From owner-svn-src-head@freebsd.org Sun Nov 1 12:53:16 2020 Return-Path: Delivered-To: svn-src-head@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 5E05344CC97; Sun, 1 Nov 2020 12:53:16 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) (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 4CPGDr0FsMz45rV; Sun, 1 Nov 2020 12:53:15 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-yb1-xb2d.google.com with SMTP id i186so9300833ybc.11; Sun, 01 Nov 2020 04:53:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=xT9Hj7vvCtNHPLnfGeGh4f1ENRu9DOOEehwiZ/RixDk=; b=HDeKKv3lAACKlWxBK/ZVKYUFoMrAr/0W+4dKubBDIQrgOfX/2qbNKbxiGWf1ZNZsdD RtatHEMNfoDz2eQB2mXqEn9NzzVjfAddlEnYTJCcLwMyMZd/cRioWP5qpmP4kPPNp0va pIVRb4gws2A9v1+/FYDrI1wbhV8ScJVArhSJp0BWSykNWJ/g571nzjHciTzyE2egIyag DBEbWYOc5WmuALjnlJnJwO0xtDWdg56+/9a9w+wK9Gf6vQHPjin1Is5YVJXSxqQpjawy CpSxG7Pg6U+V0YCAQzQqn4aigKl3DwQGkJ/brRMHXXFcG9/cuUh+Asf7DEPmCinNgK7V rkpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=xT9Hj7vvCtNHPLnfGeGh4f1ENRu9DOOEehwiZ/RixDk=; b=SAxJQDzxrdMITb6wxldSsl+/U2auYu0fcs8fNIoC0bjpyPmAP7Odl2030XW9IFy23A c3R7CzFsTNkM43ARAhqTzXx/NIQu7q/IA7UI4IUHiGryTbo56h0bnIFLb36imTVtd6qR XeoFd9awrpTlgJvdIdoOFuihGBeOuVN/WvuSuNEG2hrzmjj/H78FD+FowB3eQwu2dCYs MKpQVDk6bG+S7FZgbwrD6Z5oeWwpVsNNvEEnFyu4GmjqzGPXn+QMunCphym0XFnpJqGh 6cTjpCyVaBv0AplbKPMCKQCtICnvc5g/L20GQlJIltERtR1LCRDnLEuSnxhU3AByGQn2 kMqw== X-Gm-Message-State: AOAM533m9oaz1rXX1IGIiCk5gxvnDzSf8SHqm9r0Ae9NLOFmso49X14Z fJiXYmIPt2O/STX4//oaz6Em2qGf15TDdLBDFBw44iJ+ X-Google-Smtp-Source: ABdhPJxskoot1GQo32B5Q4VopHGPZVtLSf6GQK3Ex4SkxVp1bX1R8q5pA6C/PbYWAItCrBE1DtdXJGA6OoCwFtN5woo= X-Received: by 2002:a25:d248:: with SMTP id j69mr14511390ybg.278.1604235194833; Sun, 01 Nov 2020 04:53:14 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:d8d2:0:0:0:0:0 with HTTP; Sun, 1 Nov 2020 04:53:14 -0800 (PST) In-Reply-To: <202010312348.09VNmfWN009773@repo.freebsd.org> References: <202010312348.09VNmfWN009773@repo.freebsd.org> From: Oliver Pinter Date: Sun, 1 Nov 2020 13:53:14 +0100 Message-ID: Subject: Re: svn commit: r367243 - in head: lib/libc/gen sys/kern To: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CPGDr0FsMz45rV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 12:53:16 -0000 On Sunday, November 1, 2020, Stefan E=C3=9Fer wrote: > Author: se > Date: Sat Oct 31 23:48:41 2020 > New Revision: 367243 > URL: https://svnweb.freebsd.org/changeset/base/367243 > > Log: > Make sysctl user.local a tunable that can be written at run-time > > This sysctl value had been provided as a read-only variable that is > compiled into the C library based on the value of _PATH_LOCALBASE in > paths.h. > > After this change, the value is compiled into the kernel as an empty > string, which is translated to _PATH_LOCALBASE by the C library. > > This empty string can be overridden at boot time or by a privileged > user at run time and will then be returned by sysctl. > > When set to an empty string, the value returned by sysctl reverts to > _PATH_LOCALBASE. > > This update does not change the behavior on any system that does > not modify the default value of user.localbase. > > I consider this change as experimental and would prefer if the run-time > write permission was reconsidered and the sysctl variable defined with > CLFLAG_RDTUN instead to restrict it to be set at boot time. > > MFC after: 1 month Wouldn't be better to make this variable a per-jail variable? > > Modified: > head/lib/libc/gen/sysctl.c > head/sys/kern/kern_mib.c > > Modified: head/lib/libc/gen/sysctl.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/lib/libc/gen/sysctl.c Sat Oct 31 23:19:59 2020 (r367242) > +++ head/lib/libc/gen/sysctl.c Sat Oct 31 23:48:41 2020 (r367243) > @@ -68,14 +68,14 @@ sysctl(const int *name, u_int namelen, void *oldp, si= z > if (retval || name[0] !=3D CTL_USER) > return (retval); > > - if (newp !=3D NULL) { > - errno =3D EPERM; > - return (-1); > - } > if (namelen !=3D 2) { > errno =3D EINVAL; > return (-1); > } > + if (newp !=3D NULL && name[1] !=3D USER_LOCALBASE) { > + errno =3D EPERM; > + return (-1); > + } > > switch (name[1]) { > case USER_CS_PATH: > @@ -88,13 +88,21 @@ sysctl(const int *name, u_int namelen, void *oldp, si= z > memmove(oldp, _PATH_STDPATH, > sizeof(_PATH_STDPATH)); > return (0); > case USER_LOCALBASE: > - if (oldp !=3D NULL && orig_oldlen < sizeof(_PATH_LOCALBAS= E)) > { > - errno =3D ENOMEM; > - return (-1); > + if (oldlenp !=3D NULL) { > + if (oldp =3D=3D NULL) { > + if (*oldlenp =3D=3D 1) > + *oldlenp =3D sizeof(_PATH_LOCALBA= SE); > + } else { > + if (*oldlenp !=3D 1) > + return (retval); > + if (orig_oldlen < sizeof(_PATH_LOCALBASE)= ) > { > + errno =3D ENOMEM; > + return (-1); > + } > + *oldlenp =3D sizeof(_PATH_LOCALBASE); > + memmove(oldp, _PATH_LOCALBASE, > sizeof(_PATH_LOCALBASE)); > + } > } > - *oldlenp =3D sizeof(_PATH_LOCALBASE); > - if (oldp !=3D NULL) > - memmove(oldp, _PATH_LOCALBASE, > sizeof(_PATH_LOCALBASE)); > return (0); > } > > > Modified: head/sys/kern/kern_mib.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/sys/kern/kern_mib.c Sat Oct 31 23:19:59 2020 (r367242) > +++ head/sys/kern/kern_mib.c Sat Oct 31 23:48:41 2020 (r367243) > @@ -652,8 +652,11 @@ SYSCTL_INT(_user, USER_STREAM_MAX, stream_max, CTLFL= AG > SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of streams a process may > have open at one time"); > SYSCTL_INT(_user, USER_TZNAME_MAX, tzname_max, CTLFLAG_RD, > SYSCTL_NULL_INT_PTR, 0, "Min Maximum number of types supported for > timezone names"); > -SYSCTL_STRING(_user, USER_LOCALBASE, localbase, CTLFLAG_RD, > - "", 0, "Prefix used to install and locate add-on packages"); > + > +static char localbase[MAXPATHLEN] =3D ""; > + > +SYSCTL_STRING(_user, USER_LOCALBASE, localbase, CTLFLAG_RWTUN, > + localbase, sizeof(localbase), "Prefix used to install and locate > add-on packages"); > > #include > SYSCTL_INT(_debug_sizeof, OID_AUTO, vnode, CTLFLAG_RD, > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Sun Nov 1 15:57:15 2020 Return-Path: Delivered-To: svn-src-head@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 44DD7451058; Sun, 1 Nov 2020 15:57:15 +0000 (UTC) (envelope-from adrian@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 4CPLK715TDz4HYX; Sun, 1 Nov 2020 15:57:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 047D51ACC2; Sun, 1 Nov 2020 15:57:15 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A1FvEc2003838; Sun, 1 Nov 2020 15:57:14 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1FvE0v003837; Sun, 1 Nov 2020 15:57:14 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202011011557.0A1FvE0v003837@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 1 Nov 2020 15:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367248 - head/usr.bin/iscsictl X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/usr.bin/iscsictl X-SVN-Commit-Revision: 367248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 15:57:15 -0000 Author: adrian Date: Sun Nov 1 15:57:14 2020 New Revision: 367248 URL: https://svnweb.freebsd.org/changeset/base/367248 Log: [iscsictl] Fix compile issues that creep up with gcc-6.4 This fixes two warnings: * double-definition of a symbol in a yacc header * Comparison of an unsigned int being >= 0; that's always going to be true. Reviewed by: imp, rscheff Differential Revision: https://reviews.freebsd.org/D27036 Modified: head/usr.bin/iscsictl/parse.y Modified: head/usr.bin/iscsictl/parse.y ============================================================================== --- head/usr.bin/iscsictl/parse.y Sun Nov 1 11:34:15 2020 (r367247) +++ head/usr.bin/iscsictl/parse.y Sun Nov 1 15:57:14 2020 (r367248) @@ -54,7 +54,6 @@ static struct conf *conf; static struct target *target; extern void yyerror(const char *); -extern int yylex(void); extern void yyrestart(FILE *); %} @@ -359,7 +358,7 @@ pcp: PCP EQUALS STR free($3); return(1); } - if (!((tmp >=0) && (tmp <= 7))) { + if (tmp > 7) { yyerror("invalid pcp value"); return(1); } From owner-svn-src-head@freebsd.org Sun Nov 1 16:25:35 2020 Return-Path: Delivered-To: svn-src-head@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 C565D45251A; Sun, 1 Nov 2020 16:25:35 +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 4CPLxq4rHrz4KBg; Sun, 1 Nov 2020 16:25:35 +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 8AF411B5F1; Sun, 1 Nov 2020 16:25:35 +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 0A1GPZ3d021946; Sun, 1 Nov 2020 16:25:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1GPZ0S021945; Sun, 1 Nov 2020 16:25:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011011625.0A1GPZ0S021945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Nov 2020 16:25:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367249 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367249 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 16:25:35 -0000 Author: kib Date: Sun Nov 1 16:25:35 2020 New Revision: 367249 URL: https://svnweb.freebsd.org/changeset/base/367249 Log: Cleanup of net/if_media.c: switch to ANSI C function definitions. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27034 Modified: head/sys/net/if_media.c Modified: head/sys/net/if_media.c ============================================================================== --- head/sys/net/if_media.c Sun Nov 1 15:57:14 2020 (r367248) +++ head/sys/net/if_media.c Sun Nov 1 16:25:35 2020 (r367249) @@ -85,11 +85,8 @@ static void ifmedia_printword(int); * Initialize if_media struct for a specific interface instance. */ void -ifmedia_init(ifm, dontcare_mask, change_callback, status_callback) - struct ifmedia *ifm; - int dontcare_mask; - ifm_change_cb_t change_callback; - ifm_stat_cb_t status_callback; +ifmedia_init(struct ifmedia *ifm, int dontcare_mask, + ifm_change_cb_t change_callback, ifm_stat_cb_t status_callback) { LIST_INIT(&ifm->ifm_list); @@ -101,8 +98,7 @@ ifmedia_init(ifm, dontcare_mask, change_callback, stat } void -ifmedia_removeall(ifm) - struct ifmedia *ifm; +ifmedia_removeall(struct ifmedia *ifm) { struct ifmedia_entry *entry; @@ -119,11 +115,7 @@ ifmedia_removeall(ifm) * for a specific interface instance. */ void -ifmedia_add(ifm, mword, data, aux) - struct ifmedia *ifm; - int mword; - int data; - void *aux; +ifmedia_add(struct ifmedia *ifm, int mword, int data, void *aux) { struct ifmedia_entry *entry; @@ -154,10 +146,7 @@ ifmedia_add(ifm, mword, data, aux) * supported media for a specific interface instance. */ void -ifmedia_list_add(ifm, lp, count) - struct ifmedia *ifm; - struct ifmedia_entry *lp; - int count; +ifmedia_list_add(struct ifmedia *ifm, struct ifmedia_entry *lp, int count) { int i; @@ -174,10 +163,7 @@ ifmedia_list_add(ifm, lp, count) * media-change callback. */ void -ifmedia_set(ifm, target) - struct ifmedia *ifm; - int target; - +ifmedia_set(struct ifmedia *ifm, int target) { struct ifmedia_entry *match; @@ -219,11 +205,8 @@ compat_media(int media) * Device-independent media ioctl support function. */ int -ifmedia_ioctl(ifp, ifr, ifm, cmd) - struct ifnet *ifp; - struct ifreq *ifr; - struct ifmedia *ifm; - u_long cmd; +ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, struct ifmedia *ifm, + u_long cmd) { struct ifmedia_entry *match; struct ifmediareq *ifmr = (struct ifmediareq *) ifr; @@ -344,10 +327,7 @@ ifmedia_ioctl(ifp, ifr, ifm, cmd) * */ static struct ifmedia_entry * -ifmedia_match(ifm, target, mask) - struct ifmedia *ifm; - int target; - int mask; +ifmedia_match(struct ifmedia *ifm, int target, int mask) { struct ifmedia_entry *match, *next; @@ -453,8 +433,7 @@ static const struct ifmedia_type_to_subtype ifmedia_ty * print a media word. */ static void -ifmedia_printword(ifmw) - int ifmw; +ifmedia_printword(int ifmw) { const struct ifmedia_description *desc; const struct ifmedia_type_to_subtype *ttos; From owner-svn-src-head@freebsd.org Sun Nov 1 16:30:18 2020 Return-Path: Delivered-To: svn-src-head@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 6B8C84523FB; Sun, 1 Nov 2020 16:30:18 +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 4CPM3G2Bfqz4K0J; Sun, 1 Nov 2020 16:30:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E9431B5F3; Sun, 1 Nov 2020 16:30:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A1GUISV022230; Sun, 1 Nov 2020 16:30:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1GUIsZ022229; Sun, 1 Nov 2020 16:30:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011011630.0A1GUIsZ022229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Nov 2020 16:30:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367250 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367250 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 16:30:18 -0000 Author: kib Date: Sun Nov 1 16:30:17 2020 New Revision: 367250 URL: https://svnweb.freebsd.org/changeset/base/367250 Log: Cleanup of net/if_media.c: some style. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27034 Modified: head/sys/net/if_media.c Modified: head/sys/net/if_media.c ============================================================================== --- head/sys/net/if_media.c Sun Nov 1 16:25:35 2020 (r367249) +++ head/sys/net/if_media.c Sun Nov 1 16:30:17 2020 (r367250) @@ -213,7 +213,7 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st int error = 0; if (ifp == NULL || ifr == NULL || ifm == NULL) - return(EINVAL); + return (EINVAL); switch (cmd) { /* @@ -243,10 +243,9 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st * Keep going in case the connected media changed. * Similarly, if best match changed (kernel debugger?). */ - if ((IFM_SUBTYPE(newmedia) != IFM_AUTO) && - (newmedia == ifm->ifm_media) && - (match == ifm->ifm_cur)) - return 0; + if (IFM_SUBTYPE(newmedia) != IFM_AUTO && + newmedia == ifm->ifm_media && match == ifm->ifm_cur) + return (0); /* * We found a match, now make the driver switch to it. @@ -346,7 +345,7 @@ ifmedia_match(struct ifmedia *ifm, int target, int mas } } - return match; + return (match); } /* @@ -362,7 +361,8 @@ ifmedia_baudrate(int mword) int i; for (i = 0; ifmedia_baudrate_descriptions[i].ifmb_word != 0; i++) { - if (IFM_TYPE_MATCH(mword, ifmedia_baudrate_descriptions[i].ifmb_word)) + if (IFM_TYPE_MATCH(mword, ifmedia_baudrate_descriptions[i]. + ifmb_word)) return (ifmedia_baudrate_descriptions[i].ifmb_baudrate); } From owner-svn-src-head@freebsd.org Sun Nov 1 16:36:22 2020 Return-Path: Delivered-To: svn-src-head@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 6B37145292E; Sun, 1 Nov 2020 16:36: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 4CPMBG2B5yz4KqH; Sun, 1 Nov 2020 16:36: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 2EC0E1B055; Sun, 1 Nov 2020 16:36: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 0A1GaMk1028119; Sun, 1 Nov 2020 16:36:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1GaMWC028118; Sun, 1 Nov 2020 16:36:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011011636.0A1GaMWC028118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Nov 2020 16:36:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367251 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 16:36:22 -0000 Author: kib Date: Sun Nov 1 16:36:21 2020 New Revision: 367251 URL: https://svnweb.freebsd.org/changeset/base/367251 Log: Cleanup of net/if_media.c: simplify cleanup loop in ifmedia_removeall(). Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27034 Modified: head/sys/net/if_media.c Modified: head/sys/net/if_media.c ============================================================================== --- head/sys/net/if_media.c Sun Nov 1 16:30:17 2020 (r367250) +++ head/sys/net/if_media.c Sun Nov 1 16:36:21 2020 (r367251) @@ -102,8 +102,7 @@ ifmedia_removeall(struct ifmedia *ifm) { struct ifmedia_entry *entry; - for (entry = LIST_FIRST(&ifm->ifm_list); entry; - entry = LIST_FIRST(&ifm->ifm_list)) { + while ((entry = LIST_FIRST(&ifm->ifm_list)) != NULL) { LIST_REMOVE(entry, ifm_list); free(entry, M_IFADDR); } From owner-svn-src-head@freebsd.org Sun Nov 1 16:38:31 2020 Return-Path: Delivered-To: svn-src-head@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 A2F4D4528DA; Sun, 1 Nov 2020 16:38:31 +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 4CPMDl3rHNz4KZS; Sun, 1 Nov 2020 16:38:31 +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 66C6A1B784; Sun, 1 Nov 2020 16:38:31 +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 0A1GcV7d028268; Sun, 1 Nov 2020 16:38:31 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1GcVcp028267; Sun, 1 Nov 2020 16:38:31 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011011638.0A1GcVcp028267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Nov 2020 16:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367252 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 16:38:31 -0000 Author: kib Date: Sun Nov 1 16:38:30 2020 New Revision: 367252 URL: https://svnweb.freebsd.org/changeset/base/367252 Log: net/if_media.c: improve IFMEDIA_DEBUG output. Use consistent output format for hex. Print both media and mask where relevant. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27034 Modified: head/sys/net/if_media.c Modified: head/sys/net/if_media.c ============================================================================== --- head/sys/net/if_media.c Sun Nov 1 16:36:21 2020 (r367251) +++ head/sys/net/if_media.c Sun Nov 1 16:38:30 2020 (r367252) @@ -124,7 +124,7 @@ ifmedia_add(struct ifmedia *ifm, int mword, int data, printf("ifmedia_add: null ifm\n"); return; } - printf("Adding entry for "); + printf("Adding entry for (%#010x) ", mword); ifmedia_printword(mword); } #endif @@ -229,8 +229,8 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st #ifdef IFMEDIA_DEBUG if (ifmedia_debug) { printf( - "ifmedia_ioctl: no media found for 0x%x\n", - newmedia); + "ifmedia_ioctl: no media found for %#010x mask %#010x\n", + newmedia, ifm->ifm_mask); } #endif return (ENXIO); @@ -337,7 +337,7 @@ ifmedia_match(struct ifmedia *ifm, int target, int mas #if defined(IFMEDIA_DEBUG) || defined(DIAGNOSTIC) if (match) { printf("ifmedia_match: multiple match for " - "0x%x/0x%x\n", target, mask); + "%#010x/%#010x\n", target, mask); } #endif match = next; From owner-svn-src-head@freebsd.org Sun Nov 1 17:00:59 2020 Return-Path: Delivered-To: svn-src-head@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 DE03C452F7A for ; Sun, 1 Nov 2020 17:00:59 +0000 (UTC) (envelope-from mw@semihalf.com) Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) (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 4CPMkg16Xnz4Lc8 for ; Sun, 1 Nov 2020 17:00:58 +0000 (UTC) (envelope-from mw@semihalf.com) Received: by mail-wm1-x32c.google.com with SMTP id c16so7242555wmd.2 for ; Sun, 01 Nov 2020 09:00:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=KeaGZlrCr6S576AGbESMfCFLlhySpqqS+sMFdTTUQh0=; b=trdt2VilHWmxoDrtEkjmo5JkK7lJQKqrAeaiFdlYqni2r1Cx+rnoO93G0F2kHdVqbk WogJIpJRouvRlnXYV/oG7KZ/CedEV9tUENHkzx4/fia8H3VXM2HeVXBEPzf3hn68HCu5 TVd6MDw8J/WNEbN321tC+ptJDK44Ix1nW/7RBXSL7UujlMCXoXrQdiweyBQ9z/LPWWBA H8ZV9nYGScUmOXVb8mwjO/LQqhvulv2VJejTrnkYsmjdxLY8CbUgF9oaW1EmrG6C1YxC DyvyURYN8WAQdaw6IxJ/kmaUVL1BsWvmsjb8dqffhjZt/dpIN4Kqth6u7tT3PEIPiOBo 6rmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=KeaGZlrCr6S576AGbESMfCFLlhySpqqS+sMFdTTUQh0=; b=eCVV5xqyCI9arpRuGJ9zH8zYOAutnI+Q1u8k1idABWZYL0jq7LyyHTmGskWBHorub3 Re6c1dZcT4/hxxVi28tm9GeQmQMLxamFmRTWOp+O1Y0ry2GPF7mG0xPxlDw1bSR62OW2 0yRk/9L04a2ZFMkWCkrqtr9pamh2xgf1R+JLdRTk6uXtbaNI39txvzQ/Fm2nuEKZESdW MOhaUQsdHHyQf34xMipEB1iWmd+R5cTZlXYEkfuSYbt1ncy/+itKWhJGahutvoWjV6rr iFjh4ZxuZnTKX6QRmSzYHYcucNcykopGZgSojwQFhh1jAw5Bas86IN3tNQufEU/X0fGs xilw== X-Gm-Message-State: AOAM531L0e9BuldenzofWTxRJl7XkU6NNp5j/nldNddkNawm4DXija5x SKubZI+cH8lWkEooNvA+joKy93zK0W2UzpMI1epPYg== X-Google-Smtp-Source: ABdhPJyyHI4YcRL6MC9P8iNUE3ITZTCRzsuAhk1CqBD+hlVQuAeXCORQfUD3BspFCL4SwxpqCu/R/qVanmkf6epRizM= X-Received: by 2002:a7b:cb98:: with SMTP id m24mr14141340wmi.133.1604250056463; Sun, 01 Nov 2020 09:00:56 -0800 (PST) MIME-Version: 1.0 References: <202009240717.08O7H55G090719@repo.freebsd.org> In-Reply-To: <202009240717.08O7H55G090719@repo.freebsd.org> From: Marcin Wojtas Date: Sun, 1 Nov 2020 18:00:44 +0100 Message-ID: Subject: Re: svn commit: r366106 - head/sys/arm64/arm64 To: Andrew Turner Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Artur Rojek Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4CPMkg16Xnz4Lc8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=trdt2Vil; dmarc=none; spf=none (mx1.freebsd.org: domain of mw@semihalf.com has no SPF policy when checking 2a00:1450:4864:20::32c) smtp.mailfrom=mw@semihalf.com X-Spamd-Result: default: False [-2.70 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[semihalf-com.20150623.gappssmtp.com:s=20150623]; FREEFALL_USER(0.00)[mw]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.95)[-0.950]; NEURAL_HAM_LONG(-0.99)[-0.990]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[semihalf.com]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[semihalf-com.20150623.gappssmtp.com:+]; NEURAL_HAM_SHORT(-0.46)[-0.458]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::32c:from]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 17:00:59 -0000 Hi, With this commit SDHCI fails to allocate a bounce buffer for SDMA (sdhci_dma_alloc() routine). The same behavior was observed on LS1046A and Armada 7k8k. Example log: sdhci_xenon0: mem 0x780000-0x7802ff irq 38 on simplebus3 getaddr: error 27 sdhci_xenon0-slot0: Can't load DMA memory for SDMA device_attach: sdhci_xenon0 attach returned 6 I debugged it a bit: * bus_dmamap_load returns EFBIG (error =3D 27) * The tag is created with an alignment to 128k (https://github.com/freebsd/freebsd/blob/master/sys/dev/sdhci/sdhci.c#L752) * When I set the alignment to anything =3D< PAGE_SIZE it works again: --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -749,7 +749,7 @@ sdhci_dma_alloc(struct sdhci_slot *slot) * forming the actual address of data, requiring the SDMA buffer to * be aligned to the SDMA boundary. */ - err =3D bus_dma_tag_create(bus_get_dma_tag(slot->bus), slot->sdma_b= bufsz, + err =3D bus_dma_tag_create(bus_get_dma_tag(slot->bus), PAGE_SIZE, 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, slot->sdma_bbufsz, 1, slot->sdma_bbufsz, BUS_DMA_ALLOCNOW, NULL, NULL, &slot->dmatag); I don't know if it's a valid fix though given a comment in code above (Linux however aligns DMA buffer to 512). Comments appreciated. Any reason why the huge alignment value worked before the r366106 and now it is problematic? Best regards, Marcin czw., 24 wrz 2020 o 09:17 Andrew Turner napisa=C5=82(a= ): > > Author: andrew > Date: Thu Sep 24 07:17:05 2020 > New Revision: 366106 > URL: https://svnweb.freebsd.org/changeset/base/366106 > > Log: > Bounce in more cases in the arm64 busdma > > We need to use a bounce buffer when the memory we are operating on is n= ot > aligned to a cacheline, and not aligned to the maps alignment. > > The former is to stop other threads from dirtying the cacheline while w= e > are performing DMA operations with it. The latter is to check memory > passed in by a driver is correctly aligned for the device. > > Reviewed by: mmel > Sponsored by: Innovate UK > Differential Revision: https://reviews.freebsd.org/D26496 > > Modified: > head/sys/arm64/arm64/busdma_bounce.c > > Modified: head/sys/arm64/arm64/busdma_bounce.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/sys/arm64/arm64/busdma_bounce.c Thu Sep 24 07:13:13 2020 = (r366105) > +++ head/sys/arm64/arm64/busdma_bounce.c Thu Sep 24 07:17:05 2020 = (r366106) > @@ -139,6 +139,7 @@ struct bus_dmamap { > u_int flags; > #define DMAMAP_COHERENT (1 << 0) > #define DMAMAP_FROM_DMAMEM (1 << 1) > +#define DMAMAP_MBUF (1 << 2) > int sync_count; > struct sync_list slist[]; > }; > @@ -155,8 +156,8 @@ static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, > vm_offset_t vaddr, bus_addr_t addr, bus_size_t size); > static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpa= ge); > int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr); > -static bool _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t buf, > - bus_size_t buflen, int *pagesneeded); > +static bool _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, bus_dmamap_t map= , > + vm_paddr_t buf, bus_size_t buflen, int *pagesneeded); > static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map= , > pmap_t pmap, void *buf, bus_size_t buflen, int flags); > static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, > @@ -164,20 +165,70 @@ static void _bus_dmamap_count_phys(bus_dma_tag_t dm= at, > static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t ma= p, > int flags); > > +/* > + * Return true if the DMA should bounce because the start or end does no= t fall > + * on a cacheline boundary (which would require a partial cacheline flus= h). > + * COHERENT memory doesn't trigger cacheline flushes. Memory allocated = by > + * bus_dmamem_alloc() is always aligned to cacheline boundaries, and the= re's a > + * strict rule that such memory cannot be accessed by the CPU while DMA = is in > + * progress (or by multiple DMA engines at once), so that it's always sa= fe to do > + * full cacheline flushes even if that affects memory outside the range = of a > + * given DMA operation that doesn't involve the full allocated buffer. = If we're > + * mapping an mbuf, that follows the same rules as a buffer we allocated= . > + */ > static bool > -might_bounce(bus_dma_tag_t dmat) > +cacheline_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, > + bus_size_t size) > { > > +#define DMAMAP_CACHELINE_FLAGS = \ > + (DMAMAP_FROM_DMAMEM | DMAMAP_COHERENT | DMAMAP_MBUF) > + if ((dmat->bounce_flags & BF_COHERENT) !=3D 0) > + return (false); > + if (map !=3D NULL && (map->flags & DMAMAP_CACHELINE_FLAGS) !=3D 0= ) > + return (false); > + return (((paddr | size) & (dcache_line_size - 1)) !=3D 0); > +#undef DMAMAP_CACHELINE_FLAGS > +} > + > +/* > + * Return true if the given address does not fall on the alignment bound= ary. > + */ > +static bool > +alignment_bounce(bus_dma_tag_t dmat, bus_addr_t addr) > +{ > + > + return ((addr & (dmat->common.alignment - 1)) !=3D 0); > +} > + > +static bool > +might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, > + bus_size_t size) > +{ > + > if ((dmat->bounce_flags & BF_COULD_BOUNCE) !=3D 0) > return (true); > > + if (cacheline_bounce(dmat, map, paddr, size)) > + return (true); > + > + if (alignment_bounce(dmat, paddr)) > + return (true); > + > return (false); > } > > static bool > -must_bounce(bus_dma_tag_t dmat, bus_addr_t paddr) > +must_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t paddr, > + bus_size_t size) > { > > + if (cacheline_bounce(dmat, map, paddr, size)) > + return (true); > + > + if (alignment_bounce(dmat, paddr)) > + return (true); > + > if ((dmat->bounce_flags & BF_COULD_BOUNCE) !=3D 0 && > bus_dma_run_filter(&dmat->common, paddr)) > return (true); > @@ -240,8 +291,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_s= i > newtag->common.alignment > 1) > newtag->bounce_flags |=3D BF_COULD_BOUNCE; > > - if (((newtag->bounce_flags & BF_COULD_BOUNCE) !=3D 0) && > - (flags & BUS_DMA_ALLOCNOW) !=3D 0) { > + if ((flags & BUS_DMA_ALLOCNOW) !=3D 0) { > struct bounce_zone *bz; > > /* Must bounce */ > @@ -315,9 +365,9 @@ static bool > bounce_bus_dma_id_mapped(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t = buflen) > { > > - if (!might_bounce(dmat)) > + if (!might_bounce(dmat, NULL, buf, buflen)) > return (true); > - return (!_bus_dmamap_pagesneeded(dmat, buf, buflen, NULL)); > + return (!_bus_dmamap_pagesneeded(dmat, NULL, buf, buflen, NULL)); > } > > static bus_dmamap_t > @@ -373,43 +423,39 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int fl= ags > * exclusion region, a data alignment that is stricter than 1, an= d/or > * an active address boundary. > */ > - if (dmat->bounce_flags & BF_COULD_BOUNCE) { > - /* Must bounce */ > - if (dmat->bounce_zone =3D=3D NULL) { > - if ((error =3D alloc_bounce_zone(dmat)) !=3D 0) { > - free(*mapp, M_DEVBUF); > - return (error); > - } > + if (dmat->bounce_zone =3D=3D NULL) { > + if ((error =3D alloc_bounce_zone(dmat)) !=3D 0) { > + free(*mapp, M_DEVBUF); > + return (error); > } > - bz =3D dmat->bounce_zone; > + } > + bz =3D dmat->bounce_zone; > > - /* > - * Attempt to add pages to our pool on a per-instance > - * basis up to a sane limit. > - */ > - if (dmat->common.alignment > 1) > - maxpages =3D MAX_BPAGES; > - else > - maxpages =3D MIN(MAX_BPAGES, Maxmem - > - atop(dmat->common.lowaddr)); > - if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP) =3D=3D 0 || > - (bz->map_count > 0 && bz->total_bpages < maxpages)) { > - pages =3D MAX(atop(dmat->common.maxsize), 1); > - pages =3D MIN(maxpages - bz->total_bpages, pages)= ; > - pages =3D MAX(pages, 1); > - if (alloc_bounce_pages(dmat, pages) < pages) > - error =3D ENOMEM; > - if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP) > - =3D=3D 0) { > - if (error =3D=3D 0) { > - dmat->bounce_flags |=3D > - BF_MIN_ALLOC_COMP; > - } > - } else > - error =3D 0; > - } > - bz->map_count++; > + /* > + * Attempt to add pages to our pool on a per-instance > + * basis up to a sane limit. > + */ > + if (dmat->common.alignment > 1) > + maxpages =3D MAX_BPAGES; > + else > + maxpages =3D MIN(MAX_BPAGES, Maxmem - > + atop(dmat->common.lowaddr)); > + if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP) =3D=3D 0 || > + (bz->map_count > 0 && bz->total_bpages < maxpages)) { > + pages =3D MAX(atop(dmat->common.maxsize), 1); > + pages =3D MIN(maxpages - bz->total_bpages, pages); > + pages =3D MAX(pages, 1); > + if (alloc_bounce_pages(dmat, pages) < pages) > + error =3D ENOMEM; > + if ((dmat->bounce_flags & BF_MIN_ALLOC_COMP) =3D=3D 0) { > + if (error =3D=3D 0) { > + dmat->bounce_flags |=3D BF_MIN_ALLOC_COMP= ; > + } > + } else > + error =3D 0; > } > + bz->map_count++; > + > if (error =3D=3D 0) { > dmat->map_count++; > if ((dmat->bounce_flags & BF_COHERENT) !=3D 0) > @@ -595,8 +641,8 @@ bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vadd= r > } > > static bool > -_bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t b= uflen, > - int *pagesneeded) > +_bus_dmamap_pagesneeded(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t= buf, > + bus_size_t buflen, int *pagesneeded) > { > bus_addr_t curaddr; > bus_size_t sgsize; > @@ -610,7 +656,7 @@ _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_= t > curaddr =3D buf; > while (buflen !=3D 0) { > sgsize =3D MIN(buflen, dmat->common.maxsegsz); > - if (must_bounce(dmat, curaddr)) { > + if (must_bounce(dmat, map, curaddr, sgsize)) { > sgsize =3D MIN(sgsize, > PAGE_SIZE - (curaddr & PAGE_MASK)); > if (pagesneeded =3D=3D NULL) > @@ -632,7 +678,8 @@ _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap= _ > { > > if (map->pagesneeded =3D=3D 0) { > - _bus_dmamap_pagesneeded(dmat, buf, buflen, &map->pagesnee= ded); > + _bus_dmamap_pagesneeded(dmat, map, buf, buflen, > + &map->pagesneeded); > CTR1(KTR_BUSDMA, "pagesneeded=3D %d\n", map->pagesneeded)= ; > } > } > @@ -666,7 +713,9 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmama= p > paddr =3D pmap_kextract(vaddr); > else > paddr =3D pmap_extract(pmap, vaddr); > - if (must_bounce(dmat, paddr)) { > + if (must_bounce(dmat, map, paddr, > + min(vendaddr - vaddr, (PAGE_SIZE - ((vm_offse= t_t)vaddr & > + PAGE_MASK)))) !=3D 0) { > sg_len =3D roundup2(sg_len, > dmat->common.alignment); > map->pagesneeded++; > @@ -764,7 +813,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_d= m > if (segs =3D=3D NULL) > segs =3D dmat->segments; > > - if (might_bounce(dmat)) { > + if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { > _bus_dmamap_count_phys(dmat, map, buf, buflen, flags); > if (map->pagesneeded !=3D 0) { > error =3D _bus_dmamap_reserve_pages(dmat, map, fl= ags); > @@ -779,7 +828,8 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_d= m > while (buflen > 0) { > curaddr =3D buf; > sgsize =3D MIN(buflen, dmat->common.maxsegsz); > - if (map->pagesneeded !=3D 0 && must_bounce(dmat, curaddr)= ) { > + if (map->pagesneeded !=3D 0 && > + must_bounce(dmat, map, curaddr, sgsize)) { > sgsize =3D MIN(sgsize, PAGE_SIZE - (curaddr & PAG= E_MASK)); > curaddr =3D add_bounce_page(dmat, map, 0, curaddr= , > sgsize); > @@ -833,7 +883,10 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bu= s_ > if (segs =3D=3D NULL) > segs =3D dmat->segments; > > - if (might_bounce(dmat)) { > + if (flags & BUS_DMA_LOAD_MBUF) > + map->flags |=3D DMAMAP_MBUF; > + > + if (might_bounce(dmat, map, (bus_addr_t)buf, buflen)) { > _bus_dmamap_count_pages(dmat, map, pmap, buf, buflen, fla= gs); > if (map->pagesneeded !=3D 0) { > error =3D _bus_dmamap_reserve_pages(dmat, map, fl= ags); > @@ -864,7 +917,8 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus= _ > */ > max_sgsize =3D MIN(buflen, dmat->common.maxsegsz); > sgsize =3D PAGE_SIZE - (curaddr & PAGE_MASK); > - if (map->pagesneeded !=3D 0 && must_bounce(dmat, curaddr)= ) { > + if (map->pagesneeded !=3D 0 && > + must_bounce(dmat, map, curaddr, sgsize)) { > sgsize =3D roundup2(sgsize, dmat->common.alignmen= t); > sgsize =3D MIN(sgsize, max_sgsize); > curaddr =3D add_bounce_page(dmat, map, kvaddr, cu= raddr, > @@ -949,6 +1003,7 @@ bounce_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dma= ma > } > > map->sync_count =3D 0; > + map->flags &=3D ~DMAMAP_MBUF; > } > > static void From owner-svn-src-head@freebsd.org Sun Nov 1 17:16:32 2020 Return-Path: Delivered-To: svn-src-head@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 05979453929; Sun, 1 Nov 2020 17:16:32 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CPN4Z6r0qz4MR0; Sun, 1 Nov 2020 17:16:30 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id 0E5441A7E0; Sun, 1 Nov 2020 11:16:24 -0600 (CST) Date: Sun, 1 Nov 2020 11:16:23 -0600 (CST) From: Dan Mack X-X-Sender: mack@localhost.local To: =?ISO-8859-15?Q?Stefan_E=DFer?= cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367221 - head In-Reply-To: <202010311639.09VGdRoS043478@repo.freebsd.org> Message-ID: References: <202010311639.09VGdRoS043478@repo.freebsd.org> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 X-Rspamd-Queue-Id: 4CPN4Z6r0qz4MR0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=pass (policy=none) header.from=macktronics.com; spf=pass (mx1.freebsd.org: domain of mack@macktronics.com designates 209.181.253.65 as permitted sender) smtp.mailfrom=mack@macktronics.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.985]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; R_SPF_ALLOW(-0.20)[+ip4:209.181.253.64/29]; NEURAL_HAM_LONG(-1.07)[-1.068]; NEURAL_HAM_SHORT(-0.65)[-0.647]; CTYPE_MIXED_BOGUS(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[macktronics.com,none]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; ASN(0.00)[asn:209, ipnet:209.181.252.0/23, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 8BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 17:16:32 -0000 Are lines 29 and 36 in /usr/src/UPDATING supposed to be 2020.... or is the 2010.... correct ? ebf6d80bc3db (se 2020-10-31 16:39:27 +0000 29) 20101030: .... a187ea2ff625 (imp 2020-10-26 03:26:18 +0000 36) 20101026: Dan On Sat, 31 Oct 2020, Stefan Eßer wrote: > Author: se > Date: Sat Oct 31 16:39:27 2020 > New Revision: 367221 > URL: https://svnweb.freebsd.org/changeset/base/367221 > > Log: > Mention the more strict consistency checks performed by calendar(), which > can make the program abort with an error message on previously accepted > but malformed input files. > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Sat Oct 31 16:24:11 2020 (r367220) > +++ head/UPDATING Sat Oct 31 16:39:27 2020 (r367221) > @@ -26,6 +26,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > world, or to merely disable the most expensive debugging functionality > at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20101030: > + The internal pre-processor in the calendar(1) program has been > + extended to support more C pre-processor commands (e.g. #ifdef, #else, > + and #undef) and to detect unbalanced conditional statements. > + Error messages have been extended to include the filename and line > + number if processing stops to help fixing malformed data files. > + > 20101026: > All the data files for the calendar(1) program, except calendar.freebsd, > have been moved to the deskutils/calendar-data port, much like the > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > From owner-svn-src-head@freebsd.org Sun Nov 1 17:27:49 2020 Return-Path: Delivered-To: svn-src-head@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 4795C453BD0; Sun, 1 Nov 2020 17:27:49 +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 4CPNKd18G9z4N70; Sun, 1 Nov 2020 17:27:49 +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 0A5C11BDE6; Sun, 1 Nov 2020 17:27:49 +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 0A1HRmmg058996; Sun, 1 Nov 2020 17:27:48 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1HRm6h058995; Sun, 1 Nov 2020 17:27:48 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011011727.0A1HRm6h058995@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: Sun, 1 Nov 2020 17:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367253 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 367253 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 17:27:49 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 1 17:27:48 2020 New Revision: 367253 URL: https://svnweb.freebsd.org/changeset/base/367253 Log: Document how to use sudo for SU_CMD It is rather common for the ports users to replace su(1) with sudo(8) within the SU_CMD variable. Let's document it in the manual page (so far it's been hidden in a comment within bsd.commands.mk). MFC after: 2 weeks Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Sun Nov 1 16:38:30 2020 (r367252) +++ head/share/man/man7/ports.7 Sun Nov 1 17:27:48 2020 (r367253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 3, 2020 +.Dd November 1, 2020 .Dt PORTS 7 .Os .Sh NAME @@ -442,7 +442,10 @@ The unprivileged user must have write access to and .Va DISTDIR . The default is -.Ql /usr/bin/su root -c +.Ql /usr/bin/su root -c . +Many users set it to +.Ql /usr/local/bin/sudo -E sh -c +for convenience. .It Va PACKAGES Used only for the .Cm package From owner-svn-src-head@freebsd.org Sun Nov 1 19:13:56 2020 Return-Path: Delivered-To: svn-src-head@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 1D9C845754C; Sun, 1 Nov 2020 19:13:56 +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 4CPQh373Nxz4Tlb; Sun, 1 Nov 2020 19:13:55 +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 D55F01D121; Sun, 1 Nov 2020 19:13:55 +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 0A1JDtBg026404; Sun, 1 Nov 2020 19:13:55 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1JDtv7026403; Sun, 1 Nov 2020 19:13:55 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011011913.0A1JDtv7026403@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, 1 Nov 2020 19:13:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367254 - head X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 19:13:56 -0000 Author: se Date: Sun Nov 1 19:13:55 2020 New Revision: 367254 URL: https://svnweb.freebsd.org/changeset/base/367254 Log: Fix year in 2 most recent entries (2010 -> 2020) Reported by: mack@macktronics.com (Dan Mack) Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Sun Nov 1 17:27:48 2020 (r367253) +++ head/UPDATING Sun Nov 1 19:13:55 2020 (r367254) @@ -26,14 +26,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) -20101030: +20201030: The internal pre-processor in the calendar(1) program has been extended to support more C pre-processor commands (e.g. #ifdef, #else, and #undef) and to detect unbalanced conditional statements. Error messages have been extended to include the filename and line number if processing stops to help fixing malformed data files. -20101026: +20201026: All the data files for the calendar(1) program, except calendar.freebsd, have been moved to the deskutils/calendar-data port, much like the jewish calendar entries were moved to deskutils/hebcal years ago. After From owner-svn-src-head@freebsd.org Sun Nov 1 19:15:49 2020 Return-Path: Delivered-To: svn-src-head@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 62DCC457566; Sun, 1 Nov 2020 19:15:49 +0000 (UTC) (envelope-from se@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 4CPQkF1yrZz4Td5; Sun, 1 Nov 2020 19:15:49 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f0bbc00093238cf260616f7.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:932:38cf:2606:16f7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 833FE261DC; Sun, 1 Nov 2020 19:15:48 +0000 (UTC) (envelope-from se@freebsd.org) To: Dan Mack Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010311639.09VGdRoS043478@repo.freebsd.org> From: Stefan Esser Subject: Re: svn commit: r367221 - head Message-ID: Date: Sun, 1 Nov 2020 20:15:46 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="1gBDX374q3GpvwemOBJPYIaYrKm7H9jgS" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 19:15:49 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --1gBDX374q3GpvwemOBJPYIaYrKm7H9jgS Content-Type: multipart/mixed; boundary="fSMo0Up3tZNst1PHeIzIHHfFBbCPwbJZF"; protected-headers="v1" From: Stefan Esser To: Dan Mack Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r367221 - head References: <202010311639.09VGdRoS043478@repo.freebsd.org> In-Reply-To: --fSMo0Up3tZNst1PHeIzIHHfFBbCPwbJZF Content-Type: multipart/mixed; boundary="------------F5131E701D91B1D42E7C03CF" Content-Language: en-US This is a multi-part message in MIME format. --------------F5131E701D91B1D42E7C03CF Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: quoted-printable Am 01.11.20 um 18:16 schrieb Dan Mack: > Are lines 29 and 36 in /usr/src/UPDATING supposed to be 2020.... or is = > the 2010.... correct ? Fixed in SVN rev. r367254 Thanks for spotting this error! Regards, STefan --------------F5131E701D91B1D42E7C03CF-- --fSMo0Up3tZNst1PHeIzIHHfFBbCPwbJZF-- --1gBDX374q3GpvwemOBJPYIaYrKm7H9jgS Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+fCWIFAwAAAAAACgkQR+u171r99UTO 7wgAzC9B/EQtxRjz1Mzo3o9vL7GYf+FvD8Eh0+0vL6tcpbikxrliUkrubDLgxcLZYJahuH8JCVY+ 93C+wvKUk1KYKwYWGJRirQ436HqaX37BpVx11rXL0zEvGUvILM3I23V2EEj8p0+hXoaLF2HtSXM+ zzYlt2InWTdroCcTTUbwejYWZtU3XYnbofcleLDNyx56WEUE/tt7/TfIE7WYG63XB7zE+kiBAKZy T9tUGCRA+AzoTkW1OU5Xsj65/84dZvCVdDqv6cKtt3nfcJr2BI7bDzu1HvuV9tq2WwAq4DXFkGgg /3xnQCo2VI1GSnuS6n4PWDf/ZSnRI6SW8ly8ZJ6dZQ== =jFl4 -----END PGP SIGNATURE----- --1gBDX374q3GpvwemOBJPYIaYrKm7H9jgS-- From owner-svn-src-head@freebsd.org Sun Nov 1 20:38:35 2020 Return-Path: Delivered-To: svn-src-head@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 D60EE45946E; Sun, 1 Nov 2020 20:38:35 +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 4CPSYl5619z4YrC; Sun, 1 Nov 2020 20:38:35 +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 8E3A21E296; Sun, 1 Nov 2020 20:38:35 +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 0A1KcZYJ076168; Sun, 1 Nov 2020 20:38:35 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1KcZQv076167; Sun, 1 Nov 2020 20:38:35 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011012038.0A1KcZQv076167@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, 1 Nov 2020 20:38:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367255 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 367255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 20:38:35 -0000 Author: se Date: Sun Nov 1 20:38:35 2020 New Revision: 367255 URL: https://svnweb.freebsd.org/changeset/base/367255 Log: Fix psoition reporting for calendar data file in system directory MFC after: 3 days Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Sun Nov 1 19:13:55 2020 (r367254) +++ head/usr.bin/calendar/io.c Sun Nov 1 20:38:35 2020 (r367255) @@ -147,10 +147,22 @@ cal_fopen(const char *file) return (NULL); } +static char* +cal_path(void) +{ + static char buffer[MAXPATHLEN + 10]; + + if (cal_dir[0] == '/') + snprintf(buffer, sizeof(buffer), "%s/%s", cal_dir, cal_file); + else + snprintf(buffer, sizeof(buffer), "%s/%s/%s", cal_home, cal_dir, cal_file); + return (buffer); +} + #define WARN0(format) \ - warnx(format " in %s/%s/%s line %d", cal_home, cal_dir, cal_file, cal_line) + warnx(format " in %s line %d", cal_path(), cal_line) #define WARN1(format, arg1) \ - warnx(format " in %s/%s/%s line %d", arg1, cal_home, cal_dir, cal_file, cal_line) + warnx(format " in %s line %d", arg1, cal_path(), cal_line) static int token(char *line, FILE *out, int *skip, int *unskip) From owner-svn-src-head@freebsd.org Sun Nov 1 20:54:03 2020 Return-Path: Delivered-To: svn-src-head@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 AE703459978; Sun, 1 Nov 2020 20:54:03 +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 4CPSvb42wSz4ZnR; Sun, 1 Nov 2020 20:54:03 +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 6E1B01E2DE; Sun, 1 Nov 2020 20:54:03 +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 0A1Ks3KC088555; Sun, 1 Nov 2020 20:54:03 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1Ks3B6088554; Sun, 1 Nov 2020 20:54:03 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011012054.0A1Ks3B6088554@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: Sun, 1 Nov 2020 20:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367256 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 367256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 20:54:03 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 1 20:54:02 2020 New Revision: 367256 URL: https://svnweb.freebsd.org/changeset/base/367256 Log: Do not document default locations of the OpenBSD and NetBSD ports trees Our own Ports Collection is not targeting those systems at the moment, so let's stop documenting bits specific to OpenBSD and NetBSD in the ports documentation. Especially, that it might bit rot one day. MFC after: 1 week Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Sun Nov 1 20:38:35 2020 (r367255) +++ head/share/man/man7/ports.7 Sun Nov 1 20:54:02 2020 (r367256) @@ -417,14 +417,7 @@ You can change all of these. Location of the ports tree. This is .Pa /usr/ports -on -.Fx -and -.Ox , -and -.Pa /usr/pkgsrc -on -.Nx . +by default. .It Va WRKDIRPREFIX Where to create any temporary files. Useful if From owner-svn-src-head@freebsd.org Sun Nov 1 21:18:22 2020 Return-Path: Delivered-To: svn-src-head@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 97C0045B534; Sun, 1 Nov 2020 21:18:22 +0000 (UTC) (envelope-from adrian@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 4CPTRf3SWbz4d9w; Sun, 1 Nov 2020 21:18:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59E221ED19; Sun, 1 Nov 2020 21:18:22 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A1LIMnN001776; Sun, 1 Nov 2020 21:18:22 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1LIMpE001775; Sun, 1 Nov 2020 21:18:22 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202011012118.0A1LIMpE001775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sun, 1 Nov 2020 21:18:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367257 - head/usr.sbin/ctld X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/usr.sbin/ctld X-SVN-Commit-Revision: 367257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 21:18:22 -0000 Author: adrian Date: Sun Nov 1 21:18:21 2020 New Revision: 367257 URL: https://svnweb.freebsd.org/changeset/base/367257 Log: [ctld] Fix compilation under gcc-6.4 * remove dup yylex symbol; already defined in a header file * uint64_t is always >= 0 Reviewed by: cem, imp Differential Revision: https://reviews.freebsd.org/D27046 Modified: head/usr.sbin/ctld/parse.y Modified: head/usr.sbin/ctld/parse.y ============================================================================== --- head/usr.sbin/ctld/parse.y Sun Nov 1 20:54:02 2020 (r367256) +++ head/usr.sbin/ctld/parse.y Sun Nov 1 21:18:21 2020 (r367257) @@ -54,7 +54,6 @@ static struct target *target = NULL; static struct lun *lun = NULL; extern void yyerror(const char *); -extern int yylex(void); extern void yyrestart(FILE *); %} @@ -522,7 +521,7 @@ portal_group_pcp: PCP STR free($2); return (1); } - if (!((tmp >= 0) && (tmp <= 7))) { + if (tmp > 7) { yyerror("invalid pcp value"); free($2); return (1); From owner-svn-src-head@freebsd.org Sun Nov 1 22:46:44 2020 Return-Path: Delivered-To: svn-src-head@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 2DD4445D32B; Sun, 1 Nov 2020 22:46:44 +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 4CPWPc0MpQz3Tch; Sun, 1 Nov 2020 22:46:44 +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 E3F8C1FCAA; Sun, 1 Nov 2020 22:46:43 +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 0A1Mkhpm057239; Sun, 1 Nov 2020 22:46:43 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1MkhxS057238; Sun, 1 Nov 2020 22:46:43 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011012246.0A1MkhxS057238@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: Sun, 1 Nov 2020 22:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367258 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 367258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 22:46:44 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 1 22:46:43 2020 New Revision: 367258 URL: https://svnweb.freebsd.org/changeset/base/367258 Log: Remove Tn macros from ifconfig.8 MFC after: 3 days Modified: head/sbin/ifconfig/ifconfig.8 Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Sun Nov 1 21:18:21 2020 (r367257) +++ head/sbin/ifconfig/ifconfig.8 Sun Nov 1 22:46:43 2020 (r367258) @@ -92,15 +92,11 @@ or other operating parameters. The following options are available: .Bl -tag -width indent .It Ar address -For the -.Tn DARPA Ns -Internet -family, +For the DARPA-Internet family, the address is either a host name present in the host name data base, .Xr hosts 5 , -or a -.Tn DARPA -Internet address expressed in the Internet standard +or a DARPA Internet address expressed in the Internet standard .Dq dot notation . .Pp It is also possible to use the CIDR notation (also known as the @@ -131,9 +127,7 @@ parameter below for more information. .\" (Ethernet, FDDI, and Token Ring) interfaces, .\" which use the hardware physical address, .\" and on interfaces other than the first. -.\" For the -.\" .Tn ISO -.\" family, addresses are specified as a long hexadecimal string, +.\" For the ISO family, addresses are specified as a long hexadecimal string, .\" as in the Xerox family. .\" However, two consecutive dots imply a zero .\" byte, and the dots are optional, if the user wishes to (carefully) @@ -320,12 +314,8 @@ Enable the use of the Address Resolution Protocol .Pq Xr arp 4 in mapping between network level addresses and link level addresses (default). -This is currently implemented for mapping between -.Tn DARPA -Internet -addresses and -.Tn IEEE -802 48-bit MAC addresses (Ethernet, FDDI, and Token Ring addresses). +This is currently implemented for mapping between DARPA Internet addresses +and IEEE 802 48-bit MAC addresses (Ethernet, FDDI, and Token Ring addresses). .It Fl arp Disable the use of the Address Resolution Protocol .Pq Xr arp 4 . @@ -425,8 +415,7 @@ of the interface to Some interfaces support the mutually exclusive use of one of several different physical media connectors. For example, a 10Mbit/s Ethernet -interface might support the use of either -.Tn AUI +interface might support the use of either AUI or twisted pair connectors. Setting the media type to .Cm 10base5/AUI @@ -596,7 +585,7 @@ Note that this must be configured on a physical interf not on a .Xr vlan 4 interface itself. -.It Fl vlanmtu , vlanhwtag, vlanhwfilter, vlanhwtso +.It Fl vlanmtu , vlanhwtag , vlanhwfilter , vlanhwtso If the driver offers user-configurable VLAN support, disable reception of extended frames, tag processing in hardware, frame filtering in hardware, or TSO on VLAN, @@ -652,16 +641,12 @@ Destroy the specified network pseudo-device. Another name for the .Cm create parameter. -Included for -.Tn Solaris -compatibility. +Included for Solaris compatibility. .It Cm unplumb Another name for the .Cm destroy parameter. -Included for -.Tn Solaris -compatibility. +Included for Solaris compatibility. .It Cm metric Ar n Set the routing metric of the interface to .Ar n , @@ -1981,9 +1966,7 @@ string or as a string of hexadecimal digits preceded b .Ql 0x . For maximum portability, hex keys are recommended; the mapping of text keys to WEP encryption is usually driver-specific. -In particular, the -.Tn Windows -drivers do this mapping differently to +In particular, the Windows drivers do this mapping differently to .Fx . A key may be cleared by setting it to .Ql - . From owner-svn-src-head@freebsd.org Sun Nov 1 22:50:22 2020 Return-Path: Delivered-To: svn-src-head@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 6C0F345D78A; Sun, 1 Nov 2020 22:50:22 +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 4CPWTp2Dh2z3Tbp; Sun, 1 Nov 2020 22:50:22 +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 2FEDB1FB5B; Sun, 1 Nov 2020 22:50:22 +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 0A1MoMsf057465; Sun, 1 Nov 2020 22:50:22 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A1MoMFs057464; Sun, 1 Nov 2020 22:50:22 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011012250.0A1MoMFs057464@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: Sun, 1 Nov 2020 22:50:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367259 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 367259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Nov 2020 22:50:22 -0000 Author: 0mp (doc,ports committer) Date: Sun Nov 1 22:50:21 2020 New Revision: 367259 URL: https://svnweb.freebsd.org/changeset/base/367259 Log: ifconfig.8: Improve formatting of -f in synopsis MFC after: 3 days Modified: head/sbin/ifconfig/ifconfig.8 Modified: head/sbin/ifconfig/ifconfig.8 ============================================================================== --- head/sbin/ifconfig/ifconfig.8 Sun Nov 1 22:46:43 2020 (r367258) +++ head/sbin/ifconfig/ifconfig.8 Sun Nov 1 22:50:21 2020 (r367259) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd October 28, 2020 +.Dd November 1, 2020 .Dt IFCONFIG 8 .Os .Sh NAME @@ -36,7 +36,7 @@ .Nd configure network interface parameters .Sh SYNOPSIS .Nm -.Op Fl f Ar type:format Ns Op Ar ,type:format +.Op Fl f Ar type Ns Cm \&: Ns Ar format Ns Op Cm \&, Ns Ar type Ns Cm \& : Ns Ar format ... .Op Fl L .Op Fl k .Op Fl m From owner-svn-src-head@freebsd.org Mon Nov 2 01:01:42 2020 Return-Path: Delivered-To: svn-src-head@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 6AB9E3F112E; Mon, 2 Nov 2020 01:01:42 +0000 (UTC) (envelope-from mav@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 4CPZPL284Qz3cSp; Mon, 2 Nov 2020 01:01:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DB1A216AA; Mon, 2 Nov 2020 01:01:42 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A211g1C044037; Mon, 2 Nov 2020 01:01:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A211fqW044035; Mon, 2 Nov 2020 01:01:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011020101.0A211fqW044035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 2 Nov 2020 01:01:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367261 - in head/sys: cam dev/ahci dev/siis X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: cam dev/ahci dev/siis X-SVN-Commit-Revision: 367261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 01:01:42 -0000 Author: mav Date: Mon Nov 2 01:01:41 2020 New Revision: 367261 URL: https://svnweb.freebsd.org/changeset/base/367261 Log: Add icc (Isochronous Command Completion) ccb_ataio field. MFC after: 1 week Modified: head/sys/cam/cam_ccb.h head/sys/dev/ahci/ahci.c head/sys/dev/siis/siis.c Modified: head/sys/cam/cam_ccb.h ============================================================================== --- head/sys/cam/cam_ccb.h Mon Nov 2 00:45:40 2020 (r367260) +++ head/sys/cam/cam_ccb.h Mon Nov 2 01:01:41 2020 (r367261) @@ -786,6 +786,8 @@ struct ccb_ataio { u_int32_t resid; /* Transfer residual length: 2's comp */ u_int8_t ata_flags; /* Flags for the rest of the buffer */ #define ATA_FLAG_AUX 0x1 +#define ATA_FLAG_ICC 0x2 + uint8_t icc; /* Isochronous Command Completion */ uint32_t aux; uint32_t unused; }; Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Mon Nov 2 00:45:40 2020 (r367260) +++ head/sys/dev/ahci/ahci.c Mon Nov 2 01:01:41 2020 (r367261) @@ -2584,15 +2584,17 @@ ahci_setup_fis(struct ahci_channel *ch, struct ahci_cm fis[12] |= tag << 3; } fis[13] = ccb->ataio.cmd.sector_count_exp; + if (ccb->ataio.ata_flags & ATA_FLAG_ICC) + fis[14] = ccb->ataio.icc; fis[15] = ATA_A_4BIT; + if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { + fis[16] = ccb->ataio.aux & 0xff; + fis[17] = (ccb->ataio.aux >> 8) & 0xff; + fis[18] = (ccb->ataio.aux >> 16) & 0xff; + fis[19] = (ccb->ataio.aux >> 24) & 0xff; + } } else { fis[15] = ccb->ataio.cmd.control; - } - if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { - fis[16] = ccb->ataio.aux & 0xff; - fis[17] = (ccb->ataio.aux >> 8) & 0xff; - fis[18] = (ccb->ataio.aux >> 16) & 0xff; - fis[19] = (ccb->ataio.aux >> 24) & 0xff; } return (20); } Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Mon Nov 2 00:45:40 2020 (r367260) +++ head/sys/dev/siis/siis.c Mon Nov 2 01:01:41 2020 (r367261) @@ -1729,6 +1729,8 @@ siis_setup_fis(device_t dev, struct siis_cmd *ctp, uni fis[12] |= tag << 3; } fis[13] = ccb->ataio.cmd.sector_count_exp; + if (ccb->ataio.ata_flags & ATA_FLAG_ICC) + fis[14] = ccb->ataio.icc; fis[15] = ATA_A_4BIT; if (ccb->ataio.ata_flags & ATA_FLAG_AUX) { fis[16] = ccb->ataio.aux & 0xff; From owner-svn-src-head@freebsd.org Mon Nov 2 06:16:12 2020 Return-Path: Delivered-To: svn-src-head@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 4461F3F68E7; Mon, 2 Nov 2020 06:16:12 +0000 (UTC) (envelope-from cem@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 4CPjND12Lpz45ms; Mon, 2 Nov 2020 06:16:12 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 06DA92506D; Mon, 2 Nov 2020 06:16:12 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A26GB7V034208; Mon, 2 Nov 2020 06:16:11 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A26GB7c034207; Mon, 2 Nov 2020 06:16:11 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011020616.0A26GB7c034207@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 2 Nov 2020 06:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367267 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 06:16:12 -0000 Author: cem Date: Mon Nov 2 06:16:11 2020 New Revision: 367267 URL: https://svnweb.freebsd.org/changeset/base/367267 Log: linux(4): Disambiguate identical ioctl errors in distinct paths And stop truncating the full ioctl number in the error message. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D27048 Modified: head/sys/compat/linux/linux_ioctl.c Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Mon Nov 2 01:34:58 2020 (r367266) +++ head/sys/compat/linux/linux_ioctl.c Mon Nov 2 06:16:11 2020 (r367267) @@ -275,8 +275,8 @@ linux_ioctl_hdio(struct thread *td, struct linux_ioctl default: /* XXX */ linux_msg(td, - "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented", - args->fd, (int)(args->cmd & 0xffff), + "%s fd=%d, cmd=0x%x ('%c',%d) is not implemented", + __func__, args->fd, args->cmd, (int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff)); break; @@ -3670,8 +3670,8 @@ linux_ioctl_fallback(struct thread *td, struct linux_i return (ENOTSUP); default: - linux_msg(td, "ioctl fd=%d, cmd=0x%x ('%c',%d) is not implemented", - args->fd, (int)(args->cmd & 0xffff), + linux_msg(td, "%s fd=%d, cmd=0x%x ('%c',%d) is not implemented", + __func__, args->fd, args->cmd, (int)(args->cmd & 0xff00) >> 8, (int)(args->cmd & 0xff)); break; } From owner-svn-src-head@freebsd.org Mon Nov 2 08:26:20 2020 Return-Path: Delivered-To: svn-src-head@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 77FC744A1B1; Mon, 2 Nov 2020 08:26:20 +0000 (UTC) (envelope-from mmel@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 4CPmGN2bNVz4FP9; Mon, 2 Nov 2020 08:26:20 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 3BB6A268E9; Mon, 2 Nov 2020 08:26:20 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A28QKSw014119; Mon, 2 Nov 2020 08:26:20 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A28QKga014118; Mon, 2 Nov 2020 08:26:20 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011020826.0A28QKga014118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 2 Nov 2020 08:26:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367268 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 367268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 08:26:20 -0000 Author: mmel Date: Mon Nov 2 08:26:19 2020 New Revision: 367268 URL: https://svnweb.freebsd.org/changeset/base/367268 Log: Improve loading of multipage aligned buffers. The multipage alignment requirements is incompatible with many aspects of actual busdma code. Multi-page alignment requests are incompatible with many aspects of current busdma code. Mainly with partially bounced buffer segments and per-page loop in bus_dmamap_load_buffer(). Because proper implementation would be a major restructuring of the code, add the fix only for already known uses and do KASSERT for all other cases. For this reason, bus_dmamap_load_buffer () should take the memory allocated by bus_dmam_alloc () as one segment bypassing per page segmentation. We can do this because it is guaranteed that the memory is physically continuous. Reviewed by: bz Tested by: imp, mv, daniel.engberg.lists_pyret.net, kjopek_gmail.com Differential Revision: https://reviews.freebsd.org/D26735 Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- head/sys/arm64/arm64/busdma_bounce.c Mon Nov 2 06:16:11 2020 (r367267) +++ head/sys/arm64/arm64/busdma_bounce.c Mon Nov 2 08:26:19 2020 (r367268) @@ -501,13 +501,6 @@ static int bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, bus_dmamap_t *mapp) { - /* - * XXX ARM64TODO: - * This bus_dma implementation requires IO-Coherent architecutre. - * If IO-Coherency is not guaranteed, the BUS_DMA_COHERENT flag has - * to be implented using non-cacheable memory. - */ - vm_memattr_t attr; int mflags; @@ -830,7 +823,19 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm sgsize = MIN(buflen, dmat->common.maxsegsz); if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, sgsize)) { - sgsize = MIN(sgsize, PAGE_SIZE - (curaddr & PAGE_MASK)); + /* + * The attempt to split a physically continuous buffer + * seems very controversial, it's unclear whether we + * can do this in all cases. Also, memory for bounced + * buffers is allocated as pages, so we cannot + * guarantee multipage alignment. + */ + KASSERT(dmat->common.alignment <= PAGE_SIZE, + ("bounced buffer cannot have alignment bigger " + "than PAGE_SIZE: %lu", dmat->common.alignment)); + sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); + sgsize = roundup2(sgsize, dmat->common.alignment); + sgsize = MIN(sgsize, dmat->common.maxsegsz); curaddr = add_bounce_page(dmat, map, 0, curaddr, sgsize); } else if ((map->flags & DMAMAP_COHERENT) == 0) { @@ -843,11 +848,11 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm sl++; sl->vaddr = 0; sl->paddr = curaddr; - sl->datacount = sgsize; sl->pages = PHYS_TO_VM_PAGE(curaddr); KASSERT(sl->pages != NULL, ("%s: page at PA:0x%08lx is not in " "vm_page_array", __func__, curaddr)); + sl->datacount = sgsize; } else sl->datacount += sgsize; } @@ -880,6 +885,11 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ vm_offset_t kvaddr, vaddr, sl_vend; int error; + KASSERT((map->flags & DMAMAP_FROM_DMAMEM) != 0 || + dmat->common.alignment <= PAGE_SIZE, + ("loading user buffer with alignment bigger than PAGE_SIZE is not " + "supported")); + if (segs == NULL) segs = dmat->segments; @@ -895,6 +905,11 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ } } + /* + * XXX Optimally we should parse input buffer for physically + * continuous segments first and then pass these segment into + * load loop. + */ sl = map->slist + map->sync_count - 1; vaddr = (vm_offset_t)buf; sl_pend = 0; @@ -916,15 +931,25 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ * Compute the segment size, and adjust counts. */ max_sgsize = MIN(buflen, dmat->common.maxsegsz); - sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); + if ((map->flags & DMAMAP_FROM_DMAMEM) != 0) { + sgsize = max_sgsize; + } else { + sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); + sgsize = MIN(sgsize, max_sgsize); + } + if (map->pagesneeded != 0 && must_bounce(dmat, map, curaddr, sgsize)) { + /* See comment in bounce_bus_dmamap_load_phys */ + KASSERT(dmat->common.alignment <= PAGE_SIZE, + ("bounced buffer cannot have alignment bigger " + "than PAGE_SIZE: %lu", dmat->common.alignment)); + sgsize = PAGE_SIZE - (curaddr & PAGE_MASK); sgsize = roundup2(sgsize, dmat->common.alignment); sgsize = MIN(sgsize, max_sgsize); curaddr = add_bounce_page(dmat, map, kvaddr, curaddr, sgsize); } else if ((map->flags & DMAMAP_COHERENT) == 0) { - sgsize = MIN(sgsize, max_sgsize); if (map->sync_count > 0) { sl_pend = sl->paddr + sl->datacount; sl_vend = sl->vaddr + sl->datacount; @@ -934,7 +959,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ (kvaddr != 0 && kvaddr != sl_vend) || (curaddr != sl_pend)) { if (++map->sync_count > dmat->common.nsegments) - goto cleanup; + break; sl++; sl->vaddr = kvaddr; sl->paddr = curaddr; @@ -950,8 +975,6 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ sl->datacount = sgsize; } else sl->datacount += sgsize; - } else { - sgsize = MIN(sgsize, max_sgsize); } sgsize = _bus_dmamap_addseg(dmat, map, curaddr, sgsize, segs, segp); @@ -961,7 +984,6 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ buflen -= sgsize; } -cleanup: /* * Did we fit? */ From owner-svn-src-head@freebsd.org Mon Nov 2 10:44:29 2020 Return-Path: Delivered-To: svn-src-head@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 EB15844E2AC; Mon, 2 Nov 2020 10:44:29 +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 4CPqKn5x5gz4NwT; Mon, 2 Nov 2020 10:44:29 +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 B036E856F; Mon, 2 Nov 2020 10:44:29 +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 0A2AiTq4000499; Mon, 2 Nov 2020 10:44:29 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2AiTYd000498; Mon, 2 Nov 2020 10:44:29 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011021044.0A2AiTYd000498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 2 Nov 2020 10:44:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367269 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/ofed/drivers/infiniband/core X-SVN-Commit-Revision: 367269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 10:44:30 -0000 Author: hselasky Date: Mon Nov 2 10:44:29 2020 New Revision: 367269 URL: https://svnweb.freebsd.org/changeset/base/367269 Log: Fix for referencing file via its vnode in ibore. Use the native vnode lookup functions, instead of going via the LinuxKPI, because the file referenced is typically created outside the LinuxKPI, and the LinuxKPI's fdget() can only resolve file descriptor numbers which were created by itself. The vnode pointer is used as an identifier to identify XRCD handles which are sharing resources. This patch fixes the so-called XRCD support in ibcore for FreeBSD. Refer to ibv_open_xrcd(3) for more information how the file descriptor argument is used. Reviewed by: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Modified: head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Mon Nov 2 08:26:19 2020 (r367268) +++ head/sys/ofed/drivers/infiniband/core/ib_uverbs_cmd.c Mon Nov 2 10:44:29 2020 (r367269) @@ -666,11 +666,11 @@ err_put: struct xrcd_table_entry { struct rb_node node; struct ib_xrcd *xrcd; - struct inode *inode; + struct vnode *vnode; }; static int xrcd_table_insert(struct ib_uverbs_device *dev, - struct inode *inode, + struct vnode *vnode, struct ib_xrcd *xrcd) { struct xrcd_table_entry *entry, *scan; @@ -682,15 +682,15 @@ static int xrcd_table_insert(struct ib_uverbs_device * return -ENOMEM; entry->xrcd = xrcd; - entry->inode = inode; + entry->vnode = vnode; while (*p) { parent = *p; scan = rb_entry(parent, struct xrcd_table_entry, node); - if (inode < scan->inode) { + if ((uintptr_t)vnode < (uintptr_t)scan->vnode) { p = &(*p)->rb_left; - } else if (inode > scan->inode) { + } else if ((uintptr_t)vnode > (uintptr_t)scan->vnode) { p = &(*p)->rb_right; } else { kfree(entry); @@ -700,12 +700,12 @@ static int xrcd_table_insert(struct ib_uverbs_device * rb_link_node(&entry->node, parent, p); rb_insert_color(&entry->node, &dev->xrcd_tree); - igrab(inode); + vrefact(vnode); return 0; } static struct xrcd_table_entry *xrcd_table_search(struct ib_uverbs_device *dev, - struct inode *inode) + struct vnode *vnode) { struct xrcd_table_entry *entry; struct rb_node *p = dev->xrcd_tree.rb_node; @@ -713,9 +713,9 @@ static struct xrcd_table_entry *xrcd_table_search(stru while (p) { entry = rb_entry(p, struct xrcd_table_entry, node); - if (inode < entry->inode) + if ((uintptr_t)vnode < (uintptr_t)entry->vnode) p = p->rb_left; - else if (inode > entry->inode) + else if ((uintptr_t)vnode > (uintptr_t)entry->vnode) p = p->rb_right; else return entry; @@ -724,11 +724,11 @@ static struct xrcd_table_entry *xrcd_table_search(stru return NULL; } -static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct inode *inode) +static struct ib_xrcd *find_xrcd(struct ib_uverbs_device *dev, struct vnode *vnode) { struct xrcd_table_entry *entry; - entry = xrcd_table_search(dev, inode); + entry = xrcd_table_search(dev, vnode); if (!entry) return NULL; @@ -736,13 +736,13 @@ static struct ib_xrcd *find_xrcd(struct ib_uverbs_devi } static void xrcd_table_delete(struct ib_uverbs_device *dev, - struct inode *inode) + struct vnode *vnode) { struct xrcd_table_entry *entry; - entry = xrcd_table_search(dev, inode); + entry = xrcd_table_search(dev, vnode); if (entry) { - iput(inode); + vrele(vnode); rb_erase(&entry->node, &dev->xrcd_tree); kfree(entry); } @@ -758,8 +758,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil struct ib_udata udata; struct ib_uxrcd_object *obj; struct ib_xrcd *xrcd = NULL; - struct fd f = {NULL}; - struct inode *inode = NULL; + struct vnode *vnode = NULL; int ret = 0; int new_xrcd = 0; @@ -777,14 +776,11 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil if (cmd.fd != -1) { /* search for file descriptor */ - f = fdget(cmd.fd); - if (!f.file) { - ret = -EBADF; + ret = -fgetvp(curthread, cmd.fd, &cap_no_rights, &vnode); + if (ret != 0) goto err_tree_mutex_unlock; - } - inode = f.file->f_dentry->d_inode; - xrcd = find_xrcd(file->device, inode); + xrcd = find_xrcd(file->device, vnode); if (!xrcd && !(cmd.oflags & O_CREAT)) { /* no file descriptor. Need CREATE flag */ ret = -EAGAIN; @@ -814,7 +810,7 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil goto err; } - xrcd->inode = inode; + xrcd->vnode = vnode; xrcd->device = ib_dev; atomic_set(&xrcd->usecnt, 0); mutex_init(&xrcd->tgt_qp_mutex); @@ -831,10 +827,10 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil memset(&resp, 0, sizeof resp); resp.xrcd_handle = obj->uobject.id; - if (inode) { + if (vnode != NULL) { if (new_xrcd) { - /* create new inode/xrcd table entry */ - ret = xrcd_table_insert(file->device, inode, xrcd); + /* create new vnode/xrcd table entry */ + ret = xrcd_table_insert(file->device, vnode, xrcd); if (ret) goto err_insert_xrcd; } @@ -847,8 +843,8 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil goto err_copy; } - if (f.file) - fdput(f); + if (vnode != NULL) + vrele(vnode); mutex_lock(&file->mutex); list_add_tail(&obj->uobject.list, &file->ucontext->xrcd_list); @@ -861,9 +857,9 @@ ssize_t ib_uverbs_open_xrcd(struct ib_uverbs_file *fil return in_len; err_copy: - if (inode) { + if (vnode != NULL) { if (new_xrcd) - xrcd_table_delete(file->device, inode); + xrcd_table_delete(file->device, vnode); atomic_dec(&xrcd->usecnt); } @@ -877,8 +873,8 @@ err: put_uobj_write(&obj->uobject); err_tree_mutex_unlock: - if (f.file) - fdput(f); + if (vnode != NULL) + vrele(vnode); mutex_unlock(&file->device->xrcd_tree_mutex); @@ -893,7 +889,7 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi struct ib_uverbs_close_xrcd cmd; struct ib_uobject *uobj; struct ib_xrcd *xrcd = NULL; - struct inode *inode = NULL; + struct vnode *vnode = NULL; struct ib_uxrcd_object *obj; int live; int ret = 0; @@ -909,7 +905,7 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi } xrcd = uobj->object; - inode = xrcd->inode; + vnode = xrcd->vnode; obj = container_of(uobj, struct ib_uxrcd_object, uobject); if (atomic_read(&obj->refcnt)) { put_uobj_write(uobj); @@ -917,14 +913,14 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi goto out; } - if (!inode || atomic_dec_and_test(&xrcd->usecnt)) { + if (!vnode || atomic_dec_and_test(&xrcd->usecnt)) { ret = ib_dealloc_xrcd(uobj->object); if (!ret) uobj->live = 0; } live = uobj->live; - if (inode && ret) + if (vnode && ret) atomic_inc(&xrcd->usecnt); put_uobj_write(uobj); @@ -932,8 +928,8 @@ ssize_t ib_uverbs_close_xrcd(struct ib_uverbs_file *fi if (ret) goto out; - if (inode && !live) - xrcd_table_delete(file->device, inode); + if (vnode && !live) + xrcd_table_delete(file->device, vnode); idr_remove_uobj(&ib_uverbs_xrcd_idr, uobj); mutex_lock(&file->mutex); @@ -951,16 +947,16 @@ out: void ib_uverbs_dealloc_xrcd(struct ib_uverbs_device *dev, struct ib_xrcd *xrcd) { - struct inode *inode; + struct vnode *vnode; - inode = xrcd->inode; - if (inode && !atomic_dec_and_test(&xrcd->usecnt)) + vnode = xrcd->vnode; + if (vnode && !atomic_dec_and_test(&xrcd->usecnt)) return; ib_dealloc_xrcd(xrcd); - if (inode) - xrcd_table_delete(dev, inode); + if (vnode) + xrcd_table_delete(dev, vnode); } ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file, From owner-svn-src-head@freebsd.org Mon Nov 2 15:01:38 2020 Return-Path: Delivered-To: svn-src-head@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 20276453CFB; Mon, 2 Nov 2020 15:01:38 +0000 (UTC) (envelope-from adrian@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 4CPx2T5wJVz4dLD; Mon, 2 Nov 2020 15:01:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE6BFB2A9; Mon, 2 Nov 2020 15:01:37 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2F1b07059569; Mon, 2 Nov 2020 15:01:37 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2F1bvQ059568; Mon, 2 Nov 2020 15:01:37 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202011021501.0A2F1bvQ059568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 2 Nov 2020 15:01:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367273 - head/lib/libnetmap X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/lib/libnetmap X-SVN-Commit-Revision: 367273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 15:01:38 -0000 Author: adrian Date: Mon Nov 2 15:01:37 2020 New Revision: 367273 URL: https://svnweb.freebsd.org/changeset/base/367273 Log: [libnetmap] Fix 32 bit compilation under gcc-6.4 Use uintptr_t to cast a uint64_t to a pointer type. Yeah, it isn't technically correct for platforms with pointers > 64 bits, but it's fine here. This fixes 32 bit compat library builds on amd64 and also mips32 builds. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D26790 Modified: head/lib/libnetmap/nmreq.c Modified: head/lib/libnetmap/nmreq.c ============================================================================== --- head/lib/libnetmap/nmreq.c Mon Nov 2 14:30:55 2020 (r367272) +++ head/lib/libnetmap/nmreq.c Mon Nov 2 15:01:37 2020 (r367273) @@ -603,10 +603,9 @@ nmreq_options_decode(const char *opt, struct nmreq_opt struct nmreq_option * nmreq_find_option(struct nmreq_header *h, uint32_t t) { - struct nmreq_option *o; + struct nmreq_option *o = NULL; - for (o = (struct nmreq_option *)h->nr_options; o != NULL; - o = (struct nmreq_option *)o->nro_next) { + nmreq_foreach_option(h, o) { if (o->nro_reqtype == t) break; } @@ -633,8 +632,14 @@ nmreq_free_options(struct nmreq_header *h) { struct nmreq_option *o, *next; - for (o = (struct nmreq_option *)h->nr_options; o != NULL; o = next) { - next = (struct nmreq_option *)o->nro_next; + /* + * Note: can't use nmreq_foreach_option() here; it frees the + * list as it's walking and nmreq_foreach_option() isn't + * modification-safe. + */ + for (o = (struct nmreq_option *)(uintptr_t)h->nr_options; o != NULL; + o = next) { + next = (struct nmreq_option *)(uintptr_t)o->nro_next; free(o); } } From owner-svn-src-head@freebsd.org Mon Nov 2 17:38:09 2020 Return-Path: Delivered-To: svn-src-head@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 E506E4566D2; Mon, 2 Nov 2020 17:38:09 +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 4CQ0W55kLDz3WlG; Mon, 2 Nov 2020 17:38:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3982C969; Mon, 2 Nov 2020 17:38:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2Hc9XX054590; Mon, 2 Nov 2020 17:38:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2Hc80h054585; Mon, 2 Nov 2020 17:38:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011021738.0A2Hc80h054585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 2 Nov 2020 17:38:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367274 - in head: lib/libmemstat share/man/man9 sys/kern usr.bin/vmstat X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head: lib/libmemstat share/man/man9 sys/kern usr.bin/vmstat X-SVN-Commit-Revision: 367274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 17:38:10 -0000 Author: mjg Date: Mon Nov 2 17:38:08 2020 New Revision: 367274 URL: https://svnweb.freebsd.org/changeset/base/367274 Log: malloc: export kernel zones instead of relying on them being power-of-2 Reviewed by: markj (previous version) Differential Revision: https://reviews.freebsd.org/D27026 Modified: head/lib/libmemstat/memstat.h head/lib/libmemstat/memstat_malloc.c head/share/man/man9/malloc.9 head/sys/kern/kern_malloc.c head/usr.bin/vmstat/vmstat.c Modified: head/lib/libmemstat/memstat.h ============================================================================== --- head/lib/libmemstat/memstat.h Mon Nov 2 15:01:37 2020 (r367273) +++ head/lib/libmemstat/memstat.h Mon Nov 2 17:38:08 2020 (r367274) @@ -118,6 +118,13 @@ int memstat_kvm_malloc(struct memory_type_list *list, int memstat_kvm_uma(struct memory_type_list *list, void *kvm_handle); /* + * General malloc routines. + */ +size_t memstat_malloc_zone_get_count(void); +size_t memstat_malloc_zone_get_size(size_t n); +int memstat_malloc_zone_used(const struct memory_type *mtp, size_t n); + +/* * Accessor methods for struct memory_type. */ const char *memstat_get_name(const struct memory_type *mtp); Modified: head/lib/libmemstat/memstat_malloc.c ============================================================================== --- head/lib/libmemstat/memstat_malloc.c Mon Nov 2 15:01:37 2020 (r367273) +++ head/lib/libmemstat/memstat_malloc.c Mon Nov 2 17:38:08 2020 (r367274) @@ -44,10 +44,22 @@ #include "memstat.h" #include "memstat_internal.h" +static int memstat_malloc_zone_count; +static int memstat_malloc_zone_sizes[32]; + +static int memstat_malloc_zone_init(void); +static int memstat_malloc_zone_init_kvm(kvm_t *kvm); + static struct nlist namelist[] = { #define X_KMEMSTATISTICS 0 { .n_name = "_kmemstatistics" }, -#define X_MP_MAXCPUS 1 +#define X_KMEMZONES 1 + { .n_name = "_kmemzones" }, +#define X_NUMZONES 2 + { .n_name = "_numzones" }, +#define X_VM_MALLOC_ZONE_COUNT 3 + { .n_name = "_vm_malloc_zone_count" }, +#define X_MP_MAXCPUS 4 { .n_name = "_mp_maxcpus" }, { .n_name = "" }, }; @@ -111,6 +123,11 @@ retry: return (-1); } + if (memstat_malloc_zone_init() == -1) { + list->mtl_error = MEMSTAT_ERROR_VERSION; + return (-1); + } + size = sizeof(*mthp) + count * (sizeof(*mthp) + sizeof(*mtsp) * maxcpus); @@ -333,6 +350,12 @@ memstat_kvm_malloc(struct memory_type_list *list, void return (-1); } + ret = memstat_malloc_zone_init_kvm(kvm); + if (ret != 0) { + list->mtl_error = ret; + return (-1); + } + mp_ncpus = kvm_getncpus(kvm); for (typep = kmemstatistics; typep != NULL; typep = type.ks_next) { @@ -413,6 +436,112 @@ memstat_kvm_malloc(struct memory_type_list *list, void mtp->mt_bytes = mtp->mt_memalloced - mtp->mt_memfreed; mtp->mt_count = mtp->mt_numallocs - mtp->mt_numfrees; } + + return (0); +} + +static int +memstat_malloc_zone_init(void) +{ + size_t size; + + size = sizeof(memstat_malloc_zone_count); + if (sysctlbyname("vm.malloc.zone_count", &memstat_malloc_zone_count, + &size, NULL, 0) < 0) { + return (-1); + } + + if (memstat_malloc_zone_count > (int)nitems(memstat_malloc_zone_sizes)) { + return (-1); + } + + size = sizeof(memstat_malloc_zone_sizes); + if (sysctlbyname("vm.malloc.zone_sizes", &memstat_malloc_zone_sizes, + &size, NULL, 0) < 0) { + return (-1); + } + + return (0); +} + +/* + * Copied from kern_malloc.c + * + * kz_zone is an array sized at compilation time, the size is exported in + * "numzones". Below we need to iterate kz_size. + */ +struct memstat_kmemzone { + int kz_size; + const char *kz_name; + void *kz_zone[1]; +}; + +static int +memstat_malloc_zone_init_kvm(kvm_t *kvm) +{ + struct memstat_kmemzone *kmemzones, *kz; + int numzones, objsize, allocsize, ret; + int i; + + ret = kread_symbol(kvm, X_VM_MALLOC_ZONE_COUNT, + &memstat_malloc_zone_count, sizeof(memstat_malloc_zone_count), 0); + if (ret != 0) { + return (ret); + } + + ret = kread_symbol(kvm, X_NUMZONES, &numzones, sizeof(numzones), 0); + if (ret != 0) { + return (ret); + } + + objsize = __offsetof(struct memstat_kmemzone, kz_zone) + + sizeof(void *) * numzones; + + allocsize = objsize * memstat_malloc_zone_count; + kmemzones = malloc(allocsize); + if (kmemzones == NULL) { + return (MEMSTAT_ERROR_NOMEMORY); + } + ret = kread_symbol(kvm, X_KMEMZONES, kmemzones, allocsize, 0); + if (ret != 0) { + free(kmemzones); + return (ret); + } + + kz = kmemzones; + for (i = 0; i < (int)nitems(memstat_malloc_zone_sizes); i++) { + memstat_malloc_zone_sizes[i] = kz->kz_size; + kz = (struct memstat_kmemzone *)((char *)kz + objsize); + } + + free(kmemzones); + return (0); +} + +size_t +memstat_malloc_zone_get_count(void) +{ + + return (memstat_malloc_zone_count); +} + +size_t +memstat_malloc_zone_get_size(size_t n) +{ + + if (n >= nitems(memstat_malloc_zone_sizes)) { + return (-1); + } + + return (memstat_malloc_zone_sizes[n]); +} + +int +memstat_malloc_zone_used(const struct memory_type *mtp, size_t n) +{ + + if (memstat_get_sizemask(mtp) & (1 << n)) + return (1); return (0); } Modified: head/share/man/man9/malloc.9 ============================================================================== --- head/share/man/man9/malloc.9 Mon Nov 2 15:01:37 2020 (r367273) +++ head/share/man/man9/malloc.9 Mon Nov 2 17:38:08 2020 (r367274) @@ -29,7 +29,7 @@ .\" $NetBSD: malloc.9,v 1.3 1996/11/11 00:05:11 lukem Exp $ .\" $FreeBSD$ .\" -.Dd August 28, 2020 +.Dd October 30, 2020 .Dt MALLOC 9 .Os .Sh NAME @@ -57,6 +57,8 @@ .Fn reallocf "void *addr" "size_t size" "struct malloc_type *type" "int flags" .Ft size_t .Fn malloc_usable_size "const void *addr" +.Ft void * +.Fn malloc_exec "size_t size" "struct malloc_type *type" "int flags" .Fn MALLOC_DECLARE type .In sys/param.h .In sys/malloc.h @@ -66,6 +68,8 @@ .In sys/domainset.h .Ft void * .Fn malloc_domainset "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags" +.Ft void * +.Fn malloc_domainset_exec "size_t size" "struct malloc_type *type" "struct domainset *ds" "int flags" .Sh DESCRIPTION The .Fn malloc @@ -82,6 +86,13 @@ See .Xr domainset 9 for some example policies. .Pp +Both +.Fn malloc_exec +and +.Fn malloc_domainset_exec +can be used to return executable memory. +Not all platforms enforce a distinction between executable and non-executable memory. +.Pp The .Fn mallocarray function allocates uninitialized memory in kernel address space for an @@ -214,11 +225,6 @@ This option should only be used in combination with .Dv M_NOWAIT when an allocation failure cannot be tolerated by the caller without catastrophic effects on the system. -.It Dv M_EXEC -Indicates that the system should allocate executable memory. -If this flag is not set, the system will not allocate executable memory. -Not all platforms enforce a distinction between executable and -non-executable memory. .El .Pp Exactly one of either Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Mon Nov 2 15:01:37 2020 (r367273) +++ head/sys/kern/kern_malloc.c Mon Nov 2 17:38:08 2020 (r367274) @@ -147,6 +147,8 @@ static int numzones = MALLOC_DEBUG_MAXZONES; * Small malloc(9) memory allocations are allocated from a set of UMA buckets * of various sizes. * + * Warning: the layout of the struct is duplicated in libmemstat for KVM support. + * * XXX: The comment here used to read "These won't be powers of two for * long." It's possible that a significant amount of wasted memory could be * recovered by tuning the sizes of these buckets. @@ -213,6 +215,19 @@ SYSCTL_PROC(_vm, OID_AUTO, kmem_map_free, CTLFLAG_RD | CTLTYPE_ULONG | CTLFLAG_MPSAFE, NULL, 0, sysctl_kmem_map_free, "LU", "Free space in kmem"); +static SYSCTL_NODE(_vm, OID_AUTO, malloc, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "Malloc information"); + +static u_int vm_malloc_zone_count = nitems(kmemzones); +SYSCTL_UINT(_vm_malloc, OID_AUTO, zone_count, + CTLFLAG_RD, &vm_malloc_zone_count, 0, + "Number of malloc zones"); + +static int sysctl_vm_malloc_zone_sizes(SYSCTL_HANDLER_ARGS); +SYSCTL_PROC(_vm_malloc, OID_AUTO, zone_sizes, + CTLFLAG_RD | CTLTYPE_OPAQUE | CTLFLAG_MPSAFE, NULL, 0, + sysctl_vm_malloc_zone_sizes, "S", "Zone sizes used by malloc"); + /* * The malloc_mtx protects the kmemstatistics linked list. */ @@ -272,6 +287,19 @@ sysctl_kmem_map_free(SYSCTL_HANDLER_ARGS) else size = limit - size; return (sysctl_handle_long(oidp, &size, 0, req)); +} + +static int +sysctl_vm_malloc_zone_sizes(SYSCTL_HANDLER_ARGS) +{ + int sizes[nitems(kmemzones)]; + int i; + + for (i = 0; i < nitems(kmemzones); i++) { + sizes[i] = kmemzones[i].kz_size; + } + + return (SYSCTL_OUT(req, &sizes, sizeof(sizes))); } /* Modified: head/usr.bin/vmstat/vmstat.c ============================================================================== --- head/usr.bin/vmstat/vmstat.c Mon Nov 2 15:01:37 2020 (r367273) +++ head/usr.bin/vmstat/vmstat.c Mon Nov 2 17:38:08 2020 (r367274) @@ -1407,7 +1407,8 @@ domemstat_malloc(void) { struct memory_type_list *mtlp; struct memory_type *mtp; - int error, first, i; + size_t i, zones; + int error, first; mtlp = memstat_mtl_alloc(); if (mtlp == NULL) { @@ -1435,6 +1436,7 @@ domemstat_malloc(void) xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s} {T:Size(s)}\n", "Type", "InUse", "MemUse", "HighUse", "Requests"); xo_open_list("memory"); + zones = memstat_malloc_zone_get_count(); for (mtp = memstat_mtl_first(mtlp); mtp != NULL; mtp = memstat_mtl_next(mtp)) { if (memstat_get_numallocs(mtp) == 0 && @@ -1449,11 +1451,11 @@ domemstat_malloc(void) (uintmax_t)memstat_get_numallocs(mtp)); first = 1; xo_open_list("size"); - for (i = 0; i < 32; i++) { - if (memstat_get_sizemask(mtp) & (1 << i)) { + for (i = 0; i < zones; i++) { + if (memstat_malloc_zone_used(mtp, i)) { if (!first) xo_emit(","); - xo_emit("{l:size/%d}", 1 << (i + 4)); + xo_emit("{l:size/%d}", memstat_malloc_zone_get_size(i)); first = 0; } } From owner-svn-src-head@freebsd.org Mon Nov 2 17:39:16 2020 Return-Path: Delivered-To: svn-src-head@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 2F9DD4566EC; Mon, 2 Nov 2020 17:39:16 +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 4CQ0XM6GHCz3Wtq; Mon, 2 Nov 2020 17:39:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BAAE9C96B; Mon, 2 Nov 2020 17:39:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2HdFkO054679; Mon, 2 Nov 2020 17:39:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2HdFOt054678; Mon, 2 Nov 2020 17:39:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011021739.0A2HdFOt054678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 2 Nov 2020 17:39:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367275 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 17:39:16 -0000 Author: mjg Date: Mon Nov 2 17:39:15 2020 New Revision: 367275 URL: https://svnweb.freebsd.org/changeset/base/367275 Log: malloc: prefix zones with malloc- Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27038 Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Mon Nov 2 17:38:08 2020 (r367274) +++ head/sys/kern/kern_malloc.c Mon Nov 2 17:39:15 2020 (r367275) @@ -158,19 +158,19 @@ struct { const char *kz_name; uma_zone_t kz_zone[MALLOC_DEBUG_MAXZONES]; } kmemzones[] = { - {16, "16", }, - {32, "32", }, - {64, "64", }, - {128, "128", }, - {256, "256", }, - {512, "512", }, - {1024, "1024", }, - {2048, "2048", }, - {4096, "4096", }, - {8192, "8192", }, - {16384, "16384", }, - {32768, "32768", }, - {65536, "65536", }, + {16, "malloc-16", }, + {32, "malloc-32", }, + {64, "malloc-64", }, + {128, "malloc-128", }, + {256, "malloc-256", }, + {512, "malloc-512", }, + {1024, "malloc-1024", }, + {2048, "malloc-2048", }, + {4096, "malloc-4096", }, + {8192, "malloc-8192", }, + {16384, "malloc-16384", }, + {32768, "malloc-32768", }, + {65536, "malloc-65536", }, {0, NULL}, }; From owner-svn-src-head@freebsd.org Mon Nov 2 17:40:00 2020 Return-Path: Delivered-To: svn-src-head@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 456534566FA; Mon, 2 Nov 2020 17:40:00 +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 4CQ0YD1DJ8z3WdM; Mon, 2 Nov 2020 17:40:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BBBDCAF5; Mon, 2 Nov 2020 17:40:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2Hdxx9054783; Mon, 2 Nov 2020 17:39:59 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2HdxI5054782; Mon, 2 Nov 2020 17:39:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011021739.0A2HdxI5054782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 2 Nov 2020 17:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367276 - head/sys/contrib/openzfs/module/zstd X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/zstd X-SVN-Commit-Revision: 367276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 17:40:00 -0000 Author: mjg Date: Mon Nov 2 17:39:59 2020 New Revision: 367276 URL: https://svnweb.freebsd.org/changeset/base/367276 Log: zfs: zstd: short-circuit cleaning buffers if none exist This avoids a barrage of locking every minute. Modified: head/sys/contrib/openzfs/module/zstd/zfs_zstd.c Modified: head/sys/contrib/openzfs/module/zstd/zfs_zstd.c ============================================================================== --- head/sys/contrib/openzfs/module/zstd/zfs_zstd.c Mon Nov 2 17:39:15 2020 (r367275) +++ head/sys/contrib/openzfs/module/zstd/zfs_zstd.c Mon Nov 2 17:39:59 2020 (r367276) @@ -700,6 +700,13 @@ zstd_mempool_deinit(void) void zfs_zstd_cache_reap_now(void) { + + /* + * Short-circuit if there are no buffers to begin with. + */ + if (ZSTDSTAT(zstd_stat_buffers) == 0) + return; + /* * calling alloc with zero size seeks * and releases old unused objects From owner-svn-src-head@freebsd.org Mon Nov 2 18:23:51 2020 Return-Path: Delivered-To: svn-src-head@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 8A384457A56; Mon, 2 Nov 2020 18:23:51 +0000 (UTC) (envelope-from manu@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 4CQ1Wq2xmyz3Znb; Mon, 2 Nov 2020 18:23:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4856BDB0A; Mon, 2 Nov 2020 18:23:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2INpHZ086368; Mon, 2 Nov 2020 18:23:51 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2INo93086367; Mon, 2 Nov 2020 18:23:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011021823.0A2INo93086367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 2 Nov 2020 18:23:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367277 - head X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 18:23:51 -0000 Author: manu Date: Mon Nov 2 18:23:50 2020 New Revision: 367277 URL: https://svnweb.freebsd.org/changeset/base/367277 Log: pkgbase: Add incremental packages This adds a new target update-packages which will create the new packages compared to the last run. This is how to use it: At this point we cut a release $ make buildworld ... $ make buildkernel $ make packages There is now a PKG_VERSION directory with latest link pointing to it Distribute the packages to server $ something something that update the source tree $ make buildworld ... $ make buildkernel $ make update-packages You know have a PKG_VERSION directory in the REPODIR and latest link pointing to it. In PKG_VERSION dir only the packages which differs from the latest run are named PKG_VERSION, otherwise the old packages are there. The process is : Build the new packages in the PKG_VERSION directory Compare the internal data with the PKG_VERSION_FROM version. The comparison is done by checking the internal hash of the packages. By default PKG_VERSION_FROM is set to what the latest link points to. If the old and new version matches, we rm the new package and cp the old one. Differential Revision: https://reviews.freebsd.org/D25984 Modified: head/Makefile head/Makefile.inc1 Modified: head/Makefile ============================================================================== --- head/Makefile Mon Nov 2 17:39:59 2020 (r367276) +++ head/Makefile Mon Nov 2 18:23:50 2020 (r367277) @@ -162,8 +162,8 @@ TGTS= all all-man buildenv buildenvvars buildkernel bu xdev-links native-xtools native-xtools-install stageworld stagekernel \ stage-packages stage-packages-kernel stage-packages-world \ create-packages-world create-packages-kernel create-packages \ - packages installconfig real-packages sign-packages package-pkg \ - print-dir test-system-compiler test-system-linker + update-packages packages installconfig real-packages real-update-packages \ + sign-packages package-pkg print-dir test-system-compiler test-system-linker # These targets require a TARGET and TARGET_ARCH be defined. XTGTS= native-xtools native-xtools-install xdev xdev-build xdev-install \ Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Nov 2 17:39:59 2020 (r367276) +++ head/Makefile.inc1 Mon Nov 2 18:23:50 2020 (r367277) @@ -568,12 +568,12 @@ EXTRA_REVISION= _${_BRANCH:C/-PRERELEASE/.p/} .elif ${_BRANCH:M*-p*} EXTRA_REVISION= _${_BRANCH:C/.*-p([0-9]+$)/\1/} .endif -PKG_VERSION= ${_REVISION}${EXTRA_REVISION} +PKG_VERSION:= ${_REVISION}${EXTRA_REVISION} .endif .endif # !defined(PKG_VERSION) .if !defined(PKG_TIMESTAMP) -TIMEEPOCHNOW= %s +TIMEEPOCHNOW= %s SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime} .else SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP} @@ -1855,9 +1855,22 @@ _pkgbootstrap: .PHONY @env ASSUME_ALWAYS_YES=YES pkg bootstrap .endif +.if make(create-world-packages-jobs) || make(create-kernel-packages*) || make(real-update-packages) +PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI +.endif + +.if !defined(PKG_VERSION_FROM) +.if defined(PKG_ABI) +PKG_VERSION_FROM!=/usr/bin/readlink ${REPODIR}/${PKG_ABI}/latest +.endif +.endif + packages: .PHONY ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-packages +update-packages: .PHONY + ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} real-update-packages + package-pkg: .PHONY rm -rf /tmp/ports.${TARGET} || : env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \ @@ -1867,6 +1880,28 @@ package-pkg: .PHONY real-packages: stage-packages create-packages sign-packages .PHONY +real-update-packages: stage-packages .PHONY + ${_+_}${MAKE} -C ${.CURDIR} PKG_VERSION=${PKG_VERSION} create-packages + @echo "==> Checking for new packages (comparing ${PKG_VERSION} to ${PKG_VERSION_FROM})" + @for pkg in ${REPODIR}/${PKG_ABI}/${PKG_VERSION_FROM}/${PKG_NAME_PREFIX}-*; do \ + pkgname=$$(pkg query -F $${pkg} '%n' | sed 's/${PKG_NAME_PREFIX}-\(.*\)/\1/') ; \ + newpkgname=${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION}.${PKG_FORMAT} ; \ + oldsum=$$(pkg query -F $${pkg} '%X') ; \ + if [ ! -f ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ]; then \ + continue; \ + fi ; \ + newsum=$$(pkg query -F ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} '%X') ; \ + if [ "$${oldsum}" == "$${newsum}" ]; then \ + echo "==> Keeping old ${PKG_NAME_PREFIX}-$${pkgname}-${PKG_VERSION_FROM}.${PKG_FORMAT}" ; \ + rm ${REPODIR}/${PKG_ABI}/${PKG_VERSION}/$${newpkgname} ; \ + cp $${pkg} ${REPODIR}/${PKG_ABI}/${PKG_VERSION} ; \ + else \ + echo "==> New package $${newpkgname}" ; \ + fi ; \ + done + ${_+_}@cd ${.CURDIR}; \ + ${MAKE} -f Makefile.inc1 PKG_VERSION=${PKG_VERSION} sign-packages + stage-packages-world: .PHONY @mkdir -p ${WSTAGEDIR} ${_+_}@cd ${.CURDIR}; \ @@ -1915,10 +1950,6 @@ create-world-packages: _pkgbootstrap .PHONY .if make(create-world-packages-jobs) .include "${WSTAGEDIR}/packages.mk" -.endif - -.if make(create-world-packages-jobs) || make(create-kernel-packages*) -PKG_ABI!=${PKG_CMD} -o ABI_FILE=${WSTAGEDIR}/usr/bin/uname config ABI .endif create-world-packages-jobs: .PHONY From owner-svn-src-head@freebsd.org Mon Nov 2 18:45:16 2020 Return-Path: Delivered-To: svn-src-head@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 9BE5A45819A; Mon, 2 Nov 2020 18:45:16 +0000 (UTC) (envelope-from cem@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 4CQ20X3cSwz3bZW; Mon, 2 Nov 2020 18:45:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F403DCC6; Mon, 2 Nov 2020 18:45:16 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2IjGXt098709; Mon, 2 Nov 2020 18:45:16 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2IjGfp098706; Mon, 2 Nov 2020 18:45:16 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011021845.0A2IjGfp098706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 2 Nov 2020 18:45:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367278 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 18:45:16 -0000 Author: cem Date: Mon Nov 2 18:45:15 2020 New Revision: 367278 URL: https://svnweb.freebsd.org/changeset/base/367278 Log: linux(4): Deduplicate ioctl range construction with a helper macro No functional change. Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27049 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:23:50 2020 (r367277) +++ head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:45:15 2020 (r367278) @@ -102,70 +102,35 @@ __FBSDID("$FreeBSD$"); CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); -static linux_ioctl_function_t linux_ioctl_cdrom; -static linux_ioctl_function_t linux_ioctl_vfat; -static linux_ioctl_function_t linux_ioctl_console; -static linux_ioctl_function_t linux_ioctl_hdio; -static linux_ioctl_function_t linux_ioctl_disk; -static linux_ioctl_function_t linux_ioctl_socket; -static linux_ioctl_function_t linux_ioctl_sound; -static linux_ioctl_function_t linux_ioctl_termio; -static linux_ioctl_function_t linux_ioctl_private; -static linux_ioctl_function_t linux_ioctl_drm; -static linux_ioctl_function_t linux_ioctl_sg; -static linux_ioctl_function_t linux_ioctl_v4l; -static linux_ioctl_function_t linux_ioctl_v4l2; -static linux_ioctl_function_t linux_ioctl_special; -static linux_ioctl_function_t linux_ioctl_fbsd_usb; -static linux_ioctl_function_t linux_ioctl_evdev; -static linux_ioctl_function_t linux_ioctl_kcov; +#define DEFINE_LINUX_IOCTL_SET(shortname, SHORTNAME) \ +static linux_ioctl_function_t linux_ioctl_ ## shortname; \ +static struct linux_ioctl_handler shortname ## _handler = { \ + .func = linux_ioctl_ ## shortname, \ + .low = LINUX_IOCTL_ ## SHORTNAME ## _MIN, \ + .high = LINUX_IOCTL_ ## SHORTNAME ## _MAX, \ +}; \ +DATA_SET(linux_ioctl_handler_set, shortname ## _handler) -static struct linux_ioctl_handler cdrom_handler = -{ linux_ioctl_cdrom, LINUX_IOCTL_CDROM_MIN, LINUX_IOCTL_CDROM_MAX }; -static struct linux_ioctl_handler vfat_handler = -{ linux_ioctl_vfat, LINUX_IOCTL_VFAT_MIN, LINUX_IOCTL_VFAT_MAX }; -static struct linux_ioctl_handler console_handler = -{ linux_ioctl_console, LINUX_IOCTL_CONSOLE_MIN, LINUX_IOCTL_CONSOLE_MAX }; -static struct linux_ioctl_handler hdio_handler = -{ linux_ioctl_hdio, LINUX_IOCTL_HDIO_MIN, LINUX_IOCTL_HDIO_MAX }; -static struct linux_ioctl_handler disk_handler = -{ linux_ioctl_disk, LINUX_IOCTL_DISK_MIN, LINUX_IOCTL_DISK_MAX }; -static struct linux_ioctl_handler socket_handler = -{ linux_ioctl_socket, LINUX_IOCTL_SOCKET_MIN, LINUX_IOCTL_SOCKET_MAX }; -static struct linux_ioctl_handler sound_handler = -{ linux_ioctl_sound, LINUX_IOCTL_SOUND_MIN, LINUX_IOCTL_SOUND_MAX }; -static struct linux_ioctl_handler private_handler = -{ linux_ioctl_private, LINUX_IOCTL_PRIVATE_MIN, LINUX_IOCTL_PRIVATE_MAX }; -static struct linux_ioctl_handler drm_handler = -{ linux_ioctl_drm, LINUX_IOCTL_DRM_MIN, LINUX_IOCTL_DRM_MAX }; -static struct linux_ioctl_handler sg_handler = -{ linux_ioctl_sg, LINUX_IOCTL_SG_MIN, LINUX_IOCTL_SG_MAX }; -static struct linux_ioctl_handler video_handler = -{ linux_ioctl_v4l, LINUX_IOCTL_VIDEO_MIN, LINUX_IOCTL_VIDEO_MAX }; -static struct linux_ioctl_handler video2_handler = -{ linux_ioctl_v4l2, LINUX_IOCTL_VIDEO2_MIN, LINUX_IOCTL_VIDEO2_MAX }; -static struct linux_ioctl_handler fbsd_usb = -{ linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX }; -static struct linux_ioctl_handler evdev_handler = -{ linux_ioctl_evdev, LINUX_IOCTL_EVDEV_MIN, LINUX_IOCTL_EVDEV_MAX }; -static struct linux_ioctl_handler kcov_handler = -{ linux_ioctl_kcov, LINUX_KCOV_MIN, LINUX_KCOV_MAX }; +DEFINE_LINUX_IOCTL_SET(cdrom, CDROM); +DEFINE_LINUX_IOCTL_SET(vfat, VFAT); +DEFINE_LINUX_IOCTL_SET(console, CONSOLE); +DEFINE_LINUX_IOCTL_SET(hdio, HDIO); +DEFINE_LINUX_IOCTL_SET(disk, DISK); +DEFINE_LINUX_IOCTL_SET(socket, SOCKET); +DEFINE_LINUX_IOCTL_SET(sound, SOUND); +DEFINE_LINUX_IOCTL_SET(termio, TERMIO); +DEFINE_LINUX_IOCTL_SET(private, PRIVATE); +DEFINE_LINUX_IOCTL_SET(drm, DRM); +DEFINE_LINUX_IOCTL_SET(sg, SG); +DEFINE_LINUX_IOCTL_SET(v4l, VIDEO); +DEFINE_LINUX_IOCTL_SET(v4l2, VIDEO2); +DEFINE_LINUX_IOCTL_SET(fbsd_usb, FBSD_LUSB); +DEFINE_LINUX_IOCTL_SET(evdev, EVDEV); +DEFINE_LINUX_IOCTL_SET(kcov, KCOV); -DATA_SET(linux_ioctl_handler_set, cdrom_handler); -DATA_SET(linux_ioctl_handler_set, vfat_handler); -DATA_SET(linux_ioctl_handler_set, console_handler); -DATA_SET(linux_ioctl_handler_set, hdio_handler); -DATA_SET(linux_ioctl_handler_set, disk_handler); -DATA_SET(linux_ioctl_handler_set, socket_handler); -DATA_SET(linux_ioctl_handler_set, sound_handler); -DATA_SET(linux_ioctl_handler_set, private_handler); -DATA_SET(linux_ioctl_handler_set, drm_handler); -DATA_SET(linux_ioctl_handler_set, sg_handler); -DATA_SET(linux_ioctl_handler_set, video_handler); -DATA_SET(linux_ioctl_handler_set, video2_handler); -DATA_SET(linux_ioctl_handler_set, fbsd_usb); -DATA_SET(linux_ioctl_handler_set, evdev_handler); -DATA_SET(linux_ioctl_handler_set, kcov_handler); +#undef DEFINE_LINUX_IOCTL_SET + +static int linux_ioctl_special(struct thread *, struct linux_ioctl_args *); /* * Keep sorted by low. Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Mon Nov 2 18:23:50 2020 (r367277) +++ head/sys/compat/linux/linux_ioctl.h Mon Nov 2 18:45:15 2020 (r367278) @@ -747,8 +747,8 @@ #define FBSD_LUSB_GET_POWER_USAGE 0xffdd #define FBSD_LUSB_DEVICESTATS 0xffdc -#define FBSD_LUSB_MAX 0xffff -#define FBSD_LUSB_MIN 0xffdc +#define LINUX_IOCTL_FBSD_LUSB_MAX 0xffff +#define LINUX_IOCTL_FBSD_LUSB_MIN 0xffdc /* * Linux btrfs clone operation @@ -767,8 +767,8 @@ /* * kcov(4) shims */ -#define LINUX_KCOV_MIN 0x6300 -#define LINUX_KCOV_MAX 0x63ff +#define LINUX_IOCTL_KCOV_MIN 0x6300 +#define LINUX_IOCTL_KCOV_MAX 0x63ff #define LINUX_KCOV_INIT_TRACE 0x6301 #define LINUX_KCOV_ENABLE 0x6364 #define LINUX_KCOV_DISABLE 0x6365 From owner-svn-src-head@freebsd.org Mon Nov 2 18:45:44 2020 Return-Path: Delivered-To: svn-src-head@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 B3701458313; Mon, 2 Nov 2020 18:45:44 +0000 (UTC) (envelope-from cem@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 4CQ21446M2z3bbn; Mon, 2 Nov 2020 18:45:44 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7088ADF85; Mon, 2 Nov 2020 18:45:44 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2Iji5B098771; Mon, 2 Nov 2020 18:45:44 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2IjiEw098770; Mon, 2 Nov 2020 18:45:44 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011021845.0A2IjiEw098770@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Mon, 2 Nov 2020 18:45:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367279 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 18:45:44 -0000 Author: cem Date: Mon Nov 2 18:45:43 2020 New Revision: 367279 URL: https://svnweb.freebsd.org/changeset/base/367279 Log: linux(4): Quiesce unrecognized ioctl warning for F2FS query On Linux, sqlite probes for underlying F2FS filesystems that support certain kinds of atomic update with this ioctl. The expected result on non-F2FS filesystem (i.e., all FreeBSD filesystems) is any error value. Minimally implement the ioctl and avoid the warning message. (This shows up in Linux Chrome, which embeds sqlite.) Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27050 Modified: head/sys/compat/linux/linux_ioctl.c head/sys/compat/linux/linux_ioctl.h Modified: head/sys/compat/linux/linux_ioctl.c ============================================================================== --- head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:45:15 2020 (r367278) +++ head/sys/compat/linux/linux_ioctl.c Mon Nov 2 18:45:43 2020 (r367279) @@ -3631,6 +3631,7 @@ linux_ioctl_fallback(struct thread *td, struct linux_i switch (args->cmd & 0xffff) { case LINUX_BTRFS_IOC_CLONE: + case LINUX_F2FS_IOC_GET_FEATURES: case LINUX_FS_IOC_FIEMAP: return (ENOTSUP); Modified: head/sys/compat/linux/linux_ioctl.h ============================================================================== --- head/sys/compat/linux/linux_ioctl.h Mon Nov 2 18:45:15 2020 (r367278) +++ head/sys/compat/linux/linux_ioctl.h Mon Nov 2 18:45:43 2020 (r367279) @@ -707,6 +707,11 @@ #define LINUX_IOCTL_VIDEO2_MIN LINUX_VIDIOC_QUERYCAP #define LINUX_IOCTL_VIDEO2_MAX LINUX_VIDIOC_UNSUBSCRIBE_EVENT +#define LINUX_F2FS_IOC_GET_FEATURES 0xf50c /* 0x8004f50c */ + +#define LINUX_IOCTL_F2FS_MIN 0xf500 +#define LINUX_IOCTL_F2FS_MAX LINUX_F2FS_IOC_GET_FEATURES + /* * Our libusb(8) calls emulated within linux(4). */ From owner-svn-src-head@freebsd.org Mon Nov 2 18:48:07 2020 Return-Path: Delivered-To: svn-src-head@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 D4A8B4581CE; Mon, 2 Nov 2020 18:48:07 +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 4CQ23q5HBMz3bYx; Mon, 2 Nov 2020 18:48:07 +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 80448DE67; Mon, 2 Nov 2020 18:48:07 +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 0A2Im7Q2098922; Mon, 2 Nov 2020 18:48:07 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2Im7Kx098921; Mon, 2 Nov 2020 18:48:07 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011021848.0A2Im7Kx098921@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: Mon, 2 Nov 2020 18:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367280 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 367280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 18:48:07 -0000 Author: se Date: Mon Nov 2 18:48:06 2020 New Revision: 367280 URL: https://svnweb.freebsd.org/changeset/base/367280 Log: Re-arrange some of the code to separate writable user tree variables from R/O variables. While here fix some nearby style. No functional change intended. MFC after: 1 month Modified: head/lib/libc/gen/sysctl.c Modified: head/lib/libc/gen/sysctl.c ============================================================================== --- head/lib/libc/gen/sysctl.c Mon Nov 2 18:45:43 2020 (r367279) +++ head/lib/libc/gen/sysctl.c Mon Nov 2 18:48:06 2020 (r367280) @@ -53,26 +53,42 @@ sysctl(const int *name, u_int namelen, void *oldp, siz int retval; size_t orig_oldlen; - orig_oldlen = oldlenp ? *oldlenp : 0; + orig_oldlen = oldlenp != NULL ? *oldlenp : 0; retval = __sysctl(name, namelen, oldp, oldlenp, newp, newlen); /* - * All valid names under CTL_USER have a dummy entry in the sysctl - * tree (to support name lookups and enumerations) with an - * empty/zero value, and the true value is supplied by this routine. - * For all such names, __sysctl() is used solely to validate the - * name. + * Valid names under CTL_USER except USER_LOCALBASE have a dummy entry + * in the sysctl tree (to support name lookups and enumerations) with + * an empty/zero value, and the true value is supplied by this routine. + * For all such names, __sysctl() is used solely to validate the name. * - * Return here unless there was a successful lookup for a CTL_USER - * name. + * Return here unless there was a successful lookup for a CTL_USER name. */ - if (retval || name[0] != CTL_USER) + if (retval != 0 || name[0] != CTL_USER) return (retval); if (namelen != 2) { errno = EINVAL; return (-1); } - if (newp != NULL && name[1] != USER_LOCALBASE) { + + /* Variables under CLT_USER that may be overridden by kernel values */ + switch (name[1]) { + case USER_LOCALBASE: + if (oldlenp == NULL || *oldlenp != 1) + return (0); + if (oldp != NULL) { + if (orig_oldlen < sizeof(_PATH_LOCALBASE)) { + errno = ENOMEM; + return (-1); + } + memmove(oldp, _PATH_LOCALBASE, sizeof(_PATH_LOCALBASE)); + } + *oldlenp = sizeof(_PATH_LOCALBASE); + return (0); + } + + /* Variables under CLT_USER whose values are immutably defined below */ + if (newp != NULL) { errno = EPERM; return (-1); } @@ -87,26 +103,9 @@ sysctl(const int *name, u_int namelen, void *oldp, siz if (oldp != NULL) memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH)); return (0); - case USER_LOCALBASE: - if (oldlenp != NULL) { - if (oldp == NULL) { - if (*oldlenp == 1) - *oldlenp = sizeof(_PATH_LOCALBASE); - } else { - if (*oldlenp != 1) - return (retval); - if (orig_oldlen < sizeof(_PATH_LOCALBASE)) { - errno = ENOMEM; - return (-1); - } - *oldlenp = sizeof(_PATH_LOCALBASE); - memmove(oldp, _PATH_LOCALBASE, sizeof(_PATH_LOCALBASE)); - } - } - return (0); } - if (oldp && *oldlenp < sizeof(int)) { + if (oldp != NULL && *oldlenp < sizeof(int)) { errno = ENOMEM; return (-1); } From owner-svn-src-head@freebsd.org Mon Nov 2 19:20:08 2020 Return-Path: Delivered-To: svn-src-head@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 7129C458E86; Mon, 2 Nov 2020 19:20:08 +0000 (UTC) (envelope-from alc@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 4CQ2mm2JYvz3dF7; Mon, 2 Nov 2020 19:20:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E1EDE4BE; Mon, 2 Nov 2020 19:20:08 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2JK8EM017812; Mon, 2 Nov 2020 19:20:08 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2JK7a4017807; Mon, 2 Nov 2020 19:20:07 GMT (envelope-from alc@FreeBSD.org) Message-Id: <202011021920.0A2JK7a4017807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Mon, 2 Nov 2020 19:20:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367281 - in head/sys: amd64/amd64 arm64/arm64 mips/mips powerpc/powerpc riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm64/arm64 mips/mips powerpc/powerpc riscv/riscv X-SVN-Commit-Revision: 367281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 19:20:08 -0000 Author: alc Date: Mon Nov 2 19:20:06 2020 New Revision: 367281 URL: https://svnweb.freebsd.org/changeset/base/367281 Log: Tidy up the #includes. Recent changes, such as the introduction of VM_ALLOC_WAITOK and vm_page_unwire_noq(), have eliminated the need for many of the #includes. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D27052 Modified: head/sys/amd64/amd64/uma_machdep.c head/sys/arm64/arm64/uma_machdep.c head/sys/mips/mips/uma_machdep.c head/sys/powerpc/powerpc/uma_machdep.c head/sys/riscv/riscv/uma_machdep.c Modified: head/sys/amd64/amd64/uma_machdep.c ============================================================================== --- head/sys/amd64/amd64/uma_machdep.c Mon Nov 2 18:48:06 2020 (r367280) +++ head/sys/amd64/amd64/uma_machdep.c Mon Nov 2 19:20:06 2020 (r367281) @@ -30,15 +30,10 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include -#include -#include #include #include #include -#include #include #include #include Modified: head/sys/arm64/arm64/uma_machdep.c ============================================================================== --- head/sys/arm64/arm64/uma_machdep.c Mon Nov 2 18:48:06 2020 (r367280) +++ head/sys/arm64/arm64/uma_machdep.c Mon Nov 2 19:20:06 2020 (r367281) @@ -28,11 +28,7 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include -#include -#include #include #include #include Modified: head/sys/mips/mips/uma_machdep.c ============================================================================== --- head/sys/mips/mips/uma_machdep.c Mon Nov 2 18:48:06 2020 (r367280) +++ head/sys/mips/mips/uma_machdep.c Mon Nov 2 19:20:06 2020 (r367281) @@ -30,11 +30,7 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include -#include -#include #include #include #include @@ -42,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include void * uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, Modified: head/sys/powerpc/powerpc/uma_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/uma_machdep.c Mon Nov 2 18:48:06 2020 (r367280) +++ head/sys/powerpc/powerpc/uma_machdep.c Mon Nov 2 19:20:06 2020 (r367281) @@ -28,21 +28,14 @@ __FBSDID("$FreeBSD$"); #include -#include -#include -#include -#include #include +#include #include -#include #include #include +#include #include -#include -#include -#include #include -#include #include #include #include Modified: head/sys/riscv/riscv/uma_machdep.c ============================================================================== --- head/sys/riscv/riscv/uma_machdep.c Mon Nov 2 18:48:06 2020 (r367280) +++ head/sys/riscv/riscv/uma_machdep.c Mon Nov 2 19:20:06 2020 (r367281) @@ -28,19 +28,13 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include -#include -#include #include #include #include -#include #include #include #include -#include void * uma_small_alloc(uma_zone_t zone, vm_size_t bytes, int domain, u_int8_t *flags, From owner-svn-src-head@freebsd.org Mon Nov 2 19:20:39 2020 Return-Path: Delivered-To: svn-src-head@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 CBA5A458DE9; Mon, 2 Nov 2020 19:20:39 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) (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 4CQ2nM0Bbkz3dYg; Mon, 2 Nov 2020 19:20:38 +0000 (UTC) (envelope-from oliver.pntr@gmail.com) Received: by mail-yb1-xb36.google.com with SMTP id o70so12702361ybc.1; Mon, 02 Nov 2020 11:20:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jAAquKx4vzElVm7nSr9Spp3vGngPj6gSokjshF8xbGw=; b=Sm9olOakzqeq3tJzVkoIecCyvd/jUI4wYjSLLEuXCQT4uVXwvniz9LNwSr8YM1s1PD IEpH6ufuWFiIhJH67ep3akQoeWbIyAwoien4KaLrmLp9sMTsDqpvK4NqWjJpu04OX1af 5E90IP5xYj6BzalDFebRakqR4rZi+8oniH03LZxUAUCdUGUrDEWZD50xdn7mZx4pyYNl m+RKwAKrcfQT/GPwUghfpx3EG8d9nkufZ4O6MMjjXb8qty5Mkl+/5hUFhTfZO1YDlw3E QA7AOuapzF6vYwOyr5B7IxqQz2b/QSWmNpeCOww7FLmZ+oNqlia/H844HsbdK2F+2DWu /+iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jAAquKx4vzElVm7nSr9Spp3vGngPj6gSokjshF8xbGw=; b=tNCLUugva/74gGeuOGs8mx7englJGO8NdDm25dBkx4j4fMAk6vQlC3xRhTmEqzjSd5 nML14802RMAviBNt7ZMwjpQqC1kPl88/tooo1A84t9Qv+J/bq9pdXwc6qnEjJOEOe0XC T9HqK+Y5OqiasxhFfb4mzHss3UIV33IQnVlh5hHv/x5K8r1h16BplIcNSyR8tP63+2vw +TskRActd++jQ9pzfJViVVJLuHceKRoi83AgBb70pG66ryScO5+GCBQg1Ru7LNAz+CYv Yg49PYJSNZTiKjH3dYp5Ym0ZugrcOwq6+42xY5DMdGwN6muGxDU5WDdKsvvfJIb3onXL g/Yg== X-Gm-Message-State: AOAM532XcxnwgLnh45a8pzen9A12kBa9yOCtY8LgFLq2CzFqAjFTwg+V 42u71KJaaS7TozrWvUhCLf9Yz+aXOYzPFndPST9rUqhf X-Google-Smtp-Source: ABdhPJxa4UwpUeE8CJJYgL9Pkx40cwy3AqO6NZK++vdTApXoegaISFGp/g9dYYdrh7WOIGqlsAlC2qkbtGVuDTsFdxI= X-Received: by 2002:a25:d481:: with SMTP id m123mr21829300ybf.142.1604344837461; Mon, 02 Nov 2020 11:20:37 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a25:d8d2:0:0:0:0:0 with HTTP; Mon, 2 Nov 2020 11:20:36 -0800 (PST) In-Reply-To: <202011021848.0A2Im7Kx098921@repo.freebsd.org> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> From: Oliver Pinter Date: Mon, 2 Nov 2020 20:20:36 +0100 Message-ID: Subject: Re: svn commit: r367280 - head/lib/libc/gen To: =?UTF-8?B?U3RlZmFuIEXDn2Vy?= Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 4CQ2nM0Bbkz3dYg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 19:20:39 -0000 On Monday, November 2, 2020, Stefan E=C3=9Fer wrote: > Author: se > Date: Mon Nov 2 18:48:06 2020 > New Revision: 367280 > URL: https://svnweb.freebsd.org/changeset/base/367280 > > Log: > Re-arrange some of the code to separate writable user tree variables fr= om > R/O variables. > > While here fix some nearby style. No functional change intended. > > MFC after: 1 month Is there any phabricator reference for this / these commit(s) + reviewer lists? trim From owner-svn-src-head@freebsd.org Mon Nov 2 19:56:16 2020 Return-Path: Delivered-To: svn-src-head@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 551134599B5; Mon, 2 Nov 2020 19:56:16 +0000 (UTC) (envelope-from br@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 4CQ3ZS1Ys7z3gBR; Mon, 2 Nov 2020 19:56:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18EF8EC17; Mon, 2 Nov 2020 19:56:16 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2JuFGV041905; Mon, 2 Nov 2020 19:56:15 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2JuFdm041903; Mon, 2 Nov 2020 19:56:15 GMT (envelope-from br@FreeBSD.org) Message-Id: <202011021956.0A2JuFdm041903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Mon, 2 Nov 2020 19:56:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367282 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 367282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 19:56:16 -0000 Author: br Date: Mon Nov 2 19:56:15 2020 New Revision: 367282 URL: https://svnweb.freebsd.org/changeset/base/367282 Log: Add routines for ARM System MMU (SMMU) pmap management. Reviewed by: markj Discussed with: kib Sponsored by: DARPA, Innovate UK Differential Revision: https://reviews.freebsd.org/D26877 Modified: head/sys/arm64/arm64/pmap.c head/sys/arm64/include/pmap.h Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Mon Nov 2 19:20:06 2020 (r367281) +++ head/sys/arm64/arm64/pmap.c Mon Nov 2 19:56:15 2020 (r367282) @@ -3605,6 +3605,184 @@ restart: } /* + * Add a single SMMU entry. This function does not sleep. + */ +int +pmap_senter(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, + vm_prot_t prot, u_int flags) +{ + pd_entry_t *pde; + pt_entry_t new_l3, orig_l3; + pt_entry_t *l3; + vm_page_t mpte; + int lvl; + int rv; + + PMAP_ASSERT_STAGE1(pmap); + KASSERT(va < VM_MAXUSER_ADDRESS, ("wrong address space")); + + va = trunc_page(va); + new_l3 = (pt_entry_t)(pa | ATTR_DEFAULT | + ATTR_S1_IDX(VM_MEMATTR_DEVICE) | L3_PAGE); + if ((prot & VM_PROT_WRITE) == 0) + new_l3 |= ATTR_S1_AP(ATTR_S1_AP_RO); + new_l3 |= ATTR_S1_XN; /* Execute never. */ + new_l3 |= ATTR_S1_AP(ATTR_S1_AP_USER); + new_l3 |= ATTR_S1_nG; /* Non global. */ + + CTR2(KTR_PMAP, "pmap_senter: %.16lx -> %.16lx", va, pa); + + PMAP_LOCK(pmap); + + /* + * In the case that a page table page is not + * resident, we are creating it here. + */ +retry: + pde = pmap_pde(pmap, va, &lvl); + if (pde != NULL && lvl == 2) { + l3 = pmap_l2_to_l3(pde, va); + } else { + mpte = _pmap_alloc_l3(pmap, pmap_l2_pindex(va), NULL); + if (mpte == NULL) { + CTR0(KTR_PMAP, "pmap_enter: mpte == NULL"); + rv = KERN_RESOURCE_SHORTAGE; + goto out; + } + goto retry; + } + + orig_l3 = pmap_load(l3); + KASSERT(!pmap_l3_valid(orig_l3), ("l3 is valid")); + + /* New mapping */ + pmap_store(l3, new_l3); + pmap_resident_count_inc(pmap, 1); + dsb(ishst); + + rv = KERN_SUCCESS; +out: + PMAP_UNLOCK(pmap); + + return (rv); +} + +/* + * Remove a single SMMU entry. + */ +int +pmap_sremove(pmap_t pmap, vm_offset_t va) +{ + pt_entry_t *pte; + int lvl; + int rc; + + PMAP_LOCK(pmap); + + pte = pmap_pte(pmap, va, &lvl); + KASSERT(lvl == 3, + ("Invalid SMMU pagetable level: %d != 3", lvl)); + + if (pte != NULL) { + pmap_resident_count_dec(pmap, 1); + pmap_clear(pte); + rc = KERN_SUCCESS; + } else + rc = KERN_FAILURE; + + PMAP_UNLOCK(pmap); + + return (rc); +} + +/* + * Remove all the allocated L1, L2 pages from SMMU pmap. + * All the L3 entires must be cleared in advance, otherwise + * this function panics. + */ +void +pmap_sremove_pages(pmap_t pmap) +{ + pd_entry_t l0e, *l1, l1e, *l2, l2e; + pt_entry_t *l3, l3e; + vm_page_t m, m0, m1; + vm_offset_t sva; + vm_paddr_t pa; + vm_paddr_t pa0; + vm_paddr_t pa1; + int i, j, k, l; + + PMAP_LOCK(pmap); + + for (sva = VM_MINUSER_ADDRESS, i = pmap_l0_index(sva); + (i < Ln_ENTRIES && sva < VM_MAXUSER_ADDRESS); i++) { + l0e = pmap->pm_l0[i]; + if ((l0e & ATTR_DESCR_VALID) == 0) { + sva += L0_SIZE; + continue; + } + pa0 = l0e & ~ATTR_MASK; + m0 = PHYS_TO_VM_PAGE(pa0); + l1 = (pd_entry_t *)PHYS_TO_DMAP(pa0); + + for (j = pmap_l1_index(sva); j < Ln_ENTRIES; j++) { + l1e = l1[j]; + if ((l1e & ATTR_DESCR_VALID) == 0) { + sva += L1_SIZE; + continue; + } + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) { + sva += L1_SIZE; + continue; + } + pa1 = l1e & ~ATTR_MASK; + m1 = PHYS_TO_VM_PAGE(pa1); + l2 = (pd_entry_t *)PHYS_TO_DMAP(pa1); + + for (k = pmap_l2_index(sva); k < Ln_ENTRIES; k++) { + l2e = l2[k]; + if ((l2e & ATTR_DESCR_VALID) == 0) { + sva += L2_SIZE; + continue; + } + pa = l2e & ~ATTR_MASK; + m = PHYS_TO_VM_PAGE(pa); + l3 = (pt_entry_t *)PHYS_TO_DMAP(pa); + + for (l = pmap_l3_index(sva); l < Ln_ENTRIES; + l++, sva += L3_SIZE) { + l3e = l3[l]; + if ((l3e & ATTR_DESCR_VALID) == 0) + continue; + panic("%s: l3e found for va %jx\n", + __func__, sva); + } + + vm_page_unwire_noq(m1); + vm_page_unwire_noq(m); + pmap_resident_count_dec(pmap, 1); + vm_page_free(m); + pmap_clear(&l2[k]); + } + + vm_page_unwire_noq(m0); + pmap_resident_count_dec(pmap, 1); + vm_page_free(m1); + pmap_clear(&l1[j]); + } + + pmap_resident_count_dec(pmap, 1); + vm_page_free(m0); + pmap_clear(&pmap->pm_l0[i]); + } + + KASSERT(pmap->pm_stats.resident_count == 0, + ("Invalid resident count %jd", pmap->pm_stats.resident_count)); + + PMAP_UNLOCK(pmap); +} + +/* * Insert the given physical page (p) at * the specified virtual address (v) in the * target physical map with the protection requested. Modified: head/sys/arm64/include/pmap.h ============================================================================== --- head/sys/arm64/include/pmap.h Mon Nov 2 19:20:06 2020 (r367281) +++ head/sys/arm64/include/pmap.h Mon Nov 2 19:56:15 2020 (r367282) @@ -187,6 +187,12 @@ bool pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t * int pmap_fault(pmap_t, uint64_t, uint64_t); +/* System MMU (SMMU). */ +int pmap_senter(pmap_t pmap, vm_offset_t va, vm_paddr_t pa, vm_prot_t prot, + u_int flags); +int pmap_sremove(pmap_t pmap, vm_offset_t va); +void pmap_sremove_pages(pmap_t pmap); + struct pcb *pmap_switch(struct thread *, struct thread *); extern void (*pmap_clean_stage2_tlbi)(void); From owner-svn-src-head@freebsd.org Mon Nov 2 21:10:50 2020 Return-Path: Delivered-To: svn-src-head@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 3C09345A957; Mon, 2 Nov 2020 21:10:50 +0000 (UTC) (envelope-from manu@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 4CQ5DV0pssz41DR; Mon, 2 Nov 2020 21:10:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D923DF7AD; Mon, 2 Nov 2020 21:10:49 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A2LAnc5085110; Mon, 2 Nov 2020 21:10:49 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2LAncM085108; Mon, 2 Nov 2020 21:10:49 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011022110.0A2LAncM085108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 2 Nov 2020 21:10:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367284 - in head/release: . tools X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/release: . tools X-SVN-Commit-Revision: 367284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 21:10:50 -0000 Author: manu Date: Mon Nov 2 21:10:49 2020 New Revision: 367284 URL: https://svnweb.freebsd.org/changeset/base/367284 Log: release: Add an image for CI A lot of projects CI can't do FreeBSD tests currently. The main reason is that the project CI infrastructure is runned on Linux and that our images aren't modifiable from a Linux hosts. Add a basic image specific for this case (called BASIC-CI for a lack of a better name). The image have no package pre-installed. It only have a few modification to have dhcp client runned on the default interface and sshd started with option to be able to log on without a password as root. Sponsored by: The FreeBSD Foundation Reviewed by: re (gjb@) Differential Revision: https://reviews.freebsd.org/D25598 Added: head/release/tools/basic-ci.conf (contents, props changed) Modified: head/release/Makefile.vm Modified: head/release/Makefile.vm ============================================================================== --- head/release/Makefile.vm Mon Nov 2 20:00:50 2020 (r367283) +++ head/release/Makefile.vm Mon Nov 2 21:10:49 2020 (r367284) @@ -16,13 +16,17 @@ VMDK_DESC= VMWare, VirtualBox disk image QCOW2_DESC= Qemu, KVM disk image RAW_DESC= Unformatted raw disk image -CLOUDWARE?= EC2 \ +CLOUDWARE?= BASIC-CI \ + EC2 \ GCE \ VAGRANT-VIRTUALBOX \ VAGRANT-VMWARE AZURE_FORMAT= vhdf AZURE_DESC= Microsoft Azure platform image AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT} +BASIC-CI_FORMAT= raw +BASIC-CI_DESC= Image for CI +BASIC-CI_DISK= ${OSRELEASE}.${BASIC-CI_FORMAT} EC2_FORMAT= raw EC2_DESC= Amazon EC2 image EC2_DISK= ${OSRELEASE}.${EC2_FORMAT} Added: head/release/tools/basic-ci.conf ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/release/tools/basic-ci.conf Mon Nov 2 21:10:49 2020 (r367284) @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Should be enough for base image, image can be resized in needed +export VMSIZE=5G + +# Set to a list of third-party software to enable in rc.conf(5). +export VM_RC_LIST="sshd growfs" + +vm_extra_pre_umount() { + cat << EOF >> ${DESTDIR}/etc/rc.conf +dumpdev="AUTO" +ifconfig_DEFAULT="DHCP" +sshd_enable="YES" +EOF + + cat << EOF >> ${DESTDIR}/boot/loader.conf +autoboot_delay="-1" +beastie_disable="YES" +loader_logo="none" +console="comconsole,vidconsole" +EOF + cat <> ${DESTDIR}/etc/ssh/sshd_config +PermitRootLogin yes +PasswordAuthentication yes +PermitEmptyPasswords yes +UsePAM no +EOF + + touch ${DESTDIR}/firstboot + + return 0 +} From owner-svn-src-head@freebsd.org Mon Nov 2 21:41:40 2020 Return-Path: Delivered-To: svn-src-head@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 B446D45B6FA; Mon, 2 Nov 2020 21:41:40 +0000 (UTC) (envelope-from se@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 4CQ5w43dWTz43DK; Mon, 2 Nov 2020 21:41:40 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f0bbc00143e0d922c7a134c.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:143e:d92:2c7a:134c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id C074632D73; Mon, 2 Nov 2020 21:41:39 +0000 (UTC) (envelope-from se@freebsd.org) To: Oliver Pinter References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> From: Stefan Esser Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> Date: Mon, 2 Nov 2020 22:41:38 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="p9ToTsPqS3y8vvcx5THMtlQZXM8EQB6CM" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 21:41:40 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --p9ToTsPqS3y8vvcx5THMtlQZXM8EQB6CM Content-Type: multipart/mixed; boundary="47TTESs5KIGoigC7ptry3ouLNurmXMUeK"; protected-headers="v1" From: Stefan Esser To: Oliver Pinter Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Message-ID: <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> Subject: Re: svn commit: r367280 - head/lib/libc/gen References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> In-Reply-To: --47TTESs5KIGoigC7ptry3ouLNurmXMUeK Content-Type: multipart/mixed; boundary="------------50A5C1A53B712B2604F9B991" Content-Language: en-US This is a multi-part message in MIME format. --------------50A5C1A53B712B2604F9B991 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Am 02.11.20 um 20:20 schrieb Oliver Pinter:> On Monday, November 2,=20 2020, Stefan E=C3=9Fer > wrote: >=20 > Author: se > Date: Mon Nov=C2=A0 2 18:48:06 2020 > New Revision: 367280 > URL: https://svnweb.freebsd.org/changeset/base/367280 > >=20 > Log: > =C2=A0 Re-arrange some of the code to separate writable user tree > variables from > =C2=A0 R/O variables. >=20 > =C2=A0 While here fix some nearby style. No functional change inte= nded. >=20 > =C2=A0 MFC after:=C2=A0 =C2=A0 1 month >=20 >=20 > Is there any phabricator reference for this / these commit(s) + reviewe= r=20 > lists? The previous commit that has been refined in this one has been discussed in D27009. I had added the new R/W sysctl variable to a switch statement that contained one R/O string value, and excluded the OID from causing an error return when a new value had been passed. This was functionally OK, but I have decided to move handling of the new writable variable to before the check for a write attempt and thus need to test specifically for its OID. This sysctl variable is referenced in Scott Longs proposed getlocalbase() function (D27022), but also in the change to make it define defaults paths in /etc/defaults/rc.conf (D27014). I do not support to make LOCALBASE dynamic for a broad range of programs, since this could lead to severe security issues (e.g. when a program is restricted by policy settings LOCALBASE/etc and an user-defined LOCALBASE could be used to circumvent them. There are already programs that respect a LOCALBASE environment variable, e.g. the pkg program, to allow it to e.g. operate with a DESTDIR prefix other than "/". This is a program that could instead use getlocalbase(), IMHO. But for security reasons all files that determine policies and exist in LOCALBASE since they are not distributed as part of the base system, should be located in a secure way, and that is by referring to a compiled in trusted path, IMHO. Even if the sysctl variable "user.localbase" can only be written to by root, the use of getlocalbase() provided by a shared library could allow to perform a LD_PRELOAD attack (provide a getlocalbase() that leadsto a user provided policy file instead of the admin controlled one). Regards, STefan --------------50A5C1A53B712B2604F9B991-- --47TTESs5KIGoigC7ptry3ouLNurmXMUeK-- --p9ToTsPqS3y8vvcx5THMtlQZXM8EQB6CM Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+gfRIFAwAAAAAACgkQR+u171r99UQH TAf/cEQAU5xPuY6JtIJWXP0zr6VjTWYmv4yWp7NEFQz8UKgOlB++dcD/vErPzsW1Ab1gRgaj+i1q 4ZTlGuKkV5z9+Bn2cMQoLTRP0T6W8WyE1QD/eVDseSO2DakS8hyQHWoQ+eGOs3rTZKQUA8R59ZPZ g7j4K6qZ+yQity1xeNc505ZT0dIthWtr/Cbmg/djUi0hl1cFz1v81rSlb/ugBCpbFPYnC2KOXe3r uU1RQLGZO9rZIZZAyEpdW5P6vK/1sgmEx5hi7GcnKtSJtzoCw/17GhNFZKS3SCq4F7rHnD3nG26C FeJ4Apd9EVfmc3Bu3W64HvVEXiY81KDDT2sJ3K4Gxw== =0Og+ -----END PGP SIGNATURE----- --p9ToTsPqS3y8vvcx5THMtlQZXM8EQB6CM-- From owner-svn-src-head@freebsd.org Mon Nov 2 21:47:35 2020 Return-Path: Delivered-To: svn-src-head@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 9A9B945C0C8; Mon, 2 Nov 2020 21:47:35 +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 4CQ62v3dMjz43px; Mon, 2 Nov 2020 21:47:35 +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 5BBBB100F9; Mon, 2 Nov 2020 21:47:35 +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 0A2LlZFR009323; Mon, 2 Nov 2020 21:47:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A2LlZsR009322; Mon, 2 Nov 2020 21:47:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011022147.0A2LlZsR009322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 2 Nov 2020 21:47:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367285 - head/sbin/ifconfig X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sbin/ifconfig X-SVN-Commit-Revision: 367285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 21:47:35 -0000 Author: kib Date: Mon Nov 2 21:47:34 2020 New Revision: 367285 URL: https://svnweb.freebsd.org/changeset/base/367285 Log: ifconfig: properly detect invalid mediaopt keywords. When invalid keyword is specified, ifconfig(8) is silent about it, instead random request is sent to the driver. Before the patch: root@r-freeb43:~ # ifconfig mce0 mediaopt -txpause,-rxpause ifconfig: SIOCSIFMEDIA (media): Device not configured After: root@r-freeb43:~ # ifconfig mce0 mediaopt -txpause,-rxpause ifconfig: unknown option: -txpause Reviewed by: hselasky, kp Sponsored by: Mellanox Technologies / NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27060 Modified: head/sbin/ifconfig/ifmedia.c Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Mon Nov 2 21:10:49 2020 (r367284) +++ head/sbin/ifconfig/ifmedia.c Mon Nov 2 21:47:34 2020 (r367285) @@ -566,7 +566,7 @@ get_media_options(int type, const char *val) struct ifmedia_description *desc; struct ifmedia_type_to_subtype *ttos; char *optlist, *optptr; - int option = 0, i, rval = 0; + int option, i, rval = 0; /* We muck with the string, so copy it. */ optlist = strdup(val); @@ -587,12 +587,13 @@ get_media_options(int type, const char *val) */ optptr = optlist; for (; (optptr = strtok(optptr, ",")) != NULL; optptr = NULL) { + option = -1; for (i = 0; ttos->options[i].desc != NULL; i++) { option = lookup_media_word(ttos->options[i].desc, optptr); if (option != -1) break; } - if (option == 0) + if (option == -1) errx(1, "unknown option: %s", optptr); rval |= option; } From owner-svn-src-head@freebsd.org Mon Nov 2 21:49:19 2020 Return-Path: Delivered-To: svn-src-head@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 4567645C1B2; Mon, 2 Nov 2020 21:49:19 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQ64s6C9sz446m; Mon, 2 Nov 2020 21:49:17 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1604353748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=L1YOR3BwUVFXqLIqzFYY0D73qpp76uHgDerLkkFw3lQ=; b=SabmnV5Q2zB5pvGXg13H5P4qjizXjZ942hlL5vCB3L41OUJuLWCzY1L4s/GN07JTeSOvuv HxaePyYlzT97NH2YYim7VJWe8P3F8foGcQl16Ym+USKr5JCZ9YBcFbCt3EcNU0O9gwbUu2 VrIB1MM0lgwOoV2vQaAHJzGCw1xvCRA= Received: from amy.home (lfbn-idf2-1-288-247.w82-123.abo.wanadoo.fr [82.123.126.247]) by mx.blih.net (OpenSMTPD) with ESMTPSA id d2d4687a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 2 Nov 2020 21:49:07 +0000 (UTC) Date: Mon, 2 Nov 2020 22:49:07 +0100 From: Emmanuel Vadot To: Stefan Esser Cc: Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-Id: <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> In-Reply-To: <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4CQ64s6C9sz446m X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=SabmnV5Q; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-2.79 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; FREEFALL_USER(0.00)[manu]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.02)[-1.022]; TO_MATCH_ENVRCPT_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx]; DKIM_TRACE(0.00)[bidouilliste.com:+]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.24)[-0.243]; NEURAL_HAM_MEDIUM(-1.03)[-1.029]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 21:49:19 -0000 On Mon, 2 Nov 2020 22:41:38 +0100 Stefan Esser wrote: > Am 02.11.20 um 20:20 schrieb Oliver Pinter:> On Monday, November 2,=20 > 2020, Stefan E=DFer > > wrote: > >=20 > > Author: se > > Date: Mon Nov=A0 2 18:48:06 2020 > > New Revision: 367280 > > URL: https://svnweb.freebsd.org/changeset/base/367280 > > > >=20 > > Log: > > =A0 Re-arrange some of the code to separate writable user tree > > variables from > > =A0 R/O variables. > >=20 > > =A0 While here fix some nearby style. No functional change intende= d. > >=20 > > =A0 MFC after:=A0 =A0 1 month > >=20 > >=20 > > Is there any phabricator reference for this / these commit(s) + reviewe= r=20 > > lists? >=20 > The previous commit that has been refined in this one has been > discussed in D27009. >=20 > I had added the new R/W sysctl variable to a switch statement that > contained one R/O string value, and excluded the OID from causing > an error return when a new value had been passed. >=20 > This was functionally OK, but I have decided to move handling of > the new writable variable to before the check for a write attempt > and thus need to test specifically for its OID. >=20 > This sysctl variable is referenced in Scott Longs proposed > getlocalbase() function (D27022), but also in the change to make > it define defaults paths in /etc/defaults/rc.conf (D27014). >=20 > I do not support to make LOCALBASE dynamic for a broad range of > programs, since this could lead to severe security issues (e.g. > when a program is restricted by policy settings LOCALBASE/etc and > an user-defined LOCALBASE could be used to circumvent them. >=20 > There are already programs that respect a LOCALBASE environment > variable, e.g. the pkg program, to allow it to e.g. operate with > a DESTDIR prefix other than "/". This is a program that could > instead use getlocalbase(), IMHO. >=20 > But for security reasons all files that determine policies and > exist in LOCALBASE since they are not distributed as part of the > base system, should be located in a secure way, and that is by > referring to a compiled in trusted path, IMHO. >=20 > Even if the sysctl variable "user.localbase" can only be written to > by root, the use of getlocalbase() provided by a shared library could > allow to perform a LD_PRELOAD attack (provide a getlocalbase() that > leadsto a user provided policy file instead of the admin controlled > one). >=20 > Regards, STefan I think that the first question we want to ask is : Do we want to support LOCALBASE being different than /usr/local I honestly don't see any advantages of making it !=3D/usr/local/ and before we start putting a lot of new/useless(for I guess 99% of our user base) in the tree we should here why people are using /usr/pkg or whatever weird location. If they have some good argument, then we should proceed further. --=20 Emmanuel Vadot From owner-svn-src-head@freebsd.org Mon Nov 2 22:10:50 2020 Return-Path: Delivered-To: svn-src-head@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 D992D45C7AF; Mon, 2 Nov 2020 22:10:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQ6Yj4JZMz452C; Mon, 2 Nov 2020 22:10:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0A2MAdH3072549 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 3 Nov 2020 00:10:43 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0A2MAdH3072549 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0A2MAdug072548; Tue, 3 Nov 2020 00:10:39 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 3 Nov 2020 00:10:39 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: Stefan Esser , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <20201102221039.GN2654@kib.kiev.ua> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CQ6Yj4JZMz452C X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-0.09 / 15.00]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-0.26)[-0.262]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_MEDIUM(0.07)[0.075]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.10)[0.100]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:10:50 -0000 On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: > I think that the first question we want to ask is : Do we want to > support LOCALBASE being different than /usr/local > I honestly don't see any advantages of making it !=/usr/local/ and > before we start putting a lot of new/useless(for I guess 99% of our > user base) in the tree we should here why people are using /usr/pkg or > whatever weird location. > If they have some good argument, then we should proceed further. I would be delighted to be able to install _and use_ two independent set of packages from the same base system install. Without recursing to jails, X forwarding, etc. In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64 machine. I am fine with me building both of them in my instance of poudriere. But indeed I am not sure if this worth the effort of many people, for many hours. If it puts too high burden on everybody, then it is not a good feature. Otherwise, it is very convenient in some situations. From owner-svn-src-head@freebsd.org Mon Nov 2 22:22:19 2020 Return-Path: Delivered-To: svn-src-head@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 A791645C76F; Mon, 2 Nov 2020 22:22:19 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQ6py0MSwz45w6; Mon, 2 Nov 2020 22:22:17 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1604355735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GQ8f8Q70oPCXuND6S6SoMGOoMfinaVzpQy724hPIVBM=; b=P2hf3Ltg4sNh61vt3PZUeqJjsk0gRNoQc+qd9Epx6lUQje1wWYNqLpb+qXfKqPIipG1Cxz wSMfJnUx4AOBiXL4GH7SPA0eHXJ8rvC9IwAdQi4KdUlccvg8YasW6VA+Yg2X5JCLEMEUMS 54CkT1fo8l97MGybSv7566iuu96emAI= Received: from amy.home (lfbn-idf2-1-288-247.w82-123.abo.wanadoo.fr [82.123.126.247]) by mx.blih.net (OpenSMTPD) with ESMTPSA id a02ec008 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 2 Nov 2020 22:22:15 +0000 (UTC) Date: Mon, 2 Nov 2020 23:22:15 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: Stefan Esser , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-Id: <20201102232215.3ae253e0478791a3261d1dd1@bidouilliste.com> In-Reply-To: <20201102221039.GN2654@kib.kiev.ua> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CQ6py0MSwz45w6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=P2hf3Ltg; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-2.94 / 15.00]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; FREEFALL_USER(0.00)[manu]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; MID_RHS_MATCH_FROM(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+mx]; ARC_NA(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.01)[-1.013]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.38)[-0.378]; NEURAL_HAM_MEDIUM(-1.05)[-1.052]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-head,svn-src-all] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:22:19 -0000 On Tue, 3 Nov 2020 00:10:39 +0200 Konstantin Belousov wrote: > On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: > > I think that the first question we want to ask is : Do we want to > > support LOCALBASE being different than /usr/local > > I honestly don't see any advantages of making it !=/usr/local/ and > > before we start putting a lot of new/useless(for I guess 99% of our > > user base) in the tree we should here why people are using /usr/pkg or > > whatever weird location. > > If they have some good argument, then we should proceed further. > > I would be delighted to be able to install _and use_ two independent > set of packages from the same base system install. Without recursing > to jails, X forwarding, etc. > > In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64 > machine. I am fine with me building both of them in my instance of > poudriere. > > But indeed I am not sure if this worth the effort of many people, for many > hours. If it puts too high burden on everybody, then it is not a good > feature. Otherwise, it is very convenient in some situations. I understand this situation but I think that the best way for you do do that is to use pkg install -r /path/to/my/i386/packages Since you will need to tweak you PATH variable to start applications installed in /usr/local-i386 anyway it's not too much to tweak that to the pkg path for your i386 repo. The "downside" of using this method is that you will have a /usr/local/ under the /path/to/my/i386/packages. The "upside" of using this method is that you would be able to use the same i386 packages on a native i386 install and they would install in /usr/local/ (so no tweaking here). -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Mon Nov 2 22:24:36 2020 Return-Path: Delivered-To: svn-src-head@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 BF9F945C9E5; Mon, 2 Nov 2020 22:24:36 +0000 (UTC) (envelope-from se@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 4CQ6sc4dWCz45wr; Mon, 2 Nov 2020 22:24:36 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f0bbc00143e0d922c7a134c.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:143e:d92:2c7a:134c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id E622E32F13; Mon, 2 Nov 2020 22:24:35 +0000 (UTC) (envelope-from se@freebsd.org) To: Emmanuel Vadot Cc: Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> From: Stefan Esser Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: Date: Mon, 2 Nov 2020 23:24:34 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:24:36 -0000 Am 02.11.20 um 22:49 schrieb Emmanuel Vadot: > On Mon, 2 Nov 2020 22:41:38 +0100 > Stefan Esser wrote: > >> Am 02.11.20 um 20:20 schrieb Oliver Pinter:> On Monday, November 2, >> 2020, Stefan Eßer >> > wrote: >>> >>> Author: se >>> Date: Mon Nov  2 18:48:06 2020 >>> New Revision: 367280 >>> URL: https://svnweb.freebsd.org/changeset/base/367280 >>> >>> >>> Log: >>>   Re-arrange some of the code to separate writable user tree >>> variables from >>>   R/O variables. >>> >>>   While here fix some nearby style. No functional change intended. >>> >>>   MFC after:    1 month >>> >>> >>> Is there any phabricator reference for this / these commit(s) + reviewer >>> lists? >> >> The previous commit that has been refined in this one has been >> discussed in D27009. >> >> I had added the new R/W sysctl variable to a switch statement that >> contained one R/O string value, and excluded the OID from causing >> an error return when a new value had been passed. >> >> This was functionally OK, but I have decided to move handling of >> the new writable variable to before the check for a write attempt >> and thus need to test specifically for its OID. >> >> This sysctl variable is referenced in Scott Longs proposed >> getlocalbase() function (D27022), but also in the change to make >> it define defaults paths in /etc/defaults/rc.conf (D27014). >> >> I do not support to make LOCALBASE dynamic for a broad range of >> programs, since this could lead to severe security issues (e.g. >> when a program is restricted by policy settings LOCALBASE/etc and >> an user-defined LOCALBASE could be used to circumvent them. >> >> There are already programs that respect a LOCALBASE environment >> variable, e.g. the pkg program, to allow it to e.g. operate with >> a DESTDIR prefix other than "/". This is a program that could >> instead use getlocalbase(), IMHO. >> >> But for security reasons all files that determine policies and >> exist in LOCALBASE since they are not distributed as part of the >> base system, should be located in a secure way, and that is by >> referring to a compiled in trusted path, IMHO. >> >> Even if the sysctl variable "user.localbase" can only be written to >> by root, the use of getlocalbase() provided by a shared library could >> allow to perform a LD_PRELOAD attack (provide a getlocalbase() that >> leadsto a user provided policy file instead of the admin controlled >> one). >> >> Regards, STefan > > I think that the first question we want to ask is : Do we want to > support LOCALBASE being different than /usr/local The big majority of users will keep the default value, and I do not see a good reason for a change, except if there is a large installed base that traditionally uses another prefix (I have seen /vol/local and /opt, but also OS and architecture-specific prefixes, for example). > I honestly don't see any advantages of making it !=/usr/local/ and > before we start putting a lot of new/useless(for I guess 99% of our > user base) in the tree we should here why people are using /usr/pkg or > whatever weird location. No, why should we [assess] (assuming that word is to be implied in your sentence) why people want to be able to easily use a different prefix? That would be a waste of time, IMHO. I know that there are legitimate reasons to want a different prefix, and we had requests to make it easier to support it. We have literal uses of /usr/local in a lot of files in the FreeBSD base system (more than 1700) and this is not going to change. But it was easy to replace a number of such literal pathes in base system binaries, and we can make it easier for those that need a different prefix to get it consistently used. > If they have some good argument, then we should proceed further. You do not have to participate in this effort - there are so many other areas to work on (and I know you are very active in one). But please do not ask those that have started to reduce the use of literal /usr/local in the base system to justify this work. If you are happy with /usr/local, then you are not affected at all. And if you need to configure your system to use a different prefix, you are welcome to let us know which steps are still causing much effort and should be worked on to make it easier ... Do you have any reason to be against removal of literal /usr/local from the base system in favor of using a symbolic name for it? Regards, STefan From owner-svn-src-head@freebsd.org Mon Nov 2 22:32:24 2020 Return-Path: Delivered-To: svn-src-head@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 F0CB445CF1D; Mon, 2 Nov 2020 22:32:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQ72Z59Zqz46GF; Mon, 2 Nov 2020 22:32:22 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0A2MWEfj090685 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 3 Nov 2020 00:32:17 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0A2MWEfj090685 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0A2MWEnV090684; Tue, 3 Nov 2020 00:32:14 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 3 Nov 2020 00:32:14 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: Stefan Esser , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <20201102223214.GO2654@kib.kiev.ua> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> <20201102232215.3ae253e0478791a3261d1dd1@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201102232215.3ae253e0478791a3261d1dd1@bidouilliste.com> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CQ72Z59Zqz46GF X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-0.31 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; NEURAL_HAM_MEDIUM(-0.03)[-0.026]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-0.34)[-0.337]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.06)[0.055]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:32:25 -0000 On Mon, Nov 02, 2020 at 11:22:15PM +0100, Emmanuel Vadot wrote: > On Tue, 3 Nov 2020 00:10:39 +0200 > Konstantin Belousov wrote: > > > On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: > > > I think that the first question we want to ask is : Do we want to > > > support LOCALBASE being different than /usr/local > > > I honestly don't see any advantages of making it !=/usr/local/ and > > > before we start putting a lot of new/useless(for I guess 99% of our > > > user base) in the tree we should here why people are using /usr/pkg or > > > whatever weird location. > > > If they have some good argument, then we should proceed further. > > > > I would be delighted to be able to install _and use_ two independent > > set of packages from the same base system install. Without recursing > > to jails, X forwarding, etc. > > > > In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64 > > machine. I am fine with me building both of them in my instance of > > poudriere. > > > > But indeed I am not sure if this worth the effort of many people, for many > > hours. If it puts too high burden on everybody, then it is not a good > > feature. Otherwise, it is very convenient in some situations. > > I understand this situation but I think that the best way for you do > do that is to use pkg install -r /path/to/my/i386/packages > > Since you will need to tweak you PATH variable to start applications > installed in /usr/local-i386 anyway it's not too much to tweak that to > the pkg path for your i386 repo. > > The "downside" of using this method is that you will have > a /usr/local/ under the /path/to/my/i386/packages. > The "upside" of using this method is that you would be able to use the > same i386 packages on a native i386 install and they would install > in /usr/local/ (so no tweaking here). If I can already use them from non-/usr/local prefix, then it is great news (for me). But I have a reason to doubt. For instance, a lot of applications are configured at build time to look for /usr/local. Like, gcc with /usr/local/lib/gcc/, and binutils, which are actually one of the main use case for me. So I believe that pkg install -r requires chroot/jail for the result to work. From owner-svn-src-head@freebsd.org Mon Nov 2 22:37:51 2020 Return-Path: Delivered-To: svn-src-head@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 0411445D30C; Mon, 2 Nov 2020 22:37:51 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQ78s3qRCz46k7; Mon, 2 Nov 2020 22:37:49 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1604356667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BQcykIBkAipksxMQeNoI/Ss8zMxFrD4FsySJoYgzWAw=; b=H5+RbgmG0CcOnee3MzfAFj55FTjWGSdYjSwDNDpyIJpLSTZy2+uIGIcxD/YAa9TXVYMmsN ZQP2k1xmMTTSpjmV34oLCTbZpaeLU+KaBA4y6JioqRb5qjIT5HUvgV5lLp5O/U0JsLmvP9 +M1R7o3cce3V6rzTcRtGxQ13GOUDyn0= Received: from amy.home (lfbn-idf2-1-288-247.w82-123.abo.wanadoo.fr [82.123.126.247]) by mx.blih.net (OpenSMTPD) with ESMTPSA id fe795c4c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 2 Nov 2020 22:37:47 +0000 (UTC) Date: Mon, 2 Nov 2020 23:37:47 +0100 From: Emmanuel Vadot To: Stefan Esser Cc: Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-Id: <20201102233747.f545b6ca667d4025a3f3371b@bidouilliste.com> In-Reply-To: References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4CQ78s3qRCz46k7 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=H5+RbgmG; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-3.19 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; FREEFALL_USER(0.00)[manu]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:c]; MV_CASE(0.50)[]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.02)[-1.023]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_TLS_ALL(0.00)[]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.64)[-0.642]; NEURAL_HAM_MEDIUM(-1.03)[-1.029]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org]; MAILMAN_DEST(0.00)[svn-src-head,svn-src-all]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:37:51 -0000 On Mon, 2 Nov 2020 23:24:34 +0100 Stefan Esser wrote: > Am 02.11.20 um 22:49 schrieb Emmanuel Vadot: > > On Mon, 2 Nov 2020 22:41:38 +0100 > > Stefan Esser wrote: > >=20 > >> Am 02.11.20 um 20:20 schrieb Oliver Pinter:> On Monday, November 2, > >> 2020, Stefan E=DFer >>> > wrote: > >>> > >>> Author: se > >>> Date: Mon Nov=A0 2 18:48:06 2020 > >>> New Revision: 367280 > >>> URL: https://svnweb.freebsd.org/changeset/base/367280 > >>> > >>> > >>> Log: > >>> =A0 Re-arrange some of the code to separate writable user tree > >>> variables from > >>> =A0 R/O variables. > >>> > >>> =A0 While here fix some nearby style. No functional change inte= nded. > >>> > >>> =A0 MFC after:=A0 =A0 1 month > >>> > >>> > >>> Is there any phabricator reference for this / these commit(s) + revie= wer > >>> lists? > >> > >> The previous commit that has been refined in this one has been > >> discussed in D27009. > >> > >> I had added the new R/W sysctl variable to a switch statement that > >> contained one R/O string value, and excluded the OID from causing > >> an error return when a new value had been passed. > >> > >> This was functionally OK, but I have decided to move handling of > >> the new writable variable to before the check for a write attempt > >> and thus need to test specifically for its OID. > >> > >> This sysctl variable is referenced in Scott Longs proposed > >> getlocalbase() function (D27022), but also in the change to make > >> it define defaults paths in /etc/defaults/rc.conf (D27014). > >> > >> I do not support to make LOCALBASE dynamic for a broad range of > >> programs, since this could lead to severe security issues (e.g. > >> when a program is restricted by policy settings LOCALBASE/etc and > >> an user-defined LOCALBASE could be used to circumvent them. > >> > >> There are already programs that respect a LOCALBASE environment > >> variable, e.g. the pkg program, to allow it to e.g. operate with > >> a DESTDIR prefix other than "/". This is a program that could > >> instead use getlocalbase(), IMHO. > >> > >> But for security reasons all files that determine policies and > >> exist in LOCALBASE since they are not distributed as part of the > >> base system, should be located in a secure way, and that is by > >> referring to a compiled in trusted path, IMHO. > >> > >> Even if the sysctl variable "user.localbase" can only be written to > >> by root, the use of getlocalbase() provided by a shared library could > >> allow to perform a LD_PRELOAD attack (provide a getlocalbase() that > >> leadsto a user provided policy file instead of the admin controlled > >> one). > >> > >> Regards, STefan > >=20 > > I think that the first question we want to ask is : Do we want to > > support LOCALBASE being different than /usr/local >=20 > The big majority of users will keep the default value, and I do not > see a good reason for a change, except if there is a large installed > base that traditionally uses another prefix (I have seen /vol/local > and /opt, but also OS and architecture-specific prefixes, for example). I'd still like to see some arguments for such installs. > > I honestly don't see any advantages of making it !=3D/usr/local/ and > > before we start putting a lot of new/useless(for I guess 99% of our > > user base) in the tree we should here why people are using /usr/pkg or > > whatever weird location. >=20 > No, why should we [assess] (assuming that word is to be implied in > your sentence) why people want to be able to easily use a different > prefix? That would be a waste of time, IMHO. >=20 > I know that there are legitimate reasons to want a different prefix, > and we had requests to make it easier to support it. What are thoses ? > We have literal uses of /usr/local in a lot of files in the FreeBSD > base system (more than 1700) and this is not going to change. >=20 > But it was easy to replace a number of such literal pathes in base > system binaries, and we can make it easier for those that need a > different prefix to get it consistently used. >=20 > > If they have some good argument, then we should proceed further. >=20 > You do not have to participate in this effort=20 I do have to participate, it's a common project. Also since I also participate in pkg(8) and in ports/Mk lua/blah stuff there might be some stuff to do there so yes I need to participate. And since you never really started a conversation on a ml (that I know of) my only mean to start this participation is answering a commit email. > - there are so many > other areas to work on (and I know you are very active in one). Only one ? Damn, I should work more then. > But please do not ask those that have started to reduce the use of > literal /usr/local in the base system to justify this work. Seriously ? I have every right to ask you to justify this when it was not talked about in a public forum. > If you are happy with /usr/local, then you are not affected at all. > And if you need to configure your system to use a different prefix, > you are welcome to let us know which steps are still causing much > effort and should be worked on to make it easier ... >=20 > Do you have any reason to be against removal of literal /usr/local > from the base system in favor of using a symbolic name for it? Do you have any reason to remove them at all ? > Regards, STefan --=20 Emmanuel Vadot From owner-svn-src-head@freebsd.org Mon Nov 2 22:40:49 2020 Return-Path: Delivered-To: svn-src-head@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 0FC8045D244; Mon, 2 Nov 2020 22:40:49 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (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 (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQ7DJ06h6z46l0; Mon, 2 Nov 2020 22:40:47 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1604356846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Uezipp7EoVuadyGnzeDPKyRlTeHF0n+a3QpylyMInz0=; b=bfIT0T2A/9V1YQ4NGfJUDOQn9ScbNba90yM6xSw29E3pNffesxDw6UeZKXuWgSHOO4VSP2 2iDJs/hX+RSCbHdUhFKoKpuCLozdVpdh2JbsALCyBNYBQzZ4ko7u/8Y3B6jrowipOJl0gk SkAK7ZRyrqg8Oh1bRb+E2XyvUbRfn/o= Received: from amy.home (lfbn-idf2-1-288-247.w82-123.abo.wanadoo.fr [82.123.126.247]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 6680a4d3 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 2 Nov 2020 22:40:46 +0000 (UTC) Date: Mon, 2 Nov 2020 23:40:45 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: Stefan Esser , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-Id: <20201102234045.2c932050240f040752ca066b@bidouilliste.com> In-Reply-To: <20201102223214.GO2654@kib.kiev.ua> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> <20201102232215.3ae253e0478791a3261d1dd1@bidouilliste.com> <20201102223214.GO2654@kib.kiev.ua> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CQ7DJ06h6z46l0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mx header.b=bfIT0T2A; dmarc=pass (policy=none) header.from=bidouilliste.com; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.155.74 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-2.94 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mx]; FREEFALL_USER(0.00)[manu]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+mx:c]; MIME_GOOD(-0.10)[text/plain]; MID_RHS_MATCH_FROM(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.01)[-1.013]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_TLS_ALL(0.00)[]; DMARC_POLICY_ALLOW(-0.50)[bidouilliste.com,none]; NEURAL_HAM_SHORT(-0.38)[-0.379]; NEURAL_HAM_MEDIUM(-1.05)[-1.051]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:12876, ipnet:212.83.128.0/19, country:FR]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-head,svn-src-all] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:40:49 -0000 On Tue, 3 Nov 2020 00:32:14 +0200 Konstantin Belousov wrote: > On Mon, Nov 02, 2020 at 11:22:15PM +0100, Emmanuel Vadot wrote: > > On Tue, 3 Nov 2020 00:10:39 +0200 > > Konstantin Belousov wrote: > > > > > On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: > > > > I think that the first question we want to ask is : Do we want to > > > > support LOCALBASE being different than /usr/local > > > > I honestly don't see any advantages of making it !=/usr/local/ and > > > > before we start putting a lot of new/useless(for I guess 99% of our > > > > user base) in the tree we should here why people are using /usr/pkg or > > > > whatever weird location. > > > > If they have some good argument, then we should proceed further. > > > > > > I would be delighted to be able to install _and use_ two independent > > > set of packages from the same base system install. Without recursing > > > to jails, X forwarding, etc. > > > > > > In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64 > > > machine. I am fine with me building both of them in my instance of > > > poudriere. > > > > > > But indeed I am not sure if this worth the effort of many people, for many > > > hours. If it puts too high burden on everybody, then it is not a good > > > feature. Otherwise, it is very convenient in some situations. > > > > I understand this situation but I think that the best way for you do > > do that is to use pkg install -r /path/to/my/i386/packages > > > > Since you will need to tweak you PATH variable to start applications > > installed in /usr/local-i386 anyway it's not too much to tweak that to > > the pkg path for your i386 repo. > > > > The "downside" of using this method is that you will have > > a /usr/local/ under the /path/to/my/i386/packages. > > The "upside" of using this method is that you would be able to use the > > same i386 packages on a native i386 install and they would install > > in /usr/local/ (so no tweaking here). > If I can already use them from non-/usr/local prefix, then it is great > news (for me). But I have a reason to doubt. If you pkg -r packages you can use a lot of them. > For instance, a lot of applications are configured at build time to look > for /usr/local. Like, gcc with /usr/local/lib/gcc/, and binutils, > which are actually one of the main use case for me. So I believe that > pkg install -r requires chroot/jail for the result to work. Yes there is still some cases like that, or packages having post-install script that don't handle -r. We've been working on that with bapt@ for a few months now and still do. The main motivation of rewriting everything in lua is to be able to do that but there is still a lot do to. Never the less we would appriciate some reports of people using packages installed with -r. -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Mon Nov 2 22:51:15 2020 Return-Path: Delivered-To: svn-src-head@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 2AE5945D541; Mon, 2 Nov 2020 22:51:15 +0000 (UTC) (envelope-from se@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 4CQ7SM0M2pz47VY; Mon, 2 Nov 2020 22:51:15 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f0bbc00143e0d922c7a134c.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:143e:d92:2c7a:134c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 43CC932C6E; Mon, 2 Nov 2020 22:51:14 +0000 (UTC) (envelope-from se@freebsd.org) To: Konstantin Belousov , Emmanuel Vadot Cc: src-committers , svn-src-all , svn-src-head@freebsd.org References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> From: Stefan Esser Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: Date: Mon, 2 Nov 2020 23:51:12 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201102221039.GN2654@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Bt1gXwao7w76TH9nawlpU0WcrSujUZFQV" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2020 22:51:15 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Bt1gXwao7w76TH9nawlpU0WcrSujUZFQV Content-Type: multipart/mixed; boundary="x7Do9OR2Bxd36IgyRUG9mu4au28cQaawh"; protected-headers="v1" From: Stefan Esser To: Konstantin Belousov , Emmanuel Vadot Cc: src-committers , svn-src-all , svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r367280 - head/lib/libc/gen References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> In-Reply-To: <20201102221039.GN2654@kib.kiev.ua> --x7Do9OR2Bxd36IgyRUG9mu4au28cQaawh Content-Type: multipart/mixed; boundary="------------D6EB14D6528CE6CC2773F283" Content-Language: en-US This is a multi-part message in MIME format. --------------D6EB14D6528CE6CC2773F283 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Am 02.11.20 um 23:10 schrieb Konstantin Belousov: > On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: >> I think that the first question we want to ask is : Do we want to >> support LOCALBASE being different than /usr/local >> I honestly don't see any advantages of making it !=3D/usr/local/ and= >> before we start putting a lot of new/useless(for I guess 99% of our >> user base) in the tree we should here why people are using /usr/pkg or= >> whatever weird location. >> If they have some good argument, then we should proceed further. >=20 > I would be delighted to be able to install _and use_ two independent > set of packages from the same base system install. Without recursing > to jails, X forwarding, etc. I understand the use case, and I agree this may be appropriate for a development system. But on a production system I'd never want to have a non-constant and not generally applied LOCALBASE, at least not on a system that gives a CLI to unprivileged users. Those could build their own copy of the LOCALBASE tree (e.g. sym-linking all sub-trees that are to be kept unmodified, replacing config files that policies that restrict the user). And if LOCALBASE is not compiled into binaries but somehow obtained at run-time, there are a number of attacks I can imagine (e.g. by LD_PRELOAD replace the sysctl() call in libc by your own version). > In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64= > machine. I am fine with me building both of them in my instance of > poudriere. This is a use-case for architecture dependent path definitions (which I have used some 30 years ago on HP-UX which supported 68k and HP-PA on a single file system that way). Such a feature has been discussed in FreeBSD multiple times over the decades ... > But indeed I am not sure if this worth the effort of many people, for m= any > hours. If it puts too high burden on everybody, then it is not a good > feature. Otherwise, it is very convenient in some situations. Up to now, not much effort has been spent on this issue. I have defined _PATH_LOCALBASE in paths.h to make it available for the calendar program to let it lookup port provided data files (and moving those to a port will simplify the maintenance of these calendar files). With _PATH_LOCALBASE available, it was sensible to replace literal uses of /usr/local in the tree with references to this symbolic name (and thus to easily build a base system for a different LOCALBASE value). The addition of the user.localbase sysctl tool less than 20 lines of code in 2 files (sys/kern_mib.c and lib/libc/gen/sysctl.c). This value can now be used to make /etc/defaults/rc.conf adapt to a changed LOCALBASE (just a few lines changed). All in all less than 50 lines of code have been affected, but this makes it much easier to build a system for a different (fixed) LOCALBASE. The getlocalbase() function proposed by Scott Long will allow to use a user-configured LOCALBASE in programs that use this function instead of a compiled in path. Another 20 lines of code, not complicated at all. But the security implications of the use of a dynamic LOCALBASE can be significant. And thus I do not think that we should put this function into programs without a prior security assessment. And it would be a major effort, which IMHO is not justified for most programs. But this is not an argument against the steps that have been taken up to now, with little effort and no weakening of security. Best regards, STefan --------------D6EB14D6528CE6CC2773F283-- --x7Do9OR2Bxd36IgyRUG9mu4au28cQaawh-- --Bt1gXwao7w76TH9nawlpU0WcrSujUZFQV Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+gjWEFAwAAAAAACgkQR+u171r99URz EAf/fi/UbOETvblOBljEb86tHgglCWwW7Oa8X62eBL+vNXuoT3XNeUBAKOxNUXKiwEVP5lMH4yLi ILWQ7w2bbNSZtT/Fl60bCkKWTJ7hCU6IGWNpPOulj+IiAdYrYMFpdqbqYwrbdFnPmJKL1i7h1BQw 8eeBzoMAYLJymIvlWDuVlYAWYGiFy9GujUDmhbHraNZn3e1k+vGXLrdK5+Cb+6RQUJnzqw1Sc7cQ K24trFYBWK3poerBje4zoGCdujwV5zl5Owf95AVXWWTUdW3Bh0+UnQmrtANFTiqG6/DXMl9/vSNU a4FWosLDkxJbQLuPg/H1H2Jj7QQlU5vLG7uLe3BdPA== =Hv6i -----END PGP SIGNATURE----- --Bt1gXwao7w76TH9nawlpU0WcrSujUZFQV-- From owner-svn-src-head@freebsd.org Tue Nov 3 01:10:28 2020 Return-Path: Delivered-To: svn-src-head@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 66F7B460229; Tue, 3 Nov 2020 01:10:28 +0000 (UTC) (envelope-from cem@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 4CQBY024ktz4HbF; Tue, 3 Nov 2020 01:10:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A8BF121F3; Tue, 3 Nov 2020 01:10:28 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A31ASCo036549; Tue, 3 Nov 2020 01:10:28 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A31ASdG036548; Tue, 3 Nov 2020 01:10:28 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011030110.0A31ASdG036548@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 3 Nov 2020 01:10:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367286 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 01:10:28 -0000 Author: cem Date: Tue Nov 3 01:10:27 2020 New Revision: 367286 URL: https://svnweb.freebsd.org/changeset/base/367286 Log: linux(4): style: Eliminate dead 'break' after 'return' No functional change. Modified: head/sys/compat/linux/linux_misc.c Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Mon Nov 2 21:47:34 2020 (r367285) +++ head/sys/compat/linux/linux_misc.c Tue Nov 3 01:10:27 2020 (r367286) @@ -1955,7 +1955,6 @@ linux_prctl(struct thread *td, struct linux_prctl_args return (copyout(&pdeath_signal, (void *)(register_t)args->arg2, sizeof(pdeath_signal))); - break; case LINUX_PR_SET_DUMPABLE: linux_msg(td, "unsupported prctl PR_SET_DUMPABLE"); error = EINVAL; From owner-svn-src-head@freebsd.org Tue Nov 3 01:17:46 2020 Return-Path: Delivered-To: svn-src-head@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 C7140460CEA; Tue, 3 Nov 2020 01:17:46 +0000 (UTC) (envelope-from cem@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 4CQBjQ4yZcz4JkS; Tue, 3 Nov 2020 01:17:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A2BB123ED; Tue, 3 Nov 2020 01:17:46 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A31HkhW042279; Tue, 3 Nov 2020 01:17:46 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A31HjjR042275; Tue, 3 Nov 2020 01:17:45 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011030117.0A31HjjR042275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 3 Nov 2020 01:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367287 - in head: share/man/man4 sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: share/man/man4 sys/kern sys/sys X-SVN-Commit-Revision: 367287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 01:17:46 -0000 Author: cem Date: Tue Nov 3 01:17:45 2020 New Revision: 367287 URL: https://svnweb.freebsd.org/changeset/base/367287 Log: unix(4): Add SOL_LOCAL:LOCAL_CREDS_PERSISTENT This option is intended to be semantically identical to Linux's SOL_SOCKET:SO_PASSCRED. For now, it is mutually exclusive with the pre-existing sockopt SOL_LOCAL:LOCAL_CREDS. Reviewed by: markj (penultimate version) Differential Revision: https://reviews.freebsd.org/D27011 Modified: head/share/man/man4/unix.4 head/sys/kern/uipc_usrreq.c head/sys/sys/un.h head/sys/sys/unpcb.h Modified: head/share/man/man4/unix.4 ============================================================================== --- head/share/man/man4/unix.4 Tue Nov 3 01:10:27 2020 (r367286) +++ head/share/man/man4/unix.4 Tue Nov 3 01:17:45 2020 (r367287) @@ -28,7 +28,7 @@ .\" @(#)unix.4 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd August 3, 2020 +.Dd November 2, 2020 .Dt UNIX 4 .Os .Sh NAME @@ -201,7 +201,7 @@ which can be set with .Xr setsockopt 2 and tested with .Xr getsockopt 2 : -.Bl -tag -width ".Dv LOCAL_CONNWAIT" +.Bl -tag -width ".Dv LOCAL_CREDS_PERSISTENT" .It Dv LOCAL_CREDS This option may be enabled on .Dv SOCK_DGRAM , @@ -287,6 +287,19 @@ such as error messages. Therefore, a message accompanied by a particular .Fa sc_euid value should not be trusted as being from that user. +.It Dv LOCAL_CREDS_PERSISTENT +This option is similar to +.Dv LOCAL_CREDS , +except that socket credentials are passed on every read from a +.Dv SOCK_STREAM +or +.Dv SOCK_SEQPACKET +socket, instead of just the first read. +The +.Dv LOCAL_CREDS +and +.Dv LOCAL_CREDS_PERSISTENT +options are mutually exclusive. .It Dv LOCAL_CONNWAIT Used with .Dv SOCK_STREAM Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Tue Nov 3 01:10:27 2020 (r367286) +++ head/sys/kern/uipc_usrreq.c Tue Nov 3 01:17:45 2020 (r367287) @@ -1040,7 +1040,7 @@ uipc_send(struct socket *so, int flags, struct mbuf *m break; } - if (unp2->unp_flags & UNP_WANTCRED) + if (unp2->unp_flags & UNP_WANTCRED_MASK) control = unp_addsockcred(td, control); if (unp->unp_addr != NULL) from = (struct sockaddr *)unp->unp_addr; @@ -1094,12 +1094,13 @@ uipc_send(struct socket *so, int flags, struct mbuf *m break; } SOCKBUF_LOCK(&so2->so_rcv); - if (unp2->unp_flags & UNP_WANTCRED) { + if (unp2->unp_flags & UNP_WANTCRED_MASK) { /* - * Credentials are passed only once on SOCK_STREAM - * and SOCK_SEQPACKET. + * Credentials are passed only once on SOCK_STREAM and + * SOCK_SEQPACKET (LOCAL_CREDS => WANTCRED_ONESHOT), or + * forever (LOCAL_CREDS_PERSISTENT => WANTCRED_ALWAYS). */ - unp2->unp_flags &= ~UNP_WANTCRED; + unp2->unp_flags &= ~UNP_WANTCRED_ONESHOT; control = unp_addsockcred(td, control); } @@ -1405,10 +1406,16 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt case LOCAL_CREDS: /* Unlocked read. */ - optval = unp->unp_flags & UNP_WANTCRED ? 1 : 0; + optval = unp->unp_flags & UNP_WANTCRED_ONESHOT ? 1 : 0; error = sooptcopyout(sopt, &optval, sizeof(optval)); break; + case LOCAL_CREDS_PERSISTENT: + /* Unlocked read. */ + optval = unp->unp_flags & UNP_WANTCRED_ALWAYS ? 1 : 0; + error = sooptcopyout(sopt, &optval, sizeof(optval)); + break; + case LOCAL_CONNWAIT: /* Unlocked read. */ optval = unp->unp_flags & UNP_CONNWAIT ? 1 : 0; @@ -1424,28 +1431,38 @@ uipc_ctloutput(struct socket *so, struct sockopt *sopt case SOPT_SET: switch (sopt->sopt_name) { case LOCAL_CREDS: + case LOCAL_CREDS_PERSISTENT: case LOCAL_CONNWAIT: error = sooptcopyin(sopt, &optval, sizeof(optval), sizeof(optval)); if (error) break; -#define OPTSET(bit) do { \ +#define OPTSET(bit, exclusive) do { \ UNP_PCB_LOCK(unp); \ - if (optval) \ - unp->unp_flags |= bit; \ - else \ - unp->unp_flags &= ~bit; \ + if (optval) { \ + if ((unp->unp_flags & (exclusive)) != 0) { \ + UNP_PCB_UNLOCK(unp); \ + error = EINVAL; \ + break; \ + } \ + unp->unp_flags |= (bit); \ + } else \ + unp->unp_flags &= ~(bit); \ UNP_PCB_UNLOCK(unp); \ } while (0) switch (sopt->sopt_name) { case LOCAL_CREDS: - OPTSET(UNP_WANTCRED); + OPTSET(UNP_WANTCRED_ONESHOT, UNP_WANTCRED_ALWAYS); break; + case LOCAL_CREDS_PERSISTENT: + OPTSET(UNP_WANTCRED_ALWAYS, UNP_WANTCRED_ONESHOT); + break; + case LOCAL_CONNWAIT: - OPTSET(UNP_CONNWAIT); + OPTSET(UNP_CONNWAIT, 0); break; default: @@ -1651,8 +1668,7 @@ unp_copy_peercred(struct thread *td, struct unpcb *cli memcpy(&server_unp->unp_peercred, &listen_unp->unp_peercred, sizeof(server_unp->unp_peercred)); server_unp->unp_flags |= UNP_HAVEPC; - if (listen_unp->unp_flags & UNP_WANTCRED) - client_unp->unp_flags |= UNP_WANTCRED; + client_unp->unp_flags |= (listen_unp->unp_flags & UNP_WANTCRED_MASK); } static int @@ -2853,8 +2869,12 @@ db_print_unpflags(int unp_flags) db_printf("%sUNP_HAVEPC", comma ? ", " : ""); comma = 1; } - if (unp_flags & UNP_WANTCRED) { - db_printf("%sUNP_WANTCRED", comma ? ", " : ""); + if (unp_flags & UNP_WANTCRED_ALWAYS) { + db_printf("%sUNP_WANTCRED_ALWAYS", comma ? ", " : ""); + comma = 1; + } + if (unp_flags & UNP_WANTCRED_ONESHOT) { + db_printf("%sUNP_WANTCRED_ONESHOT", comma ? ", " : ""); comma = 1; } if (unp_flags & UNP_CONNWAIT) { Modified: head/sys/sys/un.h ============================================================================== --- head/sys/sys/un.h Tue Nov 3 01:10:27 2020 (r367286) +++ head/sys/sys/un.h Tue Nov 3 01:17:45 2020 (r367287) @@ -67,6 +67,7 @@ struct sockaddr_un { /* Socket options. */ #define LOCAL_PEERCRED 1 /* retrieve peer credentials */ #define LOCAL_CREDS 2 /* pass credentials to receiver */ +#define LOCAL_CREDS_PERSISTENT 3 /* pass credentials to receiver */ #define LOCAL_CONNWAIT 4 /* connects block until accepted */ /* Start of reserved space for third-party socket options. */ Modified: head/sys/sys/unpcb.h ============================================================================== --- head/sys/sys/unpcb.h Tue Nov 3 01:10:27 2020 (r367286) +++ head/sys/sys/unpcb.h Tue Nov 3 01:17:45 2020 (r367287) @@ -107,9 +107,12 @@ struct unpcb { * to determine whether the contents should be sent to the user or * not. */ -#define UNP_HAVEPC 0x001 -#define UNP_WANTCRED 0x004 /* credentials wanted */ +#define UNP_HAVEPC 0x001 +#define UNP_WANTCRED_ALWAYS 0x002 /* credentials wanted always */ +#define UNP_WANTCRED_ONESHOT 0x004 /* credentials wanted once */ #define UNP_CONNWAIT 0x008 /* connect blocks until accepted */ + +#define UNP_WANTCRED_MASK (UNP_WANTCRED_ONESHOT | UNP_WANTCRED_ALWAYS) /* * These flags are used to handle non-atomicity in connect() and bind() From owner-svn-src-head@freebsd.org Tue Nov 3 01:19:14 2020 Return-Path: Delivered-To: svn-src-head@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 5BA89460FD8; Tue, 3 Nov 2020 01:19:14 +0000 (UTC) (envelope-from cem@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 4CQBl61qq9z4K8l; Tue, 3 Nov 2020 01:19:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22438126AA; Tue, 3 Nov 2020 01:19:14 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A31JEkJ042384; Tue, 3 Nov 2020 01:19:14 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A31JEdb042383; Tue, 3 Nov 2020 01:19:14 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011030119.0A31JEdb042383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 3 Nov 2020 01:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367288 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 01:19:14 -0000 Author: cem Date: Tue Nov 3 01:19:13 2020 New Revision: 367288 URL: https://svnweb.freebsd.org/changeset/base/367288 Log: linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED This is required by some major linux applications, such as Chrome and Firefox. (As well as Electron-using applications, which are essentially a bundled version of Chrome.) Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27012 Modified: head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Tue Nov 3 01:17:45 2020 (r367287) +++ head/sys/compat/linux/linux_socket.c Tue Nov 3 01:19:13 2020 (r367288) @@ -222,6 +222,8 @@ linux_to_bsd_so_sockopt(int opt) return (SO_LINGER); case LINUX_SO_REUSEPORT: return (SO_REUSEPORT_LB); + case LINUX_SO_PASSCRED: + return (LOCAL_CREDS_PERSISTENT); case LINUX_SO_PEERCRED: return (LOCAL_PEERCRED); case LINUX_SO_RCVLOWAT: @@ -1445,6 +1447,9 @@ linux_setsockopt(struct thread *td, struct linux_setso case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); switch (name) { + case LOCAL_CREDS_PERSISTENT: + level = SOL_LOCAL; + break; case SO_RCVTIMEO: /* FALLTHROUGH */ case SO_SNDTIMEO: @@ -1522,6 +1527,9 @@ linux_getsockopt(struct thread *td, struct linux_getso case SOL_SOCKET: name = linux_to_bsd_so_sockopt(args->optname); switch (name) { + case LOCAL_CREDS_PERSISTENT: + level = SOL_LOCAL; + break; case SO_RCVTIMEO: /* FALLTHROUGH */ case SO_SNDTIMEO: From owner-svn-src-head@freebsd.org Tue Nov 3 01:48:34 2020 Return-Path: Delivered-To: svn-src-head@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 4E88B462630; Tue, 3 Nov 2020 01:48:34 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from duke.cs.duke.edu (duke.cs.duke.edu [152.3.140.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CQCNx1QjKz4M9P; Tue, 3 Nov 2020 01:48:33 +0000 (UTC) (envelope-from gallatin@cs.duke.edu) Received: from [192.168.1.2] (pool-74-110-137-7.rcmdva.fios.verizon.net [74.110.137.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gallatin) by duke.cs.duke.edu (Postfix) with ESMTPSA id ABC042700189; Mon, 2 Nov 2020 20:48:31 -0500 (EST) DMARC-Filter: OpenDMARC Filter v1.3.1 duke.cs.duke.edu ABC042700189 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=cs.duke.edu; s=mail0816; t=1604368111; bh=oabY6EpSvo7EVzfgduOTxFUQP136EaQnCZ3ae2WP0fk=; h=Subject:To:From:Date:From; b=lXvg8fUINl/+Sh7sr3rmtVvE52WMhBKOR87WeG9frek6d3xwqxOnrW6HLeZTEFLZ+ 1+CGFZ6pXk1nJlYaOgQFzsIdgegvlGjgyUfqZ0YFZQGhzal0UyGzjpPdWiYDs9aWaX x47Pt0pDz2r2il6ZnhXuKXQGvfBX1Bt5NzKGkuFqZtIRMboh2d8ixNL2lCjQ4Q13rd PHH61iQr+77f/OhBlzjT3DnpNev7UlScAMX+8R1uzZX1mXQoMS/ViGtFcg3igXWESo uB6Srbj4qFNYsTntu9iMCN5dbTD9tAn32tL87HLnVFEZ1QshBRjlMjT2VFWc8z/u/Z G9ETwzOdWZ0gw== Subject: Re: svn commit: r367288 - head/sys/compat/linux To: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011030119.0A31JEdb042383@repo.freebsd.org> From: Andrew Gallatin Message-ID: <17f7249f-0212-d46e-db63-2d4feda6e5b1@cs.duke.edu> Date: Mon, 2 Nov 2020 20:48:31 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <202011030119.0A31JEdb042383@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CQCNx1QjKz4M9P X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:13371, ipnet:152.3.128.0/17, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 01:48:34 -0000 On 11/2/20 8:19 PM, Conrad Meyer wrote: > > Log: > linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED > > This is required by some major linux applications, such as Chrome and > Firefox. (As well as Electron-using applications, which are essentially > a bundled version of Chrome.) > Awesome! Does this get electron apps working? Drew From owner-svn-src-head@freebsd.org Tue Nov 3 02:10:55 2020 Return-Path: Delivered-To: svn-src-head@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 1B8D646367C; Tue, 3 Nov 2020 02:10:55 +0000 (UTC) (envelope-from cem@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 4CQCtk74Blz4NWN; Tue, 3 Nov 2020 02:10:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D634E12CE7; Tue, 3 Nov 2020 02:10:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A32As7H074321; Tue, 3 Nov 2020 02:10:54 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A32AsV5074319; Tue, 3 Nov 2020 02:10:54 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011030210.0A32AsV5074319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 3 Nov 2020 02:10:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367290 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 02:10:55 -0000 Author: cem Date: Tue Nov 3 02:10:54 2020 New Revision: 367290 URL: https://svnweb.freebsd.org/changeset/base/367290 Log: linux(4) prctl(2): Implement PR_[GS]ET_DUMPABLE Proxy the flag to the roughly analogous FreeBSD procctl 'TRACE'. TRACE-disabled processes are not coredumped, and Linux !DUMPABLE processes can not be ptraced. There are some additional semantics around ownership of files in the /proc/[pid] pseudo-filesystem, which we do not attempt to emulate correctly at this time. Reviewed by: markj (earlier version) Differential Revision: https://reviews.freebsd.org/D27015 Modified: head/sys/compat/linux/linux_misc.c head/sys/compat/linux/linux_misc.h Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Tue Nov 3 01:38:16 2020 (r367289) +++ head/sys/compat/linux/linux_misc.c Tue Nov 3 02:10:54 2020 (r367290) @@ -1937,7 +1937,7 @@ linux_prctl(struct thread *td, struct linux_prctl_args int error = 0, max_size; struct proc *p = td->td_proc; char comm[LINUX_MAX_COMM_LEN]; - int pdeath_signal; + int pdeath_signal, trace_state; switch (args->option) { case LINUX_PR_SET_PDEATHSIG: @@ -1955,10 +1955,46 @@ linux_prctl(struct thread *td, struct linux_prctl_args return (copyout(&pdeath_signal, (void *)(register_t)args->arg2, sizeof(pdeath_signal))); + /* + * In Linux, this flag controls if set[gu]id processes can coredump. + * There are additional semantics imposed on processes that cannot + * coredump: + * - Such processes can not be ptraced. + * - There are some semantics around ownership of process-related files + * in the /proc namespace. + * + * In FreeBSD, we can (and by default, do) disable setuid coredump + * system-wide with 'sugid_coredump.' We control tracability on a + * per-process basis with the procctl PROC_TRACE (=> P2_NOTRACE flag). + * By happy coincidence, P2_NOTRACE also prevents coredumping. So the + * procctl is roughly analogous to Linux's DUMPABLE. + * + * So, proxy these knobs to the corresponding PROC_TRACE setting. + */ + case LINUX_PR_GET_DUMPABLE: + error = kern_procctl(td, P_PID, p->p_pid, PROC_TRACE_STATUS, + &trace_state); + if (error != 0) + return (error); + td->td_retval[0] = (trace_state != -1); + return (0); case LINUX_PR_SET_DUMPABLE: - linux_msg(td, "unsupported prctl PR_SET_DUMPABLE"); - error = EINVAL; - break; + /* + * It is only valid for userspace to set one of these two + * flags, and only one at a time. + */ + switch (args->arg2) { + case LINUX_SUID_DUMP_DISABLE: + trace_state = PROC_TRACE_CTL_DISABLE_EXEC; + break; + case LINUX_SUID_DUMP_USER: + trace_state = PROC_TRACE_CTL_ENABLE; + break; + default: + return (EINVAL); + } + return (kern_procctl(td, P_PID, p->p_pid, PROC_TRACE_CTL, + &trace_state)); case LINUX_PR_GET_KEEPCAPS: /* * Indicate that we always clear the effective and Modified: head/sys/compat/linux/linux_misc.h ============================================================================== --- head/sys/compat/linux/linux_misc.h Tue Nov 3 01:38:16 2020 (r367289) +++ head/sys/compat/linux/linux_misc.h Tue Nov 3 02:10:54 2020 (r367290) @@ -50,6 +50,7 @@ * Second arg is a ptr to return the * signal. */ +#define LINUX_PR_GET_DUMPABLE 3 #define LINUX_PR_SET_DUMPABLE 4 #define LINUX_PR_GET_KEEPCAPS 7 /* Get drop capabilities on setuid */ #define LINUX_PR_SET_KEEPCAPS 8 /* Set drop capabilities on setuid */ @@ -61,6 +62,11 @@ #define LINUX_PR_SET_PTRACER 1499557217 #define LINUX_MAX_COMM_LEN 16 /* Maximum length of the process name. */ + +/* For GET/SET DUMPABLE */ +#define LINUX_SUID_DUMP_DISABLE 0 /* Don't coredump setuid processes. */ +#define LINUX_SUID_DUMP_USER 1 /* Dump as user of process. */ +#define LINUX_SUID_DUMP_ROOT 2 /* Dump as root. */ #define LINUX_MREMAP_MAYMOVE 1 #define LINUX_MREMAP_FIXED 2 From owner-svn-src-head@freebsd.org Tue Nov 3 04:00:24 2020 Return-Path: Delivered-To: svn-src-head@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 87D0E449068; Tue, 3 Nov 2020 04:00:24 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f178.google.com (mail-oi1-f178.google.com [209.85.167.178]) (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 4CQGK33bn8z4XBd; Tue, 3 Nov 2020 04:00:23 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f178.google.com with SMTP id k27so17025197oij.11; Mon, 02 Nov 2020 20:00:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=vnnhv/8wWBtioZXAF3Bb8/q0WBC/qGNyFTYnUTnfZyY=; b=OY+D7b4tBOrR2zKQa07TGX2aV/LdL8Rr84tQ3cDdR2b+1VyrJUViby4CYUyDZNVAOs At25R3ReC9utS0RHdy7VRPAQ/Ef4VUhqUViBNcBCLjBL7+ZZWc6JJ7UdpVmsmlh6ngqA XfMR5S6JZ0uQwTgpn8pgUyMb+ch6mWZp/qZPN+gizjzXk9I6sfUNwDBUpIa0zBTcMehr knZIJVW/GT+bzG9VM95dPkpedRUB0g/4oepRgy3a8fkQyZaL3270q2a8yMxdADySMa+R aEP8oN5+GkhKffiB8zYSrQQNqW0Zr0VbuAGklUhnJaV1gbEyIkMJA/tLUTEALiQScgBb Mdaw== X-Gm-Message-State: AOAM533DL/MJQSt3wXoSUciVgBZWRKMjuSLllZVyS2hKDUlgnpWvsfRI ELslRMtiGSloinf33MiomAMKfYcceRs= X-Google-Smtp-Source: ABdhPJwM16U62yQMSJY4+ZeHkALsBRshEJr8kr+bmz6l3dO6IGG/rnteo1wDOLIhVG6um8mZmyAD1g== X-Received: by 2002:a05:6808:a90:: with SMTP id q16mr831536oij.17.1604376019231; Mon, 02 Nov 2020 20:00:19 -0800 (PST) Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com. [209.85.161.48]) by smtp.gmail.com with ESMTPSA id m11sm3840002oop.6.2020.11.02.20.00.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 Nov 2020 20:00:18 -0800 (PST) Received: by mail-oo1-f48.google.com with SMTP id j41so3895338oof.12; Mon, 02 Nov 2020 20:00:18 -0800 (PST) X-Received: by 2002:a4a:d6d0:: with SMTP id j16mr14208784oot.38.1604376018464; Mon, 02 Nov 2020 20:00:18 -0800 (PST) MIME-Version: 1.0 References: <202011030119.0A31JEdb042383@repo.freebsd.org> <17f7249f-0212-d46e-db63-2d4feda6e5b1@cs.duke.edu> In-Reply-To: <17f7249f-0212-d46e-db63-2d4feda6e5b1@cs.duke.edu> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Mon, 2 Nov 2020 20:00:07 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r367288 - head/sys/compat/linux To: Andrew Gallatin Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CQGK33bn8z4XBd X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.167.178 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-2.14 / 15.00]; HAS_REPLYTO(0.00)[cem@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-0.26)[-0.255]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.87)[-0.868]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.02)[-1.019]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.167.178:from]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.167.178:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 04:00:24 -0000 No, not as far as I can tell. On Mon, Nov 2, 2020 at 5:48 PM Andrew Gallatin wrote: > > On 11/2/20 8:19 PM, Conrad Meyer wrote: > > > > Log: > > linux(4): Emulate Linux SOL_SOCKET:SO_PASSCRED > > > > This is required by some major linux applications, such as Chrome and > > Firefox. (As well as Electron-using applications, which are essentially > > a bundled version of Chrome.) > > > > Awesome! Does this get electron apps working? > > Drew From owner-svn-src-head@freebsd.org Tue Nov 3 09:33:35 2020 Return-Path: Delivered-To: svn-src-head@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 8763B452D07 for ; Tue, 3 Nov 2020 09:33:35 +0000 (UTC) (envelope-from sent64627@spread5send1.com) Received: from mail228054.app5.reasonable5a.com (mail228054.app5.reasonable5a.com [103.71.228.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4CQPjT5YX9z4rpG for ; Tue, 3 Nov 2020 09:33:33 +0000 (UTC) (envelope-from sent64627@spread5send1.com) Received: from WIN-1D67MVONS8I (mail58251.app1.reasonables3.com [103.95.58.251]) by mail228054.app5.reasonable5a.com (Postfix) with ESMTPA id EE6271E11A1 for ; Tue, 3 Nov 2020 16:23:26 +0800 (HKT) From: "Linda" To: "svn-src-head@freebsd.org" Date: Tue, 03 Nov 2020 16:26:44 +0800 Subject: The knitting fabric and PU coated fabric X-Mailer: aspNetEmail ver 3.7.0.19 X-Spread-CampaignId: 314361 X-Spread-SubscriberId: 126010424 X-Spread-SpreaderId: 64627 X-Spread-Engine-Build: 4.0.7172.26848 Message-ID: X-Rspamd-Queue-Id: 4CQPjT5YX9z4rpG X-Spamd-Bar: ++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of sent64627@spread5send1.com designates 103.71.228.54 as permitted sender) smtp.mailfrom=sent64627@spread5send1.com X-Spamd-Result: default: False [8.60 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_MA_MISSING_TEXT(2.00)[]; R_SPF_ALLOW(-0.20)[+ip4:103.71.228.0/22]; URI_COUNT_ODD(1.00)[11]; NEURAL_HAM_SHORT(-0.07)[-0.068]; FORGED_SENDER(0.30)[lona@lonasign.com,sent64627@spread5send1.com]; RCVD_NO_TLS_LAST(0.10)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:~]; ASN(0.00)[asn:133054, ipnet:103.71.228.0/22, country:HK]; FROM_NEQ_ENVFROM(0.00)[lona@lonasign.com,sent64627@spread5send1.com]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.37)[-0.373]; HTML_SHORT_LINK_IMG_2(1.00)[]; MIME_GOOD(-0.10)[multipart/alternative]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; R_BAD_CTE_7BIT(3.50)[7bit]; DMARC_NA(0.00)[lonasign.com]; NEURAL_SPAM_MEDIUM(0.75)[0.747]; MIME_HTML_ONLY(0.20)[]; TO_DN_EQ_ADDR_ALL(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[svn-src-head] X-Spam: Yes MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 09:33:35 -0000 From owner-svn-src-head@freebsd.org Tue Nov 3 10:02:53 2020 Return-Path: Delivered-To: svn-src-head@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 A3B4B453BD6; Tue, 3 Nov 2020 10:02:53 +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 4CQQMK3ccmz4tMC; Tue, 3 Nov 2020 10:02:53 +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 5F51E18D54; Tue, 3 Nov 2020 10:02:53 +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 0A3A2rSP070446; Tue, 3 Nov 2020 10:02:53 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3A2rVo070445; Tue, 3 Nov 2020 10:02:53 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011031002.0A3A2rVo070445@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: Tue, 3 Nov 2020 10:02:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367291 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 367291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 10:02:53 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 3 10:02:52 2020 New Revision: 367291 URL: https://svnweb.freebsd.org/changeset/base/367291 Log: rc.d/zfs: Add shutdown to KEYWORDS The problem is that Without walling /etc/rc.d/zfs on shutdown, resources associated with ZFS mounts are not freed and the jails will remain in dying state. In addition, the dataset is now in a dangling state, as the jail it is attached to is dying. A known workaround for jails was to add the following lines to /etc/jail.conf, to make sure that "service zfs stop" is run when the jail is stopped: exec.stop = "/bin/sh /etc/rc.shutdown"; exec.stop += "/usr/sbin/service zfs stop || /usr/bin/true"; While the workaround seems to be okay-ish for the jail situation, it is still unclean. However, for physical hosts this may wreak havoc with the pool if shared spares are used, as "zfs unshare" is never invoked on shutdown. PR: 147444 Submitted by: Markus Stoff Reported by: Mykah Reviewed by: cy Approved by: cy (src) MFC after: 1 week Relnotes: yes Differential Revision: https://reviews.freebsd.org/D27039 Modified: head/libexec/rc/rc.d/zfs Modified: head/libexec/rc/rc.d/zfs ============================================================================== --- head/libexec/rc/rc.d/zfs Tue Nov 3 02:10:54 2020 (r367290) +++ head/libexec/rc/rc.d/zfs Tue Nov 3 10:02:52 2020 (r367291) @@ -6,6 +6,7 @@ # PROVIDE: zfs # REQUIRE: zfsbe # BEFORE: FILESYSTEMS var +# KEYWORD: shutdown . /etc/rc.subr From owner-svn-src-head@freebsd.org Tue Nov 3 10:33:22 2020 Return-Path: Delivered-To: svn-src-head@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 0A540454559; Tue, 3 Nov 2020 10:33:22 +0000 (UTC) (envelope-from se@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 4CQR2T6Xswz3SYH; Tue, 3 Nov 2020 10:33:21 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MBP-WLAN.fritz.box (p200300cd5f0bbc00143e0d922c7a134c.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:143e:d92:2c7a:134c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 33C881066E; Tue, 3 Nov 2020 10:33:21 +0000 (UTC) (envelope-from se@freebsd.org) To: Emmanuel Vadot Cc: Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102233747.f545b6ca667d4025a3f3371b@bidouilliste.com> From: Stefan Esser Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <1b636b92-92e8-4abf-0771-f7232ca6d25f@freebsd.org> Date: Tue, 3 Nov 2020 11:33:19 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201102233747.f545b6ca667d4025a3f3371b@bidouilliste.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="nWF3ctLDblUM08QlI0CssBQPj4K2op5fi" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 10:33:22 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --nWF3ctLDblUM08QlI0CssBQPj4K2op5fi Content-Type: multipart/mixed; boundary="bnHdc4RvExdOzlzQNCVkPQlF1bHOs4Rcr"; protected-headers="v1" From: Stefan Esser To: Emmanuel Vadot Cc: Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org Message-ID: <1b636b92-92e8-4abf-0771-f7232ca6d25f@freebsd.org> Subject: Re: svn commit: r367280 - head/lib/libc/gen References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102233747.f545b6ca667d4025a3f3371b@bidouilliste.com> In-Reply-To: <20201102233747.f545b6ca667d4025a3f3371b@bidouilliste.com> --bnHdc4RvExdOzlzQNCVkPQlF1bHOs4Rcr Content-Type: multipart/mixed; boundary="------------37EF1AE24478502182B2C699" Content-Language: en-US This is a multi-part message in MIME format. --------------37EF1AE24478502182B2C699 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable >>> I think that the first question we want to ask is : Do we want to >>> support LOCALBASE being different than /usr/local >> >> The big majority of users will keep the default value, and I do not >> see a good reason for a change, except if there is a large installed >> base that traditionally uses another prefix (I have seen /vol/local >> and /opt, but also OS and architecture-specific prefixes, for example)= =2E >=20 > I'd still like to see some arguments for such installs. There are no reasons, if you have a narrow scope where FreeBSD should get installed. If it only on individual desktop users' system, they are best served with LOCALBASE immutably fixed to /usr/local. But there are other kinds of user and I have already given examples. Companies that have tooling that traditionally used some other prefix will not rewrite all their tools if we tell them that only /usr/local is supported, for example. I do not have to justify the existence of such use cases, and I'm happy with /usr/local on all my systems. But I do know that such use cases do exist and I have worked in environments where they were relevant. >>> I honestly don't see any advantages of making it !=3D/usr/local/ a= nd >>> before we start putting a lot of new/useless(for I guess 99% of our >>> user base) in the tree we should here why people are using /usr/pkg o= r >>> whatever weird location. >> >> No, why should we [assess] (assuming that word is to be implied in >> your sentence) why people want to be able to easily use a different >> prefix? That would be a waste of time, IMHO. >> >> I know that there are legitimate reasons to want a different prefix, >> and we had requests to make it easier to support it. >=20 > What are thoses ? Please check the mail-lists since I did not save those messages. >> We have literal uses of /usr/local in a lot of files in the FreeBSD >> base system (more than 1700) and this is not going to change. >> >> But it was easy to replace a number of such literal pathes in base >> system binaries, and we can make it easier for those that need a >> different prefix to get it consistently used. >> >>> If they have some good argument, then we should proceed further. >> >> You do not have to participate in this effort >=20 > I do have to participate, it's a common project. But it does not affect you if you do not use it. > Also since I also participate in pkg(8) and in ports/Mk lua/blah stuf= f > there might be some stuff to do there so yes I need to participate. Ports should already support PREFIX and LOCALBASE other than /usr/local. And the pkg program even supports the LOCALBASE environment variable. All we try to do is go away from multiple inconsistent methods and mechanisms and make it easier for installations that do have a need for a different LOCALBASE to get in consistently applied to all parts of the system. (They have to go through the tree and apply local patches to program sources or config files, currently, but will then have the same result with much more effort spent by each of them.) > And since you never really started a conversation on a ml (that I kno= w > of) my only mean to start this participation is answering a commit > email. There has been a lengthy discussion in the thread about moving the calendar data files out of the base system. And there is review D26942, which was announced on the -current list and which you seem to have missed. Also relevant are D27009, D27014, and D27022, which have been mentioned in commits as far they have already been committed, but have not been widely announced. You can easily >> - there are so many >> other areas to work on (and I know you are very active in one). >=20 > Only one ? Damn, I should work more then. The most recent breakage you caused for me was the backlight kernel option that has been introduced without any discussion I'm aware of. Yes, I know about your involvement in getting support for modern GPUs into FreeBSD and appreciate it. >> But please do not ask those that have started to reduce the use of >> literal /usr/local in the base system to justify this work. >=20 > Seriously ? I have every right to ask you to justify this when it was= > not talked about in a public forum. What is the problem with replacing a literal string with a macro that provides the exact same string to the compiler (unless its definition in paths.h is changed). Why are you against Scott Long suggesting a function getlocalbase() that can be used as the official method to have a user supplied value of LOCALBASE become effective in a program instead of local hacks like checking for the LOCALBASE environment variable in some programs? This does not affect you at all, since you can continue to hard-code /usr/local or to continue to fetch LOCALBASE from the environment. But developers that want to make sure that a non-default value of LOCALBASE is consistently used by their software can make use of this function instead of inventing their own. >> If you are happy with /usr/local, then you are not affected at all. >> And if you need to configure your system to use a different prefix, >> you are welcome to let us know which steps are still causing much >> effort and should be worked on to make it easier ... >> >> Do you have any reason to be against removal of literal /usr/local >> from the base system in favor of using a symbolic name for it? >=20 > Do you have any reason to remove them at all ? No, I do not. But I do not want to further complicate the use of a non-default /usr/local in case it is required. And the easiest way to do this is to provide a system-wide define in a common include file, which already allowed you to specify e.g. the system-wide default PATH for user programs including /usr/local/bin and /usr/local/sbin. Changing that path makes a different LOCALBASE effective in all programs that have a default PATH compiled in. The change to paths.h was just to introduce _PATH_LOCALBASE in path.h for reference in _PATH_DEFPATH and some programs that had /usr/local as literal strings in paths they rely on. I really do not understand what's wrong with using a symbolic name for a directory instead of the literal string. And the change that started this thread makes the compiled in value of _PATH_LOCALBASE accessible by sysctl, in the same way as the default binary path already was as user.cs_path. What is your problem with being able to query that value? All of these changes have been available for review on Phabricator, but I have not announced this particular change on -hackers. But it has been reviewed and accepted by 2 core team members, which I think was sufficient support to let me commit them. Making the sysctl variable writable by root is an undocumented change in support of the getlocalbase() function proposed by one of those reviewers and is meant to simplify testing of such a function without the need for a locally patched kernel. This variable is currently not used by any program and its value therefore not relevant. I have spent more time on this discussion than on working on the code and I really do not understand what you are complaining about. The changes made and still planned to the base system with regard to LOCALBASE are not so different from the use of LOCALBASE in the ports system, which nobody seems to object to. Regards, STefan --------------37EF1AE24478502182B2C699-- --bnHdc4RvExdOzlzQNCVkPQlF1bHOs4Rcr-- --nWF3ctLDblUM08QlI0CssBQPj4K2op5fi Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+hMe8FAwAAAAAACgkQR+u171r99UQA SAf/cs81AsMR/MIL3nva6ELgUDElv8aN0yROGwMQ7GWwsUw0h3XBQpvxvaGWa0ptG+HjWZk+vZCy Z5KezLSsbuWsNUN7k9KIKZwnO5QYvAc8n66AKwGQI3OAedQ4B7ioJFAMpAUw98ceTWgzYHgIJIpn ayfnDy7imMU7k1Bepos3amqabPFz5jQiW2amjfwuODc4lBVrY+Pja7IsaMvN7QF4DbJPbcXPv0JT Iiy6szdwlSs3U90aldDrmYbkMsRGH30YCHRFR3XKvVTfdy/Eenm8b4tb4Upkl4XcCZBdZD0wjbx0 iNdBxxHOlKlPA/HYgKRs9Fl7V/LH5yoJNU6CDNPl1g== =6mdM -----END PGP SIGNATURE----- --nWF3ctLDblUM08QlI0CssBQPj4K2op5fi-- From owner-svn-src-head@freebsd.org Tue Nov 3 11:37:19 2020 Return-Path: Delivered-To: svn-src-head@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 D33A7455980; Tue, 3 Nov 2020 11:37:19 +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 4CQSSH5DMhz3WDc; Tue, 3 Nov 2020 11:37:19 +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 96EC419CF8; Tue, 3 Nov 2020 11:37:19 +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 0A3BbJ9H026067; Tue, 3 Nov 2020 11:37:19 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3BbJLh026066; Tue, 3 Nov 2020 11:37:19 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011031137.0A3BbJLh026066@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, 3 Nov 2020 11:37:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367292 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 367292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 11:37:19 -0000 Author: se Date: Tue Nov 3 11:37:19 2020 New Revision: 367292 URL: https://svnweb.freebsd.org/changeset/base/367292 Log: Check that #ifdef, #ifndef, and #undef are used with a single name This restores the parameter validation that has been peformed by cpp for defining and testing of names used in conditions. MFC after: 3 days Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Tue Nov 3 10:02:52 2020 (r367291) +++ head/usr.bin/calendar/io.c Tue Nov 3 11:37:19 2020 (r367292) @@ -89,22 +89,29 @@ static StringList *definitions = NULL; static struct event *events[MAXCOUNT]; static char *extradata[MAXCOUNT]; -static void +static char * trimlr(char **buf) { char *walk = *buf; + char *sep; char *last; while (isspace(*walk)) walk++; - if (*walk != '\0') { - last = walk + strlen(walk) - 1; + *buf = walk; + + sep = walk; + while (*sep != '\0' && !isspace(*sep)) + sep++; + + if (*sep != '\0') { + last = sep + strlen(sep) - 1; while (last > walk && isspace(*last)) last--; *(last+1) = 0; } - *buf = walk; + return (sep); } static FILE * @@ -167,7 +174,7 @@ cal_path(void) static int token(char *line, FILE *out, int *skip, int *unskip) { - char *walk, c, a; + char *walk, *sep, a, c; const char *this_cal_home; const char *this_cal_dir; const char *this_cal_file; @@ -188,14 +195,20 @@ token(char *line, FILE *out, int *skip, int *unskip) if (strncmp(line, "ifdef", 5) == 0) { walk = line + 5; - trimlr(&walk); + sep = trimlr(&walk); if (*walk == '\0') { WARN0("Expecting arguments after #ifdef"); return (T_ERR); } + if (*sep != '\0') { + WARN1("Expecting a single word after #ifdef " + "but got \"%s\"", walk); + return (T_ERR); + } - if (*skip != 0 || definitions == NULL || sl_find(definitions, walk) == NULL) + if (*skip != 0 || + definitions == NULL || sl_find(definitions, walk) == NULL) ++*skip; else ++*unskip; @@ -205,14 +218,20 @@ token(char *line, FILE *out, int *skip, int *unskip) if (strncmp(line, "ifndef", 6) == 0) { walk = line + 6; - trimlr(&walk); + sep = trimlr(&walk); if (*walk == '\0') { WARN0("Expecting arguments after #ifndef"); return (T_ERR); } + if (*sep != '\0') { + WARN1("Expecting a single word after #ifndef " + "but got \"%s\"", walk); + return (T_ERR); + } - if (*skip != 0 || (definitions != NULL && sl_find(definitions, walk) != NULL)) + if (*skip != 0 || + (definitions != NULL && sl_find(definitions, walk) != NULL)) ++*skip; else ++*unskip; @@ -222,7 +241,7 @@ token(char *line, FILE *out, int *skip, int *unskip) if (strncmp(line, "else", 4) == 0) { walk = line + 4; - trimlr(&walk); + (void)trimlr(&walk); if (*walk != '\0') { WARN0("Expecting no arguments after #else"); @@ -251,7 +270,7 @@ token(char *line, FILE *out, int *skip, int *unskip) if (strncmp(line, "include", 7) == 0) { walk = line + 7; - trimlr(&walk); + (void)trimlr(&walk); if (*walk == '\0') { WARN0("Expecting arguments after #include"); @@ -291,7 +310,8 @@ token(char *line, FILE *out, int *skip, int *unskip) if (definitions == NULL) definitions = sl_init(); walk = line + 6; - trimlr(&walk); + sep = trimlr(&walk); + *sep = '\0'; if (*walk == '\0') { WARN0("Expecting arguments after #define"); @@ -306,10 +326,15 @@ token(char *line, FILE *out, int *skip, int *unskip) if (strncmp(line, "undef", 5) == 0) { if (definitions != NULL) { walk = line + 5; - trimlr(&walk); + sep = trimlr(&walk); if (*walk == '\0') { WARN0("Expecting arguments after #undef"); + return (T_ERR); + } + if (*sep != '\0') { + WARN1("Expecting a single word after #undef " + "but got \"%s\"", walk); return (T_ERR); } From owner-svn-src-head@freebsd.org Tue Nov 3 12:15:08 2020 Return-Path: Delivered-To: svn-src-head@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 D8219456E2C; Tue, 3 Nov 2020 12:15:08 +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 4CQTHw5JLVz3Y5g; Tue, 3 Nov 2020 12:15:08 +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 993CE1A343; Tue, 3 Nov 2020 12:15:08 +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 0A3CF83d050304; Tue, 3 Nov 2020 12:15:08 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3CF8Dt050303; Tue, 3 Nov 2020 12:15:08 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011031215.0A3CF8Dt050303@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, 3 Nov 2020 12:15:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367293 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 367293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 12:15:08 -0000 Author: se Date: Tue Nov 3 12:15:08 2020 New Revision: 367293 URL: https://svnweb.freebsd.org/changeset/base/367293 Log: Consistently print calendar dates in the locale of the user Calendar files that specify LANG=... to specify their character encoding did also set the date format defined for that locale, resulting in output like: Nov 4 Gabriel Faure dies from pneumonia in Paris, France, 1924 4 nov. N'oubliez pas les Charles ! After this commit the output is always printed in a consistent format according to the user's current locale, e.g.: Nov 4 Gabriel Faure dies from pneumonia in Paris, France, 1924 Nov 4 N'oubliez pas les Charles ! I'll open a review asking for opinions whether this format change should be merged to -STABLE. Relnotes: yes Modified: head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Tue Nov 3 11:37:19 2020 (r367292) +++ head/usr.bin/calendar/io.c Tue Nov 3 12:15:08 2020 (r367293) @@ -468,8 +468,7 @@ cal_parse(FILE *in, FILE *out) * and does not run iconv(), this variable has little use. */ if (strncmp(buf, "LANG=", 5) == 0) { - (void)setlocale(LC_ALL, buf + 5); - d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); + (void)setlocale(LC_CTYPE, buf + 5); #ifdef WITH_ICONV if (!doall) set_new_encoding(); From owner-svn-src-head@freebsd.org Tue Nov 3 12:29:11 2020 Return-Path: Delivered-To: svn-src-head@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 2D30F45778B; Tue, 3 Nov 2020 12:29:11 +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 4CQTc70538z3Ynb; Tue, 3 Nov 2020 12:29:11 +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 DB9EA1A934; Tue, 3 Nov 2020 12:29:10 +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 0A3CTAib056626; Tue, 3 Nov 2020 12:29:10 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3CTAoR056624; Tue, 3 Nov 2020 12:29:10 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011031229.0A3CTAoR056624@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, 3 Nov 2020 12:29:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367294 - head/libexec/rc X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/libexec/rc X-SVN-Commit-Revision: 367294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 12:29:11 -0000 Author: se Date: Tue Nov 3 12:29:10 2020 New Revision: 367294 URL: https://svnweb.freebsd.org/changeset/base/367294 Log: Replace literal uses of /usr/local with a variable The variable defaults to "/usr/local", unless sysctl returns some other value for "user.localbase". The value of user.localbase defaults to _PATH_LOCALBASE as defined in paths.h and thus this commit has no immediate effect. The purpose of this change is to make /etc/defaults/rc.conf automatically use the value of _PATH_LOCALBASE when not set to the default value. Reviewed by: imp, scottl MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D27014 Modified: head/libexec/rc/rc head/libexec/rc/rc.conf Modified: head/libexec/rc/rc ============================================================================== --- head/libexec/rc/rc Tue Nov 3 12:15:08 2020 (r367293) +++ head/libexec/rc/rc Tue Nov 3 12:29:10 2020 (r367294) @@ -59,6 +59,8 @@ else _boot="quietstart" fi +_localbase=`/sbin/sysctl -n user.localbase 2> /dev/null` + dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` if [ ${dlv:=0} -ne 0 -o -f /etc/diskless ]; then sh /etc/rc.initdiskless Modified: head/libexec/rc/rc.conf ============================================================================== --- head/libexec/rc/rc.conf Tue Nov 3 12:15:08 2020 (r367293) +++ head/libexec/rc/rc.conf Tue Nov 3 12:29:10 2020 (r367294) @@ -21,6 +21,9 @@ ### Important initial Boot-time options #################### ############################################################## +# Set default value of _localbase if not previously set +: ${_localbase:="/usr/local"} + # rc_debug can't be set here without interferring with rc.subr's setting it # when the kenv variable rc.debug is set. #rc_debug="NO" # Set to YES to enable debugging output from rc.d @@ -58,7 +61,7 @@ varmfs_flags="-S" # Extra mount options for the mfs /v mfs_type="auto" # "md", "tmpfs", "auto" to prefer tmpfs with md as fallback populate_var="AUTO" # Set to YES to always (re)populate /var, NO to never cleanvar_enable="YES" # Clean the /var directory -local_startup="/usr/local/etc/rc.d" # startup script dirs. +local_startup="${_localbase}/etc/rc.d" # startup script dirs. script_name_sep=" " # Change if your startup scripts' names contain spaces rc_conf_files="/etc/rc.conf /etc/rc.conf.local" @@ -188,7 +191,7 @@ ipfw_netflow_enable="NO" # Enable netflow logging via ip_portrange_first="NO" # Set first dynamically allocated port ip_portrange_last="NO" # Set last dynamically allocated port ike_enable="NO" # Enable IKE daemon (usually racoon or isakmpd) -ike_program="/usr/local/sbin/isakmpd" # Path to IKE daemon +ike_program="${_localbase}/sbin/isakmpd" # Path to IKE daemon ike_flags="" # Additional flags for IKE daemon ipsec_enable="NO" # Set to YES to run setkey on ipsec_file ipsec_file="/etc/ipsec.conf" # Name of config file for setkey @@ -647,19 +650,19 @@ linux_mounts_enable="YES" # If linux_enable is set to clear_tmp_enable="NO" # Clear /tmp at startup. clear_tmp_X="YES" # Clear and recreate X11-related directories in /tmp ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks -ldconfig_paths="/usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg" +ldconfig_paths="/usr/lib/compat ${_localbase}/lib ${_localbase}/lib/compat/pkg" # shared library search paths ldconfig32_paths="/usr/lib32 /usr/lib32/compat" # 32-bit compatibility shared library search paths -ldconfigsoft_paths="/usr/libsoft /usr/libsoft/compat /usr/local/libsoft" +ldconfigsoft_paths="/usr/libsoft /usr/libsoft/compat ${_localbase}/libsoft" # soft float compatibility shared library search paths # Note: temporarily with extra stuff for transition -ldconfig_local_dirs="/usr/local/libdata/ldconfig" +ldconfig_local_dirs="${_localbase}/libdata/ldconfig" # Local directories with ldconfig configuration files. -ldconfig_local32_dirs="/usr/local/libdata/ldconfig32" +ldconfig_local32_dirs="${_localbase}/libdata/ldconfig32" # Local directories with 32-bit compatibility ldconfig # configuration files. -ldconfig_localsoft_dirs="/usr/local/libdata/ldconfigsoft" +ldconfig_localsoft_dirs="${_localbase}/libdata/ldconfigsoft" # Local directories with soft float compatibility ldconfig # configuration files. kern_securelevel_enable="NO" # kernel security level (see security(7)) From owner-svn-src-head@freebsd.org Tue Nov 3 13:26:00 2020 Return-Path: Delivered-To: svn-src-head@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 F2E5B458C1D; Tue, 3 Nov 2020 13:26: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 4CQVsh690Mz3cf3; Tue, 3 Nov 2020 13:26: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 B6E091B17D; Tue, 3 Nov 2020 13:26: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 0A3DQ01t093411; Tue, 3 Nov 2020 13:26:00 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3DQ0VE093410; Tue, 3 Nov 2020 13:26:00 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011031326.0A3DQ0VE093410@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: Tue, 3 Nov 2020 13:26:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367295 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 367295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 13:26:01 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 3 13:26:00 2020 New Revision: 367295 URL: https://svnweb.freebsd.org/changeset/base/367295 Log: Document how to set ports options via make.conf(5) This patch is based on: - https://lists.freebsd.org/pipermail/freebsd-ports-announce/2013-June/000062.html - current content of /usr/ports/Mk/bsd.options.mk PR: 194306 Reported by: Daan K. MFC after: 2 weeks Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Tue Nov 3 12:29:10 2020 (r367294) +++ head/share/man/man7/ports.7 Tue Nov 3 13:26:00 2020 (r367295) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2020 +.Dd November 3, 2020 .Dt PORTS 7 .Os .Sh NAME @@ -615,6 +615,25 @@ is going to be built with Python 3.7 support.) .Li # Ic cd /usr/ports/devel/py-pip .Li # Ic env FLAVOR=py37 make build .Ed +.It Sy Example 4\&: No Setting Ports Options via Xr make.conf 5 +.Pp +The following lines present various ways of configuring ports options via +.Xr make.conf 5 +(as an alternative to, e.g., running +.Dq Li make config ) : +.Bd -literal -offset 2n +# Enable NLS for all ports unless configured otherwise +# using the options dialog. +OPTIONS_SET= NLS +# Disable DOCS for all ports overriding the options set +# via the options dialog. +OPTIONS_UNSET_FORCE= DOCS +# Disable DOCS and EXAMPLES for the shells/zsh port. +shells_zsh_UNSET= DOCS EXAMPLES +.Ed +.Pp +These and other options-related variables are documented in +.Pa /usr/ports/Mk/bsd.options.mk . .El .Sh SEE ALSO .Xr make 1 , From owner-svn-src-head@freebsd.org Tue Nov 3 14:33:05 2020 Return-Path: Delivered-To: svn-src-head@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 4493E45A68D; Tue, 3 Nov 2020 14:33:05 +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 4CQXM5189qz3yBP; Tue, 3 Nov 2020 14:33:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B76E1C16E; Tue, 3 Nov 2020 14:33:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3EX4w8036314; Tue, 3 Nov 2020 14:33:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3EX4DB036313; Tue, 3 Nov 2020 14:33:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011031433.0A3EX4DB036313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 3 Nov 2020 14:33:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367296 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 367296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 14:33:05 -0000 Author: kib Date: Tue Nov 3 14:33:04 2020 New Revision: 367296 URL: https://svnweb.freebsd.org/changeset/base/367296 Log: if_media.c SIOCGMEDIAX handler: improve loop Stop advancing counter past the current iteration number at the start of iteration. This removes the need of subtracting one when calculating index for copyout, and arguably fixes off-by-one reporting of copied out elements when copyout failed. Reviewed by: hselasky Sponsored by: Mellanox Technologies / NVidia Networking MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27073 Modified: head/sys/net/if_media.c Modified: head/sys/net/if_media.c ============================================================================== --- head/sys/net/if_media.c Tue Nov 3 13:26:00 2020 (r367295) +++ head/sys/net/if_media.c Tue Nov 3 14:33:04 2020 (r367296) @@ -300,15 +300,17 @@ ifmedia_ioctl(struct ifnet *ifp, struct ifreq *ifr, st * allocate. */ i = 0; - LIST_FOREACH(ep, &ifm->ifm_list, ifm_list) - if (i++ < ifmr->ifm_count) { + LIST_FOREACH(ep, &ifm->ifm_list, ifm_list) { + if (i < ifmr->ifm_count) { error = copyout(&ep->ifm_media, - ifmr->ifm_ulist + i - 1, sizeof(int)); - if (error) + ifmr->ifm_ulist + i, sizeof(int)); + if (error != 0) break; } + i++; + } if (error == 0 && i > ifmr->ifm_count) - error = ifmr->ifm_count ? E2BIG : 0; + error = ifmr->ifm_count != 0 ? E2BIG : 0; ifmr->ifm_count = i; break; } From owner-svn-src-head@freebsd.org Tue Nov 3 14:44:34 2020 Return-Path: Delivered-To: svn-src-head@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 5186145AB72; Tue, 3 Nov 2020 14:44:34 +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 4CQXcL1W44z40lM; Tue, 3 Nov 2020 14:44:34 +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 167901C073; Tue, 3 Nov 2020 14:44:34 +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 0A3EiXaX043077; Tue, 3 Nov 2020 14:44:33 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3EiX1p043076; Tue, 3 Nov 2020 14:44:33 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011031444.0A3EiX1p043076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 3 Nov 2020 14:44:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367298 - 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: 367298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 14:44:34 -0000 Author: trasz Date: Tue Nov 3 14:44:33 2020 New Revision: 367298 URL: https://svnweb.freebsd.org/changeset/base/367298 Log: Fix rookie mistake - it's nitems(), not sizeof(). Reported by: xtouqh_icloud.com MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_errno.c Modified: head/sys/compat/linux/linux_errno.c ============================================================================== --- head/sys/compat/linux/linux_errno.c Tue Nov 3 14:41:49 2020 (r367297) +++ head/sys/compat/linux/linux_errno.c Tue Nov 3 14:44:33 2020 (r367298) @@ -27,7 +27,7 @@ linux_check_errtbl(void) { int i; - for (i = 1; i < sizeof(linux_errtbl); i++) { + for (i = 1; i < nitems(linux_errtbl); i++) { KASSERT(linux_errtbl[i] != 0, ("%s: linux_errtbl[%d] == 0", __func__, i)); } From owner-svn-src-head@freebsd.org Tue Nov 3 18:02:02 2020 Return-Path: Delivered-To: svn-src-head@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 E67B645EFDF; Tue, 3 Nov 2020 18:02:02 +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 4CQd0B5lfLz4DDJ; Tue, 3 Nov 2020 18:02:02 +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 A43851E7E7; Tue, 3 Nov 2020 18:02:02 +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 0A3I221J066330; Tue, 3 Nov 2020 18:02:02 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3I22rb066329; Tue, 3 Nov 2020 18:02:02 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011031802.0A3I22rb066329@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: Tue, 3 Nov 2020 18:02:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367299 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 367299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 18:02:03 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 3 18:02:02 2020 New Revision: 367299 URL: https://svnweb.freebsd.org/changeset/base/367299 Log: Fix a typo in the description of WITH_DEBUG_PORTS For each origin listed in WITH_DEBUG_PORTS, the ports framework sets WITH_DEBUG instead of WITH_DEBUG_PORTS. MFC after: 3 days Modified: head/share/man/man7/ports.7 Modified: head/share/man/man7/ports.7 ============================================================================== --- head/share/man/man7/ports.7 Tue Nov 3 14:44:33 2020 (r367298) +++ head/share/man/man7/ports.7 Tue Nov 3 18:02:02 2020 (r367299) @@ -560,7 +560,7 @@ Porter's Handbook. If set, debugging symbols are installed for ports binaries. .It Va WITH_DEBUG_PORTS A list of origins for which to set -.Va WITH_DEBUG_PORTS . +.Va WITH_DEBUG . .It Va WITH_CCACHE_BUILD .Pq Vt bool If set, enables the use of From owner-svn-src-head@freebsd.org Tue Nov 3 18:13:43 2020 Return-Path: Delivered-To: svn-src-head@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 6171045F74E; Tue, 3 Nov 2020 18:13:43 +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 4CQdFg1vQ6z4FTf; Tue, 3 Nov 2020 18:13:43 +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 23EAB1EA4C; Tue, 3 Nov 2020 18:13:43 +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 0A3IDhLo073877; Tue, 3 Nov 2020 18:13:43 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3IDhiQ073876; Tue, 3 Nov 2020 18:13:43 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011031813.0A3IDhiQ073876@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: Tue, 3 Nov 2020 18:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367300 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 367300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 18:13:43 -0000 Author: 0mp (doc,ports committer) Date: Tue Nov 3 18:13:42 2020 New Revision: 367300 URL: https://svnweb.freebsd.org/changeset/base/367300 Log: build.7: Mention etcupdate(8) alongside mergemaster(8) MFC after: 3 days Modified: head/share/man/man7/build.7 Modified: head/share/man/man7/build.7 ============================================================================== --- head/share/man/man7/build.7 Tue Nov 3 18:02:02 2020 (r367299) +++ head/share/man/man7/build.7 Tue Nov 3 18:13:42 2020 (r367300) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 11, 2020 +.Dd November 3, 2020 .Dt BUILD 7 .Os .Sh NAME @@ -864,6 +864,7 @@ manpage first appeared in .Xr release 7 , .Xr tests 7 , .Xr config 8 , +.Xr etcupdate 8 , .Xr mergemaster 8 , .Xr reboot 8 , .Xr shutdown 8 From owner-svn-src-head@freebsd.org Tue Nov 3 19:12:34 2020 Return-Path: Delivered-To: svn-src-head@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 597A7460AC7; Tue, 3 Nov 2020 19:12:34 +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 4CQfYZ1fPLz4J3G; Tue, 3 Nov 2020 19:12:34 +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 1BE721F57A; Tue, 3 Nov 2020 19:12:34 +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 0A3JCXGu010301; Tue, 3 Nov 2020 19:12:33 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3JCXL0010296; Tue, 3 Nov 2020 19:12:33 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011031912.0A3JCXL0010296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 3 Nov 2020 19:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367301 - in head: lib/libsysdecode sys/compat/linux sys/modules/linux_common X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: lib/libsysdecode sys/compat/linux sys/modules/linux_common X-SVN-Commit-Revision: 367301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 19:12:34 -0000 Author: trasz Date: Tue Nov 3 19:12:33 2020 New Revision: 367301 URL: https://svnweb.freebsd.org/changeset/base/367301 Log: Make linux_errtbl[] static. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27004 Modified: head/lib/libsysdecode/errno.c head/sys/compat/linux/linux_emul.h head/sys/compat/linux/linux_errno.inc head/sys/modules/linux_common/Makefile Modified: head/lib/libsysdecode/errno.c ============================================================================== --- head/lib/libsysdecode/errno.c Tue Nov 3 18:13:42 2020 (r367300) +++ head/lib/libsysdecode/errno.c Tue Nov 3 19:12:33 2020 (r367301) @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #if defined(__aarch64__) || defined(__amd64__) || defined(__i386__) #include -static #include #endif Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Tue Nov 3 18:13:42 2020 (r367300) +++ head/sys/compat/linux/linux_emul.h Tue Nov 3 19:12:33 2020 (r367301) @@ -80,6 +80,4 @@ struct linux_pemuldata { struct linux_pemuldata *pem_find(struct proc *); -extern const int linux_errtbl[]; - #endif /* !_LINUX_EMUL_H_ */ Modified: head/sys/compat/linux/linux_errno.inc ============================================================================== --- head/sys/compat/linux/linux_errno.inc Tue Nov 3 18:13:42 2020 (r367300) +++ head/sys/compat/linux/linux_errno.inc Tue Nov 3 19:12:33 2020 (r367301) @@ -38,7 +38,7 @@ * XXX: The "XXX" comments below should be replaced with rationale * for the errno value chosen. */ -const int linux_errtbl[ELAST + 1] = { +static const int linux_errtbl[ELAST + 1] = { /* [0, 9] */ [0] = -0, [EPERM] = -LINUX_EPERM, Modified: head/sys/modules/linux_common/Makefile ============================================================================== --- head/sys/modules/linux_common/Makefile Tue Nov 3 18:13:42 2020 (r367300) +++ head/sys/modules/linux_common/Makefile Tue Nov 3 19:12:33 2020 (r367301) @@ -9,7 +9,6 @@ SRCS= linux_common.c linux_mib.c linux_mmap.c linux_ut EXPORT_SYMS= EXPORT_SYMS+= linux_emul_path -EXPORT_SYMS+= linux_errtbl EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname From owner-svn-src-head@freebsd.org Tue Nov 3 19:14:04 2020 Return-Path: Delivered-To: svn-src-head@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 747FE460A75; Tue, 3 Nov 2020 19:14:04 +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 4CQfbJ2SZZz4JSL; Tue, 3 Nov 2020 19:14:04 +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 37A481F5C6; Tue, 3 Nov 2020 19:14:04 +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 0A3JE31m010416; Tue, 3 Nov 2020 19:14:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3JE3rd010415; Tue, 3 Nov 2020 19:14:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <202011031914.0A3JE3rd010415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 3 Nov 2020 19:14:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367302 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 19:14:04 -0000 Author: brooks Date: Tue Nov 3 19:14:03 2020 New Revision: 367302 URL: https://svnweb.freebsd.org/changeset/base/367302 Log: sysvshm: pass relevant uap members as arguments Alter shmget_allocate_segment and shmget_existing to take the values they want from struct shmget_args rather than passing the struct around. In general, uap structures should only be the interface to sys_ functions. This makes on small functional change and records the allocated space rather than the requested space. If this turns out to be a problem (e.g. if software tries to find undersized segments by exact size rather than using keys), we can correct that easily. Reviewed by: kib Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27077 Modified: head/sys/kern/sysv_shm.c Modified: head/sys/kern/sysv_shm.c ============================================================================== --- head/sys/kern/sysv_shm.c Tue Nov 3 19:12:33 2020 (r367301) +++ head/sys/kern/sysv_shm.c Tue Nov 3 19:14:03 2020 (r367302) @@ -111,11 +111,6 @@ FEATURE(sysv_shm, "System V shared memory segments sup static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments"); -static int shmget_allocate_segment(struct thread *td, - struct shmget_args *uap, int mode); -static int shmget_existing(struct thread *td, struct shmget_args *uap, - int mode, int segnum); - #define SHMSEG_FREE 0x0200 #define SHMSEG_REMOVED 0x0400 #define SHMSEG_ALLOCATED 0x0800 @@ -134,6 +129,10 @@ static void shm_deallocate_segment(struct shmid_kernel static int shm_find_segment_by_key(struct prison *, key_t); static struct shmid_kernel *shm_find_segment(struct prison *, int, bool); static int shm_delete_mapping(struct vmspace *vm, struct shmmap_state *); +static int shmget_allocate_segment(struct thread *td, key_t key, size_t size, + int mode); +static int shmget_existing(struct thread *td, size_t size, int shmflg, + int mode, int segnum); static void shmrealloc(void); static int shminit(void); static int sysvshm_modload(struct module *, int, void *); @@ -659,7 +658,7 @@ done: } static int -shmget_existing(struct thread *td, struct shmget_args *uap, int mode, +shmget_existing(struct thread *td, size_t size, int shmflg, int mode, int segnum) { struct shmid_kernel *shmseg; @@ -671,35 +670,34 @@ shmget_existing(struct thread *td, struct shmget_args KASSERT(segnum >= 0 && segnum < shmalloced, ("segnum %d shmalloced %d", segnum, shmalloced)); shmseg = &shmsegs[segnum]; - if ((uap->shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) + if ((shmflg & (IPC_CREAT | IPC_EXCL)) == (IPC_CREAT | IPC_EXCL)) return (EEXIST); #ifdef MAC - error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, uap->shmflg); + error = mac_sysvshm_check_shmget(td->td_ucred, shmseg, shmflg); if (error != 0) return (error); #endif - if (uap->size != 0 && uap->size > shmseg->u.shm_segsz) + if (size != 0 && size > shmseg->u.shm_segsz) return (EINVAL); td->td_retval[0] = IXSEQ_TO_IPCID(segnum, shmseg->u.shm_perm); return (0); } static int -shmget_allocate_segment(struct thread *td, struct shmget_args *uap, int mode) +shmget_allocate_segment(struct thread *td, key_t key, size_t size, int mode) { struct ucred *cred = td->td_ucred; struct shmid_kernel *shmseg; vm_object_t shm_object; int i, segnum; - size_t size; SYSVSHM_ASSERT_LOCKED(); - if (uap->size < shminfo.shmmin || uap->size > shminfo.shmmax) + if (size < shminfo.shmmin || size > shminfo.shmmax) return (EINVAL); if (shm_nused >= shminfo.shmmni) /* Any shmids left? */ return (ENOSPC); - size = round_page(uap->size); + size = round_page(size); if (shm_committed + btoc(size) > shminfo.shmall) return (ENOMEM); if (shm_last_free < 0) { @@ -755,10 +753,10 @@ shmget_allocate_segment(struct thread *td, struct shmg shmseg->u.shm_perm.cuid = shmseg->u.shm_perm.uid = cred->cr_uid; shmseg->u.shm_perm.cgid = shmseg->u.shm_perm.gid = cred->cr_gid; shmseg->u.shm_perm.mode = (mode & ACCESSPERMS) | SHMSEG_ALLOCATED; - shmseg->u.shm_perm.key = uap->key; + shmseg->u.shm_perm.key = key; shmseg->u.shm_perm.seq = (shmseg->u.shm_perm.seq + 1) & 0x7fff; shmseg->cred = crhold(cred); - shmseg->u.shm_segsz = uap->size; + shmseg->u.shm_segsz = size; shmseg->u.shm_cpid = td->td_proc->p_pid; shmseg->u.shm_lpid = shmseg->u.shm_nattch = 0; shmseg->u.shm_atime = shmseg->u.shm_dtime = 0; @@ -791,16 +789,18 @@ sys_shmget(struct thread *td, struct shmget_args *uap) mode = uap->shmflg & ACCESSPERMS; SYSVSHM_LOCK(); if (uap->key == IPC_PRIVATE) { - error = shmget_allocate_segment(td, uap, mode); + error = shmget_allocate_segment(td, uap->key, uap->size, mode); } else { segnum = shm_find_segment_by_key(td->td_ucred->cr_prison, uap->key); if (segnum >= 0) - error = shmget_existing(td, uap, mode, segnum); + error = shmget_existing(td, uap->size, uap->shmflg, + mode, segnum); else if ((uap->shmflg & IPC_CREAT) == 0) error = ENOENT; else - error = shmget_allocate_segment(td, uap, mode); + error = shmget_allocate_segment(td, uap->key, + uap->size, mode); } SYSVSHM_UNLOCK(); return (error); From owner-svn-src-head@freebsd.org Tue Nov 3 19:50:43 2020 Return-Path: Delivered-To: svn-src-head@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 953D446236D; Tue, 3 Nov 2020 19:50:43 +0000 (UTC) (envelope-from cem@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 4CQgPb3SQVz4MS4; Tue, 3 Nov 2020 19:50:43 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5A5EE20098; Tue, 3 Nov 2020 19:50:43 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3Johuh032475; Tue, 3 Nov 2020 19:50:43 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3JohPI032474; Tue, 3 Nov 2020 19:50:43 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011031950.0A3JohPI032474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Tue, 3 Nov 2020 19:50:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367303 - head/sys/compat/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/compat/linux X-SVN-Commit-Revision: 367303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 19:50:43 -0000 Author: cem Date: Tue Nov 3 19:50:42 2020 New Revision: 367303 URL: https://svnweb.freebsd.org/changeset/base/367303 Log: linux(4): Improve netlink diagnostics Add some missing netlink_family definitions and produce vaguely human-readable error messages for those definitions, like we used to do for just ROUTE and KOBJECT_UEVENTS. Additionally, if we know it's a netfilter socket but didn't find it in the table, fall back to printing that instead of the generic handler ("socket domain 16, ..."). No change to the emulator correctness, just mildly improved diagnostics for gaps. Modified: head/sys/compat/linux/linux.h head/sys/compat/linux/linux_socket.c Modified: head/sys/compat/linux/linux.h ============================================================================== --- head/sys/compat/linux/linux.h Tue Nov 3 19:14:03 2020 (r367302) +++ head/sys/compat/linux/linux.h Tue Nov 3 19:50:42 2020 (r367303) @@ -60,8 +60,14 @@ struct l_sockaddr { #define LINUX_AF_INET6 10 #define LINUX_AF_NETLINK 16 -#define LINUX_NETLINK_ROUTE 0 -#define LINUX_NETLINK_UEVENT 15 +#define LINUX_NETLINK_ROUTE 0 +#define LINUX_NETLINK_SOCK_DIAG 4 +#define LINUX_NETLINK_NFLOG 5 +#define LINUX_NETLINK_SELINUX 7 +#define LINUX_NETLINK_AUDIT 9 +#define LINUX_NETLINK_FIB_LOOKUP 10 +#define LINUX_NETLINK_NETFILTER 12 +#define LINUX_NETLINK_KOBJECT_UEVENT 15 /* * net device flags Modified: head/sys/compat/linux/linux_socket.c ============================================================================== --- head/sys/compat/linux/linux_socket.c Tue Nov 3 19:14:03 2020 (r367302) +++ head/sys/compat/linux/linux_socket.c Tue Nov 3 19:50:42 2020 (r367303) @@ -502,6 +502,17 @@ goout: return (error); } +static const char *linux_netlink_names[] = { + [LINUX_NETLINK_ROUTE] = "ROUTE", + [LINUX_NETLINK_SOCK_DIAG] = "SOCK_DIAG", + [LINUX_NETLINK_NFLOG] = "NFLOG", + [LINUX_NETLINK_SELINUX] = "SELINUX", + [LINUX_NETLINK_AUDIT] = "AUDIT", + [LINUX_NETLINK_FIB_LOOKUP] = "FIB_LOOKUP", + [LINUX_NETLINK_NETFILTER] = "NETFILTER", + [LINUX_NETLINK_KOBJECT_UEVENT] = "KOBJECT_UEVENT", +}; + int linux_socket(struct thread *td, struct linux_socket_args *args) { @@ -516,22 +527,29 @@ linux_socket(struct thread *td, struct linux_socket_ar return (retval_socket); domain = linux_to_bsd_domain(args->domain); if (domain == -1) { - if (args->domain == LINUX_AF_NETLINK && - args->protocol == LINUX_NETLINK_ROUTE) { - linux_msg(curthread, - "unsupported socket(AF_NETLINK, %d, NETLINK_ROUTE)", type); - return (EAFNOSUPPORT); + /* Mask off SOCK_NONBLOCK / CLOEXEC for error messages. */ + type = args->type & LINUX_SOCK_TYPE_MASK; + if (args->domain == LINUX_AF_NETLINK) { + const char *nl_name; + + if (args->protocol >= 0 && + args->protocol < nitems(linux_netlink_names)) + nl_name = linux_netlink_names[args->protocol]; + else + nl_name = NULL; + if (nl_name != NULL) + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, " + "NETLINK_%s)", type, nl_name); + else + linux_msg(curthread, + "unsupported socket(AF_NETLINK, %d, %d)", + type, args->protocol); + } else { + linux_msg(curthread, "unsupported socket domain %d, " + "type %d, protocol %d", args->domain, type, + args->protocol); } - - if (args->domain == LINUX_AF_NETLINK && - args->protocol == LINUX_NETLINK_UEVENT) { - linux_msg(curthread, - "unsupported socket(AF_NETLINK, %d, NETLINK_UEVENT)", type); - return (EAFNOSUPPORT); - } - - linux_msg(curthread, "unsupported socket domain %d, type %d, protocol %d", - args->domain, args->type & LINUX_SOCK_TYPE_MASK, args->protocol); return (EAFNOSUPPORT); } From owner-svn-src-head@freebsd.org Tue Nov 3 19:57:30 2020 Return-Path: Delivered-To: svn-src-head@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 79E0D462823; Tue, 3 Nov 2020 19:57:30 +0000 (UTC) (envelope-from dim@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 4CQgYQ2g8xz4MvB; Tue, 3 Nov 2020 19:57:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3FEBD201A8; Tue, 3 Nov 2020 19:57:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3JvUSJ038319; Tue, 3 Nov 2020 19:57:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3JvSJ4038311; Tue, 3 Nov 2020 19:57:28 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011031957.0A3JvSJ4038311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 3 Nov 2020 19:57:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt X-SVN-Commit-Revision: 367304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 19:57:30 -0000 Author: dim Date: Tue Nov 3 19:57:28 2020 New Revision: 367304 URL: https://svnweb.freebsd.org/changeset/base/367304 Log: Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt Since elftoolchain's cxxfilt is rather far behind on features, and we ran into several bugs, add an option to use llvm-cxxfilt as an drop-in replacement. It supports the same options as elftoolchain cxxfilt, though it doesn't have support for old ARM (C++ Annotated Reference Manual, not the CPU) and GNU v2 manglings. But these are irrelevant in 2020. Note: as we already compile the required libraries as part of libllvm, this will not add any significant build time either. PR: 250702 Reviewed by: emaste, yuri Differential Revision: https://reviews.freebsd.org/D27071 MFC after: 2 weeks Added: head/tools/build/options/WITHOUT_LLVM_CXXFILT (contents, props changed) head/tools/build/options/WITH_LLVM_CXXFILT (contents, props changed) Modified: head/share/man/man5/src.conf.5 head/share/mk/src.opts.mk head/usr.bin/Makefile head/usr.bin/clang/Makefile head/usr.bin/clang/llvm-cxxfilt/Makefile Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Tue Nov 3 19:50:42 2020 (r367303) +++ head/share/man/man5/src.conf.5 Tue Nov 3 19:57:28 2020 (r367304) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd September 15, 2020 +.Dd November 3, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -919,6 +919,8 @@ Set to disable debugging assertions in LLVM. Set to not build the .Xr llvm-cov 1 tool. +.It Va WITH_LLVM_CXXFILT +Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Nov 3 19:50:42 2020 (r367303) +++ head/share/mk/src.opts.mk Tue Nov 3 19:57:28 2020 (r367304) @@ -210,6 +210,7 @@ __DEFAULT_NO_OPTIONS = \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ + LLVM_CXXFILT \ LOADER_FIREWIRE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ Added: head/tools/build/options/WITHOUT_LLVM_CXXFILT ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_LLVM_CXXFILT Tue Nov 3 19:57:28 2020 (r367304) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. Added: head/tools/build/options/WITH_LLVM_CXXFILT ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_LLVM_CXXFILT Tue Nov 3 19:57:28 2020 (r367304) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Tue Nov 3 19:50:42 2020 (r367303) +++ head/usr.bin/Makefile Tue Nov 3 19:57:28 2020 (r367304) @@ -260,7 +260,9 @@ SUBDIR.${MK_TOOLCHAIN}+= ar SUBDIR.${MK_TOOLCHAIN}+= c89 SUBDIR.${MK_TOOLCHAIN}+= c99 SUBDIR.${MK_TOOLCHAIN}+= ctags +.if ${MK_LLVM_CXXFILT} == "no" SUBDIR.${MK_TOOLCHAIN}+= cxxfilt +.endif SUBDIR.${MK_TOOLCHAIN}+= objcopy SUBDIR.${MK_TOOLCHAIN}+= file2c SUBDIR.${MK_TOOLCHAIN}+= gprof Modified: head/usr.bin/clang/Makefile ============================================================================== --- head/usr.bin/clang/Makefile Tue Nov 3 19:50:42 2020 (r367303) +++ head/usr.bin/clang/Makefile Tue Nov 3 19:57:28 2020 (r367304) @@ -16,6 +16,10 @@ SUBDIR+= llvm-nm SUBDIR+= llvm-objdump SUBDIR+= llvm-symbolizer +.if ${MK_CLANG_EXTRAS} != "no" || ${MK_LLVM_CXXFILT} != "no" +SUBDIR+= llvm-cxxfilt +.endif + .if ${MK_CLANG_EXTRAS} != "no" SUBDIR+= bugpoint SUBDIR+= llc @@ -23,7 +27,6 @@ SUBDIR+= lli SUBDIR+= llvm-as SUBDIR+= llvm-bcanalyzer SUBDIR+= llvm-cxxdump -SUBDIR+= llvm-cxxfilt SUBDIR+= llvm-diff SUBDIR+= llvm-dis SUBDIR+= llvm-dwarfdump Modified: head/usr.bin/clang/llvm-cxxfilt/Makefile ============================================================================== --- head/usr.bin/clang/llvm-cxxfilt/Makefile Tue Nov 3 19:50:42 2020 (r367303) +++ head/usr.bin/clang/llvm-cxxfilt/Makefile Tue Nov 3 19:57:28 2020 (r367304) @@ -1,8 +1,15 @@ # $FreeBSD$ +.include + PROG_CXX= llvm-cxxfilt SRCDIR= llvm/tools/llvm-cxxfilt SRCS+= llvm-cxxfilt.cpp + +.if ${MK_LLVM_CXXFILT} != "no" +LINKS= ${BINDIR}/llvm-cxxfilt ${BINDIR}/c++filt +MLINKS= llvm-cxxfilt.1 c++filt.1 +.endif .include "../llvm.prog.mk" From owner-svn-src-head@freebsd.org Tue Nov 3 21:38:59 2020 Return-Path: Delivered-To: svn-src-head@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 E07E9464A89; Tue, 3 Nov 2020 21:38:59 +0000 (UTC) (envelope-from kibab@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 4CQjpW5X47z4Tgn; Tue, 3 Nov 2020 21:38:59 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1014210DD; Tue, 3 Nov 2020 21:38:59 +0000 (UTC) (envelope-from kibab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3LcxGV002127; Tue, 3 Nov 2020 21:38:59 GMT (envelope-from kibab@FreeBSD.org) Received: (from kibab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3LcxWt002126; Tue, 3 Nov 2020 21:38:59 GMT (envelope-from kibab@FreeBSD.org) Message-Id: <202011032138.0A3LcxWt002126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kibab set sender to kibab@FreeBSD.org using -f From: Ilya Bakulin Date: Tue, 3 Nov 2020 21:38:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367306 - head/sys/cam/mmc X-SVN-Group: head X-SVN-Commit-Author: kibab X-SVN-Commit-Paths: head/sys/cam/mmc X-SVN-Commit-Revision: 367306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 21:38:59 -0000 Author: kibab Date: Tue Nov 3 21:38:59 2020 New Revision: 367306 URL: https://svnweb.freebsd.org/changeset/base/367306 Log: Always return MMC errors from mmc_handle_reply() There are two ways to propagate the error in MMCCAM: * Using cmd.error which is set by the peripheral driver; * Using CCB status which is... also set by the driver. The problem is that those two error conditions don't necessarily match. This leads to the confusion when handling the MMC reply. So enforce the consistency by panicking if request is marked as completed successfully but MMC-level error is present (this hints to the programming error). Reviewed by: manu Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D26925 Modified: head/sys/cam/mmc/mmc_da.c Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Tue Nov 3 20:43:01 2020 (r367305) +++ head/sys/cam/mmc/mmc_da.c Tue Nov 3 21:38:59 2020 (r367306) @@ -239,31 +239,29 @@ get_rca(struct cam_periph *periph) { /* * Figure out if CCB execution resulted in error. * Look at both CAM-level errors and on MMC protocol errors. + * + * Return value is always MMC error. */ static int mmc_handle_reply(union ccb *ccb) { - KASSERT(ccb->ccb_h.func_code == XPT_MMC_IO, ("ccb %p: cannot handle non-XPT_MMC_IO errors, got func_code=%d", ccb, ccb->ccb_h.func_code)); - /* TODO: maybe put MMC-specific handling into cam.c/cam_error_print altogether */ - if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)) { - if (ccb->mmcio.cmd.error != 0) { - xpt_print_path(ccb->ccb_h.path); - printf("CMD%d failed, err %d (%s)\n", - ccb->mmcio.cmd.opcode, - ccb->mmcio.cmd.error, - mmc_errmsg[ccb->mmcio.cmd.error]); - return (EIO); - } - } else { - cam_error_print(ccb, CAM_ESF_ALL, CAM_EPF_ALL); - return (EIO); - } + /* CAM-level error should always correspond to MMC-level error */ + if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) && + (ccb->mmcio.cmd.error != MMC_ERR_NONE)) + panic("CCB status is OK but MMC error != MMC_ERR_NONE"); - return (0); /* Normal return */ + if (ccb->mmcio.cmd.error != MMC_ERR_NONE) { + xpt_print_path(ccb->ccb_h.path); + printf("CMD%d failed, err %d (%s)\n", + ccb->mmcio.cmd.opcode, + ccb->mmcio.cmd.error, + mmc_errmsg[ccb->mmcio.cmd.error]); + } + return (ccb->mmcio.cmd.error); } static uint32_t From owner-svn-src-head@freebsd.org Tue Nov 3 22:04:33 2020 Return-Path: Delivered-To: svn-src-head@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 9A24C465256; Tue, 3 Nov 2020 22:04:33 +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 4CQkN13ZQPz4WMp; Tue, 3 Nov 2020 22:04:33 +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 5F23021A9E; Tue, 3 Nov 2020 22:04:33 +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 0A3M4XBT019992; Tue, 3 Nov 2020 22:04:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3M4Xge019991; Tue, 3 Nov 2020 22:04:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202011032204.0A3M4Xge019991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 3 Nov 2020 22:04:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367307 - head/sbin/savecore X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sbin/savecore X-SVN-Commit-Revision: 367307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 22:04:33 -0000 Author: glebius Date: Tue Nov 3 22:04:32 2020 New Revision: 367307 URL: https://svnweb.freebsd.org/changeset/base/367307 Log: Style, not functional changes: - Improve spelling of a false check [1] - A missing line from r367150. Submitted by: kib Modified: head/sbin/savecore/savecore.c Modified: head/sbin/savecore/savecore.c ============================================================================== --- head/sbin/savecore/savecore.c Tue Nov 3 21:38:59 2020 (r367306) +++ head/sbin/savecore/savecore.c Tue Nov 3 22:04:32 2020 (r367307) @@ -677,7 +677,7 @@ DoFile(const char *savedir, int savedirfd, const char dtoh32(kdhl.version), device); status = STATUS_BAD; - if (force == false) + if (!force) goto closefd; } } else if (compare_magic(&kdhl, KERNELDUMPMAGIC)) { @@ -687,7 +687,7 @@ DoFile(const char *savedir, int savedirfd, const char dtoh32(kdhl.version), device); status = STATUS_BAD; - if (force == false) + if (!force) goto closefd; } switch (kdhl.compression) { @@ -711,7 +711,7 @@ DoFile(const char *savedir, int savedirfd, const char device); status = STATUS_BAD; - if (force == false) + if (!force) goto closefd; if (compare_magic(&kdhl, KERNELDUMPMAGIC_CLEARED)) { @@ -728,7 +728,7 @@ DoFile(const char *savedir, int savedirfd, const char dtoh32(kdhl.version), device); status = STATUS_BAD; - if (force == false) + if (!force) goto closefd; } } @@ -742,7 +742,7 @@ DoFile(const char *savedir, int savedirfd, const char "parity error on last dump header on %s", device); nerr++; status = STATUS_BAD; - if (force == false) + if (!force) goto closefd; } dumpextent = dtoh64(kdhl.dumpextent); @@ -773,7 +773,7 @@ DoFile(const char *savedir, int savedirfd, const char "first and last dump headers disagree on %s", device); nerr++; status = STATUS_BAD; - if (force == false) + if (!force) goto closefd; } else { status = STATUS_GOOD; @@ -1148,7 +1148,7 @@ main(int argc, char **argv) verbose++; break; case 'z': - compress = 1; + compress = true; break; case '?': default: From owner-svn-src-head@freebsd.org Tue Nov 3 22:13:17 2020 Return-Path: Delivered-To: svn-src-head@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 197AF4658BF; Tue, 3 Nov 2020 22:13:17 +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 4CQkZ46zs9z4WfM; Tue, 3 Nov 2020 22:13:16 +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 D326F21A54; Tue, 3 Nov 2020 22:13:16 +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 0A3MDG0g026455; Tue, 3 Nov 2020 22:13:16 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3MDGwX026454; Tue, 3 Nov 2020 22:13:16 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011032213.0A3MDGwX026454@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, 3 Nov 2020 22:13:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367308 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 367308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 22:13:17 -0000 Author: se Date: Tue Nov 3 22:13:16 2020 New Revision: 367308 URL: https://svnweb.freebsd.org/changeset/base/367308 Log: Update man-page to document changes made to the calendar program. MFC after: 3 days Modified: head/usr.bin/calendar/calendar.1 Modified: head/usr.bin/calendar/calendar.1 ============================================================================== --- head/usr.bin/calendar/calendar.1 Tue Nov 3 22:04:32 2020 (r367307) +++ head/usr.bin/calendar/calendar.1 Tue Nov 3 22:13:16 2020 (r367308) @@ -198,12 +198,20 @@ file is preprocessed by a limited subset of .Xr cpp 1 internally, allowing the inclusion of shared files such as lists of company holidays or meetings. -This limited subset consists of \fB#include #ifdef #ifndef #else -#endif\fR and \fB#define\fR. Conditions can be nested, but not check -for matching begin and end directives is performed. -Included files are parsed in their own scope. -They have no read or write access to condition variables defined in -an outer scope and open conditional blocks are implicitly closed. +This limited subset consists of \fB#include\fR, \fB#define\fR, +\fB#undef\fR, \fB#ifdef\fR, \fB#ifndef\fR, and \fB#else\fR. +.Pp +Conditions can be nested and the consistency of opening and closing +instructions is checked. +Only the first word after #define is used as the name of the +condition variable being defined. +More than word following #ifdef, #ifndef, or #undef is a ayntax +error, since names cannot include white-space. +Included files are parsed in a global scope with regard to the condition +variables being defined or tested therein. +All conditional blocks are implicitly closed at the end of a file, +and missing #endif instructions are assumed to be present on implied +succeeding lines. .Pp If the shared file is not referenced by a full pathname, .Nm From owner-svn-src-head@freebsd.org Tue Nov 3 22:27:59 2020 Return-Path: Delivered-To: svn-src-head@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 BD336465D32; Tue, 3 Nov 2020 22:27:59 +0000 (UTC) (envelope-from jhb@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 4CQkv34sFHz4XVh; Tue, 3 Nov 2020 22:27:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8991B21DD5; Tue, 3 Nov 2020 22:27:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3MRxEF032617; Tue, 3 Nov 2020 22:27:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3MRsLD032592; Tue, 3 Nov 2020 22:27:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011032227.0A3MRsLD032592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Nov 2020 22:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367309 - in head/sys: crypto crypto/chacha20 crypto/des crypto/rijndael crypto/skein opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: crypto crypto/chacha20 crypto/des crypto/rijndael crypto/skein opencrypto X-SVN-Commit-Revision: 367309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 22:27:59 -0000 Author: jhb Date: Tue Nov 3 22:27:54 2020 New Revision: 367309 URL: https://svnweb.freebsd.org/changeset/base/367309 Log: Consistently use C99 fixed-width types in the in-kernel crypto code. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27061 Modified: head/sys/crypto/chacha20/chacha-sw.c head/sys/crypto/des/des.h head/sys/crypto/rijndael/rijndael-api-fst.c head/sys/crypto/rijndael/rijndael.h head/sys/crypto/rijndael/rijndael_local.h head/sys/crypto/sha1.c head/sys/crypto/sha1.h head/sys/crypto/skein/skein_port.h head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodeflate.c head/sys/opencrypto/cryptodev.c head/sys/opencrypto/cryptodev.h head/sys/opencrypto/cryptosoft.c head/sys/opencrypto/deflate.h head/sys/opencrypto/rmd160.c head/sys/opencrypto/rmd160.h head/sys/opencrypto/xform_auth.h head/sys/opencrypto/xform_comp.h head/sys/opencrypto/xform_deflate.c head/sys/opencrypto/xform_enc.h head/sys/opencrypto/xform_null.c head/sys/opencrypto/xform_rijndael.c head/sys/opencrypto/xform_sha1.c head/sys/opencrypto/xform_sha2.c Modified: head/sys/crypto/chacha20/chacha-sw.c ============================================================================== --- head/sys/crypto/chacha20/chacha-sw.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/chacha20/chacha-sw.c Tue Nov 3 22:27:54 2020 (r367309) @@ -18,7 +18,7 @@ chacha20_xform_setkey(void *ctx, const uint8_t *key, i } static void -chacha20_xform_reinit(void *ctx, const u_int8_t *iv) +chacha20_xform_reinit(void *ctx, const uint8_t *iv) { chacha_ivsetup(ctx, iv + 8, iv); Modified: head/sys/crypto/des/des.h ============================================================================== --- head/sys/crypto/des/des.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/des/des.h Tue Nov 3 22:27:54 2020 (r367309) @@ -56,7 +56,7 @@ extern "C" { #endif /* must be 32bit quantity */ -#define DES_LONG u_int32_t +#define DES_LONG uint32_t typedef unsigned char des_cblock[8]; typedef struct des_ks_struct Modified: head/sys/crypto/rijndael/rijndael-api-fst.c ============================================================================== --- head/sys/crypto/rijndael/rijndael-api-fst.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/rijndael/rijndael-api-fst.c Tue Nov 3 22:27:54 2020 (r367309) @@ -32,7 +32,7 @@ __FBSDID("$FreeBSD$"); #define TRUE 1 #endif -typedef u_int8_t BYTE; +typedef uint8_t BYTE; int rijndael_makeKey(keyInstance *key, BYTE direction, int keyLen, const char *keyMaterial) { @@ -84,7 +84,7 @@ int rijndael_cipherInit(cipherInstance *cipher, BYTE m int rijndael_blockEncrypt(cipherInstance *cipher, keyInstance *key, const BYTE *input, int inputLen, BYTE *outBuffer) { int i, k, numBlocks; - u_int8_t block[16], iv[4][4]; + uint8_t block[16], iv[4][4]; if (cipher == NULL || key == NULL || @@ -110,15 +110,15 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyI #if 1 /*STRICT_ALIGN*/ memcpy(block, cipher->IV, 16); memcpy(iv, input, 16); - ((u_int32_t*)block)[0] ^= ((u_int32_t*)iv)[0]; - ((u_int32_t*)block)[1] ^= ((u_int32_t*)iv)[1]; - ((u_int32_t*)block)[2] ^= ((u_int32_t*)iv)[2]; - ((u_int32_t*)block)[3] ^= ((u_int32_t*)iv)[3]; + ((uint32_t*)block)[0] ^= ((uint32_t*)iv)[0]; + ((uint32_t*)block)[1] ^= ((uint32_t*)iv)[1]; + ((uint32_t*)block)[2] ^= ((uint32_t*)iv)[2]; + ((uint32_t*)block)[3] ^= ((uint32_t*)iv)[3]; #else - ((u_int32_t*)block)[0] = ((u_int32_t*)cipher->IV)[0] ^ ((u_int32_t*)input)[0]; - ((u_int32_t*)block)[1] = ((u_int32_t*)cipher->IV)[1] ^ ((u_int32_t*)input)[1]; - ((u_int32_t*)block)[2] = ((u_int32_t*)cipher->IV)[2] ^ ((u_int32_t*)input)[2]; - ((u_int32_t*)block)[3] = ((u_int32_t*)cipher->IV)[3] ^ ((u_int32_t*)input)[3]; + ((uint32_t*)block)[0] = ((uint32_t*)cipher->IV)[0] ^ ((uint32_t*)input)[0]; + ((uint32_t*)block)[1] = ((uint32_t*)cipher->IV)[1] ^ ((uint32_t*)input)[1]; + ((uint32_t*)block)[2] = ((uint32_t*)cipher->IV)[2] ^ ((uint32_t*)input)[2]; + ((uint32_t*)block)[3] = ((uint32_t*)cipher->IV)[3] ^ ((uint32_t*)input)[3]; #endif rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); input += 16; @@ -126,15 +126,15 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyI #if 1 /*STRICT_ALIGN*/ memcpy(block, outBuffer, 16); memcpy(iv, input, 16); - ((u_int32_t*)block)[0] ^= ((u_int32_t*)iv)[0]; - ((u_int32_t*)block)[1] ^= ((u_int32_t*)iv)[1]; - ((u_int32_t*)block)[2] ^= ((u_int32_t*)iv)[2]; - ((u_int32_t*)block)[3] ^= ((u_int32_t*)iv)[3]; + ((uint32_t*)block)[0] ^= ((uint32_t*)iv)[0]; + ((uint32_t*)block)[1] ^= ((uint32_t*)iv)[1]; + ((uint32_t*)block)[2] ^= ((uint32_t*)iv)[2]; + ((uint32_t*)block)[3] ^= ((uint32_t*)iv)[3]; #else - ((u_int32_t*)block)[0] = ((u_int32_t*)outBuffer)[0] ^ ((u_int32_t*)input)[0]; - ((u_int32_t*)block)[1] = ((u_int32_t*)outBuffer)[1] ^ ((u_int32_t*)input)[1]; - ((u_int32_t*)block)[2] = ((u_int32_t*)outBuffer)[2] ^ ((u_int32_t*)input)[2]; - ((u_int32_t*)block)[3] = ((u_int32_t*)outBuffer)[3] ^ ((u_int32_t*)input)[3]; + ((uint32_t*)block)[0] = ((uint32_t*)outBuffer)[0] ^ ((uint32_t*)input)[0]; + ((uint32_t*)block)[1] = ((uint32_t*)outBuffer)[1] ^ ((uint32_t*)input)[1]; + ((uint32_t*)block)[2] = ((uint32_t*)outBuffer)[2] ^ ((uint32_t*)input)[2]; + ((uint32_t*)block)[3] = ((uint32_t*)outBuffer)[3] ^ ((uint32_t*)input)[3]; #endif outBuffer += 16; rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); @@ -146,17 +146,17 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyI #if 1 /*STRICT_ALIGN*/ memcpy(iv, cipher->IV, 16); #else /* !STRICT_ALIGN */ - *((u_int32_t*)iv[0]) = *((u_int32_t*)(cipher->IV )); - *((u_int32_t*)iv[1]) = *((u_int32_t*)(cipher->IV+ 4)); - *((u_int32_t*)iv[2]) = *((u_int32_t*)(cipher->IV+ 8)); - *((u_int32_t*)iv[3]) = *((u_int32_t*)(cipher->IV+12)); + *((uint32_t*)iv[0]) = *((uint32_t*)(cipher->IV )); + *((uint32_t*)iv[1]) = *((uint32_t*)(cipher->IV+ 4)); + *((uint32_t*)iv[2]) = *((uint32_t*)(cipher->IV+ 8)); + *((uint32_t*)iv[3]) = *((uint32_t*)(cipher->IV+12)); #endif /* ?STRICT_ALIGN */ for (i = numBlocks; i > 0; i--) { for (k = 0; k < 128; k++) { - *((u_int32_t*) block ) = *((u_int32_t*)iv[0]); - *((u_int32_t*)(block+ 4)) = *((u_int32_t*)iv[1]); - *((u_int32_t*)(block+ 8)) = *((u_int32_t*)iv[2]); - *((u_int32_t*)(block+12)) = *((u_int32_t*)iv[3]); + *((uint32_t*) block ) = *((uint32_t*)iv[0]); + *((uint32_t*)(block+ 4)) = *((uint32_t*)iv[1]); + *((uint32_t*)(block+ 8)) = *((uint32_t*)iv[2]); + *((uint32_t*)(block+12)) = *((uint32_t*)iv[3]); rijndaelEncrypt(key->ek, key->Nr, block, block); outBuffer[k/8] ^= (block[0] & 0x80) >> (k & 7); @@ -200,7 +200,7 @@ int rijndael_blockEncrypt(cipherInstance *cipher, keyI int rijndael_padEncrypt(cipherInstance *cipher, keyInstance *key, const BYTE *input, int inputOctets, BYTE *outBuffer) { int i, numBlocks, padLen; - u_int8_t block[16], *iv, *cp; + uint8_t block[16], *iv, *cp; if (cipher == NULL || key == NULL || @@ -232,10 +232,10 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyIns case MODE_CBC: iv = cipher->IV; for (i = numBlocks; i > 0; i--) { - ((u_int32_t*)block)[0] = ((const u_int32_t*)input)[0] ^ ((u_int32_t*)iv)[0]; - ((u_int32_t*)block)[1] = ((const u_int32_t*)input)[1] ^ ((u_int32_t*)iv)[1]; - ((u_int32_t*)block)[2] = ((const u_int32_t*)input)[2] ^ ((u_int32_t*)iv)[2]; - ((u_int32_t*)block)[3] = ((const u_int32_t*)input)[3] ^ ((u_int32_t*)iv)[3]; + ((uint32_t*)block)[0] = ((const uint32_t*)input)[0] ^ ((uint32_t*)iv)[0]; + ((uint32_t*)block)[1] = ((const uint32_t*)input)[1] ^ ((uint32_t*)iv)[1]; + ((uint32_t*)block)[2] = ((const uint32_t*)input)[2] ^ ((uint32_t*)iv)[2]; + ((uint32_t*)block)[3] = ((const uint32_t*)input)[3] ^ ((uint32_t*)iv)[3]; rijndaelEncrypt(key->rk, key->Nr, block, outBuffer); iv = outBuffer; input += 16; @@ -264,7 +264,7 @@ int rijndael_padEncrypt(cipherInstance *cipher, keyIns int rijndael_blockDecrypt(cipherInstance *cipher, keyInstance *key, const BYTE *input, int inputLen, BYTE *outBuffer) { int i, k, numBlocks; - u_int8_t block[16], iv[4][4]; + uint8_t block[16], iv[4][4]; if (cipher == NULL || key == NULL || @@ -290,25 +290,25 @@ int rijndael_blockDecrypt(cipherInstance *cipher, keyI #if 1 /*STRICT_ALIGN */ memcpy(iv, cipher->IV, 16); #else - *((u_int32_t*)iv[0]) = *((u_int32_t*)(cipher->IV )); - *((u_int32_t*)iv[1]) = *((u_int32_t*)(cipher->IV+ 4)); - *((u_int32_t*)iv[2]) = *((u_int32_t*)(cipher->IV+ 8)); - *((u_int32_t*)iv[3]) = *((u_int32_t*)(cipher->IV+12)); + *((uint32_t*)iv[0]) = *((uint32_t*)(cipher->IV )); + *((uint32_t*)iv[1]) = *((uint32_t*)(cipher->IV+ 4)); + *((uint32_t*)iv[2]) = *((uint32_t*)(cipher->IV+ 8)); + *((uint32_t*)iv[3]) = *((uint32_t*)(cipher->IV+12)); #endif for (i = numBlocks; i > 0; i--) { rijndaelDecrypt(key->rk, key->Nr, input, block); - ((u_int32_t*)block)[0] ^= *((u_int32_t*)iv[0]); - ((u_int32_t*)block)[1] ^= *((u_int32_t*)iv[1]); - ((u_int32_t*)block)[2] ^= *((u_int32_t*)iv[2]); - ((u_int32_t*)block)[3] ^= *((u_int32_t*)iv[3]); + ((uint32_t*)block)[0] ^= *((uint32_t*)iv[0]); + ((uint32_t*)block)[1] ^= *((uint32_t*)iv[1]); + ((uint32_t*)block)[2] ^= *((uint32_t*)iv[2]); + ((uint32_t*)block)[3] ^= *((uint32_t*)iv[3]); #if 1 /*STRICT_ALIGN*/ memcpy(iv, input, 16); memcpy(outBuffer, block, 16); #else - *((u_int32_t*)iv[0]) = ((u_int32_t*)input)[0]; ((u_int32_t*)outBuffer)[0] = ((u_int32_t*)block)[0]; - *((u_int32_t*)iv[1]) = ((u_int32_t*)input)[1]; ((u_int32_t*)outBuffer)[1] = ((u_int32_t*)block)[1]; - *((u_int32_t*)iv[2]) = ((u_int32_t*)input)[2]; ((u_int32_t*)outBuffer)[2] = ((u_int32_t*)block)[2]; - *((u_int32_t*)iv[3]) = ((u_int32_t*)input)[3]; ((u_int32_t*)outBuffer)[3] = ((u_int32_t*)block)[3]; + *((uint32_t*)iv[0]) = ((uint32_t*)input)[0]; ((uint32_t*)outBuffer)[0] = ((uint32_t*)block)[0]; + *((uint32_t*)iv[1]) = ((uint32_t*)input)[1]; ((uint32_t*)outBuffer)[1] = ((uint32_t*)block)[1]; + *((uint32_t*)iv[2]) = ((uint32_t*)input)[2]; ((uint32_t*)outBuffer)[2] = ((uint32_t*)block)[2]; + *((uint32_t*)iv[3]) = ((uint32_t*)input)[3]; ((uint32_t*)outBuffer)[3] = ((uint32_t*)block)[3]; #endif input += 16; outBuffer += 16; @@ -319,17 +319,17 @@ int rijndael_blockDecrypt(cipherInstance *cipher, keyI #if 1 /*STRICT_ALIGN */ memcpy(iv, cipher->IV, 16); #else - *((u_int32_t*)iv[0]) = *((u_int32_t*)(cipher->IV)); - *((u_int32_t*)iv[1]) = *((u_int32_t*)(cipher->IV+ 4)); - *((u_int32_t*)iv[2]) = *((u_int32_t*)(cipher->IV+ 8)); - *((u_int32_t*)iv[3]) = *((u_int32_t*)(cipher->IV+12)); + *((uint32_t*)iv[0]) = *((uint32_t*)(cipher->IV)); + *((uint32_t*)iv[1]) = *((uint32_t*)(cipher->IV+ 4)); + *((uint32_t*)iv[2]) = *((uint32_t*)(cipher->IV+ 8)); + *((uint32_t*)iv[3]) = *((uint32_t*)(cipher->IV+12)); #endif for (i = numBlocks; i > 0; i--) { for (k = 0; k < 128; k++) { - *((u_int32_t*) block ) = *((u_int32_t*)iv[0]); - *((u_int32_t*)(block+ 4)) = *((u_int32_t*)iv[1]); - *((u_int32_t*)(block+ 8)) = *((u_int32_t*)iv[2]); - *((u_int32_t*)(block+12)) = *((u_int32_t*)iv[3]); + *((uint32_t*) block ) = *((uint32_t*)iv[0]); + *((uint32_t*)(block+ 4)) = *((uint32_t*)iv[1]); + *((uint32_t*)(block+ 8)) = *((uint32_t*)iv[2]); + *((uint32_t*)(block+12)) = *((uint32_t*)iv[3]); rijndaelEncrypt(key->ek, key->Nr, block, block); iv[0][0] = (iv[0][0] << 1) | (iv[0][1] >> 7); @@ -364,8 +364,8 @@ int rijndael_blockDecrypt(cipherInstance *cipher, keyI int rijndael_padDecrypt(cipherInstance *cipher, keyInstance *key, const BYTE *input, int inputOctets, BYTE *outBuffer) { int i, numBlocks, padLen, rval; - u_int8_t block[16]; - u_int32_t iv[4]; + uint8_t block[16]; + uint32_t iv[4]; if (cipher == NULL || key == NULL || @@ -410,10 +410,10 @@ int rijndael_padDecrypt(cipherInstance *cipher, keyIns /* all blocks but last */ for (i = numBlocks - 1; i > 0; i--) { rijndaelDecrypt(key->rk, key->Nr, input, block); - ((u_int32_t*)block)[0] ^= iv[0]; - ((u_int32_t*)block)[1] ^= iv[1]; - ((u_int32_t*)block)[2] ^= iv[2]; - ((u_int32_t*)block)[3] ^= iv[3]; + ((uint32_t*)block)[0] ^= iv[0]; + ((uint32_t*)block)[1] ^= iv[1]; + ((uint32_t*)block)[2] ^= iv[2]; + ((uint32_t*)block)[3] ^= iv[3]; memcpy(iv, input, 16); memcpy(outBuffer, block, 16); input += 16; @@ -421,10 +421,10 @@ int rijndael_padDecrypt(cipherInstance *cipher, keyIns } /* last block */ rijndaelDecrypt(key->rk, key->Nr, input, block); - ((u_int32_t*)block)[0] ^= iv[0]; - ((u_int32_t*)block)[1] ^= iv[1]; - ((u_int32_t*)block)[2] ^= iv[2]; - ((u_int32_t*)block)[3] ^= iv[3]; + ((uint32_t*)block)[0] ^= iv[0]; + ((uint32_t*)block)[1] ^= iv[1]; + ((uint32_t*)block)[2] ^= iv[2]; + ((uint32_t*)block)[3] ^= iv[3]; padLen = block[15]; if (padLen <= 0 || padLen > 16) { rval = BAD_DATA; Modified: head/sys/crypto/rijndael/rijndael.h ============================================================================== --- head/sys/crypto/rijndael/rijndael.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/rijndael/rijndael.h Tue Nov 3 22:27:54 2020 (r367309) @@ -45,11 +45,11 @@ void rijndael_set_key(rijndael_ctx *, const u_char *, void rijndael_decrypt(const rijndael_ctx *, const u_char *, u_char *); void rijndael_encrypt(const rijndael_ctx *, const u_char *, u_char *); -int rijndaelKeySetupEnc(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int); -int rijndaelKeySetupDec(u_int32_t [/*4*(Nr+1)*/], const u_int8_t [], int); -void rijndaelEncrypt(const u_int32_t [/*4*(Nr+1)*/], int, - const u_int8_t[16], u_int8_t [16]); -void rijndaelDecrypt(const u_int32_t [/*4*(Nr+1)*/], int, - const u_int8_t [16], u_int8_t [16]); +int rijndaelKeySetupEnc(uint32_t [/*4*(Nr+1)*/], const uint8_t [], int); +int rijndaelKeySetupDec(uint32_t [/*4*(Nr+1)*/], const uint8_t [], int); +void rijndaelEncrypt(const uint32_t [/*4*(Nr+1)*/], int, + const uint8_t[16], uint8_t [16]); +void rijndaelDecrypt(const uint32_t [/*4*(Nr+1)*/], int, + const uint8_t [16], uint8_t [16]); #endif /* __RIJNDAEL_H */ Modified: head/sys/crypto/rijndael/rijndael_local.h ============================================================================== --- head/sys/crypto/rijndael/rijndael_local.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/rijndael/rijndael_local.h Tue Nov 3 22:27:54 2020 (r367309) @@ -2,6 +2,6 @@ /* $FreeBSD$ */ /* the file should not be used from outside */ -typedef u_int8_t u8; -typedef u_int16_t u16; -typedef u_int32_t u32; +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; Modified: head/sys/crypto/sha1.c ============================================================================== --- head/sys/crypto/sha1.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/sha1.c Tue Nov 3 22:27:54 2020 (r367309) @@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$"); #ifndef unsupported /* constant table */ -static u_int32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 }; +static uint32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6 }; #define K(t) _K[(t) / 20] #define F0(b, c, d) (((b) & (c)) | ((~(b)) & (d))) @@ -94,9 +94,9 @@ static void sha1_step(ctxt) struct sha1_ctxt *ctxt; { - u_int32_t a, b, c, d, e; + uint32_t a, b, c, d, e; size_t t, s; - u_int32_t tmp; + uint32_t tmp; #if BYTE_ORDER == LITTLE_ENDIAN struct sha1_ctxt tctxt; @@ -225,7 +225,7 @@ sha1_pad(ctxt) void sha1_loop(ctxt, input, len) struct sha1_ctxt *ctxt; - const u_int8_t *input; + const uint8_t *input; size_t len; { size_t gaplen; @@ -253,9 +253,9 @@ sha1_loop(ctxt, input, len) void sha1_result(struct sha1_ctxt *ctxt, char digest0[static SHA1_RESULTLEN]) { - u_int8_t *digest; + uint8_t *digest; - digest = (u_int8_t *)digest0; + digest = (uint8_t *)digest0; sha1_pad(ctxt); #if BYTE_ORDER == BIG_ENDIAN bcopy(&ctxt->h.b8[0], digest, SHA1_RESULTLEN); Modified: head/sys/crypto/sha1.h ============================================================================== --- head/sys/crypto/sha1.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/sha1.h Tue Nov 3 22:27:54 2020 (r367309) @@ -42,18 +42,18 @@ struct sha1_ctxt { union { - u_int8_t b8[20]; - u_int32_t b32[5]; + uint8_t b8[20]; + uint32_t b32[5]; } h; union { - u_int8_t b8[8]; - u_int64_t b64[1]; + uint8_t b8[8]; + uint64_t b64[1]; } c; union { - u_int8_t b8[64]; - u_int32_t b32[16]; + uint8_t b8[64]; + uint32_t b32[16]; } m; - u_int8_t count; + uint8_t count; }; typedef struct sha1_ctxt SHA1_CTX; @@ -62,7 +62,7 @@ typedef struct sha1_ctxt SHA1_CTX; #ifdef _KERNEL extern void sha1_init(struct sha1_ctxt *); extern void sha1_pad(struct sha1_ctxt *); -extern void sha1_loop(struct sha1_ctxt *, const u_int8_t *, size_t); +extern void sha1_loop(struct sha1_ctxt *, const uint8_t *, size_t); extern void sha1_result(struct sha1_ctxt *, char[__min_size(SHA1_RESULTLEN)]); /* compatibilty with other SHA1 source codes */ Modified: head/sys/crypto/skein/skein_port.h ============================================================================== --- head/sys/crypto/skein/skein_port.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/crypto/skein/skein_port.h Tue Nov 3 22:27:54 2020 (r367309) @@ -22,9 +22,9 @@ #ifndef _OPENSOLARIS_SYS_TYPES_H_ /* Avoid redefining this typedef */ typedef unsigned int uint_t; /* native unsigned integer */ #endif -typedef u_int8_t u08b_t; /* 8-bit unsigned integer */ -typedef u_int32_t uint_32t; /* 32-bit unsigned integer */ -typedef u_int64_t u64b_t; /* 64-bit unsigned integer */ +typedef uint8_t u08b_t; /* 8-bit unsigned integer */ +typedef uint32_t uint_32t; /* 32-bit unsigned integer */ +typedef uint64_t u64b_t; /* 64-bit unsigned integer */ #ifndef RotL_64 #define RotL_64(x,N) (((x) << (N)) | ((x) >> (64-(N)))) Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/crypto.c Tue Nov 3 22:27:54 2020 (r367309) @@ -117,9 +117,9 @@ static struct mtx crypto_drivers_mtx; /* lock on driv struct cryptocap { device_t cc_dev; uint32_t cc_hid; - u_int32_t cc_sessions; /* (d) # of sessions */ - u_int32_t cc_koperations; /* (d) # os asym operations */ - u_int8_t cc_kalg[CRK_ALGORITHM_MAX + 1]; + uint32_t cc_sessions; /* (d) # of sessions */ + uint32_t cc_koperations; /* (d) # os asym operations */ + uint8_t cc_kalg[CRK_ALGORITHM_MAX + 1]; int cc_flags; /* (d) flags */ #define CRYPTOCAP_F_CLEANUP 0x80000000 /* needs resource cleanup */ @@ -173,8 +173,8 @@ struct crypto_ret_worker { TAILQ_HEAD(,cryptop) crp_ret_q; /* callback queue for symetric jobs */ TAILQ_HEAD(,cryptkop) crp_ret_kq; /* callback queue for asym jobs */ - u_int32_t reorder_ops; /* total ordered sym jobs received */ - u_int32_t reorder_cur_seq; /* current sym job dispatched */ + uint32_t reorder_ops; /* total ordered sym jobs received */ + uint32_t reorder_cur_seq; /* current sym job dispatched */ struct proc *cryptoretproc; }; @@ -611,7 +611,7 @@ crypto_cipher(const struct crypto_session_params *csp) } static struct cryptocap * -crypto_checkdriver(u_int32_t hid) +crypto_checkdriver(uint32_t hid) { return (hid >= crypto_drivers_size ? NULL : crypto_drivers[hid]); @@ -1119,7 +1119,7 @@ crypto_getcaps(int hid) * is called once for each algorithm supported a driver. */ int -crypto_kregister(u_int32_t driverid, int kalg, u_int32_t flags) +crypto_kregister(uint32_t driverid, int kalg, uint32_t flags) { struct cryptocap *cap; int err; @@ -1159,7 +1159,7 @@ crypto_kregister(u_int32_t driverid, int kalg, u_int32 * requests. */ int -crypto_unregister_all(u_int32_t driverid) +crypto_unregister_all(uint32_t driverid) { struct cryptocap *cap; @@ -1190,7 +1190,7 @@ crypto_unregister_all(u_int32_t driverid) * the driver is now ready for cryptop's and/or cryptokop's. */ int -crypto_unblock(u_int32_t driverid, int what) +crypto_unblock(uint32_t driverid, int what) { struct cryptocap *cap; int err; Modified: head/sys/opencrypto/cryptodeflate.c ============================================================================== --- head/sys/opencrypto/cryptodeflate.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/cryptodeflate.c Tue Nov 3 22:27:54 2020 (r367309) @@ -49,13 +49,13 @@ __FBSDID("$FreeBSD$"); SDT_PROVIDER_DECLARE(opencrypto); SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, entry, - "int", "u_int32_t"); + "int", "uint32_t"); SDT_PROBE_DEFINE6(opencrypto, deflate, deflate_global, bad, "int", "int", "int", "int", "int", "int"); SDT_PROBE_DEFINE6(opencrypto, deflate, deflate_global, iter, "int", "int", "int", "int", "int", "int"); SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, return, - "int", "u_int32_t"); + "int", "uint32_t"); int window_inflate = -1 * MAX_WBITS; int window_deflate = -12; @@ -81,18 +81,18 @@ crypto_zfree(void *nil, void *ptr) * algorithm */ -u_int32_t +uint32_t deflate_global(data, size, decomp, out) - u_int8_t *data; - u_int32_t size; + uint8_t *data; + uint32_t size; int decomp; - u_int8_t **out; + uint8_t **out; { /* decomp indicates whether we compress (0) or decompress (1) */ z_stream zbuf; - u_int8_t *output; - u_int32_t count, result; + uint8_t *output; + uint32_t count, result; int error, i; struct deflate_buf *bufh, *bufp; Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/cryptodev.c Tue Nov 3 22:27:54 2020 (r367309) @@ -72,53 +72,53 @@ SDT_PROBE_DEFINE1(opencrypto, dev, ioctl, error, "int" #include struct session_op32 { - u_int32_t cipher; - u_int32_t mac; - u_int32_t keylen; - u_int32_t key; + uint32_t cipher; + uint32_t mac; + uint32_t keylen; + uint32_t key; int mackeylen; - u_int32_t mackey; - u_int32_t ses; + uint32_t mackey; + uint32_t ses; }; struct session2_op32 { - u_int32_t cipher; - u_int32_t mac; - u_int32_t keylen; - u_int32_t key; + uint32_t cipher; + uint32_t mac; + uint32_t keylen; + uint32_t key; int mackeylen; - u_int32_t mackey; - u_int32_t ses; + uint32_t mackey; + uint32_t ses; int crid; int pad[4]; }; struct crypt_op32 { - u_int32_t ses; - u_int16_t op; - u_int16_t flags; + uint32_t ses; + uint16_t op; + uint16_t flags; u_int len; - u_int32_t src, dst; - u_int32_t mac; - u_int32_t iv; + uint32_t src, dst; + uint32_t mac; + uint32_t iv; }; struct crypt_aead32 { - u_int32_t ses; - u_int16_t op; - u_int16_t flags; + uint32_t ses; + uint16_t op; + uint16_t flags; u_int len; u_int aadlen; u_int ivlen; - u_int32_t src; - u_int32_t dst; - u_int32_t aad; - u_int32_t tag; - u_int32_t iv; + uint32_t src; + uint32_t dst; + uint32_t aad; + uint32_t tag; + uint32_t iv; }; struct crparam32 { - u_int32_t crp_p; + uint32_t crp_p; u_int crp_nbits; }; @@ -309,7 +309,7 @@ struct csession { TAILQ_ENTRY(csession) next; crypto_session_t cses; volatile u_int refs; - u_int32_t ses; + uint32_t ses; struct mtx lock; /* for op submission */ struct enc_xform *txform; @@ -437,7 +437,7 @@ cryptof_ioctl( void *mackey = NULL; struct crypt_kop *kop; crypto_session_t cses; - u_int32_t ses; + uint32_t ses; int error = 0, crid; union { struct session2_op sopc; @@ -806,7 +806,7 @@ bail: session2_op_to_op(sop, data); break; case CIOCFSESSION: - ses = *(u_int32_t *)data; + ses = *(uint32_t *)data; if (!csedelete(fcr, ses)) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/cryptodev.h Tue Nov 3 22:27:54 2020 (r367309) @@ -216,15 +216,15 @@ /* NB: deprecated */ struct session_op { - u_int32_t cipher; /* ie. CRYPTO_AES_CBC */ - u_int32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */ + uint32_t cipher; /* ie. CRYPTO_AES_CBC */ + uint32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */ - u_int32_t keylen; /* cipher key */ + uint32_t keylen; /* cipher key */ c_caddr_t key; int mackeylen; /* mac key */ c_caddr_t mackey; - u_int32_t ses; /* returns: session # */ + uint32_t ses; /* returns: session # */ }; /* @@ -233,25 +233,25 @@ struct session_op { * "cryptop" (no underscore). */ struct session2_op { - u_int32_t cipher; /* ie. CRYPTO_AES_CBC */ - u_int32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */ + uint32_t cipher; /* ie. CRYPTO_AES_CBC */ + uint32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */ - u_int32_t keylen; /* cipher key */ + uint32_t keylen; /* cipher key */ c_caddr_t key; int mackeylen; /* mac key */ c_caddr_t mackey; - u_int32_t ses; /* returns: session # */ + uint32_t ses; /* returns: session # */ int crid; /* driver id + flags (rw) */ int pad[4]; /* for future expansion */ }; struct crypt_op { - u_int32_t ses; - u_int16_t op; /* i.e. COP_ENCRYPT */ + uint32_t ses; + uint16_t op; /* i.e. COP_ENCRYPT */ #define COP_ENCRYPT 1 #define COP_DECRYPT 2 - u_int16_t flags; + uint16_t flags; #define COP_F_CIPHER_FIRST 0x0001 /* Cipher before MAC. */ #define COP_F_BATCH 0x0008 /* Batch op if possible */ u_int len; @@ -263,9 +263,9 @@ struct crypt_op { /* op and flags the same as crypt_op */ struct crypt_aead { - u_int32_t ses; - u_int16_t op; /* i.e. COP_ENCRYPT */ - u_int16_t flags; + uint32_t ses; + uint16_t op; /* i.e. COP_ENCRYPT */ + uint16_t flags; u_int len; u_int aadlen; u_int ivlen; @@ -320,16 +320,16 @@ struct crypt_kop { * done against open of /dev/crypto, to get a cloned descriptor. * Please use F_SETFD against the cloned descriptor. */ -#define CRIOGET _IOWR('c', 100, u_int32_t) +#define CRIOGET _IOWR('c', 100, uint32_t) #define CRIOASYMFEAT CIOCASYMFEAT #define CRIOFINDDEV CIOCFINDDEV /* the following are done against the cloned descriptor */ #define CIOCGSESSION _IOWR('c', 101, struct session_op) -#define CIOCFSESSION _IOW('c', 102, u_int32_t) +#define CIOCFSESSION _IOW('c', 102, uint32_t) #define CIOCCRYPT _IOWR('c', 103, struct crypt_op) #define CIOCKEY _IOWR('c', 104, struct crypt_kop) -#define CIOCASYMFEAT _IOR('c', 105, u_int32_t) +#define CIOCASYMFEAT _IOR('c', 105, uint32_t) #define CIOCGSESSION2 _IOWR('c', 106, struct session2_op) #define CIOCKEY2 _IOWR('c', 107, struct crypt_kop) #define CIOCFINDDEV _IOWR('c', 108, struct crypt_find_op) @@ -656,13 +656,13 @@ extern int32_t crypto_get_driverid(device_t dev, size_ extern int crypto_find_driver(const char *); extern device_t crypto_find_device_byhid(int hid); extern int crypto_getcaps(int hid); -extern int crypto_kregister(u_int32_t, int, u_int32_t); -extern int crypto_unregister_all(u_int32_t driverid); +extern int crypto_kregister(uint32_t, int, uint32_t); +extern int crypto_unregister_all(uint32_t driverid); extern int crypto_dispatch(struct cryptop *crp); extern int crypto_kdispatch(struct cryptkop *); #define CRYPTO_SYMQ 0x1 #define CRYPTO_ASYMQ 0x2 -extern int crypto_unblock(u_int32_t, int); +extern int crypto_unblock(uint32_t, int); extern void crypto_done(struct cryptop *crp); extern void crypto_kdone(struct cryptkop *); extern int crypto_getfeat(int *); Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/cryptosoft.c Tue Nov 3 22:27:54 2020 (r367309) @@ -893,10 +893,10 @@ swcr_eta(struct swcr_session *ses, struct cryptop *crp static int swcr_compdec(struct swcr_session *ses, struct cryptop *crp) { - u_int8_t *data, *out; + uint8_t *data, *out; struct comp_algo *cxf; int adj; - u_int32_t result; + uint32_t result; cxf = ses->swcr_compdec.sw_cxf; Modified: head/sys/opencrypto/deflate.h ============================================================================== --- head/sys/opencrypto/deflate.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/deflate.h Tue Nov 3 22:27:54 2020 (r367309) @@ -41,7 +41,7 @@ #define MINCOMP 2 /* won't be used, but must be defined */ #define ZBUF 10 -u_int32_t deflate_global(u_int8_t *, u_int32_t, int, u_int8_t **); +uint32_t deflate_global(uint8_t *, uint32_t, int, uint8_t **); /* * We are going to use a combined allocation to hold the metadata Modified: head/sys/opencrypto/rmd160.c ============================================================================== --- head/sys/opencrypto/rmd160.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/rmd160.c Tue Nov 3 22:27:54 2020 (r367309) @@ -106,9 +106,9 @@ RMD160Init(RMD160_CTX *ctx) } void -RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len) +RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len) { - u_int32_t have, off, need; + uint32_t have, off, need; have = (ctx->count/8) % 64; need = 64 - have; @@ -137,7 +137,7 @@ RMD160Final(u_char digest[20], RMD160_CTX *ctx) { int i; u_char size[8]; - u_int32_t padlen; + uint32_t padlen; PUT_64BIT_LE(size, ctx->count); @@ -159,9 +159,9 @@ RMD160Final(u_char digest[20], RMD160_CTX *ctx) } void -RMD160Transform(u_int32_t state[5], const u_char block[64]) +RMD160Transform(uint32_t state[5], const u_char block[64]) { - u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; + uint32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; #if BYTE_ORDER == LITTLE_ENDIAN memcpy(x, block, 64); @@ -169,7 +169,7 @@ RMD160Transform(u_int32_t state[5], const u_char block int i; for (i = 0; i < 16; i++) - x[i] = bswap32(*(const u_int32_t*)(block+i*4)); + x[i] = bswap32(*(const uint32_t*)(block+i*4)); #endif a = state[0]; Modified: head/sys/opencrypto/rmd160.h ============================================================================== --- head/sys/opencrypto/rmd160.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/rmd160.h Tue Nov 3 22:27:54 2020 (r367309) @@ -28,14 +28,14 @@ /* RMD160 context. */ typedef struct RMD160Context { - u_int32_t state[5]; /* state */ - u_int64_t count; /* number of bits, modulo 2^64 */ + uint32_t state[5]; /* state */ + uint64_t count; /* number of bits, modulo 2^64 */ u_char buffer[64]; /* input buffer */ } RMD160_CTX; void RMD160Init(RMD160_CTX *); -void RMD160Transform(u_int32_t [5], const u_char [64]); -void RMD160Update(RMD160_CTX *, const u_char *, u_int32_t); +void RMD160Transform(uint32_t [5], const u_char [64]); +void RMD160Update(RMD160_CTX *, const u_char *, uint32_t); void RMD160Final(u_char [20], RMD160_CTX *); #endif /* _RMD160_H */ Modified: head/sys/opencrypto/xform_auth.h ============================================================================== --- head/sys/opencrypto/xform_auth.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_auth.h Tue Nov 3 22:27:54 2020 (r367309) @@ -52,15 +52,15 @@ struct auth_hash { int type; char *name; - u_int16_t keysize; - u_int16_t hashsize; - u_int16_t ctxsize; - u_int16_t blocksize; + uint16_t keysize; + uint16_t hashsize; + uint16_t ctxsize; + uint16_t blocksize; void (*Init) (void *); void (*Setkey) (void *, const uint8_t *, u_int); void (*Reinit) (void *, const uint8_t *, u_int); int (*Update) (void *, const void *, u_int); - void (*Final) (u_int8_t *, void *); + void (*Final) (uint8_t *, void *); }; extern struct auth_hash auth_hash_null; Modified: head/sys/opencrypto/xform_comp.h ============================================================================== --- head/sys/opencrypto/xform_comp.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_comp.h Tue Nov 3 22:27:54 2020 (r367309) @@ -42,8 +42,8 @@ struct comp_algo { int type; char *name; size_t minlen; - u_int32_t (*compress) (u_int8_t *, u_int32_t, u_int8_t **); - u_int32_t (*decompress) (u_int8_t *, u_int32_t, u_int8_t **); + uint32_t (*compress) (uint8_t *, uint32_t, uint8_t **); + uint32_t (*decompress) (uint8_t *, uint32_t, uint8_t **); }; extern struct comp_algo comp_algo_deflate; Modified: head/sys/opencrypto/xform_deflate.c ============================================================================== --- head/sys/opencrypto/xform_deflate.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_deflate.c Tue Nov 3 22:27:54 2020 (r367309) @@ -53,8 +53,8 @@ __FBSDID("$FreeBSD$"); #include #include -static u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **); -static u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **); +static uint32_t deflate_compress(uint8_t *, uint32_t, uint8_t **); +static uint32_t deflate_decompress(uint8_t *, uint32_t, uint8_t **); /* Compression instance */ struct comp_algo comp_algo_deflate = { @@ -67,20 +67,20 @@ struct comp_algo comp_algo_deflate = { * And compression */ -static u_int32_t +static uint32_t deflate_compress(data, size, out) - u_int8_t *data; - u_int32_t size; - u_int8_t **out; + uint8_t *data; + uint32_t size; + uint8_t **out; { return deflate_global(data, size, 0, out); } -static u_int32_t +static uint32_t deflate_decompress(data, size, out) - u_int8_t *data; - u_int32_t size; - u_int8_t **out; + uint8_t *data; + uint32_t size; + uint8_t **out; { return deflate_global(data, size, 1, out); } Modified: head/sys/opencrypto/xform_enc.h ============================================================================== --- head/sys/opencrypto/xform_enc.h Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_enc.h Tue Nov 3 22:27:54 2020 (r367309) @@ -50,10 +50,10 @@ struct enc_xform { int type; char *name; size_t ctxsize; - u_int16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ + uint16_t blocksize; /* Required input block size -- 1 for stream ciphers. */ uint16_t native_blocksize; /* Used for stream ciphers. */ - u_int16_t ivsize; - u_int16_t minkey, maxkey; + uint16_t ivsize; + uint16_t minkey, maxkey; /* * Encrypt/decrypt a single block. For stream ciphers this @@ -62,7 +62,7 @@ struct enc_xform { void (*encrypt) (void *, const uint8_t *, uint8_t *); void (*decrypt) (void *, const uint8_t *, uint8_t *); int (*setkey) (void *, const uint8_t *, int len); - void (*reinit) (void *, const u_int8_t *); + void (*reinit) (void *, const uint8_t *); /* * For stream ciphers, encrypt/decrypt the final partial block @@ -84,16 +84,16 @@ extern struct enc_xform enc_xform_chacha20; extern struct enc_xform enc_xform_ccm; struct aes_icm_ctx { - u_int32_t ac_ek[4*(RIJNDAEL_MAXNR + 1)]; + uint32_t ac_ek[4*(RIJNDAEL_MAXNR + 1)]; /* ac_block is initialized to IV */ - u_int8_t ac_block[AESICM_BLOCKSIZE]; + uint8_t ac_block[AESICM_BLOCKSIZE]; int ac_nr; }; struct aes_xts_ctx { rijndael_ctx key1; rijndael_ctx key2; - u_int8_t tweak[AES_XTS_BLOCKSIZE]; + uint8_t tweak[AES_XTS_BLOCKSIZE]; }; #endif /* _CRYPTO_XFORM_ENC_H_ */ Modified: head/sys/opencrypto/xform_null.c ============================================================================== --- head/sys/opencrypto/xform_null.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_null.c Tue Nov 3 22:27:54 2020 (r367309) @@ -53,13 +53,13 @@ __FBSDID("$FreeBSD$"); #include #include -static int null_setkey(void *, const u_int8_t *, int); +static int null_setkey(void *, const uint8_t *, int); static void null_crypt(void *, const uint8_t *, uint8_t *); static void null_init(void *); static void null_reinit(void *ctx, const uint8_t *buf, u_int len); static int null_update(void *, const void *, u_int); -static void null_final(u_int8_t *, void *); +static void null_final(uint8_t *, void *); /* Encryption instances */ struct enc_xform enc_xform_null = { @@ -125,8 +125,8 @@ null_update(void *ctx, const void *buf, u_int len) } static void -null_final(u_int8_t *buf, void *ctx) +null_final(uint8_t *buf, void *ctx) { - if (buf != (u_int8_t *) 0) + if (buf != (uint8_t *) 0) bzero(buf, 12); } Modified: head/sys/opencrypto/xform_rijndael.c ============================================================================== --- head/sys/opencrypto/xform_rijndael.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_rijndael.c Tue Nov 3 22:27:54 2020 (r367309) @@ -53,7 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include -static int rijndael128_setkey(void *, const u_int8_t *, int); +static int rijndael128_setkey(void *, const uint8_t *, int); static void rijndael128_encrypt(void *, const uint8_t *, uint8_t *); static void rijndael128_decrypt(void *, const uint8_t *, uint8_t *); Modified: head/sys/opencrypto/xform_sha1.c ============================================================================== --- head/sys/opencrypto/xform_sha1.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_sha1.c Tue Nov 3 22:27:54 2020 (r367309) @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); static void SHA1Init_int(void *); static int SHA1Update_int(void *, const void *, u_int); -static void SHA1Final_int(u_int8_t *, void *); +static void SHA1Final_int(uint8_t *, void *); /* Plain hash */ struct auth_hash auth_hash_sha1 = { @@ -99,7 +99,7 @@ SHA1Update_int(void *ctx, const void *buf, u_int len) } static void -SHA1Final_int(u_int8_t *blk, void *ctx) +SHA1Final_int(uint8_t *blk, void *ctx) { SHA1Final(blk, ctx); } Modified: head/sys/opencrypto/xform_sha2.c ============================================================================== --- head/sys/opencrypto/xform_sha2.c Tue Nov 3 22:13:16 2020 (r367308) +++ head/sys/opencrypto/xform_sha2.c Tue Nov 3 22:27:54 2020 (r367309) @@ -70,7 +70,7 @@ struct auth_hash auth_hash_sha2_224 = { .blocksize = SHA2_224_BLOCK_LEN, .Init = (void (*)(void *)) SHA224_Init, .Update = SHA224Update_int, - .Final = (void (*)(u_int8_t *, void *)) SHA224_Final, + .Final = (void (*)(uint8_t *, void *)) SHA224_Final, }; struct auth_hash auth_hash_sha2_256 = { @@ -82,7 +82,7 @@ struct auth_hash auth_hash_sha2_256 = { .blocksize = SHA2_256_BLOCK_LEN, .Init = (void (*)(void *)) SHA256_Init, .Update = SHA256Update_int, - .Final = (void (*)(u_int8_t *, void *)) SHA256_Final, + .Final = (void (*)(uint8_t *, void *)) SHA256_Final, }; struct auth_hash auth_hash_sha2_384 = { @@ -94,7 +94,7 @@ struct auth_hash auth_hash_sha2_384 = { .blocksize = SHA2_384_BLOCK_LEN, .Init = (void (*)(void *)) SHA384_Init, .Update = SHA384Update_int, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Nov 3 22:32:31 2020 Return-Path: Delivered-To: svn-src-head@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 D5F4846627C; Tue, 3 Nov 2020 22:32:31 +0000 (UTC) (envelope-from jhb@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 4CQl0H5LQ8z4Y3y; Tue, 3 Nov 2020 22:32:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C1BE21FAC; Tue, 3 Nov 2020 22:32:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3MWVGj038520; Tue, 3 Nov 2020 22:32:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3MWVh9038517; Tue, 3 Nov 2020 22:32:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011032232.0A3MWVh9038517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Nov 2020 22:32:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367310 - in head/sys: crypto opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: crypto opencrypto X-SVN-Commit-Revision: 367310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 22:32:31 -0000 Author: jhb Date: Tue Nov 3 22:32:30 2020 New Revision: 367310 URL: https://svnweb.freebsd.org/changeset/base/367310 Log: Replace some K&R function definitions with ANSI C. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27062 Modified: head/sys/crypto/sha1.c head/sys/opencrypto/cryptodeflate.c head/sys/opencrypto/xform_deflate.c Modified: head/sys/crypto/sha1.c ============================================================================== --- head/sys/crypto/sha1.c Tue Nov 3 22:27:54 2020 (r367309) +++ head/sys/crypto/sha1.c Tue Nov 3 22:32:30 2020 (r367310) @@ -91,8 +91,7 @@ static uint32_t _K[] = { 0x5a827999, 0x6ed9eba1, 0x8f1 static void sha1_step(struct sha1_ctxt *); static void -sha1_step(ctxt) - struct sha1_ctxt *ctxt; +sha1_step(struct sha1_ctxt *ctxt) { uint32_t a, b, c, d, e; size_t t, s; @@ -176,8 +175,7 @@ sha1_step(ctxt) /*------------------------------------------------------------*/ void -sha1_init(ctxt) - struct sha1_ctxt *ctxt; +sha1_init(struct sha1_ctxt *ctxt) { bzero(ctxt, sizeof(struct sha1_ctxt)); H(0) = 0x67452301; @@ -188,8 +186,7 @@ sha1_init(ctxt) } void -sha1_pad(ctxt) - struct sha1_ctxt *ctxt; +sha1_pad(struct sha1_ctxt *ctxt) { size_t padlen; /*pad length in bytes*/ size_t padstart; @@ -223,10 +220,7 @@ sha1_pad(ctxt) } void -sha1_loop(ctxt, input, len) - struct sha1_ctxt *ctxt; - const uint8_t *input; - size_t len; +sha1_loop(struct sha1_ctxt *ctxt, const uint8_t *input, size_t len) { size_t gaplen; size_t gapstart; Modified: head/sys/opencrypto/cryptodeflate.c ============================================================================== --- head/sys/opencrypto/cryptodeflate.c Tue Nov 3 22:27:54 2020 (r367309) +++ head/sys/opencrypto/cryptodeflate.c Tue Nov 3 22:32:30 2020 (r367310) @@ -82,11 +82,7 @@ crypto_zfree(void *nil, void *ptr) */ uint32_t -deflate_global(data, size, decomp, out) - uint8_t *data; - uint32_t size; - int decomp; - uint8_t **out; +deflate_global(uint8_t *data, uint32_t size, int decomp, uint8_t **out) { /* decomp indicates whether we compress (0) or decompress (1) */ Modified: head/sys/opencrypto/xform_deflate.c ============================================================================== --- head/sys/opencrypto/xform_deflate.c Tue Nov 3 22:27:54 2020 (r367309) +++ head/sys/opencrypto/xform_deflate.c Tue Nov 3 22:32:30 2020 (r367310) @@ -68,19 +68,13 @@ struct comp_algo comp_algo_deflate = { */ static uint32_t -deflate_compress(data, size, out) - uint8_t *data; - uint32_t size; - uint8_t **out; +deflate_compress(uint8_t *data, uint32_t size, uint8_t **out) { return deflate_global(data, size, 0, out); } static uint32_t -deflate_decompress(data, size, out) - uint8_t *data; - uint32_t size; - uint8_t **out; +deflate_decompress(uint8_t *data, uint32_t size, uint8_t **out) { return deflate_global(data, size, 1, out); } From owner-svn-src-head@freebsd.org Tue Nov 3 22:53:24 2020 Return-Path: Delivered-To: svn-src-head@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 22B9F466A9D; Tue, 3 Nov 2020 22:53:24 +0000 (UTC) (envelope-from jhb@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 4CQlSN09r3z4ZL6; Tue, 3 Nov 2020 22:53:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE73322249; Tue, 3 Nov 2020 22:53:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A3MrNLo050773; Tue, 3 Nov 2020 22:53:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A3MrN5b050772; Tue, 3 Nov 2020 22:53:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011032253.0A3MrN5b050772@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Nov 2020 22:53:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367311 - head/tools/tools/crypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/tools/tools/crypto X-SVN-Commit-Revision: 367311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Nov 2020 22:53:24 -0000 Author: jhb Date: Tue Nov 3 22:53:23 2020 New Revision: 367311 URL: https://svnweb.freebsd.org/changeset/base/367311 Log: Remove unnecessary __DECONST(). Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27063 Modified: head/tools/tools/crypto/cryptocheck.c Modified: head/tools/tools/crypto/cryptocheck.c ============================================================================== --- head/tools/tools/crypto/cryptocheck.c Tue Nov 3 22:32:30 2020 (r367310) +++ head/tools/tools/crypto/cryptocheck.c Tue Nov 3 22:53:23 2020 (r367311) @@ -492,7 +492,7 @@ ocf_hash(const struct alg *alg, const char *buffer, si ocf_init_cop(&ses, &cop); cop.op = 0; cop.len = size; - cop.src = __DECONST(char *, buffer); + cop.src = buffer; cop.mac = digest; if (ioctl(ses.fd, CIOCCRYPT, &cop) < 0) { @@ -596,7 +596,7 @@ ocf_hmac(const struct alg *alg, const char *buffer, si ocf_init_sop(&sop); sop.mackeylen = key_len; - sop.mackey = __DECONST(char *, key); + sop.mackey = key; sop.mac = alg->mac; if (!ocf_init_session(&sop, "HMAC", alg->name, &ses)) return (false); @@ -604,7 +604,7 @@ ocf_hmac(const struct alg *alg, const char *buffer, si ocf_init_cop(&ses, &cop); cop.op = 0; cop.len = size; - cop.src = __DECONST(char *, buffer); + cop.src = buffer; cop.mac = digest; if (ioctl(ses.fd, CIOCCRYPT, &cop) < 0) { @@ -709,7 +709,7 @@ ocf_init_cipher_session(const struct alg *alg, const c ocf_init_sop(&sop); sop.keylen = key_len; - sop.key = __DECONST(char *, key); + sop.key = key; sop.cipher = alg->cipher; return (ocf_init_session(&sop, "cipher", alg->name, ses)); } @@ -723,9 +723,9 @@ ocf_cipher(const struct ocf_session *ses, const struct ocf_init_cop(ses, &cop); cop.op = op; cop.len = size; - cop.src = __DECONST(char *, input); + cop.src = input; cop.dst = output; - cop.iv = __DECONST(char *, iv); + cop.iv = iv; if (ioctl(ses->fd, CIOCCRYPT, &cop) < 0) { warn("cryptodev %s (%zu) cipher failed for device %s", @@ -841,10 +841,10 @@ ocf_init_eta_session(const struct alg *alg, const char ocf_init_sop(&sop); sop.keylen = cipher_key_len; - sop.key = __DECONST(char *, cipher_key); + sop.key = cipher_key; sop.cipher = alg->cipher; sop.mackeylen = auth_key_len; - sop.mackey = __DECONST(char *, auth_key); + sop.mackey = auth_key; sop.mac = alg->mac; return (ocf_init_session(&sop, "ETA", alg->name, ses)); } @@ -864,11 +864,11 @@ ocf_eta(const struct ocf_session *ses, const char *iv, caead.len = size; caead.aadlen = aad_len; caead.ivlen = iv_len; - caead.src = __DECONST(char *, input); + caead.src = input; caead.dst = output; - caead.aad = __DECONST(char *, aad); + caead.aad = aad; caead.tag = digest; - caead.iv = __DECONST(char *, iv); + caead.iv = iv; ret = ioctl(ses->fd, CIOCCRYPTAEAD, &caead); } else { @@ -877,10 +877,10 @@ ocf_eta(const struct ocf_session *ses, const char *iv, ocf_init_cop(ses, &cop); cop.op = op; cop.len = size; - cop.src = __DECONST(char *, input); + cop.src = input; cop.dst = output; cop.mac = digest; - cop.iv = __DECONST(char *, iv); + cop.iv = iv; ret = ioctl(ses->fd, CIOCCRYPT, &cop); } @@ -1078,7 +1078,7 @@ ocf_gmac(const struct alg *alg, const char *input, siz ocf_init_sop(&sop); sop.mackeylen = key_len; - sop.mackey = __DECONST(char *, key); + sop.mackey = key; sop.mac = alg->mac; if (!ocf_init_session(&sop, "GMAC", alg->name, &ses)) return (false); @@ -1086,7 +1086,7 @@ ocf_gmac(const struct alg *alg, const char *input, siz ocf_init_cop(&ses, &cop); cop.op = 0; cop.len = size; - cop.src = __DECONST(char *, input); + cop.src = input; cop.mac = tag; cop.iv = iv; @@ -1298,7 +1298,7 @@ ocf_init_aead_session(const struct alg *alg, const cha ocf_init_sop(&sop); sop.keylen = key_len; - sop.key = __DECONST(char *, key); + sop.key = key; sop.cipher = alg->cipher; return (ocf_init_session(&sop, "AEAD", alg->name, ses)); } @@ -1315,11 +1315,11 @@ ocf_aead(const struct ocf_session *ses, const char *iv caead.len = size; caead.aadlen = aad_len; caead.ivlen = iv_len; - caead.src = __DECONST(char *, input); + caead.src = input; caead.dst = output; - caead.aad = __DECONST(char *, aad); + caead.aad = aad; caead.tag = tag; - caead.iv = __DECONST(char *, iv); + caead.iv = iv; if (ioctl(ses->fd, CIOCCRYPTAEAD, &caead) < 0) return (errno); From owner-svn-src-head@freebsd.org Wed Nov 4 10:21:31 2020 Return-Path: Delivered-To: svn-src-head@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 A1CF3457BF3; Wed, 4 Nov 2020 10:21:31 +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 4CR2kM3rgQz4Xnv; Wed, 4 Nov 2020 10:21:31 +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 6761BC1A5; Wed, 4 Nov 2020 10:21:31 +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 0A4ALVTJ072725; Wed, 4 Nov 2020 10:21:31 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4ALVio072724; Wed, 4 Nov 2020 10:21:31 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202011041021.0A4ALVio072724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 4 Nov 2020 10:21:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367320 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 367320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 10:21:31 -0000 Author: andrew Date: Wed Nov 4 10:21:30 2020 New Revision: 367320 URL: https://svnweb.freebsd.org/changeset/base/367320 Log: Allow the creation of 3 level page tables on arm64 The stage 2 arm64 page tables may need to start at a lower level. This is because we may only be able to map a limited IPA range and trying to use a full 4 levels will cause the CPU to fault in an unrecoverable way. To simplify the code we still allocate the full 4 levels, however level 0 will only ever be used to find the level 1 table used as the base. Handle this by creating a dummy entry in the level 0 table to point to the level 1 table. Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D26066 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Wed Nov 4 07:54:07 2020 (r367319) +++ head/sys/arm64/arm64/pmap.c Wed Nov 4 10:21:30 2020 (r367320) @@ -970,6 +970,8 @@ pmap_bootstrap(vm_offset_t l0pt, vm_offset_t l1pt, vm_ kernel_pmap->pm_l0_paddr = l0pt - kern_delta; kernel_pmap->pm_cookie = COOKIE_FROM(-1, INT_MIN); kernel_pmap->pm_stage = PM_STAGE1; + kernel_pmap->pm_levels = 4; + kernel_pmap->pm_ttbr = kernel_pmap->pm_l0_paddr; kernel_pmap->pm_asid_set = &asids; /* Assume the address we were loaded to is a valid physical address */ @@ -1714,33 +1716,37 @@ pmap_pinit0(pmap_t pmap) pmap->pm_root.rt_root = 0; pmap->pm_cookie = COOKIE_FROM(ASID_RESERVED_FOR_PID_0, INT_MIN); pmap->pm_stage = PM_STAGE1; + pmap->pm_levels = 4; + pmap->pm_ttbr = pmap->pm_l0_paddr; pmap->pm_asid_set = &asids; PCPU_SET(curpmap, pmap); } int -pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage) +pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage, int levels) { - vm_page_t l0pt; + vm_page_t m; /* * allocate the l0 page */ - while ((l0pt = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | + while ((m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) vm_wait(NULL); - pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(l0pt); + pmap->pm_l0_paddr = VM_PAGE_TO_PHYS(m); pmap->pm_l0 = (pd_entry_t *)PHYS_TO_DMAP(pmap->pm_l0_paddr); - if ((l0pt->flags & PG_ZERO) == 0) + if ((m->flags & PG_ZERO) == 0) pagezero(pmap->pm_l0); pmap->pm_root.rt_root = 0; bzero(&pmap->pm_stats, sizeof(pmap->pm_stats)); pmap->pm_cookie = COOKIE_FROM(-1, INT_MAX); + MPASS(levels == 3 || levels == 4); + pmap->pm_levels = levels; pmap->pm_stage = stage; switch (stage) { case PM_STAGE1: @@ -1757,6 +1763,18 @@ pmap_pinit_stage(pmap_t pmap, enum pmap_stage stage) /* XXX Temporarily disable deferred ASID allocation. */ pmap_alloc_asid(pmap); + /* + * Allocate the level 1 entry to use as the root. This will increase + * the refcount on the level 1 page so it won't be removed until + * pmap_release() is called. + */ + if (pmap->pm_levels == 3) { + PMAP_LOCK(pmap); + m = _pmap_alloc_l3(pmap, NUL2E + NUL1E, NULL); + PMAP_UNLOCK(pmap); + } + pmap->pm_ttbr = VM_PAGE_TO_PHYS(m); + return (1); } @@ -1764,7 +1782,7 @@ int pmap_pinit(pmap_t pmap) { - return (pmap_pinit_stage(pmap, PM_STAGE1)); + return (pmap_pinit_stage(pmap, PM_STAGE1, 4)); } /* @@ -2017,10 +2035,29 @@ retry: void pmap_release(pmap_t pmap) { + boolean_t rv; + struct spglist free; struct asid_set *set; vm_page_t m; int asid; + if (pmap->pm_levels != 4) { + PMAP_ASSERT_STAGE2(pmap); + KASSERT(pmap->pm_stats.resident_count == 1, + ("pmap_release: pmap resident count %ld != 0", + pmap->pm_stats.resident_count)); + KASSERT((pmap->pm_l0[0] & ATTR_DESCR_VALID) == ATTR_DESCR_VALID, + ("pmap_release: Invalid l0 entry: %lx", pmap->pm_l0[0])); + + SLIST_INIT(&free); + m = PHYS_TO_VM_PAGE(pmap->pm_ttbr); + PMAP_LOCK(pmap); + rv = pmap_unwire_l3(pmap, 0, m, &free); + PMAP_UNLOCK(pmap); + MPASS(rv == TRUE); + vm_page_free_pages_toq(&free, true); + } + KASSERT(pmap->pm_stats.resident_count == 0, ("pmap_release: pmap resident count %ld != 0", pmap->pm_stats.resident_count)); @@ -6514,7 +6551,7 @@ pmap_to_ttbr0(pmap_t pmap) { return (ASID_TO_OPERAND(COOKIE_TO_ASID(pmap->pm_cookie)) | - pmap->pm_l0_paddr); + pmap->pm_ttbr); } static bool From owner-svn-src-head@freebsd.org Wed Nov 4 10:38:26 2020 Return-Path: Delivered-To: svn-src-head@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 28F6E4583A1; Wed, 4 Nov 2020 10:38:26 +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 4CR35t06Zxz4YXY; Wed, 4 Nov 2020 10:38:26 +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 D883BC686; Wed, 4 Nov 2020 10:38:25 +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 0A4AcPKE082014; Wed, 4 Nov 2020 10:38:25 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4AcPNn082013; Wed, 4 Nov 2020 10:38:25 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011041038.0A4AcPNn082013@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: Wed, 4 Nov 2020 10:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367321 - head/sys/amd64/linux X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sys/amd64/linux X-SVN-Commit-Revision: 367321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 10:38:26 -0000 Author: 0mp (doc,ports committer) Date: Wed Nov 4 10:38:25 2020 New Revision: 367321 URL: https://svnweb.freebsd.org/changeset/base/367321 Log: Fix a typo Modified: head/sys/amd64/linux/linux_machdep.c Modified: head/sys/amd64/linux/linux_machdep.c ============================================================================== --- head/sys/amd64/linux/linux_machdep.c Wed Nov 4 10:21:30 2020 (r367320) +++ head/sys/amd64/linux/linux_machdep.c Wed Nov 4 10:38:25 2020 (r367321) @@ -126,7 +126,7 @@ linux_set_upcall_kse(struct thread *td, register_t sta /* * The newly created Linux thread returns - * to the user space by the same path that a parent do. + * to the user space by the same path that a parent does. */ td->td_frame->tf_rax = 0; return (0); From owner-svn-src-head@freebsd.org Wed Nov 4 10:45:15 2020 Return-Path: Delivered-To: svn-src-head@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 CC8724580FA; Wed, 4 Nov 2020 10:45:15 +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 4CR3Fl51Nmz4YRJ; Wed, 4 Nov 2020 10:45:15 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p4fd3a1f5.dip0.t-ipconnect.de [79.211.161.245]) (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 4F2C31B7F1; Wed, 4 Nov 2020 10:45:15 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Wed, 4 Nov 2020 11:45:15 +0100 From: Gordon Bergling To: Mateusz Piotrowski <0mp@freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367321 - head/sys/amd64/linux Message-ID: <20201104104515.GA83813@lion.0xfce3.net> References: <202011041038.0A4AcPNn082013@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202011041038.0A4AcPNn082013@repo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 11:42AM up 4 days, 21:18, 5 users, load averages: 0.06, 0.14, 0.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 10:45:15 -0000 Shouldn't such a commit be approved by someone? And why you just abandoned the differential [1]? [1] https://reviews.freebsd.org/D25934 --Gordon On Wed, Nov 04, 2020 at 10:38:25AM +0000, Mateusz Piotrowski wrote: > Author: 0mp (doc,ports committer) > Date: Wed Nov 4 10:38:25 2020 > New Revision: 367321 > URL: https://svnweb.freebsd.org/changeset/base/367321 > > Log: > Fix a typo > > Modified: > head/sys/amd64/linux/linux_machdep.c > > Modified: head/sys/amd64/linux/linux_machdep.c > ============================================================================== > --- head/sys/amd64/linux/linux_machdep.c Wed Nov 4 10:21:30 2020 (r367320) > +++ head/sys/amd64/linux/linux_machdep.c Wed Nov 4 10:38:25 2020 (r367321) > @@ -126,7 +126,7 @@ linux_set_upcall_kse(struct thread *td, register_t sta > > /* > * The newly created Linux thread returns > - * to the user space by the same path that a parent do. > + * to the user space by the same path that a parent does. > */ > td->td_frame->tf_rax = 0; > return (0); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" -- From owner-svn-src-head@freebsd.org Wed Nov 4 11:02:06 2020 Return-Path: Delivered-To: svn-src-head@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 5988C459191; Wed, 4 Nov 2020 11:02:06 +0000 (UTC) (envelope-from dim@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 4CR3dB1FK9z4b9s; Wed, 4 Nov 2020 11:02:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0F497CB81; Wed, 4 Nov 2020 11:02:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4B25iS099951; Wed, 4 Nov 2020 11:02:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4B25Vd099947; Wed, 4 Nov 2020 11:02:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011041102.0A4B25Vd099947@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Nov 2020 11:02:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367322 - head/contrib/elftoolchain/libelftc X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/elftoolchain/libelftc X-SVN-Commit-Revision: 367322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 11:02:06 -0000 Author: dim Date: Wed Nov 4 11:02:05 2020 New Revision: 367322 URL: https://svnweb.freebsd.org/changeset/base/367322 Log: Merge elftoolchain r3877 (by jkoshy): Incorporate fixes from Dimitry Andric: - Use a BUFFER_GROW() macro to avoid rounding errors in capacity calculations. - Fix a bug introduced in [r3531]. - Fix handling of nested template parameters. Ticket: #581 This should fix a number of assertions on elftoolchain's cxxfilt, and allow it to correctly demangle several names that it could not handle before. Obtained from: https://sourceforge.net/p/elftoolchain/code/3877/ PR: 250702 MFC after: 3 days Modified: head/contrib/elftoolchain/libelftc/_libelftc.h head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c head/contrib/elftoolchain/libelftc/libelftc_vstr.c Modified: head/contrib/elftoolchain/libelftc/_libelftc.h ============================================================================== --- head/contrib/elftoolchain/libelftc/_libelftc.h Wed Nov 4 10:38:25 2020 (r367321) +++ head/contrib/elftoolchain/libelftc/_libelftc.h Wed Nov 4 11:02:05 2020 (r367322) @@ -56,6 +56,7 @@ struct vector_str { }; #define BUFFER_GROWFACTOR 1.618 +#define BUFFER_GROW(x) (((x)+0.5)*BUFFER_GROWFACTOR) #define ELFTC_FAILURE 0 #define ELFTC_ISDIGIT(C) (isdigit((C) & 0xFF)) Modified: head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Wed Nov 4 10:38:25 2020 (r367321) +++ head/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Wed Nov 4 11:02:05 2020 (r367322) @@ -2135,10 +2135,10 @@ cpp_demangle_read_sname(struct cpp_demangle_data *ddat if (err == 0) return (0); - assert(ddata->output.size > 0); + assert(ddata->cur_output->size > 0); if (vector_read_cmd_find(&ddata->cmd, READ_TMPL) == NULL) ddata->last_sname = - ddata->output.container[ddata->output.size - 1]; + ddata->cur_output->container[ddata->output.size - 1]; ddata->cur += len; @@ -2421,7 +2421,7 @@ cpp_demangle_read_tmpl_args(struct cpp_demangle_data * return (0); limit = 0; - v = &ddata->output; + v = ddata->cur_output; for (;;) { idx = v->size; if (!cpp_demangle_read_tmpl_arg(ddata)) @@ -3909,7 +3909,7 @@ vector_read_cmd_push(struct vector_read_cmd *v, enum r return (0); if (v->size == v->capacity) { - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); if ((tmp_r_ctn = malloc(sizeof(*tmp_r_ctn) * tmp_cap)) == NULL) return (0); for (i = 0; i < v->size; ++i) @@ -3974,7 +3974,7 @@ vector_type_qualifier_push(struct vector_type_qualifie return (0); if (v->size == v->capacity) { - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); if ((tmp_ctn = malloc(sizeof(enum type_qualifier) * tmp_cap)) == NULL) return (0); Modified: head/contrib/elftoolchain/libelftc/libelftc_vstr.c ============================================================================== --- head/contrib/elftoolchain/libelftc/libelftc_vstr.c Wed Nov 4 10:38:25 2020 (r367321) +++ head/contrib/elftoolchain/libelftc/libelftc_vstr.c Wed Nov 4 11:02:05 2020 (r367322) @@ -152,7 +152,7 @@ vector_str_grow(struct vector_str *v) assert(v->capacity > 0); - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); assert(tmp_cap > v->capacity); @@ -253,7 +253,7 @@ vector_str_push_vector_head(struct vector_str *dst, st if (dst == NULL || org == NULL) return (false); - tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(dst->size + org->size); if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) return (false); @@ -293,7 +293,7 @@ vector_str_push_vector(struct vector_str *dst, struct if (dst == NULL || org == NULL) return (false); - tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(dst->size + org->size); if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) return (false); From owner-svn-src-head@freebsd.org Wed Nov 4 11:13:37 2020 Return-Path: Delivered-To: svn-src-head@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 1711C4593B0; Wed, 4 Nov 2020 11:13:37 +0000 (UTC) (envelope-from dim@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 4CR3tT09plz4bZg; Wed, 4 Nov 2020 11:13:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C33F7C9CA; Wed, 4 Nov 2020 11:13:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4BDaHV006438; Wed, 4 Nov 2020 11:13:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4BDaMZ006437; Wed, 4 Nov 2020 11:13:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011041113.0A4BDaMZ006437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Nov 2020 11:13:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367323 - head/contrib/libcxxrt X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/libcxxrt X-SVN-Commit-Revision: 367323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 11:13:37 -0000 Author: dim Date: Wed Nov 4 11:13:36 2020 New Revision: 367323 URL: https://svnweb.freebsd.org/changeset/base/367323 Log: Update libcxxrt's private copy of elftoolchain demangler This updates the private copy of libelftc_dem_gnu3.c in libcxxrt with the most recent version from upstream r3877. Similar to r367322, this fixes a number of possible assertions, and allows it to correctly demangle several names that it could not handle before. PR: 250702 MFC after: 3 days Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c ============================================================================== --- head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 11:02:05 2020 (r367322) +++ head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 11:13:36 2020 (r367323) @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2007, 2008 Hyogeol Lee + * Copyright (c) 2007 Hyogeol Lee + * Copyright (c) 2015-2017 Kai Wang * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,12 +55,17 @@ struct vector_str { }; #define BUFFER_GROWFACTOR 1.618 -#define VECTOR_DEF_CAPACITY 8 +#define BUFFER_GROW(x) (((x)+0.5)*BUFFER_GROWFACTOR) + +#define ELFTC_FAILURE 0 #define ELFTC_ISDIGIT(C) (isdigit((C) & 0xFF)) +#define ELFTC_SUCCESS 1 +#define VECTOR_DEF_CAPACITY 8 + enum type_qualifier { TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT, - TYPE_CST, TYPE_VEC + TYPE_CST, TYPE_VEC, TYPE_RREF }; struct vector_type_qualifier { @@ -73,35 +79,57 @@ enum read_cmd { READ_TYPE, READ_FUNC, READ_PTRMEM }; +struct read_cmd_item { + enum read_cmd cmd; + void *data; +}; + struct vector_read_cmd { size_t size, capacity; - enum read_cmd *r_container; + struct read_cmd_item *r_container; }; +enum push_qualifier { + PUSH_ALL_QUALIFIER, + PUSH_CV_QUALIFIER, + PUSH_NON_CV_QUALIFIER, +}; + struct cpp_demangle_data { struct vector_str output; /* output string vector */ - struct vector_str output_tmp; struct vector_str subst; /* substitution string vector */ struct vector_str tmpl; struct vector_str class_type; + struct vector_str *cur_output; /* ptr to current output vec */ struct vector_read_cmd cmd; - bool paren; /* parenthesis opened */ - bool pfirst; /* first element of parameter */ bool mem_rst; /* restrict member function */ bool mem_vat; /* volatile member function */ bool mem_cst; /* const member function */ + bool mem_ref; /* lvalue-ref member func */ + bool mem_rref; /* rvalue-ref member func */ + bool is_tmpl; /* template args */ + bool is_functype; /* function type */ + bool ref_qualifier; /* ref qualifier */ + enum type_qualifier ref_qualifier_type; /* ref qualifier type */ + enum push_qualifier push_qualifier; /* which qualifiers to push */ int func_type; const char *cur; /* current mangled name ptr */ const char *last_sname; /* last source name */ - int push_head; }; +struct type_delimit { + bool paren; + bool firstp; +}; + #define CPP_DEMANGLE_TRY_LIMIT 128 #define FLOAT_SPRINTF_TRY_LIMIT 5 #define FLOAT_QUADRUPLE_BYTES 16 #define FLOAT_EXTENED_BYTES 10 #define SIMPLE_HASH(x,y) (64 * x + y) +#define DEM_PUSH_STR(d,s) cpp_demangle_push_str((d), (s), strlen((s))) +#define VEC_PUSH_STR(d,s) vector_str_push((d), (s), strlen((s))) static size_t get_strlen_sum(const struct vector_str *v); static bool vector_str_grow(struct vector_str *v); @@ -125,7 +153,7 @@ get_strlen_sum(const struct vector_str *v) /** * @brief Deallocate resource in vector_str. */ -static void +void vector_str_dest(struct vector_str *v) { size_t i; @@ -146,7 +174,7 @@ vector_str_dest(struct vector_str *v) * @param l Length of the string. * @return -1 at failed, 0 at not found, 1 at found. */ -static int +int vector_str_find(const struct vector_str *v, const char *o, size_t l) { size_t i; @@ -169,7 +197,7 @@ vector_str_find(const struct vector_str *v, const char * @param l Length of the string. * @return NULL at failed or NUL terminated new allocated string. */ -static char * +char * vector_str_get_flat(const struct vector_str *v, size_t *l) { ssize_t elem_pos, elem_size, rtn_size; @@ -213,7 +241,7 @@ vector_str_grow(struct vector_str *v) assert(v->capacity > 0); - tmp_cap = v->capacity * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(v->capacity); assert(tmp_cap > v->capacity); @@ -235,7 +263,7 @@ vector_str_grow(struct vector_str *v) * @brief Initialize vector_str. * @return false at failed, true at success. */ -static bool +bool vector_str_init(struct vector_str *v) { @@ -259,7 +287,7 @@ vector_str_init(struct vector_str *v) * @brief Remove last element in vector_str. * @return false at failed, true at success. */ -static bool +bool vector_str_pop(struct vector_str *v) { @@ -281,7 +309,7 @@ vector_str_pop(struct vector_str *v) * @brief Push back string to vector. * @return false at failed, true at success. */ -static bool +bool vector_str_push(struct vector_str *v, const char *str, size_t len) { @@ -305,7 +333,7 @@ vector_str_push(struct vector_str *v, const char *str, * @brief Push front org vector to det vector. * @return false at failed, true at success. */ -static bool +bool vector_str_push_vector_head(struct vector_str *dst, struct vector_str *org) { size_t i, j, tmp_cap; @@ -314,7 +342,7 @@ vector_str_push_vector_head(struct vector_str *dst, st if (dst == NULL || org == NULL) return (false); - tmp_cap = (dst->size + org->size) * BUFFER_GROWFACTOR; + tmp_cap = BUFFER_GROW(dst->size + org->size); if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) return (false); @@ -342,12 +370,53 @@ vector_str_push_vector_head(struct vector_str *dst, st } /** + * @brief Push org vector to the tail of det vector. + * @return false at failed, true at success. + */ +bool +vector_str_push_vector(struct vector_str *dst, struct vector_str *org) +{ + size_t i, j, tmp_cap; + char **tmp_ctn; + + if (dst == NULL || org == NULL) + return (false); + + tmp_cap = BUFFER_GROW(dst->size + org->size); + + if ((tmp_ctn = malloc(sizeof(char *) * tmp_cap)) == NULL) + return (false); + + for (i = 0; i < dst->size; ++i) + tmp_ctn[i] = dst->container[i]; + + for (i = 0; i < org->size; ++i) + if ((tmp_ctn[i + dst->size] = strdup(org->container[i])) == + NULL) { + for (j = 0; j < i + dst->size; ++j) + free(tmp_ctn[j]); + + free(tmp_ctn); + + return (false); + } + + free(dst->container); + + dst->container = tmp_ctn; + dst->capacity = tmp_cap; + dst->size += org->size; + + return (true); +} + +/** * @brief Get new allocated flat string from vector between begin and end. * * If r_len is not NULL, string length will be returned. * @return NULL at failed or NUL terminated new allocated string. */ -static char * +char * vector_str_substr(const struct vector_str *v, size_t begin, size_t end, size_t *r_len) { @@ -387,6 +456,7 @@ static int cpp_demangle_push_fp(struct cpp_demangle_da char *(*)(const char *, size_t)); static int cpp_demangle_push_str(struct cpp_demangle_data *, const char *, size_t); +static int cpp_demangle_pop_str(struct cpp_demangle_data *); static int cpp_demangle_push_subst(struct cpp_demangle_data *, const char *, size_t); static int cpp_demangle_push_subst_v(struct cpp_demangle_data *, @@ -419,16 +489,18 @@ static int cpp_demangle_read_number_as_string(struct c static int cpp_demangle_read_nv_offset(struct cpp_demangle_data *); static int cpp_demangle_read_offset(struct cpp_demangle_data *); static int cpp_demangle_read_offset_number(struct cpp_demangle_data *); -static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *); +static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *, + struct vector_type_qualifier *); static int cpp_demangle_read_sname(struct cpp_demangle_data *); static int cpp_demangle_read_subst(struct cpp_demangle_data *); static int cpp_demangle_read_subst_std(struct cpp_demangle_data *); static int cpp_demangle_read_subst_stdtmpl(struct cpp_demangle_data *, - const char *, size_t); + const char *); static int cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *); static int cpp_demangle_read_tmpl_args(struct cpp_demangle_data *); static int cpp_demangle_read_tmpl_param(struct cpp_demangle_data *); -static int cpp_demangle_read_type(struct cpp_demangle_data *, int); +static int cpp_demangle_read_type(struct cpp_demangle_data *, + struct type_delimit *); static int cpp_demangle_read_type_flat(struct cpp_demangle_data *, char **); static int cpp_demangle_read_uqname(struct cpp_demangle_data *); @@ -440,10 +512,12 @@ static char *decode_fp_to_float80(const char *, size_t static char *decode_fp_to_long_double(const char *, size_t); static int hex_to_dec(char); static void vector_read_cmd_dest(struct vector_read_cmd *); -static int vector_read_cmd_find(struct vector_read_cmd *, enum read_cmd); +static struct read_cmd_item *vector_read_cmd_find(struct vector_read_cmd *, + enum read_cmd); static int vector_read_cmd_init(struct vector_read_cmd *); static int vector_read_cmd_pop(struct vector_read_cmd *); -static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd); +static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd, + void *); static void vector_type_qualifier_dest(struct vector_type_qualifier *); static int vector_type_qualifier_init(struct vector_type_qualifier *); static int vector_type_qualifier_push(struct vector_type_qualifier *, @@ -460,14 +534,16 @@ char * __cxa_demangle_gnu3(const char *org) { struct cpp_demangle_data ddata; + struct vector_str ret_type; + struct type_delimit td; ssize_t org_len; unsigned int limit; - char *rtn = NULL; + char *rtn; + bool has_ret, more_type; - if (org == NULL) + if (org == NULL || (org_len = strlen(org)) < 2) return (NULL); - org_len = strlen(org); if (org_len > 11 && !strncmp(org, "_GLOBAL__I_", 11)) { if ((rtn = malloc(org_len + 19)) == NULL) return (NULL); @@ -476,52 +552,100 @@ __cxa_demangle_gnu3(const char *org) return (rtn); } - // Try demangling as a type for short encodings - if ((org_len < 2) || (org[0] != '_' || org[1] != 'Z' )) { - if (!cpp_demangle_data_init(&ddata, org)) - return (NULL); - if (!cpp_demangle_read_type(&ddata, 0)) - goto clean; - rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); - goto clean; - } + if (org[0] != '_' || org[1] != 'Z') + return (NULL); - if (!cpp_demangle_data_init(&ddata, org + 2)) return (NULL); rtn = NULL; + has_ret = more_type = false; if (!cpp_demangle_read_encoding(&ddata)) goto clean; + /* + * Pop function name from substitution candidate list. + */ + if (*ddata.cur != 0 && ddata.subst.size >= 1) { + if (!vector_str_pop(&ddata.subst)) + goto clean; + } + + td.paren = false; + td.firstp = true; limit = 0; + + /* + * The first type is a return type if we just demangled template + * args. (the template args is right next to the function name, + * which means it's a template function) + */ + if (ddata.is_tmpl) { + ddata.is_tmpl = false; + if (!vector_str_init(&ret_type)) + goto clean; + ddata.cur_output = &ret_type; + has_ret = true; + } + while (*ddata.cur != '\0') { /* * Breaking at some gcc info at tail. e.g) @@GLIBCXX_3.4 */ if (*ddata.cur == '@' && *(ddata.cur + 1) == '@') break; - if (!cpp_demangle_read_type(&ddata, 1)) - goto clean; + + if (has_ret) { + /* Read return type */ + if (!cpp_demangle_read_type(&ddata, NULL)) + goto clean; + } else { + /* Read function arg type */ + if (!cpp_demangle_read_type(&ddata, &td)) + goto clean; + } + + if (has_ret) { + /* Push return type to the beginning */ + if (!VEC_PUSH_STR(&ret_type, " ")) + goto clean; + if (!vector_str_push_vector_head(&ddata.output, + &ret_type)) + goto clean; + ddata.cur_output = &ddata.output; + vector_str_dest(&ret_type); + has_ret = false; + more_type = true; + } else if (more_type) + more_type = false; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) goto clean; } + if (more_type) + goto clean; if (ddata.output.size == 0) goto clean; - if (ddata.paren && !vector_str_push(&ddata.output, ")", 1)) + if (td.paren && !VEC_PUSH_STR(&ddata.output, ")")) goto clean; - if (ddata.mem_vat && !vector_str_push(&ddata.output, " volatile", 9)) + if (ddata.mem_vat && !VEC_PUSH_STR(&ddata.output, " volatile")) goto clean; - if (ddata.mem_cst && !vector_str_push(&ddata.output, " const", 6)) + if (ddata.mem_cst && !VEC_PUSH_STR(&ddata.output, " const")) goto clean; - if (ddata.mem_rst && !vector_str_push(&ddata.output, " restrict", 9)) + if (ddata.mem_rst && !VEC_PUSH_STR(&ddata.output, " restrict")) goto clean; + if (ddata.mem_ref && !VEC_PUSH_STR(&ddata.output, " &")) + goto clean; + if (ddata.mem_rref && !VEC_PUSH_STR(&ddata.output, " &&")) + goto clean; rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); clean: + if (has_ret) + vector_str_dest(&ret_type); + cpp_demangle_data_dest(&ddata); return (rtn); @@ -538,7 +662,6 @@ cpp_demangle_data_dest(struct cpp_demangle_data *d) vector_str_dest(&d->class_type); vector_str_dest(&d->tmpl); vector_str_dest(&d->subst); - vector_str_dest(&d->output_tmp); vector_str_dest(&d->output); } @@ -551,43 +674,42 @@ cpp_demangle_data_init(struct cpp_demangle_data *d, co if (!vector_str_init(&d->output)) return (0); - if (!vector_str_init(&d->output_tmp)) - goto clean1; if (!vector_str_init(&d->subst)) - goto clean2; + goto clean1; if (!vector_str_init(&d->tmpl)) - goto clean3; + goto clean2; if (!vector_str_init(&d->class_type)) - goto clean4; + goto clean3; if (!vector_read_cmd_init(&d->cmd)) - goto clean5; + goto clean4; assert(d->output.container != NULL); - assert(d->output_tmp.container != NULL); assert(d->subst.container != NULL); assert(d->tmpl.container != NULL); assert(d->class_type.container != NULL); - d->paren = false; - d->pfirst = false; d->mem_rst = false; d->mem_vat = false; d->mem_cst = false; + d->mem_ref = false; + d->mem_rref = false; + d->is_tmpl = false; + d->is_functype = false; + d->ref_qualifier = false; + d->push_qualifier = PUSH_ALL_QUALIFIER; d->func_type = 0; d->cur = cur; + d->cur_output = &d->output; d->last_sname = NULL; - d->push_head = 0; return (1); -clean5: - vector_str_dest(&d->class_type); clean4: - vector_str_dest(&d->tmpl); + vector_str_dest(&d->class_type); clean3: - vector_str_dest(&d->subst); + vector_str_dest(&d->tmpl); clean2: - vector_str_dest(&d->output_tmp); + vector_str_dest(&d->subst); clean1: vector_str_dest(&d->output); @@ -632,13 +754,27 @@ cpp_demangle_push_str(struct cpp_demangle_data *ddata, if (ddata == NULL || str == NULL || len == 0) return (0); - if (ddata->push_head > 0) - return (vector_str_push(&ddata->output_tmp, str, len)); + /* + * is_tmpl is used to check if the type (function arg) is right next + * to template args, and should always be cleared whenever new string + * pushed. + */ + ddata->is_tmpl = false; - return (vector_str_push(&ddata->output, str, len)); + return (vector_str_push(ddata->cur_output, str, len)); } static int +cpp_demangle_pop_str(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL) + return (0); + + return (vector_str_pop(ddata->cur_output)); +} + +static int cpp_demangle_push_subst(struct cpp_demangle_data *ddata, const char *str, size_t len) { @@ -677,9 +813,11 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d struct vector_type_qualifier *v, const char *type_str) { struct vector_str subst_v; + enum type_qualifier t; size_t idx, e_idx, e_len; - int rtn; char *buf; + int rtn; + bool cv; if (ddata == NULL || v == NULL) return (0); @@ -691,18 +829,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d if (type_str != NULL) { if (!vector_str_init(&subst_v)) return (0); - if (!vector_str_push(&subst_v, type_str, strlen(type_str))) + if (!VEC_PUSH_STR(&subst_v, type_str)) goto clean; } + cv = true; e_idx = 0; while (idx > 0) { switch (v->q_container[idx - 1]) { case TYPE_PTR: - if (!cpp_demangle_push_str(ddata, "*", 1)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "*")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, "*", 1)) + if (!VEC_PUSH_STR(&subst_v, "*")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -711,10 +853,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_REF: - if (!cpp_demangle_push_str(ddata, "&", 1)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "&")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, "&", 1)) + if (!VEC_PUSH_STR(&subst_v, "&")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -722,11 +867,29 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d } break; + case TYPE_RREF: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "&&")) + goto clean; + if (type_str != NULL) { + if (!VEC_PUSH_STR(&subst_v, "&&")) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, + &subst_v)) + goto clean; + } + break; + case TYPE_CMX: - if (!cpp_demangle_push_str(ddata, " complex", 8)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, " complex")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " complex", 8)) + if (!VEC_PUSH_STR(&subst_v, " complex")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -735,11 +898,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_IMG: - if (!cpp_demangle_push_str(ddata, " imaginary", 10)) + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, " imaginary")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " imaginary", - 10)) + if (!VEC_PUSH_STR(&subst_v, " imaginary")) goto clean; if (!cpp_demangle_push_subst_v(ddata, &subst_v)) @@ -748,6 +913,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_EXT: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (v->ext_name.size == 0 || e_idx > v->ext_name.size - 1) goto clean; @@ -759,14 +927,13 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d snprintf(buf, e_len + 2, " %s", v->ext_name.container[e_idx]); - if (!cpp_demangle_push_str(ddata, buf, e_len + 1)) { + if (!DEM_PUSH_STR(ddata, buf)) { free(buf); goto clean; } if (type_str != NULL) { - if (!vector_str_push(&subst_v, buf, - e_len + 1)) { + if (!VEC_PUSH_STR(&subst_v, buf)) { free(buf); goto clean; } @@ -781,11 +948,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_RST: - if (!cpp_demangle_push_str(ddata, " restrict", 9)) + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; + if (!DEM_PUSH_STR(ddata, " restrict")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " restrict", 9)) + if (!VEC_PUSH_STR(&subst_v, " restrict")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -793,11 +971,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_VAT: - if (!cpp_demangle_push_str(ddata, " volatile", 9)) + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; + if (!DEM_PUSH_STR(ddata, " volatile")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " volatile", 9)) + if (!VEC_PUSH_STR(&subst_v, " volatile")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -805,11 +994,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_CST: - if (!cpp_demangle_push_str(ddata, " const", 6)) + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; + if (!DEM_PUSH_STR(ddata, " const")) goto clean; if (type_str != NULL) { - if (!vector_str_push(&subst_v, " const", 6)) + if (!VEC_PUSH_STR(&subst_v, " const")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -817,6 +1017,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_VEC: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (v->ext_name.size == 0 || e_idx > v->ext_name.size - 1) goto clean; @@ -827,13 +1030,12 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d goto clean; snprintf(buf, e_len + 12, " __vector(%s)", v->ext_name.container[e_idx]); - if (!cpp_demangle_push_str(ddata, buf, e_len + 11)) { + if (!DEM_PUSH_STR(ddata, buf)) { free(buf); goto clean; } if (type_str != NULL) { - if (!vector_str_push(&subst_v, buf, - e_len + 11)) { + if (!VEC_PUSH_STR(&subst_v, buf)) { free(buf); goto clean; } @@ -907,10 +1109,10 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); - if (!cpp_demangle_push_str(ddata, "[]", 2)) + if (!DEM_PUSH_STR(ddata, "[]")) return (0); } else { if (ELFTC_ISDIGIT(*ddata->cur) != 0) { @@ -923,13 +1125,13 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat assert(num_len > 0); if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); - if (!cpp_demangle_push_str(ddata, "[", 1)) + if (!DEM_PUSH_STR(ddata, "[")) return (0); if (!cpp_demangle_push_str(ddata, num, num_len)) return (0); - if (!cpp_demangle_push_str(ddata, "]", 1)) + if (!DEM_PUSH_STR(ddata, "]")) return (0); } else { p_idx = ddata->output.size; @@ -953,11 +1155,11 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat free(exp); return (0); } - if (!cpp_demangle_read_type(ddata, 0)) { + if (!cpp_demangle_read_type(ddata, NULL)) { free(exp); return (0); } - if (!cpp_demangle_push_str(ddata, "[", 1)) { + if (!DEM_PUSH_STR(ddata, "[")) { free(exp); return (0); } @@ -965,7 +1167,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat free(exp); return (0); } - if (!cpp_demangle_push_str(ddata, "]", 1)) { + if (!DEM_PUSH_STR(ddata, "]")) { free(exp); return (0); } @@ -1001,10 +1203,10 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_dat switch (*(++ddata->cur)) { case '0': ddata->cur += 2; - return (cpp_demangle_push_str(ddata, "false", 5)); + return (DEM_PUSH_STR(ddata, "false")); case '1': ddata->cur += 2; - return (cpp_demangle_push_str(ddata, "true", 4)); + return (DEM_PUSH_STR(ddata, "true")); default: return (0); } @@ -1041,7 +1243,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_dat case 'x': case 'y': if (*(++ddata->cur) == 'n') { - if (!cpp_demangle_push_str(ddata, "-", 1)) + if (!DEM_PUSH_STR(ddata, "-")) return (0); ++ddata->cur; } @@ -1070,11 +1272,11 @@ cpp_demangle_read_expression(struct cpp_demangle_data switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { case SIMPLE_HASH('s', 't'): ddata->cur += 2; - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('s', 'r'): ddata->cur += 2; - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); if (!cpp_demangle_read_uqname(ddata)) return (0); @@ -1351,8 +1553,7 @@ cpp_demangle_read_expression_flat(struct cpp_demangle_ size_t i, p_idx, idx, exp_len; char *exp; - output = ddata->push_head > 0 ? &ddata->output_tmp : - &ddata->output; + output = &ddata->output; p_idx = output->size; @@ -1429,8 +1630,12 @@ static int cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c, struct vector_type_qualifier *v) { + struct type_delimit td; + struct read_cmd_item *rc; size_t class_type_size, class_type_len, limit; const char *class_type; + int i; + bool paren, non_cv_qualifier; if (ddata == NULL || *ddata->cur != 'F' || v == NULL) return (0); @@ -1441,12 +1646,43 @@ cpp_demangle_read_function(struct cpp_demangle_data *d *ext_c = 1; ++ddata->cur; } - if (!cpp_demangle_read_type(ddata, 0)) + + /* Return type */ + if (!cpp_demangle_read_type(ddata, NULL)) return (0); + if (*ddata->cur != 'E') { - if (!cpp_demangle_push_str(ddata, "(", 1)) + if (!DEM_PUSH_STR(ddata, " ")) return (0); - if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM)) { + + non_cv_qualifier = false; + if (v->size > 0) { + for (i = 0; (size_t) i < v->size; i++) { + if (v->q_container[i] != TYPE_RST && + v->q_container[i] != TYPE_VAT && + v->q_container[i] != TYPE_CST) { + non_cv_qualifier = true; + break; + } + } + } + + paren = false; + rc = vector_read_cmd_find(&ddata->cmd, READ_PTRMEM); + if (non_cv_qualifier || rc != NULL) { + if (!DEM_PUSH_STR(ddata, "(")) + return (0); + paren = true; + } + + /* Push non-cv qualifiers. */ + ddata->push_qualifier = PUSH_NON_CV_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, v, NULL)) + return (0); + + if (rc) { + if (non_cv_qualifier && !DEM_PUSH_STR(ddata, " ")) + return (0); if ((class_type_size = ddata->class_type.size) == 0) return (0); class_type = @@ -1458,42 +1694,69 @@ cpp_demangle_read_function(struct cpp_demangle_data *d if (!cpp_demangle_push_str(ddata, class_type, class_type_len)) return (0); - if (!cpp_demangle_push_str(ddata, "::*", 3)) + if (!DEM_PUSH_STR(ddata, "::*")) return (0); + /* Push pointer-to-member qualifiers. */ + ddata->push_qualifier = PUSH_ALL_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, rc->data, + NULL)) + return (0); ++ddata->func_type; - } else { - if (!cpp_demangle_push_type_qualifier(ddata, v, - (const char *) NULL)) + } + + if (paren) { + if (!DEM_PUSH_STR(ddata, ")")) return (0); - vector_type_qualifier_dest(v); - if (!vector_type_qualifier_init(v)) - return (0); + paren = false; } - if (!cpp_demangle_push_str(ddata, ")(", 2)) - return (0); - + td.paren = false; + td.firstp = true; limit = 0; + ddata->is_functype = true; for (;;) { - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, &td)) return (0); if (*ddata->cur == 'E') break; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) return (0); } - - if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM) == 1) { - if (!cpp_demangle_push_type_qualifier(ddata, v, - (const char *) NULL)) + ddata->is_functype = false; + if (td.paren) { + if (!DEM_PUSH_STR(ddata, ")")) return (0); - vector_type_qualifier_dest(v); - if (!vector_type_qualifier_init(v)) - return (0); + td.paren = false; } - if (!cpp_demangle_push_str(ddata, ")", 1)) + /* Push CV qualifiers. */ + ddata->push_qualifier = PUSH_CV_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, v, NULL)) return (0); + + ddata->push_qualifier = PUSH_ALL_QUALIFIER; + + /* Release type qualifier vector. */ + vector_type_qualifier_dest(v); + if (!vector_type_qualifier_init(v)) + return (0); + + /* Push ref-qualifiers. */ + if (ddata->ref_qualifier) { + switch (ddata->ref_qualifier_type) { + case TYPE_REF: + if (!DEM_PUSH_STR(ddata, " &")) + return (0); + break; + case TYPE_RREF: + if (!DEM_PUSH_STR(ddata, " &&")) + return (0); + break; + default: + return (0); + } + ddata->ref_qualifier = false; + } } ++ddata->cur; @@ -1515,7 +1778,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d /* special name */ switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { case SIMPLE_HASH('G', 'A'): - if (!cpp_demangle_push_str(ddata, "hidden alias for ", 17)) + if (!DEM_PUSH_STR(ddata, "hidden alias for ")) return (0); ddata->cur += 2; if (*ddata->cur == '\0') @@ -1523,7 +1786,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d return (cpp_demangle_read_encoding(ddata)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Wed Nov 4 11:23:20 2020 Return-Path: Delivered-To: svn-src-head@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 F0B30459907; Wed, 4 Nov 2020 11:23:20 +0000 (UTC) (envelope-from dim@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 4CR45h52N9z4c0y; Wed, 4 Nov 2020 11:23:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 901F5CEA2; Wed, 4 Nov 2020 11:23:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4BNKOC012582; Wed, 4 Nov 2020 11:23:20 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4BNKIr012581; Wed, 4 Nov 2020 11:23:20 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011041123.0A4BNKIr012581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Nov 2020 11:23:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367324 - in head/share: man/man5 mk X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/share: man/man5 mk X-SVN-Commit-Revision: 367324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 11:23:21 -0000 Author: dim Date: Wed Nov 4 11:23:19 2020 New Revision: 367324 URL: https://svnweb.freebsd.org/changeset/base/367324 Log: Turn on WITH_LLVM_CXXFILT by default LLVM's demangler supports more modern C++ constructs such as lambdas and unnamed types, and is actively maintained. The command line tool is usable as a drop-in replacement for GNU c++filt, or elftoolchain's cxxfilt. The latter is still available by using WITHOUT_LLVM_CXXFILT, if needed. PR: 250702 MFC after: 2 weeks Modified: head/share/man/man5/src.conf.5 head/share/mk/src.opts.mk Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Nov 4 11:13:36 2020 (r367323) +++ head/share/man/man5/src.conf.5 Wed Nov 4 11:23:19 2020 (r367324) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd November 3, 2020 +.Dd November 4, 2020 .Dt SRC.CONF 5 .Os .Sh NAME @@ -919,8 +919,8 @@ Set to disable debugging assertions in LLVM. Set to not build the .Xr llvm-cov 1 tool. -.It Va WITH_LLVM_CXXFILT -Install LLVM's llvm-cxxfilt as c++filt, instead of ELF Tool Chain's cxxfilt. +.It Va WITHOUT_LLVM_CXXFILT +Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Nov 4 11:13:36 2020 (r367323) +++ head/share/mk/src.opts.mk Wed Nov 4 11:23:19 2020 (r367324) @@ -135,6 +135,7 @@ __DEFAULT_YES_OPTIONS = \ LLD_IS_LD \ LLVM_ASSERTIONS \ LLVM_COV \ + LLVM_CXXFILT \ LLVM_TARGET_ALL \ LOADER_GELI \ LOADER_LUA \ @@ -210,7 +211,6 @@ __DEFAULT_NO_OPTIONS = \ GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ - LLVM_CXXFILT \ LOADER_FIREWIRE \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ From owner-svn-src-head@freebsd.org Wed Nov 4 11:48:09 2020 Return-Path: Delivered-To: svn-src-head@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 34776459F4F; Wed, 4 Nov 2020 11:48:09 +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 4CR4fK0f93z4cqC; Wed, 4 Nov 2020 11:48:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ED8C3D1C7; Wed, 4 Nov 2020 11:48:08 +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 0A4Bm8l2025122; Wed, 4 Nov 2020 11:48:08 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4Bm8xM025121; Wed, 4 Nov 2020 11:48:08 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202011041148.0A4Bm8xM025121@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 4 Nov 2020 11:48:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367325 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 367325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 11:48:09 -0000 Author: andrew Date: Wed Nov 4 11:48:08 2020 New Revision: 367325 URL: https://svnweb.freebsd.org/changeset/base/367325 Log: Add the pmap.h changes missed in r367320 Reported by: bz Sponsored by: Innovate UK Modified: head/sys/arm64/include/pmap.h Modified: head/sys/arm64/include/pmap.h ============================================================================== --- head/sys/arm64/include/pmap.h Wed Nov 4 11:23:19 2020 (r367324) +++ head/sys/arm64/include/pmap.h Wed Nov 4 11:48:08 2020 (r367325) @@ -85,6 +85,7 @@ enum pmap_stage { struct pmap { struct mtx pm_mtx; struct pmap_statistics pm_stats; /* pmap statistics */ + uint64_t pm_ttbr; vm_paddr_t pm_l0_paddr; pd_entry_t *pm_l0; TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */ @@ -92,6 +93,7 @@ struct pmap { long pm_cookie; /* encodes the pmap's ASID */ struct asid_set *pm_asid_set; /* The ASID/VMID set to use */ enum pmap_stage pm_stage; + int pm_levels; }; typedef struct pmap *pmap_t; @@ -170,7 +172,7 @@ void pmap_kremove(vm_offset_t); void pmap_kremove_device(vm_offset_t, vm_size_t); void *pmap_mapdev_attr(vm_offset_t pa, vm_size_t size, vm_memattr_t ma); bool pmap_page_is_mapped(vm_page_t m); -int pmap_pinit_stage(pmap_t, enum pmap_stage); +int pmap_pinit_stage(pmap_t, enum pmap_stage, int); bool pmap_ps_enabled(pmap_t pmap); uint64_t pmap_to_ttbr0(pmap_t pmap); From owner-svn-src-head@freebsd.org Wed Nov 4 12:07:34 2020 Return-Path: Delivered-To: svn-src-head@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 5209245B1D4; Wed, 4 Nov 2020 12:07:34 +0000 (UTC) (envelope-from bz@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 4CR54k0P0Wz4fPB; Wed, 4 Nov 2020 12:07:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 A572FD2B6; Wed, 4 Nov 2020 12:07:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4C7Xjl037213; Wed, 4 Nov 2020 12:07:33 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4C7Xfn037212; Wed, 4 Nov 2020 12:07:33 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011041207.0A4C7Xfn037212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 4 Nov 2020 12:07:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367326 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 367326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 12:07:34 -0000 Author: bz Date: Wed Nov 4 12:07:33 2020 New Revision: 367326 URL: https://svnweb.freebsd.org/changeset/base/367326 Log: net80211: fix a typo Correct a typo referring to the wrong flags in a comment. No functional changes. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Modified: head/sys/net80211/_ieee80211.h Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Wed Nov 4 11:48:08 2020 (r367325) +++ head/sys/net80211/_ieee80211.h Wed Nov 4 12:07:33 2020 (r367326) @@ -619,7 +619,7 @@ struct ieee80211_rx_stats { } evm; /* 32 bits */ - uint8_t c_phytype; /* PHY type, FW flags above */ + uint8_t c_phytype; /* PHY type, FP flags above */ uint8_t c_vhtnss; /* VHT - number of spatial streams */ uint8_t c_pad2[2]; }; From owner-svn-src-head@freebsd.org Wed Nov 4 12:10:06 2020 Return-Path: Delivered-To: svn-src-head@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 4A3E045B47B; Wed, 4 Nov 2020 12:10:06 +0000 (UTC) (envelope-from kp@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 4CR57d6yrvz4fW0; Wed, 4 Nov 2020 12:10:05 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id B9E631B82B; Wed, 4 Nov 2020 12:10:05 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 7F832500C0; Wed, 4 Nov 2020 13:10:03 +0100 (CET) From: "Kristof Provost" To: "Gordon Bergling" Cc: "Mateusz Piotrowski" <0mp@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367321 - head/sys/amd64/linux Date: Wed, 04 Nov 2020 13:09:59 +0100 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: <20201104104515.GA83813@lion.0xfce3.net> References: <202011041038.0A4AcPNn082013@repo.freebsd.org> <20201104104515.GA83813@lion.0xfce3.net> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 12:10:06 -0000 On 4 Nov 2020, at 11:45, Gordon Bergling wrote: > Shouldn't such a commit be approved by someone? > The committer=E2=80=99s guide seems clear that doc committers may fix = comments: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/com= mitter.types.html > doc committers may commit documentation changes to src files, such as = > man pages, READMEs, fortune databases, calendar files, and comment = > fixes without approval from a src committer, subject to the normal = > care and tending of commits. Arguably minor spelling fixes are not worth confusing the blame output = for, but this seems well within the established rules. > And why you just abandoned the differential [1]? > Probably because it timed out. The review had been pending since August. Arguably the differential link should have been included as well, but = it=E2=80=99s hardly important in this case. I don=E2=80=99t think we have= explicit = policies about this. We probably should. Best regards, Kristof From owner-svn-src-head@freebsd.org Wed Nov 4 12:11:51 2020 Return-Path: Delivered-To: svn-src-head@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 41B2945B570; Wed, 4 Nov 2020 12:11:51 +0000 (UTC) (envelope-from bz@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 4CR59g0pG7z4g2v; Wed, 4 Nov 2020 12:11:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 F2E99D26B; Wed, 4 Nov 2020 12:11:50 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4CBo71042862; Wed, 4 Nov 2020 12:11:50 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4CBotn042852; Wed, 4 Nov 2020 12:11:50 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011041211.0A4CBotn042852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 4 Nov 2020 12:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367327 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 367327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 12:11:51 -0000 Author: bz Date: Wed Nov 4 12:11:50 2020 New Revision: 367327 URL: https://svnweb.freebsd.org/changeset/base/367327 Log: arm64: implement bs_sr_ Implement the bs_sr_ generic functions based on the generic mips implementation calling the generic bs_w_ functions in a loop. ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4() is NULL. It seems ral(4) and ti(4) might be the only consumers of these functions I could find quickly so keeping them in C rather than asm. Reported by: Steve Wheeler (https://redmine.pfsense.org/issues/11021) Reviewed by: mmel MFC after: 3 days Modified: head/sys/arm64/arm64/bus_machdep.c Modified: head/sys/arm64/arm64/bus_machdep.c ============================================================================== --- head/sys/arm64/arm64/bus_machdep.c Wed Nov 4 12:07:33 2020 (r367326) +++ head/sys/arm64/arm64/bus_machdep.c Wed Nov 4 12:11:50 2020 (r367327) @@ -128,6 +128,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, return (0); } +/* + * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described + * by tag/handle starting at `offset'. + */ +static void +generic_bs_sr_1(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint8_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr++) + generic_bs_w_1(t, bsh, addr, value); +} + +static void +generic_bs_sr_2(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint16_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 2) + generic_bs_w_2(t, bsh, addr, value); +} + +static void +generic_bs_sr_4(void *t, bus_space_handle_t bsh, + bus_size_t offset, uint32_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 4) + generic_bs_w_4(t, bsh, addr, value); +} + +static void +generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset, + uint64_t value, size_t count) +{ + bus_addr_t addr = bsh + offset; + + for (; count != 0; count--, addr += 8) + generic_bs_w_8(t, bsh, addr, value); +} + struct bus_space memmap_bus = { /* cookie */ .bs_cookie = NULL, @@ -187,10 +231,10 @@ struct bus_space memmap_bus = { .bs_sm_8 = NULL, /* set region */ - .bs_sr_1 = NULL, - .bs_sr_2 = NULL, - .bs_sr_4 = NULL, - .bs_sr_8 = NULL, + .bs_sr_1 = generic_bs_sr_1, + .bs_sr_2 = generic_bs_sr_2, + .bs_sr_4 = generic_bs_sr_4, + .bs_sr_8 = generic_bs_sr_8, /* copy */ .bs_c_1 = NULL, From owner-svn-src-head@freebsd.org Wed Nov 4 13:43:35 2020 Return-Path: Delivered-To: svn-src-head@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 556A545D2B3; Wed, 4 Nov 2020 13:43:35 +0000 (UTC) (envelope-from manu@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 4CR7CW1MKMz3Wdr; Wed, 4 Nov 2020 13:43:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12DBEE170; Wed, 4 Nov 2020 13:43:35 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4DhYGM098036; Wed, 4 Nov 2020 13:43:34 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4DhYvo098035; Wed, 4 Nov 2020 13:43:34 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011041343.0A4DhYvo098035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 4 Nov 2020 13:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367328 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 367328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 13:43:35 -0000 Author: manu Date: Wed Nov 4 13:43:34 2020 New Revision: 367328 URL: https://svnweb.freebsd.org/changeset/base/367328 Log: acpi_video(4): mention that acpi_video should be loaded after any drm driver When not adhering to this order, brightness sysctl's do not show up on some laptop. Submitted by: driesm.michiels@gmail.com Reviewed by: uqs Differential Revision: https://reviews.freebsd.org/D26073 Modified: head/share/man/man4/acpi_video.4 Modified: head/share/man/man4/acpi_video.4 ============================================================================== --- head/share/man/man4/acpi_video.4 Wed Nov 4 12:11:50 2020 (r367327) +++ head/share/man/man4/acpi_video.4 Wed Nov 4 13:43:34 2020 (r367328) @@ -63,6 +63,15 @@ Preset brightness level to be used in economy mode. Defaults for these variables can be set in .Xr sysctl.conf 5 , which is parsed at boot-time. +.Sh COMPATIBILITY +In order for +.Nm +to attach correctly, +.Nm +should be loaded after any of the DRM kernel modules. +This can be achieved by setting the correct order in +.Xr rc.conf 5 +using the kld_list directive. .Sh SEE ALSO .Xr acpi 4 , .Xr loader.conf 5 , From owner-svn-src-head@freebsd.org Wed Nov 4 14:17:18 2020 Return-Path: Delivered-To: svn-src-head@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 663C845DDB6; Wed, 4 Nov 2020 14:17:18 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) (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 4CR7yP1MsBz3YWc; Wed, 4 Nov 2020 14:17:16 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ej1-f54.google.com with SMTP id o21so22942861ejb.3; Wed, 04 Nov 2020 06:17:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=fMoy1WW6PF86lkZPEO+J2EDbWaLovqCewxgZgXJZRfw=; b=bgElPdwe4Xx+5j91c/8pWOEy9+CZ3oTdLMUpGe9DESByqTlLa/6rhNzYqHNf8is1bi bCdry0sra9ZdT0dK0j7wqDNeo3xkQx8OAxsCnaeP8qRNN/cd50VNFjdwhDltxp6PAyq7 +B44759DBq3vcYjBS7/bhyIcsW1Jjxz1Cv8dZedyL8jAOrhStA+Q8u71f+gukMH6ip7q 6ZE/nMbKWQXx16WxqXMoCFIRmmCQTJbIf2Q6g86UOfPDM4Sp3+PW7OQqICNz8nXeysMv N9u9GEn/U9gKOlugb1+dTWHFafBjUC1jj+ObwxxnL+ZgBQFXgKiJpcC/Fo1fDwO/BsSS dRaA== X-Gm-Message-State: AOAM533btBXde+Ej87jFUcP3SbC2WTrqbhsATP4klajsf+kon5LsmZW+ noZRThNJ6UtsErXauXjPCU6iDAnsWxgPBQ== X-Google-Smtp-Source: ABdhPJyFvk4dJngRCpmtkO99a2C/bixs7xltKl/tHwrmjMOjmo2zxr/A5OJMEAxF/eFZC5ARP9rsIA== X-Received: by 2002:a17:906:6d0c:: with SMTP id m12mr25277785ejr.498.1604499434973; Wed, 04 Nov 2020 06:17:14 -0800 (PST) Received: from ?IPv6:2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8? ([2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8]) by smtp.gmail.com with ESMTPSA id z18sm1065492ejf.41.2020.11.04.06.17.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 06:17:14 -0800 (PST) Subject: Re: svn commit: r367321 - head/sys/amd64/linux To: Kristof Provost , Gordon Bergling Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011041038.0A4AcPNn082013@repo.freebsd.org> <20201104104515.GA83813@lion.0xfce3.net> From: Mateusz Piotrowski <0mp@FreeBSD.org> Message-ID: Date: Wed, 4 Nov 2020 15:17:17 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 4CR7yP1MsBz3YWc X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mpp302@gmail.com designates 209.85.218.54 as permitted sender) smtp.mailfrom=mpp302@gmail.com X-Spamd-Result: default: False [-2.35 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; RWL_MAILSPIKE_GOOD(0.00)[209.85.218.54:from]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.03)[-1.028]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-1.01)[-1.009]; NEURAL_HAM_SHORT(-0.31)[-0.314]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.54:from]; FORGED_SENDER(0.30)[0mp@FreeBSD.org,mpp302@gmail.com]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[0mp@FreeBSD.org,mpp302@gmail.com]; MAILMAN_DEST(0.00)[svn-src-head,svn-src-all] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 14:17:18 -0000 Hi! On 11/4/20 1:09 PM, Kristof Provost wrote: > On 4 Nov 2020, at 11:45, Gordon Bergling wrote: >> Shouldn't such a commit be approved by someone? >> > The committer’s guide seems clear that doc committers may fix comments: > > https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/committer.types.html > >> doc committers may commit documentation changes to src files, such as man pages, READMEs, fortune >> databases, calendar files, and comment fixes without approval from a src committer, subject to >> the normal care and tending of commits. > > Arguably minor spelling fixes are not worth confusing the blame output for, but this seems well > within the established rules. +1 BTW, I've another similar patch pending (this time for pmcstat) if some src committer could take a look: https://reviews.freebsd.org/D26082. > >> And why you just abandoned the differential [1]? >> > Probably because it timed out. The review had been pending since August. > Arguably the differential link should have been included as well, but it’s hardly important in > this case. I don’t think we have explicit policies about this. We probably should. I forgot to link to the review on Phabricator. I didn't follow up with an email as it didn't seem important enough to show up in everyone's mailbox. Cheers! Mateusz From owner-svn-src-head@freebsd.org Wed Nov 4 14:31:53 2020 Return-Path: Delivered-To: svn-src-head@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 9976145E4A9; Wed, 4 Nov 2020 14:31:53 +0000 (UTC) (envelope-from arichardson@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 4CR8HF3dGCz3ZNy; Wed, 4 Nov 2020 14:31:53 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 5FE14F20F; Wed, 4 Nov 2020 14:31:53 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4EVrWX029128; Wed, 4 Nov 2020 14:31:53 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4EVrlA029127; Wed, 4 Nov 2020 14:31:53 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202011041431.0A4EVrlA029127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Wed, 4 Nov 2020 14:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367331 - head/usr.sbin/jls X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/usr.sbin/jls X-SVN-Commit-Revision: 367331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 14:31:53 -0000 Author: arichardson Date: Wed Nov 4 14:31:52 2020 New Revision: 367331 URL: https://svnweb.freebsd.org/changeset/base/367331 Log: Fix bad libbxo format strings in jls The existing format string for the empty case was trying to read varargs values that weren't passed to xo_emit. This appears to work on x86 (since the next argument is probably a pointer an empty string), but for CHERI we can bound variadic arguments and detect a read past the end. While touching these lines also use the libxo 'a' modifier to avoid having to construct the libxo format string using asprintf. Found by: CHERI Reviewed By: allanjude Differential Revision: https://reviews.freebsd.org/D26885 Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c ============================================================================== --- head/usr.sbin/jls/jls.c Wed Nov 4 14:13:29 2020 (r367330) +++ head/usr.sbin/jls/jls.c Wed Nov 4 14:31:52 2020 (r367331) @@ -505,17 +505,13 @@ quoted_print(int pflags, char *name, char *value) { int qc; char *p = value; - char *param_name_value; /* An empty string needs quoting. */ if (!*p) { - asprintf(¶m_name_value, "{k:%s}{d:%s/\"\"}", name, name); - xo_emit(param_name_value); - free(param_name_value); + xo_emit("{ea:/%s}{da:/\"\"}", name, value, name); return; } - asprintf(¶m_name_value, "{:%s/%%s}", name); /* * The value will be surrounded by quotes if it contains spaces * or quotes. @@ -528,9 +524,7 @@ quoted_print(int pflags, char *name, char *value) if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); - xo_emit(param_name_value, value); - - free(param_name_value); + xo_emit("{a:/%s}", name, value); if (qc && pflags & PRINT_QUOTED) xo_emit("{P:/%c}", qc); From owner-svn-src-head@freebsd.org Wed Nov 4 15:32:04 2020 Return-Path: Delivered-To: svn-src-head@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 3675E45FCFC; Wed, 4 Nov 2020 15:32:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (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 4CR9cg6RFXz3dpc; Wed, 4 Nov 2020 15:32:03 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f52.google.com with SMTP id p7so22625549ioo.6; Wed, 04 Nov 2020 07:32:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Kec1rwm/YIGVf6xaanRZyP4Hr/iu2yGoYQBQuS1jUP8=; b=H0oV9G21U4MGbXqqSGMXnAc1bA7Q75Pkfsyr3owNxNAWUl7do/uOu9EVC8zzDg6G+U BCPGWpwLyVg+H9RsVcqBQZ5JdVtX/DBZNySX+MnFC2iG3XOh+VDXp2yzEqfgJHP1uNEd T7cBJ+8w9MCMhpRfnUSwPh/XEh2A/FogLVaU8+iVPQYuCZKLZtEhN4VP0F7kAer77kek dGUSOXWqsI0nnhMkIaO1y67viJyWwHGnwTxMsR1XfxFTsa358FvR4GfnrAe/cjXe2t1Z x96Ytgp4pneRkR6Rz9H9WemdCYqF5VOVkhnTsjeLFzQVRI93fGZKq9o07hfXprlD1xoW vWbQ== X-Gm-Message-State: AOAM530Pn9N3CCy0HJDneCe3t8E/AVIBjZhz/CCAHPXSuz6suLSqbYpm s+lyqiSTmx/VR53IsyJmaJbrvFh6a+SPIPcST+xxYDd6 X-Google-Smtp-Source: ABdhPJy3nR/dua5mFWC/gUXHOM/6XRI4jw4hz4QHbz3AG5VZ1WdHbQKSgSbuIhew6hxwtg1IkYkWGRmtXkLoftP05Wo= X-Received: by 2002:a05:6638:1181:: with SMTP id f1mr10663050jas.106.1604503922501; Wed, 04 Nov 2020 07:32:02 -0800 (PST) MIME-Version: 1.0 References: <202011041038.0A4AcPNn082013@repo.freebsd.org> <20201104104515.GA83813@lion.0xfce3.net> In-Reply-To: From: Ed Maste Date: Wed, 4 Nov 2020 10:31:50 -0500 Message-ID: Subject: Re: svn commit: r367321 - head/sys/amd64/linux To: Kristof Provost Cc: Gordon Bergling , Mateusz Piotrowski <0mp@freebsd.org>, src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4CR9cg6RFXz3dpc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 15:32:04 -0000 On Wed, 4 Nov 2020 at 07:10, Kristof Provost wrote: > > > And why you just abandoned the differential [1]? > > > Probably because it timed out. The review had been pending since August. > Arguably the differential link should have been included as well, but > it=E2=80=99s hardly important in this case. I don=E2=80=99t think we have= explicit > policies about this. We probably should. Yes, it's still worth including the phab URL so that it closes automatically and so that others can see how long it was open for. I take no issue with the change itself. From owner-svn-src-head@freebsd.org Wed Nov 4 15:45:00 2020 Return-Path: Delivered-To: svn-src-head@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 63BA7460369; Wed, 4 Nov 2020 15:45: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 4CR9vc20W2z3fsc; Wed, 4 Nov 2020 15:45: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 2941CFC72; Wed, 4 Nov 2020 15:45: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 0A4FixY7073962; Wed, 4 Nov 2020 15:44:59 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4FixmW073961; Wed, 4 Nov 2020 15:44:59 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011041544.0A4FixmW073961@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: Wed, 4 Nov 2020 15:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367332 - head/usr.sbin/pmcstat X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/usr.sbin/pmcstat X-SVN-Commit-Revision: 367332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 15:45:00 -0000 Author: 0mp (doc,ports committer) Date: Wed Nov 4 15:44:59 2020 New Revision: 367332 URL: https://svnweb.freebsd.org/changeset/base/367332 Log: pmcstat: Fix a typo in the usage message Reviewed by: emaste Approved by: emaste Differential Revision: https://reviews.freebsd.org/D26082 Modified: head/usr.sbin/pmcstat/pmcstat.c Modified: head/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- head/usr.sbin/pmcstat/pmcstat.c Wed Nov 4 14:31:52 2020 (r367331) +++ head/usr.sbin/pmcstat/pmcstat.c Wed Nov 4 15:44:59 2020 (r367332) @@ -374,7 +374,7 @@ pmcstat_show_usage(void) "\t -R file\t read events from \"file\"\n" "\t -S spec\t allocate a system-wide sampling PMC\n" "\t -T\t\t start in top mode\n" - "\t -U \t\n merged user kernel stack capture\n" + "\t -U \t\t merged user kernel stack capture\n" "\t -W\t\t (toggle) show counts per context switch\n" "\t -a file\t print sampled PCs and callgraph to \"file\"\n" "\t -c cpu-list\t set cpus for subsequent system-wide PMCs\n" From owner-svn-src-head@freebsd.org Wed Nov 4 16:27:04 2020 Return-Path: Delivered-To: svn-src-head@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 D74A5461010; Wed, 4 Nov 2020 16:27:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f182.google.com (mail-il1-f182.google.com [209.85.166.182]) (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 4CRBr83jSbz3yCc; Wed, 4 Nov 2020 16:27:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f182.google.com with SMTP id e16so5507410ile.0; Wed, 04 Nov 2020 08:27:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DlyaYi9G5iLv29pGkbW0EnxAuSioCihwiima4WPz85w=; b=ZQSYswL5eyG5OfAjMfp+Kio4JRLvYaT8Uvzc0US7WVGsO/KzUvz3Wx6f2JoYby9qek epHSyD/FPa7SgMPN1q36SBRj9cZvq6l2Mr4uzNvg3g0FdTJWh4i3NiG4ptYwF6qijzaC 3NxbPoIjhqzmuBDYi381bZT9qyzx1nyb0r82rkWec2jFQwGWgBwpjLMVqp/hKemjJckK +llI5yCE6XEdTB3DyLk/ZEWBvG/B8QTSDBVT3+lPuGdkS3v5Nocv0yM7MxqfQHBcRFFT l10SOhQq0HJt3Y8XVkqYhPwozgvM+kbyY5reByZq8K5Vw3W+foVnYxjcXxx2W4gJV2DF IkLw== X-Gm-Message-State: AOAM530gyrWLjb+CQUanSvfFnOMk1cXYytidKmK7+cfmaBtYf4kpClAx YTnL/vQPd/Nn9OAjnLhY6itPvGBiw3Qou1953gja9XmSXJk= X-Google-Smtp-Source: ABdhPJw2OxUg5gYoE/xuh8k22jw5Vip073SjmmDW2PMAFA8iyiV533l5r23WVLuw6TXwsBDUvGMqGshtByeh10ne01A= X-Received: by 2002:a92:c5a1:: with SMTP id r1mr18435846ilt.11.1604507222894; Wed, 04 Nov 2020 08:27:02 -0800 (PST) MIME-Version: 1.0 References: <202011031957.0A3JvSJ4038311@repo.freebsd.org> In-Reply-To: <202011031957.0A3JvSJ4038311@repo.freebsd.org> From: Ed Maste Date: Wed, 4 Nov 2020 11:26:51 -0500 Message-ID: Subject: Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt To: Dimitry Andric Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CRBr83jSbz3yCc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 16:27:04 -0000 On Tue, 3 Nov 2020 at 14:57, Dimitry Andric wrote: > > Author: dim > Date: Tue Nov 3 19:57:28 2020 > New Revision: 367304 > URL: https://svnweb.freebsd.org/changeset/base/367304 > > Log: > Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt A previous argument against the LLVM versions of binutils replacements is that they were excessively large, but this does not look like a substantial problem here. LLVM's cxxfilt is indeed many times the size of ELF Tool Chain's, but still small enough that for a tool chain component it's not a concern, in my opinion. ELF Tool Chain: $ size obj/c++filt text data bss dec hex filename 66966 1008 8400 76374 0x12a56 obj/c++filt LLVM: $ size obj/llvm-cxxfilt text data bss dec hex filename 378138 1756 9165 389059 0x5efc3 obj/llvm-cxxfilt A remaining issue is that both nm and addr2line can also demangle C++ symbols. From owner-svn-src-head@freebsd.org Wed Nov 4 16:30:31 2020 Return-Path: Delivered-To: svn-src-head@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 71ED2460ECD; Wed, 4 Nov 2020 16:30:31 +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 4CRBw72Ll7z3yRk; Wed, 4 Nov 2020 16:30:31 +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 307771080C; Wed, 4 Nov 2020 16:30:31 +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 0A4GUVMI099057; Wed, 4 Nov 2020 16:30:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4GUUxL099055; Wed, 4 Nov 2020 16:30:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011041630.0A4GUUxL099055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 4 Nov 2020 16:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367333 - in head: share/man/man9 sys/sys X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man9 sys/sys X-SVN-Commit-Revision: 367333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 16:30:31 -0000 Author: markj Date: Wed Nov 4 16:30:30 2020 New Revision: 367333 URL: https://svnweb.freebsd.org/changeset/base/367333 Log: refcount(9): Add refcount_release_if_last() and refcount_load() The former is intended for use in vmspace_exit(). The latter is to encourage use of explicit loads rather than relying on the volatile qualifier. This works better with kernel sanitizers, which can intercept atomic(9) calls, and makes tricky lockless code easier to read by not forcing the reader to remember which variables are declared volatile. Reviewed by: kib, mjg, mmel MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27056 Modified: head/share/man/man9/refcount.9 head/sys/sys/refcount.h Modified: head/share/man/man9/refcount.9 ============================================================================== --- head/share/man/man9/refcount.9 Wed Nov 4 15:44:59 2020 (r367332) +++ head/share/man/man9/refcount.9 Wed Nov 4 16:30:30 2020 (r367333) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2019 +.Dd November 2, 2020 .Dt REFCOUNT 9 .Os .Sh NAME @@ -46,6 +46,8 @@ .In sys/refcount.h .Ft void .Fn refcount_init "volatile u_int *count" "u_int value" +.Ft u_int +.Fn refcount_load "volatile u_int *count" .Ft void .Fn refcount_acquire "volatile u_int *count" .Ft bool @@ -55,6 +57,8 @@ .Ft bool .Fn refcount_release "volatile u_int *count" .Ft bool +.Fn refcount_release_if_last "volatile u_int *count" +.Ft bool .Fn refcount_release_if_not_last "volatile u_int *count" .Sh DESCRIPTION The @@ -75,6 +79,16 @@ function is used to set the initial value of the count It is normally used when creating a reference-counted object. .Pp The +.Fn refcount_load +function returns a snapshot of the counter value. +This value may immediately become out-of-date in the absence of external +synchronization. +.Fn refcount_load +should be used instead of relying on the properties of the +.Vt volatile +qualifier. +.Pp +The .Fn refcount_acquire function is used to acquire a new reference. The caller is responsible for ensuring that it holds a valid reference @@ -119,16 +133,33 @@ the last reference; otherwise, it returns false. .Pp The +.Fn refcount_release_if_last +and .Fn refcount_release_if_not_last -is a variant of +functions are variants of .Fn refcount_release -which only drops the reference when it is not the last reference. -In other words, the function returns +which only drop the reference when it is or is not the last reference, +respectively. +In other words, +.Fn refcount_release_if_last +returns .Dv true when .Fa *count +is equal to one, in which case it is decremented to zero. +Otherwise, +.Fa *count +is not modified and the function returns +.Dv false . +Similarly, +.Fn refcount_release_if_not_last +returns +.Dv true +when +.Fa *count is greater than one, in which case -.Fa *count is decremented. +.Fa *count +is decremented. Otherwise, if .Fa *count is equal to one, the reference is not released and the function returns Modified: head/sys/sys/refcount.h ============================================================================== --- head/sys/sys/refcount.h Wed Nov 4 15:44:59 2020 (r367332) +++ head/sys/sys/refcount.h Wed Nov 4 16:30:30 2020 (r367333) @@ -67,6 +67,12 @@ refcount_init(volatile u_int *count, u_int value) } static __inline u_int +refcount_load(volatile u_int *count) +{ + return (atomic_load_int(count)); +} + +static __inline u_int refcount_acquire(volatile u_int *count) { u_int old; @@ -168,32 +174,50 @@ refcount_release(volatile u_int *count) return (refcount_releasen(count, 1)); } +#define _refcount_release_if_cond(cond, name) \ +static __inline __result_use_check bool \ +_refcount_release_if_##name(volatile u_int *count, u_int n) \ +{ \ + u_int old; \ + \ + KASSERT(n > 0, ("%s: zero increment", __func__)); \ + old = atomic_load_int(count); \ + for (;;) { \ + if (!(cond)) \ + return (false); \ + if (__predict_false(REFCOUNT_SATURATED(old))) \ + return (false); \ + if (atomic_fcmpset_rel_int(count, &old, old - 1)) \ + return (true); \ + } \ +} +_refcount_release_if_cond(old > n, gt) +_refcount_release_if_cond(old == n, eq) + static __inline __result_use_check bool refcount_release_if_gt(volatile u_int *count, u_int n) { - u_int old; - KASSERT(n > 0, - ("refcount_release_if_gt: Use refcount_release for final ref")); - old = atomic_load_int(count); - for (;;) { - if (old <= n) - return (false); - if (__predict_false(REFCOUNT_SATURATED(old))) - return (true); - /* - * Paired with acquire fence in refcount_releasen(). - */ - if (atomic_fcmpset_rel_int(count, &old, old - 1)) - return (true); + return (_refcount_release_if_gt(count, n)); +} + +static __inline __result_use_check bool +refcount_release_if_last(volatile u_int *count) +{ + + if (_refcount_release_if_eq(count, 1)) { + /* See the comment in refcount_releasen(). */ + atomic_thread_fence_acq(); + return (true); } + return (false); } static __inline __result_use_check bool refcount_release_if_not_last(volatile u_int *count) { - return (refcount_release_if_gt(count, 1)); + return (_refcount_release_if_gt(count, 1)); } #endif /* !__SYS_REFCOUNT_H__ */ From owner-svn-src-head@freebsd.org Wed Nov 4 16:30:58 2020 Return-Path: Delivered-To: svn-src-head@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 74369460FA9; Wed, 4 Nov 2020 16:30: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 4CRBwf2XSdz3ySY; Wed, 4 Nov 2020 16:30: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 3A2D710810; Wed, 4 Nov 2020 16:30: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 0A4GUwAq099830; Wed, 4 Nov 2020 16:30:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4GUud4099822; Wed, 4 Nov 2020 16:30:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011041630.0A4GUud4099822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 4 Nov 2020 16:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367334 - in head/sys: dev/cxgbe/tom kern vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: dev/cxgbe/tom kern vm X-SVN-Commit-Revision: 367334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 16:30:58 -0000 Author: markj Date: Wed Nov 4 16:30:56 2020 New Revision: 367334 URL: https://svnweb.freebsd.org/changeset/base/367334 Log: vmspace: Convert to refcount(9) This is mostly mechanical except for vmspace_exit(). There, use the new refcount_release_if_last() to avoid switching to vmspace0 unless other processes are sharing the vmspace. In that case, upon switching to vmspace0 we can unconditionally release the reference. Remove the volatile qualifier from vm_refcnt now that accesses are protected using refcount(9) KPIs. Reviewed by: alc, kib, mmel MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27057 Modified: head/sys/dev/cxgbe/tom/t4_ddp.c head/sys/kern/init_main.c head/sys/kern/kern_exec.c head/sys/kern/vfs_aio.c head/sys/vm/vm_glue.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/dev/cxgbe/tom/t4_ddp.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_ddp.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/dev/cxgbe/tom/t4_ddp.c Wed Nov 4 16:30:56 2020 (r367334) @@ -1347,7 +1347,7 @@ hold_aio(struct toepcb *toep, struct kaiocb *job, stru ps->offset = pgoff; ps->len = job->uaiocb.aio_nbytes; - atomic_add_int(&vm->vm_refcnt, 1); + refcount_acquire(&vm->vm_refcnt); ps->vm = vm; ps->start = start; Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/kern/init_main.c Wed Nov 4 16:30:56 2020 (r367334) @@ -591,7 +591,7 @@ proc0_init(void *dummy __unused) /* Allocate a prototype map so we have something to fork. */ p->p_vmspace = &vmspace0; - vmspace0.vm_refcnt = 1; + refcount_init(&vmspace0.vm_refcnt, 1); pmap_pinit0(vmspace_pmap(&vmspace0)); /* Modified: head/sys/kern/kern_exec.c ============================================================================== --- head/sys/kern/kern_exec.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/kern/kern_exec.c Wed Nov 4 16:30:56 2020 (r367334) @@ -1060,7 +1060,8 @@ exec_new_vmspace(struct image_params *imgp, struct sys sv_minuser = sv->sv_minuser; else sv_minuser = MAX(sv->sv_minuser, PAGE_SIZE); - if (vmspace->vm_refcnt == 1 && vm_map_min(map) == sv_minuser && + if (refcount_load(&vmspace->vm_refcnt) == 1 && + vm_map_min(map) == sv_minuser && vm_map_max(map) == sv->sv_maxuser && cpu_exec_vmspace_reuse(p, map)) { shmexit(vmspace); Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/kern/vfs_aio.c Wed Nov 4 16:30:56 2020 (r367334) @@ -1159,8 +1159,9 @@ aio_daemon(void *_id) KASSERT(p->p_vmspace == myvm, ("AIOD: bad vmspace for exiting daemon")); - KASSERT(myvm->vm_refcnt > 1, - ("AIOD: bad vm refcnt for exiting daemon: %d", myvm->vm_refcnt)); + KASSERT(refcount_load(&myvm->vm_refcnt) > 1, + ("AIOD: bad vm refcnt for exiting daemon: %d", + refcount_load(&myvm->vm_refcnt))); kproc_exit(0); } Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/vm/vm_glue.c Wed Nov 4 16:30:56 2020 (r367334) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -549,7 +550,7 @@ vm_forkproc(struct thread *td, struct proc *p2, struct * COW locally. */ if ((flags & RFMEM) == 0) { - if (p1->p_vmspace->vm_refcnt > 1) { + if (refcount_load(&p1->p_vmspace->vm_refcnt) > 1) { error = vmspace_unshare(p1); if (error) return (error); @@ -561,7 +562,7 @@ vm_forkproc(struct thread *td, struct proc *p2, struct if (flags & RFMEM) { p2->p_vmspace = p1->p_vmspace; - atomic_add_int(&p1->p_vmspace->vm_refcnt, 1); + refcount_acquire(&p1->p_vmspace->vm_refcnt); } dset = td2->td_domain.dr_policy; while (vm_page_count_severe_set(&dset->ds_mask)) { Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/vm/vm_map.c Wed Nov 4 16:30:56 2020 (r367334) @@ -257,7 +257,7 @@ vmspace_alloc(vm_offset_t min, vm_offset_t max, pmap_p } CTR1(KTR_VM, "vmspace_alloc: %p", vm); _vm_map_init(&vm->vm_map, vmspace_pmap(vm), min, max); - vm->vm_refcnt = 1; + refcount_init(&vm->vm_refcnt, 1); vm->vm_shm = NULL; vm->vm_swrss = 0; vm->vm_tsize = 0; @@ -316,10 +316,7 @@ vmspace_free(struct vmspace *vm) WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "vmspace_free() called"); - if (vm->vm_refcnt == 0) - panic("vmspace_free: attempt to free already freed vmspace"); - - if (atomic_fetchadd_int(&vm->vm_refcnt, -1) == 1) + if (refcount_release(&vm->vm_refcnt)) vmspace_dofree(vm); } @@ -339,45 +336,42 @@ vmspace_exitfree(struct proc *p) void vmspace_exit(struct thread *td) { - int refcnt; struct vmspace *vm; struct proc *p; + bool released; - /* - * Release user portion of address space. - * This releases references to vnodes, - * which could cause I/O if the file has been unlinked. - * Need to do this early enough that we can still sleep. - * - * The last exiting process to reach this point releases as - * much of the environment as it can. vmspace_dofree() is the - * slower fallback in case another process had a temporary - * reference to the vmspace. - */ - p = td->td_proc; vm = p->p_vmspace; - atomic_add_int(&vmspace0.vm_refcnt, 1); - refcnt = vm->vm_refcnt; - do { - if (refcnt > 1 && p->p_vmspace != &vmspace0) { - /* Switch now since other proc might free vmspace */ + + /* + * Prepare to release the vmspace reference. The thread that releases + * the last reference is responsible for tearing down the vmspace. + * However, threads not releasing the final reference must switch to the + * kernel's vmspace0 before the decrement so that the subsequent pmap + * deactivation does not modify a freed vmspace. + */ + refcount_acquire(&vmspace0.vm_refcnt); + if (!(released = refcount_release_if_last(&vm->vm_refcnt))) { + if (p->p_vmspace != &vmspace0) { PROC_VMSPACE_LOCK(p); p->p_vmspace = &vmspace0; PROC_VMSPACE_UNLOCK(p); pmap_activate(td); } - } while (!atomic_fcmpset_int(&vm->vm_refcnt, &refcnt, refcnt - 1)); - if (refcnt == 1) { + released = refcount_release(&vm->vm_refcnt); + } + if (released) { + /* + * pmap_remove_pages() expects the pmap to be active, so switch + * back first if necessary. + */ if (p->p_vmspace != vm) { - /* vmspace not yet freed, switch back */ PROC_VMSPACE_LOCK(p); p->p_vmspace = vm; PROC_VMSPACE_UNLOCK(p); pmap_activate(td); } pmap_remove_pages(vmspace_pmap(vm)); - /* Switch now since this proc will free vmspace */ PROC_VMSPACE_LOCK(p); p->p_vmspace = &vmspace0; PROC_VMSPACE_UNLOCK(p); @@ -396,21 +390,13 @@ struct vmspace * vmspace_acquire_ref(struct proc *p) { struct vmspace *vm; - int refcnt; PROC_VMSPACE_LOCK(p); vm = p->p_vmspace; - if (vm == NULL) { + if (vm == NULL || !refcount_acquire_if_not_zero(&vm->vm_refcnt)) { PROC_VMSPACE_UNLOCK(p); return (NULL); } - refcnt = vm->vm_refcnt; - do { - if (refcnt <= 0) { /* Avoid 0->1 transition */ - PROC_VMSPACE_UNLOCK(p); - return (NULL); - } - } while (!atomic_fcmpset_int(&vm->vm_refcnt, &refcnt, refcnt + 1)); if (vm != p->p_vmspace) { PROC_VMSPACE_UNLOCK(p); vmspace_free(vm); @@ -442,7 +428,7 @@ vmspace_switch_aio(struct vmspace *newvm) /* XXX: Need some way to assert that this is an aio daemon. */ - KASSERT(newvm->vm_refcnt > 0, + KASSERT(refcount_load(&newvm->vm_refcnt) > 0, ("vmspace_switch_aio: newvm unreferenced")); oldvm = curproc->p_vmspace; @@ -453,7 +439,7 @@ vmspace_switch_aio(struct vmspace *newvm) * Point to the new address space and refer to it. */ curproc->p_vmspace = newvm; - atomic_add_int(&newvm->vm_refcnt, 1); + refcount_acquire(&newvm->vm_refcnt); /* Activate the new mapping. */ pmap_activate(curthread); @@ -4777,7 +4763,7 @@ vmspace_unshare(struct proc *p) struct vmspace *newvmspace; vm_ooffset_t fork_charge; - if (oldvmspace->vm_refcnt == 1) + if (refcount_load(&oldvmspace->vm_refcnt) == 1) return (0); fork_charge = 0; newvmspace = vmspace_fork(oldvmspace, &fork_charge); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Wed Nov 4 16:30:30 2020 (r367333) +++ head/sys/vm/vm_map.h Wed Nov 4 16:30:56 2020 (r367334) @@ -291,7 +291,7 @@ struct vmspace { caddr_t vm_taddr; /* (c) user virtual address of text */ caddr_t vm_daddr; /* (c) user virtual address of data */ caddr_t vm_maxsaddr; /* user VA at max stack growth */ - volatile int vm_refcnt; /* number of references */ + u_int vm_refcnt; /* number of references */ /* * Keep the PMAP last, so that CPU-specific variations of that * structure on a single architecture don't result in offset From owner-svn-src-head@freebsd.org Wed Nov 4 16:38:16 2020 Return-Path: Delivered-To: svn-src-head@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 1DAD04613CE for ; Wed, 4 Nov 2020 16:38:16 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) (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 4CRC532sq4z40Pm for ; Wed, 4 Nov 2020 16:38:15 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x733.google.com with SMTP id k9so19855932qki.6 for ; Wed, 04 Nov 2020 08:38:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=mPjs9xnHXg0UaBCdzQ8LG1BvsyLjigHMqfclvigoABU=; b=Wr/GGJCR3zGkNxCOFJWWCl4JrR5N2YbapVAg/g5/H5o+OlraCMsT+5/kmKaMu5xxS4 gjoYd16V8FLkTOVFagXmVZ+GOsW8TWed34zGCCPHdN7ptKqtVe6+20wQMaVu+5J5fkWL qh3MX1OIEQ07Fm+rMrirb3U+iOrDvNgfCfaDYtOSqMLoqDzP3V93aGPUMOku1jZDt9oB pXoEqe0iL8wy0/JnVfpMEnE/eEEzI8ZT8e1HXQLkIeqYTRfBv9wquU4RwGFZy7kAFmPL 2OxwxUl1ESrA/1RDXC6qYiDnQSxov7Nvlt+wH0SAeK+XnhmBXS6v9H9/BNkOIJ04KRo3 LT/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=mPjs9xnHXg0UaBCdzQ8LG1BvsyLjigHMqfclvigoABU=; b=hHRBVDQLHY8W6lW6K44lNs79NlT435MHTTlLzqyLwdNM7HYN7C7C1tAt+YQHfDxJdI UoIU0s3T2p8hP1+kRr3M/u1tjz2T34OZx4gGIj302u4mv3TrDDn8VnnKAonyA2x/GQ8Q kpd3T4LHrlKTmE0w4eJYnjsHdZfQo5e/zwsOtu7NNmYJU+GeceEuLMGyOhDCJ5pldvuO J9Z1C+3pkZNAVJiTUjJVz8DHyxrOrsXHWX10a3eu3s1HENldkCJdd1lHXsZg1T7Ac3Hk XoDVdWa/nP1FCU9n5T8Ozqn5cF1Y7emAQCGE3dT13Nkq8L776YYIea5C2rnEQKZEb6bL if9A== X-Gm-Message-State: AOAM530pbM/vP2X9ovdUJcMlhBJHJWDA+grcYzamIsgfy1Xbv3qMTR4L t9XQBcOHimDGiOnNxF3MIQCtOw== X-Google-Smtp-Source: ABdhPJyTHCwg4wXe0+lKCTiS2w7hY9cGPmM9uszH9QR+MMrb/HSTW1cOEWteF4BPONEf5/XGwapRtw== X-Received: by 2002:a05:620a:21d2:: with SMTP id h18mr25508812qka.162.1604507894541; Wed, 04 Nov 2020 08:38:14 -0800 (PST) Received: from mutt-hbsd ([38.140.209.220]) by smtp.gmail.com with ESMTPSA id p1sm2620414qkc.100.2020.11.04.08.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2020 08:38:13 -0800 (PST) Date: Wed, 4 Nov 2020 11:38:11 -0500 From: Shawn Webb To: Ed Maste Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt Message-ID: <20201104163811.2waowgqzarpr3asr@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011031957.0A3JvSJ4038311@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="e6n3pkqac6rtvho3" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CRC532sq4z40Pm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=Wr/GGJCR; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::733 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.21 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-0.98)[-0.982]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.07)[-1.067]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; NEURAL_HAM_SHORT(-0.07)[-0.066]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::733:from]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; MID_RHS_NOT_FQDN(0.50)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 16:38:16 -0000 --e6n3pkqac6rtvho3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 04, 2020 at 11:26:51AM -0500, Ed Maste wrote: > On Tue, 3 Nov 2020 at 14:57, Dimitry Andric wrote: > > > > Author: dim > > Date: Tue Nov 3 19:57:28 2020 > > New Revision: 367304 > > URL: https://svnweb.freebsd.org/changeset/base/367304 > > > > Log: > > Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt >=20 > A previous argument against the LLVM versions of binutils replacements > is that they were excessively large, but this does not look like a > substantial problem here. LLVM's cxxfilt is indeed many times the size > of ELF Tool Chain's, but still small enough that for a tool chain > component it's not a concern, in my opinion. >=20 > ELF Tool Chain: > $ size obj/c++filt > text data bss dec hex filename > 66966 1008 8400 76374 0x12a56 obj/c++filt >=20 > LLVM: > $ size obj/llvm-cxxfilt > text data bss dec hex filename > 378138 1756 9165 389059 0x5efc3 obj/llvm-cxxfilt >=20 > A remaining issue is that both nm and addr2line can also demangle C++ sym= bols. This brings a question: is there any guidance as to what FreeBSD considers "too large of a component" for a toolchain component (or any other various components, like src.git/stand)? I ask mostly out of curiousity. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --e6n3pkqac6rtvho3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl+i2PAACgkQ/y5nonf4 4fqhTxAApJxjXO5c/3lUIOweo1s1sCugiDUCpWSLASGYnJGR8zpQqdzNu23zqgFf kxY7HTVESYheKLCAEMp6SJGz1ykl/hiYUMVT/+HUYfJZMEwNlWrUwQ8UwcnSLdjN QEJ2aRDUL/fvoxq3aZsQeGoyW30BUEJv3PD9hgp7WIZkM5K+MfZh0bqEKR7j3RSO UhXYV4xamDsU8QGV7wWu6mXNr3b7CTocDlkOwWLBzb9FYyXJUxdI0PHgHKUykewW uiXR1r8WZNd/RRlh1IdQjrOEmUNkrFuumqNYTjf34wgjRf73+Q/EqqcQRZUwMuLb xxu/7oCcGbb95wIl2pzl3B6wc1mC3FmPcWeqoXtUYU1Fc656dxnCuLumeND8Vd+2 KSZP1AvWt9hrdtBwqu7Ya23a2YbE3hX6g7Vmt1idNfqMz3YKN4kscG/RF45mQxCI jtA99SfEDXqSMxHvqLLsMMItaPAmF4F1DIHCcxWyrRwWGTsJTU8x+1h4iq67U2/E f0oPexqZDz1UBBYPWyCh4Aihiqqh/9e/LTaGs+ExsdUGIuQyenJOQPEGEhPw1lZ8 2ENWMs89Ob8cztI4Ko7U9lehRWVV0er9nTOjPmlow/IzX1ZAdjV2QxLOPVjehxqL g4epKIJ/GwuKeYkDzn+UL/FuUqeIZ/VOOYYn4/e1gPfCDU2aqnA= =76rh -----END PGP SIGNATURE----- --e6n3pkqac6rtvho3-- From owner-svn-src-head@freebsd.org Wed Nov 4 16:42:21 2020 Return-Path: Delivered-To: svn-src-head@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 F0BA446154C; Wed, 4 Nov 2020 16:42: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 4CRC9n6B75z40l2; Wed, 4 Nov 2020 16:42: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 B8E57107E5; Wed, 4 Nov 2020 16:42: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 0A4GgLW1010483; Wed, 4 Nov 2020 16:42:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4GgLYv010479; Wed, 4 Nov 2020 16:42:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011041642.0A4GgLYv010479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 4 Nov 2020 16:42:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367335 - in head/sys/amd64: amd64 include X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/amd64: amd64 include X-SVN-Commit-Revision: 367335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 16:42:22 -0000 Author: markj Date: Wed Nov 4 16:42:20 2020 New Revision: 367335 URL: https://svnweb.freebsd.org/changeset/base/367335 Log: amd64: Make it easier to configure exception stack sizes The amd64 kernel handles certain types of exceptions on a dedicated stack. Currently the sizes of these stacks are all hard-coded to PAGE_SIZE, but for at least NMI handling it can be useful to use larger stacks. Add constants to intr_machdep.h to make this easier to tweak. No functional change intended. Reviewed by: kib MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27076 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/mp_machdep.c head/sys/amd64/amd64/pmap.c head/sys/amd64/include/intr_machdep.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Wed Nov 4 16:30:56 2020 (r367334) +++ head/sys/amd64/amd64/machdep.c Wed Nov 4 16:42:20 2020 (r367335) @@ -670,10 +670,10 @@ cpu_setregs(void) static struct gate_descriptor idt0[NIDT]; struct gate_descriptor *idt = &idt0[0]; /* interrupt descriptor table */ -static char dblfault_stack[PAGE_SIZE] __aligned(16); -static char mce0_stack[PAGE_SIZE] __aligned(16); -static char nmi0_stack[PAGE_SIZE] __aligned(16); -static char dbg0_stack[PAGE_SIZE] __aligned(16); +static char dblfault_stack[DBLFAULT_STACK_SIZE] __aligned(16); +static char mce0_stack[MCE_STACK_SIZE] __aligned(16); +static char nmi0_stack[NMI_STACK_SIZE] __aligned(16); +static char dbg0_stack[DBG_STACK_SIZE] __aligned(16); CTASSERT(sizeof(struct nmi_pcpu) == 16); /* Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Wed Nov 4 16:30:56 2020 (r367334) +++ head/sys/amd64/amd64/mp_machdep.c Wed Nov 4 16:42:20 2020 (r367335) @@ -305,22 +305,22 @@ init_secondary(void) pc->pc_common_tss.tss_rsp0 = 0; /* The doublefault stack runs on IST1. */ - np = ((struct nmi_pcpu *)&doublefault_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&doublefault_stack[DBLFAULT_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist1 = (long)np; /* The NMI stack runs on IST2. */ - np = ((struct nmi_pcpu *) &nmi_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&nmi_stack[NMI_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist2 = (long)np; /* The MC# stack runs on IST3. */ - np = ((struct nmi_pcpu *) &mce_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&mce_stack[MCE_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist3 = (long)np; /* The DB# stack runs on IST4. */ - np = ((struct nmi_pcpu *) &dbg_stack[PAGE_SIZE]) - 1; + np = ((struct nmi_pcpu *)&dbg_stack[DBG_STACK_SIZE]) - 1; np->np_pcpu = (register_t)pc; pc->pc_common_tss.tss_ist4 = (long)np; @@ -481,13 +481,14 @@ native_start_all_aps(void) /* allocate and set up an idle stack data page */ bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, M_WAITOK | M_ZERO); - doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | - M_ZERO); - mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); + doublefault_stack = (char *)kmem_malloc(DBLFAULT_STACK_SIZE, + M_WAITOK | M_ZERO); + mce_stack = (char *)kmem_malloc(MCE_STACK_SIZE, + M_WAITOK | M_ZERO); nmi_stack = (char *)kmem_malloc_domainset( - DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), NMI_STACK_SIZE, M_WAITOK | M_ZERO); dbg_stack = (char *)kmem_malloc_domainset( - DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + DOMAINSET_PREF(domain), DBG_STACK_SIZE, M_WAITOK | M_ZERO); dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain), DPCPU_SIZE, M_WAITOK | M_ZERO); Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Nov 4 16:30:56 2020 (r367334) +++ head/sys/amd64/amd64/pmap.c Wed Nov 4 16:42:20 2020 (r367335) @@ -157,6 +157,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -10481,17 +10482,17 @@ pmap_pti_init(void) CPU_FOREACH(i) { /* Doublefault stack IST 1 */ va = __pcpu[i].pc_common_tss.tss_ist1 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - DBLFAULT_STACK_SIZE, va, false); /* NMI stack IST 2 */ va = __pcpu[i].pc_common_tss.tss_ist2 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - NMI_STACK_SIZE, va, false); /* MC# stack IST 3 */ va = __pcpu[i].pc_common_tss.tss_ist3 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - MCE_STACK_SIZE, va, false); /* DB# stack IST 4 */ va = __pcpu[i].pc_common_tss.tss_ist4 + sizeof(struct nmi_pcpu); - pmap_pti_add_kva_locked(va - PAGE_SIZE, va, false); + pmap_pti_add_kva_locked(va - DBG_STACK_SIZE, va, false); } pmap_pti_add_kva_locked((vm_offset_t)kernphys + KERNBASE, (vm_offset_t)etext, true); Modified: head/sys/amd64/include/intr_machdep.h ============================================================================== --- head/sys/amd64/include/intr_machdep.h Wed Nov 4 16:30:56 2020 (r367334) +++ head/sys/amd64/include/intr_machdep.h Wed Nov 4 16:42:20 2020 (r367335) @@ -41,4 +41,9 @@ struct nmi_pcpu { register_t __padding; /* pad to 16 bytes */ }; +#define DBLFAULT_STACK_SIZE PAGE_SIZE +#define NMI_STACK_SIZE PAGE_SIZE +#define MCE_STACK_SIZE PAGE_SIZE +#define DBG_STACK_SIZE PAGE_SIZE + #endif /* !__MACHINE_INTR_MACHDEP_H__ */ From owner-svn-src-head@freebsd.org Wed Nov 4 17:40:39 2020 Return-Path: Delivered-To: svn-src-head@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 BAA2A4627AF; Wed, 4 Nov 2020 17:40:39 +0000 (UTC) (envelope-from dim@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 4CRDT34YY1z43Cc; Wed, 4 Nov 2020 17:40:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 670061E80B; Wed, 4 Nov 2020 17:40:39 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::a5b3:1b51:5589:5564] (unknown [IPv6:2001:470:7a58:0:a5b3:1b51:5589:5564]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 7EF9F3F8AB; Wed, 4 Nov 2020 18:40:37 +0100 (CET) From: Dimitry Andric Message-Id: <9AE259A8-F497-486E-94E0-07E1CA2C2BD7@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_689C94B6-26A4-41AB-AB46-FAC9243C4C3A"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.17\)) Subject: Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt Date: Wed, 4 Nov 2020 18:40:27 +0100 In-Reply-To: <20201104163811.2waowgqzarpr3asr@mutt-hbsd> Cc: Ed Maste , src-committers , svn-src-all , svn-src-head To: Shawn Webb References: <202011031957.0A3JvSJ4038311@repo.freebsd.org> <20201104163811.2waowgqzarpr3asr@mutt-hbsd> X-Mailer: Apple Mail (2.3445.104.17) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 17:40:39 -0000 --Apple-Mail=_689C94B6-26A4-41AB-AB46-FAC9243C4C3A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 4 Nov 2020, at 17:38, Shawn Webb wrote: >=20 > On Wed, Nov 04, 2020 at 11:26:51AM -0500, Ed Maste wrote: >> On Tue, 3 Nov 2020 at 14:57, Dimitry Andric wrote: >>>=20 >>> Author: dim >>> Date: Tue Nov 3 19:57:28 2020 >>> New Revision: 367304 >>> URL: https://svnweb.freebsd.org/changeset/base/367304 >>>=20 >>> Log: >>> Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt >>=20 >> A previous argument against the LLVM versions of binutils = replacements >> is that they were excessively large, but this does not look like a >> substantial problem here. LLVM's cxxfilt is indeed many times the = size >> of ELF Tool Chain's, but still small enough that for a tool chain >> component it's not a concern, in my opinion. >>=20 >> ELF Tool Chain: >> $ size obj/c++filt >> text data bss dec hex filename >> 66966 1008 8400 76374 0x12a56 obj/c++filt >>=20 >> LLVM: >> $ size obj/llvm-cxxfilt >> text data bss dec hex filename >> 378138 1756 9165 389059 0x5efc3 obj/llvm-cxxfilt >>=20 >> A remaining issue is that both nm and addr2line can also demangle C++ = symbols. >=20 > This brings a question: is there any guidance as to what FreeBSD > considers "too large of a component" for a toolchain component (or any > other various components, like src.git/stand)? I think this guidance originates from the world of embedded systems, where storage size is a more limiting factor than on recent desktop or server class machines. On my desktops I won't care too much whether an executable is 1M or 100MB, but on a small SD card things add up very quickly! That said, llvm-related tools such as llvm-ar or llvm-cxxfilt are pretty big, mainly because all of them are written in C++ with a lot of templates, and we link the llvm and clang .a files statically into them. It would save some space to stuff all those library files into a shared library, and link the tools against that, but the disadvantage is that it will take a *lot* of memory and CPU time to link that (huge) shared library. I experimented a little with that in the past, and it's very difficult to make it work on 32-bit systems. -Dimitry --Apple-Mail=_689C94B6-26A4-41AB-AB46-FAC9243C4C3A Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCX6LniwAKCRCwXqMKLiCW o8gKAKCxbjEuJ990AqwplrupcNnlvDdPLgCg/yq3CATtsvZ1Loi3ddH2qoOimwU= =PtyD -----END PGP SIGNATURE----- --Apple-Mail=_689C94B6-26A4-41AB-AB46-FAC9243C4C3A-- From owner-svn-src-head@freebsd.org Wed Nov 4 17:51:10 2020 Return-Path: Delivered-To: svn-src-head@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 5731C462A6E; Wed, 4 Nov 2020 17:51:10 +0000 (UTC) (envelope-from dim@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 4CRDjB1cMFz446S; Wed, 4 Nov 2020 17:51:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A7211133B; Wed, 4 Nov 2020 17:51:10 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4Hp9c8048128; Wed, 4 Nov 2020 17:51:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4Hp9mc048127; Wed, 4 Nov 2020 17:51:09 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011041751.0A4Hp9mc048127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Nov 2020 17:51:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367337 - head/contrib/libcxxrt X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/libcxxrt X-SVN-Commit-Revision: 367337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 17:51:10 -0000 Author: dim Date: Wed Nov 4 17:51:09 2020 New Revision: 367337 URL: https://svnweb.freebsd.org/changeset/base/367337 Log: Make vector-related functions in libcxxrt's demangler static Follow-up to r367323 by re-adding static to a number of the functions copied from elftc's libelftc_vstr.c. This was requested by upstream. PR: 250702 MFC after: 3 days Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c Modified: head/contrib/libcxxrt/libelftc_dem_gnu3.c ============================================================================== --- head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 17:22:12 2020 (r367336) +++ head/contrib/libcxxrt/libelftc_dem_gnu3.c Wed Nov 4 17:51:09 2020 (r367337) @@ -153,7 +153,7 @@ get_strlen_sum(const struct vector_str *v) /** * @brief Deallocate resource in vector_str. */ -void +static void vector_str_dest(struct vector_str *v) { size_t i; @@ -174,7 +174,7 @@ vector_str_dest(struct vector_str *v) * @param l Length of the string. * @return -1 at failed, 0 at not found, 1 at found. */ -int +static int vector_str_find(const struct vector_str *v, const char *o, size_t l) { size_t i; @@ -197,7 +197,7 @@ vector_str_find(const struct vector_str *v, const char * @param l Length of the string. * @return NULL at failed or NUL terminated new allocated string. */ -char * +static char * vector_str_get_flat(const struct vector_str *v, size_t *l) { ssize_t elem_pos, elem_size, rtn_size; @@ -263,7 +263,7 @@ vector_str_grow(struct vector_str *v) * @brief Initialize vector_str. * @return false at failed, true at success. */ -bool +static bool vector_str_init(struct vector_str *v) { @@ -287,7 +287,7 @@ vector_str_init(struct vector_str *v) * @brief Remove last element in vector_str. * @return false at failed, true at success. */ -bool +static bool vector_str_pop(struct vector_str *v) { @@ -309,7 +309,7 @@ vector_str_pop(struct vector_str *v) * @brief Push back string to vector. * @return false at failed, true at success. */ -bool +static bool vector_str_push(struct vector_str *v, const char *str, size_t len) { @@ -333,7 +333,7 @@ vector_str_push(struct vector_str *v, const char *str, * @brief Push front org vector to det vector. * @return false at failed, true at success. */ -bool +static bool vector_str_push_vector_head(struct vector_str *dst, struct vector_str *org) { size_t i, j, tmp_cap; @@ -373,7 +373,7 @@ vector_str_push_vector_head(struct vector_str *dst, st * @brief Push org vector to the tail of det vector. * @return false at failed, true at success. */ -bool +static bool vector_str_push_vector(struct vector_str *dst, struct vector_str *org) { size_t i, j, tmp_cap; @@ -416,7 +416,7 @@ vector_str_push_vector(struct vector_str *dst, struct * If r_len is not NULL, string length will be returned. * @return NULL at failed or NUL terminated new allocated string. */ -char * +static char * vector_str_substr(const struct vector_str *v, size_t begin, size_t end, size_t *r_len) { From owner-svn-src-head@freebsd.org Wed Nov 4 18:17:49 2020 Return-Path: Delivered-To: svn-src-head@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 0FB914630CB; Wed, 4 Nov 2020 18:17:49 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) (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 4CRFHw5JMFz45Lc; Wed, 4 Nov 2020 18:17:48 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f46.google.com with SMTP id u21so12581817iol.12; Wed, 04 Nov 2020 10:17:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/MkQayawaOiccnEntl5lJGlIW/riFFO9ynebXR3Pljk=; b=SzT7kSx4+mjdsGauCBkRXq7EHmAT+vPqGh10EU8F1aibf9KD2K7do9mKeclfzOtKhP 2ujn9VmpaSchMNkZSkMvQ5Eb8WunnQ/PwueDZ0+1FmReRVXw+LIFPsOkh389sWz3ohTz /s0ReGGmBRfR1rEEPVv2/jSjWqRwd3UbhdAb9QOZczIpIztdwIOj774ItRtfXU46Fb0r O/SglvQO4KQYc4ueOAk6tXoHIMwNoqjqdWuqYCACC8Mv2D/rmeCcO7KP0CYhy6rQEmmZ vvTWlmcYze6K+wYdYl7IpzOcpC8fDprOhlBj3+ed1iq8PYzMcJIKObXA5TmXWSumAC5x FOmA== X-Gm-Message-State: AOAM533e9AG3JBQtnCYOMCUNtRL6o9gM4Iw4T5StgNi80GEuNW9Llz4b bMxjuOtkj1KAmOWWhdw6u+TWR1gmSut0MQa1Y/AxuPVe X-Google-Smtp-Source: ABdhPJzhq1q9hL1tlwPeFeyMA7jOGDWww0JRjPeVro5TKaLHTmGhCLkQ1iiK4IXOfRFh9+iFv1RBNThnQ2uX1iZNI7I= X-Received: by 2002:a02:8348:: with SMTP id w8mr21414553jag.136.1604513866752; Wed, 04 Nov 2020 10:17:46 -0800 (PST) MIME-Version: 1.0 References: <202011031957.0A3JvSJ4038311@repo.freebsd.org> <20201104163811.2waowgqzarpr3asr@mutt-hbsd> <9AE259A8-F497-486E-94E0-07E1CA2C2BD7@FreeBSD.org> In-Reply-To: <9AE259A8-F497-486E-94E0-07E1CA2C2BD7@FreeBSD.org> From: Ed Maste Date: Wed, 4 Nov 2020 13:17:34 -0500 Message-ID: Subject: Re: svn commit: r367304 - in head: share/man/man5 share/mk tools/build/options usr.bin usr.bin/clang usr.bin/clang/llvm-cxxfilt To: Dimitry Andric Cc: Shawn Webb , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CRFHw5JMFz45Lc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 18:17:49 -0000 On Wed, 4 Nov 2020 at 12:40, Dimitry Andric wrote: > > I think this guidance originates from the world of embedded systems, > where storage size is a more limiting factor than on recent desktop or > server class machines. On my desktops I won't care too much whether an > executable is 1M or 100MB, but on a small SD card things add up very > quickly! Indeed, although even there the lowest-capacity SD card available in the market keeps growing. Most of the tool chain is irrelevant for embedded systems and the size makes little difference, but there are some tool chain components that may be of interest. We don't expect Clang on a constrained target, but might want find size, or strings. From owner-svn-src-head@freebsd.org Wed Nov 4 18:24:00 2020 Return-Path: Delivered-To: svn-src-head@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 7F358463884; Wed, 4 Nov 2020 18:24:00 +0000 (UTC) (envelope-from manu@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 4CRFR42mx4z45dS; Wed, 4 Nov 2020 18:24:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4203711E00; Wed, 4 Nov 2020 18:24:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4IO0Gm072309; Wed, 4 Nov 2020 18:24:00 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4IO031072308; Wed, 4 Nov 2020 18:24:00 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011041824.0A4IO031072308@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 4 Nov 2020 18:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367338 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 367338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 18:24:00 -0000 Author: manu Date: Wed Nov 4 18:23:59 2020 New Revision: 367338 URL: https://svnweb.freebsd.org/changeset/base/367338 Log: Plug minor memory leak in dwc3 USB2/USB3 controller. OF_getprop_alloc called earlier requires corresponding OF_prop_free to release allocated memory. Submitted by: kjopek@gmail.com Differential Revision: https://reviews.freebsd.org/D27085 Modified: head/sys/dev/usb/controller/dwc3.c Modified: head/sys/dev/usb/controller/dwc3.c ============================================================================== --- head/sys/dev/usb/controller/dwc3.c Wed Nov 4 17:51:09 2020 (r367337) +++ head/sys/dev/usb/controller/dwc3.c Wed Nov 4 18:23:59 2020 (r367338) @@ -235,6 +235,7 @@ snps_dwc3_configure_phy(struct snps_dwc3_softc *sc) DWC3_GUSB2PHYCFG0_USBTRDTIM(DWC3_GUSB2PHYCFG0_USBTRDTIM_8BITS); } DWC3_WRITE(sc, DWC3_GUSB2PHYCFG0, reg); + OF_prop_free(phy_type); } static void From owner-svn-src-head@freebsd.org Wed Nov 4 19:04:56 2020 Return-Path: Delivered-To: svn-src-head@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 6FA2B464239; Wed, 4 Nov 2020 19:04:56 +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 4CRGLH1JFSz47KN; Wed, 4 Nov 2020 19:04:54 +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 0A4J4cbQ025816; Wed, 4 Nov 2020 11:04:38 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 0A4J4b5k025815; Wed, 4 Nov 2020 11:04:37 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202011041904.0A4J4b5k025815@gndrsh.dnsmgr.net> Subject: Re: svn commit: r367280 - head/lib/libc/gen In-Reply-To: <1b636b92-92e8-4abf-0771-f7232ca6d25f@freebsd.org> To: Stefan Esser Date: Wed, 4 Nov 2020 11:04:37 -0800 (PST) CC: Emmanuel Vadot , Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org 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: 4CRGLH1JFSz47KN 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.30 / 15.00]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.991]; NEURAL_HAM_LONG(-0.98)[-0.978]; TAGGED_RCPT(0.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; MIME_GOOD(-0.10)[text/plain]; RCPT_COUNT_FIVE(0.00)[6]; AUTH_NA(1.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.23)[-0.232]; 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]; FREEMAIL_CC(0.00)[bidouilliste.com,gmail.com,freebsd.org]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 19:04:56 -0000 Picking a late message in this thread to reply to.... [ Charset windows-1252 unsupported, converting... ] > >>> I think that the first question we want to ask is : Do we want to > >>> support LOCALBASE being different than /usr/local > >> > >> The big majority of users will keep the default value, and I do not > >> see a good reason for a change, except if there is a large installed > >> base that traditionally uses another prefix (I have seen /vol/local > >> and /opt, but also OS and architecture-specific prefixes, for example). > > > > I'd still like to see some arguments for such installs. > > There are no reasons, if you have a narrow scope where FreeBSD should > get installed. If it only on individual desktop users' system, they > are best served with LOCALBASE immutably fixed to /usr/local. > > But there are other kinds of user and I have already given examples. > Companies that have tooling that traditionally used some other prefix > will not rewrite all their tools if we tell them that only /usr/local > is supported, for example. > > I do not have to justify the existence of such use cases, and I'm happy > with /usr/local on all my systems. But I do know that such use cases > do exist and I have worked in environments where they were relevant. > For 25 years PREFIX has been rigidly a part of the ports infustructure, why is it that the BASE system has been allowed to de-evolve from this concept as documented and REQUIRED by: https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/porting-prefix.html I again assert at one time the base system was clean of this, it has regressed and needs to be fixed. That fix should restore the independence of PREFIX. If 30k ported pieces of software can do it why can't the base system do it? Those ports do not require a recompile, why should the base system? > >>> I honestly don't see any advantages of making it !=/usr/local/ and > >>> before we start putting a lot of new/useless(for I guess 99% of our > >>> user base) in the tree we should here why people are using /usr/pkg or > >>> whatever weird location. > >> > >> No, why should we [assess] (assuming that word is to be implied in > >> your sentence) why people want to be able to easily use a different > >> prefix? That would be a waste of time, IMHO. > >> > >> I know that there are legitimate reasons to want a different prefix, > >> and we had requests to make it easier to support it. > > > > What are thoses ? > > Please check the mail-lists since I did not save those messages. > > >> We have literal uses of /usr/local in a lot of files in the FreeBSD > >> base system (more than 1700) and this is not going to change. > >> > >> But it was easy to replace a number of such literal pathes in base > >> system binaries, and we can make it easier for those that need a > >> different prefix to get it consistently used. > >> > >>> If they have some good argument, then we should proceed further. > >> > >> You do not have to participate in this effort > > > > I do have to participate, it's a common project. > > But it does not affect you if you do not use it. > > > Also since I also participate in pkg(8) and in ports/Mk lua/blah stuff > > there might be some stuff to do there so yes I need to participate. > > Ports should already support PREFIX and LOCALBASE other than /usr/local. > > And the pkg program even supports the LOCALBASE environment variable. > > All we try to do is go away from multiple inconsistent methods and > mechanisms and make it easier for installations that do have a need > for a different LOCALBASE to get in consistently applied to all parts > of the system. (They have to go through the tree and apply local > patches to program sources or config files, currently, but will then > have the same result with much more effort spent by each of them.) > > > And since you never really started a conversation on a ml (that I know > > of) my only mean to start this participation is answering a commit > > email. > > There has been a lengthy discussion in the thread about moving the > calendar data files out of the base system. > > And there is review D26942, which was announced on the -current list > and which you seem to have missed. Also relevant are D27009, D27014, > and D27022, which have been mentioned in commits as far they have > already been committed, but have not been widely announced. You can > easily > > >> - there are so many > >> other areas to work on (and I know you are very active in one). > > > > Only one ? Damn, I should work more then. > > The most recent breakage you caused for me was the backlight kernel > option that has been introduced without any discussion I'm aware of. > > Yes, I know about your involvement in getting support for modern GPUs > into FreeBSD and appreciate it. > > >> But please do not ask those that have started to reduce the use of > >> literal /usr/local in the base system to justify this work. > > > > Seriously ? I have every right to ask you to justify this when it was > > not talked about in a public forum. > > What is the problem with replacing a literal string with a macro that > provides the exact same string to the compiler (unless its definition > in paths.h is changed). > > Why are you against Scott Long suggesting a function getlocalbase() > that can be used as the official method to have a user supplied value > of LOCALBASE become effective in a program instead of local hacks > like checking for the LOCALBASE environment variable in some programs? > > This does not affect you at all, since you can continue to hard-code > /usr/local or to continue to fetch LOCALBASE from the environment. > > But developers that want to make sure that a non-default value of > LOCALBASE is consistently used by their software can make use of this > function instead of inventing their own. > > >> If you are happy with /usr/local, then you are not affected at all. > >> And if you need to configure your system to use a different prefix, > >> you are welcome to let us know which steps are still causing much > >> effort and should be worked on to make it easier ... > >> > >> Do you have any reason to be against removal of literal /usr/local > >> from the base system in favor of using a symbolic name for it? > > > > Do you have any reason to remove them at all ? > > No, I do not. But I do not want to further complicate the use of a > non-default /usr/local in case it is required. > > And the easiest way to do this is to provide a system-wide define > in a common include file, which already allowed you to specify e.g. > the system-wide default PATH for user programs including /usr/local/bin > and /usr/local/sbin. > > Changing that path makes a different LOCALBASE effective in all programs > that have a default PATH compiled in. > > The change to paths.h was just to introduce _PATH_LOCALBASE in path.h > for reference in _PATH_DEFPATH and some programs that had /usr/local as > literal strings in paths they rely on. > > I really do not understand what's wrong with using a symbolic name for > a directory instead of the literal string. > > And the change that started this thread makes the compiled in value of > _PATH_LOCALBASE accessible by sysctl, in the same way as the default > binary path already was as user.cs_path. > > What is your problem with being able to query that value? > > All of these changes have been available for review on Phabricator, but > I have not announced this particular change on -hackers. > > But it has been reviewed and accepted by 2 core team members, which I > think was sufficient support to let me commit them. > > Making the sysctl variable writable by root is an undocumented change > in support of the getlocalbase() function proposed by one of those > reviewers and is meant to simplify testing of such a function without > the need for a locally patched kernel. This variable is currently not > used by any program and its value therefore not relevant. > > I have spent more time on this discussion than on working on the code > and I really do not understand what you are complaining about. > > The changes made and still planned to the base system with regard to > LOCALBASE are not so different from the use of LOCALBASE in the ports > system, which nobody seems to object to. > > Regards, STefan -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Nov 4 19:41:05 2020 Return-Path: Delivered-To: svn-src-head@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 13CAE464837; Wed, 4 Nov 2020 19:41:05 +0000 (UTC) (envelope-from bapt@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 4CRH806hdTz49V0; Wed, 4 Nov 2020 19:41:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from ivaldir.etoilebsd.net (etoilebsd.net [178.32.217.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bapt) by smtp.freebsd.org (Postfix) with ESMTPSA id B0C591F602; Wed, 4 Nov 2020 19:41:04 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: by ivaldir.etoilebsd.net (Postfix, from userid 1001) id E9B2BD8007; Wed, 4 Nov 2020 20:40:58 +0100 (CET) Date: Wed, 4 Nov 2020 20:40:58 +0100 From: Baptiste Daroussin To: rgrimes@freebsd.org Cc: Stefan Esser , Emmanuel Vadot , Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <20201104194058.tbrh4vvgevbnb6pd@ivaldir.net> References: <1b636b92-92e8-4abf-0771-f7232ca6d25f@freebsd.org> <202011041904.0A4J4b5k025815@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vpbio6n3osvpq77o" Content-Disposition: inline In-Reply-To: <202011041904.0A4J4b5k025815@gndrsh.dnsmgr.net> X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 19:41:05 -0000 --vpbio6n3osvpq77o Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 04, 2020 at 11:04:37AM -0800, Rodney W. Grimes wrote: > Picking a late message in this thread to reply to.... >=20 > [ Charset windows-1252 unsupported, converting... ] > > >>> I think that the first question we want to ask is : Do we want to > > >>> support LOCALBASE being different than /usr/local > > >> > > >> The big majority of users will keep the default value, and I do not > > >> see a good reason for a change, except if there is a large installed > > >> base that traditionally uses another prefix (I have seen /vol/local > > >> and /opt, but also OS and architecture-specific prefixes, for exampl= e). > > >=20 > > > I'd still like to see some arguments for such installs. > >=20 > > There are no reasons, if you have a narrow scope where FreeBSD should > > get installed. If it only on individual desktop users' system, they > > are best served with LOCALBASE immutably fixed to /usr/local. > >=20 > > But there are other kinds of user and I have already given examples. > > Companies that have tooling that traditionally used some other prefix > > will not rewrite all their tools if we tell them that only /usr/local > > is supported, for example. > >=20 > > I do not have to justify the existence of such use cases, and I'm happy > > with /usr/local on all my systems. But I do know that such use cases > > do exist and I have worked in environments where they were relevant. > >=20 >=20 > For 25 years PREFIX has been rigidly a part of the ports infustructure, > why is it that the BASE system has been allowed to de-evolve from this > concept as documented and REQUIRED by: >=20 > https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/portin= g-prefix.html >=20 >=20 > I again assert at one time the base system was clean of this, > it has regressed and needs to be fixed. That fix should restore > the independence of PREFIX. If 30k ported pieces of software can > do it why can't the base system do it? >=20 > Those ports do not require a recompile, why should the base system? I am just reacting on that phrase, you do really think the ports do not req= uire a rebuild to be able to relocate from a PREFIX to another? this is a myth! ports support being built with another prefix than localbase but that is al= l it supports. There has been a flase claim for years that relocating work, but beside the tools proposing the feature it never worked, or to be fait only on some very specific port. But it is just an impossible goal to achieve otherwise as for example all t= he path which gets hardcoded at build time depending on the prefix will end up= in the binary looking for resources in a hardcoded prefix at runtime and so fa= il if you relocate the package, for example its datadir. Best regards, Bapt --vpbio6n3osvpq77o Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEgOTj3suS2urGXVU3Y4mL3PG3PloFAl+jA8MACgkQY4mL3PG3 PlphzxAArje0+AQZ2mS0GqEERDQe9tyAkeEo56zRAQz1UDlVBniuLZuh1dX+cPiU 5W5hK8jJ4NVBzII5Xj7RwUkjPiEd+aRhOcdRXNrTp/hAeCNVSbvXnwYR+4Q1XdFE 1hdfY14V/CRqboBOUlyBnPd9P/WG2GPBUrFC1JBW/0JGVcLp1SV97N8nDKsCeA03 Nn8QCcDVwSr5BEOMOJoDIrn8v5y9LWitjXEL2m3YlsO0V6OiCRKnKqGKxyQssvlJ c+GOUEmeAnzOuQedghIwDAt3HZj6WJmBtZ48hGjG11GteCGBVennx1NmbJHvrz8D v3jUa6RjDyZjAXgB1f0fZ7W+L23/ytTUSy0/mDC+XJ2NUXCXEhb35ZdDKo64hlP5 Itux1LPHqx8WoddwXeCQyL8E478Z1KXvVaNha+Kd3Ol0yrBob8p3UnUCTP/zEloZ W6LWN+EloOEW2gbYSbHAOLTy/a5C0UpbRLvLBZyN6SdpuE0VWBrbK1L24MI2Deyg VSsAlornaKtC8/931TwTRRicvEVd0L0AGzG7L+WYuYiPJJhHimCPfnSvIDmJDLK5 SvUwEeG4H1JoQSsjQaNRrdB9tIYhO5SiiZdv1ZAunnsvXZj2Mbvb/iRxR+/hKAv9 6W6mzkWvjlzNHsltObGwdwhtgjguwn/n5MAyklygumXwdBXiZsw= =kDWl -----END PGP SIGNATURE----- --vpbio6n3osvpq77o-- From owner-svn-src-head@freebsd.org Wed Nov 4 19:50:13 2020 Return-Path: Delivered-To: svn-src-head@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 79A3D464A7D; Wed, 4 Nov 2020 19:50:13 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CRHLX4rDfz4Bql; Wed, 4 Nov 2020 19:50:12 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0A4JnswM035316 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 4 Nov 2020 21:49:57 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0A4JnswM035316 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0A4Jnsf4035315; Wed, 4 Nov 2020 21:49:54 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 4 Nov 2020 21:49:54 +0200 From: Konstantin Belousov To: Stefan Esser Cc: Emmanuel Vadot , src-committers , svn-src-all , svn-src-head@freebsd.org Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <20201104194954.GR2654@kib.kiev.ua> References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CRHLX4rDfz4Bql X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-0.54 / 15.00]; ARC_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-0.79)[-0.794]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_MEDIUM(-0.26)[-0.258]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.52)[0.516]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 19:50:13 -0000 On Mon, Nov 02, 2020 at 11:51:12PM +0100, Stefan Esser wrote: > Am 02.11.20 um 23:10 schrieb Konstantin Belousov: > > On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: > > > I think that the first question we want to ask is : Do we want to > > > support LOCALBASE being different than /usr/local > > > I honestly don't see any advantages of making it !=/usr/local/ and > > > before we start putting a lot of new/useless(for I guess 99% of our > > > user base) in the tree we should here why people are using /usr/pkg or > > > whatever weird location. > > > If they have some good argument, then we should proceed further. > > > > I would be delighted to be able to install _and use_ two independent > > set of packages from the same base system install. Without recursing > > to jails, X forwarding, etc. > > I understand the use case, and I agree this may be appropriate for > a development system. > > But on a production system I'd never want to have a non-constant and > not generally applied LOCALBASE, at least not on a system that gives > a CLI to unprivileged users. Those could build their own copy of the > LOCALBASE tree (e.g. sym-linking all sub-trees that are to be kept > unmodified, replacing config files that policies that restrict the > user). So how this makes attitude to the feature different ? For me, dev machine is my production box because what I do is development. And for user that need to run an old binary-only 32bit app which requires X libs, for instance, it also would be a production. > > And if LOCALBASE is not compiled into binaries but somehow obtained > at run-time, there are a number of attacks I can imagine (e.g. by > LD_PRELOAD replace the sysctl() call in libc by your own version). If somebody can LD_PRELOAD their into your process, it makes no sense to talk about 'security'. > > > In fact I would like to use /usr/local and e.g /usr/local-i386 on amd64 > > machine. I am fine with me building both of them in my instance of > > poudriere. > > This is a use-case for architecture dependent path definitions (which > I have used some 30 years ago on HP-UX which supported 68k and HP-PA > on a single file system that way). Such a feature has been discussed > in FreeBSD multiple times over the decades ... Ok, let replace /usr/local-i386 by /usr/local-11.4, if you so inclined. From owner-svn-src-head@freebsd.org Wed Nov 4 19:54:19 2020 Return-Path: Delivered-To: svn-src-head@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 217CA464F31; Wed, 4 Nov 2020 19:54:19 +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 4CRHRH00nKz4C91; Wed, 4 Nov 2020 19:54:19 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D732212CFC; Wed, 4 Nov 2020 19:54:18 +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 0A4JsIcO027821; Wed, 4 Nov 2020 19:54:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4JsInx027819; Wed, 4 Nov 2020 19:54:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011041954.0A4JsInx027819@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 4 Nov 2020 19:54:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367339 - 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: 367339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 19:54:19 -0000 Author: trasz Date: Wed Nov 4 19:54:18 2020 New Revision: 367339 URL: https://svnweb.freebsd.org/changeset/base/367339 Log: Add linux_to_bsd_errtbl[], mapping Linux errnos to their BSD counterparts. This will be used by fuse(4). Reviewed by: asomers MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26974 Modified: head/sys/compat/linux/linux_errno.c head/sys/compat/linux/linux_errno.h head/sys/compat/linux/linux_errno.inc Modified: head/sys/compat/linux/linux_errno.c ============================================================================== --- head/sys/compat/linux/linux_errno.c Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.c Wed Nov 4 19:54:18 2020 (r367339) @@ -31,5 +31,11 @@ linux_check_errtbl(void) KASSERT(linux_errtbl[i] != 0, ("%s: linux_errtbl[%d] == 0", __func__, i)); } + + for (i = 1; i < nitems(linux_to_bsd_errtbl); i++) { + KASSERT(linux_to_bsd_errtbl[i] != 0, + ("%s: linux_to_bsd_errtbl[%d] == 0", __func__, i)); + } + } #endif Modified: head/sys/compat/linux/linux_errno.h ============================================================================== --- head/sys/compat/linux/linux_errno.h Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.h Wed Nov 4 19:54:18 2020 (r367339) @@ -180,4 +180,8 @@ #define LINUX_ERFKILL 132 #define LINUX_EHWPOISON 133 +#ifdef _KERNEL +#define LINUX_ELAST LINUX_EHWPOISON +#endif + #endif /* _LINUX_ERRNO_H_ */ Modified: head/sys/compat/linux/linux_errno.inc ============================================================================== --- head/sys/compat/linux/linux_errno.inc Wed Nov 4 18:23:59 2020 (r367338) +++ head/sys/compat/linux/linux_errno.inc Wed Nov 4 19:54:18 2020 (r367339) @@ -160,3 +160,170 @@ static const int linux_errtbl[ELAST + 1] = { _Static_assert(ELAST == 97, "missing errno entries in linux_errtbl"); + +static const int linux_to_bsd_errtbl[LINUX_ELAST + 1] = { + /* [0, 9] */ + [0] = 0, + [LINUX_EPERM] = EPERM, + [LINUX_ENOENT] = ENOENT, + [LINUX_ESRCH] = ESRCH, + [LINUX_EINTR] = EINTR, + [LINUX_EIO] = EIO, + [LINUX_ENXIO] = ENXIO, + [LINUX_E2BIG] = E2BIG, + [LINUX_ENOEXEC] = ENOENT, + [LINUX_EBADF] = EBADF, + + /* [10, 19] */ + [LINUX_ECHILD] = ECHILD, + [LINUX_EAGAIN] = EAGAIN, + [LINUX_ENOMEM] = ENOMEM, + [LINUX_EACCES] = EACCES, + [LINUX_EFAULT] = EFAULT, + [LINUX_ENOTBLK] = ENOTBLK, + [LINUX_EBUSY] = EBUSY, + [LINUX_EEXIST] = EEXIST, + [LINUX_EXDEV] = EXDEV, + [LINUX_ENODEV] = ENODEV, + + /* [20, 29] */ + [LINUX_ENOTDIR] = ENOTDIR, + [LINUX_EISDIR] = EISDIR, + [LINUX_EINVAL] = EINVAL, + [LINUX_ENFILE] = ENFILE, + [LINUX_EMFILE] = EMFILE, + [LINUX_ENOTTY] = ENOTTY, + [LINUX_ETXTBSY] = ETXTBSY, + [LINUX_EFBIG] = EFBIG, + [LINUX_ENOSPC] = ENOSPC, + [LINUX_ESPIPE] = ESPIPE, + + /* [30, 39] */ + [LINUX_EROFS] = EROFS, + [LINUX_EMLINK] = EMLINK, + [LINUX_EPIPE] = EPIPE, + [LINUX_EDOM] = EDOM, + [LINUX_ERANGE] = ERANGE, + [LINUX_EDEADLK] = EDEADLK, + [LINUX_ENAMETOOLONG] = ENAMETOOLONG, + [LINUX_ENOLCK] = ENOLCK, + [LINUX_ENOSYS] = ENOSYS, + [LINUX_ENOTEMPTY] = ENOTEMPTY, + + /* [40, 49] */ + [LINUX_ELOOP] = ELOOP, + [41] = EINVAL, + [LINUX_ENOMSG] = ENOMSG, + [LINUX_EIDRM] = EIDRM, + [LINUX_ECHRNG] = EINVAL, /* XXX */ + [LINUX_EL2NSYNC] = EINVAL, /* XXX */ + [LINUX_EL3HLT] = EINVAL, /* XXX */ + [LINUX_EL3RST] = EINVAL, /* XXX */ + [LINUX_ELNRNG] = EINVAL, /* XXX */ + [LINUX_EUNATCH] = EINVAL, /* XXX */ + + /* [50, 59] */ + [LINUX_ENOCSI] = EINVAL, /* XXX */ + [LINUX_EL2HLT] = EINVAL, /* XXX */ + [LINUX_EBADE] = EINVAL, /* XXX */ + [LINUX_EBADR] = EINVAL, /* XXX */ + [LINUX_EXFULL] = EINVAL, /* XXX */ + [LINUX_ENOANO] = EINVAL, /* XXX */ + [LINUX_EBADRQC] = EINVAL, /* XXX */ + [LINUX_EBADSLT] = EINVAL, /* XXX */ + [58] = EINVAL, + [LINUX_EBFONT] = EINVAL, /* XXX */ + + /* [60, 69] */ + [LINUX_ENOSTR] = EINVAL, /* XXX */ + [LINUX_ENODATA] = ENOATTR, /* XXX */ + [LINUX_ENOTIME] = EINVAL, /* XXX */ + [LINUX_ENOSR] = EINVAL, /* XXX */ + [LINUX_ENONET] = EINVAL, /* XXX */ + [LINUX_ENOPKG] = EINVAL, /* XXX */ + [LINUX_EREMOTE] = EREMOTE, + [LINUX_ENOLINK] = ENOLINK, + [LINUX_EADV] = EINVAL, /* XXX */ + [LINUX_ESRMNT] = EINVAL, /* XXX */ + + /* [70, 79] */ + [LINUX_ECOMM] = EINVAL, /* XXX */ + [LINUX_EPROTO] = EPROTO, + [LINUX_EMULTIHOP] = EMULTIHOP, + [LINUX_EDOTDOT] = EINVAL, /* XXX */ + [LINUX_EBADMSG] = EBADMSG, + [LINUX_EOVERFLOW] = EOVERFLOW, + [LINUX_ENOTUNIQ] = EINVAL, /* XXX */ + [LINUX_EBADFD] = EBADF, /* XXX */ + [LINUX_EREMCHG] = EINVAL, /* XXX */ + [LINUX_ELIBACC] = EINVAL, /* XXX */ + + /* [80, 89] */ + [LINUX_ELIBBAD] = EINVAL, /* XXX */ + [LINUX_ELIBSCN] = EINVAL, /* XXX */ + [LINUX_ELIBMAX] = EINVAL, /* XXX */ + [LINUX_ELIBEXEC] = EINVAL, /* XXX */ + [LINUX_EILSEQ] = EILSEQ, + [LINUX_ERESTART] = EAGAIN, /* XXX */ + [LINUX_ESTRPIPE] = EINVAL, /* XXX */ + [LINUX_EUSERS] = EUSERS, + [LINUX_ENOTSOCK] = ENOTSOCK, + [LINUX_EDESTADDRREQ] = EDESTADDRREQ, + + /* [90, 99] */ + [LINUX_EMSGSIZE] = EMSGSIZE, + [LINUX_EPROTOTYPE] = EPROTOTYPE, + [LINUX_ENOPROTOOPT] = ENOPROTOOPT, + [LINUX_EPROTONOTSUPPORT] = EPROTONOSUPPORT, + [LINUX_ESOCKNOTSUPPORT] = EPROTONOSUPPORT, /* XXX */ + [LINUX_EOPNOTSUPPORT] = EOPNOTSUPP, + [LINUX_EPFNOTSUPPORT] = EPFNOSUPPORT, + [LINUX_EAFNOTSUPPORT] = EAFNOSUPPORT, + [LINUX_EADDRINUSE] = EADDRINUSE, + [LINUX_EADDRNOTAVAIL] = EADDRNOTAVAIL, + + /* [100, 109] */ + [LINUX_ENETDOWN] = ENETDOWN, + [LINUX_ENETUNREACH] = ENETUNREACH, + [LINUX_ENETRESET] = ENETRESET, + [LINUX_ECONNABORTED] = ECONNABORTED, + [LINUX_ECONNRESET] = ECONNRESET, + [LINUX_ENOBUFS] = ENOBUFS, + [LINUX_EISCONN] = EISCONN, + [LINUX_ENOTCONN] = ENOTCONN, + [LINUX_ESHUTDOWN] = ESHUTDOWN, + [LINUX_ETOOMANYREFS] = ETOOMANYREFS, + + /* [110, 119] */ + [LINUX_ETIMEDOUT] = ETIMEDOUT, + [LINUX_ECONNREFUSED] = ECONNREFUSED, + [LINUX_EHOSTDOWN] = EHOSTDOWN, + [LINUX_EHOSTUNREACH] = EHOSTUNREACH, + [LINUX_EALREADY] = EALREADY, + [LINUX_EINPROGRESS] = EINPROGRESS, + [LINUX_ESTALE] = ESTALE, + [LINUX_EUCLEAN] = EINVAL, /* XXX */ + [LINUX_ENOTNAM] = EINVAL, /* XXX */ + [LINUX_ENAVAIL] = EINVAL, /* XXX */ + + /* [120, 129] */ + [LINUX_EISNAM] = EINVAL, /* XXX */ + [LINUX_EREMOTEIO] = EINVAL, /* XXX */ + [LINUX_EDQUOT] = EDQUOT, + [LINUX_ENOMEDIUM] = EIO, /* XXX */ + [LINUX_EMEDIUMTYPE] = EIO, /* XXX */ + [LINUX_ECANCELED] = ECANCELED, + [LINUX_ENOKEY] = EIO, /* XXX */ + [LINUX_EKEYEXPIRED] = EIO, /* XXX */ + [LINUX_EKEYREVOKED] = EIO, /* XXX */ + [LINUX_EKEYREJECTED] = EIO, /* XXX */ + + /* [130, 139] */ + [LINUX_EOWNERDEAD] = EOWNERDEAD, + [LINUX_ENOTRECOVERABLE] = ENOTRECOVERABLE, + [LINUX_ERFKILL] = ENETDOWN, /* XXX */ + [LINUX_EHWPOISON] = EINVAL, /* XXX */ +}; + +_Static_assert(LINUX_ELAST == 133, + "missing errno entries in linux_to_bsd_errtbl"); From owner-svn-src-head@freebsd.org Wed Nov 4 20:15:15 2020 Return-Path: Delivered-To: svn-src-head@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 6CDE4465236; Wed, 4 Nov 2020 20:15:15 +0000 (UTC) (envelope-from manu@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 4CRHvR2HFlz4DjD; Wed, 4 Nov 2020 20:15:15 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 319A21317D; Wed, 4 Nov 2020 20:15:15 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4KFFqB040426; Wed, 4 Nov 2020 20:15:15 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4KFFeN040425; Wed, 4 Nov 2020 20:15:15 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011042015.0A4KFFeN040425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 4 Nov 2020 20:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367340 - head/sys/modules/dtb/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/modules/dtb/rockchip X-SVN-Commit-Revision: 367340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 20:15:15 -0000 Author: manu Date: Wed Nov 4 20:15:14 2020 New Revision: 367340 URL: https://svnweb.freebsd.org/changeset/base/367340 Log: dtb/rockchip: Add rockpi-4 to the build We boot on this board to add the dtb to the build. Requested by: Daniel Engberg Modified: head/sys/modules/dtb/rockchip/Makefile Modified: head/sys/modules/dtb/rockchip/Makefile ============================================================================== --- head/sys/modules/dtb/rockchip/Makefile Wed Nov 4 19:54:18 2020 (r367339) +++ head/sys/modules/dtb/rockchip/Makefile Wed Nov 4 20:15:14 2020 (r367340) @@ -4,6 +4,7 @@ DTS= \ rockchip/rk3399-khadas-edge-captain.dts \ rockchip/rk3399-khadas-edge.dts \ rockchip/rk3399-khadas-edge-v.dts \ + rockchip/rk3399-rock-pi-4.dts \ rockchip/rk3328-rock64.dts \ rockchip/rk3399-firefly.dts \ rockchip/rk3399-rockpro64.dts From owner-svn-src-head@freebsd.org Wed Nov 4 21:18:09 2020 Return-Path: Delivered-To: svn-src-head@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 3C879466250; Wed, 4 Nov 2020 21:18:09 +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 4CRKJ10ngsz4H5F; Wed, 4 Nov 2020 21:18:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF8B213F16; Wed, 4 Nov 2020 21:18:08 +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 0A4LI8pL077090; Wed, 4 Nov 2020 21:18:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LI8wX077086; Wed, 4 Nov 2020 21:18:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042118.0A4LI8wX077086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:18:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367341 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:18:09 -0000 Author: mjg Date: Wed Nov 4 21:18:08 2020 New Revision: 367341 URL: https://svnweb.freebsd.org/changeset/base/367341 Log: rms: fixup concurrent writer handling and add more features Previously the code had one wait channel for all pending writers. This could result in a buggy scenario where after a writer switches the lock mode form readers to writers goes off CPU, another writer queues itself and then the last reader wakes up the latter instead of the former. Use a separate channel. While here add features to reliably detect whether curthread has the lock write-owned. This will be used by ZFS. Modified: head/sys/kern/kern_rmlock.c head/sys/sys/_rmlock.h head/sys/sys/rmlock.h Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Wed Nov 4 20:15:14 2020 (r367340) +++ head/sys/kern/kern_rmlock.c Wed Nov 4 21:18:08 2020 (r367341) @@ -878,10 +878,15 @@ db_show_rm(const struct lock_object *lock) * problem at some point. The easiest way to lessen it is to provide a bitmap. */ +#define RMS_NOOWNER ((void *)0x1) +#define RMS_TRANSIENT ((void *)0x2) +#define RMS_FLAGMASK 0xf + void rms_init(struct rmslock *rms, const char *name) { + rms->owner = RMS_NOOWNER; rms->writers = 0; rms->readers = 0; mtx_init(&rms->mtx, name, NULL, MTX_DEF | MTX_NEW); @@ -922,6 +927,7 @@ rms_rlock(struct rmslock *rms) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + MPASS(atomic_load_ptr(&rms->owner) != curthread); critical_enter(); zpcpu_set_protected(rms->readers_influx, 1); @@ -941,6 +947,8 @@ int rms_try_rlock(struct rmslock *rms) { + MPASS(atomic_load_ptr(&rms->owner) != curthread); + critical_enter(); zpcpu_set_protected(rms->readers_influx, 1); __compiler_membar(); @@ -1054,23 +1062,33 @@ rms_wlock(struct rmslock *rms) { WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + MPASS(atomic_load_ptr(&rms->owner) != curthread); mtx_lock(&rms->mtx); rms->writers++; if (rms->writers > 1) { - msleep(&rms->writers, &rms->mtx, (PUSER - 1) | PDROP, + msleep(&rms->owner, &rms->mtx, (PUSER - 1), mtx_name(&rms->mtx), 0); MPASS(rms->readers == 0); - return; + KASSERT(rms->owner == RMS_TRANSIENT, + ("%s: unexpected owner value %p\n", __func__, + rms->owner)); + goto out_grab; } + KASSERT(rms->owner == RMS_NOOWNER, + ("%s: unexpected owner value %p\n", __func__, rms->owner)); + rms_wlock_switch(rms); - if (rms->readers > 0) - msleep(&rms->writers, &rms->mtx, (PUSER - 1) | PDROP, + if (rms->readers > 0) { + msleep(&rms->writers, &rms->mtx, (PUSER - 1), mtx_name(&rms->mtx), 0); - else - mtx_unlock(&rms->mtx); + } + +out_grab: + rms->owner = curthread; + mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); } @@ -1079,12 +1097,27 @@ rms_wunlock(struct rmslock *rms) { mtx_lock(&rms->mtx); + KASSERT(rms->owner == curthread, + ("%s: unexpected owner value %p\n", __func__, rms->owner)); MPASS(rms->writers >= 1); MPASS(rms->readers == 0); rms->writers--; - if (rms->writers > 0) - wakeup_one(&rms->writers); - else + if (rms->writers > 0) { + wakeup_one(&rms->owner); + rms->owner = RMS_TRANSIENT; + } else { wakeup(&rms->readers); + rms->owner = RMS_NOOWNER; + } mtx_unlock(&rms->mtx); +} + +void +rms_unlock(struct rmslock *rms) +{ + + if (rms_wowned(rms)) + rms_wunlock(rms); + else + rms_runlock(rms); } Modified: head/sys/sys/_rmlock.h ============================================================================== --- head/sys/sys/_rmlock.h Wed Nov 4 20:15:14 2020 (r367340) +++ head/sys/sys/_rmlock.h Wed Nov 4 21:18:08 2020 (r367341) @@ -72,6 +72,7 @@ struct rm_priotracker { struct rmslock { struct mtx mtx; + struct thread *owner; int writers; int readers; int *readers_pcpu; Modified: head/sys/sys/rmlock.h ============================================================================== --- head/sys/sys/rmlock.h Wed Nov 4 20:15:14 2020 (r367340) +++ head/sys/sys/rmlock.h Wed Nov 4 21:18:08 2020 (r367341) @@ -140,16 +140,33 @@ int rms_try_rlock(struct rmslock *rms); void rms_runlock(struct rmslock *rms); void rms_wlock(struct rmslock *rms); void rms_wunlock(struct rmslock *rms); +void rms_unlock(struct rmslock *rms); +static inline int +rms_wowned(struct rmslock *rms) +{ + + return (rms->owner == curthread); +} + /* - * Writers are not explicitly tracked, thus until that changes the best we can - * do is indicate the lock is taken for writing by *someone*. + * Only valid to call if you hold the lock in some manner. */ static inline int -rms_wowned(struct rmslock *rms) +rms_rowned(struct rmslock *rms) { - return (rms->writers > 0); + return (rms->readers > 0); +} + +static inline int +rms_owned_any(struct rmslock *rms) +{ + + if (rms_wowned(rms)) + return (1); + + return (rms_rowned(rms)); } #endif /* _KERNEL */ From owner-svn-src-head@freebsd.org Wed Nov 4 21:18:28 2020 Return-Path: Delivered-To: svn-src-head@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 5698C466258; Wed, 4 Nov 2020 21:18:28 +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 4CRKJN1cJrz4H3Z; Wed, 4 Nov 2020 21:18:28 +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 1BC85139F3; Wed, 4 Nov 2020 21:18:28 +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 0A4LIRSO077148; Wed, 4 Nov 2020 21:18:27 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LIR0d077147; Wed, 4 Nov 2020 21:18:27 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042118.0A4LIR0d077147@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367342 - head/sys/contrib/openzfs/module/os/freebsd/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/os/freebsd/zfs X-SVN-Commit-Revision: 367342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:18:28 -0000 Author: mjg Date: Wed Nov 4 21:18:27 2020 New Revision: 367342 URL: https://svnweb.freebsd.org/changeset/base/367342 Log: zfs: even up assert Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c Wed Nov 4 21:18:08 2020 (r367341) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c Wed Nov 4 21:18:27 2020 (r367342) @@ -206,10 +206,11 @@ zfs_dd_lookup(znode_t *dzp, znode_t **zpp) uint64_t parent; int error; +#ifdef ZFS_DEBUG if (zfsvfs->z_replay == B_FALSE) ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); - +#endif if (dzp->z_unlinked) return (ENOENT); From owner-svn-src-head@freebsd.org Wed Nov 4 21:18:52 2020 Return-Path: Delivered-To: svn-src-head@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 E23F4465FFC; Wed, 4 Nov 2020 21:18:52 +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 4CRKJr5lTtz4H4L; Wed, 4 Nov 2020 21:18:52 +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 AA26314086; Wed, 4 Nov 2020 21:18:52 +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 0A4LIq6K077213; Wed, 4 Nov 2020 21:18:52 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LIq3H077210; Wed, 4 Nov 2020 21:18:52 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042118.0A4LIq3H077210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:18:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys X-SVN-Commit-Revision: 367343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:18:52 -0000 Author: mjg Date: Wed Nov 4 21:18:51 2020 New Revision: 367343 URL: https://svnweb.freebsd.org/changeset/base/367343 Log: zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros They are expected to fail only in corner cases. Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h ============================================================================== --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:27 2020 (r367342) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:51 2020 (r367343) @@ -119,7 +119,7 @@ extern minor_t zfsdev_minor_alloc(void); #define ZFS_ENTER(zfsvfs) \ { \ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ - if ((zfsvfs)->z_unmounted) { \ + if (__predict_false((zfsvfs)->z_unmounted)) { \ ZFS_EXIT(zfsvfs); \ return (EIO); \ } \ @@ -130,7 +130,7 @@ extern minor_t zfsdev_minor_alloc(void); /* Verifies the znode is valid */ #define ZFS_VERIFY_ZP(zp) \ - if ((zp)->z_sa_hdl == NULL) { \ + if (__predict_false((zp)->z_sa_hdl == NULL)) { \ ZFS_EXIT((zp)->z_zfsvfs); \ return (EIO); \ } \ Modified: head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h ============================================================================== --- head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:27 2020 (r367342) +++ head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:18:51 2020 (r367343) @@ -76,7 +76,7 @@ extern "C" { #define ZFS_ENTER_ERROR(zfsvfs, error) \ do { \ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ - if ((zfsvfs)->z_unmounted) { \ + if (unlikely((zfsvfs)->z_unmounted)) { \ ZFS_EXIT(zfsvfs); \ return (error); \ } \ @@ -95,7 +95,7 @@ do { \ /* Verifies the znode is valid. */ #define ZFS_VERIFY_ZP_ERROR(zp, error) \ do { \ - if ((zp)->z_sa_hdl == NULL) { \ + if (unlikely((zp)->z_sa_hdl == NULL)) { \ ZFS_EXIT(ZTOZSB(zp)); \ return (error); \ } \ From owner-svn-src-head@freebsd.org Wed Nov 4 21:19:27 2020 Return-Path: Delivered-To: svn-src-head@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 16950466116; Wed, 4 Nov 2020 21:19:27 +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 4CRKKV6w3Hz4Hcg; Wed, 4 Nov 2020 21:19:26 +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 CFECC13D4C; Wed, 4 Nov 2020 21:19:26 +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 0A4LJQDt077290; Wed, 4 Nov 2020 21:19:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LJQm4077284; Wed, 4 Nov 2020 21:19:26 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042119.0A4LJQm4077284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:19:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367344 - in head/sys/contrib/openzfs: include/os/freebsd/zfs/sys module/os/freebsd/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys/contrib/openzfs: include/os/freebsd/zfs/sys module/os/freebsd/zfs X-SVN-Commit-Revision: 367344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:19:27 -0000 Author: mjg Date: Wed Nov 4 21:19:25 2020 New Revision: 367344 URL: https://svnweb.freebsd.org/changeset/base/367344 Log: zfs: rename teardown inactive macros to mimick rrm convention Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h ============================================================================== --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:18:51 2020 (r367343) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:25 2020 (r367344) @@ -113,52 +113,52 @@ struct zfsvfs { }; #ifdef TEARDOWN_INACTIVE_RMS -#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ rms_init(&(zfsvfs)->z_teardown_inactive_lock, "zfs teardown inactive") -#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \ rms_destroy(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \ rms_try_rlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \ rms_rlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \ rms_runlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \ rms_wlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \ rms_wunlock(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \ rms_wowned(&(zfsvfs)->z_teardown_inactive_lock) #else -#define ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ rw_init(&(zfsvfs)->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL) -#define ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs) \ rw_destroy(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs) \ rw_tryenter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) -#define ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs) \ rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_READER) -#define ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs) \ rw_exit(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs) \ rw_enter(&(zfsvfs)->z_teardown_inactive_lock, RW_WRITER) -#define ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs) \ rw_exit(&(zfsvfs)->z_teardown_inactive_lock) -#define ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs) \ +#define ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs) \ RW_WRITE_HELD(&(zfsvfs)->z_teardown_inactive_lock) #endif Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c Wed Nov 4 21:18:51 2020 (r367343) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c Wed Nov 4 21:19:25 2020 (r367344) @@ -990,7 +990,7 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, #else rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); #endif - ZFS_INIT_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); for (int i = 0; i != ZFS_OBJ_MTX_SZ; i++) mutex_init(&zfsvfs->z_hold_mtx[i], NULL, MUTEX_DEFAULT, NULL); @@ -1130,7 +1130,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs) ASSERT(zfsvfs->z_nr_znodes == 0); list_destroy(&zfsvfs->z_all_znodes); rrm_destroy(&zfsvfs->z_teardown_lock); - ZFS_DESTROY_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs); rw_destroy(&zfsvfs->z_fuid_lock); for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) mutex_destroy(&zfsvfs->z_hold_mtx[i]); @@ -1557,7 +1557,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting zfsvfs->z_log = NULL; } - ZFS_WLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_ENTER_WRITE(zfsvfs); /* * If we are not unmounting (ie: online recv) and someone already @@ -1565,7 +1565,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting * or a reopen of z_os failed then just bail out now. */ if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { - ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); rrm_exit(&zfsvfs->z_teardown_lock, FTAG); return (SET_ERROR(EIO)); } @@ -1593,7 +1593,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting */ if (unmounting) { zfsvfs->z_unmounted = B_TRUE; - ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); rrm_exit(&zfsvfs->z_teardown_lock, FTAG); } @@ -1913,7 +1913,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) znode_t *zp; ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); - ASSERT(ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs)); + ASSERT(ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs)); /* * We already own this, so just update the objset_t, as the one we @@ -1951,7 +1951,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) bail: /* release the VOPs */ - ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); rrm_exit(&zfsvfs->z_teardown_lock, FTAG); if (err) { @@ -2068,7 +2068,7 @@ int zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) { ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); - ASSERT(ZFS_TEARDOWN_INACTIVE_WLOCKED(zfsvfs)); + ASSERT(ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs)); /* * We already own this, so just hold and rele it to update the @@ -2084,7 +2084,7 @@ zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) zfsvfs->z_os = os; /* release the VOPs */ - ZFS_WUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); rrm_exit(&zfsvfs->z_teardown_lock, FTAG); /* Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Wed Nov 4 21:18:51 2020 (r367343) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Wed Nov 4 21:19:25 2020 (r367344) @@ -4649,13 +4649,13 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t zfsvfs_t *zfsvfs = zp->z_zfsvfs; int error; - ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs); if (zp->z_sa_hdl == NULL) { /* * The fs has been unmounted, or we did a * suspend/resume and this file no longer exists. */ - ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs); vrecycle(vp); return; } @@ -4664,7 +4664,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t /* * Fast path to recycle a vnode of a removed file. */ - ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs); vrecycle(vp); return; } @@ -4684,7 +4684,7 @@ zfs_inactive(vnode_t *vp, cred_t *cr, caller_context_t dmu_tx_commit(tx); } } - ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs); } @@ -5851,10 +5851,10 @@ zfs_freebsd_need_inactive(struct vop_need_inactive_arg if (vn_need_pageq_flush(vp)) return (1); - if (!ZFS_TRYRLOCK_TEARDOWN_INACTIVE(zfsvfs)) + if (!ZFS_TEARDOWN_INACTIVE_TRY_ENTER_READ(zfsvfs)) return (1); need = (zp->z_sa_hdl == NULL || zp->z_unlinked || zp->z_atime_dirty); - ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs); return (need); } @@ -5885,12 +5885,12 @@ zfs_freebsd_reclaim(struct vop_reclaim_args *ap) * zfs_znode_dmu_fini in zfsvfs_teardown during * force unmount. */ - ZFS_RLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_ENTER_READ(zfsvfs); if (zp->z_sa_hdl == NULL) zfs_znode_free(zp); else zfs_zinactive(zp); - ZFS_RUNLOCK_TEARDOWN_INACTIVE(zfsvfs); + ZFS_TEARDOWN_INACTIVE_EXIT_READ(zfsvfs); vp->v_data = NULL; return (0); Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c Wed Nov 4 21:18:51 2020 (r367343) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_znode.c Wed Nov 4 21:19:25 2020 (r367344) @@ -374,7 +374,7 @@ zfs_znode_dmu_fini(znode_t *zp) { ASSERT(MUTEX_HELD(ZFS_OBJ_MUTEX(zp->z_zfsvfs, zp->z_id)) || zp->z_unlinked || - ZFS_TEARDOWN_INACTIVE_WLOCKED(zp->z_zfsvfs)); + ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zp->z_zfsvfs)); sa_handle_destroy(zp->z_sa_hdl); zp->z_sa_hdl = NULL; From owner-svn-src-head@freebsd.org Wed Nov 4 21:19:56 2020 Return-Path: Delivered-To: svn-src-head@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 A0BA6466799; Wed, 4 Nov 2020 21:19:56 +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 4CRKL448mmz4HXM; Wed, 4 Nov 2020 21:19:56 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71DD913EA9; Wed, 4 Nov 2020 21:19:56 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4LJujC077361; Wed, 4 Nov 2020 21:19:56 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LJtm4077354; Wed, 4 Nov 2020 21:19:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042119.0A4LJtm4077354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367345 - in head/sys/contrib/openzfs: include/os/freebsd/zfs/sys include/os/linux/zfs/sys module/os/freebsd/zfs module/os/linux/zfs module/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys/contrib/openzfs: include/os/freebsd/zfs/sys include/os/linux/zfs/sys module/os/freebsd/zfs module/os/linux/zfs module/zfs X-SVN-Commit-Revision: 367345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:19:56 -0000 Author: mjg Date: Wed Nov 4 21:19:54 2020 New Revision: 367345 URL: https://svnweb.freebsd.org/changeset/base/367345 Log: zfs: macroify teardown handling Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c head/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c head/sys/contrib/openzfs/module/zfs/zfs_ioctl.c Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h ============================================================================== --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:54 2020 (r367345) @@ -46,10 +46,12 @@ extern "C" { #endif +#define zfs_teardown_lock_t rrmlock_t + #ifdef TEARDOWN_INACTIVE_RMS -typedef struct rmslock zfs_teardown_lock_t; +typedef struct rmslock zfs_teardown_inactive_lock_t; #else -#define zfs_teardown_lock_t krwlock_t +#define zfs_teardown_inactive_lock_t krwlock_t #endif typedef struct zfsvfs zfsvfs_t; @@ -80,8 +82,8 @@ struct zfsvfs { int z_norm; /* normalization flags */ boolean_t z_atime; /* enable atimes mount option */ boolean_t z_unmounted; /* unmounted */ - rrmlock_t z_teardown_lock; - zfs_teardown_lock_t z_teardown_inactive_lock; + zfs_teardown_lock_t z_teardown_lock; + zfs_teardown_inactive_lock_t z_teardown_inactive_lock; list_t z_all_znodes; /* all vnodes in the fs */ uint64_t z_nr_znodes; /* number of znodes in the fs */ kmutex_t z_znodes_lock; /* lock for z_all_znodes */ @@ -111,6 +113,39 @@ struct zfsvfs { kmutex_t z_hold_mtx[ZFS_OBJ_MTX_SZ]; /* znode hold locks */ struct task z_unlinked_drain_task; }; + +#define ZFS_TEARDOWN_INIT(zfsvfs) \ + rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) + +#define ZFS_TEARDOWN_DESTROY(zfsvfs) \ + rrm_destroy(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rw_tryenter(&(zfsvfs)->z_teardown_lock, RW_READER) + +#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \ + rrm_enter_read(&(zfsvfs)->z_teardown_lock, tag); + +#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rrm_enter(&(zfsvfs)->z_teardown_lock, RW_WRITER, tag) + +#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rrm_exit(&(zfsvfs)->z_teardown_lock, tag) + +#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \ + RRM_READ_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + RRM_WRITE_HELD(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_HELD(zfsvfs) \ + RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) #ifdef TEARDOWN_INACTIVE_RMS #define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h ============================================================================== --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:19:54 2020 (r367345) @@ -118,15 +118,15 @@ extern minor_t zfsdev_minor_alloc(void); /* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ - rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ + ZFS_TEARDOWN_ENTER_READ((zfsvfs), FTAG); \ if (__predict_false((zfsvfs)->z_unmounted)) { \ - ZFS_EXIT(zfsvfs); \ + ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG); \ return (EIO); \ } \ } /* Must be called before exiting the vop */ -#define ZFS_EXIT(zfsvfs) rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG) +#define ZFS_EXIT(zfsvfs) ZFS_TEARDOWN_EXIT_READ(zfsvfs, FTAG) /* Verifies the znode is valid */ #define ZFS_VERIFY_ZP(zp) \ Modified: head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h ============================================================================== --- head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Wed Nov 4 21:19:54 2020 (r367345) @@ -75,9 +75,9 @@ extern "C" { /* Called on entry to each ZFS inode and vfs operation. */ #define ZFS_ENTER_ERROR(zfsvfs, error) \ do { \ - rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ + ZFS_TEARDOWN_ENTER_READ(zfsvfs, FTAG); \ if (unlikely((zfsvfs)->z_unmounted)) { \ - ZFS_EXIT(zfsvfs); \ + ZFS_EXIT_READ(zfsvfs, FTAG); \ return (error); \ } \ } while (0) @@ -88,7 +88,7 @@ do { \ #define ZFS_EXIT(zfsvfs) \ do { \ zfs_exit_fs(zfsvfs); \ - rrm_exit(&(zfsvfs)->z_teardown_lock, FTAG); \ + ZFS_EXIT_READ(zfsvfs, FTAG); \ } while (0) #define ZPL_EXIT(zfsvfs) ZFS_EXIT(zfsvfs) Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_dir.c Wed Nov 4 21:19:54 2020 (r367345) @@ -209,7 +209,7 @@ zfs_dd_lookup(znode_t *dzp, znode_t **zpp) #ifdef ZFS_DEBUG if (zfsvfs->z_replay == B_FALSE) ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); - ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(ZFS_TEARDOWN_READ_HELD(zfsvfs)); #endif if (dzp->z_unlinked) return (ENOENT); @@ -234,7 +234,7 @@ zfs_dirlook(znode_t *dzp, const char *name, znode_t ** #ifdef ZFS_DEBUG if (zfsvfs->z_replay == B_FALSE) ASSERT_VOP_LOCKED(ZTOV(dzp), __func__); - ASSERT(RRM_READ_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(ZFS_TEARDOWN_READ_HELD(zfsvfs)); #endif if (dzp->z_unlinked) return (SET_ERROR(ENOENT)); Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c Wed Nov 4 21:19:54 2020 (r367345) @@ -985,11 +985,7 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, offsetof(znode_t, z_link_node)); TASK_INIT(&zfsvfs->z_unlinked_drain_task, 0, zfsvfs_task_unlinked_drain, zfsvfs); -#ifdef DIAGNOSTIC - rrm_init(&zfsvfs->z_teardown_lock, B_TRUE); -#else - rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); -#endif + ZFS_TEARDOWN_INIT(zfsvfs); ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); for (int i = 0; i != ZFS_OBJ_MTX_SZ; i++) @@ -1129,7 +1125,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs) mutex_destroy(&zfsvfs->z_lock); ASSERT(zfsvfs->z_nr_znodes == 0); list_destroy(&zfsvfs->z_all_znodes); - rrm_destroy(&zfsvfs->z_teardown_lock); + ZFS_TEARDOWN_DESTROY(zfsvfs); ZFS_TEARDOWN_INACTIVE_DESTROY(zfsvfs); rw_destroy(&zfsvfs->z_fuid_lock); for (i = 0; i != ZFS_OBJ_MTX_SZ; i++) @@ -1381,10 +1377,10 @@ zfs_mount(vfs_t *vfsp) * manipulations between entry to zfs_suspend_fs() and return * from zfs_resume_fs(). */ - rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, FTAG); zfs_unregister_callbacks(zfsvfs); error = zfs_register_callbacks(vfsp); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); goto out; } @@ -1530,7 +1526,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting break; } } - rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, FTAG); if (!unmounting) { /* @@ -1566,7 +1562,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting */ if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); return (SET_ERROR(EIO)); } @@ -1594,7 +1590,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting if (unmounting) { zfsvfs->z_unmounted = B_TRUE; ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); } /* @@ -1654,9 +1650,9 @@ zfs_umount(vfs_t *vfsp, int fflag) * vflush(FORCECLOSE). This way we ensure no future vnops * will be called and risk operating on DOOMED vnodes. */ - rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, FTAG); zfsvfs->z_unmounted = B_TRUE; - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); } /* @@ -1912,7 +1908,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) int err; znode_t *zp; - ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(ZFS_TEARDOWN_WRITE_HELD(zfsvfs)); ASSERT(ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs)); /* @@ -1952,7 +1948,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) bail: /* release the VOPs */ ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); if (err) { /* @@ -2067,7 +2063,7 @@ zfs_busy(void) int zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) { - ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(ZFS_TEARDOWN_WRITE_HELD(zfsvfs)); ASSERT(ZFS_TEARDOWN_INACTIVE_WRITE_HELD(zfsvfs)); /* @@ -2085,7 +2081,7 @@ zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) /* release the VOPs */ ZFS_TEARDOWN_INACTIVE_EXIT_WRITE(zfsvfs); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); /* * Try to force unmount this file system. Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Wed Nov 4 21:19:54 2020 (r367345) @@ -1453,7 +1453,7 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char ASSERT_VOP_LOCKED(dvp, __func__); #ifdef DIAGNOSTIC if ((zdp->z_pflags & ZFS_XATTR) == 0) - VERIFY(!RRM_LOCK_HELD(&zfsvfs->z_teardown_lock)); + VERIFY(!ZFS_TEARDOWN_HELD(zfsvfs)); #endif if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { @@ -6550,7 +6550,7 @@ zfs_lock(struct vop_lock1_args *ap) zp = vp->v_data; if (vp->v_mount != NULL && !VN_IS_DOOMED(vp) && zp != NULL && (zp->z_pflags & ZFS_XATTR) == 0) - VERIFY(!RRM_LOCK_HELD(&zp->z_zfsvfs->z_teardown_lock)); + VERIFY(!ZFS_TEARDOWN_HELD(zp->z_zfsvfs)); } return (err); } Modified: head/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/module/os/linux/zfs/zfs_vfsops.c Wed Nov 4 21:19:54 2020 (r367345) @@ -815,7 +815,7 @@ zfsvfs_create_impl(zfsvfs_t **zfvp, zfsvfs_t *zfsvfs, mutex_init(&zfsvfs->z_lock, NULL, MUTEX_DEFAULT, NULL); list_create(&zfsvfs->z_all_znodes, sizeof (znode_t), offsetof(znode_t, z_link_node)); - rrm_init(&zfsvfs->z_teardown_lock, B_FALSE); + ZFS_TEARDOWN_INIT(zfsvfs); rw_init(&zfsvfs->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL); rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL); @@ -951,7 +951,7 @@ zfsvfs_free(zfsvfs_t *zfsvfs) mutex_destroy(&zfsvfs->z_znodes_lock); mutex_destroy(&zfsvfs->z_lock); list_destroy(&zfsvfs->z_all_znodes); - rrm_destroy(&zfsvfs->z_teardown_lock); + ZFS_TEARDOWN_DESTROY(zfsvfs); rw_destroy(&zfsvfs->z_teardown_inactive_lock); rw_destroy(&zfsvfs->z_fuid_lock); for (i = 0; i != size; i++) { @@ -1336,7 +1336,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting } } - rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); + ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, FTAG); if (!unmounting) { /* @@ -1367,7 +1367,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting */ if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) { rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); return (SET_ERROR(EIO)); } @@ -1404,7 +1404,7 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting if (unmounting) { zfsvfs->z_unmounted = B_TRUE; rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); } /* @@ -1810,7 +1810,7 @@ zfs_resume_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) int err, err2; znode_t *zp; - ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(ZFS_TEARDOWN_WRITE_HELD(zfsvfs)); ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* @@ -1886,7 +1886,7 @@ bail: /* release the VFS ops */ rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); if (err != 0) { /* @@ -1905,7 +1905,7 @@ bail: int zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) { - ASSERT(RRM_WRITE_HELD(&zfsvfs->z_teardown_lock)); + ASSERT(ZFS_TEARDOWN_WRITE_HELD(zfsvfs)); ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock)); /* @@ -1923,7 +1923,7 @@ zfs_end_fs(zfsvfs_t *zfsvfs, dsl_dataset_t *ds) /* release the VOPs */ rw_exit(&zfsvfs->z_teardown_inactive_lock); - rrm_exit(&zfsvfs->z_teardown_lock, FTAG); + ZFS_TEARDOWN_EXIT(zfsvfs, FTAG); /* * Try to force unmount this file system. Modified: head/sys/contrib/openzfs/module/zfs/zfs_ioctl.c ============================================================================== --- head/sys/contrib/openzfs/module/zfs/zfs_ioctl.c Wed Nov 4 21:19:25 2020 (r367344) +++ head/sys/contrib/openzfs/module/zfs/zfs_ioctl.c Wed Nov 4 21:19:54 2020 (r367345) @@ -1407,15 +1407,17 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zf if (getzfsvfs(name, zfvp) != 0) error = zfsvfs_create(name, B_FALSE, zfvp); if (error == 0) { - rrm_enter(&(*zfvp)->z_teardown_lock, (writer) ? RW_WRITER : - RW_READER, tag); + if (writer) + ZFS_TEARDOWN_ENTER_WRITE(*zfvp, tag); + else + ZFS_TEARDOWN_ENTER_READ(*zfvp, tag); if ((*zfvp)->z_unmounted) { /* * XXX we could probably try again, since the unmounting * thread should be just about to disassociate the * objset from the zfsvfs. */ - rrm_exit(&(*zfvp)->z_teardown_lock, tag); + ZFS_TEARDOWN_EXIT(*zfvp, tag); return (SET_ERROR(EBUSY)); } } @@ -1425,7 +1427,7 @@ zfsvfs_hold(const char *name, void *tag, zfsvfs_t **zf static void zfsvfs_rele(zfsvfs_t *zfsvfs, void *tag) { - rrm_exit(&zfsvfs->z_teardown_lock, tag); + ZFS_TEARDOWN_EXIT(zfsvfs, tag); if (zfs_vfs_held(zfsvfs)) { zfs_vfs_rele(zfsvfs); From owner-svn-src-head@freebsd.org Wed Nov 4 21:22:42 2020 Return-Path: Delivered-To: svn-src-head@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 5E12B466B8D; Wed, 4 Nov 2020 21:22:42 +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 4CRKPG1lNZz4J0P; Wed, 4 Nov 2020 21:22:42 +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 04D7113CC4; Wed, 4 Nov 2020 21:22:42 +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 0A4LMfCf083145; Wed, 4 Nov 2020 21:22:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LMfaw083144; Wed, 4 Nov 2020 21:22:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042122.0A4LMfaw083144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:22:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367346 - head/sys/contrib/openzfs/include/os/freebsd/zfs/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys X-SVN-Commit-Revision: 367346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:22:42 -0000 Author: mjg Date: Wed Nov 4 21:22:41 2020 New Revision: 367346 URL: https://svnweb.freebsd.org/changeset/base/367346 Log: zfs: use rms lock for teardown handling This deserializes otherwise non-contending operations. The previous scheme of using 17 locks hashed by curthread runs into conflicts very quickly. Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Modified: head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h ============================================================================== --- head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:19:54 2020 (r367345) +++ head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_vfsops_os.h Wed Nov 4 21:22:41 2020 (r367346) @@ -28,6 +28,10 @@ #define _SYS_FS_ZFS_VFSOPS_H #if __FreeBSD_version >= 1300109 +#define TEARDOWN_RMS +#endif + +#if __FreeBSD_version >= 1300109 #define TEARDOWN_INACTIVE_RMS #endif @@ -46,7 +50,11 @@ extern "C" { #endif +#ifdef TEARDOWN_RMS +typedef struct rmslock zfs_teardown_lock_t; +#else #define zfs_teardown_lock_t rrmlock_t +#endif #ifdef TEARDOWN_INACTIVE_RMS typedef struct rmslock zfs_teardown_inactive_lock_t; @@ -114,7 +122,41 @@ struct zfsvfs { struct task z_unlinked_drain_task; }; +#ifdef TEARDOWN_RMS #define ZFS_TEARDOWN_INIT(zfsvfs) \ + rms_init(&(zfsvfs)->z_teardown_lock, "zfs teardown") + +#define ZFS_TEARDOWN_DESTROY(zfsvfs) \ + rms_destroy(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_TRY_ENTER_READ(zfsvfs) \ + rms_try_rlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_ENTER_READ(zfsvfs, tag) \ + rms_rlock(&(zfsvfs)->z_teardown_lock); + +#define ZFS_TEARDOWN_EXIT_READ(zfsvfs, tag) \ + rms_runlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_ENTER_WRITE(zfsvfs, tag) \ + rms_wlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_EXIT_WRITE(zfsvfs) \ + rms_wunlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_EXIT(zfsvfs, tag) \ + rms_unlock(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_READ_HELD(zfsvfs) \ + rms_rowned(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_WRITE_HELD(zfsvfs) \ + rms_wowned(&(zfsvfs)->z_teardown_lock) + +#define ZFS_TEARDOWN_HELD(zfsvfs) \ + rms_owned_any(&(zfsvfs)->z_teardown_lock) +#else +#define ZFS_TEARDOWN_INIT(zfsvfs) \ rrm_init(&(zfsvfs)->z_teardown_lock, B_FALSE) #define ZFS_TEARDOWN_DESTROY(zfsvfs) \ @@ -146,6 +188,7 @@ struct zfsvfs { #define ZFS_TEARDOWN_HELD(zfsvfs) \ RRM_LOCK_HELD(&(zfsvfs)->z_teardown_lock) +#endif #ifdef TEARDOWN_INACTIVE_RMS #define ZFS_TEARDOWN_INACTIVE_INIT(zfsvfs) \ From owner-svn-src-head@freebsd.org Wed Nov 4 21:23:26 2020 Return-Path: Delivered-To: svn-src-head@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 8089B466BA6; Wed, 4 Nov 2020 21:23:26 +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 4CRKQ62cqwz4J8P; Wed, 4 Nov 2020 21:23:26 +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 3D2E5140BF; Wed, 4 Nov 2020 21:23:26 +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 0A4LNQ7q083224; Wed, 4 Nov 2020 21:23:26 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LNQ8Y083223; Wed, 4 Nov 2020 21:23:26 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042123.0A4LNQ8Y083223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 21:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367347 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 367347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:23:26 -0000 Author: mjg Date: Wed Nov 4 21:23:25 2020 New Revision: 367347 URL: https://svnweb.freebsd.org/changeset/base/367347 Log: Bump __FreeBSD_version after rms changes Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Wed Nov 4 21:22:41 2020 (r367346) +++ head/sys/sys/param.h Wed Nov 4 21:23:25 2020 (r367347) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300124 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300125 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Wed Nov 4 21:31:45 2020 Return-Path: Delivered-To: svn-src-head@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 62543466B73; Wed, 4 Nov 2020 21:31:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CRKbh3M5mz4JL8; Wed, 4 Nov 2020 21:31:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) X-Originating-IP: 93.72.151.96 Received: from [192.168.0.88] (east.meadow.volia.net [93.72.151.96]) (Authenticated sender: andriy.gapon@uabsd.com) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 56601C0008; Wed, 4 Nov 2020 21:31:35 +0000 (UTC) Subject: Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011042118.0A4LIq3H077210@repo.freebsd.org> Cc: Mateusz Guzik , Matt Macy From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; keydata= mDMEX1iFDhYJKwYBBAHaRw8BAQdAiu8JG/oLFkVkOAJqJc7Dx5KI/Q6C3SBI20EQm+DXnAu0 HkFuZHJpeSBHYXBvbiA8YXZnQEZyZWVCU0Qub3JnPoiWBBMWCAA+FiEEyCHHZM09l0OE3Ir/ 1A1+Gq8+L1EFAl9YhQ4CGwMFCQeEzgAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ1A1+ Gq8+L1Fc0wD/ZjmhHfbCJywZU3aOxXIPjcz73FYEGMvqMCCLAWyLbSABALFL+1ZNrjV3BGjq 889cOYFuboA/Yn3eWezS+tfqYBsGuDgEX1iFDhIKKwYBBAGXVQEFAQEHQL6B20Xi600TrkpG P9fWjl7JtHNxqrHKhX6Kg7kgb4ILAwEIB4h+BBgWCAAmFiEEyCHHZM09l0OE3Ir/1A1+Gq8+ L1EFAl9YhQ4CGwwFCQeEzgAACgkQ1A1+Gq8+L1F3cgEAktp4h+IJUJxL1vn6zMOt//znni/J TanKfQuA8wGXcGkBAKpZJhqMkg+pKk7MGvJhgJ6nCpTZ+rMK6vZVZLUWc3QF Message-ID: <4cecdc18-e9e9-4319-2502-e8c69a94aba5@FreeBSD.org> Date: Wed, 4 Nov 2020 23:31:34 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <202011042118.0A4LIq3H077210@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CRKbh3M5mz4JL8 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; ASN(0.00)[asn:29169, ipnet:217.70.176.0/20, country:FR]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:31:45 -0000 On 04/11/2020 23:18, Mateusz Guzik wrote: > Author: mjg > Date: Wed Nov 4 21:18:51 2020 > New Revision: 367343 > URL: https://svnweb.freebsd.org/changeset/base/367343 > > Log: > zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros > > They are expected to fail only in corner cases. > > Modified: > head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h > head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? Can I do the same? Who will be resolving any merge conflicts resulting from my changes? -- Andriy Gapon From owner-svn-src-head@freebsd.org Wed Nov 4 21:33:44 2020 Return-Path: Delivered-To: svn-src-head@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 6D25A466C7C; Wed, 4 Nov 2020 21:33:44 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 4CRKf00pFlz4Jj6; Wed, 4 Nov 2020 21:33:43 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x335.google.com with SMTP id c9so3770993wml.5; Wed, 04 Nov 2020 13:33:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=HOb+xZfVnnx3ILax4hFFOCnudX+rKhmroMYbNlQSg4s=; b=iezW1HBnYdhq0VuuvAXSnoNRJldBgBIjUv72RXGIHNPfNTKKpM+lDY8Jd589AAkoi9 vvJKakS24pjTDPTRi04HMWxK/TDZxOwO3FaJhFtQxEiKa8pPVsgRiFPvuY7Bj4jZ3ITX Pg47MZWo/wNjipNradA3L053vtCUw+tvFnXoEYTwGYgsmRShMli/xwXejxr34EwvxE1c mimKtRxrGitnAjHnZaBdKd+9PRcJqcHeSdqIpz7172ZNsowa1kV9RlRPK6VoaAEoV0rY wmIfat8O2mUDpMVxpvYOGwazCzwT/yMStckzSmMf7sQR9Ecde5ZI8nLbx5qKqYNrFsRa R1Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=HOb+xZfVnnx3ILax4hFFOCnudX+rKhmroMYbNlQSg4s=; b=s8h5kTOc+5H84BYvc13J0DEoMl9zneZ+aLkYEYdTrOSKMlYkgYCukiOjqgWJYY82i5 Xek6f1be+8WBJezg/NZNG2CKN+qGVcrHvuC/Hyf2n7CrM1YmYE+Ln690D8BojtLw3Bdi H7CmabuCuCmXf/4pTqBXiYfbuFVTLlTwvs1+uw4EyzzjNIRP73oknVU+W5AnwjZjjkAn xojDfg2Omo+tri7brIr/ReXw/KY8Fecz31ZeCr9E1xww2+O8LDvkgEpFzFpG19BrXQ38 hh48h8WhDCBH6wjWnPDP/KEBZ3SauFlmVgsbVlzLIvm+rScXz+HGrVkiOiSS4wZcLdqw 2Mgg== X-Gm-Message-State: AOAM530roJUxu2gys5jnfHVq+xhtpNvqvbHh1PloDgdivF1GhU6sHDu+ F7fzCG7riv/HH+DzUYDzbAXBCXhttkBFxBf0KS6YytawtJ8= X-Google-Smtp-Source: ABdhPJzC+98ZabSq86DaNOn6C1ym6cjNleFEVnu2+1UeW4z9/slwXi1BkpNsRG+f/S+8zcmJKovOkRGdADDBXQHMMlA= X-Received: by 2002:a1c:e442:: with SMTP id b63mr504051wmh.10.1604525621466; Wed, 04 Nov 2020 13:33:41 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4c4f:0:0:0:0:0 with HTTP; Wed, 4 Nov 2020 13:33:40 -0800 (PST) In-Reply-To: <4cecdc18-e9e9-4319-2502-e8c69a94aba5@FreeBSD.org> References: <202011042118.0A4LIq3H077210@repo.freebsd.org> <4cecdc18-e9e9-4319-2502-e8c69a94aba5@FreeBSD.org> From: Mateusz Guzik Date: Wed, 4 Nov 2020 22:33:40 +0100 Message-ID: Subject: Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys To: Andriy Gapon Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Matt Macy Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CRKf00pFlz4Jj6 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:33:44 -0000 Well, should you check OpenZFS github you will find I post pull request there as well. So whatever conflicts arise for people merging stuff back are to be just whacked in favor in what's in upstream. On 11/4/20, Andriy Gapon wrote: > On 04/11/2020 23:18, Mateusz Guzik wrote: >> Author: mjg >> Date: Wed Nov 4 21:18:51 2020 >> New Revision: 367343 >> URL: https://svnweb.freebsd.org/changeset/base/367343 >> >> Log: >> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros >> >> They are expected to fail only in corner cases. >> >> Modified: >> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h >> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h > > Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? > Can I do the same? > Who will be resolving any merge conflicts resulting from my changes? > > -- > Andriy Gapon > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Wed Nov 4 21:36:12 2020 Return-Path: Delivered-To: svn-src-head@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 50F45466DB5; Wed, 4 Nov 2020 21:36:12 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CRKhq3ypMz4JwX; Wed, 4 Nov 2020 21:36:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) X-Originating-IP: 93.72.151.96 Received: from [192.168.0.88] (east.meadow.volia.net [93.72.151.96]) (Authenticated sender: andriy.gapon@uabsd.com) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 15C6640002; Wed, 4 Nov 2020 21:36:02 +0000 (UTC) Subject: Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, Matt Macy References: <202011042118.0A4LIq3H077210@repo.freebsd.org> <4cecdc18-e9e9-4319-2502-e8c69a94aba5@FreeBSD.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; keydata= mDMEX1iFDhYJKwYBBAHaRw8BAQdAiu8JG/oLFkVkOAJqJc7Dx5KI/Q6C3SBI20EQm+DXnAu0 HkFuZHJpeSBHYXBvbiA8YXZnQEZyZWVCU0Qub3JnPoiWBBMWCAA+FiEEyCHHZM09l0OE3Ir/ 1A1+Gq8+L1EFAl9YhQ4CGwMFCQeEzgAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ1A1+ Gq8+L1Fc0wD/ZjmhHfbCJywZU3aOxXIPjcz73FYEGMvqMCCLAWyLbSABALFL+1ZNrjV3BGjq 889cOYFuboA/Yn3eWezS+tfqYBsGuDgEX1iFDhIKKwYBBAGXVQEFAQEHQL6B20Xi600TrkpG P9fWjl7JtHNxqrHKhX6Kg7kgb4ILAwEIB4h+BBgWCAAmFiEEyCHHZM09l0OE3Ir/1A1+Gq8+ L1EFAl9YhQ4CGwwFCQeEzgAACgkQ1A1+Gq8+L1F3cgEAktp4h+IJUJxL1vn6zMOt//znni/J TanKfQuA8wGXcGkBAKpZJhqMkg+pKk7MGvJhgJ6nCpTZ+rMK6vZVZLUWc3QF Message-ID: <68c25132-2d3b-5028-dc6a-db5f252842d7@FreeBSD.org> Date: Wed, 4 Nov 2020 23:36:01 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Firefox/60.0 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CRKhq3ypMz4JwX X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:29169, ipnet:217.70.176.0/20, country:FR]; local_wl_from(0.00)[FreeBSD.org] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:36:12 -0000 On 04/11/2020 23:33, Mateusz Guzik wrote: > Well, should you check OpenZFS github you will find I post pull > request there as well. So whatever conflicts arise for people merging > stuff back are to be just whacked in favor in what's in upstream. I certainly would, but how would I know that I should? Any cross-reference would be of help both now and for the future code history archaeology. > On 11/4/20, Andriy Gapon wrote: >> On 04/11/2020 23:18, Mateusz Guzik wrote: >>> Author: mjg >>> Date: Wed Nov 4 21:18:51 2020 >>> New Revision: 367343 >>> URL: https://svnweb.freebsd.org/changeset/base/367343 >>> >>> Log: >>> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros >>> >>> They are expected to fail only in corner cases. >>> >>> Modified: >>> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h >>> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h >> >> Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? >> Can I do the same? >> Who will be resolving any merge conflicts resulting from my changes? >> >> -- >> Andriy Gapon >> > > -- Andriy Gapon From owner-svn-src-head@freebsd.org Wed Nov 4 21:39:05 2020 Return-Path: Delivered-To: svn-src-head@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 916EA466CF7; Wed, 4 Nov 2020 21:39:05 +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 4CRKm93KDvz4K4k; Wed, 4 Nov 2020 21:39:05 +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 55CAD141DC; Wed, 4 Nov 2020 21:39:05 +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 0A4Ld5wR089563; Wed, 4 Nov 2020 21:39:05 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4Ld5BT089562; Wed, 4 Nov 2020 21:39:05 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011042139.0A4Ld5BT089562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Wed, 4 Nov 2020 21:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367348 - 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: 367348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:39:05 -0000 Author: trasz Date: Wed Nov 4 21:39:04 2020 New Revision: 367348 URL: https://svnweb.freebsd.org/changeset/base/367348 Log: Unbreak buildworld after r367339. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/compat/linux/linux_errno.h Modified: head/sys/compat/linux/linux_errno.h ============================================================================== --- head/sys/compat/linux/linux_errno.h Wed Nov 4 21:23:25 2020 (r367347) +++ head/sys/compat/linux/linux_errno.h Wed Nov 4 21:39:04 2020 (r367348) @@ -180,8 +180,6 @@ #define LINUX_ERFKILL 132 #define LINUX_EHWPOISON 133 -#ifdef _KERNEL #define LINUX_ELAST LINUX_EHWPOISON -#endif #endif /* _LINUX_ERRNO_H_ */ From owner-svn-src-head@freebsd.org Wed Nov 4 21:52:11 2020 Return-Path: Delivered-To: svn-src-head@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 294FE467726; Wed, 4 Nov 2020 21:52:11 +0000 (UTC) (envelope-from wulf@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 4CRL3H0Lqgz4LDh; Wed, 4 Nov 2020 21:52:11 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 E386C1456D; Wed, 4 Nov 2020 21:52:10 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4LqARF001575; Wed, 4 Nov 2020 21:52:10 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4LqA72001574; Wed, 4 Nov 2020 21:52:10 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202011042152.0A4LqA72001574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Wed, 4 Nov 2020 21:52:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367349 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 367349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 21:52:11 -0000 Author: wulf Date: Wed Nov 4 21:52:10 2020 New Revision: 367349 URL: https://svnweb.freebsd.org/changeset/base/367349 Log: atkbdc(4): Add quirk for "System76 lemur Pro" laptops. Currently atkbdc(4) assumes all coreboot BIOSes belonging to Chromebooks and unconditionally sets a number of quirks to workaround known issues. Exclude "System76" laptops from this set as they appeared to be a traditional hardware ("lemur Pro" is a rebranded Clevo chassis) with coreboot firmware on board. KBDC_QUIRK_KEEP_ACTIVATED quirk activated for Chromebook platform makes keyboard on this devices inoperable. "Purism Librem" laptops may require the same exclusion too. PR: 250711 Reported by: nick.lott@gmail.com MFC after: 2 weeks Modified: head/sys/dev/atkbdc/atkbdc.c Modified: head/sys/dev/atkbdc/atkbdc.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc.c Wed Nov 4 21:39:04 2020 (r367348) +++ head/sys/dev/atkbdc/atkbdc.c Wed Nov 4 21:52:10 2020 (r367349) @@ -113,6 +113,7 @@ struct atkbdc_quirks { }; static struct atkbdc_quirks quirks[] = { + {"coreboot", "System76", NULL, 0}, {"coreboot", NULL, NULL, KBDC_QUIRK_KEEP_ACTIVATED | KBDC_QUIRK_IGNORE_PROBE_RESULT | KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT}, From owner-svn-src-head@freebsd.org Wed Nov 4 22:28:17 2020 Return-Path: Delivered-To: svn-src-head@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 7DAFC468057 for ; Wed, 4 Nov 2020 22:28:17 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) (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 4CRLrw1w3nz4MdP for ; Wed, 4 Nov 2020 22:28:15 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb32.google.com with SMTP id a12so226275ybg.9 for ; Wed, 04 Nov 2020 14:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0ksePu1R9hTXEooJSsXNHZl0GM617bRzu2zxzEQlfmg=; b=WQQj9k7CSLIO+WJdW5iKQ5AiSuzgh/9wN/eW1RJSIZdWFLN8Sox6T8tE26zsvcUyPI +gJqW8IHNDjK4ELS10hiW//KZBYwRB6M89ftBwgiyMm7D/Lifp8mj+0W5Vu7Y92eQZ0V 89s/sR1MfI+v5NWZ5Wv2scKSERDQvkcfbUIXg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0ksePu1R9hTXEooJSsXNHZl0GM617bRzu2zxzEQlfmg=; b=YI2l5elohHoDSAH2XroScFxz8XkfW5czKJ71hR0FOYU2yTpbqJLq9Lq+96oRpgQDl8 TI6rFIRiPSaYGCurdC4oA81izkKNreySu/O2eAXsqYSU/roCcrBKVuWo+ZIUi2tO95D/ SisaI/9j+QhTY9DTUUhvrPPanzmO6u4KLtH5ku7/lHgIKsGHK8fxEe3a+z1dhVhcrk7M Zbx4XsfxhtDLk9U49C3PrlxOf+IGRfELgLNrqfqv9z+ACDpvCl8WC5heT9CAl5HT/shQ 1CcXtWo1IJu9vU1B1OeTx6o+zjF0KwHaMhqahPtFojCMExTQm/Sq6GJIGikrbNa4e2wc qtdw== X-Gm-Message-State: AOAM531KLb7I7zh4Z7y/mc4gJLQnHBQWZixH9RAF5CGSUPSH4RrKF2/q Tyw14FYH0R/OEgHA1hJMGsqQa93ylMCX19yR2FD2bg== X-Google-Smtp-Source: ABdhPJxMprbYXtHG3/0IwI1tLnrxuQhHJn0n3zHXAckuQ7YyETqqbeFbvRKt0asuyni5944OJlHxKKy1Xmw3P2w1gao= X-Received: by 2002:a25:41c2:: with SMTP id o185mr4624016yba.391.1604528894801; Wed, 04 Nov 2020 14:28:14 -0800 (PST) MIME-Version: 1.0 References: <202011042118.0A4LIq3H077210@repo.freebsd.org> <4cecdc18-e9e9-4319-2502-e8c69a94aba5@FreeBSD.org> <68c25132-2d3b-5028-dc6a-db5f252842d7@FreeBSD.org> In-Reply-To: <68c25132-2d3b-5028-dc6a-db5f252842d7@FreeBSD.org> From: Kevin Bowling Date: Wed, 4 Nov 2020 15:28:03 -0700 Message-ID: Subject: Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys To: Andriy Gapon Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Matt Macy Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CRLrw1w3nz4MdP X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none (invalid DKIM record) header.d=kev009.com header.s=google header.b=WQQj9k7C; dmarc=none; spf=pass (mx1.freebsd.org: domain of kevin.bowling@kev009.com designates 2607:f8b0:4864:20::b32 as permitted sender) smtp.mailfrom=kevin.bowling@kev009.com X-Spamd-Result: default: False [-2.17 / 15.00]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.005]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.04)[-1.041]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[kev009.com]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.17)[0.172]; DKIM_TRACE(0.00)[kev009.com:~]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::b32:from]; R_DKIM_PERMFAIL(0.00)[kev009.com:s=google]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FREEMAIL_CC(0.00)[gmail.com,freebsd.org]; MAILMAN_DEST(0.00)[svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 22:28:17 -0000 This doesn't answer all of your questions but one important thing to point out is that Mateusz is in communication with the OpenZFS and iX folks to coordinate these changes and avoid expected merge conflicts. The idealized workflow is that a change goes into OZFS first, but as long as folks are in agreement that can be expedited. Once src is on git, it is expected this type of cherry-pick in both directions will be easier to formally define. Regards, Kevin On Wed, Nov 4, 2020 at 2:36 PM Andriy Gapon wrote: > > On 04/11/2020 23:33, Mateusz Guzik wrote: > > Well, should you check OpenZFS github you will find I post pull > > request there as well. So whatever conflicts arise for people merging > > stuff back are to be just whacked in favor in what's in upstream. > > I certainly would, but how would I know that I should? > Any cross-reference would be of help both now and for the future code history > archaeology. > > > On 11/4/20, Andriy Gapon wrote: > >> On 04/11/2020 23:18, Mateusz Guzik wrote: > >>> Author: mjg > >>> Date: Wed Nov 4 21:18:51 2020 > >>> New Revision: 367343 > >>> URL: https://svnweb.freebsd.org/changeset/base/367343 > >>> > >>> Log: > >>> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros > >>> > >>> They are expected to fail only in corner cases. > >>> > >>> Modified: > >>> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h > >>> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h > >> > >> Picking a random commit of many, is this how we do ZFS/OpenZFS changes now? > >> Can I do the same? > >> Who will be resolving any merge conflicts resulting from my changes? > >> > >> -- > >> Andriy Gapon > >> > > > > > > > -- > Andriy Gapon > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-head@freebsd.org Wed Nov 4 22:29:04 2020 Return-Path: Delivered-To: svn-src-head@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 DAA114680E3; Wed, 4 Nov 2020 22:29:04 +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 4CRLsr5pWQz4NBh; Wed, 4 Nov 2020 22:29:04 +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 A64A314B95; Wed, 4 Nov 2020 22:29:04 +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 0A4MT44V020298; Wed, 4 Nov 2020 22:29:04 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4MT1w4020283; Wed, 4 Nov 2020 22:29:01 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011042229.0A4MT1w4020283@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: Wed, 4 Nov 2020 22:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367350 - in head/usr.bin/calendar: . tests X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: in head/usr.bin/calendar: . tests X-SVN-Commit-Revision: 367350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 22:29:04 -0000 Author: se Date: Wed Nov 4 22:29:01 2020 New Revision: 367350 URL: https://svnweb.freebsd.org/changeset/base/367350 Log: Add regression tests for conditions and comments Fix one case where #else was not corerctly processed and simplify the conditions logic. Fix parsing of day and month names in the locale specified in the calendar file. The previous version would expect those names to match the locale of the user. Mention that comments are now correctly processed and that // is supported in addition to /* ... */. MFC after: 3 days Added: head/usr.bin/calendar/tests/calendar.comment (contents, props changed) head/usr.bin/calendar/tests/calendar.cond (contents, props changed) head/usr.bin/calendar/tests/comment.sh (contents, props changed) head/usr.bin/calendar/tests/comment_test.sh (contents, props changed) head/usr.bin/calendar/tests/cond.sh (contents, props changed) head/usr.bin/calendar/tests/cond_test.sh (contents, props changed) head/usr.bin/calendar/tests/regress.comment.out (contents, props changed) head/usr.bin/calendar/tests/regress.cond.out (contents, props changed) Modified: head/usr.bin/calendar/calendar.1 head/usr.bin/calendar/calendar.h head/usr.bin/calendar/dates.c head/usr.bin/calendar/events.c head/usr.bin/calendar/io.c head/usr.bin/calendar/tests/Makefile Directory Properties: head/usr.bin/calendar/tests/regress.a1.out (props changed) head/usr.bin/calendar/tests/regress.a2.out (props changed) head/usr.bin/calendar/tests/regress.a3.out (props changed) head/usr.bin/calendar/tests/regress.a4.out (props changed) head/usr.bin/calendar/tests/regress.a5.out (props changed) head/usr.bin/calendar/tests/regress.b1.out (props changed) head/usr.bin/calendar/tests/regress.b2.out (props changed) head/usr.bin/calendar/tests/regress.b3.out (props changed) head/usr.bin/calendar/tests/regress.b4.out (props changed) head/usr.bin/calendar/tests/regress.b5.out (props changed) head/usr.bin/calendar/tests/regress.s1.out (props changed) head/usr.bin/calendar/tests/regress.s2.out (props changed) head/usr.bin/calendar/tests/regress.s3.out (props changed) head/usr.bin/calendar/tests/regress.s4.out (props changed) head/usr.bin/calendar/tests/regress.s5.out (props changed) head/usr.bin/calendar/tests/regress.w0-1.out (props changed) head/usr.bin/calendar/tests/regress.w0-2.out (props changed) head/usr.bin/calendar/tests/regress.w0-3.out (props changed) head/usr.bin/calendar/tests/regress.w0-4.out (props changed) head/usr.bin/calendar/tests/regress.w0-5.out (props changed) head/usr.bin/calendar/tests/regress.w0-6.out (props changed) head/usr.bin/calendar/tests/regress.w0-7.out (props changed) head/usr.bin/calendar/tests/regress.wn-1.out (props changed) head/usr.bin/calendar/tests/regress.wn-2.out (props changed) head/usr.bin/calendar/tests/regress.wn-3.out (props changed) head/usr.bin/calendar/tests/regress.wn-4.out (props changed) head/usr.bin/calendar/tests/regress.wn-5.out (props changed) head/usr.bin/calendar/tests/regress.wn-6.out (props changed) head/usr.bin/calendar/tests/regress.wn-7.out (props changed) Modified: head/usr.bin/calendar/calendar.1 ============================================================================== --- head/usr.bin/calendar/calendar.1 Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/calendar.1 Wed Nov 4 22:29:01 2020 (r367350) @@ -28,7 +28,7 @@ .\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd October 28, 2020 +.Dd November 4, 2020 .Dt CALENDAR 1 .Os .Sh NAME @@ -218,12 +218,14 @@ If the shared file is not referenced by a full pathnam searches in the current (or home) directory first, and then in the directory .Pa /usr/share/calendar . -Empty lines and lines protected by the C commenting syntax +Empty lines and text protected by the C commenting syntax .Pq Li /* ... */ +or +.Pq Li // are ignored. .Pp Some possible calendar entries ( characters highlighted by -\fB\et\fR sequence) +\fB\et\fR sequence): .Bd -unfilled -offset indent LANG=C Easter=Ostern Modified: head/usr.bin/calendar/calendar.h ============================================================================== --- head/usr.bin/calendar/calendar.h Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/calendar.h Wed Nov 4 22:29:01 2020 (r367350) @@ -122,7 +122,7 @@ extern int year1, year2; * - Use event_continue() to add more text to the last added event * - Use event_print_all() to display them in time chronological order */ -struct event *event_add(int, int, int, char *, int, char *, char *); +struct event *event_add(int, int, int, int, char *, char *); void event_continue(struct event *events, char *txt); void event_print_all(FILE *fp); struct event { @@ -189,7 +189,7 @@ int remember_yd(int y, int d, int *rm, int *rd); int first_dayofweek_of_year(int y); int first_dayofweek_of_month(int y, int m); int walkthrough_dates(struct event **e); -void addtodate(struct event *e, int year, int month, int day); +void addtodate(struct event *e); /* pom.c */ #define MAXMOONS 18 Modified: head/usr.bin/calendar/dates.c ============================================================================== --- head/usr.bin/calendar/dates.c Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/dates.c Wed Nov 4 22:29:01 2020 (r367350) @@ -444,12 +444,12 @@ find_day(int yy, int mm, int dd) } void -addtodate(struct event *e, int year, int month, int day) +addtodate(struct event *e) { struct cal_day *d; struct event *ee; - d = find_day(year, month, day); + d = find_day(e->year, e->month, e->day); ee = d->lastevent; if (ee != NULL) ee->next = e; Modified: head/usr.bin/calendar/events.c ============================================================================== --- head/usr.bin/calendar/events.c Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/events.c Wed Nov 4 22:29:01 2020 (r367350) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include static iconv_t conv = (iconv_t)-1; static char *currentEncoding = NULL; @@ -150,8 +151,7 @@ convert(char *input) } struct event * -event_add(int year, int month, int day, char *date, int var, char *txt, - char *extra) +event_add(int year, int month, int day, int var, char *txt, char *extra) { struct event *e; @@ -159,25 +159,22 @@ event_add(int year, int month, int day, char *date, in * Creating a new event: * - Create a new event * - Copy the machine readable day and month - * - Copy the human readable and language specific date * - Copy the text of the event */ e = (struct event *)calloc(1, sizeof(struct event)); if (e == NULL) errx(1, "event_add: cannot allocate memory"); + e->year = year; e->month = month; e->day = day; e->var = var; - e->date = convert(date); - if (e->date == NULL) - errx(1, "event_add: cannot allocate memory"); e->text = convert(txt); if (e->text == NULL) errx(1, "event_add: cannot allocate memory"); e->extra = NULL; if (extra != NULL && extra[0] != '\0') e->extra = convert(extra); - addtodate(e, year, month, day); + addtodate(e); return (e); } @@ -204,20 +201,37 @@ void event_print_all(FILE *fp) { struct event *e; + struct tm tm; + char dbuf[80]; + static int d_first; + const char *lang; + lang = getenv("LANG"); + if (lang == NULL) + lang = "C"; + if (setlocale(LC_ALL, lang) == NULL) + (void)setlocale(LC_ALL, "C"); + d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); + while (walkthrough_dates(&e) != 0) { + if (e) { #ifdef DEBUG - if (e) fprintf(stderr, "event_print_all month: %d, day: %d\n", e->month, e->day); #endif + memset(&tm, 0, sizeof(struct tm)); + tm.tm_mday = e->day; + tm.tm_mon = e->month - 1; + tm.tm_year = e->year - 1900; + (void)strftime(dbuf, sizeof(dbuf), d_first ? "%e %b" : "%b %e", &tm); + } /* * Go through all events and print the text of the matching * dates */ while (e != NULL) { - (void)fprintf(fp, "%s%c%s%s%s%s\n", e->date, + (void)fprintf(fp, "%s%c%s%s%s%s\n", dbuf, e->var ? '*' : ' ', e->text, e->extra != NULL ? " (" : "", e->extra != NULL ? e->extra : "", Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/io.c Wed Nov 4 22:29:01 2020 (r367350) @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -159,7 +158,9 @@ cal_path(void) { static char buffer[MAXPATHLEN + 10]; - if (cal_dir[0] == '/') + if (cal_dir == NULL) + snprintf(buffer, sizeof(buffer), "%s", cal_file); + else if (cal_dir[0] == '/') snprintf(buffer, sizeof(buffer), "%s/%s", cal_dir, cal_file); else snprintf(buffer, sizeof(buffer), "%s/%s/%s", cal_home, cal_dir, cal_file); @@ -181,14 +182,14 @@ token(char *line, FILE *out, int *skip, int *unskip) int this_cal_line; if (strncmp(line, "endif", 5) == 0) { - if (*skip > 0) - --*skip; - else if (*unskip > 0) - --*unskip; - else { + if (*skip + *unskip == 0) { WARN0("#endif without prior #ifdef or #ifndef"); return (T_ERR); } + if (*skip > 0) + --*skip; + else + --*unskip; return (T_OK); } @@ -247,18 +248,17 @@ token(char *line, FILE *out, int *skip, int *unskip) WARN0("Expecting no arguments after #else"); return (T_ERR); } + if (*skip + *unskip == 0) { + WARN0("#else without prior #ifdef or #ifndef"); + return (T_ERR); + } - if (*unskip == 0) { - if (*skip == 0) { - WARN0("#else without prior #ifdef or #ifndef"); - return (T_ERR); - } else if (*skip == 1) { - *skip = 0; - *unskip = 1; - } - } else if (*unskip == 1) { - *skip = 1; - *unskip = 0; + if (*skip == 0) { + ++*skip; + --*unskip; + } else if (*skip == 1) { + --*skip; + ++*unskip; } return (T_OK); @@ -366,7 +366,6 @@ cal_parse(FILE *in, FILE *out) size_t linecap = 0; ssize_t linelen; ssize_t l; - static int d_first = -1; static int count = 0; int i; int month[MAXCOUNT]; @@ -374,19 +373,11 @@ cal_parse(FILE *in, FILE *out) int year[MAXCOUNT]; int skip = 0; int unskip = 0; - char dbuf[80]; char *pp, p; - struct tm tm; int flags; char *c, *cc; bool incomment = false; - /* Unused */ - tm.tm_sec = 0; - tm.tm_min = 0; - tm.tm_hour = 0; - tm.tm_wday = 0; - if (in == NULL) return (1); @@ -468,7 +459,7 @@ cal_parse(FILE *in, FILE *out) * and does not run iconv(), this variable has little use. */ if (strncmp(buf, "LANG=", 5) == 0) { - (void)setlocale(LC_CTYPE, buf + 5); + (void)setlocale(LC_ALL, buf + 5); #ifdef WITH_ICONV if (!doall) set_new_encoding(); @@ -532,18 +523,10 @@ cal_parse(FILE *in, FILE *out) while (pp[1] == '\t') pp++; - if (d_first < 0) - d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); - for (i = 0; i < count; i++) { - tm.tm_mon = month[i] - 1; - tm.tm_mday = day[i]; - tm.tm_year = year[i] - 1900; - (void)strftime(dbuf, sizeof(dbuf), - d_first ? "%e %b" : "%b %e", &tm); if (debug) WARN1("got \"%s\"", pp); - events[i] = event_add(year[i], month[i], day[i], dbuf, + events[i] = event_add(year[i], month[i], day[i], ((flags &= F_VARIABLE) != 0) ? 1 : 0, pp, extradata[i]); } @@ -592,6 +575,7 @@ opencalin(void) FILE *fpin; /* open up calendar file */ + cal_file = calendarFile; if ((fpin = fopen(calendarFile, "r")) == NULL) { if (doall) { if (chdir(calendarHomes[0]) != 0) Modified: head/usr.bin/calendar/tests/Makefile ============================================================================== --- head/usr.bin/calendar/tests/Makefile Wed Nov 4 21:52:10 2020 (r367349) +++ head/usr.bin/calendar/tests/Makefile Wed Nov 4 22:29:01 2020 (r367350) @@ -2,9 +2,17 @@ PACKAGE= tests -TAP_TESTS_SH= legacy_test +TAP_TESTS_SH= comment_test cond_test legacy_test +TEST_METADATA.comment_test+= timeout="600" +TEST_METADATA.cond_test+= timeout="600" TEST_METADATA.legacy_test+= timeout="600" + +${PACKAGE}FILES+= calendar.comment +${PACKAGE}FILES+= regress.comment.out + +${PACKAGE}FILES+= calendar.cond +${PACKAGE}FILES+= regress.cond.out ${PACKAGE}FILES+= calendar.calibrate ${PACKAGE}FILES+= regress.a1.out Added: head/usr.bin/calendar/tests/calendar.comment ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/calendar.comment Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,10 @@ +1 1 jan 1 // comment +1 2 jan 2 /* comment */ +1 3 jan /* comment */3 +1 4 /* comment*/jan 4 +// comment +/* comment */1 5 jan 5 +1/* comment */ 6 jan 6 +1 7 jan 7 // /* comment */ comment +1 1/* comment */1 jan /* comment */11 // comment + Added: head/usr.bin/calendar/tests/calendar.cond ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/calendar.cond Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,83 @@ +#define DEF1 + +1 1 jan 1 OK + +#ifdef DEF1 +1 2 jan 2 OK +#endif + +1 3 jan 3 OK + +#ifdef DEF2 +1 4 jan 4 NOT OK +#else +1 5 jan 5 OK +#endif + +#ifndef DEF2 +1 6 jan 6 OK +#else +1 7 jan 7 NOT OK +#endif + +#ifdef DEF1 +#ifndef DEF2 +1 8 jan 8 OK +#endif +#endif + +#ifdef DEF1 +#ifdef DEF2 +1 9 jan 9 NOT OK +#else +1 10 jan 10 OK +#endif +#else +1 11 jan 11 NOT OK +#endif + +#define DEF2 + +#ifndef DEF1 // skip = 1 +#ifndef DEF2 // skip = 2 +1 12 jan 12 NOT OK +#else // skip = 1 unskip = 0 +1 13 jan 13 NOT OK +#endif // skip = 0 unskip = 0 +#else // skip = 0 unskip = 1 +1 14 jan 14 OK +#endif // skip = 0 unskip = 0 + +#undef DEF1 + +#ifdef DEF1 // OFF +#ifdef DEF2 // ON +#ifdef DEF3 // OFF +1 15 jan 15 NOT OK +#else +1 16 jan 16 NOT OK +#endif // DEF3 +#else // DEF2 +#ifdef DEF3 +1 17 jan 17 NOT OK +#else +1 18 jan 18 NOT OK +#endif // DEF3 +#endif // DEF2 +#else // DEF1 +#ifdef DEF2 +#ifdef DEF3 +1 19 jan 19 NOT OK +#else +1 20 jan 20 OK +#endif // DEF3 +#else // DEF2 +#ifdef DEF3 +1 21 jan 21 NOT OK +#else +1 22 jan 22 NOT OK +#endif // DEF3 +#endif // DEF2 +#endif // DEF1 + +1 23 jan 23 OK \ No newline at end of file Added: head/usr.bin/calendar/tests/comment.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/comment.sh Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +CALENDAR_FILE="-f ${SRCDIR}/calendar.comment" +CALENDAR_BIN="calendar" + +CALENDAR="${CALENDAR_BIN} ${CALENDAR_FILE}" + +REGRESSION_START($1) + +echo 1..1 + +REGRESSION_TEST(`comment',`$CALENDAR -t 01.01.2020 -A 30') + +REGRESSION_END() Added: head/usr.bin/calendar/tests/comment_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/comment_test.sh Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ + +SRCDIR="$(dirname "${0}")"; export SRCDIR + +m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/comment.sh" | sh Added: head/usr.bin/calendar/tests/cond.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/cond.sh Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,14 @@ +# $FreeBSD$ + +CALENDAR_FILE="-f ${SRCDIR}/calendar.cond" +CALENDAR_BIN="calendar" + +CALENDAR="${CALENDAR_BIN} ${CALENDAR_FILE}" + +REGRESSION_START($1) + +echo 1..1 + +REGRESSION_TEST(`cond',`$CALENDAR -t 01.01.2020 -A 30') + +REGRESSION_END() Added: head/usr.bin/calendar/tests/cond_test.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/cond_test.sh Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,6 @@ +#!/bin/sh +# $FreeBSD$ + +SRCDIR="$(dirname "${0}")"; export SRCDIR + +m4 "${SRCDIR}/../regress.m4" "${SRCDIR}/cond.sh" | sh Added: head/usr.bin/calendar/tests/regress.comment.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/regress.comment.out Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,8 @@ +Jan 1 jan 1 +Jan 2 jan 2 +Jan 3 jan 3 +Jan 4 jan 4 +Jan 5 jan 5 +Jan 6 jan 6 +Jan 7 jan 7 +Jan 11 jan 11 Added: head/usr.bin/calendar/tests/regress.cond.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/calendar/tests/regress.cond.out Wed Nov 4 22:29:01 2020 (r367350) @@ -0,0 +1,10 @@ +Jan 1 jan 1 OK +Jan 2 jan 2 OK +Jan 3 jan 3 OK +Jan 5 jan 5 OK +Jan 6 jan 6 OK +Jan 8 jan 8 OK +Jan 10 jan 10 OK +Jan 14 jan 14 OK +Jan 20 jan 20 OK +Jan 23 jan 23 OK From owner-svn-src-head@freebsd.org Wed Nov 4 22:41:55 2020 Return-Path: Delivered-To: svn-src-head@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 9CA39468667; Wed, 4 Nov 2020 22:41:55 +0000 (UTC) (envelope-from jkim@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 4CRM8g3W0Mz4P0H; Wed, 4 Nov 2020 22:41:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44D3A14DB7; Wed, 4 Nov 2020 22:41:55 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4MftXe031637; Wed, 4 Nov 2020 22:41:55 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4MfsVH031635; Wed, 4 Nov 2020 22:41:54 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <202011042241.0A4MfsVH031635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 4 Nov 2020 22:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367351 - head/tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/tests/sys/opencrypto X-SVN-Commit-Revision: 367351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 22:41:55 -0000 Author: jkim Date: Wed Nov 4 22:41:54 2020 New Revision: 367351 URL: https://svnweb.freebsd.org/changeset/base/367351 Log: Make the tests work without COMPAT_FREEBSD12 in kernel. sysctl 'kern.cryptodevallowsoft' was renamed to 'kern.crypto.allow_soft' in r359374 and the prevous one is only available in kernel built with "options COMPAT_FREEBSD12". Modified: head/tests/sys/opencrypto/blake2_test.c head/tests/sys/opencrypto/poly1305_test.c head/tests/sys/opencrypto/runtests.sh Modified: head/tests/sys/opencrypto/blake2_test.c ============================================================================== --- head/tests/sys/opencrypto/blake2_test.c Wed Nov 4 22:29:01 2020 (r367350) +++ head/tests/sys/opencrypto/blake2_test.c Wed Nov 4 22:41:54 2020 (r367351) @@ -185,14 +185,14 @@ test_blake2s_vectors(const char *devname, const char * ATF_TC_WITHOUT_HEAD(blake2b_vectors); ATF_TC_BODY(blake2b_vectors, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2b_vectors("cryptosoft0", "nexus/cryptosoft"); } ATF_TC_WITHOUT_HEAD(blake2s_vectors); ATF_TC_BODY(blake2s_vectors, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2s_vectors("cryptosoft0", "nexus/cryptosoft"); } @@ -200,14 +200,14 @@ ATF_TC_BODY(blake2s_vectors, tc) ATF_TC_WITHOUT_HEAD(blake2b_vectors_x86); ATF_TC_BODY(blake2b_vectors_x86, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2b_vectors("blaketwo0", "nexus/blake2"); } ATF_TC_WITHOUT_HEAD(blake2s_vectors_x86); ATF_TC_BODY(blake2s_vectors_x86, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_blake2s_vectors("blaketwo0", "nexus/blake2"); } #endif Modified: head/tests/sys/opencrypto/poly1305_test.c ============================================================================== --- head/tests/sys/opencrypto/poly1305_test.c Wed Nov 4 22:29:01 2020 (r367350) +++ head/tests/sys/opencrypto/poly1305_test.c Wed Nov 4 22:41:54 2020 (r367351) @@ -390,7 +390,7 @@ test_rfc7539_poly1305_vectors(int crid, const char *mo ATF_TC_WITHOUT_HEAD(poly1305_vectors); ATF_TC_BODY(poly1305_vectors, tc) { - ATF_REQUIRE_SYSCTL_INT("kern.cryptodevallowsoft", 1); + ATF_REQUIRE_SYSCTL_INT("kern.crypto.allow_soft", 1); test_rfc7539_poly1305_vectors(CRYPTO_FLAG_SOFTWARE, "nexus/cryptosoft"); } Modified: head/tests/sys/opencrypto/runtests.sh ============================================================================== --- head/tests/sys/opencrypto/runtests.sh Wed Nov 4 22:29:01 2020 (r367350) +++ head/tests/sys/opencrypto/runtests.sh Wed Nov 4 22:41:54 2020 (r367351) @@ -83,7 +83,7 @@ for required_module in $cpu_module cryptodev; do fi done -cdas_sysctl=kern.cryptodevallowsoft +cdas_sysctl=kern.crypto.allow_soft if ! oldcdas=$(sysctl -e $cdas_sysctl); then echo "1..0 # SKIP: could not resolve sysctl: $cdas_sysctl" exit 0 From owner-svn-src-head@freebsd.org Wed Nov 4 23:11:55 2020 Return-Path: Delivered-To: svn-src-head@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 73F38468C12; Wed, 4 Nov 2020 23:11:55 +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 4CRMqH2J7tz4PVp; Wed, 4 Nov 2020 23:11:55 +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 3323515582; Wed, 4 Nov 2020 23:11:55 +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 0A4NBt3T049974; Wed, 4 Nov 2020 23:11:55 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4NBtCH049973; Wed, 4 Nov 2020 23:11:55 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042311.0A4NBtCH049973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 23:11:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367352 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 23:11:55 -0000 Author: mjg Date: Wed Nov 4 23:11:54 2020 New Revision: 367352 URL: https://svnweb.freebsd.org/changeset/base/367352 Log: pipe: fix POLLHUP handling if no events were specified Linux allows polling without any events specified and it happens to be the case in FreeBSD as well. POLLHUP has to be delivered regardless of the event mask and this works fine if the condition is already present. However, if it is missing, selrecord is only called if the eventmask has relevant bits set. This in particular leads to a conditon where pipe_poll can return 0 events and neglect to selrecord, while kern_poll takes it as an indication it has to go to sleep, but then there is nobody to wake it up. While the problem seems systemic to *_poll handlers the least we can do is fix it up for pipes. Reported by: Jeremie Galarneau Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D27094 Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Wed Nov 4 22:41:54 2020 (r367351) +++ head/sys/kern/sys_pipe.c Wed Nov 4 23:11:54 2020 (r367352) @@ -1458,13 +1458,17 @@ pipe_poll(struct file *fp, int events, struct ucred *a } if (revents == 0) { - if (fp->f_flag & FREAD && events & (POLLIN | POLLRDNORM)) { + /* + * Add ourselves regardless of eventmask as we have to return + * POLLHUP even if it was not asked for. + */ + if ((fp->f_flag & FREAD) != 0) { selrecord(td, &rpipe->pipe_sel); if (SEL_WAITING(&rpipe->pipe_sel)) rpipe->pipe_state |= PIPE_SEL; } - if (fp->f_flag & FWRITE && events & (POLLOUT | POLLWRNORM)) { + if ((fp->f_flag & FWRITE)!= 0) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; From owner-svn-src-head@freebsd.org Wed Nov 4 23:17:42 2020 Return-Path: Delivered-To: svn-src-head@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 23EF8469089; Wed, 4 Nov 2020 23:17:42 +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 4CRMxy010Nz4Q4s; Wed, 4 Nov 2020 23:17:42 +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 D79BF15703; Wed, 4 Nov 2020 23:17:41 +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 0A4NHfNr051228; Wed, 4 Nov 2020 23:17:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4NHfn2051227; Wed, 4 Nov 2020 23:17:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011042317.0A4NHfn2051227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 4 Nov 2020 23:17:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367353 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 23:17:42 -0000 Author: mjg Date: Wed Nov 4 23:17:41 2020 New Revision: 367353 URL: https://svnweb.freebsd.org/changeset/base/367353 Log: pipe: whitespace nit in previous Modified: head/sys/kern/sys_pipe.c Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Wed Nov 4 23:11:54 2020 (r367352) +++ head/sys/kern/sys_pipe.c Wed Nov 4 23:17:41 2020 (r367353) @@ -1468,7 +1468,7 @@ pipe_poll(struct file *fp, int events, struct ucred *a rpipe->pipe_state |= PIPE_SEL; } - if ((fp->f_flag & FWRITE)!= 0) { + if ((fp->f_flag & FWRITE) != 0) { selrecord(td, &wpipe->pipe_sel); if (SEL_WAITING(&wpipe->pipe_sel)) wpipe->pipe_state |= PIPE_SEL; From owner-svn-src-head@freebsd.org Wed Nov 4 23:26:15 2020 Return-Path: Delivered-To: svn-src-head@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 CB059468C49; Wed, 4 Nov 2020 23:26:15 +0000 (UTC) (envelope-from jmg@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 4CRN7q50Byz4Qhw; Wed, 4 Nov 2020 23:26:15 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 8A0D4151D9; Wed, 4 Nov 2020 23:26:15 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4NQFtf057146; Wed, 4 Nov 2020 23:26:15 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4NQFJ7057145; Wed, 4 Nov 2020 23:26:15 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <202011042326.0A4NQFJ7057145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Wed, 4 Nov 2020 23:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367354 - head X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 367354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 23:26:15 -0000 Author: jmg Date: Wed Nov 4 23:26:15 2020 New Revision: 367354 URL: https://svnweb.freebsd.org/changeset/base/367354 Log: fix the docs, this was always wrong... In some cases, DISTDIR is set automatically by tools via /etc/make.conf, so remind people (me) where to find where it's set.. It would be nice for someone to document what DISTDIR is better than: where the file for a distribution gets installed Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Nov 4 23:17:41 2020 (r367353) +++ head/Makefile.inc1 Wed Nov 4 23:26:15 2020 (r367354) @@ -25,7 +25,8 @@ # LOCAL_XTOOL_DIRS="list of dirs" to add additional dirs to the # cross-tools target # METALOG="path to metadata log" to write permission and ownership -# when NO_ROOT is set. (default: ${DESTDIR}/METALOG) +# when NO_ROOT is set. (default: ${DESTDIR}/${DISTDIR}/METALOG, +# check /etc/make.conf for DISTDIR) # TARGET="machine" to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians # BUILDENV_SHELL= shell to launch for the buildenv target (def:${SHELL}) From owner-svn-src-head@freebsd.org Wed Nov 4 23:29:27 2020 Return-Path: Delivered-To: svn-src-head@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 E434846927D; Wed, 4 Nov 2020 23:29:27 +0000 (UTC) (envelope-from jhibbits@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 4CRNCW5pfsz4QdN; Wed, 4 Nov 2020 23:29:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A636A151DA; Wed, 4 Nov 2020 23:29:27 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A4NTRbn057327; Wed, 4 Nov 2020 23:29:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A4NTRBb057326; Wed, 4 Nov 2020 23:29:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <202011042329.0A4NTRBb057326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 4 Nov 2020 23:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367355 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 367355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2020 23:29:28 -0000 Author: jhibbits Date: Wed Nov 4 23:29:27 2020 New Revision: 367355 URL: https://svnweb.freebsd.org/changeset/base/367355 Log: Fix UMA alignment for COP2 context structure. UMA alignment needs specified as (power-of-2) - 1, not power-of-2. Discussed with: gonzo MFC after: 3 days Modified: head/sys/mips/mips/octeon_cop2.c Modified: head/sys/mips/mips/octeon_cop2.c ============================================================================== --- head/sys/mips/mips/octeon_cop2.c Wed Nov 4 23:26:15 2020 (r367354) +++ head/sys/mips/mips/octeon_cop2.c Wed Nov 4 23:29:27 2020 (r367355) @@ -46,7 +46,7 @@ octeon_cop2_init(void* dummy) printf("Create COP2 context zone\n"); ctxzone = uma_zcreate("COP2 context", sizeof(struct octeon_cop2_state), - NULL, NULL, NULL, NULL, 8, 0); + NULL, NULL, NULL, NULL, UMA_ALIGN_LONG, 0); } struct octeon_cop2_state * From owner-svn-src-head@freebsd.org Thu Nov 5 00:52:53 2020 Return-Path: Delivered-To: svn-src-head@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 ED8BB46AC78; Thu, 5 Nov 2020 00:52:53 +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 4CRQ3n62KYz4VpG; Thu, 5 Nov 2020 00:52:53 +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 B07C716791; Thu, 5 Nov 2020 00:52:53 +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 0A50qrnT013154; Thu, 5 Nov 2020 00:52:53 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A50qrDQ013152; Thu, 5 Nov 2020 00:52:53 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202011050052.0A50qrDQ013152@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Thu, 5 Nov 2020 00:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367356 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 367356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 00:52:54 -0000 Author: mhorne Date: Thu Nov 5 00:52:52 2020 New Revision: 367356 URL: https://svnweb.freebsd.org/changeset/base/367356 Log: riscv: set kernel_pmap hart mask more precisely In pmap_bootstrap(), we fill kernel_pmap->pm_active since it is invariably active on all harts. However, this marks it as active even for harts that don't exist in the system, which can cause issue when the mask is passed to the SBI firmware via sbi_remote_sfence_vma(). Specifically, the SBI spec allows SBI_ERR_INVALID_PARAM to be returned when an invalid hart is set in the mask. The latest version of OpenSBI does not have this issue, but v0.6 does, and this is triggering a recently added KASSERT in CI. Switch to only setting bits in pm_active for harts that enter the system. Reported by: Jenkins Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27080 Modified: head/sys/riscv/riscv/mp_machdep.c head/sys/riscv/riscv/pmap.c Modified: head/sys/riscv/riscv/mp_machdep.c ============================================================================== --- head/sys/riscv/riscv/mp_machdep.c Wed Nov 4 23:29:27 2020 (r367355) +++ head/sys/riscv/riscv/mp_machdep.c Thu Nov 5 00:52:52 2020 (r367356) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -265,6 +266,9 @@ init_secondary(uint64_t hart) /* Enable external (PLIC) interrupts */ csr_set(sie, SIE_SEIE); + + /* Activate this hart in the kernel pmap. */ + CPU_SET_ATOMIC(hart, &kernel_pmap->pm_active); /* Activate process 0's pmap. */ pmap_activate_boot(vmspace_pmap(proc0.p_vmspace)); Modified: head/sys/riscv/riscv/pmap.c ============================================================================== --- head/sys/riscv/riscv/pmap.c Wed Nov 4 23:29:27 2020 (r367355) +++ head/sys/riscv/riscv/pmap.c Thu Nov 5 00:52:52 2020 (r367356) @@ -573,7 +573,12 @@ pmap_bootstrap(vm_offset_t l1pt, vm_paddr_t kernstart, rw_init(&pvh_global_lock, "pmap pv global"); - CPU_FILL(&kernel_pmap->pm_active); + /* + * Set the current CPU as active in the kernel pmap. Secondary cores + * will add themselves later in init_secondary(). The SBI firmware + * may rely on this mask being precise, so CPU_FILL() is not used. + */ + CPU_SET(PCPU_GET(hart), &kernel_pmap->pm_active); /* Assume the address we were loaded to is a valid physical address. */ min_pa = max_pa = kernstart; From owner-svn-src-head@freebsd.org Thu Nov 5 02:12:08 2020 Return-Path: Delivered-To: svn-src-head@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 EB24D46F40E; Thu, 5 Nov 2020 02:12:08 +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 4CRRqD607Nz4cxW; Thu, 5 Nov 2020 02:12:08 +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 B0FF117722; Thu, 5 Nov 2020 02:12:08 +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 0A52C8Qu062088; Thu, 5 Nov 2020 02:12:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A52C8xL062087; Thu, 5 Nov 2020 02:12:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011050212.0A52C8xL062087@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 02:12:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367357 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 02:12:09 -0000 Author: mjg Date: Thu Nov 5 02:12:08 2020 New Revision: 367357 URL: https://svnweb.freebsd.org/changeset/base/367357 Log: fd: hide _fdrop 0 count check behind INVARIANTS While here use refcount_load and make sure to report the tested value. Modified: head/sys/kern/kern_descrip.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Nov 5 00:52:52 2020 (r367356) +++ head/sys/kern/kern_descrip.c Thu Nov 5 02:12:08 2020 (r367357) @@ -3219,9 +3219,13 @@ int __noinline _fdrop(struct file *fp, struct thread *td) { int error; +#ifdef INVARIANTS + int count; - if (fp->f_count != 0) - panic("fdrop: count %d", fp->f_count); + count = refcount_load(&fp->f_count); + if (count != 0) + panic("fdrop: fp %p count %d", fp, count); +#endif error = fo_close(fp, td); atomic_subtract_int(&openfiles, 1); crfree(fp->f_cred); From owner-svn-src-head@freebsd.org Thu Nov 5 02:12:34 2020 Return-Path: Delivered-To: svn-src-head@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 7F80446F352; Thu, 5 Nov 2020 02:12:34 +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 4CRRqk2YRTz4cyS; Thu, 5 Nov 2020 02:12:34 +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 210A21772C; Thu, 5 Nov 2020 02:12:34 +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 0A52CYPo062148; Thu, 5 Nov 2020 02:12:34 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A52CXh4062146; Thu, 5 Nov 2020 02:12:33 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011050212.0A52CXh4062146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 02:12:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367358 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 02:12:34 -0000 Author: mjg Date: Thu Nov 5 02:12:33 2020 New Revision: 367358 URL: https://svnweb.freebsd.org/changeset/base/367358 Log: fd: make all f_count uses go through refcount_* Modified: head/sys/kern/kern_descrip.c head/sys/kern/uipc_usrreq.c Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Thu Nov 5 02:12:08 2020 (r367357) +++ head/sys/kern/kern_descrip.c Thu Nov 5 02:12:33 2020 (r367358) @@ -2863,7 +2863,7 @@ fget_unlocked_seq(struct filedesc *fdp, int fd, cap_ri * This re-read is not any more racy than using the * return value from fcmpset. */ - if (fp->f_count != 0) + if (refcount_load(&fp->f_count) != 0) return (EBADF); /* * Force a reload. Other thread could reallocate the @@ -3833,7 +3833,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS) xf.xf_data = (uintptr_t)fp->f_data; xf.xf_vnode = (uintptr_t)fp->f_vnode; xf.xf_type = (uintptr_t)fp->f_type; - xf.xf_count = fp->f_count; + xf.xf_count = refcount_load(&fp->f_count); xf.xf_msgcount = 0; xf.xf_offset = foffset_get(fp); xf.xf_flag = fp->f_flag; @@ -3916,7 +3916,7 @@ export_file_to_kinfo(struct file *fp, int fd, cap_righ else cap_rights_init_zero(&kif->kf_cap_rights); kif->kf_fd = fd; - kif->kf_ref_count = fp->f_count; + kif->kf_ref_count = refcount_load(&fp->f_count); kif->kf_offset = foffset_get(fp); /* @@ -4446,7 +4446,7 @@ db_print_file(struct file *fp, int header) p = file_to_first_proc(fp); db_printf("%*p %6s %*p %08x %04x %5d %6d %*p %5d %s\n", XPTRWIDTH, fp, file_type_to_name(fp->f_type), XPTRWIDTH, fp->f_data, - fp->f_flag, 0, fp->f_count, 0, XPTRWIDTH, fp->f_vnode, + fp->f_flag, 0, refcount_load(&fp->f_count), 0, XPTRWIDTH, fp->f_vnode, p != NULL ? p->p_pid : -1, p != NULL ? p->p_comm : "-"); #undef XPTRWIDTH Modified: head/sys/kern/uipc_usrreq.c ============================================================================== --- head/sys/kern/uipc_usrreq.c Thu Nov 5 02:12:08 2020 (r367357) +++ head/sys/kern/uipc_usrreq.c Thu Nov 5 02:12:33 2020 (r367358) @@ -2651,7 +2651,7 @@ unp_gc(__unused void *arg, int pending) * NULL. */ if (f != NULL && unp->unp_msgcount != 0 && - f->f_count == unp->unp_msgcount) { + refcount_load(&f->f_count) == unp->unp_msgcount) { LIST_INSERT_HEAD(&unp_deadhead, unp, unp_dead); unp->unp_gcflag |= UNPGC_DEAD; unp->unp_gcrefs = unp->unp_msgcount; @@ -2714,7 +2714,7 @@ unp_gc(__unused void *arg, int pending) unp->unp_gcflag &= ~UNPGC_DEAD; f = unp->unp_file; if (unp->unp_msgcount == 0 || f == NULL || - f->f_count != unp->unp_msgcount || + refcount_load(&f->f_count) != unp->unp_msgcount || !fhold(f)) continue; unref[total++] = f; From owner-svn-src-head@freebsd.org Thu Nov 5 03:25:24 2020 Return-Path: Delivered-To: svn-src-head@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 1544B4491F7; Thu, 5 Nov 2020 03:25:24 +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 4CRTRl6pqCz4hY0; Thu, 5 Nov 2020 03:25:23 +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 B3155183E1; Thu, 5 Nov 2020 03:25:23 +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 0A53PNpU006244; Thu, 5 Nov 2020 03:25:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A53PN7C006243; Thu, 5 Nov 2020 03:25:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011050325.0A53PN7C006243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 03:25:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367360 - head/sys/contrib/openzfs/module/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/zfs X-SVN-Commit-Revision: 367360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 03:25:24 -0000 Author: mjg Date: Thu Nov 5 03:25:23 2020 New Revision: 367360 URL: https://svnweb.freebsd.org/changeset/base/367360 Log: zfs: lz4: add optional kmem_alloc support lz4 port from illumos to Linux added a 16KB per-CPU cache to accommodate for the missing 16KB malloc. FreeBSD supports this size, making the extra cache harmful as it can't share buckets. Modified: head/sys/contrib/openzfs/module/zfs/lz4.c Modified: head/sys/contrib/openzfs/module/zfs/lz4.c ============================================================================== --- head/sys/contrib/openzfs/module/zfs/lz4.c Thu Nov 5 02:57:40 2020 (r367359) +++ head/sys/contrib/openzfs/module/zfs/lz4.c Thu Nov 5 03:25:23 2020 (r367360) @@ -44,7 +44,8 @@ static int LZ4_compressCtx(void *ctx, const char *sour static int LZ4_compress64kCtx(void *ctx, const char *source, char *dest, int isize, int osize); -static kmem_cache_t *lz4_cache; +static void *lz4_alloc(int flags); +static void lz4_free(void *ctx); /*ARGSUSED*/ size_t @@ -838,8 +839,7 @@ real_LZ4_compress(const char *source, char *dest, int void *ctx; int result; - ASSERT(lz4_cache != NULL); - ctx = kmem_cache_alloc(lz4_cache, KM_SLEEP); + ctx = lz4_alloc(KM_SLEEP); /* * out of kernel memory, gently fall through - this will disable @@ -855,7 +855,7 @@ real_LZ4_compress(const char *source, char *dest, int else result = LZ4_compressCtx(ctx, source, dest, isize, osize); - kmem_cache_free(lz4_cache, ctx); + lz4_free(ctx); return (result); } @@ -1014,6 +1014,23 @@ LZ4_uncompress_unknownOutputSize(const char *source, c return (-1); } +#ifdef __FreeBSD__ +/* + * FreeBSD has 4, 8 and 16 KB malloc zones which can be used here. + * Should struct refTables get resized this may need to be revisited, hence + * compiler-time asserts. + */ +_Static_assert(sizeof(struct refTables) <= 16384, + "refTables too big for malloc"); +_Static_assert((sizeof(struct refTables) % 4096) == 0, + "refTables not a multiple of page size"); +#else +#define ZFS_LZ4_USE_CACHE +#endif + +#ifdef ZFS_LZ4_USE_CACHE +static kmem_cache_t *lz4_cache; + void lz4_init(void) { @@ -1029,3 +1046,39 @@ lz4_fini(void) lz4_cache = NULL; } } + +static void * +lz4_alloc(int flags) +{ + ASSERT(lz4_cache != NULL); + return (kmem_cache_alloc(lz4_cache, flags)); +} + +static void +lz4_free(void *ctx) +{ + kmem_cache_free(lz4_cache, ctx); +} +#else +void +lz4_init(void) +{ +} + +void +lz4_fini(void) +{ +} + +static void * +lz4_alloc(int flags) +{ + return (kmem_alloc(sizeof (struct refTables), flags)); +} + +static void +lz4_free(void *ctx) +{ + kmem_free(ctx, sizeof (struct refTables)); +} +#endif From owner-svn-src-head@freebsd.org Thu Nov 5 04:19:48 2020 Return-Path: Delivered-To: svn-src-head@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 D74CE449E6D; Thu, 5 Nov 2020 04:19:48 +0000 (UTC) (envelope-from kevans@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 4CRVfX564zz4kvW; Thu, 5 Nov 2020 04:19:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 926B518CB8; Thu, 5 Nov 2020 04:19:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A54Jm2s037170; Thu, 5 Nov 2020 04:19:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A54JmFW037169; Thu, 5 Nov 2020 04:19:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011050419.0A54JmFW037169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 5 Nov 2020 04:19:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367361 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 04:19:48 -0000 Author: kevans Date: Thu Nov 5 04:19:48 2020 New Revision: 367361 URL: https://svnweb.freebsd.org/changeset/base/367361 Log: imgact_binmisc: fix up some minor nits - Removed a bunch of redundant headers - Don't explicitly initialize to 0 - The !error check prior to setting imgp->interpreter_name is redundant, all error paths should and do return or go to 'done'. We have larger problems otherwise. Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Thu Nov 5 03:25:23 2020 (r367360) +++ head/sys/kern/imgact_binmisc.c Thu Nov 5 04:19:48 2020 (r367361) @@ -29,17 +29,14 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include #include #include #include #include -#include #include #include #include +#include #include #include @@ -97,7 +94,7 @@ MALLOC_DEFINE(M_BINMISC, KMOD_NAME, "misc binary image static SLIST_HEAD(, imgact_binmisc_entry) interpreter_list = SLIST_HEAD_INITIALIZER(interpreter_list); -static int interp_list_entry_count = 0; +static int interp_list_entry_count; static struct sx interp_list_sx; @@ -703,8 +700,7 @@ imgact_binmisc_exec(struct image_params *imgp) *d = '\0'; sx_sunlock(&interp_list_sx); - if (!error) - imgp->interpreter_name = imgp->args->begin_argv; + imgp->interpreter_name = imgp->args->begin_argv; done: if (sname) From owner-svn-src-head@freebsd.org Thu Nov 5 06:48:52 2020 Return-Path: Delivered-To: svn-src-head@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 4E1EE44CAE0; Thu, 5 Nov 2020 06:48:52 +0000 (UTC) (envelope-from cem@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 4CRYyX1Mmmz4rMF; Thu, 5 Nov 2020 06:48:52 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11C1A1AB56; Thu, 5 Nov 2020 06:48:52 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A56mpxQ028208; Thu, 5 Nov 2020 06:48:51 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A56mphH028205; Thu, 5 Nov 2020 06:48:51 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011050648.0A56mphH028205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 5 Nov 2020 06:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367362 - in head/sys: compat/linprocfs fs/pseudofs X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: compat/linprocfs fs/pseudofs X-SVN-Commit-Revision: 367362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 06:48:52 -0000 Author: cem Date: Thu Nov 5 06:48:51 2020 New Revision: 367362 URL: https://svnweb.freebsd.org/changeset/base/367362 Log: Add sbuf streaming mode to pseudofs(9), use in linprocfs(5) Add a pseudofs node flag 'PFS_AUTODRAIN', which automatically emits sbuf contents to the caller when the sbuf buffer fills. This is only permissible if the corresponding PFS node fill function can sleep whenever it appends to the sbuf. linprocfs' /proc/self/maps node happens to meet this requirement. Streaming out the file as it is composed avoids truncating the output and also avoids preallocating a very large buffer. Reviewed by: markj; earlier version: emaste, kib, trasz Differential Revision: https://reviews.freebsd.org/D27047 Modified: head/sys/compat/linprocfs/linprocfs.c head/sys/fs/pseudofs/pseudofs.h head/sys/fs/pseudofs/pseudofs_vnops.c Modified: head/sys/compat/linprocfs/linprocfs.c ============================================================================== --- head/sys/compat/linprocfs/linprocfs.c Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/compat/linprocfs/linprocfs.c Thu Nov 5 06:48:51 2020 (r367362) @@ -1252,10 +1252,6 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) *name ? " " : " ", name ); - if (error == -1) { - linux_msg(td, "cannot fill /proc/self/maps; " - "consider bumping PFS_MAXBUFSIZ"); - } if (freename) free(freename, M_TEMP); vm_map_lock_read(map); @@ -1890,7 +1886,7 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_link(dir, "exe", &procfs_doprocfile, NULL, &procfs_notsystem, NULL, 0); pfs_create_file(dir, "maps", &linprocfs_doprocmaps, - NULL, NULL, NULL, PFS_RD); + NULL, NULL, NULL, PFS_RD | PFS_AUTODRAIN); pfs_create_file(dir, "mem", &linprocfs_doprocmem, procfs_attr_rw, &procfs_candebug, NULL, PFS_RDWR | PFS_RAW); pfs_create_file(dir, "mounts", &linprocfs_domtab, Modified: head/sys/fs/pseudofs/pseudofs.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs.h Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/fs/pseudofs/pseudofs.h Thu Nov 5 06:48:51 2020 (r367362) @@ -78,6 +78,7 @@ typedef enum { #define PFS_RAW (PFS_RAWRD|PFS_RAWWR) #define PFS_PROCDEP 0x0010 /* process-dependent */ #define PFS_NOWAIT 0x0020 /* allow malloc to fail */ +#define PFS_AUTODRAIN 0x0040 /* sbuf_print can sleep to drain */ /* * Data structures Modified: head/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vnops.c Thu Nov 5 04:19:48 2020 (r367361) +++ head/sys/fs/pseudofs/pseudofs_vnops.c Thu Nov 5 06:48:51 2020 (r367362) @@ -623,6 +623,50 @@ pfs_open(struct vop_open_args *va) PFS_RETURN (0); } +struct sbuf_seek_helper { + off_t skip_bytes; + struct uio *uio; +}; + +static int +pfs_sbuf_uio_drain(void *arg, const char *data, int len) +{ + struct sbuf_seek_helper *ssh; + struct uio *uio; + int error, skipped; + + ssh = arg; + uio = ssh->uio; + skipped = 0; + + /* Need to discard first uio_offset bytes. */ + if (ssh->skip_bytes > 0) { + if (ssh->skip_bytes >= len) { + ssh->skip_bytes -= len; + return (len); + } + + data += ssh->skip_bytes; + len -= ssh->skip_bytes; + skipped = ssh->skip_bytes; + ssh->skip_bytes = 0; + } + + error = uiomove(__DECONST(void *, data), len, uio); + if (error != 0) + return (-error); + + /* + * The fill function has more to emit, but the reader is finished. + * This is similar to the truncated read case for non-draining PFS + * sbufs, and should be handled appropriately in fill-routines. + */ + if (uio->uio_resid == 0) + return (-ENOBUFS); + + return (skipped + len); +} + /* * Read from a file */ @@ -636,7 +680,8 @@ pfs_read(struct vop_read_args *va) struct proc *proc; struct sbuf *sb = NULL; int error, locked; - off_t buflen; + off_t buflen, buflim; + struct sbuf_seek_helper ssh; PFS_TRACE(("%s", pn->pn_name)); pfs_assert_not_owned(pn); @@ -678,16 +723,30 @@ pfs_read(struct vop_read_args *va) error = EINVAL; goto ret; } - buflen = uio->uio_offset + uio->uio_resid; - if (buflen > PFS_MAXBUFSIZ) - buflen = PFS_MAXBUFSIZ; + buflen = uio->uio_offset + uio->uio_resid + 1; + if (pn->pn_flags & PFS_AUTODRAIN) + /* + * We can use a smaller buffer if we can stream output to the + * consumer. + */ + buflim = PAGE_SIZE; + else + buflim = PFS_MAXBUFSIZ; + if (buflen > buflim) + buflen = buflim; - sb = sbuf_new(sb, NULL, buflen + 1, 0); + sb = sbuf_new(sb, NULL, buflen, 0); if (sb == NULL) { error = EIO; goto ret; } + if (pn->pn_flags & PFS_AUTODRAIN) { + ssh.skip_bytes = uio->uio_offset; + ssh.uio = uio; + sbuf_set_drain(sb, pfs_sbuf_uio_drain, &ssh); + } + error = pn_fill(curthread, proc, pn, sb, uio); if (error) { @@ -700,9 +759,23 @@ pfs_read(struct vop_read_args *va) * the data length. Then just use the full length because an * overflowed sbuf must be full. */ - if (sbuf_finish(sb) == 0) - buflen = sbuf_len(sb); - error = uiomove_frombuf(sbuf_data(sb), buflen, uio); + error = sbuf_finish(sb); + if ((pn->pn_flags & PFS_AUTODRAIN)) { + /* + * ENOBUFS just indicates early termination of the fill + * function as the caller's buffer was already filled. Squash + * to zero. + */ + if (uio->uio_resid == 0 && error == ENOBUFS) + error = 0; + } else { + if (error == 0) + buflen = sbuf_len(sb); + else + /* The trailing byte is not valid. */ + buflen--; + error = uiomove_frombuf(sbuf_data(sb), buflen, uio); + } sbuf_delete(sb); ret: vn_lock(vn, locked | LK_RETRY); From owner-svn-src-head@freebsd.org Thu Nov 5 07:47:02 2020 Return-Path: Delivered-To: svn-src-head@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 2FB53460C55; Thu, 5 Nov 2020 07:47:02 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (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 "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CRbFf0kLNz4LWd; Thu, 5 Nov 2020 07:47:02 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1604562422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7ans0nkaU7jZaCV+fT/RyU+PH4oHrWdYhKvBniN/nDc=; b=sMaCIlgJLuVHYYSCFFvnZVPF9hp7xbc4zmrUrdYorZQKEoDeSf8YCGlvpPkpac8e30mp4k ZxXS3ggGEaliNfLvFXuqPkR/4ESDNnfPgLkdY6j6HmxKfC7VuWJOniCNi+9RNKGoykZ1CT EjfJhOzTyPLAZzDf2Yw3xOqpFkHUmamf0CICs/fjrxrFRKR1len7z12vosSifs5PXipI+Y nPbILsTdvkgwhH5IZdVB/bFkGmp+lbBTh1cNCWZB8IB24VI1iKPdYHynrbrSbD1tcddD55 A0uU1RNa6R2YVyIzmgqBG6i2Ur2HJeBAT1T6+yqkTJylrUg5i0q+R56MLAZqpw== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 0FA341A52D; Thu, 5 Nov 2020 07:47:02 +0000 (UTC) Date: Thu, 5 Nov 2020 07:47:02 +0000 From: Alexey Dokuchaev To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys Message-ID: <20201105074702.GA83145@FreeBSD.org> References: <202011042118.0A4LIq3H077210@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202011042118.0A4LIq3H077210@repo.freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1604562422; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7ans0nkaU7jZaCV+fT/RyU+PH4oHrWdYhKvBniN/nDc=; b=AE2SVQzVWwZwITMMEHdS7DNJQNHBoF3P3C2Cxa0Uw/bMx5xaaNKE1LFXsQZfTLavHaYgic nVbfbdva26P0Fm/msl5ZtoHF1NSM/WDGNNOBuU5Lpqo7S84kMQ3VI2qCnavvJuvONYvZiQ fOjCacQnlaprJfsT281RFk8yaIfhTZ73P47s2ReeUYPURgssurLSViBS383/tZWZJ2VCDf iOaHXLkjeN3/zKfIwYT58Cw6psDBpTJTYro8ElTTeM1fI80RZsCs3k+Q5hHChuc7KFKjR5 cehaWUHKJzEDyFvIaeKag5Lhiwu7IgiQq5Pxbjz3J0FLdi2IxypFtOtDQN3afQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1604562422; a=rsa-sha256; cv=none; b=QDneBfQo0bNKt+tnCkWYwCZZilEDE/rY5e4Xa2BtOsNw5Z+ZnI6bvjU5CibRDPqclnckah 31mLhDMFG16D4TUDHLDqprZ7KLSSkZG8beajLkKI53zHo0ceaHUFClqx9gPbl1T3/A1KMQ zBt8i+wrICc2silaUu2Qa9HVUmc13WnxH09HzluMZPfMc72bMP5UA+gignudr/X9wcqGuI rL5Jt/l8JFLHzxbmvlJ6zR8E3yq1alt4DGLNdSOGQOEO74uW13HGlVFCSF1V/VH6xYCgaL 9UKZ7peN81z1lu1I5t8UGCbNayNRx/ihclFEoqaspYoKw/QuToZCbXCFxSQGgQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 07:47:02 -0000 On Wed, Nov 04, 2020 at 09:18:52PM +0000, Mateusz Guzik wrote: > New Revision: 367343 > URL: https://svnweb.freebsd.org/changeset/base/367343 > > Log: > zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros > > They are expected to fail only in corner cases. > > Modified: > head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h > head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h Since my earlier email was ignored, I'd take this chance to ask again: why Linux-specific bits present in the head and had to be updated like in this commit? They shouldn't have made past the vendor branch, no? ./danfe From owner-svn-src-head@freebsd.org Thu Nov 5 08:58:22 2020 Return-Path: Delivered-To: svn-src-head@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 96EFC4625B6; Thu, 5 Nov 2020 08:58:22 +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 4CRcqy3dKHz4PXW; Thu, 5 Nov 2020 08:58:22 +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 6B4381143D; Thu, 5 Nov 2020 08:58:22 +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 0A58wMCD007793; Thu, 5 Nov 2020 08:58:22 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A58wLqi007789; Thu, 5 Nov 2020 08:58:21 GMT (envelope-from se@FreeBSD.org) Message-Id: <202011050858.0A58wLqi007789@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: Thu, 5 Nov 2020 08:58:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367364 - head/usr.bin/calendar X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/usr.bin/calendar X-SVN-Commit-Revision: 367364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 08:58:22 -0000 Author: se Date: Thu Nov 5 08:58:21 2020 New Revision: 367364 URL: https://svnweb.freebsd.org/changeset/base/367364 Log: Restrict locale settings to the file they occur in This prevents LANG= in an included file from affecting the interpretation of month and day names in the including file. Make the internal pre-processor accept white space between the "#" at the start of the line and the keyword for better compatibility with cpp. Add support for the cpp keywords #warning and #error. MFC after: 3 days Modified: head/usr.bin/calendar/calendar.1 head/usr.bin/calendar/calendar.h head/usr.bin/calendar/events.c head/usr.bin/calendar/io.c Modified: head/usr.bin/calendar/calendar.1 ============================================================================== --- head/usr.bin/calendar/calendar.1 Thu Nov 5 07:59:05 2020 (r367363) +++ head/usr.bin/calendar/calendar.1 Thu Nov 5 08:58:21 2020 (r367364) @@ -28,7 +28,7 @@ .\" @(#)calendar.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd November 4, 2020 +.Dd November 5, 2020 .Dt CALENDAR 1 .Os .Sh NAME @@ -199,13 +199,14 @@ file is preprocessed by a limited subset of internally, allowing the inclusion of shared files such as lists of company holidays or meetings. This limited subset consists of \fB#include\fR, \fB#define\fR, -\fB#undef\fR, \fB#ifdef\fR, \fB#ifndef\fR, and \fB#else\fR. +\fB#undef\fR, \fB#ifdef\fR, \fB#ifndef\fR, \fB#else\fR, \fB#warning\fR, +and \fB#error\fR. .Pp Conditions can be nested and the consistency of opening and closing instructions is checked. Only the first word after #define is used as the name of the condition variable being defined. -More than word following #ifdef, #ifndef, or #undef is a ayntax +More than word following #ifdef, #ifndef, or #undef is considered a syntax error, since names cannot include white-space. Included files are parsed in a global scope with regard to the condition variables being defined or tested therein. Modified: head/usr.bin/calendar/calendar.h ============================================================================== --- head/usr.bin/calendar/calendar.h Thu Nov 5 07:59:05 2020 (r367363) +++ head/usr.bin/calendar/calendar.h Thu Nov 5 08:58:21 2020 (r367364) @@ -130,7 +130,6 @@ struct event { int month; int day; int var; - char *date; char *text; char *extra; struct event *next; Modified: head/usr.bin/calendar/events.c ============================================================================== --- head/usr.bin/calendar/events.c Thu Nov 5 07:59:05 2020 (r367363) +++ head/usr.bin/calendar/events.c Thu Nov 5 08:58:21 2020 (r367364) @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include static iconv_t conv = (iconv_t)-1; static char *currentEncoding = NULL; @@ -204,13 +203,7 @@ event_print_all(FILE *fp) struct tm tm; char dbuf[80]; static int d_first; - const char *lang; - lang = getenv("LANG"); - if (lang == NULL) - lang = "C"; - if (setlocale(LC_ALL, lang) == NULL) - (void)setlocale(LC_ALL, "C"); d_first = (*nl_langinfo(D_MD_ORDER) == 'd'); while (walkthrough_dates(&e) != 0) { Modified: head/usr.bin/calendar/io.c ============================================================================== --- head/usr.bin/calendar/io.c Thu Nov 5 07:59:05 2020 (r367363) +++ head/usr.bin/calendar/io.c Thu Nov 5 08:58:21 2020 (r367364) @@ -172,6 +172,16 @@ cal_path(void) #define WARN1(format, arg1) \ warnx(format " in %s line %d", arg1, cal_path(), cal_line) +static char* +cmptoken(char *line, const char* token) +{ + char len = strlen(token); + + if (strncmp(line, token, len) != 0) + return NULL; + return (line + len); +} + static int token(char *line, FILE *out, int *skip, int *unskip) { @@ -181,7 +191,10 @@ token(char *line, FILE *out, int *skip, int *unskip) const char *this_cal_file; int this_cal_line; - if (strncmp(line, "endif", 5) == 0) { + while (isspace(*line)) + line++; + + if (cmptoken(line, "endif")) { if (*skip + *unskip == 0) { WARN0("#endif without prior #ifdef or #ifndef"); return (T_ERR); @@ -194,8 +207,8 @@ token(char *line, FILE *out, int *skip, int *unskip) return (T_OK); } - if (strncmp(line, "ifdef", 5) == 0) { - walk = line + 5; + walk = cmptoken(line, "ifdef"); + if (walk != NULL) { sep = trimlr(&walk); if (*walk == '\0') { @@ -217,8 +230,8 @@ token(char *line, FILE *out, int *skip, int *unskip) return (T_OK); } - if (strncmp(line, "ifndef", 6) == 0) { - walk = line + 6; + walk = cmptoken(line, "ifndef"); + if (walk != NULL) { sep = trimlr(&walk); if (*walk == '\0') { @@ -240,8 +253,8 @@ token(char *line, FILE *out, int *skip, int *unskip) return (T_OK); } - if (strncmp(line, "else", 4) == 0) { - walk = line + 4; + walk = cmptoken(line, "else"); + if (walk != NULL) { (void)trimlr(&walk); if (*walk != '\0') { @@ -267,9 +280,8 @@ token(char *line, FILE *out, int *skip, int *unskip) if (*skip != 0) return (T_OK); - if (strncmp(line, "include", 7) == 0) { - walk = line + 7; - + walk = cmptoken(line, "include"); + if (walk != NULL) { (void)trimlr(&walk); if (*walk == '\0') { @@ -306,10 +318,10 @@ token(char *line, FILE *out, int *skip, int *unskip) return (T_OK); } - if (strncmp(line, "define", 6) == 0) { + walk = cmptoken(line, "define"); + if (walk != NULL) { if (definitions == NULL) definitions = sl_init(); - walk = line + 6; sep = trimlr(&walk); *sep = '\0'; @@ -323,9 +335,9 @@ token(char *line, FILE *out, int *skip, int *unskip) return (T_OK); } - if (strncmp(line, "undef", 5) == 0) { + walk = cmptoken(line, "undef"); + if (walk != NULL) { if (definitions != NULL) { - walk = line + 5; sep = trimlr(&walk); if (*walk == '\0') { @@ -345,10 +357,34 @@ token(char *line, FILE *out, int *skip, int *unskip) return (T_OK); } - return (T_PROCESS); + walk = cmptoken(line, "warning"); + if (walk != NULL) { + (void)trimlr(&walk); + WARN1("Warning: %s", walk); + } + walk = cmptoken(line, "error"); + if (walk != NULL) { + (void)trimlr(&walk); + WARN1("Error: %s", walk); + return (T_ERR); + } + + WARN1("Undefined pre-processor command \"#%s\"", line); + return (T_ERR); } +static void +setup_locale(const char *locale) +{ + (void)setlocale(LC_ALL, locale); +#ifdef WITH_ICONV + if (!doall) + set_new_encoding(); +#endif + setnnames(); +} + #define REPLACE(string, slen, struct_) \ if (strncasecmp(buf, (string), (slen)) == 0 && buf[(slen)]) { \ if (struct_.name != NULL) \ @@ -361,6 +397,7 @@ token(char *line, FILE *out, int *skip, int *unskip) static int cal_parse(FILE *in, FILE *out) { + char *mylocale = NULL; char *line = NULL; char *buf; size_t linecap = 0; @@ -459,12 +496,9 @@ cal_parse(FILE *in, FILE *out) * and does not run iconv(), this variable has little use. */ if (strncmp(buf, "LANG=", 5) == 0) { - (void)setlocale(LC_ALL, buf + 5); -#ifdef WITH_ICONV - if (!doall) - set_new_encoding(); -#endif - setnnames(); + if (mylocale == NULL) + mylocale = strdup(setlocale(LC_ALL, NULL)); + setup_locale(buf + 5); continue; } /* Parse special definitions: Easter, Paskha etc */ @@ -538,6 +572,10 @@ cal_parse(FILE *in, FILE *out) free(line); fclose(in); + if (mylocale != NULL) { + setup_locale(mylocale); + free(mylocale); + } return (0); } From owner-svn-src-head@freebsd.org Thu Nov 5 09:55:55 2020 Return-Path: Delivered-To: svn-src-head@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 8DE18463A78; Thu, 5 Nov 2020 09:55:55 +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 4CRf6M3gLsz4Rvf; Thu, 5 Nov 2020 09:55:55 +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 70CBE12121; Thu, 5 Nov 2020 09:55:55 +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 0A59ttXq044780; Thu, 5 Nov 2020 09:55:55 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A59ttve044779; Thu, 5 Nov 2020 09:55:55 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202011050955.0A59ttve044779@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 5 Nov 2020 09:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367365 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 367365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 09:55:55 -0000 Author: andrew Date: Thu Nov 5 09:55:55 2020 New Revision: 367365 URL: https://svnweb.freebsd.org/changeset/base/367365 Log: Stop trying to bounce in memory allocated by bus dma Memory allocated by bus_dmamem_alloc will take into account any alignment requirements of the CPU it's running on. Stop trying to bounce in this case as there is no bounce zone allocated. Reported by: manu, tuexen Tested by: manu Sponsored by: Innovate UK Modified: head/sys/arm64/arm64/busdma_bounce.c Modified: head/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- head/sys/arm64/arm64/busdma_bounce.c Thu Nov 5 08:58:21 2020 (r367364) +++ head/sys/arm64/arm64/busdma_bounce.c Thu Nov 5 09:55:55 2020 (r367365) @@ -206,6 +206,10 @@ might_bounce(bus_dma_tag_t dmat, bus_dmamap_t map, bus bus_size_t size) { + /* Memory allocated by bounce_bus_dmamem_alloc won't bounce */ + if ((map->flags & DMAMAP_FROM_DMAMEM) != 0) + return (false); + if ((dmat->bounce_flags & BF_COULD_BOUNCE) != 0) return (true); From owner-svn-src-head@freebsd.org Thu Nov 5 10:49:56 2020 Return-Path: Delivered-To: svn-src-head@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 4304B463EEB; Thu, 5 Nov 2020 10:49:56 +0000 (UTC) (envelope-from se@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 4CRgJh0vn2z4TfD; Thu, 5 Nov 2020 10:49:56 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MacBook-Pro-449.fritz.box (p200300cd5f0bbc00285e3e500fcb1fb8.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:285e:3e50:fcb:1fb8]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id CEB261FCDC; Thu, 5 Nov 2020 10:49:54 +0000 (UTC) (envelope-from se@freebsd.org) To: rgrimes@freebsd.org Cc: Emmanuel Vadot , Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org, Baptiste Daroussin References: <1b636b92-92e8-4abf-0771-f7232ca6d25f@freebsd.org> <202011041904.0A4J4b5k025815@gndrsh.dnsmgr.net> <20201104194058.tbrh4vvgevbnb6pd@ivaldir.net> From: Stefan Esser Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: <19d4e381-fa2d-8afc-dff4-502ba30041d2@freebsd.org> Date: Thu, 5 Nov 2020 11:49:51 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201104194058.tbrh4vvgevbnb6pd@ivaldir.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="E1E9jb925QoOWH0nv7D18x8gxyYlu55yG" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 10:49:56 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --E1E9jb925QoOWH0nv7D18x8gxyYlu55yG Content-Type: multipart/mixed; boundary="6rrfWvsfMS0eAKUOQMOC6tcT0qUL2Kdg1"; protected-headers="v1" From: Stefan Esser To: rgrimes@freebsd.org Cc: Emmanuel Vadot , Oliver Pinter , src-committers , svn-src-all , svn-src-head@freebsd.org, Baptiste Daroussin Message-ID: <19d4e381-fa2d-8afc-dff4-502ba30041d2@freebsd.org> Subject: Re: svn commit: r367280 - head/lib/libc/gen References: <1b636b92-92e8-4abf-0771-f7232ca6d25f@freebsd.org> <202011041904.0A4J4b5k025815@gndrsh.dnsmgr.net> <20201104194058.tbrh4vvgevbnb6pd@ivaldir.net> In-Reply-To: <20201104194058.tbrh4vvgevbnb6pd@ivaldir.net> --6rrfWvsfMS0eAKUOQMOC6tcT0qUL2Kdg1 Content-Type: multipart/mixed; boundary="------------8A06AD0A8054425142F5EA8C" Content-Language: en-US This is a multi-part message in MIME format. --------------8A06AD0A8054425142F5EA8C Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Am 04.11.20 um 20:40 schrieb Baptiste Daroussin: > On Wed, Nov 04, 2020 at 11:04:37AM -0800, Rodney W. Grimes wrote: >> For 25 years PREFIX has been rigidly a part of the ports infustructure= , >> why is it that the BASE system has been allowed to de-evolve from this= >> concept as documented and REQUIRED by: >> >> https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/por= ting-prefix.html >> >> >> I again assert at one time the base system was clean of this, >> it has regressed and needs to be fixed. That fix should restore >> the independence of PREFIX. If 30k ported pieces of software can >> do it why can't the base system do it? >> >> Those ports do not require a recompile, why should the base system? >=20 > I am just reacting on that phrase, you do really think the ports do not= require > a rebuild to be able to relocate from a PREFIX to another? this is a my= th! >=20 > ports support being built with another prefix than localbase but that i= s all it > supports. >=20 > There has been a flase claim for years that relocating work, but beside= the > tools proposing the feature it never worked, or to be fait only on some= very > specific port. >=20 > But it is just an impossible goal to achieve otherwise as for example a= ll the > path which gets hardcoded at build time depending on the prefix will en= d up in > the binary looking for resources in a hardcoded prefix at runtime and s= o fail if > you relocate the package, for example its datadir. Adding to Baptiste's reply: While ports have often contained hard-coded dependencies on the PREFIX used at build time, the changes currently being applied to the base=20 system would actually ease having ports that adapt to a different prefix at run-time. See Scott Longs proposed getlocalbase() function (D27022), which could be used by ports to derive at run-time the (currently hard-coded) path in a standardized way (with fall-back to _PATH_LOCALBASE or /usr/local). There are potential security issues with a run-time configured PREFIX though, e.g. if it is used to locate files that contain an admin- configured policy meant to restrict unprivileged users. Only hard-coded paths in the respective binaries protect against attacks that manipulate a dynamic prefix at run-time in such a szenario. But as long as not all supported versions of FreeBSD support the getlocalbase() function, it cannot be assumed to be generally available for use in ports. And since it will take some time for the currently supported releases to reach EoL, ports could only conditionally include such a feature when built on and for a system known to have getlocalbase(). We are in the process of creating the infrastructure that may one day allow ports to automatically adapt to the PREFIX in use on the system they are installed on, but we are not there, yet. Regards, STefan --------------8A06AD0A8054425142F5EA8C-- --6rrfWvsfMS0eAKUOQMOC6tcT0qUL2Kdg1-- --E1E9jb925QoOWH0nv7D18x8gxyYlu55yG Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+j2M8FAwAAAAAACgkQR+u171r99URr Bgf/VMva804KdQZ3ngRhH0dKh7IH1I/pxqazFTE9oZFK5h+fC6WuRNQ/uOYkfLT2uCg1WViQY2FS xeJf5OyTEQAFeO02xqRnRv4fk+cvnECxY7llPoyVmhOm7JKOeWUQo7IwyJ8WAbzZHKDTN2ViKG3+ s73wp285a0ZyCiHyAg6TNiehDntb+74iBBaiJSwbTe/CMRmjdSGmAJdHrDliwpQn5Ixc7NyQ2I4b g2dBpBnAR8RoWCuUe0D6yEyZgyZc7ibpWCsEcAldr+2pWzFapQKlLfpGPBxdDYEv5a/saZ1CG5/9 48vwe6ejITlApnNflOPXCPM3rOnr2RcVhfHYmynQ7A== =3745 -----END PGP SIGNATURE----- --E1E9jb925QoOWH0nv7D18x8gxyYlu55yG-- From owner-svn-src-head@freebsd.org Thu Nov 5 11:24:46 2020 Return-Path: Delivered-To: svn-src-head@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 56910464CD4; Thu, 5 Nov 2020 11:24:46 +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 4CRh4t224Wz4WlC; Thu, 5 Nov 2020 11:24:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3406F132F2; Thu, 5 Nov 2020 11:24:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5BOkRG099024; Thu, 5 Nov 2020 11:24:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5BOkL3099023; Thu, 5 Nov 2020 11:24:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011051124.0A5BOkL3099023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 11:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367368 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 367368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 11:24:46 -0000 Author: mjg Date: Thu Nov 5 11:24:45 2020 New Revision: 367368 URL: https://svnweb.freebsd.org/changeset/base/367368 Log: tmpfs: reorder struct tmpfs_node to shrink it by 8 bytes The reduction (232 -> 224 bytes) allows UMA to fit one more item (17 -> 18) per slab as reported in vm.uma.TMPFS_node.keg.ipers. Modified: head/sys/fs/tmpfs/tmpfs.h Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Thu Nov 5 11:19:31 2020 (r367367) +++ head/sys/fs/tmpfs/tmpfs.h Thu Nov 5 11:24:45 2020 (r367368) @@ -156,8 +156,10 @@ struct tmpfs_node { * when the node is removed from list and unlocked. */ LIST_ENTRY(tmpfs_node) tn_entries; /* (m) */ - bool tn_attached; /* (m) */ + /* Node identifier. */ + ino_t tn_id; /* (c) */ + /* * The node's type. Any of 'VBLK', 'VCHR', 'VDIR', 'VFIFO', * 'VLNK', 'VREG' and 'VSOCK' is allowed. The usage of vnode @@ -166,8 +168,10 @@ struct tmpfs_node { */ enum vtype tn_type; /* (c) */ - /* Node identifier. */ - ino_t tn_id; /* (c) */ + /* + * See the top comment. Reordered here to fill LP64 hole. + */ + bool tn_attached; /* (m) */ /* * Node's internal status. This is used by several file system From owner-svn-src-head@freebsd.org Thu Nov 5 11:25:55 2020 Return-Path: Delivered-To: svn-src-head@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 4889A464F29; Thu, 5 Nov 2020 11:25:55 +0000 (UTC) (envelope-from se@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 4CRh6C16Brz4WxX; Thu, 5 Nov 2020 11:25:55 +0000 (UTC) (envelope-from se@freebsd.org) Received: from Stefans-MacBook-Pro-449.fritz.box (p200300cd5f0bbc00285e3e500fcb1fb8.dip0.t-ipconnect.de [IPv6:2003:cd:5f0b:bc00:285e:3e50:fcb:1fb8]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: se/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 5B70F1FF3E; Thu, 5 Nov 2020 11:25:54 +0000 (UTC) (envelope-from se@freebsd.org) To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers , svn-src-all , svn-src-head@freebsd.org References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> <20201104194954.GR2654@kib.kiev.ua> From: Stefan Esser Subject: Re: svn commit: r367280 - head/lib/libc/gen Message-ID: Date: Thu, 5 Nov 2020 12:25:52 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201104194954.GR2654@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vc55wHOJxz1ErwaTySVKeRvTMDHkNrXju" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 11:25:55 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vc55wHOJxz1ErwaTySVKeRvTMDHkNrXju Content-Type: multipart/mixed; boundary="hRu7QVS3TWetlya4VxohdaUGiiwaxecYM"; protected-headers="v1" From: Stefan Esser To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers , svn-src-all , svn-src-head@freebsd.org Message-ID: Subject: Re: svn commit: r367280 - head/lib/libc/gen References: <202011021848.0A2Im7Kx098921@repo.freebsd.org> <338fdfbb-6fad-0e44-5df6-b5a1c38d3e4f@freebsd.org> <20201102224907.401c9200dffba42cab827b2d@bidouilliste.com> <20201102221039.GN2654@kib.kiev.ua> <20201104194954.GR2654@kib.kiev.ua> In-Reply-To: <20201104194954.GR2654@kib.kiev.ua> --hRu7QVS3TWetlya4VxohdaUGiiwaxecYM Content-Type: multipart/mixed; boundary="------------6005C58DBE0DE8579C75247F" Content-Language: en-US This is a multi-part message in MIME format. --------------6005C58DBE0DE8579C75247F Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable Am 04.11.20 um 20:49 schrieb Konstantin Belousov: > On Mon, Nov 02, 2020 at 11:51:12PM +0100, Stefan Esser wrote: >> Am 02.11.20 um 23:10 schrieb Konstantin Belousov: >>> On Mon, Nov 02, 2020 at 10:49:07PM +0100, Emmanuel Vadot wrote: >>>> I think that the first question we want to ask is : Do we want to= >>>> support LOCALBASE being different than /usr/local >>>> I honestly don't see any advantages of making it !=3D/usr/local/ = and >>>> before we start putting a lot of new/useless(for I guess 99% of our >>>> user base) in the tree we should here why people are using /usr/pkg = or >>>> whatever weird location. >>>> If they have some good argument, then we should proceed further. >>> >>> I would be delighted to be able to install _and use_ two independent >>> set of packages from the same base system install. Without recursing= >>> to jails, X forwarding, etc. >> >> I understand the use case, and I agree this may be appropriate for >> a development system. >> >> But on a production system I'd never want to have a non-constant and >> not generally applied LOCALBASE, at least not on a system that gives >> a CLI to unprivileged users. Those could build their own copy of the >> LOCALBASE tree (e.g. sym-linking all sub-trees that are to be kept >> unmodified, replacing config files that policies that restrict the >> user). > So how this makes attitude to the feature different ? For me, dev mach= ine > is my production box because what I do is development. And for user th= at > need to run an old binary-only 32bit app which requires X libs, for ins= tance, > it also would be a production. Maybe I'm using the term in a too strict sense, but it has been consistently used in this way in all the environments I have worked in during the last few decades: The term "production server" is generally applied to systems that are operated by e.g. an admin team (e.g. ITIL operations processes). You may consider your development work productive ;-), but that does not make your development system a production system as found e.g. in a server farm providing internal or public services. One difference between test&development vs. production systems is that development systems are generally operated under less tight security obligations. You are in full control of the system and could damage its integrity at will. It does not contain any data you are not authorized to access. The opposite is true of most "production systems", which need to be protected against attacks on confidentiality, integrity, and availability. >> And if LOCALBASE is not compiled into binaries but somehow obtained >> at run-time, there are a number of attacks I can imagine (e.g. by >> LD_PRELOAD replace the sysctl() call in libc by your own version). > If somebody can LD_PRELOAD their into your process, it makes no sense t= o talk > about 'security'. Yes, it takes some effort, but you could e.g. intercept fopen() calls and manipulate the file name argument. One of the suggested methods to make programs use a non-default LOCALBASE was by means of an environment variable, and that makes it trivial to have programs use an attacker-controlled value compare to a LD_PRELOAD attack, though. This is acceptable on a development system, but not on a production system, IMHO. I'm afraid that sysctl() could be intercepted, if it was used to determine a run-time value for LOCALBASE, but intercepting fopen() could accomplish the same result even for hard-coded paths ... >>> In fact I would like to use /usr/local and e.g /usr/local-i386 on amd= 64 >>> machine. I am fine with me building both of them in my instance of >>> poudriere. >> >> This is a use-case for architecture dependent path definitions (which >> I have used some 30 years ago on HP-UX which supported 68k and HP-PA >> on a single file system that way). Such a feature has been discussed >> in FreeBSD multiple times over the decades ... >=20 > Ok, let replace /usr/local-i386 by /usr/local-11.4, if you so inclined.= Well, how about /compat/11.4-i386 then? The HP-UX implementation used e.g. /usr/bin/@hppa/ ... and when a file name lookup for /usr/bin/somefile did not find it in /usr/bin, it would try /usr/bin/@ARCH (with ARCH =3D hppa or 68k, IIRC). This is not exactly what you asked for, but our Linux emulation might already contain everything required to allow a 32 bit environment to exist on a 64 bit system. And by that I mean not the ability to execute 32 bin binaries that we already have, but e.g. to make path lookups by such binaries consider the compat prefix first. Ports built in the 32 bit environment should then find all their include files, libraries ... under the appropriate /compat sub-tree. That still leaves a few aspects undefined though, e.g. whether config files in /etc or $LOCALBASE/etc will be different in the "emulation", or shared with the base system. The same applies to /usr/share, which ought to be architecture independent. This could be an alternative layout to e.g. having 32 bit libraries in /usr/lib32 (with both supported for backwards compatibility). Regards, STefan --------------6005C58DBE0DE8579C75247F-- --hRu7QVS3TWetlya4VxohdaUGiiwaxecYM-- --vc55wHOJxz1ErwaTySVKeRvTMDHkNrXju Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEo3HqZZwL7MgrcVMTR+u171r99UQFAl+j4UAFAwAAAAAACgkQR+u171r99USI gQf/QLO/52Rp2Sk5iMdEbOCT0nR9JoxeoGj+l6GTwWzp69D3V5S+pNYCJ3FFCgzjzlKpSNYy7RmA Zafea833hmfbrWVHO2UxlxnENpmYEE+BG2xTSbFLm7IEDv3RKQA2FqBKXYgZTBmKfNtp+B2ZUpvo pOzLaOhdREi14nKSQC35gH2qfwWuHWs5nqCOHEWeWg3pVVDMpDxuaijVVP0i6MeDrwDIPd+Ou6WJ k5fRON6Frm5VWjZYk54gSQUaE1BUltlUR8eLMZnV34cYerHASh+qdzyW3MCOzNgqx5Jr4pGWNPcX PIZ9G4KOlHKP/n/MjsEc1i7Z7dB++oh66fRYP7XjyA== =B2Uc -----END PGP SIGNATURE----- --vc55wHOJxz1ErwaTySVKeRvTMDHkNrXju-- From owner-svn-src-head@freebsd.org Thu Nov 5 12:06:51 2020 Return-Path: Delivered-To: svn-src-head@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 1EC8C46637F; Thu, 5 Nov 2020 12:06:51 +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 4CRj1R0M19z4Zyr; Thu, 5 Nov 2020 12:06:51 +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 F342713466; Thu, 5 Nov 2020 12:06:50 +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 0A5C6oBu024394; Thu, 5 Nov 2020 12:06:50 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5C6oZ6024393; Thu, 5 Nov 2020 12:06:50 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011051206.0A5C6oZ6024393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 12:06:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367372 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 12:06:51 -0000 Author: mjg Date: Thu Nov 5 12:06:50 2020 New Revision: 367372 URL: https://svnweb.freebsd.org/changeset/base/367372 Log: vfs: change nt_zone into a malloc type Elements are small in size and allocated for short periods. Modified: head/sys/kern/vfs_lookup.c Modified: head/sys/kern/vfs_lookup.c ============================================================================== --- head/sys/kern/vfs_lookup.c Thu Nov 5 11:56:49 2020 (r367371) +++ head/sys/kern/vfs_lookup.c Thu Nov 5 12:06:50 2020 (r367372) @@ -149,7 +149,7 @@ struct nameicap_tracker { }; /* Zone for cap mode tracker elements used for dotdot capability checks. */ -static uma_zone_t nt_zone; +MALLOC_DEFINE(M_NAMEITRACKER, "namei_tracker", "namei tracking for dotdot"); static void nameiinit(void *dummy __unused) @@ -157,8 +157,6 @@ nameiinit(void *dummy __unused) namei_zone = uma_zcreate("NAMEI", MAXPATHLEN, NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - nt_zone = uma_zcreate("rentr", sizeof(struct nameicap_tracker), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); vfs_vector_op_register(&crossmp_vnodeops); getnewvnode("crossmp", NULL, &crossmp_vnodeops, &vp_crossmp); } @@ -190,7 +188,7 @@ nameicap_tracker_add(struct nameidata *ndp, struct vno return; ndp->ni_lcf |= NI_LCF_BENEATH_LATCHED; } - nt = uma_zalloc(nt_zone, M_WAITOK); + nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); vhold(dp); nt->dp = dp; TAILQ_INSERT_TAIL(&ndp->ni_cap_tracker, nt, nm_link); @@ -206,7 +204,7 @@ nameicap_cleanup(struct nameidata *ndp, bool clean_lat TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link); vdrop(nt->dp); - uma_zfree(nt_zone, nt); + free(nt, M_NAMEITRACKER); } if (clean_latch && (ndp->ni_lcf & NI_LCF_LATCH) != 0) { ndp->ni_lcf &= ~NI_LCF_LATCH; From owner-svn-src-head@freebsd.org Thu Nov 5 12:08:50 2020 Return-Path: Delivered-To: svn-src-head@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 86F69466A03; Thu, 5 Nov 2020 12:08:50 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) (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 4CRj3j643sz4bK5; Thu, 5 Nov 2020 12:08:49 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x430.google.com with SMTP id x7so1488766wrl.3; Thu, 05 Nov 2020 04:08:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=N1hC0sGueWOQEPbx/IvRvvWYsF83Ep2Y7BjvNqH8jdI=; b=AshUHqH0frDAA18iQ1TtWfnKn2gWuBpM8tSBkoqJp2s/I9X7wuJkiCQRs/+lZUD1RM 5r4zDGZe/QzWt+ZbGSxMbgQ3Ar/xc8G4i80nFMG/A24w/CF6BE88WkKX4F7bsK+pujG9 iAqM/n66NGqzTtUGaBf28UPePltPIfXej+Fu3vCxOXm1Z5ery+uphhoaCrm2u7uN9kks M5PGAxOSLWBZuho9u4FFmKQ95/t28wrAb6mbcLnWd2yzcAZAa/IFC9HvCNtrdGSkUbV9 NGQvfku1cvC+QaiscBrVfJibUoIFPzR1woHmBFN4cioG7BikbqccWaMk2iMskzeuBAcl /DdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=N1hC0sGueWOQEPbx/IvRvvWYsF83Ep2Y7BjvNqH8jdI=; b=Oh714gWSOj/vOfLCccJ6m0HxX6HBcSx2gQrqrG6FQ7xg2XPADfke/6/zQV+ZQ8yR2c IvLHOCphXDuaqkDIB34OtFQLx+152bP7gZtMTBxU66x6u0fsQT3zSqcKbUUU+bYxeWiZ FEC4FIAgpsFlKlSk1tYxuR8LC8kGpk0eYNLRleO6i1LlY4MN/PlGMFcbHP6bTa/kRoe/ 6mmgONrszj/5G6+TeZJt08a914cZ5JIclXQT6c7ClUDlWZgrl8M2RkVrxF81U03DOyjw Il5U5QTDotciQQSmFV0cC+/vv5SpOSyT0ZLvOZtTWhw3XtjtlbQC1MwiV88x1Q79mONY Hxtw== X-Gm-Message-State: AOAM532yNY18MalDs2fxeWtTJ3+1O1mOzU0Nl5cGbslADcEj9a6RQ2Hs 4iEB877lQi8uZd4QdOtOeHRCHhVocIUGCq7bOkItRCy7HJw= X-Google-Smtp-Source: ABdhPJznFxlhDZZchM1Pf5nMRVrErRCbzC6hvsaGL5FUViPSYEKd8u0Zdif9xhePZ0fZ66PDvpzBrb+I0KuEvwi2Y18= X-Received: by 2002:adf:9b98:: with SMTP id d24mr723532wrc.17.1604578128408; Thu, 05 Nov 2020 04:08:48 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4c4f:0:0:0:0:0 with HTTP; Thu, 5 Nov 2020 04:08:47 -0800 (PST) In-Reply-To: <20201105074702.GA83145@FreeBSD.org> References: <202011042118.0A4LIq3H077210@repo.freebsd.org> <20201105074702.GA83145@FreeBSD.org> From: Mateusz Guzik Date: Thu, 5 Nov 2020 13:08:47 +0100 Message-ID: Subject: Re: svn commit: r367343 - in head/sys/contrib/openzfs/include/os: freebsd/zfs/sys linux/zfs/sys To: Alexey Dokuchaev Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CRj3j643sz4bK5 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=AshUHqH0; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::430 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-1.94 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::430:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::430:from:127.0.2.255]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::430:from]; NEURAL_HAM_SHORT(-0.94)[-0.937]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 12:08:50 -0000 On 11/5/20, Alexey Dokuchaev wrote: > On Wed, Nov 04, 2020 at 09:18:52PM +0000, Mateusz Guzik wrote: >> New Revision: 367343 >> URL: https://svnweb.freebsd.org/changeset/base/367343 >> >> Log: >> zfs: add branch prediction to ZFS_ENTER and ZFS_VERIFY_ZP macros >> >> They are expected to fail only in corner cases. >> >> Modified: >> head/sys/contrib/openzfs/include/os/freebsd/zfs/sys/zfs_znode_impl.h >> head/sys/contrib/openzfs/include/os/linux/zfs/sys/zfs_znode_impl.h > > Since my earlier email was ignored, I'd take this chance to ask again: > why Linux-specific bits present in the head and had to be updated like > in this commit? They shouldn't have made past the vendor branch, no? > I don't know the reasoning for putting these files here. I suspect this is to make merging easier. fwiw I don't think they are a problem. The patch at hand modified them as it was based on the work against the upstream repo and followed suit -- Mateusz Guzik From owner-svn-src-head@freebsd.org Thu Nov 5 12:24:37 2020 Return-Path: Delivered-To: svn-src-head@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 BD699466D77; Thu, 5 Nov 2020 12:24:37 +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 4CRjPx51Fxz4cq3; Thu, 5 Nov 2020 12:24:37 +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 944DD13BBC; Thu, 5 Nov 2020 12:24:37 +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 0A5CObZi037242; Thu, 5 Nov 2020 12:24:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5CObdK037241; Thu, 5 Nov 2020 12:24:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011051224.0A5CObdK037241@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 12:24:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367379 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 12:24:37 -0000 Author: mjg Date: Thu Nov 5 12:24:37 2020 New Revision: 367379 URL: https://svnweb.freebsd.org/changeset/base/367379 Log: poll/select: change selfd_zone into a malloc type On a sample box vmstat -z shows: ITEM SIZE LIMIT USED FREE REQ 64: 64, 0, 1043784, 4367538,3698187229 selfd: 64, 0, 1520, 13726,182729008 But at the same time: vm.uma.selfd.keg.domain.1.pages: 121 vm.uma.selfd.keg.domain.0.pages: 121 Thus 242 pages got pulled even though the malloc zone would likely accomodate the load without using extra memory. Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Thu Nov 5 12:17:50 2020 (r367378) +++ head/sys/kern/sys_generic.c Thu Nov 5 12:24:37 2020 (r367379) @@ -159,7 +159,7 @@ struct selfd { u_int sf_refs; }; -static uma_zone_t selfd_zone; +MALLOC_DEFINE(M_SELFD, "selfd", "selfd"); static struct mtx_pool *mtxpool_select; #ifdef __LP64__ @@ -1691,11 +1691,11 @@ selfdalloc(struct thread *td, void *cookie) stp = td->td_sel; if (stp->st_free1 == NULL) - stp->st_free1 = uma_zalloc(selfd_zone, M_WAITOK|M_ZERO); + stp->st_free1 = malloc(sizeof(*stp->st_free1), M_SELFD, M_WAITOK|M_ZERO); stp->st_free1->sf_td = stp; stp->st_free1->sf_cookie = cookie; if (stp->st_free2 == NULL) - stp->st_free2 = uma_zalloc(selfd_zone, M_WAITOK|M_ZERO); + stp->st_free2 = malloc(sizeof(*stp->st_free2), M_SELFD, M_WAITOK|M_ZERO); stp->st_free2->sf_td = stp; stp->st_free2->sf_cookie = cookie; } @@ -1713,7 +1713,7 @@ selfdfree(struct seltd *stp, struct selfd *sfp) mtx_unlock(sfp->sf_mtx); } if (refcount_release(&sfp->sf_refs)) - uma_zfree(selfd_zone, sfp); + free(sfp, M_SELFD); } /* Drain the waiters tied to all the selfd belonging the specified selinfo. */ @@ -1827,7 +1827,7 @@ doselwakeup(struct selinfo *sip, int pri) cv_broadcastpri(&stp->st_wait, pri); mtx_unlock(&stp->st_mtx); if (refcount_release(&sfp->sf_refs)) - uma_zfree(selfd_zone, sfp); + free(sfp, M_SELFD); } mtx_unlock(sip->si_mtx); } @@ -1888,9 +1888,9 @@ seltdfini(struct thread *td) if (stp == NULL) return; if (stp->st_free1) - uma_zfree(selfd_zone, stp->st_free1); + free(stp->st_free1, M_SELFD); if (stp->st_free2) - uma_zfree(selfd_zone, stp->st_free2); + free(stp->st_free2, M_SELFD); td->td_sel = NULL; cv_destroy(&stp->st_wait); mtx_destroy(&stp->st_mtx); @@ -1920,8 +1920,6 @@ static void selectinit(void *dummy __unused) { - selfd_zone = uma_zcreate("selfd", sizeof(struct selfd), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); mtxpool_select = mtx_pool_create("select mtxpool", 128, MTX_DEF); } From owner-svn-src-head@freebsd.org Thu Nov 5 14:15:52 2020 Return-Path: Delivered-To: svn-src-head@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 0301E469704; Thu, 5 Nov 2020 14:15:52 +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 4CRltH6cjbz4kXT; Thu, 5 Nov 2020 14:15:51 +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 D61C015352; Thu, 5 Nov 2020 14:15:51 +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 0A5EFpPV004992; Thu, 5 Nov 2020 14:15:51 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5EFpc8004988; Thu, 5 Nov 2020 14:15:51 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011051415.0A5EFpc8004988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 5 Nov 2020 14:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367383 - in head/sys: dev/hwpmc powerpc/include powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys: dev/hwpmc powerpc/include powerpc/powerpc X-SVN-Commit-Revision: 367383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 14:15:52 -0000 Author: luporl Date: Thu Nov 5 14:15:50 2020 New Revision: 367383 URL: https://svnweb.freebsd.org/changeset/base/367383 Log: [PowerPC] Make PPC 970 PMC SPRs the standard ones And add a _74XX suffix to 74XX SPRs. This is a preparation for adding support to POWER8/9 PMCs, which have most SPRs equal to 970 ones. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26532 Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c head/sys/dev/hwpmc/hwpmc_ppc970.c head/sys/powerpc/include/spr.h head/sys/powerpc/powerpc/cpu.c Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Thu Nov 5 13:45:26 2020 (r367382) +++ head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Thu Nov 5 14:15:50 2020 (r367383) @@ -48,12 +48,15 @@ __FBSDID("$FreeBSD$"); PMC_CAP_WRITE | PMC_CAP_INVERT | \ PMC_CAP_QUALIFIER) -#define PPC_SET_PMC1SEL(r, x) ((r & ~(SPR_MMCR0_PMC1SEL(0x3f))) | SPR_MMCR0_PMC1SEL(x)) -#define PPC_SET_PMC2SEL(r, x) ((r & ~(SPR_MMCR0_PMC2SEL(0x3f))) | SPR_MMCR0_PMC2SEL(x)) +#define PPC_SET_PMC1SEL(r, x) ((r & ~(SPR_MMCR0_74XX_PMC1SEL(0x3f))) | \ + SPR_MMCR0_74XX_PMC1SEL(x)) +#define PPC_SET_PMC2SEL(r, x) ((r & ~(SPR_MMCR0_74XX_PMC2SEL(0x3f))) | \ + SPR_MMCR0_74XX_PMC2SEL(x)) #define PPC_SET_PMC3SEL(r, x) ((r & ~(SPR_MMCR1_PMC3SEL(0x1f))) | SPR_MMCR1_PMC3SEL(x)) #define PPC_SET_PMC4SEL(r, x) ((r & ~(SPR_MMCR1_PMC4SEL(0x1f))) | SPR_MMCR1_PMC4SEL(x)) #define PPC_SET_PMC5SEL(r, x) ((r & ~(SPR_MMCR1_PMC5SEL(0x1f))) | SPR_MMCR1_PMC5SEL(x)) -#define PPC_SET_PMC6SEL(r, x) ((r & ~(SPR_MMCR1_PMC6SEL(0x3f))) | SPR_MMCR1_PMC6SEL(x)) +#define PPC_SET_PMC6SEL(r, x) ((r & ~(SPR_MMCR1_74XX_PMC6SEL(0x3f))) | \ + SPR_MMCR1_74XX_PMC6SEL(x)) /* Change this when we support more than just the 7450. */ #define MPC7XXX_MAX_PMCS 6 @@ -318,22 +321,22 @@ mpc7xxx_pmcn_read(unsigned int pmc) { switch (pmc) { case 0: - return mfspr(SPR_PMC1); + return mfspr(SPR_PMC1_74XX); break; case 1: - return mfspr(SPR_PMC2); + return mfspr(SPR_PMC2_74XX); break; case 2: - return mfspr(SPR_PMC3); + return mfspr(SPR_PMC3_74XX); break; case 3: - return mfspr(SPR_PMC4); + return mfspr(SPR_PMC4_74XX); break; case 4: - return mfspr(SPR_PMC5); + return mfspr(SPR_PMC5_74XX); break; case 5: - return mfspr(SPR_PMC6); + return mfspr(SPR_PMC6_74XX); default: panic("Invalid PMC number: %d\n", pmc); } @@ -344,22 +347,22 @@ mpc7xxx_pmcn_write(unsigned int pmc, uint32_t val) { switch (pmc) { case 0: - mtspr(SPR_PMC1, val); + mtspr(SPR_PMC1_74XX, val); break; case 1: - mtspr(SPR_PMC2, val); + mtspr(SPR_PMC2_74XX, val); break; case 2: - mtspr(SPR_PMC3, val); + mtspr(SPR_PMC3_74XX, val); break; case 3: - mtspr(SPR_PMC4, val); + mtspr(SPR_PMC4_74XX, val); break; case 4: - mtspr(SPR_PMC5, val); + mtspr(SPR_PMC5_74XX, val); break; case 5: - mtspr(SPR_PMC6, val); + mtspr(SPR_PMC6_74XX, val); break; default: panic("Invalid PMC number: %d\n", pmc); @@ -452,34 +455,34 @@ mpc7xxx_start_pmc(int cpu, int ri) /* Enable the PMC. */ switch (ri) { case 0: - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, config); - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 1: - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, config); - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 2: - pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1_74XX); pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, config); - mtspr(SPR_MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; case 3: - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, config); - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 4: - pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1_74XX); pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, config); - mtspr(SPR_MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; case 5: - pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1_74XX); pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, config); - mtspr(SPR_MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; default: break; @@ -490,10 +493,10 @@ mpc7xxx_start_pmc(int cpu, int ri) */ config = ~pm->pm_md.pm_powerpc.pm_powerpc_evsel & POWERPC_PMC_ENABLE; - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr &= ~SPR_MMCR0_FC; pmc_mmcr |= config; - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); return 0; } @@ -513,34 +516,34 @@ mpc7xxx_stop_pmc(int cpu, int ri) */ switch (ri) { case 0: - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, 0); - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 1: - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, 0); - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 2: - pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1_74XX); pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, 0); - mtspr(SPR_MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; case 3: - pmc_mmcr = mfspr(SPR_MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0_74XX); pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, 0); - mtspr(SPR_MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 4: - pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1_74XX); pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, 0); - mtspr(SPR_MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; case 5: - pmc_mmcr = mfspr(SPR_MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1_74XX); pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, 0); - mtspr(SPR_MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; default: break; @@ -577,9 +580,9 @@ mpc7xxx_pcpu_init(struct pmc_mdep *md, int cpu) } /* Clear the MMCRs, and set FC, to disable all PMCs. */ - mtspr(SPR_MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | + mtspr(SPR_MMCR0_74XX, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_FCECE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE); - mtspr(SPR_MMCR1, 0); + mtspr(SPR_MMCR1_74XX, 0); return 0; } @@ -587,11 +590,11 @@ mpc7xxx_pcpu_init(struct pmc_mdep *md, int cpu) static int mpc7xxx_pcpu_fini(struct pmc_mdep *md, int cpu) { - uint32_t mmcr0 = mfspr(SPR_MMCR0); + uint32_t mmcr0 = mfspr(SPR_MMCR0_74XX); mtmsr(mfmsr() & ~PSL_PMM); mmcr0 |= SPR_MMCR0_FC; - mtspr(SPR_MMCR0, mmcr0); + mtspr(SPR_MMCR0_74XX, mmcr0); free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); free(powerpc_pcpu[cpu], M_PMC); @@ -678,7 +681,7 @@ mpc7xxx_intr(struct trapframe *tf) pac = powerpc_pcpu[cpu]; - config = mfspr(SPR_MMCR0) & ~SPR_MMCR0_FC; + config = mfspr(SPR_MMCR0_74XX) & ~SPR_MMCR0_FC; /* * look for all PMCs that have interrupted: @@ -717,7 +720,7 @@ mpc7xxx_intr(struct trapframe *tf) /* Re-enable PERF exceptions. */ if (retval) - mtspr(SPR_MMCR0, config | SPR_MMCR0_PMXE); + mtspr(SPR_MMCR0_74XX, config | SPR_MMCR0_PMXE); return (retval); } Modified: head/sys/dev/hwpmc/hwpmc_ppc970.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_ppc970.c Thu Nov 5 13:45:26 2020 (r367382) +++ head/sys/dev/hwpmc/hwpmc_ppc970.c Thu Nov 5 14:15:50 2020 (r367383) @@ -276,28 +276,28 @@ ppc970_pmcn_read(unsigned int pmc) switch (pmc) { case 0: - val = mfspr(SPR_970PMC1); + val = mfspr(SPR_PMC1); break; case 1: - val = mfspr(SPR_970PMC2); + val = mfspr(SPR_PMC2); break; case 2: - val = mfspr(SPR_970PMC3); + val = mfspr(SPR_PMC3); break; case 3: - val = mfspr(SPR_970PMC4); + val = mfspr(SPR_PMC4); break; case 4: - val = mfspr(SPR_970PMC5); + val = mfspr(SPR_PMC5); break; case 5: - val = mfspr(SPR_970PMC6); + val = mfspr(SPR_PMC6); break; case 6: - val = mfspr(SPR_970PMC7); + val = mfspr(SPR_PMC7); break; case 7: - val = mfspr(SPR_970PMC8); + val = mfspr(SPR_PMC8); break; default: panic("Invalid PMC number: %d\n", pmc); @@ -311,28 +311,28 @@ ppc970_pmcn_write(unsigned int pmc, uint32_t val) { switch (pmc) { case 0: - mtspr(SPR_970PMC1, val); + mtspr(SPR_PMC1, val); break; case 1: - mtspr(SPR_970PMC2, val); + mtspr(SPR_PMC2, val); break; case 2: - mtspr(SPR_970PMC3, val); + mtspr(SPR_PMC3, val); break; case 3: - mtspr(SPR_970PMC4, val); + mtspr(SPR_PMC4, val); break; case 4: - mtspr(SPR_970PMC5, val); + mtspr(SPR_PMC5, val); break; case 5: - mtspr(SPR_970PMC6, val); + mtspr(SPR_PMC6, val); break; case 6: - mtspr(SPR_970PMC7, val); + mtspr(SPR_PMC7, val); break; case 7: - mtspr(SPR_970PMC8, val); + mtspr(SPR_PMC8, val); break; default: panic("Invalid PMC number: %d\n", pmc); @@ -378,9 +378,9 @@ ppc970_set_pmc(int cpu, int ri, int config) switch (ri) { case 0: case 1: - pmc_mmcr = mfspr(SPR_970MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0); pmc_mmcr = PPC970_SET_MMCR0_PMCSEL(pmc_mmcr, config, ri); - mtspr(SPR_970MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0, pmc_mmcr); break; case 2: case 3: @@ -388,9 +388,9 @@ ppc970_set_pmc(int cpu, int ri, int config) case 5: case 6: case 7: - pmc_mmcr = mfspr(SPR_970MMCR1); + pmc_mmcr = mfspr(SPR_MMCR1); pmc_mmcr = PPC970_SET_MMCR1_PMCSEL(pmc_mmcr, config, ri); - mtspr(SPR_970MMCR1, pmc_mmcr); + mtspr(SPR_MMCR1, pmc_mmcr); break; } return 0; @@ -416,10 +416,10 @@ ppc970_start_pmc(int cpu, int ri) */ config = ~pm->pm_md.pm_powerpc.pm_powerpc_evsel & POWERPC_PMC_ENABLE; - pmc_mmcr = mfspr(SPR_970MMCR0); + pmc_mmcr = mfspr(SPR_MMCR0); pmc_mmcr &= ~SPR_MMCR0_FC; pmc_mmcr |= config; - mtspr(SPR_970MMCR0, pmc_mmcr); + mtspr(SPR_MMCR0, pmc_mmcr); return 0; } @@ -505,7 +505,7 @@ ppc970_intr(struct trapframe *tf) * If found, we call a helper to process the interrupt. */ - config = mfspr(SPR_970MMCR0) & ~SPR_MMCR0_FC; + config = mfspr(SPR_MMCR0) & ~SPR_MMCR0_FC; for (i = 0; i < PPC970_MAX_PMCS; i++) { if ((pm = pac->pc_ppcpmcs[i].phw_pmc) == NULL || !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { @@ -535,7 +535,7 @@ ppc970_intr(struct trapframe *tf) /* Re-enable PERF exceptions. */ if (retval) - mtspr(SPR_970MMCR0, config | SPR_MMCR0_PMXE); + mtspr(SPR_MMCR0, config | SPR_MMCR0_PMXE); return (retval); } @@ -571,10 +571,10 @@ ppc970_pcpu_init(struct pmc_mdep *md, int cpu) /* Clear the MMCRs, and set FC, to disable all PMCs. */ /* 970 PMC is not counted when set to 0x08 */ - mtspr(SPR_970MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | + mtspr(SPR_MMCR0, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_FCECE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE | - SPR_970MMCR0_PMC1SEL(0x8) | SPR_970MMCR0_PMC2SEL(0x8)); - mtspr(SPR_970MMCR1, 0x4218420); + SPR_MMCR0_PMC1SEL(0x8) | SPR_MMCR0_PMC2SEL(0x8)); + mtspr(SPR_MMCR1, 0x4218420); return 0; } Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Thu Nov 5 13:45:26 2020 (r367382) +++ head/sys/powerpc/include/spr.h Thu Nov 5 14:15:50 2020 (r367383) @@ -412,6 +412,7 @@ #define Mx_CTR_PPCS 0x02000000 /* Priv/user state compare mode */ #define Mx_CTR_TLB_INDX 0x000001f0 /* TLB index mask */ #define Mx_CTR_TLB_INDX_BITPOS 8 /* TLB index shift */ + #define SPR_MI_AP 0x312 /* ..8 IMMU access protection */ #define Mx_GP_SUPER(n) (0 << (2*(15-(n)))) /* access is supervisor */ #define Mx_GP_PAGE (1 << (2*(15-(n)))) /* access is page protect */ @@ -441,26 +442,68 @@ #define SPR_MD_AP 0x31a /* ..8 DMMU access protection */ #define SPR_MD_EPN 0x31b /* ..8 DMMU effective number */ -#define SPR_970MMCR0 0x31b /* ... Monitor Mode Control Register 0 (PPC 970) */ -#define SPR_970MMCR0_PMC1SEL(x) ((x) << 8) /* PMC1 selector (970) */ -#define SPR_970MMCR0_PMC2SEL(x) ((x) << 1) /* PMC2 selector (970) */ -#define SPR_970MMCR1 0x31e /* ... Monitor Mode Control Register 1 (PPC 970) */ -#define SPR_970MMCR1_PMC3SEL(x) (((x) & 0x1f) << 27) /* PMC 3 selector */ -#define SPR_970MMCR1_PMC4SEL(x) (((x) & 0x1f) << 22) /* PMC 4 selector */ -#define SPR_970MMCR1_PMC5SEL(x) (((x) & 0x1f) << 17) /* PMC 5 selector */ -#define SPR_970MMCR1_PMC6SEL(x) (((x) & 0x1f) << 12) /* PMC 6 selector */ -#define SPR_970MMCR1_PMC7SEL(x) (((x) & 0x1f) << 7) /* PMC 7 selector */ -#define SPR_970MMCR1_PMC8SEL(x) (((x) & 0x1f) << 2) /* PMC 8 selector */ -#define SPR_970MMCRA 0x312 /* ... Monitor Mode Control Register 2 (PPC 970) */ -#define SPR_970PMC1 0x313 /* ... PMC 1 */ -#define SPR_970PMC2 0x314 /* ... PMC 2 */ -#define SPR_970PMC3 0x315 /* ... PMC 3 */ -#define SPR_970PMC4 0x316 /* ... PMC 4 */ -#define SPR_970PMC5 0x317 /* ... PMC 5 */ -#define SPR_970PMC6 0x318 /* ... PMC 6 */ -#define SPR_970PMC7 0x319 /* ... PMC 7 */ -#define SPR_970PMC8 0x31a /* ... PMC 8 */ +#define SPR_MMCRA 0x312 /* ... Monitor Mode Control Register A */ +#define SPR_PMC1 0x313 /* ... PMC 1 */ +#define SPR_PMC2 0x314 /* ... PMC 2 */ +#define SPR_PMC3 0x315 /* ... PMC 3 */ +#define SPR_PMC4 0x316 /* ... PMC 4 */ +#define SPR_PMC5 0x317 /* ... PMC 5 */ +#define SPR_PMC6 0x318 /* ... PMC 6 */ +#define SPR_PMC7 0x319 /* ... PMC 7 */ +#define SPR_PMC8 0x31a /* ... PMC 8 */ +#define SPR_MMCR0 0x31b /* ... Monitor Mode Control Register 0 */ +#define SPR_MMCR0_FC 0x80000000 /* Freeze counters */ +#define SPR_MMCR0_FCS 0x40000000 /* Freeze counters in supervisor mode */ +#define SPR_MMCR0_FCP 0x20000000 /* Freeze counters in user mode */ +#define SPR_MMCR0_FCM1 0x10000000 /* Freeze counters when mark=1 */ +#define SPR_MMCR0_FCM0 0x08000000 /* Freeze counters when mark=0 */ +#define SPR_MMCR0_PMXE 0x04000000 /* Enable PM interrupt */ +#define SPR_MMCR0_PMAE 0x04000000 /* PM Alert Enable */ +#define SPR_MMCR0_FCECE 0x02000000 /* Freeze counters after event */ +#define SPR_MMCR0_TBSEL_15 0x01800000 /* Count bit 15 of TBL */ +#define SPR_MMCR0_TBSEL_19 0x01000000 /* Count bit 19 of TBL */ +#define SPR_MMCR0_TBSEL_23 0x00800000 /* Count bit 23 of TBL */ +#define SPR_MMCR0_TBSEL_31 0x00000000 /* Count bit 31 of TBL */ +#define SPR_MMCR0_TBEE 0x00400000 /* Time-base event enable */ +#define SPR_MMCR0_THRESHOLD(x) ((x) << 16) /* Threshold value */ +#define SPR_MMCR0_PMC1CE 0x00008000 /* PMC1 condition enable */ +#define SPR_MMCR0_PMCNCE 0x00004000 /* PMCn condition enable */ +#define SPR_MMCR0_TRIGGER 0x00002000 /* Trigger */ +#define SPR_MMCR0_PMAO 0x00000080 /* PM Alert Occurred */ +#define SPR_MMCR0_FCPC 0x00001000 /* Freeze Counters in Problem State Cond. */ +#define SPR_MMCR0_FC56 0x00000010 /* Freeze Counters 5-6 */ +#define SPR_MMCR0_PMC1SEL(x) ((x) << 8) /* PMC1 selector (970) */ +#define SPR_MMCR0_PMC2SEL(x) ((x) << 1) /* PMC2 selector (970) */ +#define SPR_MMCR0_74XX_PMC1SEL(x) (((x) & 0x3f) << 6) /* PMC1 selector */ +#define SPR_MMCR0_74XX_PMC2SEL(x) (((x) & 0x3f) << 0) /* PMC2 selector */ + +#define SPR_MMCR1 0x31e /* ... Monitor Mode Control Register 1 */ +#define SPR_MMCR1_PMC3SEL(x) (((x) & 0x1f) << 27) /* PMC 3 selector */ +#define SPR_MMCR1_PMC4SEL(x) (((x) & 0x1f) << 22) /* PMC 4 selector */ +#define SPR_MMCR1_PMC5SEL(x) (((x) & 0x1f) << 17) /* PMC 5 selector */ +#define SPR_MMCR1_PMC6SEL(x) (((x) & 0x1f) << 12) /* PMC 6 selector */ +#define SPR_MMCR1_74XX_PMC6SEL(x) (((x) & 0x3f) << 11) /* PMC 6 selector */ +#define SPR_MMCR1_PMC7SEL(x) (((x) & 0x1f) << 7) /* PMC 7 selector */ +#define SPR_MMCR1_PMC8SEL(x) (((x) & 0x1f) << 2) /* PMC 8 selector */ +#define SPR_MMCR1_P8_PMCSEL_ALL 0xffffffff +#define SPR_MMCR1_P8_PMCNSEL_MASK(n) (0xffUL << ((3-(n))*8)) +#define SPR_MMCR1_P8_PMCNSEL(n, v) ((unsigned long)(v) << ((3-(n))*8)) + +#define SPR_MMCR2 0x311 +#define SPR_MMCR2_CNBIT(n, bit) ((bit) << (((5 - (n)) * 9) + 10)) +#define SPR_MMCR2_FCNS(n) SPR_MMCR2_CNBIT(n, 0x100UL) +#define SPR_MMCR2_FCNP0(n) SPR_MMCR2_CNBIT(n, 0x080UL) +#define SPR_MMCR2_FCNP1(n) SPR_MMCR2_CNBIT(n, 0x040UL) +#define SPR_MMCR2_FCNM1(n) SPR_MMCR2_CNBIT(n, 0x020UL) +#define SPR_MMCR2_FCNM0(n) SPR_MMCR2_CNBIT(n, 0x010UL) +#define SPR_MMCR2_FCNWAIT(n) SPR_MMCR2_CNBIT(n, 0x008UL) +#define SPR_MMCR2_FCNH(n) SPR_MMCR2_CNBIT(n, 0x004UL) +/* Freeze Counter N in Hypervisor/Supervisor/Problem states */ +#define SPR_MMCR2_FCNHSP(n) \ + (SPR_MMCR2_FCNS(n) | SPR_MMCR2_FCNP0(n) | \ + SPR_MMCR2_FCNP1(n) | SPR_MMCR2_FCNH(n)) + #define SPR_M_TWB 0x31c /* ..8 MMU tablewalk base */ #define M_TWB_L1TB 0xfffff000 /* level-1 translation base */ #define M_TWB_L1INDX 0x00000ffc /* level-1 index */ @@ -502,41 +545,19 @@ #define SPR_UMMCR0 0x3a8 /* .6. User Monitor Mode Control Register 0 */ #define SPR_USIA 0x3ab /* .6. User Sampled Instruction Address */ #define SPR_UMMCR1 0x3ac /* .6. User Monitor Mode Control Register 1 */ -#define SPR_MMCR2 0x3b0 /* .6. Monitor Mode Control Register 2 */ -#define SPR_MMCR2_THRESHMULT_32 0x80000000 /* Multiply MMCR0 threshold by 32 */ -#define SPR_MMCR2_THRESHMULT_2 0x00000000 /* Multiply MMCR0 threshold by 2 */ -#define SPR_PMC5 0x3b1 /* .6. Performance Counter Register 5 */ -#define SPR_PMC6 0x3b2 /* .6. Performance Counter Register 6 */ -#define SPR_MMCR0 0x3b8 /* .6. Monitor Mode Control Register 0 */ -#define SPR_MMCR0_FC 0x80000000 /* Freeze counters */ -#define SPR_MMCR0_FCS 0x40000000 /* Freeze counters in supervisor mode */ -#define SPR_MMCR0_FCP 0x20000000 /* Freeze counters in user mode */ -#define SPR_MMCR0_FCM1 0x10000000 /* Freeze counters when mark=1 */ -#define SPR_MMCR0_FCM0 0x08000000 /* Freeze counters when mark=0 */ -#define SPR_MMCR0_PMXE 0x04000000 /* Enable PM interrupt */ -#define SPR_MMCR0_FCECE 0x02000000 /* Freeze counters after event */ -#define SPR_MMCR0_TBSEL_15 0x01800000 /* Count bit 15 of TBL */ -#define SPR_MMCR0_TBSEL_19 0x01000000 /* Count bit 19 of TBL */ -#define SPR_MMCR0_TBSEL_23 0x00800000 /* Count bit 23 of TBL */ -#define SPR_MMCR0_TBSEL_31 0x00000000 /* Count bit 31 of TBL */ -#define SPR_MMCR0_TBEE 0x00400000 /* Time-base event enable */ -#define SPR_MMCRO_THRESHOLD(x) ((x) << 16) /* Threshold value */ -#define SPR_MMCR0_PMC1CE 0x00008000 /* PMC1 condition enable */ -#define SPR_MMCR0_PMCNCE 0x00004000 /* PMCn condition enable */ -#define SPR_MMCR0_TRIGGER 0x00002000 /* Trigger */ -#define SPR_MMCR0_PMC1SEL(x) (((x) & 0x3f) << 6) /* PMC1 selector */ -#define SPR_MMCR0_PMC2SEL(x) (((x) & 0x3f) << 0) /* PMC2 selector */ -#define SPR_PMC1 0x3b9 /* .6. Performance Counter Register 1 */ -#define SPR_PMC2 0x3ba /* .6. Performance Counter Register 2 */ +#define SPR_MMCR2_74XX 0x3b0 /* .6. Monitor Mode Control Register 2 */ +#define SPR_MMCR2_74XX_THRESHMULT_32 0x80000000 /* Multiply MMCR0 threshold by 32 */ +#define SPR_MMCR2_74XX_THRESHMULT_2 0x00000000 /* Multiply MMCR0 threshold by 2 */ +#define SPR_PMC5_74XX 0x3b1 /* .6. Performance Counter Register 5 */ +#define SPR_PMC6_74XX 0x3b2 /* .6. Performance Counter Register 6 */ +#define SPR_MMCR0_74XX 0x3b8 /* .6. Monitor Mode Control Register 0 */ +#define SPR_PMC1_74XX 0x3b9 /* .6. Performance Counter Register 1 */ +#define SPR_PMC2_74XX 0x3ba /* .6. Performance Counter Register 2 */ #define SPR_SIA 0x3bb /* .6. Sampled Instruction Address */ -#define SPR_MMCR1 0x3bc /* .6. Monitor Mode Control Register 2 */ -#define SPR_MMCR1_PMC3SEL(x) (((x) & 0x1f) << 27) /* PMC 3 selector */ -#define SPR_MMCR1_PMC4SEL(x) (((x) & 0x1f) << 22) /* PMC 4 selector */ -#define SPR_MMCR1_PMC5SEL(x) (((x) & 0x1f) << 17) /* PMC 5 selector */ -#define SPR_MMCR1_PMC6SEL(x) (((x) & 0x3f) << 11) /* PMC 6 selector */ +#define SPR_MMCR1_74XX 0x3bc /* .6. Monitor Mode Control Register 2 */ -#define SPR_PMC3 0x3bd /* .6. Performance Counter Register 3 */ -#define SPR_PMC4 0x3be /* .6. Performance Counter Register 4 */ +#define SPR_PMC3_74XX 0x3bd /* .6. Performance Counter Register 3 */ +#define SPR_PMC4_74XX 0x3be /* .6. Performance Counter Register 4 */ #define SPR_DMISS 0x3d0 /* .68 Data TLB Miss Address Register */ #define SPR_DCMP 0x3d1 /* .68 Data TLB Compare Register */ #define SPR_HASH1 0x3d2 /* .68 Primary Hash Address Register */ Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Thu Nov 5 13:45:26 2020 (r367382) +++ head/sys/powerpc/powerpc/cpu.c Thu Nov 5 14:15:50 2020 (r367383) @@ -377,12 +377,13 @@ cpu_est_clockrate(int cpu_id, uint64_t *cps) case MPC7410: case MPC7447A: case MPC7448: - mtspr(SPR_MMCR0, SPR_MMCR0_FC); - mtspr(SPR_PMC1, 0); - mtspr(SPR_MMCR0, SPR_MMCR0_PMC1SEL(PMCN_CYCLES)); + mtspr(SPR_MMCR0_74XX, SPR_MMCR0_FC); + mtspr(SPR_PMC1_74XX, 0); + mtspr(SPR_MMCR0_74XX, + SPR_MMCR0_74XX_PMC1SEL(PMCN_CYCLES)); DELAY(1000); - *cps = (mfspr(SPR_PMC1) * 1000) + 4999; - mtspr(SPR_MMCR0, SPR_MMCR0_FC); + *cps = (mfspr(SPR_PMC1_74XX) * 1000) + 4999; + mtspr(SPR_MMCR0_74XX, SPR_MMCR0_FC); mtmsr(msr); return (0); @@ -390,18 +391,17 @@ cpu_est_clockrate(int cpu_id, uint64_t *cps) case IBM970FX: case IBM970MP: isync(); - mtspr(SPR_970MMCR0, SPR_MMCR0_FC); + mtspr(SPR_MMCR0, SPR_MMCR0_FC); isync(); - mtspr(SPR_970MMCR1, 0); - mtspr(SPR_970MMCRA, 0); - mtspr(SPR_970PMC1, 0); - mtspr(SPR_970MMCR0, - SPR_970MMCR0_PMC1SEL(PMC970N_CYCLES)); + mtspr(SPR_MMCR1, 0); + mtspr(SPR_MMCRA, 0); + mtspr(SPR_PMC1, 0); + mtspr(SPR_MMCR0, SPR_MMCR0_PMC1SEL(PMC970N_CYCLES)); isync(); DELAY(1000); powerpc_sync(); - mtspr(SPR_970MMCR0, SPR_MMCR0_FC); - *cps = (mfspr(SPR_970PMC1) * 1000) + 4999; + mtspr(SPR_MMCR0, SPR_MMCR0_FC); + *cps = (mfspr(SPR_PMC1) * 1000) + 4999; mtmsr(msr); return (0); From owner-svn-src-head@freebsd.org Thu Nov 5 15:08:58 2020 Return-Path: Delivered-To: svn-src-head@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 881CB469EDC; Thu, 5 Nov 2020 15:08:58 +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 4CRn3Z3VB8z4n3w; Thu, 5 Nov 2020 15:08:58 +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 6AD2F1574F; Thu, 5 Nov 2020 15:08:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5F8wUt036029; Thu, 5 Nov 2020 15:08:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5F8vik036021; Thu, 5 Nov 2020 15:08:57 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011051508.0A5F8vik036021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 15:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367384 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 367384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 15:08:58 -0000 Author: mjg Date: Thu Nov 5 15:08:56 2020 New Revision: 367384 URL: https://svnweb.freebsd.org/changeset/base/367384 Log: Rationalize per-cpu zones. The 2 provided zones had inconsistent naming between each other ("int" and "64") and other allocator zones (which use bytes). Follow malloc by naming them "pcpu-" + size in bytes. This is a step towards replacing ad-hoc per-cpu zones with general slabs. Modified: head/sys/kern/kern_rmlock.c head/sys/kern/subr_counter.c head/sys/kern/subr_pcpu.c head/sys/kern/vfs_mount.c head/sys/sys/param.h head/sys/vm/uma.h Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Thu Nov 5 14:15:50 2020 (r367383) +++ head/sys/kern/kern_rmlock.c Thu Nov 5 15:08:56 2020 (r367384) @@ -890,8 +890,8 @@ rms_init(struct rmslock *rms, const char *name) rms->writers = 0; rms->readers = 0; mtx_init(&rms->mtx, name, NULL, MTX_DEF | MTX_NEW); - rms->readers_pcpu = uma_zalloc_pcpu(pcpu_zone_int, M_WAITOK | M_ZERO); - rms->readers_influx = uma_zalloc_pcpu(pcpu_zone_int, M_WAITOK | M_ZERO); + rms->readers_pcpu = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); + rms->readers_influx = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); } void @@ -901,8 +901,8 @@ rms_destroy(struct rmslock *rms) MPASS(rms->writers == 0); MPASS(rms->readers == 0); mtx_destroy(&rms->mtx); - uma_zfree_pcpu(pcpu_zone_int, rms->readers_pcpu); - uma_zfree_pcpu(pcpu_zone_int, rms->readers_influx); + uma_zfree_pcpu(pcpu_zone_4, rms->readers_pcpu); + uma_zfree_pcpu(pcpu_zone_4, rms->readers_influx); } static void __noinline Modified: head/sys/kern/subr_counter.c ============================================================================== --- head/sys/kern/subr_counter.c Thu Nov 5 14:15:50 2020 (r367383) +++ head/sys/kern/subr_counter.c Thu Nov 5 15:08:56 2020 (r367384) @@ -61,14 +61,14 @@ counter_u64_t counter_u64_alloc(int flags) { - return (uma_zalloc_pcpu(pcpu_zone_64, flags | M_ZERO)); + return (uma_zalloc_pcpu(pcpu_zone_8, flags | M_ZERO)); } void counter_u64_free(counter_u64_t c) { - uma_zfree_pcpu(pcpu_zone_64, c); + uma_zfree_pcpu(pcpu_zone_8, c); } int Modified: head/sys/kern/subr_pcpu.c ============================================================================== --- head/sys/kern/subr_pcpu.c Thu Nov 5 14:15:50 2020 (r367383) +++ head/sys/kern/subr_pcpu.c Thu Nov 5 15:08:56 2020 (r367384) @@ -131,21 +131,19 @@ dpcpu_startup(void *dummy __unused) SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, NULL); /* - * UMA_PCPU_ZONE zones, that are available for all kernel - * consumers. Right now 64 bit zone is used for counter(9) - * and int zone is used for mount point counters. + * UMA_ZONE_PCPU zones for general kernel use. */ -uma_zone_t pcpu_zone_int; -uma_zone_t pcpu_zone_64; +uma_zone_t pcpu_zone_4; +uma_zone_t pcpu_zone_8; static void pcpu_zones_startup(void) { - pcpu_zone_int = uma_zcreate("int pcpu", sizeof(int), + pcpu_zone_4 = uma_zcreate("pcpu-4", sizeof(uint32_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); - pcpu_zone_64 = uma_zcreate("64 pcpu", sizeof(uint64_t), + pcpu_zone_8 = uma_zcreate("pcpu-8", sizeof(uint64_t), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); } SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup, NULL); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Nov 5 14:15:50 2020 (r367383) +++ head/sys/kern/vfs_mount.c Thu Nov 5 15:08:56 2020 (r367384) @@ -127,13 +127,13 @@ mount_init(void *mem, int size, int flags) mtx_init(&mp->mnt_mtx, "struct mount mtx", NULL, MTX_DEF); mtx_init(&mp->mnt_listmtx, "struct mount vlist mtx", NULL, MTX_DEF); lockinit(&mp->mnt_explock, PVFS, "explock", 0, 0); - mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + mp->mnt_thread_in_ops_pcpu = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); - mp->mnt_ref_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + mp->mnt_ref_pcpu = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); - mp->mnt_lockref_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + mp->mnt_lockref_pcpu = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); - mp->mnt_writeopcount_pcpu = uma_zalloc_pcpu(pcpu_zone_int, + mp->mnt_writeopcount_pcpu = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); mp->mnt_ref = 0; mp->mnt_vfs_ops = 1; @@ -147,10 +147,10 @@ mount_fini(void *mem, int size) struct mount *mp; mp = (struct mount *)mem; - uma_zfree_pcpu(pcpu_zone_int, mp->mnt_writeopcount_pcpu); - uma_zfree_pcpu(pcpu_zone_int, mp->mnt_lockref_pcpu); - uma_zfree_pcpu(pcpu_zone_int, mp->mnt_ref_pcpu); - uma_zfree_pcpu(pcpu_zone_int, mp->mnt_thread_in_ops_pcpu); + uma_zfree_pcpu(pcpu_zone_4, mp->mnt_writeopcount_pcpu); + uma_zfree_pcpu(pcpu_zone_4, mp->mnt_lockref_pcpu); + uma_zfree_pcpu(pcpu_zone_4, mp->mnt_ref_pcpu); + uma_zfree_pcpu(pcpu_zone_4, mp->mnt_thread_in_ops_pcpu); lockdestroy(&mp->mnt_explock); mtx_destroy(&mp->mnt_listmtx); mtx_destroy(&mp->mnt_mtx); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Thu Nov 5 14:15:50 2020 (r367383) +++ head/sys/sys/param.h Thu Nov 5 15:08:56 2020 (r367384) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300125 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300126 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: head/sys/vm/uma.h ============================================================================== --- head/sys/vm/uma.h Thu Nov 5 14:15:50 2020 (r367383) +++ head/sys/vm/uma.h Thu Nov 5 15:08:56 2020 (r367384) @@ -666,8 +666,8 @@ size_t uma_zone_memory(uma_zone_t zone); /* * Common UMA_ZONE_PCPU zones. */ -extern uma_zone_t pcpu_zone_int; -extern uma_zone_t pcpu_zone_64; +extern uma_zone_t pcpu_zone_4; +extern uma_zone_t pcpu_zone_8; /* * Exported statistics structures to be used by user space monitoring tools. From owner-svn-src-head@freebsd.org Thu Nov 5 15:55:24 2020 Return-Path: Delivered-To: svn-src-head@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 690EC46AD50; Thu, 5 Nov 2020 15:55: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 4CRp582Pt8z4pws; Thu, 5 Nov 2020 15:55: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 44AB7164AA; Thu, 5 Nov 2020 15:55: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 0A5FtOKZ066713; Thu, 5 Nov 2020 15:55:24 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5FtNAP066707; Thu, 5 Nov 2020 15:55:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011051555.0A5FtNAP066707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 5 Nov 2020 15:55:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367386 - in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/qat sys/modules sys/modules/qat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: share/man/man4 sys/amd64/conf sys/conf sys/dev/qat sys/modules sys/modules/qat X-SVN-Commit-Revision: 367386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 15:55:24 -0000 Author: markj Date: Thu Nov 5 15:55:23 2020 New Revision: 367386 URL: https://svnweb.freebsd.org/changeset/base/367386 Log: Add qat(4) This provides an OpenCrypto driver for Intel QuickAssist devices. The driver was initially ported from NetBSD and comes with a few improvements: - support for GMAC/AES-GCM, AES-CTR and AES-XTS, and support for SHA/HMAC-authenticated encryption - support for detaching the driver - various bug fixes - DH895X support Discussed with: jhb MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Differential Revision: https://reviews.freebsd.org/D26963 Added: head/share/man/man4/qat.4 (contents, props changed) head/sys/dev/qat/ head/sys/dev/qat/qat.c (contents, props changed) head/sys/dev/qat/qat_ae.c (contents, props changed) head/sys/dev/qat/qat_aevar.h (contents, props changed) head/sys/dev/qat/qat_c2xxx.c (contents, props changed) head/sys/dev/qat/qat_c2xxxreg.h (contents, props changed) head/sys/dev/qat/qat_c3xxx.c (contents, props changed) head/sys/dev/qat/qat_c3xxxreg.h (contents, props changed) head/sys/dev/qat/qat_c62x.c (contents, props changed) head/sys/dev/qat/qat_c62xreg.h (contents, props changed) head/sys/dev/qat/qat_d15xx.c (contents, props changed) head/sys/dev/qat/qat_d15xxreg.h (contents, props changed) head/sys/dev/qat/qat_dh895xcc.c (contents, props changed) head/sys/dev/qat/qat_dh895xccreg.h (contents, props changed) head/sys/dev/qat/qat_hw15.c (contents, props changed) head/sys/dev/qat/qat_hw15reg.h (contents, props changed) head/sys/dev/qat/qat_hw15var.h (contents, props changed) head/sys/dev/qat/qat_hw17.c (contents, props changed) head/sys/dev/qat/qat_hw17reg.h (contents, props changed) head/sys/dev/qat/qat_hw17var.h (contents, props changed) head/sys/dev/qat/qatreg.h (contents, props changed) head/sys/dev/qat/qatvar.h (contents, props changed) head/sys/modules/qat/ head/sys/modules/qat/Makefile (contents, props changed) Modified: head/share/man/man4/Makefile head/sys/amd64/conf/NOTES head/sys/conf/files.x86 head/sys/modules/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Nov 5 15:27:38 2020 (r367385) +++ head/share/man/man4/Makefile Thu Nov 5 15:55:23 2020 (r367386) @@ -431,6 +431,7 @@ MAN= aac.4 \ pty.4 \ puc.4 \ pwmc.4 \ + ${_qat.4} \ ${_qlxge.4} \ ${_qlxgb.4} \ ${_qlxgbe.4} \ @@ -823,6 +824,7 @@ _nvram.4= nvram.4 _ossl.4= ossl.4 _padlock.4= padlock.4 _pchtherm.4= pchtherm.4 +_qat.4= qat.4 _rr232x.4= rr232x.4 _speaker.4= speaker.4 _spkr.4= spkr.4 Added: head/share/man/man4/qat.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/qat.4 Thu Nov 5 15:55:23 2020 (r367386) @@ -0,0 +1,99 @@ +.\"- +.\" Copyright (c) 2020 Rubicon Communications, LLC (Netgate) +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd November 5, 2020 +.Dt QAT 4 +.Os +.Sh NAME +.Nm qat +.Nd Intel QuickAssist Technology (QAT) driver +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following lines in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device crypto" +.Cd "device cryptodev" +.Cd "device qat" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following lines in +.Xr loader.conf 5 : +.Bd -literal -offset indent +qat_load="YES" +qat_c2xxxfw_load="YES" +qat_c3xxxfw_load="YES" +qat_c63xfw_load="YES" +qat_d15xxfw_load="YES" +qat_dh895xcc_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver implements +.Xr crypto 4 +support for some of the cryptographic acceleration functions of the Intel +QuickAssist device. +The +.Nm +driver supports the QAT devices integrated with Atom C2000 and C3000 and Xeon +C620 and D-1500 chipsets, and the Intel QAT Adapter 8950. +It can accelerate AES in CBC, CTR, XTS (except for the C2000) and GCM modes, +and can perform authenticated encryption combining the CBC, CTR and XTS modes +with SHA1-HMAC and SHA2-HMAC. +The +.Nm +driver can also compute SHA1 and SHA2 digests. +.Sh SEE ALSO +.Xr crypto 4 , +.Xr ipsec 4 , +.Xr pci 4 , +.Xr random 4 , +.Xr crypto 7 , +.Xr crypto 9 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 13.0 . +.Sh AUTHORS +The +.Nm +driver was written for +.Nx +by +.An Hikaru Abe Aq Mt hikaru@iij.ad.jp +and ported to +.Fx +by +.An Mark Johnston Aq Mt markj@FreeBSD.org . +.Sh BUGS +Some Atom C2000 QAT devices have two acceleration engines instead of one. +The +.Nm +driver currently misbehaves when both are enabled and thus does not enable +the second acceleration engine if one is present. Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Thu Nov 5 15:27:38 2020 (r367385) +++ head/sys/amd64/conf/NOTES Thu Nov 5 15:55:23 2020 (r367386) @@ -471,6 +471,10 @@ device vmd_bus # bus for VMD children device pmspcv # +# Intel QuickAssist +device qat + +# # SafeNet crypto driver: can be moved to the MI NOTES as soon as # it's tested on a big-endian machine # Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Thu Nov 5 15:27:38 2020 (r367385) +++ head/sys/conf/files.x86 Thu Nov 5 15:55:23 2020 (r367386) @@ -291,6 +291,15 @@ dev/isci/scil/scif_sas_task_request_state_handlers.c dev/isci/scil/scif_sas_task_request_states.c optional isci dev/isci/scil/scif_sas_timer.c optional isci dev/itwd/itwd.c optional itwd +dev/qat/qat.c optional qat +dev/qat/qat_ae.c optional qat +dev/qat/qat_c2xxx.c optional qat +dev/qat/qat_c3xxx.c optional qat +dev/qat/qat_c62x.c optional qat +dev/qat/qat_d15xx.c optional qat +dev/qat/qat_dh895xcc.c optional qat +dev/qat/qat_hw15.c optional qat +dev/qat/qat_hw17.c optional qat libkern/x86/crc32_sse42.c standard # # x86 shared code between IA32 and AMD64 architectures Added: head/sys/dev/qat/qat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/qat/qat.c Thu Nov 5 15:55:23 2020 (r367386) @@ -0,0 +1,2140 @@ +/* SPDX-License-Identifier: BSD-2-Clause-NetBSD AND BSD-3-Clause */ +/* $NetBSD: qat.c,v 1.6 2020/06/14 23:23:12 riastradh Exp $ */ + +/* + * Copyright (c) 2019 Internet Initiative Japan, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright(c) 2007-2019 Intel Corporation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Intel Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); +#if 0 +__KERNEL_RCSID(0, "$NetBSD: qat.c,v 1.6 2020/06/14 23:23:12 riastradh Exp $"); +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include "cryptodev_if.h" + +#include +#include + +#include "qatreg.h" +#include "qatvar.h" +#include "qat_aevar.h" + +extern struct qat_hw qat_hw_c2xxx; +extern struct qat_hw qat_hw_c3xxx; +extern struct qat_hw qat_hw_c62x; +extern struct qat_hw qat_hw_d15xx; +extern struct qat_hw qat_hw_dh895xcc; + +#define PCI_VENDOR_INTEL 0x8086 +#define PCI_PRODUCT_INTEL_C2000_IQIA_PHYS 0x1f18 +#define PCI_PRODUCT_INTEL_C3K_QAT 0x19e2 +#define PCI_PRODUCT_INTEL_C3K_QAT_VF 0x19e3 +#define PCI_PRODUCT_INTEL_C620_QAT 0x37c8 +#define PCI_PRODUCT_INTEL_C620_QAT_VF 0x37c9 +#define PCI_PRODUCT_INTEL_XEOND_QAT 0x6f54 +#define PCI_PRODUCT_INTEL_XEOND_QAT_VF 0x6f55 +#define PCI_PRODUCT_INTEL_DH895XCC_QAT 0x0435 +#define PCI_PRODUCT_INTEL_DH895XCC_QAT_VF 0x0443 + +static const struct qat_product { + uint16_t qatp_vendor; + uint16_t qatp_product; + const char *qatp_name; + enum qat_chip_type qatp_chip; + const struct qat_hw *qatp_hw; +} qat_products[] = { + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C2000_IQIA_PHYS, + "Intel C2000 QuickAssist PF", + QAT_CHIP_C2XXX, &qat_hw_c2xxx }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C3K_QAT, + "Intel C3000 QuickAssist PF", + QAT_CHIP_C3XXX, &qat_hw_c3xxx }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C620_QAT, + "Intel C620/Xeon D-2100 QuickAssist PF", + QAT_CHIP_C62X, &qat_hw_c62x }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XEOND_QAT, + "Intel Xeon D-1500 QuickAssist PF", + QAT_CHIP_D15XX, &qat_hw_d15xx }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_DH895XCC_QAT, + "Intel 8950 QuickAssist PCIe Adapter PF", + QAT_CHIP_DH895XCC, &qat_hw_dh895xcc }, + { 0, 0, NULL, 0, NULL }, +}; + +/* Hash Algorithm specific structure */ + +/* SHA1 - 20 bytes - Initialiser state can be found in FIPS stds 180-2 */ +static const uint8_t sha1_initial_state[QAT_HASH_SHA1_STATE_SIZE] = { + 0x67, 0x45, 0x23, 0x01, + 0xef, 0xcd, 0xab, 0x89, + 0x98, 0xba, 0xdc, 0xfe, + 0x10, 0x32, 0x54, 0x76, + 0xc3, 0xd2, 0xe1, 0xf0 +}; + +/* SHA 256 - 32 bytes - Initialiser state can be found in FIPS stds 180-2 */ +static const uint8_t sha256_initial_state[QAT_HASH_SHA256_STATE_SIZE] = { + 0x6a, 0x09, 0xe6, 0x67, + 0xbb, 0x67, 0xae, 0x85, + 0x3c, 0x6e, 0xf3, 0x72, + 0xa5, 0x4f, 0xf5, 0x3a, + 0x51, 0x0e, 0x52, 0x7f, + 0x9b, 0x05, 0x68, 0x8c, + 0x1f, 0x83, 0xd9, 0xab, + 0x5b, 0xe0, 0xcd, 0x19 +}; + +/* SHA 384 - 64 bytes - Initialiser state can be found in FIPS stds 180-2 */ +static const uint8_t sha384_initial_state[QAT_HASH_SHA384_STATE_SIZE] = { + 0xcb, 0xbb, 0x9d, 0x5d, 0xc1, 0x05, 0x9e, 0xd8, + 0x62, 0x9a, 0x29, 0x2a, 0x36, 0x7c, 0xd5, 0x07, + 0x91, 0x59, 0x01, 0x5a, 0x30, 0x70, 0xdd, 0x17, + 0x15, 0x2f, 0xec, 0xd8, 0xf7, 0x0e, 0x59, 0x39, + 0x67, 0x33, 0x26, 0x67, 0xff, 0xc0, 0x0b, 0x31, + 0x8e, 0xb4, 0x4a, 0x87, 0x68, 0x58, 0x15, 0x11, + 0xdb, 0x0c, 0x2e, 0x0d, 0x64, 0xf9, 0x8f, 0xa7, + 0x47, 0xb5, 0x48, 0x1d, 0xbe, 0xfa, 0x4f, 0xa4 +}; + +/* SHA 512 - 64 bytes - Initialiser state can be found in FIPS stds 180-2 */ +static const uint8_t sha512_initial_state[QAT_HASH_SHA512_STATE_SIZE] = { + 0x6a, 0x09, 0xe6, 0x67, 0xf3, 0xbc, 0xc9, 0x08, + 0xbb, 0x67, 0xae, 0x85, 0x84, 0xca, 0xa7, 0x3b, + 0x3c, 0x6e, 0xf3, 0x72, 0xfe, 0x94, 0xf8, 0x2b, + 0xa5, 0x4f, 0xf5, 0x3a, 0x5f, 0x1d, 0x36, 0xf1, + 0x51, 0x0e, 0x52, 0x7f, 0xad, 0xe6, 0x82, 0xd1, + 0x9b, 0x05, 0x68, 0x8c, 0x2b, 0x3e, 0x6c, 0x1f, + 0x1f, 0x83, 0xd9, 0xab, 0xfb, 0x41, 0xbd, 0x6b, + 0x5b, 0xe0, 0xcd, 0x19, 0x13, 0x7e, 0x21, 0x79 +}; + +static const struct qat_sym_hash_alg_info sha1_info = { + .qshai_digest_len = QAT_HASH_SHA1_DIGEST_SIZE, + .qshai_block_len = QAT_HASH_SHA1_BLOCK_SIZE, + .qshai_state_size = QAT_HASH_SHA1_STATE_SIZE, + .qshai_init_state = sha1_initial_state, + .qshai_sah = &auth_hash_hmac_sha1, + .qshai_state_offset = 0, + .qshai_state_word = 4, +}; + +static const struct qat_sym_hash_alg_info sha256_info = { + .qshai_digest_len = QAT_HASH_SHA256_DIGEST_SIZE, + .qshai_block_len = QAT_HASH_SHA256_BLOCK_SIZE, + .qshai_state_size = QAT_HASH_SHA256_STATE_SIZE, + .qshai_init_state = sha256_initial_state, + .qshai_sah = &auth_hash_hmac_sha2_256, + .qshai_state_offset = offsetof(SHA256_CTX, state), + .qshai_state_word = 4, +}; + +static const struct qat_sym_hash_alg_info sha384_info = { + .qshai_digest_len = QAT_HASH_SHA384_DIGEST_SIZE, + .qshai_block_len = QAT_HASH_SHA384_BLOCK_SIZE, + .qshai_state_size = QAT_HASH_SHA384_STATE_SIZE, + .qshai_init_state = sha384_initial_state, + .qshai_sah = &auth_hash_hmac_sha2_384, + .qshai_state_offset = offsetof(SHA384_CTX, state), + .qshai_state_word = 8, +}; + +static const struct qat_sym_hash_alg_info sha512_info = { + .qshai_digest_len = QAT_HASH_SHA512_DIGEST_SIZE, + .qshai_block_len = QAT_HASH_SHA512_BLOCK_SIZE, + .qshai_state_size = QAT_HASH_SHA512_STATE_SIZE, + .qshai_init_state = sha512_initial_state, + .qshai_sah = &auth_hash_hmac_sha2_512, + .qshai_state_offset = offsetof(SHA512_CTX, state), + .qshai_state_word = 8, +}; + +static const struct qat_sym_hash_alg_info aes_gcm_info = { + .qshai_digest_len = QAT_HASH_AES_GCM_DIGEST_SIZE, + .qshai_block_len = QAT_HASH_AES_GCM_BLOCK_SIZE, + .qshai_state_size = QAT_HASH_AES_GCM_STATE_SIZE, + .qshai_sah = &auth_hash_nist_gmac_aes_128, +}; + +/* Hash QAT specific structures */ + +static const struct qat_sym_hash_qat_info sha1_config = { + .qshqi_algo_enc = HW_AUTH_ALGO_SHA1, + .qshqi_auth_counter = QAT_HASH_SHA1_BLOCK_SIZE, + .qshqi_state1_len = HW_SHA1_STATE1_SZ, + .qshqi_state2_len = HW_SHA1_STATE2_SZ, +}; + +static const struct qat_sym_hash_qat_info sha256_config = { + .qshqi_algo_enc = HW_AUTH_ALGO_SHA256, + .qshqi_auth_counter = QAT_HASH_SHA256_BLOCK_SIZE, + .qshqi_state1_len = HW_SHA256_STATE1_SZ, + .qshqi_state2_len = HW_SHA256_STATE2_SZ +}; + +static const struct qat_sym_hash_qat_info sha384_config = { + .qshqi_algo_enc = HW_AUTH_ALGO_SHA384, + .qshqi_auth_counter = QAT_HASH_SHA384_BLOCK_SIZE, + .qshqi_state1_len = HW_SHA384_STATE1_SZ, + .qshqi_state2_len = HW_SHA384_STATE2_SZ +}; + +static const struct qat_sym_hash_qat_info sha512_config = { + .qshqi_algo_enc = HW_AUTH_ALGO_SHA512, + .qshqi_auth_counter = QAT_HASH_SHA512_BLOCK_SIZE, + .qshqi_state1_len = HW_SHA512_STATE1_SZ, + .qshqi_state2_len = HW_SHA512_STATE2_SZ +}; + +static const struct qat_sym_hash_qat_info aes_gcm_config = { + .qshqi_algo_enc = HW_AUTH_ALGO_GALOIS_128, + .qshqi_auth_counter = QAT_HASH_AES_GCM_BLOCK_SIZE, + .qshqi_state1_len = HW_GALOIS_128_STATE1_SZ, + .qshqi_state2_len = + HW_GALOIS_H_SZ + HW_GALOIS_LEN_A_SZ + HW_GALOIS_E_CTR0_SZ, +}; + +static const struct qat_sym_hash_def qat_sym_hash_defs[] = { + [QAT_SYM_HASH_SHA1] = { &sha1_info, &sha1_config }, + [QAT_SYM_HASH_SHA256] = { &sha256_info, &sha256_config }, + [QAT_SYM_HASH_SHA384] = { &sha384_info, &sha384_config }, + [QAT_SYM_HASH_SHA512] = { &sha512_info, &sha512_config }, + [QAT_SYM_HASH_AES_GCM] = { &aes_gcm_info, &aes_gcm_config }, +}; + +static const struct qat_product *qat_lookup(device_t); +static int qat_probe(device_t); +static int qat_attach(device_t); +static int qat_init(struct device *); +static int qat_start(struct device *); +static int qat_detach(device_t); + +static int qat_newsession(device_t dev, crypto_session_t cses, + const struct crypto_session_params *csp); +static void qat_freesession(device_t dev, crypto_session_t cses); + +static int qat_setup_msix_intr(struct qat_softc *); + +static void qat_etr_init(struct qat_softc *); +static void qat_etr_deinit(struct qat_softc *); +static void qat_etr_bank_init(struct qat_softc *, int); +static void qat_etr_bank_deinit(struct qat_softc *sc, int); + +static void qat_etr_ap_bank_init(struct qat_softc *); +static void qat_etr_ap_bank_set_ring_mask(uint32_t *, uint32_t, int); +static void qat_etr_ap_bank_set_ring_dest(struct qat_softc *, uint32_t *, + uint32_t, int); +static void qat_etr_ap_bank_setup_ring(struct qat_softc *, + struct qat_ring *); +static int qat_etr_verify_ring_size(uint32_t, uint32_t); + +static int qat_etr_ring_intr(struct qat_softc *, struct qat_bank *, + struct qat_ring *); +static void qat_etr_bank_intr(void *); + +static void qat_arb_update(struct qat_softc *, struct qat_bank *); + +static struct qat_sym_cookie *qat_crypto_alloc_sym_cookie( + struct qat_crypto_bank *); +static void qat_crypto_free_sym_cookie(struct qat_crypto_bank *, + struct qat_sym_cookie *); +static int qat_crypto_setup_ring(struct qat_softc *, + struct qat_crypto_bank *); +static int qat_crypto_bank_init(struct qat_softc *, + struct qat_crypto_bank *); +static int qat_crypto_init(struct qat_softc *); +static void qat_crypto_deinit(struct qat_softc *); +static int qat_crypto_start(struct qat_softc *); +static void qat_crypto_stop(struct qat_softc *); +static int qat_crypto_sym_rxintr(struct qat_softc *, void *, void *); + +static MALLOC_DEFINE(M_QAT, "qat", "Intel QAT driver"); + +static const struct qat_product * +qat_lookup(device_t dev) +{ + const struct qat_product *qatp; + + for (qatp = qat_products; qatp->qatp_name != NULL; qatp++) { + if (pci_get_vendor(dev) == qatp->qatp_vendor && + pci_get_device(dev) == qatp->qatp_product) + return qatp; + } + return NULL; +} + +static int +qat_probe(device_t dev) +{ + const struct qat_product *prod; + + prod = qat_lookup(dev); + if (prod != NULL) { + device_set_desc(dev, prod->qatp_name); + return BUS_PROBE_DEFAULT; + } + return ENXIO; +} + +static int +qat_attach(device_t dev) +{ + struct qat_softc *sc = device_get_softc(dev); + const struct qat_product *qatp; + bus_size_t msixtbl_offset; + int bar, count, error, i, msixoff, msixtbl_bar; + + sc->sc_dev = dev; + sc->sc_rev = pci_get_revid(dev); + + qatp = qat_lookup(dev); + memcpy(&sc->sc_hw, qatp->qatp_hw, sizeof(struct qat_hw)); + + /* Determine active accelerators and engines */ + sc->sc_accel_mask = sc->sc_hw.qhw_get_accel_mask(sc); + sc->sc_ae_mask = sc->sc_hw.qhw_get_ae_mask(sc); + + sc->sc_accel_num = 0; + for (i = 0; i < sc->sc_hw.qhw_num_accel; i++) { + if (sc->sc_accel_mask & (1 << i)) + sc->sc_accel_num++; + } + sc->sc_ae_num = 0; + for (i = 0; i < sc->sc_hw.qhw_num_engines; i++) { + if (sc->sc_ae_mask & (1 << i)) + sc->sc_ae_num++; + } + + if (!sc->sc_accel_mask || (sc->sc_ae_mask & 0x01) == 0) { + device_printf(sc->sc_dev, "couldn't find acceleration"); + goto fail; + } + + MPASS(sc->sc_accel_num <= MAX_NUM_ACCEL); + MPASS(sc->sc_ae_num <= MAX_NUM_AE); + + /* Determine SKU and capabilities */ + sc->sc_sku = sc->sc_hw.qhw_get_sku(sc); + sc->sc_accel_cap = sc->sc_hw.qhw_get_accel_cap(sc); + sc->sc_fw_uof_name = sc->sc_hw.qhw_get_fw_uof_name(sc); + + /* Map BARs */ + msixtbl_bar = 0; + msixtbl_offset = 0; + if (pci_find_cap(dev, PCIY_MSIX, &msixoff) == 0) { + uint32_t msixtbl; + msixtbl = pci_read_config(dev, msixoff + PCIR_MSIX_TABLE, 4); + msixtbl_offset = msixtbl & ~PCIM_MSIX_BIR_MASK; + msixtbl_bar = PCIR_BAR(msixtbl & PCIM_MSIX_BIR_MASK); + } + + i = 0; + if (sc->sc_hw.qhw_sram_bar_id != NO_PCI_REG) { + MPASS(sc->sc_hw.qhw_sram_bar_id == 0); + uint32_t fusectl = pci_read_config(dev, FUSECTL_REG, 4); + /* Skip SRAM BAR */ + i = (fusectl & FUSECTL_MASK) ? 1 : 0; + } + for (bar = 0; bar < PCIR_MAX_BAR_0; bar++) { + uint32_t val = pci_read_config(dev, PCIR_BAR(bar), 4); + if (val == 0 || !PCI_BAR_MEM(val)) + continue; + + sc->sc_rid[i] = PCIR_BAR(bar); + sc->sc_res[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, + &sc->sc_rid[i], RF_ACTIVE); + if (sc->sc_res[i] == NULL) { + device_printf(dev, "couldn't map BAR %d\n", bar); + goto fail; + } + + sc->sc_csrt[i] = rman_get_bustag(sc->sc_res[i]); + sc->sc_csrh[i] = rman_get_bushandle(sc->sc_res[i]); + + i++; + if ((val & PCIM_BAR_MEM_TYPE) == PCIM_BAR_MEM_64) + bar++; + } + + pci_enable_busmaster(dev); + + count = sc->sc_hw.qhw_num_banks + 1; + if (pci_msix_count(dev) < count) { + device_printf(dev, "insufficient MSI-X vectors (%d vs. %d)\n", + pci_msix_count(dev), count); + goto fail; + } + error = pci_alloc_msix(dev, &count); + if (error != 0) { + device_printf(dev, "failed to allocate MSI-X vectors\n"); + goto fail; + } + + error = qat_init(dev); + if (error == 0) + return 0; + +fail: + qat_detach(dev); + return ENXIO; +} + +static int +qat_init(device_t dev) +{ + struct qat_softc *sc = device_get_softc(dev); + int error; + + qat_etr_init(sc); + + if (sc->sc_hw.qhw_init_admin_comms != NULL && + (error = sc->sc_hw.qhw_init_admin_comms(sc)) != 0) { + device_printf(sc->sc_dev, + "Could not initialize admin comms: %d\n", error); + return error; + } + + if (sc->sc_hw.qhw_init_arb != NULL && + (error = sc->sc_hw.qhw_init_arb(sc)) != 0) { + device_printf(sc->sc_dev, + "Could not initialize hw arbiter: %d\n", error); + return error; + } + + error = qat_ae_init(sc); + if (error) { + device_printf(sc->sc_dev, + "Could not initialize Acceleration Engine: %d\n", error); + return error; + } + + error = qat_aefw_load(sc); + if (error) { + device_printf(sc->sc_dev, + "Could not load firmware: %d\n", error); + return error; + } + + error = qat_setup_msix_intr(sc); + if (error) { + device_printf(sc->sc_dev, + "Could not setup interrupts: %d\n", error); + return error; + } + + sc->sc_hw.qhw_enable_intr(sc); + + error = qat_crypto_init(sc); + if (error) { + device_printf(sc->sc_dev, + "Could not initialize service: %d\n", error); + return error; + } + + if (sc->sc_hw.qhw_enable_error_correction != NULL) + sc->sc_hw.qhw_enable_error_correction(sc); + + if (sc->sc_hw.qhw_set_ssm_wdtimer != NULL && + (error = sc->sc_hw.qhw_set_ssm_wdtimer(sc)) != 0) { + device_printf(sc->sc_dev, + "Could not initialize watchdog timer: %d\n", error); + return error; + } + + error = qat_start(dev); + if (error) { + device_printf(sc->sc_dev, + "Could not start: %d\n", error); + return error; + } + + return 0; +} + +static int +qat_start(device_t dev) +{ + struct qat_softc *sc = device_get_softc(dev); + int error; + + error = qat_ae_start(sc); + if (error) + return error; + + if (sc->sc_hw.qhw_send_admin_init != NULL && + (error = sc->sc_hw.qhw_send_admin_init(sc)) != 0) { + return error; + } + + error = qat_crypto_start(sc); + if (error) + return error; + + return 0; +} + +static int +qat_detach(device_t dev) +{ + struct qat_softc *sc; + int bar, i; + + sc = device_get_softc(dev); + + qat_crypto_stop(sc); + qat_crypto_deinit(sc); + qat_aefw_unload(sc); + + if (sc->sc_etr_banks != NULL) { + for (i = 0; i < sc->sc_hw.qhw_num_banks; i++) { + struct qat_bank *qb = &sc->sc_etr_banks[i]; + + if (qb->qb_ih_cookie != NULL) + (void)bus_teardown_intr(dev, qb->qb_ih, + qb->qb_ih_cookie); + if (qb->qb_ih != NULL) + (void)bus_release_resource(dev, SYS_RES_IRQ, + i + 1, qb->qb_ih); + } + } + if (sc->sc_ih_cookie != NULL) { + (void)bus_teardown_intr(dev, sc->sc_ih, sc->sc_ih_cookie); + sc->sc_ih_cookie = NULL; + } + if (sc->sc_ih != NULL) { + (void)bus_release_resource(dev, SYS_RES_IRQ, i + 1, sc->sc_ih); + sc->sc_ih = NULL; + } + pci_release_msi(dev); + + qat_etr_deinit(sc); + + for (bar = 0; bar < MAX_BARS; bar++) { + if (sc->sc_res[bar] != NULL) { + (void)bus_release_resource(dev, SYS_RES_MEMORY, + sc->sc_rid[bar], sc->sc_res[bar]); + sc->sc_res[bar] = NULL; + } + } + + return 0; +} + +void * +qat_alloc_mem(size_t size) +{ + return (malloc(size, M_QAT, M_WAITOK | M_ZERO)); +} + +void +qat_free_mem(void *ptr) +{ + free(ptr, M_QAT); +} + +static void +qat_alloc_dmamem_cb(void *arg, bus_dma_segment_t *segs, int nseg, + int error) +{ + struct qat_dmamem *qdm; + + if (error != 0) + return; + + KASSERT(nseg == 1, ("%s: nsegs is %d", __func__, nseg)); + qdm = arg; + qdm->qdm_dma_seg = segs[0]; +} + +int +qat_alloc_dmamem(struct qat_softc *sc, struct qat_dmamem *qdm, + int nseg, bus_size_t size, bus_size_t alignment) +{ + int error; + + KASSERT(qdm->qdm_dma_vaddr == NULL, + ("%s: DMA memory descriptor in use", __func__)); + + error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), + alignment, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + size, /* maxsize */ + nseg, /* nsegments */ + size, /* maxsegsize */ + BUS_DMA_COHERENT, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &qdm->qdm_dma_tag); + if (error != 0) + return error; + + error = bus_dmamem_alloc(qdm->qdm_dma_tag, &qdm->qdm_dma_vaddr, + BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, + &qdm->qdm_dma_map); + if (error != 0) { + device_printf(sc->sc_dev, + "couldn't allocate dmamem, error = %d\n", error); + goto fail_0; + } + + error = bus_dmamap_load(qdm->qdm_dma_tag, qdm->qdm_dma_map, + qdm->qdm_dma_vaddr, size, qat_alloc_dmamem_cb, qdm, + BUS_DMA_NOWAIT); + if (error) { + device_printf(sc->sc_dev, + "couldn't load dmamem map, error = %d\n", error); + goto fail_1; + } + + return 0; +fail_1: + bus_dmamem_free(qdm->qdm_dma_tag, qdm->qdm_dma_vaddr, qdm->qdm_dma_map); +fail_0: + bus_dma_tag_destroy(qdm->qdm_dma_tag); + return error; +} + +void +qat_free_dmamem(struct qat_softc *sc, struct qat_dmamem *qdm) +{ + if (qdm->qdm_dma_tag != NULL) { + bus_dmamap_unload(qdm->qdm_dma_tag, qdm->qdm_dma_map); + bus_dmamem_free(qdm->qdm_dma_tag, qdm->qdm_dma_vaddr, + qdm->qdm_dma_map); + bus_dma_tag_destroy(qdm->qdm_dma_tag); + explicit_bzero(qdm, sizeof(*qdm)); + } +} + +static int +qat_setup_msix_intr(struct qat_softc *sc) +{ + device_t dev; + int error, i, rid; + + dev = sc->sc_dev; + + for (i = 1; i <= sc->sc_hw.qhw_num_banks; i++) { + struct qat_bank *qb = &sc->sc_etr_banks[i - 1]; + + rid = i; + qb->qb_ih = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (qb->qb_ih == NULL) { + device_printf(dev, + "failed to allocate bank intr resource\n"); + return ENXIO; + } + error = bus_setup_intr(dev, qb->qb_ih, + INTR_TYPE_NET | INTR_MPSAFE, NULL, qat_etr_bank_intr, qb, + &qb->qb_ih_cookie); + if (error != 0) { + device_printf(dev, "failed to set up bank intr\n"); + return error; + } + error = bus_bind_intr(dev, qb->qb_ih, (i - 1) % mp_ncpus); + if (error != 0) + device_printf(dev, "failed to bind intr %d\n", i); + } + + rid = i; + sc->sc_ih = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (sc->sc_ih == NULL) + return ENXIO; + error = bus_setup_intr(dev, sc->sc_ih, INTR_TYPE_NET | INTR_MPSAFE, + NULL, qat_ae_cluster_intr, sc, &sc->sc_ih_cookie); + + return error; +} + +static void +qat_etr_init(struct qat_softc *sc) +{ + int i; + + sc->sc_etr_banks = qat_alloc_mem( + sizeof(struct qat_bank) * sc->sc_hw.qhw_num_banks); + + for (i = 0; i < sc->sc_hw.qhw_num_banks; i++) + qat_etr_bank_init(sc, i); + + if (sc->sc_hw.qhw_num_ap_banks) { + sc->sc_etr_ap_banks = qat_alloc_mem( + sizeof(struct qat_ap_bank) * sc->sc_hw.qhw_num_ap_banks); + qat_etr_ap_bank_init(sc); + } +} + +static void +qat_etr_deinit(struct qat_softc *sc) +{ + int i; + + if (sc->sc_etr_banks != NULL) { + for (i = 0; i < sc->sc_hw.qhw_num_banks; i++) + qat_etr_bank_deinit(sc, i); + qat_free_mem(sc->sc_etr_banks); + sc->sc_etr_banks = NULL; + } + if (sc->sc_etr_ap_banks != NULL) { + qat_free_mem(sc->sc_etr_ap_banks); + sc->sc_etr_ap_banks = NULL; + } +} + +static void +qat_etr_bank_init(struct qat_softc *sc, int bank) +{ + struct qat_bank *qb = &sc->sc_etr_banks[bank]; + int i, tx_rx_gap = sc->sc_hw.qhw_tx_rx_gap; + + MPASS(bank < sc->sc_hw.qhw_num_banks); + + mtx_init(&qb->qb_bank_mtx, "qb bank", NULL, MTX_DEF); + + qb->qb_sc = sc; + qb->qb_bank = bank; + qb->qb_coalescing_time = COALESCING_TIME_INTERVAL_DEFAULT; + + /* Clean CSRs for all rings within the bank */ + for (i = 0; i < sc->sc_hw.qhw_num_rings_per_bank; i++) { + struct qat_ring *qr = &qb->qb_et_rings[i]; + + qat_etr_bank_ring_write_4(sc, bank, i, + ETR_RING_CONFIG, 0); + qat_etr_bank_ring_base_write_8(sc, bank, i, 0); + + if (sc->sc_hw.qhw_tx_rings_mask & (1 << i)) { + qr->qr_inflight = qat_alloc_mem(sizeof(uint32_t)); + } else if (sc->sc_hw.qhw_tx_rings_mask & + (1 << (i - tx_rx_gap))) { + /* Share inflight counter with rx and tx */ + qr->qr_inflight = + qb->qb_et_rings[i - tx_rx_gap].qr_inflight; + } + } + + if (sc->sc_hw.qhw_init_etr_intr != NULL) { + sc->sc_hw.qhw_init_etr_intr(sc, bank); + } else { + /* common code in qat 1.7 */ + qat_etr_bank_write_4(sc, bank, ETR_INT_REG, + ETR_INT_REG_CLEAR_MASK); + for (i = 0; i < sc->sc_hw.qhw_num_rings_per_bank / + ETR_RINGS_PER_INT_SRCSEL; i++) { + qat_etr_bank_write_4(sc, bank, ETR_INT_SRCSEL + + (i * ETR_INT_SRCSEL_NEXT_OFFSET), + ETR_INT_SRCSEL_MASK); + } + } +} + +static void +qat_etr_bank_deinit(struct qat_softc *sc, int bank) +{ + struct qat_bank *qb; + struct qat_ring *qr; + int i; + + qb = &sc->sc_etr_banks[bank]; + for (i = 0; i < sc->sc_hw.qhw_num_rings_per_bank; i++) { + if (sc->sc_hw.qhw_tx_rings_mask & (1 << i)) { + qr = &qb->qb_et_rings[i]; + qat_free_mem(qr->qr_inflight); + } + } +} + +static void +qat_etr_ap_bank_init(struct qat_softc *sc) +{ + int ap_bank; + + for (ap_bank = 0; ap_bank < sc->sc_hw.qhw_num_ap_banks; ap_bank++) { + struct qat_ap_bank *qab = &sc->sc_etr_ap_banks[ap_bank]; + + qat_etr_ap_bank_write_4(sc, ap_bank, ETR_AP_NF_MASK, + ETR_AP_NF_MASK_INIT); + qat_etr_ap_bank_write_4(sc, ap_bank, ETR_AP_NF_DEST, 0); + qat_etr_ap_bank_write_4(sc, ap_bank, ETR_AP_NE_MASK, + ETR_AP_NE_MASK_INIT); + qat_etr_ap_bank_write_4(sc, ap_bank, ETR_AP_NE_DEST, 0); + + memset(qab, 0, sizeof(*qab)); + } +} + +static void +qat_etr_ap_bank_set_ring_mask(uint32_t *ap_mask, uint32_t ring, int set_mask) +{ + if (set_mask) + *ap_mask |= (1 << ETR_RING_NUMBER_IN_AP_BANK(ring)); + else + *ap_mask &= ~(1 << ETR_RING_NUMBER_IN_AP_BANK(ring)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Nov 5 16:00:34 2020 Return-Path: Delivered-To: svn-src-head@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 E8AB146AEF2; Thu, 5 Nov 2020 16:00:34 +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 4CRpC66Gylz4qHJ; Thu, 5 Nov 2020 16:00:34 +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 CA8B21656E; Thu, 5 Nov 2020 16:00:34 +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 0A5G0Yt5067136; Thu, 5 Nov 2020 16:00:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5G0UYj067115; Thu, 5 Nov 2020 16:00:30 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011051600.0A5G0UYj067115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 5 Nov 2020 16:00:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367387 - in head/sys: contrib/dev/qat modules modules/qatfw modules/qatfw/qat_c2xxx modules/qatfw/qat_c3xxx modules/qatfw/qat_c62x modules/qatfw/qat_d15xx modules/qatfw/qat_dh895xcc X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: contrib/dev/qat modules modules/qatfw modules/qatfw/qat_c2xxx modules/qatfw/qat_c3xxx modules/qatfw/qat_c62x modules/qatfw/qat_d15xx modules/qatfw/qat_dh895xcc X-SVN-Commit-Revision: 367387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 16:00:35 -0000 Author: markj Date: Thu Nov 5 16:00:30 2020 New Revision: 367387 URL: https://svnweb.freebsd.org/changeset/base/367387 Log: Add firmware modules for qat(4) MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Added: head/sys/contrib/dev/qat/ head/sys/contrib/dev/qat/LICENSE head/sys/contrib/dev/qat/mmp_firmware_c2xxx.bin head/sys/contrib/dev/qat/mof_firmware_c2xxx.bin head/sys/contrib/dev/qat/qat_895xcc.bin head/sys/contrib/dev/qat/qat_895xcc_mmp.bin head/sys/contrib/dev/qat/qat_c3xxx.bin head/sys/contrib/dev/qat/qat_c3xxx_mmp.bin head/sys/contrib/dev/qat/qat_c62x.bin head/sys/contrib/dev/qat/qat_c62x_mmp.bin head/sys/contrib/dev/qat/qat_d15xx.bin head/sys/contrib/dev/qat/qat_d15xx_mmp.bin head/sys/modules/qatfw/ head/sys/modules/qatfw/Makefile (contents, props changed) head/sys/modules/qatfw/qat_c2xxx/ head/sys/modules/qatfw/qat_c2xxx/Makefile (contents, props changed) head/sys/modules/qatfw/qat_c3xxx/ head/sys/modules/qatfw/qat_c3xxx/Makefile (contents, props changed) head/sys/modules/qatfw/qat_c62x/ head/sys/modules/qatfw/qat_c62x/Makefile (contents, props changed) head/sys/modules/qatfw/qat_d15xx/ head/sys/modules/qatfw/qat_d15xx/Makefile (contents, props changed) head/sys/modules/qatfw/qat_dh895xcc/ head/sys/modules/qatfw/qat_dh895xcc/Makefile (contents, props changed) Modified: head/sys/modules/Makefile Added: head/sys/contrib/dev/qat/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/contrib/dev/qat/LICENSE Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,11 @@ +Copyright (c) 2007-2016 Intel Corporation. +All rights reserved. +Redistribution. Redistribution and use in binary form, without modification, are permitted provided that the following conditions are met: + + Redistributions must reproduce the above copyright notice and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of Intel Corporation nor the names of its suppliers may be used to endorse or promote products derived from this software without specific prior written permission. + No reverse engineering, decompilation, or disassembly of this software is permitted. + +Limited patent license. Intel Corporation grants a world-wide, royalty-free, non-exclusive license under patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") this software, but solely to the extent that any such patent is necessary to Utilize the software alone. The patent license shall not apply to any combinations which include this software. No hardware per se is licensed hereunder. + +DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Added: head/sys/contrib/dev/qat/mmp_firmware_c2xxx.bin ============================================================================== Added: head/sys/contrib/dev/qat/mof_firmware_c2xxx.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_895xcc.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_895xcc_mmp.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_c3xxx.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_c3xxx_mmp.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_c62x.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_c62x_mmp.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_d15xx.bin ============================================================================== Added: head/sys/contrib/dev/qat/qat_d15xx_mmp.bin ============================================================================== Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Nov 5 15:55:23 2020 (r367386) +++ head/sys/modules/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -301,6 +301,7 @@ SUBDIR= \ puc \ pwm \ ${_qat} \ + ${_qatfw} \ ${_qlxge} \ ${_qlxgb} \ ${_qlxgbe} \ @@ -632,6 +633,7 @@ _ocs_fc= ocs_fc _ossl= ossl _pccard= pccard _qat= qat +_qatfw= qatfw .if ${MK_OFED} != "no" || defined(ALL_MODULES) _rdma= rdma .endif Added: head/sys/modules/qatfw/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/qatfw/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +SUBDIR= qat_c2xxx \ + qat_c3xxx \ + qat_c62x \ + qat_d15xx \ + qat_dh895xcc + +.include Added: head/sys/modules/qatfw/qat_c2xxx/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/qatfw/qat_c2xxx/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/dev/qat + +KMOD= qat_c2xxxfw +IMG1= mmp_firmware_c2xxx +IMG2= mof_firmware_c2xxx + +FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 + +.include Added: head/sys/modules/qatfw/qat_c3xxx/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/qatfw/qat_c3xxx/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/dev/qat + +KMOD= qat_c3xxxfw +IMG1= qat_c3xxx +IMG2= qat_c3xxx_mmp + +FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 + +.include Added: head/sys/modules/qatfw/qat_c62x/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/qatfw/qat_c62x/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/dev/qat + +KMOD= qat_c62xfw +IMG1= qat_c62x +IMG2= qat_c62x_mmp + +FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 + +.include Added: head/sys/modules/qatfw/qat_d15xx/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/qatfw/qat_d15xx/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/dev/qat + +KMOD= qat_d15xxfw +IMG1= qat_d15xx +IMG2= qat_d15xx_mmp + +FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 + +.include Added: head/sys/modules/qatfw/qat_dh895xcc/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/qatfw/qat_dh895xcc/Makefile Thu Nov 5 16:00:30 2020 (r367387) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.PATH: ${SRCTOP}/sys/contrib/dev/qat + +KMOD= qat_dh895xccfw +IMG1= qat_895xcc +IMG2= qat_895xcc_mmp + +FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 + +.include From owner-svn-src-head@freebsd.org Thu Nov 5 16:00:57 2020 Return-Path: Delivered-To: svn-src-head@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 E51B446B059; Thu, 5 Nov 2020 16:00:57 +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 4CRpCY6C5qz4qR3; Thu, 5 Nov 2020 16:00:57 +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 C7EC8162D7; Thu, 5 Nov 2020 16:00:57 +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 0A5G0vw6068046; Thu, 5 Nov 2020 16:00:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5G0vHn068045; Thu, 5 Nov 2020 16:00:57 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011051600.0A5G0vHn068045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 5 Nov 2020 16:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367388 - head/tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/tests/sys/opencrypto X-SVN-Commit-Revision: 367388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 16:00:58 -0000 Author: markj Date: Thu Nov 5 16:00:57 2020 New Revision: 367388 URL: https://svnweb.freebsd.org/changeset/base/367388 Log: cryptotest: Add qat(4) coverage MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/tests/sys/opencrypto/cryptotest.py Modified: head/tests/sys/opencrypto/cryptotest.py ============================================================================== --- head/tests/sys/opencrypto/cryptotest.py Thu Nov 5 16:00:30 2020 (r367387) +++ head/tests/sys/opencrypto/cryptotest.py Thu Nov 5 16:00:57 2020 (r367388) @@ -50,8 +50,8 @@ def katg(base, glob): raise unittest.SkipTest("Missing %s test vectors" % (base)) return iglob(os.path.join(katdir, base, glob)) -aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'safexcel0' ] -shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'ossl0', 'safexcel0' ] +aesmodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'safexcel0', 'qat0' ] +shamodules = [ 'cryptosoft0', 'aesni0', 'armv8crypto0', 'ccr0', 'ccp0', 'ossl0', 'safexcel0', 'qat0' ] def GenTestCase(cname): try: @@ -458,6 +458,7 @@ ccr = GenTestCase('ccr0') ccp = GenTestCase('ccp0') ossl = GenTestCase('ossl0') safexcel = GenTestCase('safexcel0') +qat = GenTestCase('qat0') if __name__ == '__main__': unittest.main() From owner-svn-src-head@freebsd.org Thu Nov 5 16:21:22 2020 Return-Path: Delivered-To: svn-src-head@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 9935546B8A6; Thu, 5 Nov 2020 16:21:22 +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 4CRpg640hBz4rJ2; Thu, 5 Nov 2020 16:21:22 +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 7C545168C8; Thu, 5 Nov 2020 16:21:22 +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 0A5GLMfI080852; Thu, 5 Nov 2020 16:21:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5GLM4x080851; Thu, 5 Nov 2020 16:21:22 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011051621.0A5GLM4x080851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 16:21:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367389 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 16:21:22 -0000 Author: mjg Date: Thu Nov 5 16:21:21 2020 New Revision: 367389 URL: https://svnweb.freebsd.org/changeset/base/367389 Log: malloc: add a helper returning size allocated for given request Sample usage: kernel modules can decide whether to stick to malloc or create their own zone. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27097 Modified: head/sys/kern/kern_malloc.c head/sys/sys/malloc.h Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Thu Nov 5 16:00:57 2020 (r367388) +++ head/sys/kern/kern_malloc.c Thu Nov 5 16:21:21 2020 (r367389) @@ -1031,6 +1031,23 @@ reallocf(void *addr, size_t size, struct malloc_type * } /* + * malloc_size: returns the number of bytes allocated for a request of the + * specified size + */ +size_t +malloc_size(size_t size) +{ + int indx; + + if (size > kmem_zmax) + return (0); + if (size & KMEM_ZMASK) + size = (size & ~KMEM_ZMASK) + KMEM_ZBASE; + indx = kmemsize[size >> KMEM_ZSHIFT]; + return (kmemzones[indx].kz_size); +} + +/* * malloc_usable_size: returns the usable size of the allocation. */ size_t Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Thu Nov 5 16:00:57 2020 (r367388) +++ head/sys/sys/malloc.h Thu Nov 5 16:21:21 2020 (r367389) @@ -250,6 +250,7 @@ void malloc_type_allocated(struct malloc_type *type, u void malloc_type_freed(struct malloc_type *type, unsigned long size); void malloc_type_list(malloc_type_list_func_t *, void *); void malloc_uninit(void *); +size_t malloc_size(size_t); size_t malloc_usable_size(const void *); void *realloc(void *addr, size_t size, struct malloc_type *type, int flags) __result_use_check __alloc_size(2); From owner-svn-src-head@freebsd.org Thu Nov 5 16:36:40 2020 Return-Path: Delivered-To: svn-src-head@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 804D946BB63; Thu, 5 Nov 2020 16:36:40 +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 4CRq0m2MnRz4sCV; Thu, 5 Nov 2020 16:36:40 +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 4432D16D86; Thu, 5 Nov 2020 16:36:40 +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 0A5GaeuD091726; Thu, 5 Nov 2020 16:36:40 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5Gae9Z091723; Thu, 5 Nov 2020 16:36:40 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011051636.0A5Gae9Z091723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 5 Nov 2020 16:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367390 - in head/sys: dev/hwpmc modules/hwpmc powerpc/include sys X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys: dev/hwpmc modules/hwpmc powerpc/include sys X-SVN-Commit-Revision: 367390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 16:36:40 -0000 Author: luporl Date: Thu Nov 5 16:36:39 2020 New Revision: 367390 URL: https://svnweb.freebsd.org/changeset/base/367390 Log: [PowerPC] hwpmc: add support for POWER8/9 PMCs This change adds support for POWER8 and POWER9 PMCs (bare metal and pseries). All PowerISA 2.07B non-random events are supported. Implementation was based on that of PPC970. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26110 Added: head/sys/dev/hwpmc/hwpmc_power8.c (contents, props changed) Modified: head/sys/dev/hwpmc/hwpmc_e500.c head/sys/dev/hwpmc/hwpmc_mpc7xxx.c head/sys/dev/hwpmc/hwpmc_powerpc.c head/sys/dev/hwpmc/hwpmc_powerpc.h head/sys/dev/hwpmc/hwpmc_ppc970.c head/sys/dev/hwpmc/pmc_events.h head/sys/modules/hwpmc/Makefile head/sys/powerpc/include/pmc_mdep.h head/sys/sys/pmc.h Modified: head/sys/dev/hwpmc/hwpmc_e500.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_e500.c Thu Nov 5 16:21:21 2020 (r367389) +++ head/sys/dev/hwpmc/hwpmc_e500.c Thu Nov 5 16:36:39 2020 (r367390) @@ -41,14 +41,6 @@ __FBSDID("$FreeBSD$"); #include "hwpmc_powerpc.h" -#define POWERPC_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \ - PMC_CAP_SYSTEM | PMC_CAP_EDGE | \ - PMC_CAP_THRESHOLD | PMC_CAP_READ | \ - PMC_CAP_WRITE | PMC_CAP_INVERT | \ - PMC_CAP_QUALIFIER) - -#define E500_PMC_HAS_OVERFLOWED(x) (e500_pmcn_read(x) & (0x1 << 31)) - struct e500_event_code_map { enum pmc_event pe_ev; /* enum value */ uint8_t pe_counter_mask; /* Which counter this can be counted in. */ @@ -246,20 +238,16 @@ static pmc_value_t e500_pmcn_read(unsigned int pmc) { switch (pmc) { - case 0: - return mfpmr(PMR_PMC0); - break; - case 1: - return mfpmr(PMR_PMC1); - break; - case 2: - return mfpmr(PMR_PMC2); - break; - case 3: - return mfpmr(PMR_PMC3); - break; - default: - panic("Invalid PMC number: %d\n", pmc); + case 0: + return (mfpmr(PMR_PMC0)); + case 1: + return (mfpmr(PMR_PMC1)); + case 2: + return (mfpmr(PMR_PMC2)); + case 3: + return (mfpmr(PMR_PMC3)); + default: + panic("Invalid PMC number: %d\n", pmc); } } @@ -267,206 +255,98 @@ static void e500_pmcn_write(unsigned int pmc, uint32_t val) { switch (pmc) { - case 0: - mtpmr(PMR_PMC0, val); - break; - case 1: - mtpmr(PMR_PMC1, val); - break; - case 2: - mtpmr(PMR_PMC2, val); - break; - case 3: - mtpmr(PMR_PMC3, val); - break; - default: - panic("Invalid PMC number: %d\n", pmc); - } -} - -static int -e500_read_pmc(int cpu, int ri, pmc_value_t *v) -{ - struct pmc *pm; - pmc_value_t tmp; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < E500_MAX_PMCS, - ("[powerpc,%d] illegal row index %d", __LINE__, ri)); - - pm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; - KASSERT(pm, - ("[core,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, - ri)); - - tmp = e500_pmcn_read(ri); - PMCDBG2(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp); - if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - *v = POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp); - else - *v = tmp; - - return 0; -} - -static int -e500_write_pmc(int cpu, int ri, pmc_value_t v) -{ - struct pmc *pm; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < E500_MAX_PMCS, - ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); - - pm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; - - if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - v = POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(v); - - PMCDBG3(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v); - - e500_pmcn_write(ri, v); - - return 0; -} - -static int -e500_config_pmc(int cpu, int ri, struct pmc *pm) -{ - struct pmc_hw *phw; - - PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < E500_MAX_PMCS, - ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); - - phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; - - KASSERT(pm == NULL || phw->phw_pmc == NULL, - ("[powerpc,%d] pm=%p phw->pm=%p hwpmc not unconfigured", - __LINE__, pm, phw->phw_pmc)); - - phw->phw_pmc = pm; - - return 0; -} - -static int -e500_start_pmc(int cpu, int ri) -{ - uint32_t config; - struct pmc *pm; - struct pmc_hw *phw; - - phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; - pm = phw->phw_pmc; - config = pm->pm_md.pm_powerpc.pm_powerpc_evsel; - - if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - config |= PMLCax_CE; - - /* Enable the PMC. */ - switch (ri) { case 0: - mtpmr(PMR_PMLCa0, config); + mtpmr(PMR_PMC0, val); break; case 1: - mtpmr(PMR_PMLCa1, config); + mtpmr(PMR_PMC1, val); break; case 2: - mtpmr(PMR_PMLCa2, config); + mtpmr(PMR_PMC2, val); break; case 3: - mtpmr(PMR_PMLCa3, config); + mtpmr(PMR_PMC3, val); break; default: - break; + panic("Invalid PMC number: %d\n", pmc); } - - return 0; } -static int -e500_stop_pmc(int cpu, int ri) +static void +e500_set_pmc(int cpu, int ri, int config) { - struct pmc *pm; - struct pmc_hw *phw; - register_t pmc_pmlc; + struct pmc *pm; + struct pmc_hw *phw; + register_t pmc_pmlc; phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; pm = phw->phw_pmc; + config &= ~POWERPC_PMC_ENABLE; - /* - * Disable the PMCs. - */ - switch (ri) { - case 0: - pmc_pmlc = mfpmr(PMR_PMLCa0); - pmc_pmlc |= PMLCax_FC; - mtpmr(PMR_PMLCa0, pmc_pmlc); - break; - case 1: - pmc_pmlc = mfpmr(PMR_PMLCa1); - pmc_pmlc |= PMLCax_FC; - mtpmr(PMR_PMLCa1, pmc_pmlc); - break; - case 2: - pmc_pmlc = mfpmr(PMR_PMLCa2); - pmc_pmlc |= PMLCax_FC; - mtpmr(PMR_PMLCa2, pmc_pmlc); - break; - case 3: - pmc_pmlc = mfpmr(PMR_PMLCa3); - pmc_pmlc |= PMLCax_FC; - mtpmr(PMR_PMLCa3, pmc_pmlc); - break; - default: - break; + if (config != PMCN_NONE) { + if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) + config |= PMLCax_CE; + + /* Enable the PMC. */ + switch (ri) { + case 0: + mtpmr(PMR_PMLCa0, config); + break; + case 1: + mtpmr(PMR_PMLCa1, config); + break; + case 2: + mtpmr(PMR_PMLCa2, config); + break; + case 3: + mtpmr(PMR_PMLCa3, config); + break; + } + } else { + /* Disable the PMC. */ + switch (ri) { + case 0: + pmc_pmlc = mfpmr(PMR_PMLCa0); + pmc_pmlc |= PMLCax_FC; + mtpmr(PMR_PMLCa0, pmc_pmlc); + break; + case 1: + pmc_pmlc = mfpmr(PMR_PMLCa1); + pmc_pmlc |= PMLCax_FC; + mtpmr(PMR_PMLCa1, pmc_pmlc); + break; + case 2: + pmc_pmlc = mfpmr(PMR_PMLCa2); + pmc_pmlc |= PMLCax_FC; + mtpmr(PMR_PMLCa2, pmc_pmlc); + break; + case 3: + pmc_pmlc = mfpmr(PMR_PMLCa3); + pmc_pmlc |= PMLCax_FC; + mtpmr(PMR_PMLCa3, pmc_pmlc); + break; + } } - return 0; } static int e500_pcpu_init(struct pmc_mdep *md, int cpu) { - int first_ri, i; - struct pmc_cpu *pc; - struct powerpc_cpu *pac; - struct pmc_hw *phw; + int i; - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] wrong cpu number %d", __LINE__, cpu)); - PMCDBG1(MDP,INI,1,"powerpc-init cpu=%d", cpu); + powerpc_pcpu_init(md, cpu); /* Freeze all counters. */ mtpmr(PMR_PMGC0, PMGC_FAC | PMGC_PMIE | PMGC_FCECE); - powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu), M_PMC, - M_WAITOK|M_ZERO); - pac->pc_ppcpmcs = malloc(sizeof(struct pmc_hw) * E500_MAX_PMCS, - M_PMC, M_WAITOK|M_ZERO); - pac->pc_class = PMC_CLASS_E500; - pc = pmc_pcpu[cpu]; - first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_POWERPC].pcd_ri; - KASSERT(pc != NULL, ("[powerpc,%d] NULL per-cpu pointer", __LINE__)); - - for (i = 0, phw = pac->pc_ppcpmcs; i < E500_MAX_PMCS; i++, phw++) { - phw->phw_state = PMC_PHW_FLAG_IS_ENABLED | - PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(i); - phw->phw_pmc = NULL; - pc->pc_hwpmcs[i + first_ri] = phw; - + for (i = 0; i < E500_MAX_PMCS; i++) /* Initialize the PMC to stopped */ - e500_stop_pmc(cpu, i); - } + powerpc_stop_pmc(cpu, i); + /* Unfreeze global register. */ mtpmr(PMR_PMGC0, PMGC_PMIE | PMGC_FCECE); - return 0; + return (0); } static int @@ -478,10 +358,7 @@ e500_pcpu_fini(struct pmc_mdep *md, int cpu) mtpmr(PMR_PMGC0, pmgc0); mtmsr(mfmsr() & ~PSL_PMM); - free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); - free(powerpc_pcpu[cpu], M_PMC); - - return 0; + return (powerpc_pcpu_fini(md, cpu)); } static int @@ -547,85 +424,12 @@ e500_allocate_pmc(int cpu, int ri, struct pmc *pm, return 0; } -static int -e500_release_pmc(int cpu, int ri, struct pmc *pmc) +static void +e500_resume_pmc(bool ie) { - struct pmc_hw *phw; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < E500_MAX_PMCS, - ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); - - phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; - KASSERT(phw->phw_pmc == NULL, - ("[powerpc,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); - - return 0; -} - -static int -e500_intr(struct trapframe *tf) -{ - int i, error, retval, cpu; - uint32_t config; - struct pmc *pm; - struct powerpc_cpu *pac; - - cpu = curcpu; - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] out of range CPU %d", __LINE__, cpu)); - - PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf, - TRAPF_USERMODE(tf)); - - retval = 0; - - pac = powerpc_pcpu[cpu]; - - config = mfpmr(PMR_PMGC0) & ~PMGC_FAC; - - /* - * look for all PMCs that have interrupted: - * - look for a running, sampling PMC which has overflowed - * and which has a valid 'struct pmc' association - * - * If found, we call a helper to process the interrupt. - */ - - for (i = 0; i < E500_MAX_PMCS; i++) { - if ((pm = pac->pc_ppcpmcs[i].phw_pmc) == NULL || - !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { - continue; - } - - if (!E500_PMC_HAS_OVERFLOWED(i)) - continue; - - retval = 1; /* Found an interrupting PMC. */ - - if (pm->pm_state != PMC_STATE_RUNNING) - continue; - - /* Stop the counter if logging fails. */ - error = pmc_process_interrupt(PMC_HR, pm, tf); - if (error != 0) - e500_stop_pmc(cpu, i); - - /* reload count. */ - e500_write_pmc(cpu, i, pm->pm_sc.pm_reloadcount); - } - - if (retval) - counter_u64_add(pmc_stats.pm_intr_processed, 1); - else - counter_u64_add(pmc_stats.pm_intr_ignored, 1); - /* Re-enable PERF exceptions. */ - if (retval) - mtpmr(PMR_PMGC0, config | PMGC_PMIE); - - return (retval); + if (ie) + mtpmr(PMR_PMGC0, (mfpmr(PMR_PMGC0) & ~PMGC_FAC) | PMGC_PMIE); } int @@ -643,19 +447,26 @@ pmc_e500_initialize(struct pmc_mdep *pmc_mdep) pcd->pcd_width = 32; pcd->pcd_allocate_pmc = e500_allocate_pmc; - pcd->pcd_config_pmc = e500_config_pmc; + pcd->pcd_config_pmc = powerpc_config_pmc; pcd->pcd_pcpu_fini = e500_pcpu_fini; pcd->pcd_pcpu_init = e500_pcpu_init; pcd->pcd_describe = powerpc_describe; pcd->pcd_get_config = powerpc_get_config; - pcd->pcd_read_pmc = e500_read_pmc; - pcd->pcd_release_pmc = e500_release_pmc; - pcd->pcd_start_pmc = e500_start_pmc; - pcd->pcd_stop_pmc = e500_stop_pmc; - pcd->pcd_write_pmc = e500_write_pmc; + pcd->pcd_read_pmc = powerpc_read_pmc; + pcd->pcd_release_pmc = powerpc_release_pmc; + pcd->pcd_start_pmc = powerpc_start_pmc; + pcd->pcd_stop_pmc = powerpc_stop_pmc; + pcd->pcd_write_pmc = powerpc_write_pmc; pmc_mdep->pmd_npmc += E500_MAX_PMCS; - pmc_mdep->pmd_intr = e500_intr; + pmc_mdep->pmd_intr = powerpc_pmc_intr; + + ppc_max_pmcs = E500_MAX_PMCS; + + powerpc_set_pmc = e500_set_pmc; + powerpc_pmcn_read = e500_pmcn_read; + powerpc_pmcn_write = e500_pmcn_write; + powerpc_resume_pmc = e500_resume_pmc; return (0); } Modified: head/sys/dev/hwpmc/hwpmc_mpc7xxx.c ============================================================================== --- head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Thu Nov 5 16:21:21 2020 (r367389) +++ head/sys/dev/hwpmc/hwpmc_mpc7xxx.c Thu Nov 5 16:36:39 2020 (r367390) @@ -42,12 +42,6 @@ __FBSDID("$FreeBSD$"); #include "hwpmc_powerpc.h" -#define POWERPC_PMC_CAPS (PMC_CAP_INTERRUPT | PMC_CAP_USER | \ - PMC_CAP_SYSTEM | PMC_CAP_EDGE | \ - PMC_CAP_THRESHOLD | PMC_CAP_READ | \ - PMC_CAP_WRITE | PMC_CAP_INVERT | \ - PMC_CAP_QUALIFIER) - #define PPC_SET_PMC1SEL(r, x) ((r & ~(SPR_MMCR0_74XX_PMC1SEL(0x3f))) | \ SPR_MMCR0_74XX_PMC1SEL(x)) #define PPC_SET_PMC2SEL(r, x) ((r & ~(SPR_MMCR0_74XX_PMC2SEL(0x3f))) | \ @@ -61,8 +55,6 @@ __FBSDID("$FreeBSD$"); /* Change this when we support more than just the 7450. */ #define MPC7XXX_MAX_PMCS 6 -#define MPC7XXX_PMC_HAS_OVERFLOWED(x) (mpc7xxx_pmcn_read(x) & (0x1 << 31)) - /* * Things to improve on this: * - It stops (clears to 0) the PMC and resets it at every context switch @@ -74,23 +66,11 @@ __FBSDID("$FreeBSD$"); * specifically). */ -struct mpc7xxx_event_code_map { - enum pmc_event pe_ev; /* enum value */ - uint8_t pe_counter_mask; /* Which counter this can be counted in. */ - uint8_t pe_code; /* numeric code */ -}; - -#define PPC_PMC_MASK1 0 -#define PPC_PMC_MASK2 1 -#define PPC_PMC_MASK3 2 -#define PPC_PMC_MASK4 3 -#define PPC_PMC_MASK5 4 -#define PPC_PMC_MASK6 5 #define PPC_PMC_MASK_ALL 0x3f #define PMC_POWERPC_EVENT(id, mask, number) \ - { .pe_ev = PMC_EV_PPC7450_##id, .pe_counter_mask = mask, .pe_code = number } + { .pe_event = PMC_EV_PPC7450_##id, .pe_flags = mask, .pe_code = number } -static struct mpc7xxx_event_code_map mpc7xxx_event_codes[] = { +static struct pmc_ppc_event mpc7xxx_event_codes[] = { PMC_POWERPC_EVENT(CYCLE,PPC_PMC_MASK_ALL, 1), PMC_POWERPC_EVENT(INSTR_COMPLETED, 0x0f, 2), PMC_POWERPC_EVENT(TLB_BIT_TRANSITIONS, 0x0f, 3), @@ -315,30 +295,26 @@ static struct mpc7xxx_event_code_map mpc7xxx_event_cod PMC_POWERPC_EVENT(PREFETCH_ENGINE_COLLISION_VS_LOAD_STORE_INSTR_FETCH, 0x20, 56), PMC_POWERPC_EVENT(PREFETCH_ENGINE_FULL, 0x20, 57) }; +static size_t mpc7xxx_event_codes_size = nitems(mpc7xxx_event_codes); static pmc_value_t mpc7xxx_pmcn_read(unsigned int pmc) { switch (pmc) { - case 0: - return mfspr(SPR_PMC1_74XX); - break; - case 1: - return mfspr(SPR_PMC2_74XX); - break; - case 2: - return mfspr(SPR_PMC3_74XX); - break; - case 3: - return mfspr(SPR_PMC4_74XX); - break; - case 4: - return mfspr(SPR_PMC5_74XX); - break; - case 5: - return mfspr(SPR_PMC6_74XX); - default: - panic("Invalid PMC number: %d\n", pmc); + case 0: + return (mfspr(SPR_PMC1_74XX)); + case 1: + return (mfspr(SPR_PMC2_74XX)); + case 2: + return (mfspr(SPR_PMC3_74XX)); + case 3: + return (mfspr(SPR_PMC4_74XX)); + case 4: + return (mfspr(SPR_PMC5_74XX)); + case 5: + return (mfspr(SPR_PMC6_74XX)); + default: + panic("Invalid PMC number: %d\n", pmc); } } @@ -346,245 +322,98 @@ static void mpc7xxx_pmcn_write(unsigned int pmc, uint32_t val) { switch (pmc) { - case 0: - mtspr(SPR_PMC1_74XX, val); - break; - case 1: - mtspr(SPR_PMC2_74XX, val); - break; - case 2: - mtspr(SPR_PMC3_74XX, val); - break; - case 3: - mtspr(SPR_PMC4_74XX, val); - break; - case 4: - mtspr(SPR_PMC5_74XX, val); - break; - case 5: - mtspr(SPR_PMC6_74XX, val); - break; - default: - panic("Invalid PMC number: %d\n", pmc); - } -} - -static int -mpc7xxx_read_pmc(int cpu, int ri, pmc_value_t *v) -{ - struct pmc *pm; - pmc_value_t tmp; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < MPC7XXX_MAX_PMCS, - ("[powerpc,%d] illegal row index %d", __LINE__, ri)); - - pm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; - KASSERT(pm, - ("[core,%d] cpu %d ri %d pmc not configured", __LINE__, cpu, - ri)); - - tmp = mpc7xxx_pmcn_read(ri); - PMCDBG2(MDP,REA,2,"ppc-read id=%d -> %jd", ri, tmp); - if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - *v = POWERPC_PERFCTR_VALUE_TO_RELOAD_COUNT(tmp); - else - *v = tmp; - - return 0; -} - -static int -mpc7xxx_write_pmc(int cpu, int ri, pmc_value_t v) -{ - struct pmc *pm; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < MPC7XXX_MAX_PMCS, - ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); - - pm = powerpc_pcpu[cpu]->pc_ppcpmcs[ri].phw_pmc; - - if (PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) - v = POWERPC_RELOAD_COUNT_TO_PERFCTR_VALUE(v); - - PMCDBG3(MDP,WRI,1,"powerpc-write cpu=%d ri=%d v=%jx", cpu, ri, v); - - mpc7xxx_pmcn_write(ri, v); - - return 0; -} - -static int -mpc7xxx_config_pmc(int cpu, int ri, struct pmc *pm) -{ - struct pmc_hw *phw; - - PMCDBG3(MDP,CFG,1, "cpu=%d ri=%d pm=%p", cpu, ri, pm); - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < MPC7XXX_MAX_PMCS, - ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); - - phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; - - KASSERT(pm == NULL || phw->phw_pmc == NULL, - ("[powerpc,%d] pm=%p phw->pm=%p hwpmc not unconfigured", - __LINE__, pm, phw->phw_pmc)); - - phw->phw_pmc = pm; - - return 0; -} - -static int -mpc7xxx_start_pmc(int cpu, int ri) -{ - uint32_t config; - struct pmc *pm; - struct pmc_hw *phw; - register_t pmc_mmcr; - - phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; - pm = phw->phw_pmc; - config = pm->pm_md.pm_powerpc.pm_powerpc_evsel & ~POWERPC_PMC_ENABLE; - - /* Enable the PMC. */ - switch (ri) { case 0: - pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, config); - mtspr(SPR_MMCR0_74XX, pmc_mmcr); + mtspr(SPR_PMC1_74XX, val); break; case 1: - pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, config); - mtspr(SPR_MMCR0_74XX, pmc_mmcr); + mtspr(SPR_PMC2_74XX, val); break; case 2: - pmc_mmcr = mfspr(SPR_MMCR1_74XX); - pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, config); - mtspr(SPR_MMCR1_74XX, pmc_mmcr); + mtspr(SPR_PMC3_74XX, val); break; case 3: - pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, config); - mtspr(SPR_MMCR0_74XX, pmc_mmcr); + mtspr(SPR_PMC4_74XX, val); break; case 4: - pmc_mmcr = mfspr(SPR_MMCR1_74XX); - pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, config); - mtspr(SPR_MMCR1_74XX, pmc_mmcr); + mtspr(SPR_PMC5_74XX, val); break; case 5: - pmc_mmcr = mfspr(SPR_MMCR1_74XX); - pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, config); - mtspr(SPR_MMCR1_74XX, pmc_mmcr); + mtspr(SPR_PMC6_74XX, val); break; default: - break; + panic("Invalid PMC number: %d\n", pmc); } - - /* The mask is inverted (enable is 1) compared to the flags in MMCR0, which - * are Freeze flags. - */ - config = ~pm->pm_md.pm_powerpc.pm_powerpc_evsel & POWERPC_PMC_ENABLE; - - pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr &= ~SPR_MMCR0_FC; - pmc_mmcr |= config; - mtspr(SPR_MMCR0_74XX, pmc_mmcr); - - return 0; } -static int -mpc7xxx_stop_pmc(int cpu, int ri) +static void +mpc7xxx_set_pmc(int cpu, int ri, int config) { - struct pmc *pm; - struct pmc_hw *phw; - register_t pmc_mmcr; + struct pmc *pm; + struct pmc_hw *phw; + register_t pmc_mmcr; + uint32_t config_mask; phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; pm = phw->phw_pmc; - - /* - * Disable the PMCs. + /* The mask is inverted (enable is 1) compared to the flags in + * MMCR0, which are Freeze flags. */ + config_mask = ~config & POWERPC_PMC_ENABLE; + config &= ~POWERPC_PMC_ENABLE; + + /* Enable/disable the PMC. */ switch (ri) { case 0: pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, 0); + pmc_mmcr = PPC_SET_PMC1SEL(pmc_mmcr, config); mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 1: pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, 0); + pmc_mmcr = PPC_SET_PMC2SEL(pmc_mmcr, config); mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 2: pmc_mmcr = mfspr(SPR_MMCR1_74XX); - pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, 0); + pmc_mmcr = PPC_SET_PMC3SEL(pmc_mmcr, config); mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; case 3: pmc_mmcr = mfspr(SPR_MMCR0_74XX); - pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, 0); + pmc_mmcr = PPC_SET_PMC4SEL(pmc_mmcr, config); mtspr(SPR_MMCR0_74XX, pmc_mmcr); break; case 4: pmc_mmcr = mfspr(SPR_MMCR1_74XX); - pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, 0); + pmc_mmcr = PPC_SET_PMC5SEL(pmc_mmcr, config); mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; case 5: pmc_mmcr = mfspr(SPR_MMCR1_74XX); - pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, 0); + pmc_mmcr = PPC_SET_PMC6SEL(pmc_mmcr, config); mtspr(SPR_MMCR1_74XX, pmc_mmcr); break; - default: - break; } - return 0; + + if (config != PMCN_NONE) { + pmc_mmcr = mfspr(SPR_MMCR0_74XX); + pmc_mmcr &= ~SPR_MMCR0_FC; + pmc_mmcr |= config; + mtspr(SPR_MMCR0_74XX, pmc_mmcr); + } } static int mpc7xxx_pcpu_init(struct pmc_mdep *md, int cpu) { - int first_ri, i; - struct pmc_cpu *pc; - struct powerpc_cpu *pac; - struct pmc_hw *phw; + powerpc_pcpu_init(md, cpu); - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] wrong cpu number %d", __LINE__, cpu)); - PMCDBG1(MDP,INI,1,"powerpc-init cpu=%d", cpu); - - powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu), M_PMC, - M_WAITOK|M_ZERO); - pac->pc_ppcpmcs = malloc(sizeof(struct pmc_hw) * MPC7XXX_MAX_PMCS, - M_PMC, M_WAITOK|M_ZERO); - pac->pc_class = PMC_CLASS_PPC7450; - pc = pmc_pcpu[cpu]; - first_ri = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_POWERPC].pcd_ri; - KASSERT(pc != NULL, ("[powerpc,%d] NULL per-cpu pointer", __LINE__)); - - for (i = 0, phw = pac->pc_ppcpmcs; i < MPC7XXX_MAX_PMCS; i++, phw++) { - phw->phw_state = PMC_PHW_FLAG_IS_ENABLED | - PMC_PHW_CPU_TO_STATE(cpu) | PMC_PHW_INDEX_TO_STATE(i); - phw->phw_pmc = NULL; - pc->pc_hwpmcs[i + first_ri] = phw; - } - /* Clear the MMCRs, and set FC, to disable all PMCs. */ mtspr(SPR_MMCR0_74XX, SPR_MMCR0_FC | SPR_MMCR0_PMXE | SPR_MMCR0_FCECE | SPR_MMCR0_PMC1CE | SPR_MMCR0_PMCNCE); mtspr(SPR_MMCR1_74XX, 0); - return 0; + return (0); } static int @@ -596,133 +425,16 @@ mpc7xxx_pcpu_fini(struct pmc_mdep *md, int cpu) mmcr0 |= SPR_MMCR0_FC; mtspr(SPR_MMCR0_74XX, mmcr0); - free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); - free(powerpc_pcpu[cpu], M_PMC); - - return 0; + return (powerpc_pcpu_fini(md, cpu)); } -static int -mpc7xxx_allocate_pmc(int cpu, int ri, struct pmc *pm, - const struct pmc_op_pmcallocate *a) +static void +mpc7xxx_resume_pmc(bool ie) { - enum pmc_event pe; - uint32_t caps, config, counter; - int i; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < MPC7XXX_MAX_PMCS, - ("[powerpc,%d] illegal row index %d", __LINE__, ri)); - - caps = a->pm_caps; - - pe = a->pm_ev; - for (i = 0; i < nitems(mpc7xxx_event_codes); i++) { - if (mpc7xxx_event_codes[i].pe_ev == pe) { - config = mpc7xxx_event_codes[i].pe_code; - counter = mpc7xxx_event_codes[i].pe_counter_mask; - break; - } - } - if (i == nitems(mpc7xxx_event_codes)) - return (EINVAL); - - if ((counter & (1 << ri)) == 0) - return (EINVAL); - - if (caps & PMC_CAP_SYSTEM) - config |= POWERPC_PMC_KERNEL_ENABLE; - if (caps & PMC_CAP_USER) - config |= POWERPC_PMC_USER_ENABLE; - if ((caps & (PMC_CAP_USER | PMC_CAP_SYSTEM)) == 0) - config |= POWERPC_PMC_ENABLE; - - pm->pm_md.pm_powerpc.pm_powerpc_evsel = config; - - PMCDBG2(MDP,ALL,2,"powerpc-allocate ri=%d -> config=0x%x", ri, config); - - return 0; -} - -static int -mpc7xxx_release_pmc(int cpu, int ri, struct pmc *pmc) -{ - struct pmc_hw *phw; - - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] illegal CPU value %d", __LINE__, cpu)); - KASSERT(ri >= 0 && ri < MPC7XXX_MAX_PMCS, - ("[powerpc,%d] illegal row-index %d", __LINE__, ri)); - - phw = &powerpc_pcpu[cpu]->pc_ppcpmcs[ri]; - KASSERT(phw->phw_pmc == NULL, - ("[powerpc,%d] PHW pmc %p non-NULL", __LINE__, phw->phw_pmc)); - - return 0; -} - -static int -mpc7xxx_intr(struct trapframe *tf) -{ - int i, error, retval, cpu; - uint32_t config; - struct pmc *pm; - struct powerpc_cpu *pac; - - cpu = curcpu; - KASSERT(cpu >= 0 && cpu < pmc_cpu_max(), - ("[powerpc,%d] out of range CPU %d", __LINE__, cpu)); - - PMCDBG3(MDP,INT,1, "cpu=%d tf=%p um=%d", cpu, (void *) tf, - TRAPF_USERMODE(tf)); - - retval = 0; - - pac = powerpc_pcpu[cpu]; - - config = mfspr(SPR_MMCR0_74XX) & ~SPR_MMCR0_FC; - - /* - * look for all PMCs that have interrupted: - * - look for a running, sampling PMC which has overflowed - * and which has a valid 'struct pmc' association - * - * If found, we call a helper to process the interrupt. - */ - - for (i = 0; i < MPC7XXX_MAX_PMCS; i++) { - if ((pm = pac->pc_ppcpmcs[i].phw_pmc) == NULL || - !PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) { - continue; - } - - if (!MPC7XXX_PMC_HAS_OVERFLOWED(i)) - continue; - - retval = 1; /* Found an interrupting PMC. */ - - if (pm->pm_state != PMC_STATE_RUNNING) - continue; - - /* Stop the counter if logging fails. */ - error = pmc_process_interrupt(PMC_HR, pm, tf); - if (error != 0) - mpc7xxx_stop_pmc(cpu, i); - - /* reload count. */ - mpc7xxx_write_pmc(cpu, i, pm->pm_sc.pm_reloadcount); - } - if (retval) - counter_u64_add(pmc_stats.pm_intr_processed, 1); - else - counter_u64_add(pmc_stats.pm_intr_ignored, 1); - /* Re-enable PERF exceptions. */ - if (retval) - mtspr(SPR_MMCR0_74XX, config | SPR_MMCR0_PMXE); - - return (retval); + if (ie) + mtspr(SPR_MMCR0_74XX, + (mfspr(SPR_MMCR0_74XX) & ~SPR_MMCR0_FC) | SPR_MMCR0_PMXE); } int @@ -739,20 +451,31 @@ pmc_mpc7xxx_initialize(struct pmc_mdep *pmc_mdep) pcd->pcd_ri = pmc_mdep->pmd_npmc; pcd->pcd_width = 32; /* All PMCs, even in ppc970, are 32-bit */ - pcd->pcd_allocate_pmc = mpc7xxx_allocate_pmc; - pcd->pcd_config_pmc = mpc7xxx_config_pmc; + pcd->pcd_allocate_pmc = powerpc_allocate_pmc; + pcd->pcd_config_pmc = powerpc_config_pmc; pcd->pcd_pcpu_fini = mpc7xxx_pcpu_fini; pcd->pcd_pcpu_init = mpc7xxx_pcpu_init; pcd->pcd_describe = powerpc_describe; pcd->pcd_get_config = powerpc_get_config; - pcd->pcd_read_pmc = mpc7xxx_read_pmc; - pcd->pcd_release_pmc = mpc7xxx_release_pmc; - pcd->pcd_start_pmc = mpc7xxx_start_pmc; - pcd->pcd_stop_pmc = mpc7xxx_stop_pmc; - pcd->pcd_write_pmc = mpc7xxx_write_pmc; + pcd->pcd_read_pmc = powerpc_read_pmc; + pcd->pcd_release_pmc = powerpc_release_pmc; + pcd->pcd_start_pmc = powerpc_start_pmc; + pcd->pcd_stop_pmc = powerpc_stop_pmc; + pcd->pcd_write_pmc = powerpc_write_pmc; pmc_mdep->pmd_npmc += MPC7XXX_MAX_PMCS; - pmc_mdep->pmd_intr = mpc7xxx_intr; + pmc_mdep->pmd_intr = powerpc_pmc_intr; + + ppc_event_codes = mpc7xxx_event_codes; + ppc_event_codes_size = mpc7xxx_event_codes_size; + ppc_event_first = PMC_EV_PPC7450_FIRST; + ppc_event_last = PMC_EV_PPC7450_LAST; + ppc_max_pmcs = MPC7XXX_MAX_PMCS; + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Nov 5 16:41:29 2020 Return-Path: Delivered-To: svn-src-head@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 7C04646C09E; Thu, 5 Nov 2020 16:41:29 +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 4CRq6K37Zjz4sSM; Thu, 5 Nov 2020 16:41:29 +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 5E8E816674; Thu, 5 Nov 2020 16:41:29 +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 0A5GfTnp093381; Thu, 5 Nov 2020 16:41:29 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5GfTPM093380; Thu, 5 Nov 2020 16:41:29 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011051641.0A5GfTPM093380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 5 Nov 2020 16:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367391 - head/lib/libpmc X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/lib/libpmc X-SVN-Commit-Revision: 367391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 16:41:29 -0000 Author: luporl Date: Thu Nov 5 16:41:28 2020 New Revision: 367391 URL: https://svnweb.freebsd.org/changeset/base/367391 Log: libpmc: add support for POWER8/9 PMCs This change adds support for POWER8/9 performance counters. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26113 Modified: head/lib/libpmc/libpmc.c Modified: head/lib/libpmc/libpmc.c ============================================================================== --- head/lib/libpmc/libpmc.c Thu Nov 5 16:36:39 2020 (r367390) +++ head/lib/libpmc/libpmc.c Thu Nov 5 16:41:28 2020 (r367391) @@ -149,6 +149,7 @@ PMC_CLASSDEP_TABLE(mips74k, MIPS74K); PMC_CLASSDEP_TABLE(octeon, OCTEON); PMC_CLASSDEP_TABLE(ppc7450, PPC7450); PMC_CLASSDEP_TABLE(ppc970, PPC970); +PMC_CLASSDEP_TABLE(power8, POWER8); PMC_CLASSDEP_TABLE(e500, E500); static struct pmc_event_descr soft_event_table[PMC_EV_DYN_COUNT]; @@ -204,6 +205,7 @@ PMC_MDEP_TABLE(mips74k, MIPS74K, PMC_CLASS_SOFT, PMC_C PMC_MDEP_TABLE(octeon, OCTEON, PMC_CLASS_SOFT, PMC_CLASS_OCTEON); PMC_MDEP_TABLE(ppc7450, PPC7450, PMC_CLASS_SOFT, PMC_CLASS_PPC7450, PMC_CLASS_TSC); PMC_MDEP_TABLE(ppc970, PPC970, PMC_CLASS_SOFT, PMC_CLASS_PPC970, PMC_CLASS_TSC); +PMC_MDEP_TABLE(power8, POWER8, PMC_CLASS_SOFT, PMC_CLASS_POWER8, PMC_CLASS_TSC); PMC_MDEP_TABLE(e500, E500, PMC_CLASS_SOFT, PMC_CLASS_E500, PMC_CLASS_TSC); PMC_MDEP_TABLE(generic, SOFT, PMC_CLASS_SOFT); @@ -252,6 +254,7 @@ PMC_CLASS_TABLE_DESC(octeon, OCTEON, octeon, mips); #if defined(__powerpc__) PMC_CLASS_TABLE_DESC(ppc7450, PPC7450, ppc7450, powerpc); PMC_CLASS_TABLE_DESC(ppc970, PPC970, ppc970, powerpc); +PMC_CLASS_TABLE_DESC(power8, POWER8, power8, powerpc); PMC_CLASS_TABLE_DESC(e500, E500, e500, powerpc); #endif @@ -913,6 +916,12 @@ static struct pmc_event_alias ppc970_aliases[] = { EV_ALIAS(NULL, NULL) }; +static struct pmc_event_alias power8_aliases[] = { + EV_ALIAS("instructions", "INSTR_COMPLETED"), + EV_ALIAS("cycles", "CYCLES"), + EV_ALIAS(NULL, NULL) +}; + static struct pmc_event_alias e500_aliases[] = { EV_ALIAS("instructions", "INSTR_COMPLETED"), EV_ALIAS("cycles", "CYCLES"), @@ -1313,6 +1322,10 @@ pmc_event_names_of_class(enum pmc_class cl, const char ev = ppc970_event_table; count = PMC_EVENT_TABLE_SIZE(ppc970); break; + case PMC_CLASS_POWER8: + ev = power8_event_table; + count = PMC_EVENT_TABLE_SIZE(power8); + break; case PMC_CLASS_E500: ev = e500_event_table; count = PMC_EVENT_TABLE_SIZE(e500); @@ -1564,6 +1577,10 @@ pmc_init(void) PMC_MDEP_INIT(ppc970); pmc_class_table[n] = &ppc970_class_table_descr; break; + case PMC_CPU_PPC_POWER8: + PMC_MDEP_INIT(power8); + pmc_class_table[n] = &power8_class_table_descr; + break; case PMC_CPU_PPC_E500: PMC_MDEP_INIT(e500); pmc_class_table[n] = &e500_class_table_descr; @@ -1701,6 +1718,9 @@ _pmc_name_of_event(enum pmc_event pe, enum pmc_cputype } else if (pe >= PMC_EV_PPC970_FIRST && pe <= PMC_EV_PPC970_LAST) { ev = ppc970_event_table; evfence = ppc970_event_table + PMC_EVENT_TABLE_SIZE(ppc970); + } else if (pe >= PMC_EV_POWER8_FIRST && pe <= PMC_EV_POWER8_LAST) { + ev = power8_event_table; + evfence = power8_event_table + PMC_EVENT_TABLE_SIZE(power8); } else if (pe >= PMC_EV_E500_FIRST && pe <= PMC_EV_E500_LAST) { ev = e500_event_table; evfence = e500_event_table + PMC_EVENT_TABLE_SIZE(e500); From owner-svn-src-head@freebsd.org Thu Nov 5 16:47:24 2020 Return-Path: Delivered-To: svn-src-head@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 767A946BFB3; Thu, 5 Nov 2020 16:47:24 +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 4CRqF82z07z4t7t; Thu, 5 Nov 2020 16:47:24 +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 5898C17107; Thu, 5 Nov 2020 16:47:24 +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 0A5GlOk5097878; Thu, 5 Nov 2020 16:47:24 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5GlOrA097877; Thu, 5 Nov 2020 16:47:24 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011051647.0A5GlOrA097877@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 5 Nov 2020 16:47:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367392 - head/lib/libpmcstat X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/lib/libpmcstat X-SVN-Commit-Revision: 367392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 16:47:24 -0000 Author: luporl Date: Thu Nov 5 16:47:23 2020 New Revision: 367392 URL: https://svnweb.freebsd.org/changeset/base/367392 Log: pmcstat: fix PPC kernel symbol resolution PowerPC kernel is of DYN type and it has a base address where it is initially loaded, before being relocated. As the start address passed to pmcstat_image_link() is where the kernel was relocated to, but the symbols always use the original base address, we need to subtract it to get the correct offset. Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D26114 Modified: head/lib/libpmcstat/libpmcstat_image.c Modified: head/lib/libpmcstat/libpmcstat_image.c ============================================================================== --- head/lib/libpmcstat/libpmcstat_image.c Thu Nov 5 16:41:28 2020 (r367391) +++ head/lib/libpmcstat/libpmcstat_image.c Thu Nov 5 16:47:23 2020 (r367392) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -176,12 +177,36 @@ pmcstat_image_link(struct pmcstat_process *pp, struct { struct pmcstat_pcmap *pcm, *pcmnew; uintfptr_t offset; +#ifdef __powerpc__ + unsigned long kernbase; + size_t kernbase_len; +#endif assert(image->pi_type != PMCSTAT_IMAGE_UNKNOWN && image->pi_type != PMCSTAT_IMAGE_INDETERMINABLE); if ((pcmnew = malloc(sizeof(*pcmnew))) == NULL) err(EX_OSERR, "ERROR: Cannot create a map entry"); + + /* + * PowerPC kernel is of DYN type and it has a base address + * where it is initially loaded, before being relocated. + * As the address in 'start' is where the kernel was relocated to, + * but the symbols always use the original base address, we need to + * subtract it to get the correct offset. + */ +#ifdef __powerpc__ + if (pp->pp_pid == -1) { + kernbase = 0; + kernbase_len = sizeof(kernbase); + if (sysctlbyname("kern.base_address", &kernbase, &kernbase_len, + NULL, 0) == -1) + warnx( + "WARNING: Could not retrieve kernel base address"); + else + start -= kernbase; + } +#endif /* * Adjust the map entry to only cover the text portion From owner-svn-src-head@freebsd.org Thu Nov 5 17:10:15 2020 Return-Path: Delivered-To: svn-src-head@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 0C5E946CACB; Thu, 5 Nov 2020 17:10:15 +0000 (UTC) (envelope-from allanjude@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 4CRqlV6xWMz4vbd; Thu, 5 Nov 2020 17:10:14 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD6E9170BE; Thu, 5 Nov 2020 17:10:14 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5HAESs010410; Thu, 5 Nov 2020 17:10:14 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5HAE33010409; Thu, 5 Nov 2020 17:10:14 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <202011051710.0A5HAE33010409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 5 Nov 2020 17:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367393 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 367393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 17:10:15 -0000 Author: allanjude Date: Thu Nov 5 17:10:14 2020 New Revision: 367393 URL: https://svnweb.freebsd.org/changeset/base/367393 Log: VirtIO: Make sure the guest knows the TRIM alignment requirements If bhyve is used to emulate 512e access in guest OS, then discard addresses should be properly aligned. Otherwise ioctl DIOCGDELETE fails for 512b requires on devices with 4K sector size. see g_dev_ioctl() in sys/geom/geom_dev.c Submitted by: Vitaliy Gusev MFC after: 1 week Sponsored by: vStack.com Differential Revision: https://reviews.freebsd.org/D27075 Modified: head/usr.sbin/bhyve/pci_virtio_block.c Modified: head/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_block.c Thu Nov 5 16:47:23 2020 (r367392) +++ head/usr.sbin/bhyve/pci_virtio_block.c Thu Nov 5 17:10:14 2020 (r367393) @@ -523,7 +523,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * sc->vbsc_cfg.vbc_writeback = 0; sc->vbsc_cfg.max_discard_sectors = VTBLK_MAX_DISCARD_SECT; sc->vbsc_cfg.max_discard_seg = VTBLK_MAX_DISCARD_SEG; - sc->vbsc_cfg.discard_sector_alignment = sectsz / VTBLK_BSIZE; + sc->vbsc_cfg.discard_sector_alignment = MAX(sectsz, sts) / VTBLK_BSIZE; /* * Should we move some of this into virtio.c? Could From owner-svn-src-head@freebsd.org Thu Nov 5 18:10:04 2020 Return-Path: Delivered-To: svn-src-head@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 3F8B346D7DF; Thu, 5 Nov 2020 18:10:04 +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 4CRs4X1JlVz3F0S; Thu, 5 Nov 2020 18:10:04 +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 1FC8117F23; Thu, 5 Nov 2020 18:10:04 +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 0A5IA4n3049103; Thu, 5 Nov 2020 18:10:04 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5IA3IQ049102; Thu, 5 Nov 2020 18:10:03 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011051810.0A5IA3IQ049102@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 5 Nov 2020 18:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367394 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 367394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 18:10:04 -0000 Author: trasz Date: Thu Nov 5 18:10:03 2020 New Revision: 367394 URL: https://svnweb.freebsd.org/changeset/base/367394 Log: Remove the 'nap' field from ARM's 'struct syscall_args', to bring it in sync with (most) other architectures. No functional changes. Reviewed by: manu Tested by: mmel MFC after: 2 weeks Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D26604 Modified: head/sys/arm/arm/syscall.c head/sys/arm/include/proc.h Modified: head/sys/arm/arm/syscall.c ============================================================================== --- head/sys/arm/arm/syscall.c Thu Nov 5 17:10:14 2020 (r367393) +++ head/sys/arm/arm/syscall.c Thu Nov 5 18:10:03 2020 (r367394) @@ -102,17 +102,19 @@ cpu_fetch_syscall_args(struct thread *td) struct proc *p; register_t *ap; struct syscall_args *sa; + u_int nap; int error; + nap = 4; sa = &td->td_sa; sa->code = td->td_frame->tf_r7; ap = &td->td_frame->tf_r0; if (sa->code == SYS_syscall) { sa->code = *ap++; - sa->nap--; + nap--; } else if (sa->code == SYS___syscall) { sa->code = ap[_QUAD_LOWWORD]; - sa->nap -= 2; + nap -= 2; ap += 2; } p = td->td_proc; @@ -121,11 +123,10 @@ cpu_fetch_syscall_args(struct thread *td) else sa->callp = &p->p_sysent->sv_table[sa->code]; error = 0; - memcpy(sa->args, ap, sa->nap * sizeof(register_t)); - if (sa->callp->sy_narg > sa->nap) { + memcpy(sa->args, ap, nap * sizeof(register_t)); + if (sa->callp->sy_narg > nap) { error = copyin((void *)td->td_frame->tf_usr_sp, sa->args + - sa->nap, (sa->callp->sy_narg - sa->nap) * - sizeof(register_t)); + nap, (sa->callp->sy_narg - nap) * sizeof(register_t)); } if (error == 0) { td->td_retval[0] = 0; @@ -140,7 +141,6 @@ static void syscall(struct thread *td, struct trapframe *frame) { - td->td_sa.nap = 4; syscallenter(td); syscallret(td); } Modified: head/sys/arm/include/proc.h ============================================================================== --- head/sys/arm/include/proc.h Thu Nov 5 17:10:14 2020 (r367393) +++ head/sys/arm/include/proc.h Thu Nov 5 18:10:03 2020 (r367394) @@ -82,7 +82,6 @@ struct syscall_args { u_int code; struct sysent *callp; register_t args[MAXARGS]; - u_int nap; } __aligned(8); #endif /* !_MACHINE_PROC_H_ */ From owner-svn-src-head@freebsd.org Thu Nov 5 19:30:33 2020 Return-Path: Delivered-To: svn-src-head@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 F03C946F1AB; Thu, 5 Nov 2020 19:30:33 +0000 (UTC) (envelope-from cem@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 4CRtsP6TVXz3Jjd; Thu, 5 Nov 2020 19:30:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D0EBF18AD2; Thu, 5 Nov 2020 19:30:33 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5JUXwD097194; Thu, 5 Nov 2020 19:30:33 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5JUVV3096332; Thu, 5 Nov 2020 19:30:31 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011051930.0A5JUVV3096332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 5 Nov 2020 19:30:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367395 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux conf i386/linux modules/linux modules/linux64 modules/linux_common x86/linux X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/linux conf i386/linux modules/linux modules/linux64 modules/linux_common x86/linux X-SVN-Commit-Revision: 367395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 19:30:34 -0000 Author: cem Date: Thu Nov 5 19:30:31 2020 New Revision: 367395 URL: https://svnweb.freebsd.org/changeset/base/367395 Log: linux(4): Deduplicate unimpl/dummy syscall handlers No functional change. Reviewed by: emaste, trasz Differential Revision: https://reviews.freebsd.org/D27099 Added: head/sys/amd64/linux/linux_dummy_machdep.c - copied, changed from r367394, head/sys/amd64/linux/linux_dummy.c head/sys/arm64/linux/linux_dummy_machdep.c - copied, changed from r367394, head/sys/arm64/linux/linux_dummy.c head/sys/compat/linux/linux_dummy.c - copied, changed from r367393, head/sys/arm64/linux/linux_dummy.c head/sys/i386/linux/linux_dummy_machdep.c - copied, changed from r367394, head/sys/i386/linux/linux_dummy.c head/sys/x86/linux/ head/sys/x86/linux/linux_dummy_x86.c (contents, props changed) - copied, changed from r367393, head/sys/amd64/linux/linux_dummy.c Deleted: head/sys/amd64/linux/linux_dummy.c head/sys/arm64/linux/linux_dummy.c head/sys/i386/linux/linux_dummy.c Modified: head/sys/amd64/linux32/linux32_dummy.c head/sys/conf/files.amd64 head/sys/conf/files.i386 head/sys/modules/linux/Makefile head/sys/modules/linux64/Makefile head/sys/modules/linux_common/Makefile Copied and modified: head/sys/amd64/linux/linux_dummy_machdep.c (from r367394, head/sys/amd64/linux/linux_dummy.c) ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Thu Nov 5 18:10:03 2020 (r367394, copy source) +++ head/sys/amd64/linux/linux_dummy_machdep.c Thu Nov 5 19:30:31 2020 (r367395) @@ -43,146 +43,32 @@ __FBSDID("$FreeBSD$"); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(epoll_ctl_old); -UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c (or + * sys/x86/linux/linux_dummy_x86.c). + */ + UNIMPLEMENTED(get_thread_area); -UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ -UNIMPLEMENTED(tuxcall); -UNIMPLEMENTED(security); UNIMPLEMENTED(set_thread_area); UNIMPLEMENTED(uselib); -UNIMPLEMENTED(vserver); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(sysfs); -DUMMY(vhangup); DUMMY(modify_ldt); -DUMMY(pivot_root); -DUMMY(adjtimex); -DUMMY(swapoff); -DUMMY(init_module); + DUMMY(ioperm); -DUMMY(delete_module); -DUMMY(quotactl); -DUMMY(readahead); DUMMY(io_setup); DUMMY(io_destroy); DUMMY(io_getevents); DUMMY(io_submit); DUMMY(io_cancel); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(restart_syscall); -DUMMY(semtimedop); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); DUMMY(mq_open); DUMMY(mq_unlink); DUMMY(mq_timedsend); DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); +DUMMY(readahead); +DUMMY(restart_syscall); +DUMMY(semtimedop); /* Linux 3.15: */ DUMMY(kexec_file_load); -/* Linux 3.17: */ -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); -/* Linux 4.11: */ -DUMMY(statx); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); -/* Linux 5.0: */ -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); Modified: head/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- head/sys/amd64/linux32/linux32_dummy.c Thu Nov 5 18:10:03 2020 (r367394) +++ head/sys/amd64/linux32/linux32_dummy.c Thu Nov 5 19:30:31 2020 (r367395) @@ -43,119 +43,29 @@ __FBSDID("$FreeBSD$"); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); UNIMPLEMENTED(break); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(ftime); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); UNIMPLEMENTED(mpx); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(prof); UNIMPLEMENTED(profil); -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(ulimit); -UNIMPLEMENTED(vserver); DUMMY(stime); DUMMY(olduname); DUMMY(uname); -DUMMY(vhangup); -DUMMY(swapoff); -DUMMY(adjtimex); -DUMMY(init_module); -DUMMY(delete_module); -DUMMY(quotactl); DUMMY(bdflush); -DUMMY(sysfs); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(pivot_root); DUMMY(ptrace); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); DUMMY(mq_open); DUMMY(mq_unlink); DUMMY(mq_timedsend); DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.17: */ -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); /* Linux 4.11: */ -DUMMY(statx); DUMMY(arch_prctl); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); /* Linux 5.0: */ DUMMY(clock_gettime64); DUMMY(clock_settime64); @@ -177,28 +87,3 @@ DUMMY(semtimedop_time64); DUMMY(rt_sigtimedwait_time64); DUMMY(futex_time64); DUMMY(sched_rr_get_interval_time64); -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); Copied and modified: head/sys/arm64/linux/linux_dummy_machdep.c (from r367394, head/sys/arm64/linux/linux_dummy.c) ============================================================================== --- head/sys/arm64/linux/linux_dummy.c Thu Nov 5 18:10:03 2020 (r367394, copy source) +++ head/sys/arm64/linux/linux_dummy_machdep.c Thu Nov 5 19:30:31 2020 (r367395) @@ -42,126 +42,22 @@ __FBSDID("$FreeBSD$"); #include #include -// LINUXTODO: deduplicate arm64 dummy against other archs? -// LINUXTODO: review/update/add unimplemented syscalls - /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(epoll_ctl_old); -UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c. + */ + UNIMPLEMENTED(get_thread_area); -UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ -UNIMPLEMENTED(security); UNIMPLEMENTED(set_thread_area); -UNIMPLEMENTED(tuxcall); UNIMPLEMENTED(uselib); -UNIMPLEMENTED(vserver); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(vhangup); -DUMMY(pivot_root); -DUMMY(adjtimex); -DUMMY(swapoff); -DUMMY(init_module); -DUMMY(delete_module); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(semtimedop); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); DUMMY(mq_open); DUMMY(mq_unlink); DUMMY(mq_timedsend); DUMMY(mq_timedreceive); DUMMY(mq_notify); DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.17: */ -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); +DUMMY(semtimedop); Copied and modified: head/sys/compat/linux/linux_dummy.c (from r367393, head/sys/arm64/linux/linux_dummy.c) ============================================================================== --- head/sys/arm64/linux/linux_dummy.c Thu Nov 5 17:10:14 2020 (r367393, copy source) +++ head/sys/compat/linux/linux_dummy.c Thu Nov 5 19:30:31 2020 (r367395) @@ -37,14 +37,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include +#ifdef COMPAT_LINUX32 +#include +#include +#else +#include +#include +#endif + #include #include -// LINUXTODO: deduplicate arm64 dummy against other archs? -// LINUXTODO: review/update/add unimplemented syscalls - /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); @@ -53,15 +56,11 @@ UNIMPLEMENTED(create_module); /* Added in Linux 1.0 re UNIMPLEMENTED(epoll_ctl_old); UNIMPLEMENTED(epoll_wait_old); UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(get_thread_area); UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(putpmsg); UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(security); -UNIMPLEMENTED(set_thread_area); -UNIMPLEMENTED(tuxcall); -UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); DUMMY(setfsuid); @@ -74,16 +73,9 @@ DUMMY(init_module); DUMMY(delete_module); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); -DUMMY(semtimedop); DUMMY(mbind); DUMMY(get_mempolicy); DUMMY(set_mempolicy); -DUMMY(mq_open); -DUMMY(mq_unlink); -DUMMY(mq_timedsend); -DUMMY(mq_timedreceive); -DUMMY(mq_notify); -DUMMY(mq_getsetattr); DUMMY(kexec_load); /* Linux 2.6.11: */ DUMMY(add_key); Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Thu Nov 5 18:10:03 2020 (r367394) +++ head/sys/conf/files.amd64 Thu Nov 5 19:30:31 2020 (r367395) @@ -412,6 +412,7 @@ amd64/linux32/linux32_support.s optional compat_linux3 dependency "linux32_assym.h" amd64/linux32/linux32_sysent.c optional compat_linux32 amd64/linux32/linux32_sysvec.c optional compat_linux32 +compat/linux/linux_dummy.c optional compat_linux32 compat/linux/linux_emul.c optional compat_linux32 compat/linux/linux_errno.c optional compat_linux32 compat/linux/linux_file.c optional compat_linux32 @@ -435,6 +436,7 @@ compat/linux/linux_vdso.c optional compat_linux32 compat/linux/linux_common.c optional compat_linux32 compat/linux/linux_event.c optional compat_linux32 compat/linux/linux.c optional compat_linux32 +x86/linux/linux_dummy_x86.c optional compat_linux32 dev/amr/amr_linux.c optional compat_linux32 amr dev/mfi/mfi_linux.c optional compat_linux32 mfi compat/ndis/winx64_wrap.S optional ndisapi pci Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Thu Nov 5 18:10:03 2020 (r367394) +++ head/sys/conf/files.i386 Thu Nov 5 19:30:31 2020 (r367395) @@ -52,6 +52,7 @@ cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace co cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs +compat/linux/linux_dummy.c optional compat_linux compat/linux/linux_event.c optional compat_linux compat/linux/linux_emul.c optional compat_linux compat/linux/linux_errno.c optional compat_linux @@ -200,7 +201,7 @@ i386/i386/vm86.c standard i386/i386/vm_machdep.c standard i386/linux/imgact_linux.c optional compat_linux i386/linux/linux_copyout.c optional compat_linux -i386/linux/linux_dummy.c optional compat_linux +i386/linux/linux_dummy_machdep.c optional compat_linux i386/linux/linux_machdep.c optional compat_linux i386/linux/linux_ptrace.c optional compat_linux i386/linux/linux_sysent.c optional compat_linux @@ -240,6 +241,7 @@ x86/isa/atpic.c optional atpic x86/isa/elcr.c optional atpic | apic x86/isa/isa.c optional isa x86/isa/isa_dma.c optional isa +x86/linux/linux_dummy_x86.c optional compat_linux x86/x86/io_apic.c optional apic x86/x86/local_apic.c optional apic x86/x86/mptable.c optional apic Copied and modified: head/sys/i386/linux/linux_dummy_machdep.c (from r367394, head/sys/i386/linux/linux_dummy.c) ============================================================================== --- head/sys/i386/linux/linux_dummy.c Thu Nov 5 18:10:03 2020 (r367394, copy source) +++ head/sys/i386/linux/linux_dummy_machdep.c Thu Nov 5 19:30:31 2020 (r367395) @@ -43,115 +43,31 @@ __FBSDID("$FreeBSD$"); /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); +/* + * Before adding new stubs to this file, please check if a stub can be added to + * the machine-independent code in sys/compat/linux/linux_dummy.c (or + * sys/x86/linux/linux_dummy_x86.c). + */ + UNIMPLEMENTED(break); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ UNIMPLEMENTED(ftime); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(getpmsg); UNIMPLEMENTED(gtty); UNIMPLEMENTED(stty); UNIMPLEMENTED(lock); UNIMPLEMENTED(mpx); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ UNIMPLEMENTED(prof); UNIMPLEMENTED(profil); -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ UNIMPLEMENTED(ulimit); -UNIMPLEMENTED(vserver); -DUMMY(stime); +DUMMY(bdflush); DUMMY(fstat); DUMMY(olduname); +DUMMY(stime); DUMMY(uname); -DUMMY(vhangup); -DUMMY(vm86old); -DUMMY(swapoff); -DUMMY(adjtimex); -DUMMY(init_module); -DUMMY(delete_module); -DUMMY(quotactl); -DUMMY(bdflush); -DUMMY(sysfs); DUMMY(vm86); -DUMMY(setfsuid); -DUMMY(setfsgid); -DUMMY(pivot_root); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); -/* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); -DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); -/* Linux 2.6.22: */ -DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.17: */ -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); +DUMMY(vm86old); /* Linux 4.11: */ -DUMMY(statx); DUMMY(arch_prctl); -/* Linux 4.18: */ -DUMMY(io_pgetevents); -DUMMY(rseq); /* Linux 5.0: */ DUMMY(clock_gettime64); DUMMY(clock_settime64); @@ -173,28 +89,3 @@ DUMMY(semtimedop_time64); DUMMY(rt_sigtimedwait_time64); DUMMY(futex_time64); DUMMY(sched_rr_get_interval_time64); -DUMMY(pidfd_send_signal); -DUMMY(io_uring_setup); -DUMMY(io_uring_enter); -DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Thu Nov 5 18:10:03 2020 (r367394) +++ head/sys/modules/linux/Makefile Thu Nov 5 19:30:31 2020 (r367395) @@ -6,6 +6,9 @@ CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 .endif .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE_CPUARCH}/linux${SFX} +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.PATH: ${SRCTOP}/sys/x86/linux +.endif VDSO= linux${SFX}_vdso @@ -18,6 +21,9 @@ SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c li linux_timer.c linux_vdso.c \ opt_inet6.h opt_compat.h opt_posix.h opt_usb.h vnode_if.h \ device_if.h bus_if.h +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +SRCS+= linux_dummy_x86.c +.endif .if ${MACHINE_CPUARCH} == "amd64" SRCS+= linux${SFX}_support.s .else Modified: head/sys/modules/linux64/Makefile ============================================================================== --- head/sys/modules/linux64/Makefile Thu Nov 5 18:10:03 2020 (r367394) +++ head/sys/modules/linux64/Makefile Thu Nov 5 19:30:31 2020 (r367395) @@ -1,11 +1,14 @@ # $FreeBSD$ .PATH: ${SRCTOP}/sys/compat/linux ${SRCTOP}/sys/${MACHINE}/linux +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +.PATH: ${SRCTOP}/sys/x86/linux +.endif VDSO= linux_vdso KMOD= linux64 -SRCS= linux_fork.c linux_dummy.c linux_file.c linux_event.c \ +SRCS= linux_fork.c linux_dummy_machdep.c linux_file.c linux_event.c \ linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \ linux_machdep.c linux_misc.c linux_ptrace.c linux_signal.c \ linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \ @@ -13,6 +16,9 @@ SRCS= linux_fork.c linux_dummy.c linux_file.c linux_ev opt_compat.h opt_inet6.h opt_posix.h opt_usb.h \ vnode_if.h device_if.h bus_if.h \ linux_support.s +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +SRCS+= linux_dummy_x86.c +.endif DPSRCS= assym.inc linux_genassym.c # XXX: for assym.inc Modified: head/sys/modules/linux_common/Makefile ============================================================================== --- head/sys/modules/linux_common/Makefile Thu Nov 5 18:10:03 2020 (r367394) +++ head/sys/modules/linux_common/Makefile Thu Nov 5 19:30:31 2020 (r367395) @@ -4,7 +4,7 @@ KMOD= linux_common SRCS= linux_common.c linux_mib.c linux_mmap.c linux_util.c linux_emul.c \ - linux_errno.c \ + linux_dummy.c linux_errno.c \ linux.c device_if.h vnode_if.h bus_if.h opt_inet6.h EXPORT_SYMS= Copied and modified: head/sys/x86/linux/linux_dummy_x86.c (from r367393, head/sys/amd64/linux/linux_dummy.c) ============================================================================== --- head/sys/amd64/linux/linux_dummy.c Thu Nov 5 17:10:14 2020 (r367393, copy source) +++ head/sys/x86/linux/linux_dummy_x86.c Thu Nov 5 19:30:31 2020 (r367395) @@ -29,132 +29,34 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include #include #include -#include -#include +#ifdef COMPAT_LINUX32 +#include +#include +#else +#include +#include +#endif + #include #include /* DTrace init */ LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); -UNIMPLEMENTED(afs_syscall); -UNIMPLEMENTED(create_module); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(epoll_ctl_old); -UNIMPLEMENTED(epoll_wait_old); -UNIMPLEMENTED(get_kernel_syms); /* Added in Linux 1.0 removed in 2.6. */ -UNIMPLEMENTED(get_thread_area); -UNIMPLEMENTED(getpmsg); -UNIMPLEMENTED(nfsservctl); /* Added in Linux 2.2 removed in 3.1. */ -UNIMPLEMENTED(putpmsg); -UNIMPLEMENTED(query_module); /* Added in Linux 2.2 removed in 2.6. */ -UNIMPLEMENTED(tuxcall); -UNIMPLEMENTED(security); -UNIMPLEMENTED(set_thread_area); -UNIMPLEMENTED(uselib); -UNIMPLEMENTED(vserver); - -DUMMY(setfsuid); -DUMMY(setfsgid); DUMMY(sysfs); -DUMMY(vhangup); -DUMMY(modify_ldt); -DUMMY(pivot_root); -DUMMY(adjtimex); -DUMMY(swapoff); -DUMMY(init_module); -DUMMY(ioperm); -DUMMY(delete_module); DUMMY(quotactl); -DUMMY(readahead); -DUMMY(io_setup); -DUMMY(io_destroy); -DUMMY(io_getevents); -DUMMY(io_submit); -DUMMY(io_cancel); -DUMMY(lookup_dcookie); -DUMMY(remap_file_pages); -DUMMY(restart_syscall); -DUMMY(semtimedop); -DUMMY(mbind); -DUMMY(get_mempolicy); -DUMMY(set_mempolicy); -DUMMY(mq_open); -DUMMY(mq_unlink); -DUMMY(mq_timedsend); -DUMMY(mq_timedreceive); -DUMMY(mq_notify); -DUMMY(mq_getsetattr); -DUMMY(kexec_load); -/* Linux 2.6.11: */ -DUMMY(add_key); -DUMMY(request_key); -DUMMY(keyctl); /* Linux 2.6.13: */ -DUMMY(ioprio_set); -DUMMY(ioprio_get); DUMMY(inotify_init); -DUMMY(inotify_add_watch); -DUMMY(inotify_rm_watch); -/* Linux 2.6.16: */ -DUMMY(migrate_pages); -DUMMY(unshare); -/* Linux 2.6.17: */ -DUMMY(tee); -DUMMY(vmsplice); -/* Linux 2.6.18: */ -DUMMY(move_pages); /* Linux 2.6.22: */ DUMMY(signalfd); -/* Linux 2.6.27: */ -DUMMY(signalfd4); -DUMMY(inotify_init1); -/* Linux 2.6.31: */ -DUMMY(perf_event_open); -/* Linux 2.6.36: */ -DUMMY(fanotify_init); -DUMMY(fanotify_mark); -/* Linux 2.6.39: */ -DUMMY(name_to_handle_at); -DUMMY(open_by_handle_at); -DUMMY(clock_adjtime); -/* Linux 3.0: */ -DUMMY(setns); -/* Linux 3.2: */ -DUMMY(process_vm_readv); -DUMMY(process_vm_writev); -/* Linux 3.5: */ -DUMMY(kcmp); -/* Linux 3.8: */ -DUMMY(finit_module); -DUMMY(sched_setattr); -DUMMY(sched_getattr); -/* Linux 3.15: */ -DUMMY(kexec_file_load); -/* Linux 3.17: */ -DUMMY(seccomp); -/* Linux 3.18: */ -DUMMY(bpf); -/* Linux 3.19: */ -DUMMY(execveat); -/* Linux 4.2: */ -DUMMY(userfaultfd); -/* Linux 4.3: */ -DUMMY(membarrier); -/* Linux 4.4: */ -DUMMY(mlock2); -/* Linux 4.6: */ -DUMMY(preadv2); -DUMMY(pwritev2); -/* Linux 4.8: */ -DUMMY(pkey_mprotect); -DUMMY(pkey_alloc); -DUMMY(pkey_free); /* Linux 4.11: */ DUMMY(statx); /* Linux 4.18: */ @@ -165,24 +67,3 @@ DUMMY(pidfd_send_signal); DUMMY(io_uring_setup); DUMMY(io_uring_enter); DUMMY(io_uring_register); - -#define DUMMY_XATTR(s) \ -int \ -linux_ ## s ## xattr( \ - struct thread *td, struct linux_ ## s ## xattr_args *arg) \ -{ \ - \ - return (EOPNOTSUPP); \ -} -DUMMY_XATTR(set); -DUMMY_XATTR(lset); -DUMMY_XATTR(fset); -DUMMY_XATTR(get); -DUMMY_XATTR(lget); -DUMMY_XATTR(fget); -DUMMY_XATTR(list); -DUMMY_XATTR(llist); -DUMMY_XATTR(flist); -DUMMY_XATTR(remove); -DUMMY_XATTR(lremove); -DUMMY_XATTR(fremove); From owner-svn-src-head@freebsd.org Thu Nov 5 20:18:01 2020 Return-Path: Delivered-To: svn-src-head@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 0DA0B2D013C; Thu, 5 Nov 2020 20:18:01 +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 4CRvw86zdVz3MFC; Thu, 5 Nov 2020 20:18:00 +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 E28B519629; Thu, 5 Nov 2020 20:18:00 +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 0A5KI0nG025464; Thu, 5 Nov 2020 20:18:00 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5KI0O2025463; Thu, 5 Nov 2020 20:18:00 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011052018.0A5KI0O2025463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Thu, 5 Nov 2020 20:18:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367397 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 367397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 20:18:01 -0000 Author: luporl Date: Thu Nov 5 20:18:00 2020 New Revision: 367397 URL: https://svnweb.freebsd.org/changeset/base/367397 Log: Fix powerpc and powerpcspe builds This change fixes 32-bit PowerPC builds, that r367390 broke (shift count >= width of type). Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Thu Nov 5 19:37:56 2020 (r367396) +++ head/sys/powerpc/include/spr.h Thu Nov 5 20:18:00 2020 (r367397) @@ -492,13 +492,13 @@ #define SPR_MMCR2 0x311 #define SPR_MMCR2_CNBIT(n, bit) ((bit) << (((5 - (n)) * 9) + 10)) -#define SPR_MMCR2_FCNS(n) SPR_MMCR2_CNBIT(n, 0x100UL) -#define SPR_MMCR2_FCNP0(n) SPR_MMCR2_CNBIT(n, 0x080UL) -#define SPR_MMCR2_FCNP1(n) SPR_MMCR2_CNBIT(n, 0x040UL) -#define SPR_MMCR2_FCNM1(n) SPR_MMCR2_CNBIT(n, 0x020UL) -#define SPR_MMCR2_FCNM0(n) SPR_MMCR2_CNBIT(n, 0x010UL) -#define SPR_MMCR2_FCNWAIT(n) SPR_MMCR2_CNBIT(n, 0x008UL) -#define SPR_MMCR2_FCNH(n) SPR_MMCR2_CNBIT(n, 0x004UL) +#define SPR_MMCR2_FCNS(n) SPR_MMCR2_CNBIT(n, 0x100ULL) +#define SPR_MMCR2_FCNP0(n) SPR_MMCR2_CNBIT(n, 0x080ULL) +#define SPR_MMCR2_FCNP1(n) SPR_MMCR2_CNBIT(n, 0x040ULL) +#define SPR_MMCR2_FCNM1(n) SPR_MMCR2_CNBIT(n, 0x020ULL) +#define SPR_MMCR2_FCNM0(n) SPR_MMCR2_CNBIT(n, 0x010ULL) +#define SPR_MMCR2_FCNWAIT(n) SPR_MMCR2_CNBIT(n, 0x008ULL) +#define SPR_MMCR2_FCNH(n) SPR_MMCR2_CNBIT(n, 0x004ULL) /* Freeze Counter N in Hypervisor/Supervisor/Problem states */ #define SPR_MMCR2_FCNHSP(n) \ (SPR_MMCR2_FCNS(n) | SPR_MMCR2_FCNP0(n) | \ From owner-svn-src-head@freebsd.org Thu Nov 5 20:52:51 2020 Return-Path: Delivered-To: svn-src-head@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 2FC272D0F89; Thu, 5 Nov 2020 20:52:51 +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 4CRwhM0gbjz3P9Z; Thu, 5 Nov 2020 20:52:51 +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 07E1E19AF0; Thu, 5 Nov 2020 20:52:51 +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 0A5Kqocs050367; Thu, 5 Nov 2020 20:52:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5KqoXi050364; Thu, 5 Nov 2020 20:52:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011052052.0A5KqoXi050364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 5 Nov 2020 20:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367398 - in head/sys: dev/acpica dev/xen/control kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: dev/acpica dev/xen/control kern sys X-SVN-Commit-Revision: 367398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 20:52:51 -0000 Author: kib Date: Thu Nov 5 20:52:49 2020 New Revision: 367398 URL: https://svnweb.freebsd.org/changeset/base/367398 Log: Suspend all writeable local filesystems on power suspend. This ensures that no writes are pending in memory, either metadata or user data, but not including dirty pages not yet converted to fs writes. Only filesystems declared local are suspended. Note that this does not guarantee absence of the metadata errors or leaks if resume is not done: for instance, on UFS unlinked but opened inodes are leaked and require fsck to gc. Reviewed by: markj Discussed with: imp Tested by: imp (previous version), pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D27054 Modified: head/sys/dev/acpica/acpi.c head/sys/dev/xen/control/control.c head/sys/kern/vfs_mount.c head/sys/sys/mount.h Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Thu Nov 5 20:18:00 2020 (r367397) +++ head/sys/dev/acpica/acpi.c Thu Nov 5 20:52:49 2020 (r367398) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -3081,6 +3082,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, int state) EVENTHANDLER_INVOKE(power_suspend_early); stop_all_proc(); + suspend_all_fs(); EVENTHANDLER_INVOKE(power_suspend); #ifdef EARLY_AP_STARTUP @@ -3240,6 +3242,7 @@ backout: } #endif + resume_all_fs(); resume_all_proc(); EVENTHANDLER_INVOKE(power_resume); Modified: head/sys/dev/xen/control/control.c ============================================================================== --- head/sys/dev/xen/control/control.c Thu Nov 5 20:18:00 2020 (r367397) +++ head/sys/dev/xen/control/control.c Thu Nov 5 20:52:49 2020 (r367398) @@ -113,6 +113,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -204,6 +205,7 @@ xctrl_suspend() xs_lock(); stop_all_proc(); xs_unlock(); + suspend_all_fs(); EVENTHANDLER_INVOKE(power_suspend); #ifdef EARLY_AP_STARTUP @@ -317,6 +319,7 @@ xctrl_suspend() } #endif + resume_all_fs(); resume_all_proc(); EVENTHANDLER_INVOKE(power_resume); Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Nov 5 20:18:00 2020 (r367397) +++ head/sys/kern/vfs_mount.c Thu Nov 5 20:52:49 2020 (r367398) @@ -2507,3 +2507,67 @@ mount_devctl_event(const char *type, struct mount *mp, sbuf_delete(&sb); free(buf, M_MOUNT); } + +/* + * Suspend write operations on all local writeable filesystems. Does + * full sync of them in the process. + * + * Iterate over the mount points in reverse order, suspending most + * recently mounted filesystems first. It handles a case where a + * filesystem mounted from a md(4) vnode-backed device should be + * suspended before the filesystem that owns the vnode. + */ +void +suspend_all_fs(void) +{ + struct mount *mp; + int error; + + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH_REVERSE(mp, &mountlist, mntlist, mnt_list) { + error = vfs_busy(mp, MBF_MNTLSTLOCK | MBF_NOWAIT); + if (error != 0) + continue; + if ((mp->mnt_flag & (MNT_RDONLY | MNT_LOCAL)) != MNT_LOCAL || + (mp->mnt_kern_flag & MNTK_SUSPEND) != 0) { + mtx_lock(&mountlist_mtx); + vfs_unbusy(mp); + continue; + } + error = vfs_write_suspend(mp, 0); + if (error == 0) { + MNT_ILOCK(mp); + MPASS((mp->mnt_kern_flag & MNTK_SUSPEND_ALL) == 0); + mp->mnt_kern_flag |= MNTK_SUSPEND_ALL; + MNT_IUNLOCK(mp); + mtx_lock(&mountlist_mtx); + } else { + printf("suspend of %s failed, error %d\n", + mp->mnt_stat.f_mntonname, error); + mtx_lock(&mountlist_mtx); + vfs_unbusy(mp); + } + } + mtx_unlock(&mountlist_mtx); +} + +void +resume_all_fs(void) +{ + struct mount *mp; + + mtx_lock(&mountlist_mtx); + TAILQ_FOREACH(mp, &mountlist, mnt_list) { + if ((mp->mnt_kern_flag & MNTK_SUSPEND_ALL) == 0) + continue; + mtx_unlock(&mountlist_mtx); + MNT_ILOCK(mp); + MPASS((mp->mnt_kern_flag & MNTK_SUSPEND) != 0); + mp->mnt_kern_flag &= ~MNTK_SUSPEND_ALL; + MNT_IUNLOCK(mp); + vfs_write_resume(mp, 0); + mtx_lock(&mountlist_mtx); + vfs_unbusy(mp); + } + mtx_unlock(&mountlist_mtx); +} Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Thu Nov 5 20:18:00 2020 (r367397) +++ head/sys/sys/mount.h Thu Nov 5 20:52:49 2020 (r367398) @@ -463,6 +463,7 @@ struct mntoptnames { #define MNTK_VMSETSIZE_BUG 0x00010000 #define MNTK_UNIONFS 0x00020000 /* A hack for F_ISUNIONSTACK */ #define MNTK_FPLOOKUP 0x00040000 /* fast path lookup is supported */ +#define MNTK_SUSPEND_ALL 0x00080000 /* Suspended by all-fs suspension */ #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ @@ -1047,6 +1048,9 @@ void vfs_dump_mount_counters(struct mount *); enum mount_counter { MNT_COUNT_REF, MNT_COUNT_LOCKREF, MNT_COUNT_WRITEOPCOUNT }; int vfs_mount_fetch_counter(struct mount *, enum mount_counter); + +void suspend_all_fs(void); +void resume_all_fs(void); /* * Code transitioning mnt_vfs_ops to > 0 issues IPIs until it observes From owner-svn-src-head@freebsd.org Thu Nov 5 21:37:24 2020 Return-Path: Delivered-To: svn-src-head@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 DCC392D1365; Thu, 5 Nov 2020 21:37:24 +0000 (UTC) (envelope-from ngie@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 4CRxgm5Wvcz3QlB; Thu, 5 Nov 2020 21:37:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABF911A441; Thu, 5 Nov 2020 21:37:24 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5LbOZM075130; Thu, 5 Nov 2020 21:37:24 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5LbOOM075129; Thu, 5 Nov 2020 21:37:24 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <202011052137.0A5LbOOM075129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 5 Nov 2020 21:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367399 - head/contrib/bsnmp/snmpd X-SVN-Group: head X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: head/contrib/bsnmp/snmpd X-SVN-Commit-Revision: 367399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 21:37:24 -0000 Author: ngie Date: Thu Nov 5 21:37:24 2020 New Revision: 367399 URL: https://svnweb.freebsd.org/changeset/base/367399 Log: snmpmod(3): fix typo under the COMMUNITIES section "recipte" should be spelled like "receipt". .Dd is intentionally not being bumped for the change. MFC after: 1 week Sponsored by: DellEMC Modified: head/contrib/bsnmp/snmpd/snmpmod.3 Modified: head/contrib/bsnmp/snmpd/snmpmod.3 ============================================================================== --- head/contrib/bsnmp/snmpd/snmpmod.3 Thu Nov 5 20:52:49 2020 (r367398) +++ head/contrib/bsnmp/snmpd/snmpmod.3 Thu Nov 5 21:37:24 2020 (r367399) @@ -577,7 +577,7 @@ struct systemg { .Ed .Ss COMMUNITIES The SNMP daemon implements a community table. -On recipte of a request message +On receipt of a request message the community string in that message is compared to each of the community strings in that table, if a match is found, the global variable .Va community From owner-svn-src-head@freebsd.org Thu Nov 5 21:44:58 2020 Return-Path: Delivered-To: svn-src-head@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 CB6672D1A42; Thu, 5 Nov 2020 21:44:58 +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 4CRxrV5Mm4z3hB2; Thu, 5 Nov 2020 21:44:58 +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 AB0001A6D8; Thu, 5 Nov 2020 21:44:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5Liw3m080895; Thu, 5 Nov 2020 21:44:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5LiwjJ080893; Thu, 5 Nov 2020 21:44:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011052144.0A5LiwjJ080893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Nov 2020 21:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367400 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 367400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 21:44:58 -0000 Author: mjg Date: Thu Nov 5 21:44:58 2020 New Revision: 367400 URL: https://svnweb.freebsd.org/changeset/base/367400 Log: nvme: change namei_request_zone into a malloc type Both the size (128 bytes) and ephemeral nature of allocations make it a great fit for malloc. A dedicated zone unnecessarily avoids sharing buckets with 128-byte objects. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D27103 Modified: head/sys/dev/nvme/nvme.c head/sys/dev/nvme/nvme_private.h Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Thu Nov 5 21:37:24 2020 (r367399) +++ head/sys/dev/nvme/nvme.c Thu Nov 5 21:44:58 2020 (r367400) @@ -49,7 +49,6 @@ struct nvme_consumer { struct nvme_consumer nvme_consumer[NVME_MAX_CONSUMERS]; #define INVALID_CONSUMER_ID 0xFFFF -uma_zone_t nvme_request_zone; int32_t nvme_retry_count; MALLOC_DEFINE(M_NVME, "nvme", "nvme(4) memory allocations"); @@ -61,9 +60,6 @@ nvme_init(void) { uint32_t i; - nvme_request_zone = uma_zcreate("nvme_request", - sizeof(struct nvme_request), NULL, NULL, NULL, NULL, 0, 0); - for (i = 0; i < NVME_MAX_CONSUMERS; i++) nvme_consumer[i].id = INVALID_CONSUMER_ID; } @@ -73,7 +69,6 @@ SYSINIT(nvme_register, SI_SUB_DRIVERS, SI_ORDER_SECOND static void nvme_uninit(void) { - uma_zdestroy(nvme_request_zone); } SYSUNINIT(nvme_unregister, SI_SUB_DRIVERS, SI_ORDER_SECOND, nvme_uninit, NULL); Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Thu Nov 5 21:37:24 2020 (r367399) +++ head/sys/dev/nvme/nvme_private.h Thu Nov 5 21:44:58 2020 (r367400) @@ -113,7 +113,6 @@ MALLOC_DECLARE(M_NVME); #define CACHE_LINE_SIZE (64) #endif -extern uma_zone_t nvme_request_zone; extern int32_t nvme_retry_count; extern bool nvme_verbose_cmd_dump; @@ -489,7 +488,7 @@ _nvme_allocate_request(nvme_cb_fn_t cb_fn, void *cb_ar { struct nvme_request *req; - req = uma_zalloc(nvme_request_zone, M_NOWAIT | M_ZERO); + req = malloc(sizeof(*req), M_NVME, M_NOWAIT | M_ZERO); if (req != NULL) { req->cb_fn = cb_fn; req->cb_arg = cb_arg; @@ -551,7 +550,7 @@ nvme_allocate_request_ccb(union ccb *ccb, nvme_cb_fn_t return (req); } -#define nvme_free_request(req) uma_zfree(nvme_request_zone, req) +#define nvme_free_request(req) free(req, M_NVME) void nvme_notify_async_consumers(struct nvme_controller *ctrlr, const struct nvme_completion *async_cpl, From owner-svn-src-head@freebsd.org Thu Nov 5 23:26:02 2020 Return-Path: Delivered-To: svn-src-head@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 B76482D35F6; Thu, 5 Nov 2020 23:26:02 +0000 (UTC) (envelope-from jhb@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 4CS0564rSDz3mcm; Thu, 5 Nov 2020 23:26:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E8EC1BA9E; Thu, 5 Nov 2020 23:26:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5NQ2J7043505; Thu, 5 Nov 2020 23:26:02 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5NQ2mD043504; Thu, 5 Nov 2020 23:26:02 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011052326.0A5NQ2mD043504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Nov 2020 23:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367403 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 23:26:02 -0000 Author: jhb Date: Thu Nov 5 23:26:02 2020 New Revision: 367403 URL: https://svnweb.freebsd.org/changeset/base/367403 Log: Don't modify the destination pointer in ioctl requests. This breaks the case where the original pointer was NULL but an in-line IV was used. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27064 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Thu Nov 5 22:41:54 2020 (r367402) +++ head/sys/opencrypto/cryptodev.c Thu Nov 5 23:26:02 2020 (r367403) @@ -381,7 +381,7 @@ static struct csession *csecreate(struct fcrypt *, cry struct auth_hash *, void *); static void csefree(struct csession *); -static int cryptodev_op(struct csession *, struct crypt_op *, +static int cryptodev_op(struct csession *, const struct crypt_op *, struct ucred *, struct thread *td); static int cryptodev_aead(struct csession *, struct crypt_aead *, struct ucred *, struct thread *); @@ -942,12 +942,13 @@ cod_free(struct cryptop_data *cod) static int cryptodev_op( struct csession *cse, - struct crypt_op *cop, + const struct crypt_op *cop, struct ucred *active_cred, struct thread *td) { struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; + char *dst; int error; if (cop->len > 256*1024-4) { @@ -980,6 +981,7 @@ cryptodev_op( } cod = cod_alloc(cse, 0, cop->len + cse->hashsize, td); + dst = cop->dst; crp = crypto_getreq(cse->cses, M_WAITOK); @@ -1082,7 +1084,7 @@ cryptodev_op( crp->crp_iv_start = 0; crp->crp_payload_start += cse->ivsize; crp->crp_payload_length -= cse->ivsize; - cop->dst += cse->ivsize; + dst += cse->ivsize; } if (cop->mac != NULL && crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { @@ -1127,7 +1129,7 @@ again: if (cop->dst != NULL) { error = copyout(cod->obuf != NULL ? cod->obuf : - cod->buf + crp->crp_payload_start, cop->dst, + cod->buf + crp->crp_payload_start, dst, crp->crp_payload_length); if (error) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); @@ -1160,6 +1162,7 @@ cryptodev_aead( { struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; + char *dst; int error; if (caead->len > 256*1024-4 || caead->aadlen > 256*1024-4) { @@ -1186,6 +1189,7 @@ cryptodev_aead( } cod = cod_alloc(cse, caead->aadlen, caead->len + cse->hashsize, td); + dst = caead->dst; crp = crypto_getreq(cse->cses, M_WAITOK); @@ -1277,7 +1281,7 @@ cryptodev_aead( crp->crp_iv_start = crp->crp_payload_start; crp->crp_payload_start += cse->ivsize; crp->crp_payload_length -= cse->ivsize; - caead->dst += cse->ivsize; + dst += cse->ivsize; } if (crp->crp_op & CRYPTO_OP_VERIFY_DIGEST) { @@ -1322,7 +1326,7 @@ again: if (caead->dst != NULL) { error = copyout(cod->obuf != NULL ? cod->obuf : - cod->buf + crp->crp_payload_start, caead->dst, + cod->buf + crp->crp_payload_start, dst, crp->crp_payload_length); if (error) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); From owner-svn-src-head@freebsd.org Thu Nov 5 23:28:06 2020 Return-Path: Delivered-To: svn-src-head@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 0B9D02D361B; Thu, 5 Nov 2020 23:28:06 +0000 (UTC) (envelope-from jhb@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 4CS07T6SMwz3n5Y; Thu, 5 Nov 2020 23:28:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D09C61BA42; Thu, 5 Nov 2020 23:28:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5NS52e043649; Thu, 5 Nov 2020 23:28:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5NS5oF043647; Thu, 5 Nov 2020 23:28:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011052328.0A5NS5oF043647@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Nov 2020 23:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367404 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 23:28:06 -0000 Author: jhb Date: Thu Nov 5 23:28:05 2020 New Revision: 367404 URL: https://svnweb.freebsd.org/changeset/base/367404 Log: Style fixes for function prototypes and definitions. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27066 Modified: head/sys/opencrypto/crypto.c head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/crypto.c ============================================================================== --- head/sys/opencrypto/crypto.c Thu Nov 5 23:26:02 2020 (r367403) +++ head/sys/opencrypto/crypto.c Thu Nov 5 23:28:05 2020 (r367404) @@ -286,7 +286,9 @@ keybuf_init(void) } /* It'd be nice if we could store these in some kind of secure memory... */ -struct keybuf * get_keybuf(void) { +struct keybuf * +get_keybuf(void) +{ return (keybuf); } Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Thu Nov 5 23:26:02 2020 (r367403) +++ head/sys/opencrypto/cryptodev.c Thu Nov 5 23:28:05 2020 (r367404) @@ -351,13 +351,13 @@ SYSCTL_TIMEVAL_SEC(_kern, OID_AUTO, cryptodev_warn_int &warninterval, "Delay in seconds between warnings of deprecated /dev/crypto algorithms"); -static int cryptof_ioctl(struct file *, u_long, void *, - struct ucred *, struct thread *); -static int cryptof_stat(struct file *, struct stat *, - struct ucred *, struct thread *); -static int cryptof_close(struct file *, struct thread *); -static int cryptof_fill_kinfo(struct file *, struct kinfo_file *, - struct filedesc *); +static int cryptof_ioctl(struct file *, u_long, void *, struct ucred *, + struct thread *); +static int cryptof_stat(struct file *, struct stat *, struct ucred *, + struct thread *); +static int cryptof_close(struct file *, struct thread *); +static int cryptof_fill_kinfo(struct file *, struct kinfo_file *, + struct filedesc *); static struct fileops cryptofops = { .fo_read = invfo_rdwr, @@ -381,12 +381,12 @@ static struct csession *csecreate(struct fcrypt *, cry struct auth_hash *, void *); static void csefree(struct csession *); -static int cryptodev_op(struct csession *, const struct crypt_op *, - struct ucred *, struct thread *td); -static int cryptodev_aead(struct csession *, struct crypt_aead *, - struct ucred *, struct thread *); -static int cryptodev_key(struct crypt_kop *); -static int cryptodev_find(struct crypt_find_op *); +static int cryptodev_op(struct csession *, const struct crypt_op *, + struct ucred *, struct thread *); +static int cryptodev_aead(struct csession *, struct crypt_aead *, + struct ucred *, struct thread *); +static int cryptodev_key(struct crypt_kop *); +static int cryptodev_find(struct crypt_find_op *); /* * Check a crypto identifier to see if it requested @@ -417,12 +417,8 @@ checkforsoftware(int *cridp) /* ARGSUSED */ static int -cryptof_ioctl( - struct file *fp, - u_long cmd, - void *data, - struct ucred *active_cred, - struct thread *td) +cryptof_ioctl(struct file *fp, u_long cmd, void *data, + struct ucred *active_cred, struct thread *td) { static struct timeval keywarn, featwarn; struct crypto_session_params csp; @@ -940,11 +936,8 @@ cod_free(struct cryptop_data *cod) } static int -cryptodev_op( - struct csession *cse, - const struct crypt_op *cop, - struct ucred *active_cred, - struct thread *td) +cryptodev_op(struct csession *cse, const struct crypt_op *cop, + struct ucred *active_cred, struct thread *td) { struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; @@ -1154,11 +1147,8 @@ bail: } static int -cryptodev_aead( - struct csession *cse, - struct crypt_aead *caead, - struct ucred *active_cred, - struct thread *td) +cryptodev_aead(struct csession *cse, struct crypt_aead *caead, + struct ucred *active_cred, struct thread *td) { struct cryptop_data *cod = NULL; struct cryptop *crp = NULL; @@ -1515,11 +1505,8 @@ cryptodev_find(struct crypt_find_op *find) /* ARGSUSED */ static int -cryptof_stat( - struct file *fp, - struct stat *sb, - struct ucred *active_cred, - struct thread *td) +cryptof_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, + struct thread *td) { return (EOPNOTSUPP); @@ -1545,7 +1532,8 @@ cryptof_close(struct file *fp, struct thread *td) } static int -cryptof_fill_kinfo(struct file *fp, struct kinfo_file *kif, struct filedesc *fdp) +cryptof_fill_kinfo(struct file *fp, struct kinfo_file *kif, + struct filedesc *fdp) { kif->kf_type = KF_TYPE_CRYPTO; @@ -1634,7 +1622,8 @@ csefree(struct csession *cse) } static int -cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) +cryptoioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, + struct thread *td) { struct file *f; struct fcrypt *fcr; From owner-svn-src-head@freebsd.org Thu Nov 5 23:31:59 2020 Return-Path: Delivered-To: svn-src-head@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 1C9FB2D3E8C; Thu, 5 Nov 2020 23:31:59 +0000 (UTC) (envelope-from jhb@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 4CS0Cz0CHPz3nXM; Thu, 5 Nov 2020 23:31:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDDCC1BA60; Thu, 5 Nov 2020 23:31:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5NVwgR046348; Thu, 5 Nov 2020 23:31:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5NVw7g046347; Thu, 5 Nov 2020 23:31:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011052331.0A5NVw7g046347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Nov 2020 23:31:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367406 - head/sys/crypto/aesni X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/crypto/aesni X-SVN-Commit-Revision: 367406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 23:31:59 -0000 Author: jhb Date: Thu Nov 5 23:31:58 2020 New Revision: 367406 URL: https://svnweb.freebsd.org/changeset/base/367406 Log: Check cipher key lengths during probesession. OCF drivers in general should perform as many session parameter checks as possible during probesession rather than when creating a new session. I got this wrong for aesni(4) in r359374. In addition, aesni(4) was performing the check for digest-only requests and failing to create digest-only sessions as a result. Reported by: jkim Tested by: jkim Sponsored by: Chelsio Communications Modified: head/sys/crypto/aesni/aesni.c Modified: head/sys/crypto/aesni/aesni.c ============================================================================== --- head/sys/crypto/aesni/aesni.c Thu Nov 5 23:28:46 2020 (r367405) +++ head/sys/crypto/aesni/aesni.c Thu Nov 5 23:31:58 2020 (r367406) @@ -237,16 +237,35 @@ aesni_cipher_supported(struct aesni_softc *sc, switch (csp->csp_cipher_alg) { case CRYPTO_AES_CBC: case CRYPTO_AES_ICM: + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + CRYPTDEB("invalid CBC/ICM key length"); + return (false); + } if (csp->csp_ivlen != AES_BLOCK_LEN) return (false); - return (sc->has_aes); + break; case CRYPTO_AES_XTS: + switch (csp->csp_cipher_klen * 8) { + case 256: + case 512: + break; + default: + CRYPTDEB("invalid XTS key length"); + return (false); + } if (csp->csp_ivlen != AES_XTS_IV_LEN) return (false); - return (sc->has_aes); + break; default: return (false); } + + return (true); } #define SUPPORTED_SES (CSP_F_SEPARATE_OUTPUT | CSP_F_SEPARATE_AAD | CSP_F_ESN) @@ -271,6 +290,15 @@ aesni_probesession(device_t dev, const struct crypto_s case CSP_MODE_AEAD: switch (csp->csp_cipher_alg) { case CRYPTO_AES_NIST_GCM_16: + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + CRYPTDEB("invalid GCM key length"); + return (EINVAL); + } if (csp->csp_auth_mlen != 0 && csp->csp_auth_mlen != GMAC_DIGEST_LEN) return (EINVAL); @@ -279,6 +307,15 @@ aesni_probesession(device_t dev, const struct crypto_s return (EINVAL); break; case CRYPTO_AES_CCM_16: + switch (csp->csp_cipher_klen * 8) { + case 128: + case 192: + case 256: + break; + default: + CRYPTDEB("invalid CCM key length"); + return (EINVAL); + } if (csp->csp_auth_mlen != 0 && csp->csp_auth_mlen != AES_CBC_MAC_HASH_LEN) return (EINVAL); @@ -519,41 +556,6 @@ aesni_authprepare(struct aesni_session *ses, int klen) } static int -aesni_cipherprepare(const struct crypto_session_params *csp) -{ - - switch (csp->csp_cipher_alg) { - case CRYPTO_AES_ICM: - case CRYPTO_AES_NIST_GCM_16: - case CRYPTO_AES_CCM_16: - case CRYPTO_AES_CBC: - switch (csp->csp_cipher_klen * 8) { - case 128: - case 192: - case 256: - break; - default: - CRYPTDEB("invalid CBC/ICM/GCM key length"); - return (EINVAL); - } - break; - case CRYPTO_AES_XTS: - switch (csp->csp_cipher_klen * 8) { - case 256: - case 512: - break; - default: - CRYPTDEB("invalid XTS key length"); - return (EINVAL); - } - break; - default: - return (EINVAL); - } - return (0); -} - -static int aesni_cipher_setup(struct aesni_session *ses, const struct crypto_session_params *csp) { @@ -600,10 +602,6 @@ aesni_cipher_setup(struct aesni_session *ses, if (error != 0) return (error); } - - error = aesni_cipherprepare(csp); - if (error != 0) - return (error); kt = is_fpu_kern_thread(0) || (csp->csp_cipher_alg == 0); if (!kt) { From owner-svn-src-head@freebsd.org Thu Nov 5 23:42:36 2020 Return-Path: Delivered-To: svn-src-head@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 9EE542D4105; Thu, 5 Nov 2020 23:42:36 +0000 (UTC) (envelope-from jhb@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 4CS0SD3ymJz3p9f; Thu, 5 Nov 2020 23:42:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B79F1BDBB; Thu, 5 Nov 2020 23:42:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A5Nga9d056204; Thu, 5 Nov 2020 23:42:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A5Ngauw056203; Thu, 5 Nov 2020 23:42:36 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011052342.0A5Ngauw056203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Nov 2020 23:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367407 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 23:42:36 -0000 Author: jhb Date: Thu Nov 5 23:42:36 2020 New Revision: 367407 URL: https://svnweb.freebsd.org/changeset/base/367407 Log: Move cryptodev_cb earlier before it is used. This is consistent with cryptodevkey_cb being defined before it is used and removes a prototype in the middle of the file. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27067 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Thu Nov 5 23:31:58 2020 (r367406) +++ head/sys/opencrypto/cryptodev.c Thu Nov 5 23:42:36 2020 (r367407) @@ -904,8 +904,6 @@ bail: return (error); } -static int cryptodev_cb(struct cryptop *); - static struct cryptop_data * cod_alloc(struct csession *cse, size_t aad_len, size_t len, struct thread *td) { @@ -936,6 +934,23 @@ cod_free(struct cryptop_data *cod) } static int +cryptodev_cb(struct cryptop *crp) +{ + struct cryptop_data *cod = crp->crp_opaque; + + /* + * Lock to ensure the wakeup() is not missed by the loops + * waiting on cod->done in cryptodev_op() and + * cryptodev_aead(). + */ + mtx_lock(&cod->cse->lock); + cod->done = true; + mtx_unlock(&cod->cse->lock); + wakeup(cod); + return (0); +} + +static int cryptodev_op(struct csession *cse, const struct crypt_op *cop, struct ucred *active_cred, struct thread *td) { @@ -1338,23 +1353,6 @@ bail: cod_free(cod); return (error); -} - -static int -cryptodev_cb(struct cryptop *crp) -{ - struct cryptop_data *cod = crp->crp_opaque; - - /* - * Lock to ensure the wakeup() is not missed by the loops - * waiting on cod->done in cryptodev_op() and - * cryptodev_aead(). - */ - mtx_lock(&cod->cse->lock); - cod->done = true; - mtx_unlock(&cod->cse->lock); - wakeup(cod); - return (0); } static void From owner-svn-src-head@freebsd.org Fri Nov 6 00:10:59 2020 Return-Path: Delivered-To: svn-src-head@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 778652D4FBE; Fri, 6 Nov 2020 00:10:59 +0000 (UTC) (envelope-from jhb@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 4CS14z31fsz3qtC; Fri, 6 Nov 2020 00:10:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FD241C339; Fri, 6 Nov 2020 00:10:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A60AxoO071338; Fri, 6 Nov 2020 00:10:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A60Axtr071337; Fri, 6 Nov 2020 00:10:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011060010.0A60Axtr071337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 6 Nov 2020 00:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367409 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 00:10:59 -0000 Author: jhb Date: Fri Nov 6 00:10:58 2020 New Revision: 367409 URL: https://svnweb.freebsd.org/changeset/base/367409 Log: Split logic to create new sessions into a separate function. This simplifies cryptof_ioctl as it now a wrapper around functions that contain the bulk of the per-ioctl logic. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27068 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Fri Nov 6 00:07:46 2020 (r367408) +++ head/sys/opencrypto/cryptodev.c Fri Nov 6 00:10:58 2020 (r367409) @@ -415,26 +415,318 @@ checkforsoftware(int *cridp) return 0; } +static int +cryptodev_create_session(struct fcrypt *fcr, struct session2_op *sop) +{ + struct crypto_session_params csp; + struct csession *cse; + struct enc_xform *txform; + struct auth_hash *thash; + void *key = NULL; + void *mackey = NULL; + crypto_session_t cses; + int crid, error; + + switch (sop->cipher) { + case 0: + txform = NULL; + break; + case CRYPTO_AES_CBC: + txform = &enc_xform_rijndael128; + break; + case CRYPTO_AES_XTS: + txform = &enc_xform_aes_xts; + break; + case CRYPTO_NULL_CBC: + txform = &enc_xform_null; + break; + case CRYPTO_CAMELLIA_CBC: + txform = &enc_xform_camellia; + break; + case CRYPTO_AES_ICM: + txform = &enc_xform_aes_icm; + break; + case CRYPTO_AES_NIST_GCM_16: + txform = &enc_xform_aes_nist_gcm; + break; + case CRYPTO_CHACHA20: + txform = &enc_xform_chacha20; + break; + case CRYPTO_AES_CCM_16: + txform = &enc_xform_ccm; + break; + default: + CRYPTDEB("invalid cipher"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + + switch (sop->mac) { + case 0: + thash = NULL; + break; + case CRYPTO_POLY1305: + thash = &auth_hash_poly1305; + break; + case CRYPTO_SHA1_HMAC: + thash = &auth_hash_hmac_sha1; + break; + case CRYPTO_SHA2_224_HMAC: + thash = &auth_hash_hmac_sha2_224; + break; + case CRYPTO_SHA2_256_HMAC: + thash = &auth_hash_hmac_sha2_256; + break; + case CRYPTO_SHA2_384_HMAC: + thash = &auth_hash_hmac_sha2_384; + break; + case CRYPTO_SHA2_512_HMAC: + thash = &auth_hash_hmac_sha2_512; + break; + case CRYPTO_RIPEMD160_HMAC: + thash = &auth_hash_hmac_ripemd_160; + break; +#ifdef COMPAT_FREEBSD12 + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + /* Should always be paired with GCM. */ + if (sop->cipher != CRYPTO_AES_NIST_GCM_16) { + CRYPTDEB("GMAC without GCM"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + break; +#endif + case CRYPTO_AES_NIST_GMAC: + switch (sop->mackeylen * 8) { + case 128: + thash = &auth_hash_nist_gmac_aes_128; + break; + case 192: + thash = &auth_hash_nist_gmac_aes_192; + break; + case 256: + thash = &auth_hash_nist_gmac_aes_256; + break; + default: + CRYPTDEB("invalid GMAC key length"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + break; + case CRYPTO_AES_CCM_CBC_MAC: + switch (sop->mackeylen) { + case 16: + thash = &auth_hash_ccm_cbc_mac_128; + break; + case 24: + thash = &auth_hash_ccm_cbc_mac_192; + break; + case 32: + thash = &auth_hash_ccm_cbc_mac_256; + break; + default: + CRYPTDEB("Invalid CBC MAC key size %d", sop->keylen); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + break; + case CRYPTO_SHA1: + thash = &auth_hash_sha1; + break; + case CRYPTO_SHA2_224: + thash = &auth_hash_sha2_224; + break; + case CRYPTO_SHA2_256: + thash = &auth_hash_sha2_256; + break; + case CRYPTO_SHA2_384: + thash = &auth_hash_sha2_384; + break; + case CRYPTO_SHA2_512: + thash = &auth_hash_sha2_512; + break; + + case CRYPTO_NULL_HMAC: + thash = &auth_hash_null; + break; + + case CRYPTO_BLAKE2B: + thash = &auth_hash_blake2b; + break; + case CRYPTO_BLAKE2S: + thash = &auth_hash_blake2s; + break; + + default: + CRYPTDEB("invalid mac"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + + if (txform == NULL && thash == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + + memset(&csp, 0, sizeof(csp)); + if (use_outputbuffers) + csp.csp_flags |= CSP_F_SEPARATE_OUTPUT; + + if (sop->cipher == CRYPTO_AES_NIST_GCM_16) { + switch (sop->mac) { +#ifdef COMPAT_FREEBSD12 + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + if (sop->keylen != sop->mackeylen) { + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); + return (EINVAL); + } + break; +#endif + case 0: + break; + default: + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + csp.csp_mode = CSP_MODE_AEAD; + } else if (sop->cipher == CRYPTO_AES_CCM_16) { + switch (sop->mac) { +#ifdef COMPAT_FREEBSD12 + case CRYPTO_AES_CCM_CBC_MAC: + if (sop->keylen != sop->mackeylen) { + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); + return (EINVAL); + } + thash = NULL; + break; +#endif + case 0: + break; + default: + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + csp.csp_mode = CSP_MODE_AEAD; + } else if (txform != NULL && thash != NULL) + csp.csp_mode = CSP_MODE_ETA; + else if (txform != NULL) + csp.csp_mode = CSP_MODE_CIPHER; + else + csp.csp_mode = CSP_MODE_DIGEST; + + switch (csp.csp_mode) { + case CSP_MODE_AEAD: + case CSP_MODE_ETA: + if (use_separate_aad) + csp.csp_flags |= CSP_F_SEPARATE_AAD; + break; + } + + if (txform != NULL) { + csp.csp_cipher_alg = txform->type; + csp.csp_cipher_klen = sop->keylen; + if (sop->keylen > txform->maxkey || + sop->keylen < txform->minkey) { + CRYPTDEB("invalid cipher parameters"); + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + + key = malloc(csp.csp_cipher_klen, M_XDATA, M_WAITOK); + error = copyin(sop->key, key, csp.csp_cipher_klen); + if (error) { + CRYPTDEB("invalid key"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + csp.csp_cipher_key = key; + csp.csp_ivlen = txform->ivsize; + } + + if (thash != NULL) { + csp.csp_auth_alg = thash->type; + csp.csp_auth_klen = sop->mackeylen; + if (sop->mackeylen > thash->keysize || sop->mackeylen < 0) { + CRYPTDEB("invalid mac key length"); + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + + if (csp.csp_auth_klen != 0) { + mackey = malloc(csp.csp_auth_klen, M_XDATA, M_WAITOK); + error = copyin(sop->mackey, mackey, csp.csp_auth_klen); + if (error) { + CRYPTDEB("invalid mac key"); + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); + goto bail; + } + csp.csp_auth_key = mackey; + } + + if (csp.csp_auth_alg == CRYPTO_AES_NIST_GMAC) + csp.csp_ivlen = AES_GCM_IV_LEN; + if (csp.csp_auth_alg == CRYPTO_AES_CCM_CBC_MAC) + csp.csp_ivlen = AES_CCM_IV_LEN; + } + + crid = sop->crid; + error = checkforsoftware(&crid); + if (error) { + CRYPTDEB("checkforsoftware"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + error = crypto_newsession(&cses, &csp, crid); + if (error) { + CRYPTDEB("crypto_newsession"); + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + goto bail; + } + + cse = csecreate(fcr, cses, &csp, txform, key, thash, mackey); + + if (cse == NULL) { + crypto_freesession(cses); + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + CRYPTDEB("csecreate"); + goto bail; + } + sop->ses = cse->ses; + + /* return hardware/driver id */ + sop->crid = crypto_ses2hid(cse->cses); +bail: + if (error) { + free(key, M_XDATA); + free(mackey, M_XDATA); + } + return (error); +} + /* ARGSUSED */ static int cryptof_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred, struct thread *td) { static struct timeval keywarn, featwarn; - struct crypto_session_params csp; struct fcrypt *fcr = fp->f_data; struct csession *cse; struct session2_op *sop; struct crypt_op *cop; struct crypt_aead *caead; - struct enc_xform *txform = NULL; - struct auth_hash *thash = NULL; - void *key = NULL; - void *mackey = NULL; struct crypt_kop *kop; - crypto_session_t cses; uint32_t ses; - int error = 0, crid; + int error = 0; union { struct session2_op sopc; #ifdef COMPAT_FREEBSD32 @@ -502,302 +794,7 @@ cryptof_ioctl(struct file *fp, u_long cmd, void *data, } else sop = (struct session2_op *)data; - switch (sop->cipher) { - case 0: - break; - case CRYPTO_AES_CBC: - txform = &enc_xform_rijndael128; - break; - case CRYPTO_AES_XTS: - txform = &enc_xform_aes_xts; - break; - case CRYPTO_NULL_CBC: - txform = &enc_xform_null; - break; - case CRYPTO_CAMELLIA_CBC: - txform = &enc_xform_camellia; - break; - case CRYPTO_AES_ICM: - txform = &enc_xform_aes_icm; - break; - case CRYPTO_AES_NIST_GCM_16: - txform = &enc_xform_aes_nist_gcm; - break; - case CRYPTO_CHACHA20: - txform = &enc_xform_chacha20; - break; - case CRYPTO_AES_CCM_16: - txform = &enc_xform_ccm; - break; - - default: - CRYPTDEB("invalid cipher"); - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EINVAL); - } - - switch (sop->mac) { - case 0: - break; - case CRYPTO_POLY1305: - thash = &auth_hash_poly1305; - break; - case CRYPTO_SHA1_HMAC: - thash = &auth_hash_hmac_sha1; - break; - case CRYPTO_SHA2_224_HMAC: - thash = &auth_hash_hmac_sha2_224; - break; - case CRYPTO_SHA2_256_HMAC: - thash = &auth_hash_hmac_sha2_256; - break; - case CRYPTO_SHA2_384_HMAC: - thash = &auth_hash_hmac_sha2_384; - break; - case CRYPTO_SHA2_512_HMAC: - thash = &auth_hash_hmac_sha2_512; - break; - case CRYPTO_RIPEMD160_HMAC: - thash = &auth_hash_hmac_ripemd_160; - break; -#ifdef COMPAT_FREEBSD12 - case CRYPTO_AES_128_NIST_GMAC: - case CRYPTO_AES_192_NIST_GMAC: - case CRYPTO_AES_256_NIST_GMAC: - /* Should always be paired with GCM. */ - if (sop->cipher != CRYPTO_AES_NIST_GCM_16) { - CRYPTDEB("GMAC without GCM"); - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - return (EINVAL); - } - break; -#endif - case CRYPTO_AES_NIST_GMAC: - switch (sop->mackeylen * 8) { - case 128: - thash = &auth_hash_nist_gmac_aes_128; - break; - case 192: - thash = &auth_hash_nist_gmac_aes_192; - break; - case 256: - thash = &auth_hash_nist_gmac_aes_256; - break; - default: - CRYPTDEB("invalid GMAC key length"); - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - return (EINVAL); - } - break; - case CRYPTO_AES_CCM_CBC_MAC: - switch (sop->mackeylen) { - case 16: - thash = &auth_hash_ccm_cbc_mac_128; - break; - case 24: - thash = &auth_hash_ccm_cbc_mac_192; - break; - case 32: - thash = &auth_hash_ccm_cbc_mac_256; - break; - default: - CRYPTDEB("Invalid CBC MAC key size %d", - sop->keylen); - SDT_PROBE1(opencrypto, dev, ioctl, - error, __LINE__); - return (EINVAL); - } - break; - case CRYPTO_SHA1: - thash = &auth_hash_sha1; - break; - case CRYPTO_SHA2_224: - thash = &auth_hash_sha2_224; - break; - case CRYPTO_SHA2_256: - thash = &auth_hash_sha2_256; - break; - case CRYPTO_SHA2_384: - thash = &auth_hash_sha2_384; - break; - case CRYPTO_SHA2_512: - thash = &auth_hash_sha2_512; - break; - - case CRYPTO_NULL_HMAC: - thash = &auth_hash_null; - break; - - case CRYPTO_BLAKE2B: - thash = &auth_hash_blake2b; - break; - case CRYPTO_BLAKE2S: - thash = &auth_hash_blake2s; - break; - - default: - CRYPTDEB("invalid mac"); - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EINVAL); - } - - if (txform == NULL && thash == NULL) { - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EINVAL); - } - - memset(&csp, 0, sizeof(csp)); - if (use_outputbuffers) - csp.csp_flags |= CSP_F_SEPARATE_OUTPUT; - - if (sop->cipher == CRYPTO_AES_NIST_GCM_16) { - switch (sop->mac) { -#ifdef COMPAT_FREEBSD12 - case CRYPTO_AES_128_NIST_GMAC: - case CRYPTO_AES_192_NIST_GMAC: - case CRYPTO_AES_256_NIST_GMAC: - if (sop->keylen != sop->mackeylen) { - SDT_PROBE1(opencrypto, dev, ioctl, - error, __LINE__); - return (EINVAL); - } - break; -#endif - case 0: - break; - default: - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - return (EINVAL); - } - csp.csp_mode = CSP_MODE_AEAD; - } else if (sop->cipher == CRYPTO_AES_CCM_16) { - switch (sop->mac) { -#ifdef COMPAT_FREEBSD12 - case CRYPTO_AES_CCM_CBC_MAC: - if (sop->keylen != sop->mackeylen) { - SDT_PROBE1(opencrypto, dev, ioctl, - error, __LINE__); - return (EINVAL); - } - thash = NULL; - break; -#endif - case 0: - break; - default: - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - return (EINVAL); - } - csp.csp_mode = CSP_MODE_AEAD; - } else if (txform && thash) - csp.csp_mode = CSP_MODE_ETA; - else if (txform) - csp.csp_mode = CSP_MODE_CIPHER; - else - csp.csp_mode = CSP_MODE_DIGEST; - - switch (csp.csp_mode) { - case CSP_MODE_AEAD: - case CSP_MODE_ETA: - if (use_separate_aad) - csp.csp_flags |= CSP_F_SEPARATE_AAD; - break; - } - - if (txform) { - csp.csp_cipher_alg = txform->type; - csp.csp_cipher_klen = sop->keylen; - if (sop->keylen > txform->maxkey || - sop->keylen < txform->minkey) { - CRYPTDEB("invalid cipher parameters"); - error = EINVAL; - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - goto bail; - } - - key = malloc(csp.csp_cipher_klen, M_XDATA, M_WAITOK); - error = copyin(sop->key, key, csp.csp_cipher_klen); - if (error) { - CRYPTDEB("invalid key"); - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - goto bail; - } - csp.csp_cipher_key = key; - csp.csp_ivlen = txform->ivsize; - } - - if (thash) { - csp.csp_auth_alg = thash->type; - csp.csp_auth_klen = sop->mackeylen; - if (sop->mackeylen > thash->keysize || - sop->mackeylen < 0) { - CRYPTDEB("invalid mac key length"); - error = EINVAL; - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - goto bail; - } - - if (csp.csp_auth_klen) { - mackey = malloc(csp.csp_auth_klen, M_XDATA, - M_WAITOK); - error = copyin(sop->mackey, mackey, - csp.csp_auth_klen); - if (error) { - CRYPTDEB("invalid mac key"); - SDT_PROBE1(opencrypto, dev, ioctl, - error, __LINE__); - goto bail; - } - csp.csp_auth_key = mackey; - } - - if (csp.csp_auth_alg == CRYPTO_AES_NIST_GMAC) - csp.csp_ivlen = AES_GCM_IV_LEN; - if (csp.csp_auth_alg == CRYPTO_AES_CCM_CBC_MAC) - csp.csp_ivlen = AES_CCM_IV_LEN; - } - - crid = sop->crid; - error = checkforsoftware(&crid); - if (error) { - CRYPTDEB("checkforsoftware"); - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - goto bail; - } - error = crypto_newsession(&cses, &csp, crid); - if (error) { - CRYPTDEB("crypto_newsession"); - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - goto bail; - } - - cse = csecreate(fcr, cses, &csp, txform, key, thash, mackey); - - if (cse == NULL) { - crypto_freesession(cses); - error = EINVAL; - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - CRYPTDEB("csecreate"); - goto bail; - } - sop->ses = cse->ses; - - /* return hardware/driver id */ - sop->crid = crypto_ses2hid(cse->cses); -bail: - if (error) { - free(key, M_XDATA); - free(mackey, M_XDATA); - } - + error = cryptodev_create_session(fcr, sop); if (cmd == CIOCGSESSION && error == 0) session2_op_to_op(sop, data); break; From owner-svn-src-head@freebsd.org Fri Nov 6 00:15:53 2020 Return-Path: Delivered-To: svn-src-head@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 1BA772D5644; Fri, 6 Nov 2020 00:15:53 +0000 (UTC) (envelope-from jhb@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 4CS1Bd0KzBz3rTs; Fri, 6 Nov 2020 00:15:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F26061C523; Fri, 6 Nov 2020 00:15:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A60FqAT074765; Fri, 6 Nov 2020 00:15:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A60FqAX074764; Fri, 6 Nov 2020 00:15:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011060015.0A60FqAX074764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 6 Nov 2020 00:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367410 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 00:15:53 -0000 Author: jhb Date: Fri Nov 6 00:15:52 2020 New Revision: 367410 URL: https://svnweb.freebsd.org/changeset/base/367410 Log: Move cryptof_ioctl() below the routines it calls. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27069 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Fri Nov 6 00:10:58 2020 (r367409) +++ head/sys/opencrypto/cryptodev.c Fri Nov 6 00:15:52 2020 (r367410) @@ -381,13 +381,6 @@ static struct csession *csecreate(struct fcrypt *, cry struct auth_hash *, void *); static void csefree(struct csession *); -static int cryptodev_op(struct csession *, const struct crypt_op *, - struct ucred *, struct thread *); -static int cryptodev_aead(struct csession *, struct crypt_aead *, - struct ucred *, struct thread *); -static int cryptodev_key(struct crypt_kop *); -static int cryptodev_find(struct crypt_find_op *); - /* * Check a crypto identifier to see if it requested * a software device/driver. This can be done either @@ -713,194 +706,6 @@ bail: return (error); } -/* ARGSUSED */ -static int -cryptof_ioctl(struct file *fp, u_long cmd, void *data, - struct ucred *active_cred, struct thread *td) -{ - static struct timeval keywarn, featwarn; - struct fcrypt *fcr = fp->f_data; - struct csession *cse; - struct session2_op *sop; - struct crypt_op *cop; - struct crypt_aead *caead; - struct crypt_kop *kop; - uint32_t ses; - int error = 0; - union { - struct session2_op sopc; -#ifdef COMPAT_FREEBSD32 - struct crypt_op copc; - struct crypt_aead aeadc; - struct crypt_kop kopc; -#endif - } thunk; -#ifdef COMPAT_FREEBSD32 - u_long cmd32; - void *data32; - - cmd32 = 0; - data32 = NULL; - switch (cmd) { - case CIOCGSESSION32: - cmd32 = cmd; - data32 = data; - cmd = CIOCGSESSION; - data = &thunk.sopc; - session_op_from_32((struct session_op32 *)data32, &thunk.sopc); - break; - case CIOCGSESSION232: - cmd32 = cmd; - data32 = data; - cmd = CIOCGSESSION2; - data = &thunk.sopc; - session2_op_from_32((struct session2_op32 *)data32, - &thunk.sopc); - break; - case CIOCCRYPT32: - cmd32 = cmd; - data32 = data; - cmd = CIOCCRYPT; - data = &thunk.copc; - crypt_op_from_32((struct crypt_op32 *)data32, &thunk.copc); - break; - case CIOCCRYPTAEAD32: - cmd32 = cmd; - data32 = data; - cmd = CIOCCRYPTAEAD; - data = &thunk.aeadc; - crypt_aead_from_32((struct crypt_aead32 *)data32, &thunk.aeadc); - break; - case CIOCKEY32: - case CIOCKEY232: - cmd32 = cmd; - data32 = data; - if (cmd == CIOCKEY32) - cmd = CIOCKEY; - else - cmd = CIOCKEY2; - data = &thunk.kopc; - crypt_kop_from_32((struct crypt_kop32 *)data32, &thunk.kopc); - break; - } -#endif - - switch (cmd) { - case CIOCGSESSION: - case CIOCGSESSION2: - if (cmd == CIOCGSESSION) { - session2_op_from_op(data, &thunk.sopc); - sop = &thunk.sopc; - } else - sop = (struct session2_op *)data; - - error = cryptodev_create_session(fcr, sop); - if (cmd == CIOCGSESSION && error == 0) - session2_op_to_op(sop, data); - break; - case CIOCFSESSION: - ses = *(uint32_t *)data; - if (!csedelete(fcr, ses)) { - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EINVAL); - } - break; - case CIOCCRYPT: - cop = (struct crypt_op *)data; - cse = csefind(fcr, cop->ses); - if (cse == NULL) { - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EINVAL); - } - error = cryptodev_op(cse, cop, active_cred, td); - csefree(cse); - break; - case CIOCKEY: - case CIOCKEY2: - if (ratecheck(&keywarn, &warninterval)) - gone_in(14, - "Asymmetric crypto operations via /dev/crypto"); - - if (!crypto_userasymcrypto) { - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EPERM); /* XXX compat? */ - } - kop = (struct crypt_kop *)data; - if (cmd == CIOCKEY) { - /* NB: crypto core enforces s/w driver use */ - kop->crk_crid = - CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE; - } - mtx_lock(&Giant); - error = cryptodev_key(kop); - mtx_unlock(&Giant); - break; - case CIOCASYMFEAT: - if (ratecheck(&featwarn, &warninterval)) - gone_in(14, - "Asymmetric crypto features via /dev/crypto"); - - if (!crypto_userasymcrypto) { - /* - * NB: if user asym crypto operations are - * not permitted return "no algorithms" - * so well-behaved applications will just - * fallback to doing them in software. - */ - *(int *)data = 0; - } else { - error = crypto_getfeat((int *)data); - if (error) - SDT_PROBE1(opencrypto, dev, ioctl, error, - __LINE__); - } - break; - case CIOCFINDDEV: - error = cryptodev_find((struct crypt_find_op *)data); - break; - case CIOCCRYPTAEAD: - caead = (struct crypt_aead *)data; - cse = csefind(fcr, caead->ses); - if (cse == NULL) { - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - return (EINVAL); - } - error = cryptodev_aead(cse, caead, active_cred, td); - csefree(cse); - break; - default: - error = EINVAL; - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - break; - } - -#ifdef COMPAT_FREEBSD32 - switch (cmd32) { - case CIOCGSESSION32: - if (error == 0) - session_op_to_32(data, data32); - break; - case CIOCGSESSION232: - if (error == 0) - session2_op_to_32(data, data32); - break; - case CIOCCRYPT32: - if (error == 0) - crypt_op_to_32(data, data32); - break; - case CIOCCRYPTAEAD32: - if (error == 0) - crypt_aead_to_32(data, data32); - break; - case CIOCKEY32: - case CIOCKEY232: - crypt_kop_to_32(data, data32); - break; - } -#endif - return (error); -} - static struct cryptop_data * cod_alloc(struct csession *cse, size_t aad_len, size_t len, struct thread *td) { @@ -1496,6 +1301,193 @@ cryptodev_find(struct crypt_find_op *find) return (ENOENT); } return (0); +} + +static int +cryptof_ioctl(struct file *fp, u_long cmd, void *data, + struct ucred *active_cred, struct thread *td) +{ + static struct timeval keywarn, featwarn; + struct fcrypt *fcr = fp->f_data; + struct csession *cse; + struct session2_op *sop; + struct crypt_op *cop; + struct crypt_aead *caead; + struct crypt_kop *kop; + uint32_t ses; + int error = 0; + union { + struct session2_op sopc; +#ifdef COMPAT_FREEBSD32 + struct crypt_op copc; + struct crypt_aead aeadc; + struct crypt_kop kopc; +#endif + } thunk; +#ifdef COMPAT_FREEBSD32 + u_long cmd32; + void *data32; + + cmd32 = 0; + data32 = NULL; + switch (cmd) { + case CIOCGSESSION32: + cmd32 = cmd; + data32 = data; + cmd = CIOCGSESSION; + data = &thunk.sopc; + session_op_from_32((struct session_op32 *)data32, &thunk.sopc); + break; + case CIOCGSESSION232: + cmd32 = cmd; + data32 = data; + cmd = CIOCGSESSION2; + data = &thunk.sopc; + session2_op_from_32((struct session2_op32 *)data32, + &thunk.sopc); + break; + case CIOCCRYPT32: + cmd32 = cmd; + data32 = data; + cmd = CIOCCRYPT; + data = &thunk.copc; + crypt_op_from_32((struct crypt_op32 *)data32, &thunk.copc); + break; + case CIOCCRYPTAEAD32: + cmd32 = cmd; + data32 = data; + cmd = CIOCCRYPTAEAD; + data = &thunk.aeadc; + crypt_aead_from_32((struct crypt_aead32 *)data32, &thunk.aeadc); + break; + case CIOCKEY32: + case CIOCKEY232: + cmd32 = cmd; + data32 = data; + if (cmd == CIOCKEY32) + cmd = CIOCKEY; + else + cmd = CIOCKEY2; + data = &thunk.kopc; + crypt_kop_from_32((struct crypt_kop32 *)data32, &thunk.kopc); + break; + } +#endif + + switch (cmd) { + case CIOCGSESSION: + case CIOCGSESSION2: + if (cmd == CIOCGSESSION) { + session2_op_from_op(data, &thunk.sopc); + sop = &thunk.sopc; + } else + sop = (struct session2_op *)data; + + error = cryptodev_create_session(fcr, sop); + if (cmd == CIOCGSESSION && error == 0) + session2_op_to_op(sop, data); + break; + case CIOCFSESSION: + ses = *(uint32_t *)data; + if (!csedelete(fcr, ses)) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + break; + case CIOCCRYPT: + cop = (struct crypt_op *)data; + cse = csefind(fcr, cop->ses); + if (cse == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + error = cryptodev_op(cse, cop, active_cred, td); + csefree(cse); + break; + case CIOCKEY: + case CIOCKEY2: + if (ratecheck(&keywarn, &warninterval)) + gone_in(14, + "Asymmetric crypto operations via /dev/crypto"); + + if (!crypto_userasymcrypto) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EPERM); /* XXX compat? */ + } + kop = (struct crypt_kop *)data; + if (cmd == CIOCKEY) { + /* NB: crypto core enforces s/w driver use */ + kop->crk_crid = + CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE; + } + mtx_lock(&Giant); + error = cryptodev_key(kop); + mtx_unlock(&Giant); + break; + case CIOCASYMFEAT: + if (ratecheck(&featwarn, &warninterval)) + gone_in(14, + "Asymmetric crypto features via /dev/crypto"); + + if (!crypto_userasymcrypto) { + /* + * NB: if user asym crypto operations are + * not permitted return "no algorithms" + * so well-behaved applications will just + * fallback to doing them in software. + */ + *(int *)data = 0; + } else { + error = crypto_getfeat((int *)data); + if (error) + SDT_PROBE1(opencrypto, dev, ioctl, error, + __LINE__); + } + break; + case CIOCFINDDEV: + error = cryptodev_find((struct crypt_find_op *)data); + break; + case CIOCCRYPTAEAD: + caead = (struct crypt_aead *)data; + cse = csefind(fcr, caead->ses); + if (cse == NULL) { + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + return (EINVAL); + } + error = cryptodev_aead(cse, caead, active_cred, td); + csefree(cse); + break; + default: + error = EINVAL; + SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); + break; + } + +#ifdef COMPAT_FREEBSD32 + switch (cmd32) { + case CIOCGSESSION32: + if (error == 0) + session_op_to_32(data, data32); + break; + case CIOCGSESSION232: + if (error == 0) + session2_op_to_32(data, data32); + break; + case CIOCCRYPT32: + if (error == 0) + crypt_op_to_32(data, data32); + break; + case CIOCCRYPTAEAD32: + if (error == 0) + crypt_aead_to_32(data, data32); + break; + case CIOCKEY32: + case CIOCKEY232: + crypt_kop_to_32(data, data32); + break; + } +#endif + return (error); } /* ARGSUSED */ From owner-svn-src-head@freebsd.org Fri Nov 6 13:34:31 2020 Return-Path: Delivered-To: svn-src-head@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 D6AD82EEE5F; Fri, 6 Nov 2020 13:34:31 +0000 (UTC) (envelope-from alfredo@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 4CSLw75mqBz3n3H; Fri, 6 Nov 2020 13:34:31 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B928225A73; Fri, 6 Nov 2020 13:34:31 +0000 (UTC) (envelope-from alfredo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6DYVBl083101; Fri, 6 Nov 2020 13:34:31 GMT (envelope-from alfredo@FreeBSD.org) Received: (from alfredo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6DYUV9083093; Fri, 6 Nov 2020 13:34:30 GMT (envelope-from alfredo@FreeBSD.org) Message-Id: <202011061334.0A6DYUV9083093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alfredo set sender to alfredo@FreeBSD.org using -f From: "Alfredo Dal'Ava Junior" Date: Fri, 6 Nov 2020 13:34:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367416 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: alfredo X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 367416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 13:34:31 -0000 Author: alfredo Date: Fri Nov 6 13:34:30 2020 New Revision: 367416 URL: https://svnweb.freebsd.org/changeset/base/367416 Log: [POWERPC] Floating-Point Exception trap support Add support for Floating-Point Exception traps on 32 and 64 bit platforms. Also make sure to clean FPSCR on EXEC and thread exit Author of initial version: Renato Riolino Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23623 Modified: head/sys/powerpc/include/cpufunc.h head/sys/powerpc/include/fpu.h head/sys/powerpc/include/psl.h head/sys/powerpc/powerpc/exec_machdep.c head/sys/powerpc/powerpc/fpu.c head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/include/cpufunc.h ============================================================================== --- head/sys/powerpc/include/cpufunc.h Fri Nov 6 07:16:21 2020 (r367415) +++ head/sys/powerpc/include/cpufunc.h Fri Nov 6 13:34:30 2020 (r367416) @@ -163,6 +163,25 @@ mttb(u_quad_t time) mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff)); } + +static __inline register_t +mffs(void) +{ + register_t value; + + __asm __volatile ("mffs 0; stfd 0,0(%0)" + :: "b"(&value)); + + return (value); +} + +static __inline void +mtfsf(register_t value) +{ + __asm __volatile ("lfd 0,0(%0); mtfsf 0xff,0" + :: "b"(&value)); +} + static __inline void eieio(void) { Modified: head/sys/powerpc/include/fpu.h ============================================================================== --- head/sys/powerpc/include/fpu.h Fri Nov 6 07:16:21 2020 (r367415) +++ head/sys/powerpc/include/fpu.h Fri Nov 6 13:34:30 2020 (r367416) @@ -75,6 +75,8 @@ void enable_fpu(struct thread *); void save_fpu(struct thread *); void save_fpu_nodrop(struct thread *); +void cleanup_fpscr(void); +u_int get_fpu_exception(struct thread *); #endif /* _KERNEL */ Modified: head/sys/powerpc/include/psl.h ============================================================================== --- head/sys/powerpc/include/psl.h Fri Nov 6 07:16:21 2020 (r367415) +++ head/sys/powerpc/include/psl.h Fri Nov 6 13:34:30 2020 (r367416) @@ -88,7 +88,7 @@ #define PSL_FE_NONREC PSL_FE1 /* imprecise non-recoverable */ #define PSL_FE_REC PSL_FE0 /* imprecise recoverable */ #define PSL_FE_PREC (PSL_FE0 | PSL_FE1) /* precise */ -#define PSL_FE_DFLT PSL_FE_DIS /* default == none */ +#define PSL_FE_DFLT PSL_FE_PREC /* default == precise */ #ifndef LOCORE extern register_t psl_kernset; /* Default MSR values for kernel */ Modified: head/sys/powerpc/powerpc/exec_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/exec_machdep.c Fri Nov 6 07:16:21 2020 (r367415) +++ head/sys/powerpc/powerpc/exec_machdep.c Fri Nov 6 13:34:30 2020 (r367416) @@ -239,11 +239,14 @@ sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask usfp = (void *)((sp - rndfsize) & ~0xFul); } - /* - * Save the floating-point state, if necessary, then copy it. + /* + * Set Floating Point facility to "Ignore Exceptions Mode" so signal + * handler can run. */ - /* XXX */ + if (td->td_pcb->pcb_flags & PCB_FPU) + tf->srr1 = tf->srr1 & ~(PSL_FE0 | PSL_FE1); + /* * Set up the registers to return to sigcode. * @@ -333,6 +336,13 @@ sys_sigreturn(struct thread *td, struct sigreturn_args kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); + /* + * Save FPU state if needed. User may have changed it on + * signal handler + */ + if (uc.uc_mcontext.mc_srr1 & PSL_FP) + save_fpu(td); + CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); @@ -556,6 +566,8 @@ cleanup_power_extras(struct thread *td) mtspr(SPR_FSCR, 0); if (pcb_flags & PCB_CDSCR) mtspr(SPR_DSCRP, 0); + + cleanup_fpscr(); } /* @@ -825,6 +837,14 @@ freebsd32_sigreturn(struct thread *td, struct freebsd3 return (error); kern_sigprocmask(td, SIG_SETMASK, &uc.uc_sigmask, NULL, 0); + + /* + * Save FPU state if needed. User may have changed it on + * signal handler + */ + if (uc.uc_mcontext.mc_srr1 & PSL_FP) + save_fpu(td); + CTR3(KTR_SIG, "sigreturn: return td=%p pc=%#x sp=%#x", td, uc.uc_mcontext.mc_srr0, uc.uc_mcontext.mc_gpr[1]); Modified: head/sys/powerpc/powerpc/fpu.c ============================================================================== --- head/sys/powerpc/powerpc/fpu.c Fri Nov 6 07:16:21 2020 (r367415) +++ head/sys/powerpc/powerpc/fpu.c Fri Nov 6 13:34:30 2020 (r367416) @@ -48,7 +48,7 @@ __FBSDID("$FreeBSD$"); static void save_fpu_int(struct thread *td) { - int msr; + register_t msr; struct pcb *pcb; pcb = td->td_pcb; @@ -102,7 +102,7 @@ save_fpu_int(struct thread *td) void enable_fpu(struct thread *td) { - int msr; + register_t msr; struct pcb *pcb; struct trapframe *tf; @@ -208,3 +208,58 @@ save_fpu_nodrop(struct thread *td) if (td == PCPU_GET(fputhread)) save_fpu_int(td); } + + +/* + * Clear Floating-Point Status and Control Register + */ +void +cleanup_fpscr() +{ + register_t msr; + msr = mfmsr(); + mtmsr(msr | PSL_FP | PSL_VSX); + + mtfsf(0); + + isync(); + mtmsr(msr); +} + + +/* + * * Returns the current fp exception + * */ +u_int +get_fpu_exception(struct thread *td) +{ + register_t msr; + u_int ucode; + register_t reg; + + critical_enter(); + + msr = mfmsr(); + mtmsr(msr | PSL_FP); + + reg = mffs(); + + isync(); + mtmsr(msr); + + critical_exit(); + + if (reg & FPSCR_ZX) + ucode = FPE_FLTDIV; + else if (reg & FPSCR_OX) + ucode = FPE_FLTOVF; + else if (reg & FPSCR_UX) + ucode = FPE_FLTUND; + else if (reg & FPSCR_XX) + ucode = FPE_FLTRES; + else + ucode = FPE_FLTINV; + + return ucode; +} + Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Fri Nov 6 07:16:21 2020 (r367415) +++ head/sys/powerpc/powerpc/trap.c Fri Nov 6 13:34:30 2020 (r367416) @@ -405,16 +405,24 @@ trap(struct trapframe *frame) #endif sig = SIGTRAP; ucode = TRAP_BRKPT; - } else { + break; + } + + if ((frame->srr1 & EXC_PGM_FPENABLED) && + (td->td_pcb->pcb_flags & PCB_FPU)) + sig = SIGFPE; + else sig = ppc_instr_emulate(frame, td); - if (sig == SIGILL) { - if (frame->srr1 & EXC_PGM_PRIV) - ucode = ILL_PRVOPC; - else if (frame->srr1 & EXC_PGM_ILLEGAL) - ucode = ILL_ILLOPC; - } else if (sig == SIGFPE) - ucode = FPE_FLTINV; /* Punt for now, invalid operation. */ + + if (sig == SIGILL) { + if (frame->srr1 & EXC_PGM_PRIV) + ucode = ILL_PRVOPC; + else if (frame->srr1 & EXC_PGM_ILLEGAL) + ucode = ILL_ILLOPC; + } else if (sig == SIGFPE) { + ucode = get_fpu_exception(td); } + break; case EXC_MCHK: @@ -964,7 +972,7 @@ fix_unaligned(struct thread *td, struct trapframe *fra static void normalize_inputs(void) { - unsigned long msr; + register_t msr; /* enable VSX */ msr = mfmsr(); From owner-svn-src-head@freebsd.org Fri Nov 6 14:12:46 2020 Return-Path: Delivered-To: svn-src-head@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 1DAAD2EF9DB; Fri, 6 Nov 2020 14:12:46 +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 4CSMmG0M8Vz3qLq; Fri, 6 Nov 2020 14:12:46 +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 F346926599; Fri, 6 Nov 2020 14:12:45 +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 0A6ECjH9008002; Fri, 6 Nov 2020 14:12:45 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6ECjiM008000; Fri, 6 Nov 2020 14:12:45 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011061412.0A6ECjiM008000@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Fri, 6 Nov 2020 14:12:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367417 - in head/sys: powerpc/aim powerpc/include powerpc/powernv powerpc/powerpc powerpc/pseries vm X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys: powerpc/aim powerpc/include powerpc/powernv powerpc/powerpc powerpc/pseries vm X-SVN-Commit-Revision: 367417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 14:12:46 -0000 Author: luporl Date: Fri Nov 6 14:12:45 2020 New Revision: 367417 URL: https://svnweb.freebsd.org/changeset/base/367417 Log: Implement superpages for PowerPC64 (HPT) This change adds support for transparent superpages for PowerPC64 systems using Hashed Page Tables (HPT). All pmap operations are supported. The changes were inspired by RISC-V implementation of superpages, by @markj (r344106), but heavily adapted to fit PPC64 HPT architecture and existing MMU OEA64 code. While these changes are not better tested, superpages support is disabled by default. To enable it, use vm.pmap.superpages_enabled=1. In this initial implementation, when superpages are disabled, system performance stays at the same level as without these changes. When superpages are enabled, buildworld time increases a bit (~2%). However, for workloads that put a heavy pressure on the TLB the performance boost is much bigger (see HPC Challenge and pgbench on D25237). Reviewed by: jhibbits Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D25237 Modified: head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/mmu_oea64.h head/sys/powerpc/aim/moea64_native.c head/sys/powerpc/include/pmap.h head/sys/powerpc/include/pte.h head/sys/powerpc/include/slb.h head/sys/powerpc/include/vmparam.h head/sys/powerpc/powernv/platform_powernv.c head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/powerpc/pseries/mmu_phyp.c head/sys/vm/vm_fault.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Fri Nov 6 13:34:30 2020 (r367416) +++ head/sys/powerpc/aim/mmu_oea64.c Fri Nov 6 14:12:45 2020 (r367417) @@ -83,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -111,9 +112,6 @@ uintptr_t moea64_get_unique_vsid(void); #define VSID_TO_HASH(vsid) (((vsid) >> 4) & 0xfffff) #define VSID_HASH_MASK 0x0000007fffffffffULL -/* Get physical address from PVO. */ -#define PVO_PADDR(pvo) ((pvo)->pvo_pte.pa & LPTE_RPGN) - /* * Locking semantics: * @@ -146,6 +144,48 @@ static struct mtx_padalign pv_lock[PV_LOCK_COUNT]; #define PV_PAGE_UNLOCK(m) PV_UNLOCK(VM_PAGE_TO_PHYS(m)) #define PV_PAGE_LOCKASSERT(m) PV_LOCKASSERT(VM_PAGE_TO_PHYS(m)) +/* Superpage PV lock */ + +#define PV_LOCK_SIZE (1<pvo_vaddr & PVO_LARGE) && \ + (pvo)->pvo_pmap != kernel_pmap) + +/* Get physical address from PVO. */ +#define PVO_PADDR(pvo) moea64_pvo_paddr(pvo) + +/* MD page flag indicating that the page is a superpage. */ +#define MDPG_ATTR_SP 0x40000000 + +static SYSCTL_NODE(_vm, OID_AUTO, pmap, CTLFLAG_RD, 0, + "VM/pmap parameters"); + +static int superpages_enabled = 0; +SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled, CTLFLAG_RDTUN, + &superpages_enabled, 0, "Enable support for transparent superpages"); + +static SYSCTL_NODE(_vm_pmap, OID_AUTO, sp, CTLFLAG_RD, 0, + "SP page mapping counters"); + +static u_long sp_demotions; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, demotions, CTLFLAG_RD, + &sp_demotions, 0, "SP page demotions"); + +static u_long sp_mappings; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, mappings, CTLFLAG_RD, + &sp_mappings, 0, "SP page mappings"); + +static u_long sp_p_failures; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, p_failures, CTLFLAG_RD, + &sp_p_failures, 0, "SP page promotion failures"); + +static u_long sp_p_fail_pa; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, p_fail_pa, CTLFLAG_RD, + &sp_p_fail_pa, 0, "SP page promotion failure: PAs don't match"); + +static u_long sp_p_fail_flags; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, p_fail_flags, CTLFLAG_RD, + &sp_p_fail_flags, 0, "SP page promotion failure: page flags don't match"); + +static u_long sp_p_fail_prot; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, p_fail_prot, CTLFLAG_RD, + &sp_p_fail_prot, 0, + "SP page promotion failure: page protections don't match"); + +static u_long sp_p_fail_wimg; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, p_fail_wimg, CTLFLAG_RD, + &sp_p_fail_wimg, 0, "SP page promotion failure: WIMG bits don't match"); + +static u_long sp_promotions; +SYSCTL_ULONG(_vm_pmap_sp, OID_AUTO, promotions, CTLFLAG_RD, + &sp_promotions, 0, "SP page promotions"); + +static bool moea64_ps_enabled(pmap_t); +static void moea64_align_superpage(vm_object_t, vm_ooffset_t, + vm_offset_t *, vm_size_t); + +static int moea64_sp_enter(pmap_t pmap, vm_offset_t va, + vm_page_t m, vm_prot_t prot, u_int flags, int8_t psind); +static struct pvo_entry *moea64_sp_remove(struct pvo_entry *sp, + struct pvo_dlist *tofree); + +static void moea64_sp_promote(pmap_t pmap, vm_offset_t va, vm_page_t m); +static void moea64_sp_demote_aligned(struct pvo_entry *sp); +static void moea64_sp_demote(struct pvo_entry *pvo); + +static struct pvo_entry *moea64_sp_unwire(struct pvo_entry *sp); +static struct pvo_entry *moea64_sp_protect(struct pvo_entry *sp, + vm_prot_t prot); + +static int64_t moea64_sp_query(struct pvo_entry *pvo, uint64_t ptebit); +static int64_t moea64_sp_clear(struct pvo_entry *pvo, vm_page_t m, + uint64_t ptebit); + +static __inline bool moea64_sp_pvo_in_range(struct pvo_entry *pvo, + vm_offset_t sva, vm_offset_t eva); + +/* * Kernel MMU interface */ void moea64_clear_modify(vm_page_t); @@ -362,6 +492,8 @@ static struct pmap_funcs moea64_methods = { #ifdef __powerpc64__ .page_array_startup = moea64_page_array_startup, #endif + .ps_enabled = moea64_ps_enabled, + .align_superpage = moea64_align_superpage, /* Internal interfaces */ .mapdev = moea64_mapdev, @@ -381,6 +513,26 @@ static struct pmap_funcs moea64_methods = { MMU_DEF(oea64_mmu, "mmu_oea64_base", moea64_methods); +/* + * Get physical address from PVO. + * + * For superpages, the lower bits are not stored on pvo_pte.pa and must be + * obtained from VA. + */ +static __always_inline vm_paddr_t +moea64_pvo_paddr(struct pvo_entry *pvo) +{ + vm_paddr_t pa; + + pa = (pvo)->pvo_pte.pa & LPTE_RPGN; + + if (PVO_IS_SP(pvo)) { + pa &= ~HPT_SP_MASK; /* This is needed to clear LPTE_LP bits. */ + pa |= PVO_VADDR(pvo) & HPT_SP_MASK; + } + return (pa); +} + static struct pvo_head * vm_page_to_pvoh(vm_page_t m) { @@ -428,8 +580,10 @@ init_pvo_entry(struct pvo_entry *pvo, pmap_t pmap, vm_ pvo->pvo_vpn = (uint64_t)((va & ADDR_PIDX) >> ADDR_PIDX_SHFT) | (vsid << 16); - shift = (pvo->pvo_vaddr & PVO_LARGE) ? moea64_large_page_shift : - ADDR_PIDX_SHFT; + if (pmap == kernel_pmap && (pvo->pvo_vaddr & PVO_LARGE) != 0) + shift = moea64_large_page_shift; + else + shift = ADDR_PIDX_SHFT; hash = (vsid & VSID_HASH_MASK) ^ (((uint64_t)va & ADDR_PIDX) >> shift); pvo->pvo_pte.slot = (hash & moea64_pteg_mask) << 3; } @@ -773,6 +927,9 @@ moea64_early_bootstrap(vm_offset_t kernelstart, vm_off vm_paddr_t kernelphysstart, kernelphysend; int rm_pavail; + /* Level 0 reservations consist of 4096 pages (16MB superpage). */ + vm_level_0_order = 12; + #ifndef __powerpc64__ /* We don't have a direct map since there is no BAT */ hw_direct_map = 0; @@ -1204,6 +1361,17 @@ moea64_unwire(pmap_t pm, vm_offset_t sva, vm_offset_t for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); pvo != NULL && PVO_VADDR(pvo) < eva; pvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo)) { + if (PVO_IS_SP(pvo)) { + if (moea64_sp_pvo_in_range(pvo, sva, eva)) { + pvo = moea64_sp_unwire(pvo); + continue; + } else { + CTR1(KTR_PMAP, "%s: demote before unwire", + __func__); + moea64_sp_demote(pvo); + } + } + if ((pvo->pvo_vaddr & PVO_WIRED) == 0) panic("moea64_unwire: pvo %p is missing PVO_WIRED", pvo); @@ -1489,10 +1657,11 @@ int moea64_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, u_int flags, int8_t psind) { - struct pvo_entry *pvo, *oldpvo; + struct pvo_entry *pvo, *oldpvo, *tpvo; struct pvo_head *pvo_head; uint64_t pte_lo; int error; + vm_paddr_t pa; if ((m->oflags & VPO_UNMANAGED) == 0) { if ((flags & PMAP_ENTER_QUICK_LOCKED) == 0) @@ -1501,14 +1670,18 @@ moea64_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, VM_OBJECT_ASSERT_LOCKED(m->object); } + if (psind > 0) + return (moea64_sp_enter(pmap, va, m, prot, flags, psind)); + pvo = alloc_pvo_entry(0); if (pvo == NULL) return (KERN_RESOURCE_SHORTAGE); pvo->pvo_pmap = NULL; /* to be filled in later */ pvo->pvo_pte.prot = prot; - pte_lo = moea64_calc_wimg(VM_PAGE_TO_PHYS(m), pmap_page_get_memattr(m)); - pvo->pvo_pte.pa = VM_PAGE_TO_PHYS(m) | pte_lo; + pa = VM_PAGE_TO_PHYS(m); + pte_lo = moea64_calc_wimg(pa, pmap_page_get_memattr(m)); + pvo->pvo_pte.pa = pa | pte_lo; if ((flags & PMAP_ENTER_WIRED) != 0) pvo->pvo_vaddr |= PVO_WIRED; @@ -1520,10 +1693,20 @@ moea64_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, pvo->pvo_vaddr |= PVO_MANAGED; } - PV_PAGE_LOCK(m); + PV_LOCK(pa); PMAP_LOCK(pmap); if (pvo->pvo_pmap == NULL) init_pvo_entry(pvo, pmap, va); + + if (moea64_ps_enabled(pmap) && + (tpvo = moea64_pvo_find_va(pmap, va & ~HPT_SP_MASK)) != NULL && + PVO_IS_SP(tpvo)) { + /* Demote SP before entering a regular page */ + CTR2(KTR_PMAP, "%s: demote before enter: va=%#jx", + __func__, (uintmax_t)va); + moea64_sp_demote_aligned(tpvo); + } + if (prot & VM_PROT_WRITE) if (pmap_bootstrapped && (m->oflags & VPO_UNMANAGED) == 0) @@ -1544,9 +1727,10 @@ moea64_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, } /* Then just clean up and go home */ - PV_PAGE_UNLOCK(m); PMAP_UNLOCK(pmap); + PV_UNLOCK(pa); free_pvo_entry(pvo); + pvo = NULL; goto out; } else { /* Otherwise, need to kill it first */ @@ -1557,7 +1741,7 @@ moea64_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, } } PMAP_UNLOCK(pmap); - PV_PAGE_UNLOCK(m); + PV_UNLOCK(pa); /* Free any dead pages */ if (error == EEXIST) { @@ -1573,8 +1757,23 @@ out: if (pmap != kernel_pmap && (m->a.flags & PGA_EXECUTABLE) == 0 && (pte_lo & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) { vm_page_aflag_set(m, PGA_EXECUTABLE); - moea64_syncicache(pmap, va, VM_PAGE_TO_PHYS(m), PAGE_SIZE); + moea64_syncicache(pmap, va, pa, PAGE_SIZE); } + + /* + * Try to promote pages. + * + * If the VA of the entered page is not aligned with its PA, + * don't try page promotion as it is not possible. + * This reduces the number of promotion failures dramatically. + */ + if (moea64_ps_enabled(pmap) && pmap != kernel_pmap && pvo != NULL && + (pvo->pvo_vaddr & PVO_MANAGED) != 0 && + (va & HPT_SP_MASK) == (pa & HPT_SP_MASK) && + (m->flags & PG_FICTITIOUS) == 0 && + vm_reserv_level_iffullpop(m) == 0) + moea64_sp_promote(pmap, va, m); + return (KERN_SUCCESS); } @@ -1633,15 +1832,25 @@ moea64_enter_object(pmap_t pm, vm_offset_t start, vm_o { vm_page_t m; vm_pindex_t diff, psize; + vm_offset_t va; + int8_t psind; VM_OBJECT_ASSERT_LOCKED(m_start->object); psize = atop(end - start); m = m_start; while (m != NULL && (diff = m->pindex - m_start->pindex) < psize) { - moea64_enter(pm, start + ptoa(diff), m, prot & - (VM_PROT_READ | VM_PROT_EXECUTE), PMAP_ENTER_NOSLEEP | - PMAP_ENTER_QUICK_LOCKED, 0); + va = start + ptoa(diff); + if ((va & HPT_SP_MASK) == 0 && va + HPT_SP_SIZE <= end && + m->psind == 1 && moea64_ps_enabled(pm)) + psind = 1; + else + psind = 0; + moea64_enter(pm, va, m, prot & + (VM_PROT_READ | VM_PROT_EXECUTE), + PMAP_ENTER_NOSLEEP | PMAP_ENTER_QUICK_LOCKED, psind); + if (psind == 1) + m = &m[HPT_SP_SIZE / PAGE_SIZE - 1]; m = TAILQ_NEXT(m, listq); } } @@ -1755,6 +1964,27 @@ moea64_init() NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE); + /* + * Are large page mappings enabled? + */ + TUNABLE_INT_FETCH("vm.pmap.superpages_enabled", &superpages_enabled); + if (superpages_enabled) { + KASSERT(MAXPAGESIZES > 1 && pagesizes[1] == 0, + ("moea64_init: can't assign to pagesizes[1]")); + + if (moea64_large_page_size == 0) { + printf("mmu_oea64: HW does not support large pages. " + "Disabling superpages...\n"); + superpages_enabled = 0; + } else if (!moea64_has_lp_4k_16m) { + printf("mmu_oea64: " + "HW does not support mixed 4KB/16MB page sizes. " + "Disabling superpages...\n"); + superpages_enabled = 0; + } else + pagesizes[1] = HPT_SP_SIZE; + } + if (!hw_direct_map) { uma_zone_set_allocf(moea64_pvo_zone, moea64_uma_page_alloc); } @@ -1834,7 +2064,7 @@ moea64_remove_write(vm_page_t m) vm_page_assert_busied(m); if (!pmap_page_is_write_mapped(m)) - return + return; powerpc_sync(); PV_PAGE_LOCK(m); @@ -1844,6 +2074,11 @@ moea64_remove_write(vm_page_t m) PMAP_LOCK(pmap); if (!(pvo->pvo_vaddr & PVO_DEAD) && (pvo->pvo_pte.prot & VM_PROT_WRITE)) { + if (PVO_IS_SP(pvo)) { + CTR1(KTR_PMAP, "%s: demote before remwr", + __func__); + moea64_sp_demote(pvo); + } pvo->pvo_pte.prot &= ~VM_PROT_WRITE; ret = moea64_pte_replace(pvo, MOEA64_PTE_PROT_UPDATE); if (ret < 0) @@ -1892,6 +2127,9 @@ moea64_page_set_memattr(vm_page_t m, vm_memattr_t ma) pmap_t pmap; uint64_t lo; + CTR3(KTR_PMAP, "%s: pa=%#jx, ma=%#x", + __func__, (uintmax_t)VM_PAGE_TO_PHYS(m), ma); + if ((m->oflags & VPO_UNMANAGED) != 0) { m->md.mdpg_cache_attrs = ma; return; @@ -1904,6 +2142,11 @@ moea64_page_set_memattr(vm_page_t m, vm_memattr_t ma) pmap = pvo->pvo_pmap; PMAP_LOCK(pmap); if (!(pvo->pvo_vaddr & PVO_DEAD)) { + if (PVO_IS_SP(pvo)) { + CTR1(KTR_PMAP, + "%s: demote before set_memattr", __func__); + moea64_sp_demote(pvo); + } pvo->pvo_pte.pa &= ~LPTE_WIMG; pvo->pvo_pte.pa |= lo; refchg = moea64_pte_replace(pvo, MOEA64_PTE_INVALIDATE); @@ -2356,7 +2599,7 @@ void moea64_protect(pmap_t pm, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) { - struct pvo_entry *pvo, *tpvo, key; + struct pvo_entry *pvo, key; CTR4(KTR_PMAP, "moea64_protect: pm=%p sva=%#x eva=%#x prot=%#x", pm, sva, eva, prot); @@ -2372,8 +2615,18 @@ moea64_protect(pmap_t pm, vm_offset_t sva, vm_offset_t PMAP_LOCK(pm); key.pvo_vaddr = sva; for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); - pvo != NULL && PVO_VADDR(pvo) < eva; pvo = tpvo) { - tpvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo); + pvo != NULL && PVO_VADDR(pvo) < eva; + pvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo)) { + if (PVO_IS_SP(pvo)) { + if (moea64_sp_pvo_in_range(pvo, sva, eva)) { + pvo = moea64_sp_protect(pvo, prot); + continue; + } else { + CTR1(KTR_PMAP, "%s: demote before protect", + __func__); + moea64_sp_demote(pvo); + } + } moea64_pvo_protect(pm, pvo, prot); } PMAP_UNLOCK(pm); @@ -2473,13 +2726,46 @@ moea64_remove_pages(pmap_t pm) } } +static void +moea64_remove_locked(pmap_t pm, vm_offset_t sva, vm_offset_t eva, + struct pvo_dlist *tofree) +{ + struct pvo_entry *pvo, *tpvo, key; + + PMAP_LOCK_ASSERT(pm, MA_OWNED); + + key.pvo_vaddr = sva; + for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); + pvo != NULL && PVO_VADDR(pvo) < eva; pvo = tpvo) { + if (PVO_IS_SP(pvo)) { + if (moea64_sp_pvo_in_range(pvo, sva, eva)) { + tpvo = moea64_sp_remove(pvo, tofree); + continue; + } else { + CTR1(KTR_PMAP, "%s: demote before remove", + __func__); + moea64_sp_demote(pvo); + } + } + tpvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo); + + /* + * For locking reasons, remove this from the page table and + * pmap, but save delinking from the vm_page for a second + * pass + */ + moea64_pvo_remove_from_pmap(pvo); + SLIST_INSERT_HEAD(tofree, pvo, pvo_dlink); + } +} + /* * Remove the given range of addresses from the specified map. */ void moea64_remove(pmap_t pm, vm_offset_t sva, vm_offset_t eva) { - struct pvo_entry *pvo, *tpvo, key; + struct pvo_entry *pvo; struct pvo_dlist tofree; /* @@ -2488,23 +2774,9 @@ moea64_remove(pmap_t pm, vm_offset_t sva, vm_offset_t if (pm->pm_stats.resident_count == 0) return; - key.pvo_vaddr = sva; - SLIST_INIT(&tofree); - PMAP_LOCK(pm); - for (pvo = RB_NFIND(pvo_tree, &pm->pmap_pvo, &key); - pvo != NULL && PVO_VADDR(pvo) < eva; pvo = tpvo) { - tpvo = RB_NEXT(pvo_tree, &pm->pmap_pvo, pvo); - - /* - * For locking reasons, remove this from the page table and - * pmap, but save delinking from the vm_page for a second - * pass - */ - moea64_pvo_remove_from_pmap(pvo); - SLIST_INSERT_HEAD(&tofree, pvo, pvo_dlink); - } + moea64_remove_locked(pm, sva, eva, &tofree); PMAP_UNLOCK(pm); while (!SLIST_EMPTY(&tofree)) { @@ -2534,8 +2806,14 @@ moea64_remove_all(vm_page_t m) pmap = pvo->pvo_pmap; PMAP_LOCK(pmap); wasdead = (pvo->pvo_vaddr & PVO_DEAD); - if (!wasdead) + if (!wasdead) { + if (PVO_IS_SP(pvo)) { + CTR1(KTR_PMAP, "%s: demote before remove_all", + __func__); + moea64_sp_demote(pvo); + } moea64_pvo_remove_from_pmap(pvo); + } moea64_pvo_remove_from_page_locked(pvo, m); if (!wasdead) LIST_INSERT_HEAD(&freequeue, pvo, pvo_vlink); @@ -2768,11 +3046,17 @@ moea64_query_bit(vm_page_t m, uint64_t ptebit) struct pvo_entry *pvo; int64_t ret; boolean_t rv; + vm_page_t sp; /* * See if this bit is stored in the page already. + * + * For superpages, the bit is stored in the first vm page. */ - if (m->md.mdpg_attrs & ptebit) + if ((m->md.mdpg_attrs & ptebit) != 0 || + ((sp = PHYS_TO_VM_PAGE(VM_PAGE_TO_PHYS(m) & ~HPT_SP_MASK)) != NULL && + (sp->md.mdpg_attrs & (ptebit | MDPG_ATTR_SP)) == + (ptebit | MDPG_ATTR_SP))) return (TRUE); /* @@ -2783,6 +3067,21 @@ moea64_query_bit(vm_page_t m, uint64_t ptebit) powerpc_sync(); PV_PAGE_LOCK(m); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { + if (PVO_IS_SP(pvo)) { + ret = moea64_sp_query(pvo, ptebit); + /* + * If SP was not demoted, check its REF/CHG bits here. + */ + if (ret != -1) { + if ((ret & ptebit) != 0) { + rv = TRUE; + break; + } + continue; + } + /* else, fallthrough */ + } + ret = 0; /* @@ -2828,6 +3127,12 @@ moea64_clear_bit(vm_page_t m, u_int64_t ptebit) count = 0; PV_PAGE_LOCK(m); LIST_FOREACH(pvo, vm_page_to_pvoh(m), pvo_vlink) { + if (PVO_IS_SP(pvo)) { + if ((ret = moea64_sp_clear(pvo, m, ptebit)) != -1) { + count += ret; + continue; + } + } ret = 0; PMAP_LOCK(pvo->pvo_pmap); @@ -3231,3 +3536,770 @@ DEFINE_OEA64_IFUNC(int64_t, pte_unset, (struct pvo_ent DEFINE_OEA64_IFUNC(int64_t, pte_clear, (struct pvo_entry *, uint64_t), moea64_null_method) DEFINE_OEA64_IFUNC(int64_t, pte_synch, (struct pvo_entry *), moea64_null_method) +DEFINE_OEA64_IFUNC(int64_t, pte_insert_sp, (struct pvo_entry *), moea64_null_method) +DEFINE_OEA64_IFUNC(int64_t, pte_unset_sp, (struct pvo_entry *), moea64_null_method) +DEFINE_OEA64_IFUNC(int64_t, pte_replace_sp, (struct pvo_entry *), moea64_null_method) + +/* Superpage functions */ + +/* MMU interface */ + +static bool +moea64_ps_enabled(pmap_t pmap) +{ + return (superpages_enabled); +} + +static void +moea64_align_superpage(vm_object_t object, vm_ooffset_t offset, + vm_offset_t *addr, vm_size_t size) +{ + vm_offset_t sp_offset; + + if (size < HPT_SP_SIZE) + return; + + CTR4(KTR_PMAP, "%s: offs=%#jx, addr=%p, size=%#jx", + __func__, (uintmax_t)offset, addr, (uintmax_t)size); + + if (object != NULL && (object->flags & OBJ_COLORED) != 0) + offset += ptoa(object->pg_color); + sp_offset = offset & HPT_SP_MASK; + if (size - ((HPT_SP_SIZE - sp_offset) & HPT_SP_MASK) < HPT_SP_SIZE || + (*addr & HPT_SP_MASK) == sp_offset) + return; + if ((*addr & HPT_SP_MASK) < sp_offset) + *addr = (*addr & ~HPT_SP_MASK) + sp_offset; + else + *addr = ((*addr + HPT_SP_MASK) & ~HPT_SP_MASK) + sp_offset; +} + +/* Helpers */ + +static __inline void +moea64_pvo_cleanup(struct pvo_dlist *tofree) +{ + struct pvo_entry *pvo; + + /* clean up */ + while (!SLIST_EMPTY(tofree)) { + pvo = SLIST_FIRST(tofree); + SLIST_REMOVE_HEAD(tofree, pvo_dlink); + if (pvo->pvo_vaddr & PVO_DEAD) + moea64_pvo_remove_from_page(pvo); + free_pvo_entry(pvo); + } +} + +static __inline uint16_t +pvo_to_vmpage_flags(struct pvo_entry *pvo) +{ + uint16_t flags; + + flags = 0; + if ((pvo->pvo_pte.prot & VM_PROT_WRITE) != 0) + flags |= PGA_WRITEABLE; + if ((pvo->pvo_pte.prot & VM_PROT_EXECUTE) != 0) + flags |= PGA_EXECUTABLE; + + return (flags); +} + +/* + * Check if the given pvo and its superpage are in sva-eva range. + */ +static __inline bool +moea64_sp_pvo_in_range(struct pvo_entry *pvo, vm_offset_t sva, vm_offset_t eva) +{ + vm_offset_t spva; + + spva = PVO_VADDR(pvo) & ~HPT_SP_MASK; + if (spva >= sva && spva + HPT_SP_SIZE <= eva) { + /* + * Because this function is intended to be called from loops + * that iterate over ordered pvo entries, if the condition + * above is true then the pvo must be the first of its + * superpage. + */ + KASSERT(PVO_VADDR(pvo) == spva, + ("%s: unexpected unaligned superpage pvo", __func__)); + return (true); + } + return (false); +} + +/* + * Update vm about the REF/CHG bits if the superpage is managed and + * has (or had) write access. + */ +static void +moea64_sp_refchg_process(struct pvo_entry *sp, vm_page_t m, + int64_t sp_refchg, vm_prot_t prot) +{ + vm_page_t m_end; + int64_t refchg; + + if ((sp->pvo_vaddr & PVO_MANAGED) != 0 && (prot & VM_PROT_WRITE) != 0) { + for (m_end = &m[HPT_SP_PAGES]; m < m_end; m++) { + refchg = sp_refchg | + atomic_readandclear_32(&m->md.mdpg_attrs); + if (refchg & LPTE_CHG) + vm_page_dirty(m); + if (refchg & LPTE_REF) + vm_page_aflag_set(m, PGA_REFERENCED); + } + } +} + +/* Superpage ops */ + +static int +moea64_sp_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, + vm_prot_t prot, u_int flags, int8_t psind) +{ + struct pvo_entry *pvo, **pvos; + struct pvo_head *pvo_head; + vm_offset_t sva; + vm_page_t sm; + vm_paddr_t pa, spa; + bool sync; + struct pvo_dlist tofree; + int error, i; + uint16_t aflags; + + KASSERT((va & HPT_SP_MASK) == 0, ("%s: va %#jx unaligned", + __func__, (uintmax_t)va)); + KASSERT(psind == 1, ("%s: invalid psind: %d", __func__, psind)); + KASSERT(m->psind == 1, ("%s: invalid m->psind: %d", + __func__, m->psind)); + KASSERT(pmap != kernel_pmap, + ("%s: function called with kernel pmap", __func__)); + + CTR5(KTR_PMAP, "%s: va=%#jx, pa=%#jx, prot=%#x, flags=%#x, psind=1", + __func__, (uintmax_t)va, (uintmax_t)VM_PAGE_TO_PHYS(m), + prot, flags); + + SLIST_INIT(&tofree); + + sva = va; + sm = m; + spa = pa = VM_PAGE_TO_PHYS(sm); + + /* Try to allocate all PVOs first, to make failure handling easier. */ + pvos = malloc(HPT_SP_PAGES * sizeof(struct pvo_entry *), M_TEMP, + M_NOWAIT); + if (pvos == NULL) { + CTR1(KTR_PMAP, "%s: failed to alloc pvo array", __func__); + return (KERN_RESOURCE_SHORTAGE); + } + + for (i = 0; i < HPT_SP_PAGES; i++) { + pvos[i] = alloc_pvo_entry(0); + if (pvos[i] == NULL) { + CTR1(KTR_PMAP, "%s: failed to alloc pvo", __func__); + for (i = i - 1; i >= 0; i--) + free_pvo_entry(pvos[i]); + free(pvos, M_TEMP); + return (KERN_RESOURCE_SHORTAGE); + } + } + + SP_PV_LOCK_ALIGNED(spa); + PMAP_LOCK(pmap); + + /* Note: moea64_remove_locked() also clears cached REF/CHG bits. */ + moea64_remove_locked(pmap, va, va + HPT_SP_SIZE, &tofree); + + /* Enter pages */ + for (i = 0; i < HPT_SP_PAGES; + i++, va += PAGE_SIZE, pa += PAGE_SIZE, m++) { + pvo = pvos[i]; + + pvo->pvo_pte.prot = prot; + pvo->pvo_pte.pa = (pa & ~LPTE_LP_MASK) | LPTE_LP_4K_16M | + moea64_calc_wimg(pa, pmap_page_get_memattr(m)); + + if ((flags & PMAP_ENTER_WIRED) != 0) + pvo->pvo_vaddr |= PVO_WIRED; + pvo->pvo_vaddr |= PVO_LARGE; + + if ((m->oflags & VPO_UNMANAGED) != 0) + pvo_head = NULL; + else { + pvo_head = &m->md.mdpg_pvoh; + pvo->pvo_vaddr |= PVO_MANAGED; + } + + init_pvo_entry(pvo, pmap, va); + + error = moea64_pvo_enter(pvo, pvo_head, NULL); + /* + * All superpage PVOs were previously removed, so no errors + * should occur while inserting the new ones. + */ + KASSERT(error == 0, ("%s: unexpected error " + "when inserting superpage PVO: %d", + __func__, error)); + } + + PMAP_UNLOCK(pmap); + SP_PV_UNLOCK_ALIGNED(spa); + + sync = (sm->a.flags & PGA_EXECUTABLE) == 0; + /* Note: moea64_pvo_cleanup() also clears page prot. flags. */ + moea64_pvo_cleanup(&tofree); + pvo = pvos[0]; + + /* Set vm page flags */ + aflags = pvo_to_vmpage_flags(pvo); + if (aflags != 0) + for (m = sm; m < &sm[HPT_SP_PAGES]; m++) + vm_page_aflag_set(m, aflags); + + /* + * Flush the page from the instruction cache if this page is + * mapped executable and cacheable. + */ + if (sync && (pvo->pvo_pte.pa & (LPTE_I | LPTE_G | LPTE_NOEXEC)) == 0) + moea64_syncicache(pmap, sva, spa, HPT_SP_SIZE); + + atomic_add_long(&sp_mappings, 1); + CTR3(KTR_PMAP, "%s: SP success for va %#jx in pmap %p", + __func__, (uintmax_t)sva, pmap); + + free(pvos, M_TEMP); + return (KERN_SUCCESS); +} + +static void +moea64_sp_promote(pmap_t pmap, vm_offset_t va, vm_page_t m) +{ + struct pvo_entry *first, *pvo; + vm_paddr_t pa, pa_end; + vm_offset_t sva, va_end; + int64_t sp_refchg; + + /* This CTR may generate a lot of output. */ + /* CTR2(KTR_PMAP, "%s: va=%#jx", __func__, (uintmax_t)va); */ + + va &= ~HPT_SP_MASK; + sva = va; + /* Get superpage */ + pa = VM_PAGE_TO_PHYS(m) & ~HPT_SP_MASK; + m = PHYS_TO_VM_PAGE(pa); + + PMAP_LOCK(pmap); + + /* + * Check if all pages meet promotion criteria. + * + * XXX In some cases the loop below may be executed for each or most + * of the entered pages of a superpage, which can be expensive + * (although it was not profiled) and need some optimization. + * + * Some cases where this seems to happen are: + * - When a superpage is first entered read-only and later becomes + * read-write. + * - When some of the superpage's virtual addresses map to previously + * wired/cached pages while others map to pages allocated from a + * different physical address range. A common scenario where this + * happens is when mmap'ing a file that is already present in FS + * block cache and doesn't fill a superpage. + */ + first = pvo = moea64_pvo_find_va(pmap, sva); + for (pa_end = pa + HPT_SP_SIZE; + pa < pa_end; pa += PAGE_SIZE, va += PAGE_SIZE) { + if (pvo == NULL || (pvo->pvo_vaddr & PVO_DEAD) != 0) { + CTR3(KTR_PMAP, + "%s: NULL or dead PVO: pmap=%p, va=%#jx", + __func__, pmap, (uintmax_t)va); + goto error; + } + if (PVO_PADDR(pvo) != pa) { + CTR5(KTR_PMAP, "%s: PAs don't match: " + "pmap=%p, va=%#jx, pvo_pa=%#jx, exp_pa=%#jx", + __func__, pmap, (uintmax_t)va, + (uintmax_t)PVO_PADDR(pvo), (uintmax_t)pa); + atomic_add_long(&sp_p_fail_pa, 1); + goto error; + } + if ((first->pvo_vaddr & PVO_FLAGS_PROMOTE) != + (pvo->pvo_vaddr & PVO_FLAGS_PROMOTE)) { + CTR5(KTR_PMAP, "%s: PVO flags don't match: " + "pmap=%p, va=%#jx, pvo_flags=%#jx, exp_flags=%#jx", + __func__, pmap, (uintmax_t)va, + (uintmax_t)(pvo->pvo_vaddr & PVO_FLAGS_PROMOTE), + (uintmax_t)(first->pvo_vaddr & PVO_FLAGS_PROMOTE)); + atomic_add_long(&sp_p_fail_flags, 1); + goto error; + } + if (first->pvo_pte.prot != pvo->pvo_pte.prot) { + CTR5(KTR_PMAP, "%s: PVO protections don't match: " + "pmap=%p, va=%#jx, pvo_prot=%#x, exp_prot=%#x", + __func__, pmap, (uintmax_t)va, + pvo->pvo_pte.prot, first->pvo_pte.prot); + atomic_add_long(&sp_p_fail_prot, 1); + goto error; + } + if ((first->pvo_pte.pa & LPTE_WIMG) != + (pvo->pvo_pte.pa & LPTE_WIMG)) { + CTR5(KTR_PMAP, "%s: WIMG bits don't match: " + "pmap=%p, va=%#jx, pvo_wimg=%#jx, exp_wimg=%#jx", + __func__, pmap, (uintmax_t)va, + (uintmax_t)(pvo->pvo_pte.pa & LPTE_WIMG), + (uintmax_t)(first->pvo_pte.pa & LPTE_WIMG)); + atomic_add_long(&sp_p_fail_wimg, 1); + goto error; + } + + pvo = RB_NEXT(pvo_tree, &pmap->pmap_pvo, pvo); + } + + /* All OK, promote. */ + + /* + * Handle superpage REF/CHG bits. If REF or CHG is set in + * any page, then it must be set in the superpage. + * + * Instead of querying each page, we take advantage of two facts: + * 1- If a page is being promoted, it was referenced. + * 2- If promoted pages are writable, they were modified. + */ + sp_refchg = LPTE_REF | + ((first->pvo_pte.prot & VM_PROT_WRITE) != 0 ? LPTE_CHG : 0); + + /* Promote pages */ + + for (pvo = first, va_end = PVO_VADDR(pvo) + HPT_SP_SIZE; + pvo != NULL && PVO_VADDR(pvo) < va_end; + pvo = RB_NEXT(pvo_tree, &pmap->pmap_pvo, pvo)) { + pvo->pvo_pte.pa &= ~LPTE_LP_MASK; + pvo->pvo_pte.pa |= LPTE_LP_4K_16M; + pvo->pvo_vaddr |= PVO_LARGE; + } + moea64_pte_replace_sp(first); + + /* Send REF/CHG bits to VM */ + moea64_sp_refchg_process(first, m, sp_refchg, first->pvo_pte.prot); + + /* Use first page to cache REF/CHG bits */ + atomic_set_32(&m->md.mdpg_attrs, sp_refchg | MDPG_ATTR_SP); + + PMAP_UNLOCK(pmap); + + atomic_add_long(&sp_mappings, 1); + atomic_add_long(&sp_promotions, 1); + CTR3(KTR_PMAP, "%s: success for va %#jx in pmap %p", + __func__, (uintmax_t)sva, pmap); + return; + +error: + atomic_add_long(&sp_p_failures, 1); + PMAP_UNLOCK(pmap); +} + +static void +moea64_sp_demote_aligned(struct pvo_entry *sp) +{ + struct pvo_entry *pvo; + vm_offset_t va, va_end; + vm_paddr_t pa; + vm_page_t m; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Nov 6 15:21:54 2020 Return-Path: Delivered-To: svn-src-head@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 6230A441350; Fri, 6 Nov 2020 15:21:54 +0000 (UTC) (envelope-from manu@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 4CSPJ22R47z3tM9; Fri, 6 Nov 2020 15:21:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 466A626DF5; Fri, 6 Nov 2020 15:21:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6FLsD6049870; Fri, 6 Nov 2020 15:21:54 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6FLs6G049869; Fri, 6 Nov 2020 15:21:54 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011061521.0A6FLs6G049869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 6 Nov 2020 15:21:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367418 - head/release/packages X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/release/packages X-SVN-Commit-Revision: 367418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 15:21:54 -0000 Author: manu Date: Fri Nov 6 15:21:53 2020 New Revision: 367418 URL: https://svnweb.freebsd.org/changeset/base/367418 Log: pkgbase: Remove %VCS_REVISION% from utilities comments We don't do that on other packages so be consistent. It also don't work when building from git. Modified: head/release/packages/utilities.ucl Modified: head/release/packages/utilities.ucl ============================================================================== --- head/release/packages/utilities.ucl Fri Nov 6 14:12:45 2020 (r367417) +++ head/release/packages/utilities.ucl Fri Nov 6 15:21:53 2020 (r367418) @@ -5,7 +5,7 @@ name = "%PKG_NAME_PREFIX%-%PKGNAME%" origin = "base" version = "%VERSION%" -comment = "%COMMENT% %VCS_REVISION%" +comment = "%COMMENT%" categories = [ base ] maintainer = "%PKG_MAINTAINER%" www = "%PKG_WWW%" From owner-svn-src-head@freebsd.org Fri Nov 6 15:38:52 2020 Return-Path: Delivered-To: svn-src-head@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 672A64418BD; Fri, 6 Nov 2020 15:38:52 +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 4CSPgc25Zmz3vJC; Fri, 6 Nov 2020 15:38:52 +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 3AF2327359; Fri, 6 Nov 2020 15:38:52 +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 0A6Fcqvx057986; Fri, 6 Nov 2020 15:38:52 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6FcqsX057985; Fri, 6 Nov 2020 15:38:52 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011061538.0A6FcqsX057985@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: Fri, 6 Nov 2020 15:38:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367419 - head/sbin/mdconfig X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sbin/mdconfig X-SVN-Commit-Revision: 367419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 15:38:52 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 6 15:38:51 2020 New Revision: 367419 URL: https://svnweb.freebsd.org/changeset/base/367419 Log: Fix a typo and remove Xr's to vn(4) and vnconfig(4) "mandoc -Tlint" complained about the Xr to vnconfig, which was removed in r238202. I am not sure but maybe it's time to do the same to vn(4). MFC after: 2 weeks Modified: head/sbin/mdconfig/mdconfig.8 Modified: head/sbin/mdconfig/mdconfig.8 ============================================================================== --- head/sbin/mdconfig/mdconfig.8 Fri Nov 6 15:21:53 2020 (r367418) +++ head/sbin/mdconfig/mdconfig.8 Fri Nov 6 15:38:51 2020 (r367419) @@ -37,7 +37,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2018 +.Dd November 6, 2020 .Dt MDCONFIG 8 .Os .Sh NAME @@ -261,7 +261,7 @@ checksums or cryptographic signatures. Request a specific unit number or device name for the .Xr md 4 device instead of automatic allocation. -If a device name is specified, it must be start with +If a device name is specified, it must start with .Dq md followed by the unit number. .El @@ -350,11 +350,8 @@ The .Nm utility first appeared in .Fx 5.0 -as a cleaner replacement for the -.Xr vn 4 -and -.Xr vnconfig 8 -combo. +as a cleaner replacement for the vn kernel module +and the vnconfig utility combo. .Sh AUTHORS The .Nm From owner-svn-src-head@freebsd.org Fri Nov 6 15:46:06 2020 Return-Path: Delivered-To: svn-src-head@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 40AE34416FB; Fri, 6 Nov 2020 15:46:06 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 4CSPqx1KCfz3w9S; Fri, 6 Nov 2020 15:46:04 +0000 (UTC) (envelope-from mpp302@gmail.com) Received: by mail-ej1-f52.google.com with SMTP id i19so2536656ejx.9; Fri, 06 Nov 2020 07:46:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=MVWB2N7VWkUeawCrileexRZ8WIHE/Cv+HtRuQh8gPYQ=; b=IFa/k2L8LEuXWzsK7RraU+RXXiwJc3uL/CA6+31qG0Qb3xKF5rTgp1Fc7wv4zFyQmA wYb8cKdfw97giHh9Lg5arFWBpDdc7a3zgwbBgVD5D+Z0Cg/i36Wc/PxWD8urzzSwMUws I7eZdyukSCMuUo/i8D+2dZFTdyTzW7B/g5/wzPrjWjx3BNRo/Ff3DGuESgdZBnnmqkop 02uYQozyOVJ4NsMDWY7XkTu9W7xHCtWQpBcD5BmUkMmtqmP3kq54Jp6QXWbwyZcWa9dx xMqi9wTF4P0PreT8AQH5o47CBx53++5eGuiuhQNgKjSxM4z52IRyu10jclRtamcV3ViI rA0A== X-Gm-Message-State: AOAM531sr+oGYl6wLAgvMUqZokcGIiJJoc9bLNoU7QD7vfpXu5XgOP/7 UxB9lWvZ50r3S2Z8B3sXEPWRmY3Dlao= X-Google-Smtp-Source: ABdhPJyMLefVszKcC7JNeTlfPocbVcKTLffQ61DAWUve5Pg6Tw3IxYFH3hJgYrFOhwxcuS9DBYABhA== X-Received: by 2002:a17:906:7805:: with SMTP id u5mr2720431ejm.379.1604677562920; Fri, 06 Nov 2020 07:46:02 -0800 (PST) Received: from ?IPv6:2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8? ([2a02:8109:98c0:1bc0:5e5f:67ff:fef4:ffd8]) by smtp.gmail.com with ESMTPSA id e19sm1173934ejz.35.2020.11.06.07.46.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Nov 2020 07:46:02 -0800 (PST) Subject: Re: svn commit: r367419 - head/sbin/mdconfig From: Mateusz Piotrowski <0mp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011061538.0A6FcqsX057985@repo.freebsd.org> Message-ID: Date: Fri, 6 Nov 2020 16:46:01 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <202011061538.0A6FcqsX057985@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4CSPqx1KCfz3w9S X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of mpp302@gmail.com designates 209.85.218.52 as permitted sender) smtp.mailfrom=mpp302@gmail.com X-Spamd-Result: default: False [-1.26 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[FreeBSD.org]; RWL_MAILSPIKE_GOOD(0.00)[209.85.218.52:from]; MID_RHS_MATCH_FROM(0.00)[]; SPAMHAUS_ZRD(0.00)[209.85.218.52:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; NEURAL_HAM_MEDIUM(-0.99)[-0.994]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.218.52:from]; NEURAL_HAM_SHORT(-0.27)[-0.269]; RCVD_IN_DNSWL_NONE(0.00)[209.85.218.52:from]; FORGED_SENDER(0.30)[0mp@FreeBSD.org,mpp302@gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; MIME_TRACE(0.00)[0:+]; FROM_NEQ_ENVFROM(0.00)[0mp@FreeBSD.org,mpp302@gmail.com]; MAILMAN_DEST(0.00)[svn-src-head,svn-src-all] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 15:46:06 -0000 On 11/6/20 4:38 PM, Mateusz Piotrowski wrote: > Author: 0mp (doc,ports committer) > Date: Fri Nov 6 15:38:51 2020 > New Revision: 367419 > URL: https://svnweb.freebsd.org/changeset/base/367419 > > Log: > Fix a typo and remove Xr's to vn(4) and vnconfig(4) > > "mandoc -Tlint" complained about the Xr to vnconfig, which was removed in > r238202. I am not sure but maybe it's time to do the same to vn(4). I've submitted a patch to Phabricator: https://reviews.freebsd.org/D27122 Cheers, Mateusz From owner-svn-src-head@freebsd.org Fri Nov 6 15:55:14 2020 Return-Path: Delivered-To: svn-src-head@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 28D434421CB; Fri, 6 Nov 2020 15:55:14 +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 4CSQ2V0hVbz4Qlh; Fri, 6 Nov 2020 15:55:14 +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 0AA02276D8; Fri, 6 Nov 2020 15:55:14 +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 0A6FtDnq070180; Fri, 6 Nov 2020 15:55:13 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6FtDXc070179; Fri, 6 Nov 2020 15:55:13 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202011061555.0A6FtDXc070179@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: Fri, 6 Nov 2020 15:55:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367420 - head/sbin/mdconfig X-SVN-Group: head X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: head/sbin/mdconfig X-SVN-Commit-Revision: 367420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 15:55:14 -0000 Author: 0mp (doc,ports committer) Date: Fri Nov 6 15:55:13 2020 New Revision: 367420 URL: https://svnweb.freebsd.org/changeset/base/367420 Log: Use Cm macros instead of Ar when referring to a specific memory disk type MFC after: 3 days Modified: head/sbin/mdconfig/mdconfig.8 Modified: head/sbin/mdconfig/mdconfig.8 ============================================================================== --- head/sbin/mdconfig/mdconfig.8 Fri Nov 6 15:38:51 2020 (r367419) +++ head/sbin/mdconfig/mdconfig.8 Fri Nov 6 15:55:13 2020 (r367420) @@ -127,7 +127,7 @@ Filename to use for the vnode type memory disk. The .Fl a and -.Fl t Ar vnode +.Fl t Cm vnode options are implied if not specified. .It Fl l List configured devices. @@ -170,7 +170,7 @@ When used without the option, the .Fl a and -.Fl t Ar swap +.Fl t Cm swap options are implied if not specified. .It Fl S Ar sectorsize Sectorsize to use for the memory disk, in bytes. @@ -272,7 +272,7 @@ The last form, is provided for convenience as an abbreviation of .Nm .Fl a -.Fl t Ar vnode +.Fl t Cm vnode .Fl f Ar file . .Sh EXAMPLES Create a disk with From owner-svn-src-head@freebsd.org Fri Nov 6 16:12:07 2020 Return-Path: Delivered-To: svn-src-head@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 63D7D442732; Fri, 6 Nov 2020 16:12:07 +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 4CSQPz2RnLz4S7l; Fri, 6 Nov 2020 16:12:07 +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 46C9127AA4; Fri, 6 Nov 2020 16:12:07 +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 0A6GC7L8081119; Fri, 6 Nov 2020 16:12:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6GC7MO081118; Fri, 6 Nov 2020 16:12:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011061612.0A6GC7MO081118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Nov 2020 16:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367422 - head/sys/contrib/dev/qat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/contrib/dev/qat X-SVN-Commit-Revision: 367422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 16:12:07 -0000 Author: markj Date: Fri Nov 6 16:12:06 2020 New Revision: 367422 URL: https://svnweb.freebsd.org/changeset/base/367422 Log: Add firmware modules for qat(4), take two My script to convert git commits to svn patch does not handle binary files correctly, and r367387 committed a set of empty files as a result. MFC with: r367387 Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/contrib/dev/qat/mmp_firmware_c2xxx.bin (contents, props changed) head/sys/contrib/dev/qat/mof_firmware_c2xxx.bin (contents, props changed) head/sys/contrib/dev/qat/qat_895xcc.bin (contents, props changed) head/sys/contrib/dev/qat/qat_895xcc_mmp.bin (contents, props changed) head/sys/contrib/dev/qat/qat_c3xxx.bin (contents, props changed) head/sys/contrib/dev/qat/qat_c3xxx_mmp.bin (contents, props changed) head/sys/contrib/dev/qat/qat_c62x.bin (contents, props changed) head/sys/contrib/dev/qat/qat_c62x_mmp.bin (contents, props changed) head/sys/contrib/dev/qat/qat_d15xx.bin (contents, props changed) head/sys/contrib/dev/qat/qat_d15xx_mmp.bin (contents, props changed) Modified: head/sys/contrib/dev/qat/mmp_firmware_c2xxx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/mof_firmware_c2xxx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_895xcc.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_895xcc_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_c3xxx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_c3xxx_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_c62x.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_c62x_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_d15xx.bin ============================================================================== Binary file (source and/or target). No diff available. Modified: head/sys/contrib/dev/qat/qat_d15xx_mmp.bin ============================================================================== Binary file (source and/or target). No diff available. From owner-svn-src-head@freebsd.org Fri Nov 6 16:33:43 2020 Return-Path: Delivered-To: svn-src-head@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 DFD1C44204A; Fri, 6 Nov 2020 16:33:43 +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 4CSQtv5zVsz4T4Z; Fri, 6 Nov 2020 16:33:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C03D327F1F; Fri, 6 Nov 2020 16:33:43 +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 0A6GXh2K094882; Fri, 6 Nov 2020 16:33:43 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6GXhRB094880; Fri, 6 Nov 2020 16:33:43 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202011061633.0A6GXhRB094880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 6 Nov 2020 16:33:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367423 - in head/libexec/rc: . rc.d X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: in head/libexec/rc: . rc.d X-SVN-Commit-Revision: 367423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 16:33:43 -0000 Author: rmacklem Date: Fri Nov 6 16:33:42 2020 New Revision: 367423 URL: https://svnweb.freebsd.org/changeset/base/367423 Log: Add support for the new mountd -R option. r376026 added a new "-R" option to mountd, which tells it to not support the Mount protocol (not used by NFSv4) and not register with rpcbind. Rpcbind is considered a security issue by some sites now. This patch adds a new yes/no variable called nfsv4_server_only. When that is set, make vfs.nfsd.server_min_vers=4 and set "=R" for mountd. Setting vfs.nfsd.server_min_vers=4 tells nfsd to not register with rpcbind. While here, add a check for "load_kld nfsd" failing to nfsd. Reviewed by: 0mp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26938 Modified: head/libexec/rc/rc.conf head/libexec/rc/rc.d/mountd head/libexec/rc/rc.d/nfsd Modified: head/libexec/rc/rc.conf ============================================================================== --- head/libexec/rc/rc.conf Fri Nov 6 16:12:06 2020 (r367422) +++ head/libexec/rc/rc.conf Fri Nov 6 16:33:42 2020 (r367423) @@ -380,6 +380,7 @@ rpc_ypupdated_enable="NO" # Run if NIS master and Secu keyserv_enable="NO" # Run the SecureRPC keyserver (or NO). keyserv_flags="" # Flags to keyserv (if enabled). nfsv4_server_enable="NO" # Enable support for NFSv4 +nfsv4_server_only="NO" # Set NFS server to NFSv4 only nfscbd_enable="NO" # NFSv4 client side callback daemon nfscbd_flags="" # Flags for nfscbd nfsuserd_enable="NO" # NFSv4 user/group name mapping daemon Modified: head/libexec/rc/rc.d/mountd ============================================================================== --- head/libexec/rc/rc.d/mountd Fri Nov 6 16:12:06 2020 (r367422) +++ head/libexec/rc/rc.d/mountd Fri Nov 6 16:33:42 2020 (r367423) @@ -20,13 +20,33 @@ extra_commands="reload" mountd_precmd() { - force_depend rpcbind || return 1 + # Load the modules now, so that the vfs.nfsd sysctl + # oids are available. + load_kld nfsd || return 1 + + # Do not force rpcbind to be running for an NFSv4 only server. + # + if checkyesno nfsv4_server_only; then + echo 'NFSv4 only server' + sysctl vfs.nfsd.server_min_nfsvers=4 > /dev/null + sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null + rc_flags="${rc_flags} -R" + else + force_depend rpcbind || return 1 + fi + # mountd flags will differ depending on rc.conf settings # - if checkyesno nfs_server_enable ; then + if checkyesno nfs_server_enable || checkyesno nfsv4_server_only; then if checkyesno weak_mountd_authentication; then - rc_flags="${mountd_flags} -n" + if checkyesno nfsv4_server_only; then + echo -n 'weak_mountd_authentication ' + echo -n 'incompatible with nfsv4_server_only, ' + echo 'ignored' + else + rc_flags="${rc_flags} -n" + fi fi else if checkyesno mountd_enable; then Modified: head/libexec/rc/rc.d/nfsd ============================================================================== --- head/libexec/rc/rc.d/nfsd Fri Nov 6 16:12:06 2020 (r367422) +++ head/libexec/rc/rc.d/nfsd Fri Nov 6 16:33:42 2020 (r367423) @@ -26,7 +26,7 @@ nfsd_precmd() # Load the modules now, so that the vfs.nfsd sysctl # oids are available. - load_kld nfsd + load_kld nfsd || return 1 if checkyesno nfs_reserved_port_only; then echo 'NFS on reserved port only=YES' @@ -41,12 +41,15 @@ nfsd_precmd() if checkyesno nfsv4_server_enable; then sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null - else + elif ! checkyesno nfsv4_server_only; then echo 'NFSv4 is disabled' sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null fi - force_depend rpcbind || return 1 + if ! checkyesno nfsv4_server_only; then + force_depend rpcbind || return 1 + fi + force_depend mountd || return 1 if [ -n "${nfs_server_vhost}" ]; then command_args="-V \"${nfs_server_vhost}\"" From owner-svn-src-head@freebsd.org Fri Nov 6 18:05:29 2020 Return-Path: Delivered-To: svn-src-head@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 C1B7E44527E; Fri, 6 Nov 2020 18:05:29 +0000 (UTC) (envelope-from jhb@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 4CSSwn555lz4Z8L; Fri, 6 Nov 2020 18:05:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A169328CEF; Fri, 6 Nov 2020 18:05:29 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6I5TiJ050684; Fri, 6 Nov 2020 18:05:29 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6I5TN7050683; Fri, 6 Nov 2020 18:05:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011061805.0A6I5TN7050683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 6 Nov 2020 18:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367425 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 18:05:29 -0000 Author: jhb Date: Fri Nov 6 18:05:29 2020 New Revision: 367425 URL: https://svnweb.freebsd.org/changeset/base/367425 Log: Group session management routines together before first use. - Rename cse*() to cse_*() to more closely match other local APIs in this file. - Merge the old csecreate() into cryptodev_create_session() and rename the new function to cse_create(). Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27070 Modified: head/sys/opencrypto/cryptodev.c Modified: head/sys/opencrypto/cryptodev.c ============================================================================== --- head/sys/opencrypto/cryptodev.c Fri Nov 6 17:52:04 2020 (r367424) +++ head/sys/opencrypto/cryptodev.c Fri Nov 6 18:05:29 2020 (r367425) @@ -374,13 +374,6 @@ static struct fileops cryptofops = { .fo_fill_kinfo = cryptof_fill_kinfo, }; -static struct csession *csefind(struct fcrypt *, u_int); -static bool csedelete(struct fcrypt *, u_int); -static struct csession *csecreate(struct fcrypt *, crypto_session_t, - struct crypto_session_params *, struct enc_xform *, void *, - struct auth_hash *, void *); -static void csefree(struct csession *); - /* * Check a crypto identifier to see if it requested * a software device/driver. This can be done either @@ -409,7 +402,7 @@ checkforsoftware(int *cridp) } static int -cryptodev_create_session(struct fcrypt *fcr, struct session2_op *sop) +cse_create(struct fcrypt *fcr, struct session2_op *sop) { struct crypto_session_params csp; struct csession *cse; @@ -685,15 +678,27 @@ cryptodev_create_session(struct fcrypt *fcr, struct se goto bail; } - cse = csecreate(fcr, cses, &csp, txform, key, thash, mackey); + cse = malloc(sizeof(struct csession), M_XDATA, M_WAITOK | M_ZERO); + mtx_init(&cse->lock, "cryptodev", "crypto session lock", MTX_DEF); + refcount_init(&cse->refs, 1); + cse->key = key; + cse->mackey = mackey; + cse->mode = csp.csp_mode; + cse->cses = cses; + cse->txform = txform; + if (thash != NULL) + cse->hashsize = thash->hashsize; + else if (csp.csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) + cse->hashsize = AES_GMAC_HASH_LEN; + else if (csp.csp_cipher_alg == CRYPTO_AES_CCM_16) + cse->hashsize = AES_CBC_MAC_HASH_LEN; + cse->ivsize = csp.csp_ivlen; - if (cse == NULL) { - crypto_freesession(cses); - error = EINVAL; - SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); - CRYPTDEB("csecreate"); - goto bail; - } + mtx_lock(&fcr->lock); + TAILQ_INSERT_TAIL(&fcr->csessions, cse, next); + cse->ses = fcr->sesn++; + mtx_unlock(&fcr->lock); + sop->ses = cse->ses; /* return hardware/driver id */ @@ -706,6 +711,56 @@ bail: return (error); } +static struct csession * +cse_find(struct fcrypt *fcr, u_int ses) +{ + struct csession *cse; + + mtx_lock(&fcr->lock); + TAILQ_FOREACH(cse, &fcr->csessions, next) { + if (cse->ses == ses) { + refcount_acquire(&cse->refs); + mtx_unlock(&fcr->lock); + return (cse); + } + } + mtx_unlock(&fcr->lock); + return (NULL); +} + +static void +cse_free(struct csession *cse) +{ + + if (!refcount_release(&cse->refs)) + return; + crypto_freesession(cse->cses); + mtx_destroy(&cse->lock); + if (cse->key) + free(cse->key, M_XDATA); + if (cse->mackey) + free(cse->mackey, M_XDATA); + free(cse, M_XDATA); +} + +static bool +cse_delete(struct fcrypt *fcr, u_int ses) +{ + struct csession *cse; + + mtx_lock(&fcr->lock); + TAILQ_FOREACH(cse, &fcr->csessions, next) { + if (cse->ses == ses) { + TAILQ_REMOVE(&fcr->csessions, cse, next); + mtx_unlock(&fcr->lock); + cse_free(cse); + return (true); + } + } + mtx_unlock(&fcr->lock); + return (false); +} + static struct cryptop_data * cod_alloc(struct csession *cse, size_t aad_len, size_t len, struct thread *td) { @@ -1383,26 +1438,26 @@ cryptof_ioctl(struct file *fp, u_long cmd, void *data, } else sop = (struct session2_op *)data; - error = cryptodev_create_session(fcr, sop); + error = cse_create(fcr, sop); if (cmd == CIOCGSESSION && error == 0) session2_op_to_op(sop, data); break; case CIOCFSESSION: ses = *(uint32_t *)data; - if (!csedelete(fcr, ses)) { + if (!cse_delete(fcr, ses)) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } break; case CIOCCRYPT: cop = (struct crypt_op *)data; - cse = csefind(fcr, cop->ses); + cse = cse_find(fcr, cop->ses); if (cse == NULL) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } error = cryptodev_op(cse, cop, active_cred, td); - csefree(cse); + cse_free(cse); break; case CIOCKEY: case CIOCKEY2: @@ -1449,13 +1504,13 @@ cryptof_ioctl(struct file *fp, u_long cmd, void *data, break; case CIOCCRYPTAEAD: caead = (struct crypt_aead *)data; - cse = csefind(fcr, caead->ses); + cse = cse_find(fcr, caead->ses); if (cse == NULL) { SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); return (EINVAL); } error = cryptodev_aead(cse, caead, active_cred, td); - csefree(cse); + cse_free(cse); break; default: error = EINVAL; @@ -1511,7 +1566,7 @@ cryptof_close(struct file *fp, struct thread *td) KASSERT(cse->refs == 1, ("%s: crypto session %p with %d refs", __func__, cse, cse->refs)); - csefree(cse); + cse_free(cse); } free(fcr, M_XDATA); fp->f_data = NULL; @@ -1525,87 +1580,6 @@ cryptof_fill_kinfo(struct file *fp, struct kinfo_file kif->kf_type = KF_TYPE_CRYPTO; return (0); -} - -static struct csession * -csefind(struct fcrypt *fcr, u_int ses) -{ - struct csession *cse; - - mtx_lock(&fcr->lock); - TAILQ_FOREACH(cse, &fcr->csessions, next) { - if (cse->ses == ses) { - refcount_acquire(&cse->refs); - mtx_unlock(&fcr->lock); - return (cse); - } - } - mtx_unlock(&fcr->lock); - return (NULL); -} - -static bool -csedelete(struct fcrypt *fcr, u_int ses) -{ - struct csession *cse; - - mtx_lock(&fcr->lock); - TAILQ_FOREACH(cse, &fcr->csessions, next) { - if (cse->ses == ses) { - TAILQ_REMOVE(&fcr->csessions, cse, next); - mtx_unlock(&fcr->lock); - csefree(cse); - return (true); - } - } - mtx_unlock(&fcr->lock); - return (false); -} - -struct csession * -csecreate(struct fcrypt *fcr, crypto_session_t cses, - struct crypto_session_params *csp, struct enc_xform *txform, - void *key, struct auth_hash *thash, void *mackey) -{ - struct csession *cse; - - cse = malloc(sizeof(struct csession), M_XDATA, M_NOWAIT | M_ZERO); - if (cse == NULL) - return NULL; - mtx_init(&cse->lock, "cryptodev", "crypto session lock", MTX_DEF); - refcount_init(&cse->refs, 1); - cse->key = key; - cse->mackey = mackey; - cse->mode = csp->csp_mode; - cse->cses = cses; - cse->txform = txform; - if (thash != NULL) - cse->hashsize = thash->hashsize; - else if (csp->csp_cipher_alg == CRYPTO_AES_NIST_GCM_16) - cse->hashsize = AES_GMAC_HASH_LEN; - else if (csp->csp_cipher_alg == CRYPTO_AES_CCM_16) - cse->hashsize = AES_CBC_MAC_HASH_LEN; - cse->ivsize = csp->csp_ivlen; - mtx_lock(&fcr->lock); - TAILQ_INSERT_TAIL(&fcr->csessions, cse, next); - cse->ses = fcr->sesn++; - mtx_unlock(&fcr->lock); - return (cse); -} - -static void -csefree(struct csession *cse) -{ - - if (!refcount_release(&cse->refs)) - return; - crypto_freesession(cse->cses); - mtx_destroy(&cse->lock); - if (cse->key) - free(cse->key, M_XDATA); - if (cse->mackey) - free(cse->mackey, M_XDATA); - free(cse, M_XDATA); } static int From owner-svn-src-head@freebsd.org Fri Nov 6 18:09:53 2020 Return-Path: Delivered-To: svn-src-head@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 74C874457C3; Fri, 6 Nov 2020 18:09:53 +0000 (UTC) (envelope-from jhb@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 4CST1s2j0Kz4Z2F; Fri, 6 Nov 2020 18:09:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F84928E6C; Fri, 6 Nov 2020 18:09:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6I9rlT050915; Fri, 6 Nov 2020 18:09:53 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6I9rWF050914; Fri, 6 Nov 2020 18:09:53 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011061809.0A6I9rWF050914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 6 Nov 2020 18:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367426 - head/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/opencrypto X-SVN-Commit-Revision: 367426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 18:09:53 -0000 Author: jhb Date: Fri Nov 6 18:09:52 2020 New Revision: 367426 URL: https://svnweb.freebsd.org/changeset/base/367426 Log: Use void * in place of caddr_t. Reviewed by: markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27065 Modified: head/sys/opencrypto/cryptodev.h Modified: head/sys/opencrypto/cryptodev.h ============================================================================== --- head/sys/opencrypto/cryptodev.h Fri Nov 6 18:05:29 2020 (r367425) +++ head/sys/opencrypto/cryptodev.h Fri Nov 6 18:09:52 2020 (r367426) @@ -220,9 +220,9 @@ struct session_op { uint32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */ uint32_t keylen; /* cipher key */ - c_caddr_t key; + const void *key; int mackeylen; /* mac key */ - c_caddr_t mackey; + const void *mackey; uint32_t ses; /* returns: session # */ }; @@ -237,9 +237,9 @@ struct session2_op { uint32_t mac; /* ie. CRYPTO_SHA2_256_HMAC */ uint32_t keylen; /* cipher key */ - c_caddr_t key; + const void *key; int mackeylen; /* mac key */ - c_caddr_t mackey; + const void *mackey; uint32_t ses; /* returns: session # */ int crid; /* driver id + flags (rw) */ @@ -255,10 +255,10 @@ struct crypt_op { #define COP_F_CIPHER_FIRST 0x0001 /* Cipher before MAC. */ #define COP_F_BATCH 0x0008 /* Batch op if possible */ u_int len; - c_caddr_t src; /* become iov[] inside kernel */ - caddr_t dst; - caddr_t mac; /* must be big enough for chosen MAC */ - c_caddr_t iv; + const void *src; /* become iov[] inside kernel */ + void *dst; + void *mac; /* must be big enough for chosen MAC */ + const void *iv; }; /* op and flags the same as crypt_op */ @@ -269,11 +269,11 @@ struct crypt_aead { u_int len; u_int aadlen; u_int ivlen; - c_caddr_t src; /* become iov[] inside kernel */ - caddr_t dst; - c_caddr_t aad; /* additional authenticated data */ - caddr_t tag; /* must fit for chosen TAG length */ - c_caddr_t iv; + const void *src; /* become iov[] inside kernel */ + void *dst; + const void *aad; /* additional authenticated data */ + void *tag; /* must fit for chosen TAG length */ + const void *iv; }; /* @@ -288,7 +288,7 @@ struct crypt_find_op { /* bignum parameter, in packed bytes, ... */ struct crparam { - caddr_t crp_p; + void *crp_p; u_int crp_nbits; }; From owner-svn-src-head@freebsd.org Fri Nov 6 18:50:01 2020 Return-Path: Delivered-To: svn-src-head@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 1D3CB4465C4; Fri, 6 Nov 2020 18:50:01 +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 4CSTw90Kp1z4cVB; Fri, 6 Nov 2020 18:50:01 +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 F268B29990; Fri, 6 Nov 2020 18:50:00 +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 0A6Io0TK075581; Fri, 6 Nov 2020 18:50:00 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6Io0j5075577; Fri, 6 Nov 2020 18:50:00 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <202011061850.0A6Io0j5075577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Fri, 6 Nov 2020 18:50:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367427 - in head/sys: conf powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: in head/sys: conf powerpc/aim X-SVN-Commit-Revision: 367427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 18:50:01 -0000 Author: luporl Date: Fri Nov 6 18:50:00 2020 New Revision: 367427 URL: https://svnweb.freebsd.org/changeset/base/367427 Log: Fix powerpc and LINT builds Fix build errors introduced by r367417 and r367390: - Guard label reached only by powerpc64 - Guard vm_reserv_level_iffullpop call, that is not defined on powerpc variants that don't support superpages - Add missing hwpmc file, for when hwpmc is built into kernel Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/moea64_native.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Fri Nov 6 18:09:52 2020 (r367426) +++ head/sys/conf/files.powerpc Fri Nov 6 18:50:00 2020 (r367427) @@ -26,6 +26,7 @@ dev/agp/agp_apple.c optional agp powermac dev/fb/fb.c optional sc dev/hwpmc/hwpmc_e500.c optional hwpmc dev/hwpmc/hwpmc_mpc7xxx.c optional hwpmc +dev/hwpmc/hwpmc_power8.c optional hwpmc dev/hwpmc/hwpmc_powerpc.c optional hwpmc dev/hwpmc/hwpmc_ppc970.c optional hwpmc dev/iicbus/ad7417.c optional ad7417 powermac Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Fri Nov 6 18:09:52 2020 (r367426) +++ head/sys/powerpc/aim/mmu_oea64.c Fri Nov 6 18:50:00 2020 (r367427) @@ -1760,6 +1760,7 @@ out: moea64_syncicache(pmap, va, pa, PAGE_SIZE); } +#if VM_NRESERVLEVEL > 0 /* * Try to promote pages. * @@ -1773,6 +1774,7 @@ out: (m->flags & PG_FICTITIOUS) == 0 && vm_reserv_level_iffullpop(m) == 0) moea64_sp_promote(pmap, va, m); +#endif return (KERN_SUCCESS); } Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Fri Nov 6 18:09:52 2020 (r367426) +++ head/sys/powerpc/aim/moea64_native.c Fri Nov 6 18:50:00 2020 (r367427) @@ -211,6 +211,8 @@ TLBIE(uint64_t vpn, uint64_t oldptehi) */ __asm __volatile("li 0, 0 \n tlbie %0, 0" :: "r"(vpn) : "r0", "memory"); __asm __volatile("eieio; tlbsync; ptesync" ::: "memory"); +done: + #else vpn_hi = (uint32_t)(vpn >> 32); vpn_lo = (uint32_t)vpn; @@ -235,7 +237,6 @@ TLBIE(uint64_t vpn, uint64_t oldptehi) intr_restore(intr); #endif -done: /* No barriers or special ops -- taken care of by ptesync above */ if (need_lock) tlbie_lock = 0; From owner-svn-src-head@freebsd.org Fri Nov 6 19:04:22 2020 Return-Path: Delivered-To: svn-src-head@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 C4CEF446CE0; Fri, 6 Nov 2020 19:04:22 +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 4CSVDk4yVBz4dRC; Fri, 6 Nov 2020 19:04:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D1C5299E7; Fri, 6 Nov 2020 19:04:22 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6J4Mce088064; Fri, 6 Nov 2020 19:04:22 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6J4Lnm088056; Fri, 6 Nov 2020 19:04:21 GMT (envelope-from np@FreeBSD.org) Message-Id: <202011061904.0A6J4Lnm088056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 6 Nov 2020 19:04:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367428 - in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys: conf dev/cxgbe/firmware modules/cxgbe/t4_firmware modules/cxgbe/t5_firmware modules/cxgbe/t6_firmware X-SVN-Commit-Revision: 367428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 19:04:22 -0000 Author: np Date: Fri Nov 6 19:04:20 2020 New Revision: 367428 URL: https://svnweb.freebsd.org/changeset/base/367428 Log: cxgbe(4): Update firmwares to 1.25.0.40. This fixes a potential crash in firmware 1.25.0.0 on the passive open side during TOE operation. Obtained from: Chelsio Communications MFC after: 1 week Sponsored by: Chelsio Communications Added: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin (contents, props changed) head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin (contents, props changed) Deleted: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.0.bin head/sys/dev/cxgbe/firmware/t5fw-1.25.0.0.bin head/sys/dev/cxgbe/firmware/t6fw-1.25.0.0.bin Modified: head/sys/conf/files head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/modules/cxgbe/t4_firmware/Makefile head/sys/modules/cxgbe/t5_firmware/Makefile head/sys/modules/cxgbe/t6_firmware/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Nov 6 18:50:00 2020 (r367427) +++ head/sys/conf/files Fri Nov 6 19:04:20 2020 (r367428) @@ -1516,7 +1516,7 @@ t4fw.fwo optional cxgbe \ no-implicit-rule \ clean "t4fw.fwo" t4fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t4fw-1.25.0.40.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t4fw.fw" @@ -1550,7 +1550,7 @@ t5fw.fwo optional cxgbe \ no-implicit-rule \ clean "t5fw.fwo" t5fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t5fw-1.25.0.40.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t5fw.fw" @@ -1584,7 +1584,7 @@ t6fw.fwo optional cxgbe \ no-implicit-rule \ clean "t6fw.fwo" t6fw.fw optional cxgbe \ - dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.0.bin" \ + dependency "$S/dev/cxgbe/firmware/t6fw-1.25.0.40.bin" \ compile-with "${CP} ${.ALLSRC} ${.TARGET}" \ no-obj no-implicit-rule \ clean "t6fw.fw" Added: head/sys/dev/cxgbe/firmware/t4fw-1.25.0.40.bin ============================================================================== Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h ============================================================================== --- head/sys/dev/cxgbe/firmware/t4fw_interface.h Fri Nov 6 18:50:00 2020 (r367427) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.h Fri Nov 6 19:04:20 2020 (r367428) @@ -9985,17 +9985,17 @@ enum { T4FW_VERSION_MAJOR = 1, T4FW_VERSION_MINOR = 25, T4FW_VERSION_MICRO = 0, - T4FW_VERSION_BUILD = 0, + T4FW_VERSION_BUILD = 40, T5FW_VERSION_MAJOR = 1, T5FW_VERSION_MINOR = 25, T5FW_VERSION_MICRO = 0, - T5FW_VERSION_BUILD = 0, + T5FW_VERSION_BUILD = 40, T6FW_VERSION_MAJOR = 1, T6FW_VERSION_MINOR = 25, T6FW_VERSION_MICRO = 0, - T6FW_VERSION_BUILD = 0, + T6FW_VERSION_BUILD = 40, }; enum { Added: head/sys/dev/cxgbe/firmware/t5fw-1.25.0.40.bin ============================================================================== Added: head/sys/dev/cxgbe/firmware/t6fw-1.25.0.40.bin ============================================================================== Modified: head/sys/modules/cxgbe/t4_firmware/Makefile ============================================================================== --- head/sys/modules/cxgbe/t4_firmware/Makefile Fri Nov 6 18:50:00 2020 (r367427) +++ head/sys/modules/cxgbe/t4_firmware/Makefile Fri Nov 6 19:04:20 2020 (r367428) @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T4FW_VER= 1.25.0.0 +T4FW_VER= 1.25.0.40 FIRMWS+= t4fw-${T4FW_VER}.bin:t4fw:${T4FW_VER} .include Modified: head/sys/modules/cxgbe/t5_firmware/Makefile ============================================================================== --- head/sys/modules/cxgbe/t5_firmware/Makefile Fri Nov 6 18:50:00 2020 (r367427) +++ head/sys/modules/cxgbe/t5_firmware/Makefile Fri Nov 6 19:04:20 2020 (r367428) @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T5FW_VER= 1.25.0.0 +T5FW_VER= 1.25.0.40 FIRMWS+= t5fw-${T5FW_VER}.bin:t5fw:${T5FW_VER} .include Modified: head/sys/modules/cxgbe/t6_firmware/Makefile ============================================================================== --- head/sys/modules/cxgbe/t6_firmware/Makefile Fri Nov 6 18:50:00 2020 (r367427) +++ head/sys/modules/cxgbe/t6_firmware/Makefile Fri Nov 6 19:04:20 2020 (r367428) @@ -17,7 +17,7 @@ FIRMWS+= ${F}:${F:C/.txt//}:1.0.0.0 .endif .endfor -T6FW_VER= 1.25.0.0 +T6FW_VER= 1.25.0.40 FIRMWS+= t6fw-${T6FW_VER}.bin:t6fw:${T6FW_VER} .include From owner-svn-src-head@freebsd.org Fri Nov 6 19:19:52 2020 Return-Path: Delivered-To: svn-src-head@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 BB5004473A1; Fri, 6 Nov 2020 19:19:52 +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 4CSVZc4w6Gz4dbx; Fri, 6 Nov 2020 19:19:52 +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 9748129E0C; Fri, 6 Nov 2020 19:19:52 +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 0A6JJqbv094193; Fri, 6 Nov 2020 19:19:52 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6JJqOw094190; Fri, 6 Nov 2020 19:19:52 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011061919.0A6JJqOw094190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 6 Nov 2020 19:19:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367429 - in head/sys/mips: include mips X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head/sys/mips: include mips X-SVN-Commit-Revision: 367429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 19:19:52 -0000 Author: trasz Date: Fri Nov 6 19:19:51 2020 New Revision: 367429 URL: https://svnweb.freebsd.org/changeset/base/367429 Log: Remove 'struct trapframe' pointer from mips64's 'struct syscall_args'. While here, use MAXARGS. This brings its 'struct syscall_args' in sync with most other architectures. Reviewed by: arichardson, brooks MFC after: 2 weeks Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D26619 Modified: head/sys/mips/include/proc.h head/sys/mips/mips/trap.c Modified: head/sys/mips/include/proc.h ============================================================================== --- head/sys/mips/include/proc.h Fri Nov 6 19:04:20 2020 (r367428) +++ head/sys/mips/include/proc.h Fri Nov 6 19:19:51 2020 (r367429) @@ -81,11 +81,11 @@ struct mdproc { size_t md_tls_tcb_offset; /* TCB offset */ }; +#define MAXARGS 8 struct syscall_args { u_int code; struct sysent *callp; - register_t args[8]; - struct trapframe *trapframe; + register_t args[MAXARGS]; }; #ifdef __mips_n64 Modified: head/sys/mips/mips/trap.c ============================================================================== --- head/sys/mips/mips/trap.c Fri Nov 6 19:04:20 2020 (r367428) +++ head/sys/mips/mips/trap.c Fri Nov 6 19:19:51 2020 (r367429) @@ -349,9 +349,9 @@ cpu_fetch_syscall_args(struct thread *td) bzero(sa->args, sizeof(sa->args)); /* compute next PC after syscall instruction */ - td->td_pcb->pcb_tpc = sa->trapframe->pc; /* Remember if restart */ - if (DELAYBRANCH(sa->trapframe->cause)) /* Check BD bit */ - locr0->pc = MipsEmulateBranch(locr0, sa->trapframe->pc, 0, 0); + td->td_pcb->pcb_tpc = locr0->pc; /* Remember if restart */ + if (DELAYBRANCH(locr0->cause)) /* Check BD bit */ + locr0->pc = MipsEmulateBranch(locr0, locr0->pc, 0, 0); else locr0->pc += sizeof(int); sa->code = locr0->v0; @@ -781,7 +781,6 @@ dofault: case T_SYSCALL + T_USER: { - td->td_sa.trapframe = trapframe; syscallenter(td); #if !defined(SMP) && (defined(DDB) || defined(DEBUG)) From owner-svn-src-head@freebsd.org Fri Nov 6 19:27:28 2020 Return-Path: Delivered-To: svn-src-head@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 61ADE447C91; Fri, 6 Nov 2020 19:27:28 +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 4CSVlN2KPKz4fY9; Fri, 6 Nov 2020 19:27: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 42DDE29E39; Fri, 6 Nov 2020 19:27: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 0A6JRSZO000310; Fri, 6 Nov 2020 19:27:28 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6JRSdr000309; Fri, 6 Nov 2020 19:27:28 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011061927.0A6JRSdr000309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Fri, 6 Nov 2020 19:27:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367430 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 367430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 19:27:28 -0000 Author: trasz Date: Fri Nov 6 19:27:27 2020 New Revision: 367430 URL: https://svnweb.freebsd.org/changeset/base/367430 Log: Make powerpc use MAXARGS (defined as 8) instead of hardcoding '10'. This brings its 'struct syscall_args' in sync with other architectures. Reviewed by: bdragon, jhibbits MFC after: 2 weeks Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D26605 Modified: head/sys/powerpc/include/proc.h Modified: head/sys/powerpc/include/proc.h ============================================================================== --- head/sys/powerpc/include/proc.h Fri Nov 6 19:19:51 2020 (r367429) +++ head/sys/powerpc/include/proc.h Fri Nov 6 19:27:27 2020 (r367430) @@ -59,10 +59,11 @@ struct mdproc { #define KINFO_PROC_SIZE 816 #endif +#define MAXARGS 8 struct syscall_args { u_int code; struct sysent *callp; - register_t args[10]; + register_t args[MAXARGS]; }; #ifdef _KERNEL From owner-svn-src-head@freebsd.org Fri Nov 6 21:27:55 2020 Return-Path: Delivered-To: svn-src-head@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 25E502D32FF; Fri, 6 Nov 2020 21:27:55 +0000 (UTC) (envelope-from tsoome@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 4CSYQM0dyfz4nmg; Fri, 6 Nov 2020 21:27:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 050092B66B; Fri, 6 Nov 2020 21:27:55 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6LRsjk074622; Fri, 6 Nov 2020 21:27:54 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6LRsP6074621; Fri, 6 Nov 2020 21:27:54 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011062127.0A6LRsP6074621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 6 Nov 2020 21:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367431 - head/sys/dev/vt/hw/efifb X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/dev/vt/hw/efifb X-SVN-Commit-Revision: 367431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 21:27:55 -0000 Author: tsoome Date: Fri Nov 6 21:27:54 2020 New Revision: 367431 URL: https://svnweb.freebsd.org/changeset/base/367431 Log: efifb: vt_generate_cons_palette() takes max color, not mask vt_generate_cons_palette() does take max values of RGB component colours, not mask. Also we need to set info->fb_cmsize, or vt_fb_init() will re-initialize the info->fb_cmap. Modified: head/sys/dev/vt/hw/efifb/efifb.c Modified: head/sys/dev/vt/hw/efifb/efifb.c ============================================================================== --- head/sys/dev/vt/hw/efifb/efifb.c Fri Nov 6 19:27:27 2020 (r367430) +++ head/sys/dev/vt/hw/efifb/efifb.c Fri Nov 6 21:27:54 2020 (r367431) @@ -102,6 +102,7 @@ vt_efifb_init(struct vt_device *vd) struct fb_info *info; struct efi_fb *efifb; caddr_t kmdp; + int roff, goff, boff; info = vd->vd_softc; if (info == NULL) @@ -126,10 +127,14 @@ vt_efifb_init(struct vt_device *vd) /* Stride in bytes, not pixels */ info->fb_stride = efifb->fb_stride * (info->fb_bpp / NBBY); + roff = ffs(efifb->fb_mask_red) - 1; + goff = ffs(efifb->fb_mask_green) - 1; + boff = ffs(efifb->fb_mask_blue) - 1; vt_generate_cons_palette(info->fb_cmap, COLOR_FORMAT_RGB, - efifb->fb_mask_red, ffs(efifb->fb_mask_red) - 1, - efifb->fb_mask_green, ffs(efifb->fb_mask_green) - 1, - efifb->fb_mask_blue, ffs(efifb->fb_mask_blue) - 1); + efifb->fb_mask_red >> roff, roff, + efifb->fb_mask_green >> goff, goff, + efifb->fb_mask_blue >> boff, boff); + info->fb_cmsize = NCOLORS; info->fb_size = info->fb_height * info->fb_stride; info->fb_pbase = efifb->fb_addr; From owner-svn-src-head@freebsd.org Fri Nov 6 21:34:00 2020 Return-Path: Delivered-To: svn-src-head@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 9B1302D3A84; Fri, 6 Nov 2020 21:34:00 +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 4CSYYN3z9vz4ppR; Fri, 6 Nov 2020 21:34:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B20A2B83E; Fri, 6 Nov 2020 21:34:00 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6LY0AY081208; Fri, 6 Nov 2020 21:34:00 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6LXxvo081199; Fri, 6 Nov 2020 21:33:59 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011062133.0A6LXxvo081199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 6 Nov 2020 21:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys X-SVN-Commit-Revision: 367432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 21:34:00 -0000 Author: mjg Date: Fri Nov 6 21:33:59 2020 New Revision: 367432 URL: https://svnweb.freebsd.org/changeset/base/367432 Log: malloc: move malloc_type_internal into malloc_type According to code comments the original motivation was to allow for malloc_type_internal changes without ABI breakage. This can be trivially accomplished by providing spare fields and versioning the struct, as implemented in the patch below. The upshots are one less memory indirection on each alloc and disappearance of mt_zone. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D27104 Modified: head/lib/libmemstat/memstat_malloc.c head/sys/cddl/dev/dtmalloc/dtmalloc.c head/sys/kern/kern_malloc.c head/sys/sys/malloc.h head/sys/sys/param.h Modified: head/lib/libmemstat/memstat_malloc.c ============================================================================== --- head/lib/libmemstat/memstat_malloc.c Fri Nov 6 21:27:54 2020 (r367431) +++ head/lib/libmemstat/memstat_malloc.c Fri Nov 6 21:33:59 2020 (r367432) @@ -317,7 +317,7 @@ memstat_kvm_malloc(struct memory_type_list *list, void int hint_dontsearch, j, mp_maxcpus, mp_ncpus, ret; char name[MEMTYPE_MAXNAME]; struct malloc_type_stats mts; - struct malloc_type_internal mti, *mtip; + struct malloc_type_internal *mtip; struct malloc_type type, *typep; kvm_t *kvm; @@ -372,18 +372,17 @@ memstat_kvm_malloc(struct memory_type_list *list, void list->mtl_error = ret; return (-1); } + if (type.ks_version != M_VERSION) { + warnx("type %s with unsupported version %lu; skipped", + name, type.ks_version); + continue; + } /* * Since our compile-time value for MAXCPU may differ from the * kernel's, we populate our own array. */ - mtip = type.ks_handle; - ret = kread(kvm, mtip, &mti, sizeof(mti), 0); - if (ret != 0) { - _memstat_mtl_empty(list); - list->mtl_error = ret; - return (-1); - } + mtip = &type.ks_mti; if (hint_dontsearch == 0) { mtp = memstat_mtl_find(list, ALLOCATOR_MALLOC, name); @@ -404,7 +403,7 @@ memstat_kvm_malloc(struct memory_type_list *list, void */ _memstat_mt_reset_stats(mtp, mp_maxcpus); for (j = 0; j < mp_ncpus; j++) { - ret = kread_zpcpu(kvm, (u_long)mti.mti_stats, &mts, + ret = kread_zpcpu(kvm, (u_long)mtip->mti_stats, &mts, sizeof(mts), j); if (ret != 0) { _memstat_mtl_empty(list); Modified: head/sys/cddl/dev/dtmalloc/dtmalloc.c ============================================================================== --- head/sys/cddl/dev/dtmalloc/dtmalloc.c Fri Nov 6 21:27:54 2020 (r367431) +++ head/sys/cddl/dev/dtmalloc/dtmalloc.c Fri Nov 6 21:33:59 2020 (r367432) @@ -114,7 +114,7 @@ static void dtmalloc_type_cb(struct malloc_type *mtp, void *arg __unused) { char name[DTRACE_FUNCNAMELEN]; - struct malloc_type_internal *mtip = mtp->ks_handle; + struct malloc_type_internal *mtip = &mtp->ks_mti; int i; /* Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Fri Nov 6 21:27:54 2020 (r367431) +++ head/sys/kern/kern_malloc.c Fri Nov 6 21:33:59 2020 (r367432) @@ -175,14 +175,8 @@ struct { }; /* - * Zone to allocate malloc type descriptions from. For ABI reasons, memory - * types are described by a data structure passed by the declaring code, but - * the malloc(9) implementation has its own data structure describing the - * type and statistics. This permits the malloc(9)-internal data structures - * to be modified without breaking binary-compiled kernel modules that - * declare malloc types. + * Zone to allocate per-CPU storage for statistics. */ -static uma_zone_t mt_zone; static uma_zone_t mt_stats_zone; u_long vm_kmem_size; @@ -342,7 +336,7 @@ mtp_set_subzone(struct malloc_type *mtp) size_t len; u_int val; - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; desc = mtp->ks_shortdesc; if (desc == NULL || (len = strlen(desc)) == 0) val = 0; @@ -356,7 +350,7 @@ mtp_get_subzone(struct malloc_type *mtp) { struct malloc_type_internal *mtip; - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; KASSERT(mtip->mti_zone < numzones, ("mti_zone %u out of range %d", @@ -371,7 +365,7 @@ mtp_set_subzone(struct malloc_type *mtp) { struct malloc_type_internal *mtip; - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; mtip->mti_zone = 0; } @@ -404,7 +398,7 @@ malloc_type_zone_allocated(struct malloc_type *mtp, un struct malloc_type_stats *mtsp; critical_enter(); - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; mtsp = zpcpu_get(mtip->mti_stats); if (size > 0) { mtsp->mts_memalloced += size; @@ -447,7 +441,7 @@ malloc_type_freed(struct malloc_type *mtp, unsigned lo struct malloc_type_stats *mtsp; critical_enter(); - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; mtsp = zpcpu_get(mtip->mti_stats); mtsp->mts_memfreed += size; mtsp->mts_numfrees++; @@ -524,7 +518,7 @@ malloc_dbg(caddr_t *vap, size_t *sizep, struct malloc_ #ifdef INVARIANTS int indx; - KASSERT(mtp->ks_magic == M_MAGIC, ("malloc: bad malloc type magic")); + KASSERT(mtp->ks_version == M_VERSION, ("malloc: bad malloc type version")); /* * Check that exactly one of M_WAITOK or M_NOWAIT is specified. */ @@ -848,7 +842,7 @@ free_dbg(void **addrp, struct malloc_type *mtp) void *addr; addr = *addrp; - KASSERT(mtp->ks_magic == M_MAGIC, ("free: bad malloc type magic")); + KASSERT(mtp->ks_version == M_VERSION, ("free: bad malloc type version")); KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("free: called with spinlock or critical section held")); @@ -965,8 +959,8 @@ realloc(void *addr, size_t size, struct malloc_type *m unsigned long alloc; void *newaddr; - KASSERT(mtp->ks_magic == M_MAGIC, - ("realloc: bad malloc type magic")); + KASSERT(mtp->ks_version == M_VERSION, + ("realloc: bad malloc type version")); KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(), ("realloc: called with spinlock or critical section held")); @@ -1193,13 +1187,6 @@ mallocinit(void *dummy) mt_stats_zone = uma_zcreate("mt_stats_zone", sizeof(struct malloc_type_stats), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); - mt_zone = uma_zcreate("mt_zone", sizeof(struct malloc_type_internal), -#ifdef INVARIANTS - mtrash_ctor, mtrash_dtor, mtrash_init, mtrash_fini, -#else - NULL, NULL, NULL, NULL, -#endif - UMA_ALIGN_PTR, UMA_ZONE_MALLOC); for (i = 0, indx = 0; kmemzones[indx].kz_size != 0; indx++) { int size = kmemzones[indx].kz_size; const char *name = kmemzones[indx].kz_name; @@ -1230,12 +1217,12 @@ malloc_init(void *data) KASSERT(vm_cnt.v_page_count != 0, ("malloc_register before vm_init")); mtp = data; - if (mtp->ks_magic != M_MAGIC) - panic("malloc_init: bad malloc type magic"); + if (mtp->ks_version != M_VERSION) + panic("malloc_init: unsupported malloc type version %lu", + mtp->ks_version); - mtip = uma_zalloc(mt_zone, M_WAITOK | M_ZERO); + mtip = &mtp->ks_mti; mtip->mti_stats = uma_zalloc_pcpu(mt_stats_zone, M_WAITOK | M_ZERO); - mtp->ks_handle = mtip; mtp_set_subzone(mtp); mtx_lock(&malloc_mtx); @@ -1251,18 +1238,15 @@ malloc_uninit(void *data) struct malloc_type_internal *mtip; struct malloc_type_stats *mtsp; struct malloc_type *mtp, *temp; - uma_slab_t slab; long temp_allocs, temp_bytes; int i; mtp = data; - KASSERT(mtp->ks_magic == M_MAGIC, - ("malloc_uninit: bad malloc type magic")); - KASSERT(mtp->ks_handle != NULL, ("malloc_deregister: cookie NULL")); + KASSERT(mtp->ks_version == M_VERSION, + ("malloc_uninit: bad malloc type version")); mtx_lock(&malloc_mtx); - mtip = mtp->ks_handle; - mtp->ks_handle = NULL; + mtip = &mtp->ks_mti; if (mtp != kmemstatistics) { for (temp = kmemstatistics; temp != NULL; temp = temp->ks_next) { @@ -1295,9 +1279,7 @@ malloc_uninit(void *data) temp_allocs, temp_bytes); } - slab = vtoslab((vm_offset_t) mtip & (~UMA_SLAB_MASK)); uma_zfree_pcpu(mt_stats_zone, mtip->mti_stats); - uma_zfree_arg(mt_zone, mtip, slab); } struct malloc_type * @@ -1346,7 +1328,7 @@ sysctl_kern_malloc_stats(SYSCTL_HANDLER_ARGS) * Insert alternating sequence of type headers and type statistics. */ for (mtp = kmemstatistics; mtp != NULL; mtp = mtp->ks_next) { - mtip = (struct malloc_type_internal *)mtp->ks_handle; + mtip = &mtp->ks_mti; /* * Insert type header. @@ -1483,7 +1465,7 @@ DB_SHOW_COMMAND(malloc, db_show_malloc) ties = 1; continue; } - size = get_malloc_stats(mtp->ks_handle, &allocs, + size = get_malloc_stats(&mtp->ks_mti, &allocs, &inuse); if (size > cur_size && size < last_size + ties) { cur_size = size; @@ -1493,7 +1475,7 @@ DB_SHOW_COMMAND(malloc, db_show_malloc) if (cur_mtype == NULL) break; - size = get_malloc_stats(cur_mtype->ks_handle, &allocs, &inuse); + size = get_malloc_stats(&cur_mtype->ks_mti, &allocs, &inuse); db_printf(fmt_entry, cur_mtype->ks_shortdesc, inuse, howmany(size, 1024), allocs); @@ -1517,17 +1499,17 @@ DB_SHOW_COMMAND(multizone_matches, db_show_multizone_m return; } mtp = (void *)addr; - if (mtp->ks_magic != M_MAGIC) { - db_printf("Magic %lx does not match expected %x\n", - mtp->ks_magic, M_MAGIC); + if (mtp->ks_version != M_VERSION) { + db_printf("Version %lx does not match expected %x\n", + mtp->ks_version, M_VERSION); return; } - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; subzone = mtip->mti_zone; for (mtp = kmemstatistics; mtp != NULL; mtp = mtp->ks_next) { - mtip = mtp->ks_handle; + mtip = &mtp->ks_mti; if (mtip->mti_zone != subzone) continue; db_printf("%s\n", mtp->ks_shortdesc); Modified: head/sys/sys/malloc.h ============================================================================== --- head/sys/sys/malloc.h Fri Nov 6 21:27:54 2020 (r367431) +++ head/sys/sys/malloc.h Fri Nov 6 21:33:59 2020 (r367432) @@ -63,7 +63,7 @@ #define M_EXEC 0x4000 /* allocate executable space */ #define M_NEXTFIT 0x8000 /* only for vmem, follow cursor */ -#define M_MAGIC 877983977 /* time when first defined :-) */ +#define M_VERSION 2020110501 /* * Two malloc type structures are present: malloc_type, which is used by a @@ -104,18 +104,17 @@ struct malloc_type_internal { /* DTrace probe ID array. */ u_char mti_zone; struct malloc_type_stats *mti_stats; + u_long mti_spare[8]; }; /* - * Public data structure describing a malloc type. Private data is hung off - * of ks_handle to avoid encoding internal malloc(9) data structures in - * modules, which will statically allocate struct malloc_type. + * Public data structure describing a malloc type. */ struct malloc_type { struct malloc_type *ks_next; /* Next in global chain. */ - u_long ks_magic; /* Detect programmer error. */ + u_long ks_version; /* Detect programmer error. */ const char *ks_shortdesc; /* Printable type name. */ - void *ks_handle; /* Priv. data, was lo_class. */ + struct malloc_type_internal ks_mti; }; /* @@ -141,7 +140,12 @@ struct malloc_type_header { #ifdef _KERNEL #define MALLOC_DEFINE(type, shortdesc, longdesc) \ struct malloc_type type[1] = { \ - { NULL, M_MAGIC, shortdesc, NULL } \ + { \ + .ks_next = NULL, \ + .ks_version = M_VERSION, \ + .ks_shortdesc = shortdesc, \ + .ks_mti = { 0 }, \ + } \ }; \ SYSINIT(type##_init, SI_SUB_KMEM, SI_ORDER_THIRD, malloc_init, \ type); \ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Fri Nov 6 21:27:54 2020 (r367431) +++ head/sys/sys/param.h Fri Nov 6 21:33:59 2020 (r367432) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300126 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300127 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Fri Nov 6 22:04:58 2020 Return-Path: Delivered-To: svn-src-head@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 9B2702D48D6; Fri, 6 Nov 2020 22:04:58 +0000 (UTC) (envelope-from cem@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 4CSZF63n29z4r5Z; Fri, 6 Nov 2020 22:04:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 749A62C01A; Fri, 6 Nov 2020 22:04:58 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6M4wkg099800; Fri, 6 Nov 2020 22:04:58 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6M4vJT099797; Fri, 6 Nov 2020 22:04:57 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202011062204.0A6M4vJT099797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Fri, 6 Nov 2020 22:04:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367433 - in head/sys: compat/linux conf X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head/sys: compat/linux conf X-SVN-Commit-Revision: 367433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 22:04:58 -0000 Author: cem Date: Fri Nov 6 22:04:57 2020 New Revision: 367433 URL: https://svnweb.freebsd.org/changeset/base/367433 Log: linux(4): Fix loadable modules after r367395 Move dtrace SDT definitions into linux_common module code. Also, build linux_dummy.c into the linux_common kld -- we don't need separate versions of these stubs for 32- and 64-bit emulation. Reported by: several PR: 250897 Discussed with: emaste, trasz Tested by: John Kennedy, Yasuhiro KIMURA, Oleg Sidorkin X-MFC-With: r367395 Differential Revision: https://reviews.freebsd.org/D27124 Modified: head/sys/compat/linux/linux_common.c head/sys/compat/linux/linux_dummy.c head/sys/compat/linux/linux_misc.c head/sys/conf/files.i386 Modified: head/sys/compat/linux/linux_common.c ============================================================================== --- head/sys/compat/linux/linux_common.c Fri Nov 6 21:33:59 2020 (r367432) +++ head/sys/compat/linux/linux_common.c Fri Nov 6 22:04:57 2020 (r367433) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -48,6 +49,20 @@ FEATURE(linuxulator_v4l, "V4L ioctl wrapper support in FEATURE(linuxulator_v4l2, "V4L2 ioctl wrapper support in the linuxulator"); MODULE_VERSION(linux_common, 1); + +/** + * Special DTrace provider for the linuxulator. + * + * In this file we define the provider for the entire linuxulator. All + * modules (= files of the linuxulator) use it. + * + * We define a different name depending on the emulated bitsize, see + * ../..//linux{,32}/linux.h, e.g.: + * native bitsize = linuxulator + * amd64, 32bit emulation = linuxulator32 + */ +LIN_SDT_PROVIDER_DEFINE(linuxulator); +LIN_SDT_PROVIDER_DEFINE(linuxulator32); SET_DECLARE(linux_device_handler_set, struct linux_device_handler); Modified: head/sys/compat/linux/linux_dummy.c ============================================================================== --- head/sys/compat/linux/linux_dummy.c Fri Nov 6 21:33:59 2020 (r367432) +++ head/sys/compat/linux/linux_dummy.c Fri Nov 6 22:04:57 2020 (r367433) @@ -29,21 +29,19 @@ #include __FBSDID("$FreeBSD$"); -#include "opt_compat.h" - #include #include #include #include #include -#ifdef COMPAT_LINUX32 -#include -#include -#else +/* + * Including linux vs linux32 here is arbitrary -- the syscall args structures + * (proto.h) are not dereferenced by the DUMMY stub implementations, and + * suitable for use by both native and compat32 entrypoints. + */ #include #include -#endif #include #include Modified: head/sys/compat/linux/linux_misc.c ============================================================================== --- head/sys/compat/linux/linux_misc.c Fri Nov 6 21:33:59 2020 (r367432) +++ head/sys/compat/linux/linux_misc.c Fri Nov 6 22:04:57 2020 (r367433) @@ -99,19 +99,6 @@ __FBSDID("$FreeBSD$"); #include #include -/** - * Special DTrace provider for the linuxulator. - * - * In this file we define the provider for the entire linuxulator. All - * modules (= files of the linuxulator) use it. - * - * We define a different name depending on the emulated bitsize, see - * ../..//linux{,32}/linux.h, e.g.: - * native bitsize = linuxulator - * amd64, 32bit emulation = linuxulator32 - */ -LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE); - int stclohz; /* Statistics clock frequency */ static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = { Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Nov 6 21:33:59 2020 (r367432) +++ head/sys/conf/files.i386 Fri Nov 6 22:04:57 2020 (r367433) @@ -52,6 +52,7 @@ cddl/dev/dtrace/i386/dtrace_asm.S optional dtrace co cddl/dev/dtrace/i386/dtrace_subr.c optional dtrace compile-with "${DTRACE_C}" compat/linprocfs/linprocfs.c optional linprocfs compat/linsysfs/linsysfs.c optional linsysfs +compat/linux/linux_common.c optional compat_linux compat/linux/linux_dummy.c optional compat_linux compat/linux/linux_event.c optional compat_linux compat/linux/linux_emul.c optional compat_linux From owner-svn-src-head@freebsd.org Fri Nov 6 22:11:06 2020 Return-Path: Delivered-To: svn-src-head@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 230412D4ABF; Fri, 6 Nov 2020 22:11:06 +0000 (UTC) (envelope-from jmg@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 4CSZNB0Y7pz4rqJ; Fri, 6 Nov 2020 22:11:06 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 05EE92BDFE; Fri, 6 Nov 2020 22:11:06 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6MB5CL002392; Fri, 6 Nov 2020 22:11:05 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6MB5N0002391; Fri, 6 Nov 2020 22:11:05 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <202011062211.0A6MB5N0002391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Fri, 6 Nov 2020 22:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367434 - head/usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: head/usr.sbin/pkg X-SVN-Commit-Revision: 367434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 22:11:06 -0000 Author: jmg Date: Fri Nov 6 22:11:05 2020 New Revision: 367434 URL: https://svnweb.freebsd.org/changeset/base/367434 Log: fix up docs, if signature checking is enabled, the file MUST exist... Modified: head/usr.sbin/pkg/pkg.7 Modified: head/usr.sbin/pkg/pkg.7 ============================================================================== --- head/usr.sbin/pkg/pkg.7 Fri Nov 6 22:04:57 2020 (r367433) +++ head/usr.sbin/pkg/pkg.7 Fri Nov 6 22:11:05 2020 (r367434) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 12, 2013 +.Dd November 6, 2020 .Dt PKG 7 .Os .Sh NAME @@ -69,11 +69,8 @@ If already installed, the command requested will be fo Install .Xr pkg 8 from a local package instead of fetching from remote. -If a -.Pa pkg.txz.sig -file exists and -signature checking is enabled, then the signature will be verified -before installing the package. +If signature checking is enabled, then the correct signature file +must exist and the signature valid before the package will be installed. If the .Fl f flag is specified, then From owner-svn-src-head@freebsd.org Fri Nov 6 22:40:01 2020 Return-Path: Delivered-To: svn-src-head@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 1E51E2D56AA; Fri, 6 Nov 2020 22:40:01 +0000 (UTC) (envelope-from bz@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 4CSb1Y0MQ6z4tJL; Fri, 6 Nov 2020 22:40:01 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 F31782C42E; Fri, 6 Nov 2020 22:40:00 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6Me0DM019364; Fri, 6 Nov 2020 22:40:00 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6Me0DI019363; Fri, 6 Nov 2020 22:40:00 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202011062240.0A6Me0DI019363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 6 Nov 2020 22:40:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367435 - head/sys/dev/usb X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/dev/usb X-SVN-Commit-Revision: 367435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 22:40:01 -0000 Author: bz Date: Fri Nov 6 22:40:00 2020 New Revision: 367435 URL: https://svnweb.freebsd.org/changeset/base/367435 Log: usb_hub: giving up port reset - device vanished Improve the output of the recently often experienced debug message in order to gather further data. PR: 237666 Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D27108 Modified: head/sys/dev/usb/usb_hub.c Modified: head/sys/dev/usb/usb_hub.c ============================================================================== --- head/sys/dev/usb/usb_hub.c Fri Nov 6 22:11:05 2020 (r367434) +++ head/sys/dev/usb/usb_hub.c Fri Nov 6 22:40:00 2020 (r367435) @@ -720,8 +720,10 @@ repeat: if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) || (!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) { if (timeout) { - DPRINTFN(0, "giving up port reset " - "- device vanished\n"); + DPRINTFN(0, "giving up port %d reset - " + "device vanished: change %#x status %#x\n", + portno, sc->sc_st.port_change, + sc->sc_st.port_status); goto error; } timeout = 1; From owner-svn-src-head@freebsd.org Fri Nov 6 22:58:32 2020 Return-Path: Delivered-To: svn-src-head@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 683DD2D5F6D; Fri, 6 Nov 2020 22:58:32 +0000 (UTC) (envelope-from rew@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 4CSbQw2ZSCz4vjK; Fri, 6 Nov 2020 22:58:32 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4B5D92C876; Fri, 6 Nov 2020 22:58:32 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6MwWfG031835; Fri, 6 Nov 2020 22:58:32 GMT (envelope-from rew@FreeBSD.org) Received: (from rew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6MwV4H031830; Fri, 6 Nov 2020 22:58:31 GMT (envelope-from rew@FreeBSD.org) Message-Id: <202011062258.0A6MwV4H031830@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rew set sender to rew@FreeBSD.org using -f From: Robert Wing Date: Fri, 6 Nov 2020 22:58:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367436 - in head: share/man/man5 usr.sbin/periodic usr.sbin/periodic/etc/daily X-SVN-Group: head X-SVN-Commit-Author: rew X-SVN-Commit-Paths: in head: share/man/man5 usr.sbin/periodic usr.sbin/periodic/etc/daily X-SVN-Commit-Revision: 367436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 22:58:32 -0000 Author: rew Date: Fri Nov 6 22:58:31 2020 New Revision: 367436 URL: https://svnweb.freebsd.org/changeset/base/367436 Log: Add a periodic script to backup output generated from `zfs list`, `zfs get`, `zpool list`, and `zpool get` commands. Disabled by default. PR: 86388 Submitted by: Miroslav Lachman <000.fbsd@quip.cz> Reviewed by: allanjude, 0mp Approved by: allanjude (mentor) MFC after: 4 weeks Event: July 2020 Bugathon Differential Revision: https://reviews.freebsd.org/D25638 Added: head/usr.sbin/periodic/etc/daily/223.backup-zfs (contents, props changed) Modified: head/share/man/man5/periodic.conf.5 head/usr.sbin/periodic/etc/daily/Makefile head/usr.sbin/periodic/periodic.conf Modified: head/share/man/man5/periodic.conf.5 ============================================================================== --- head/share/man/man5/periodic.conf.5 Fri Nov 6 22:40:00 2020 (r367435) +++ head/share/man/man5/periodic.conf.5 Fri Nov 6 22:58:31 2020 (r367436) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2020 +.Dd November 6, 2020 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -289,6 +289,57 @@ Set to if you want the .Pa /etc/mail/aliases file backed up and modifications to be displayed in your daily output. +.It Va daily_backup_zfs_enable +.Pq Vt bool +Set to +.Dq Li YES +to create backup of the output generated from the +.Xr zfs-list 8 +and +.Xr zpool-list 8 +utilities. +.It Va daily_backup_zfs_list_flags +.Pq Vt str +Set to the arguments for the +.Xr zfs-list 8 +utility. +The default is standard behavior. +.It Va daily_backup_zpool_list_flags +.Pq Vt str +Set to the arguments for the +.Xr zpool-list 8 +utility. +The default is +.Fl v . +.It Va daily_backup_zfs_props_enable +.Pq Vt bool +Set to +.Dq Li YES +to create backup of the output generated from the +.Xr zfs-get 8 +and +.Xr zpool-get 8 +utilities. +.It Va daily_backup_zfs_get_flags +.Pq Vt str +Set to the arguments for the +.Xr zfs-get 8 +utility. +The default is +.Cm all . +.It Va daily_backup_zpool_get_flags +.Pq Vt str +Set to the arguments for the +.Xr zpool-get 8 +utility. +The default is +.Cm all . +.It Va daily_backup_zfs_verbose +.Pq Vt bool +Set to +.Dq Li YES +to report a diff between the new backup and the existing backup +in the daily output. .It Va daily_calendar_enable .Pq Vt bool Set to Added: head/usr.sbin/periodic/etc/daily/223.backup-zfs ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/periodic/etc/daily/223.backup-zfs Fri Nov 6 22:58:31 2020 (r367436) @@ -0,0 +1,78 @@ +#!/bin/sh + +# $FreeBSD$ +# Created by: Miroslav Lachman <000.fbsd@quip.cz> + +# Backup of zpool list, zfs list, zpool properties and zfs properties +# for each filesystem. The backup will be stored in /var/backups. + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +bak_dir=/var/backups + +rotate() { + base_name=$1 + show_diff=$2 + file="$bak_dir/$base_name" + + if [ -f "${file}.bak" ] ; then + rc=0 + if cmp -s "${file}.bak" "${file}.tmp"; then + rm "${file}.tmp" + else + rc=1 + [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" + mv "${file}.bak" "${file}.bak2" || rc=3 + mv "${file}.tmp" "${file}.bak" || rc=3 + fi + else + rc=1 + mv "${file}.tmp" "${file}.bak" || rc=3 + [ -n "$show_diff" ] && cat "${file}.bak" + fi +} + +case "$daily_backup_zfs_verbose" in + [Yy][Ee][Ss]) show="YES" +esac + +case "$daily_backup_zfs_enable" in + [Yy][Ee][Ss]) + + zpools=$(zpool list $daily_backup_zpool_list_flags) + + if [ -z "$zpools" ]; then + echo 'daily_backup_zfs_enable is set to YES but no zpools found.' + rc=2 + else + echo "" + echo "Backup of ZFS information for all imported pools"; + + echo "$zpools" > "$bak_dir/zpool_list.tmp" + rotate "zpool_list" $show + + zfs list $daily_backup_zfs_list_flags > "$bak_dir/zfs_list.tmp" + rotate "zfs_list" $show + fi + ;; + *) rc=0;; +esac + +case "$daily_backup_zfs_props_enable" in + [Yy][Ee][Ss]) + + zfs get $daily_backup_zfs_get_flags > "$bak_dir/zfs_props.tmp" + rotate "zfs_props" + + zpool get $daily_backup_zpool_get_flags > "$bak_dir/zpool_props.tmp" + rotate "zpool_props" + ;; +esac + +exit $rc Modified: head/usr.sbin/periodic/etc/daily/Makefile ============================================================================== --- head/usr.sbin/periodic/etc/daily/Makefile Fri Nov 6 22:40:00 2020 (r367435) +++ head/usr.sbin/periodic/etc/daily/Makefile Fri Nov 6 22:58:31 2020 (r367436) @@ -55,7 +55,8 @@ CONFS+= 150.clean-hoststat \ .endif .if ${MK_ZFS} != "no" -CONFS+= 404.status-zfs \ +CONFS+= 223.backup-zfs \ + 404.status-zfs \ 800.scrub-zfs .endif Modified: head/usr.sbin/periodic/periodic.conf ============================================================================== --- head/usr.sbin/periodic/periodic.conf Fri Nov 6 22:40:00 2020 (r367435) +++ head/usr.sbin/periodic/periodic.conf Fri Nov 6 22:58:31 2020 (r367436) @@ -82,6 +82,15 @@ daily_backup_gpart_enable="YES" # Backup daily_backup_gpart_verbose="NO" # Be verbose if new backup differs from the new one daily_backup_efi_enable="NO" # Backup EFI system partition (ESP) +# 223.backup-zfs +daily_backup_zfs_enable="NO" # Backup output from zpool/zfs list +daily_backup_zfs_props_enable="NO" # Backup zpool/zfs filesystem properties +daily_backup_zfs_get_flags="all" # flags passed to `zfs get` +daily_backup_zfs_list_flags="" # flags passed to `zfs list` +daily_backup_zpool_get_flags="all" # flags passed to `zpool get` +daily_backup_zpool_list_flags="-v" # flags passed to `zpool list` +daily_backup_zfs_verbose="NO" # Report diff between the old and new backups. + # 300.calendar daily_calendar_enable="NO" # Run calendar -a From owner-svn-src-head@freebsd.org Fri Nov 6 23:37:59 2020 Return-Path: Delivered-To: svn-src-head@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 BA5622D6C29; Fri, 6 Nov 2020 23:37:59 +0000 (UTC) (envelope-from jhb@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 4CScJR4ty9z3DLw; Fri, 6 Nov 2020 23:37:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8BE6D2CE5E; Fri, 6 Nov 2020 23:37:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A6NbxUc056404; Fri, 6 Nov 2020 23:37:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A6Nbxvr056403; Fri, 6 Nov 2020 23:37:59 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202011062337.0A6Nbxvr056403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 6 Nov 2020 23:37:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367437 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 367437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 23:37:59 -0000 Author: jhb Date: Fri Nov 6 23:37:59 2020 New Revision: 367437 URL: https://svnweb.freebsd.org/changeset/base/367437 Log: Update copies of ioctl structures to match recent changes in head. - Update for C99 types and void pointers. - Update example algorithms to not use removed algorithms. Modified: head/share/man/man4/crypto.4 Modified: head/share/man/man4/crypto.4 ============================================================================== --- head/share/man/man4/crypto.4 Fri Nov 6 22:58:31 2020 (r367436) +++ head/share/man/man4/crypto.4 Fri Nov 6 23:37:59 2020 (r367437) @@ -60,7 +60,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 19, 2020 +.Dd November 6, 2020 .Dt CRYPTO 4 .Os .Sh NAME @@ -209,15 +209,15 @@ is returned. .It Dv CIOCGSESSION Fa struct session_op *sessp .Bd -literal struct session_op { - u_int32_t cipher; /* e.g. CRYPTO_DES_CBC */ - u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */ + uint32_t cipher; /* e.g. CRYPTO_AES_CBC */ + uint32_t mac; /* e.g. CRYPTO_SHA2_256_HMAC */ - u_int32_t keylen; /* cipher key */ + uint32_t keylen; /* cipher key */ const void *key; int mackeylen; /* mac key */ const void *mackey; - u_int32_t ses; /* returns: ses # */ + uint32_t ses; /* returns: ses # */ }; .Ed @@ -267,15 +267,15 @@ stand-alone non-fused operation. .It Dv CIOCGSESSION2 Fa struct session2_op *sessp .Bd -literal struct session2_op { - u_int32_t cipher; /* e.g. CRYPTO_DES_CBC */ - u_int32_t mac; /* e.g. CRYPTO_MD5_HMAC */ + uint32_t cipher; /* e.g. CRYPTO_AES_CBC */ + uint32_t mac; /* e.g. CRYPTO_SHA2_256_HMAC */ - u_int32_t keylen; /* cipher key */ + uint32_t keylen; /* cipher key */ const void *key; int mackeylen; /* mac key */ const void *mackey; - u_int32_t ses; /* returns: ses # */ + uint32_t ses; /* returns: ses # */ int crid; /* driver id + flags (rw) */ int pad[4]; /* for future expansion */ }; @@ -291,13 +291,14 @@ field must be initialized to zero. .It Dv CIOCCRYPT Fa struct crypt_op *cr_op .Bd -literal struct crypt_op { - u_int32_t ses; - u_int16_t op; /* e.g. COP_ENCRYPT */ - u_int16_t flags; + uint32_t ses; + uint16_t op; /* e.g. COP_ENCRYPT */ + uint16_t flags; u_int len; - caddr_t src, dst; - caddr_t mac; /* must be large enough for result */ - caddr_t iv; + const void *src; + void *dst; + void *mac; /* must be large enough for result */ + const void *iv; }; .Ed @@ -330,16 +331,17 @@ and the output buffer will remain unchanged. .It Dv CIOCCRYPTAEAD Fa struct crypt_aead *cr_aead .Bd -literal struct crypt_aead { - u_int32_t ses; - u_int16_t op; /* e.g. COP_ENCRYPT */ - u_int16_t flags; + uint32_t ses; + uint16_t op; /* e.g. COP_ENCRYPT */ + uint16_t flags; u_int len; u_int aadlen; u_int ivlen; - caddr_t src, dst; - caddr_t aad; - caddr_t tag; /* must be large enough for result */ - caddr_t iv; + const void *src; + void *dst; + const void *aad; /* additional authenticated data */ + void *tag; /* must fit for chosen TAG length */ + const void *iv; }; .Ed From owner-svn-src-head@freebsd.org Sat Nov 7 01:19:32 2020 Return-Path: Delivered-To: svn-src-head@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 A131D2D9EDB; Sat, 7 Nov 2020 01:19:32 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CSfYc2qYwz3Kht; Sat, 7 Nov 2020 01:19:32 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (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) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id 7EF652848E; Sat, 7 Nov 2020 10:19:28 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1604711968; bh=+iqQo5L9KLbFiaqVNu50w9JjdV7d7IaGnl1wb0Bo5m4=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=qaWCeta9lo0FxzzyfDlBvehBlsJnuqsaUJ1uTNDKpIff1N7RPO+d3uioQcH64+PYN QE097HkDFmGSdvMWca1FALfGVlKzymbmqcPlx9doVGOKpSd2UoBHdwtMQVvG+J/t/k 7sYybsDt1neP+/NcJDJpULinEQ3sx/lHTqxDL09YEpCJ5oFaAPXxZ0KYqYKpHnxyjO fdF0vAyQsSacQnwg6H6S86PP9CIrBeFGcLhCKGJHIX7uAfuK8X3oVQl0LRQcIKpE7m t66B+PQbUK2AtWvU/pshk4TntVEB2chgCyz9wEgoaURt3rW1lzgEG8JBtlc3ehmgne GB28w9sxiUQgA== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id CC0393B30C; Sat, 7 Nov 2020 10:19:25 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at eastasia.home.utahime.org Date: Sat, 07 Nov 2020 10:18:25 +0900 (JST) Message-Id: <20201107.101825.1779017732143423450.yasu@utahime.org> To: mjg@FreeBSD.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys From: Yasuhiro KIMURA In-Reply-To: <202011062133.0A6LXxvo081199@repo.freebsd.org> References: <202011062133.0A6LXxvo081199@repo.freebsd.org> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CSfYc2qYwz3Kht X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 01:19:32 -0000 From: Mateusz Guzik Subject: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys Date: Fri, 6 Nov 2020 21:33:59 +0000 (UTC) > Author: mjg > Date: Fri Nov 6 21:33:59 2020 > New Revision: 367432 > URL: https://svnweb.freebsd.org/changeset/base/367432 > > Log: > malloc: move malloc_type_internal into malloc_type > > According to code comments the original motivation was to allow for > malloc_type_internal changes without ABI breakage. This can be trivially > accomplished by providing spare fields and versioning the struct, as > implemented in the patch below. > > The upshots are one less memory indirection on each alloc and disappearance > of mt_zone. > > Reviewed by: markj > Differential Revision: https://reviews.freebsd.org/D27104 With this commit kernel panic happens on amd64 as following. https://www.utahime.org/FreeBSD/FreeBSD.13-CURRENT.amd64.r367432.panic.png --- Yasuhiro KIMURA From owner-svn-src-head@freebsd.org Sat Nov 7 01:25:07 2020 Return-Path: Delivered-To: svn-src-head@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 DFD5B2DAD86; Sat, 7 Nov 2020 01:25:07 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (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 4CSfh35s8Nz3LXB; Sat, 7 Nov 2020 01:25:07 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id w14so3084349wrs.9; Fri, 06 Nov 2020 17:25:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=X27MlvQhSS4/Bxd3x2Xe37FLb8DDOGx5erR0WxwiVs0=; b=pd3bTO2MYNm95jPO/ZVEss3nSuc0Wh71Y1HTKbC0xjG55ifAByfMRgYvM8H5W3Dqjk YwLi91jMTaN283U50rNGjm9dFHHwAWl2D17TCvp7FMoFprFoyXktDSaLVL8m3AsdlEJI jlJimuqGgnbBVAQAfcnVZpVslOb5Cb7NXbXfuCh8CNZ/t3ZAkOdPeMbJ85w4awgR8HDw mAldvAlNwYFE6SKZIOJBJN/XR9lnqUxHhVmJovDGHq+fNd8b7ksuXaOmibhAk+WqrxTk de7Vx40uwt/A5uQwpQU/u6sG4dxuQfPJFYwxI3hcYy2HdAKhBvRrNeg292XCR0Py9M/H 7j1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=X27MlvQhSS4/Bxd3x2Xe37FLb8DDOGx5erR0WxwiVs0=; b=tSRRNqKKhyGoYhulsqIsJdnJlIIN9LJzzBETYRzuXZMq4apI1UbYIbaM2ug0F3H/Hh BF2pxd5axR/rPwgoT4fqhuf30U8tS4MJ6zby4hvNji8+qwtLTw6yrKuvIVvqJvRadwio SclAZi2UPsU2avUf7UUquBZe117DiyufHzoDHEPIVMdSFWdJiRxFV3+ICzi8RF3O0PJg 3LkajekRqeEuT4R8SZgBitu6GORJtEiEzyh0Pyo2vuVDVb1H5Dt4hGqZwWIM9yD3aQds pRR0vzPHB+S7jTzdgK9knTo3b00RCxOpQyfrOq1euTCvXg1cme2Ien6Gdy7mx65PTCgy bWsQ== X-Gm-Message-State: AOAM531+FKRCWHL2zMkGGQXggubt390npNdiQW7HstbIAkCpwmbF+NtV +OSnhJHATAmNvyMz78RETOXIa8h3rSVXEsEn9b9ShLVI X-Google-Smtp-Source: ABdhPJx8q0UVurmGD77cf95EE9Y098QImd66yCKs1N+FyRdVi7CJbvdhISySbJpaNeMsAsvK5JoW7hDMM8aUNRLHl8Q= X-Received: by 2002:adf:9b98:: with SMTP id d24mr5291704wrc.17.1604712306088; Fri, 06 Nov 2020 17:25:06 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4c4f:0:0:0:0:0 with HTTP; Fri, 6 Nov 2020 17:25:05 -0800 (PST) In-Reply-To: <20201107.101825.1779017732143423450.yasu@utahime.org> References: <202011062133.0A6LXxvo081199@repo.freebsd.org> <20201107.101825.1779017732143423450.yasu@utahime.org> From: Mateusz Guzik Date: Sat, 7 Nov 2020 02:25:05 +0100 Message-ID: Subject: Re: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys To: Yasuhiro KIMURA Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CSfh35s8Nz3LXB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 01:25:07 -0000 You need to recompile all modules. On 11/7/20, Yasuhiro KIMURA wrote: > From: Mateusz Guzik > Subject: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc > sys/kern sys/sys > Date: Fri, 6 Nov 2020 21:33:59 +0000 (UTC) > >> Author: mjg >> Date: Fri Nov 6 21:33:59 2020 >> New Revision: 367432 >> URL: https://svnweb.freebsd.org/changeset/base/367432 >> >> Log: >> malloc: move malloc_type_internal into malloc_type >> >> According to code comments the original motivation was to allow for >> malloc_type_internal changes without ABI breakage. This can be >> trivially >> accomplished by providing spare fields and versioning the struct, as >> implemented in the patch below. >> >> The upshots are one less memory indirection on each alloc and >> disappearance >> of mt_zone. >> >> Reviewed by: markj >> Differential Revision: https://reviews.freebsd.org/D27104 > > With this commit kernel panic happens on amd64 as following. > > https://www.utahime.org/FreeBSD/FreeBSD.13-CURRENT.amd64.r367432.panic.png > > --- > Yasuhiro KIMURA > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sat Nov 7 01:32:16 2020 Return-Path: Delivered-To: svn-src-head@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 E67182DB883; Sat, 7 Nov 2020 01:32:16 +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 4CSfrJ6GHRz3Ly1; Sat, 7 Nov 2020 01:32:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA1632E54F; Sat, 7 Nov 2020 01:32:16 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A71WGxd029922; Sat, 7 Nov 2020 01:32:16 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A71WGiE029921; Sat, 7 Nov 2020 01:32:16 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011070132.0A71WGiE029921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 7 Nov 2020 01:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367438 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 01:32:17 -0000 Author: mjg Date: Sat Nov 7 01:32:16 2020 New Revision: 367438 URL: https://svnweb.freebsd.org/changeset/base/367438 Log: malloc: tweak the version check in r367432 to include type name While here fix a whitespace problem. Modified: head/sys/kern/kern_malloc.c Modified: head/sys/kern/kern_malloc.c ============================================================================== --- head/sys/kern/kern_malloc.c Fri Nov 6 23:37:59 2020 (r367437) +++ head/sys/kern/kern_malloc.c Sat Nov 7 01:32:16 2020 (r367438) @@ -1201,7 +1201,7 @@ mallocinit(void *dummy) NULL, NULL, NULL, NULL, #endif UMA_ALIGN_PTR, UMA_ZONE_MALLOC); - } + } for (;i <= size; i+= KMEM_ZBASE) kmemsize[i >> KMEM_ZSHIFT] = indx; } @@ -1218,8 +1218,8 @@ malloc_init(void *data) mtp = data; if (mtp->ks_version != M_VERSION) - panic("malloc_init: unsupported malloc type version %lu", - mtp->ks_version); + panic("malloc_init: type %s with unsupported version %lu", + mtp->ks_shortdesc, mtp->ks_version); mtip = &mtp->ks_mti; mtip->mti_stats = uma_zalloc_pcpu(mt_stats_zone, M_WAITOK | M_ZERO); From owner-svn-src-head@freebsd.org Sat Nov 7 01:50:47 2020 Return-Path: Delivered-To: svn-src-head@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 D890E2DC0A9; Sat, 7 Nov 2020 01:50:47 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from maybe.home.utahime.org (gate.home.utahime.org [183.180.29.210]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CSgFg3yShz3MwV; Sat, 7 Nov 2020 01:50:47 +0000 (UTC) (envelope-from yasu@utahime.org) Received: from eastasia.home.utahime.org (eastasia.home.utahime.org [192.168.174.1]) (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) (No client certificate requested) by maybe.home.utahime.org (Postfix) with ESMTPS id 0B3C32841D; Sat, 7 Nov 2020 10:50:43 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=utahime.org; s=maybe2019112701; t=1604713843; bh=jBNYyIHcSVAPAMI/DY82hViFVvY8NXolGtuyN8qfZnk=; h=Date:To:Cc:Subject:From:In-Reply-To:References; b=B8Y+el0Rtl3VuTXr1NiLnwPRR7yta+unbzQiSveW3bmdt3dvo4GbOfLvkVf8knhqU eWgFLnmQVlqc8KD13ilWOo7rW3DMXtEPiCmOTPjyMhnLZ3N3tlhDsbmsahe93DsM24 e3XgMSlwdcmEL6plIvgjdMx3XxNqIrYI2DmGOLSzyOpP/T/d8bdJfG0b2XovalbUal pB/B+biRbB0+YxDF9plG0Hos/IOfMvJN9qg9aHsQmTKsFO4rUer3PTY5FrfOdV7tXc rVwHVbjbPPuZg6JZHI7QCYPAqK2aRYm+CzePQnKg3dTdxVQkTEcbGzr7E3n8CmKV0O 7waC609XDI2GA== Received: from localhost (rolling.home.utahime.org [192.168.174.11]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by eastasia.home.utahime.org (Postfix) with ESMTPSA id 0C5F83B317; Sat, 7 Nov 2020 10:50:41 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.0 at eastasia.home.utahime.org Date: Sat, 07 Nov 2020 10:50:34 +0900 (JST) Message-Id: <20201107.105034.2180693369537407868.yasu@utahime.org> To: mjguzik@gmail.com Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys From: Yasuhiro KIMURA In-Reply-To: References: <202011062133.0A6LXxvo081199@repo.freebsd.org> <20201107.101825.1779017732143423450.yasu@utahime.org> X-Mailer: Mew version 6.8 on Emacs 27.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CSgFg3yShz3MwV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 01:50:48 -0000 From: Mateusz Guzik Subject: Re: svn commit: r367432 - in head: lib/libmemstat sys/cddl/dev/dtmalloc sys/kern sys/sys Date: Sat, 7 Nov 2020 02:25:05 +0100 > You need to recompile all modules. Sorry, I forgot to recompile emulators/virtualbox-ose-additions-nox11. After recompiling it panic disappeared. --- Yasuhiro KIMURA From owner-svn-src-head@freebsd.org Sat Nov 7 03:28:33 2020 Return-Path: Delivered-To: svn-src-head@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 70BB42DF5A6; Sat, 7 Nov 2020 03:28:33 +0000 (UTC) (envelope-from kevans@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 4CSjQT2qNTz3j43; Sat, 7 Nov 2020 03:28:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 494352FA6E; Sat, 7 Nov 2020 03:28:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A73SXNO099007; Sat, 7 Nov 2020 03:28:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A73SX5G099006; Sat, 7 Nov 2020 03:28:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011070328.0A73SX5G099006@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 03:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367439 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 03:28:33 -0000 Author: kevans Date: Sat Nov 7 03:28:32 2020 New Revision: 367439 URL: https://svnweb.freebsd.org/changeset/base/367439 Log: imgact_binmisc: minor re-organization of imgact_binmisc_exec exits Notably, streamline error paths through the existing 'done' label, making it easier to quickly verify correct cleanup. Future work might add a kernel-only flag to indicate that a interpreter uses #a. Currently, all executions via imgact_binmisc pay the penalty of constructing sname/fname, even if they will not use it. qemu-user-static doesn't need it, the stock rc script for qemu-user-static certainly doesn't use it, and I suspect these are the vast majority of (if not the only) current users. MFC after: 1 week Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Sat Nov 7 01:32:16 2020 (r367438) +++ head/sys/kern/imgact_binmisc.c Sat Nov 7 03:28:32 2020 (r367439) @@ -580,24 +580,24 @@ imgact_binmisc_exec(struct image_params *imgp) struct sbuf *sname; char *s, *d; + sname = NULL; /* Do we have an interpreter for the given image header? */ sx_slock(&interp_list_sx); if ((ibe = imgact_binmisc_find_interpreter(image_header)) == NULL) { - sx_sunlock(&interp_list_sx); - return (-1); + error = -1; + goto done; } /* No interpreter nesting allowed. */ if (imgp->interpreted & IMGACT_BINMISC) { - sx_sunlock(&interp_list_sx); - return (ENOEXEC); + error = ENOEXEC; + goto done; } imgp->interpreted |= IMGACT_BINMISC; if (imgp->args->fname != NULL) { fname = imgp->args->fname; - sname = NULL; } else { /* Use the fdescfs(5) path for fexecve(2). */ sname = sbuf_new_auto(); @@ -636,7 +636,6 @@ imgact_binmisc_exec(struct image_params *imgp) default: /* Hmm... This shouldn't happen. */ - sx_sunlock(&interp_list_sx); printf("%s: Unknown macro #%c sequence in " "interpreter string\n", KMOD_NAME, *(s + 1)); error = EINVAL; @@ -648,7 +647,6 @@ imgact_binmisc_exec(struct image_params *imgp) /* Make room for the interpreter */ error = exec_args_adjust_args(imgp->args, 0, offset); if (error != 0) { - sx_sunlock(&interp_list_sx); goto done; } @@ -698,11 +696,11 @@ imgact_binmisc_exec(struct image_params *imgp) s++; } *d = '\0'; - sx_sunlock(&interp_list_sx); imgp->interpreter_name = imgp->args->begin_argv; done: + sx_sunlock(&interp_list_sx); if (sname) sbuf_delete(sname); return (error); From owner-svn-src-head@freebsd.org Sat Nov 7 03:29:04 2020 Return-Path: Delivered-To: svn-src-head@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 F037A2DF4B6; Sat, 7 Nov 2020 03:29:04 +0000 (UTC) (envelope-from kevans@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 4CSjR46TtYz3jNl; Sat, 7 Nov 2020 03:29:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1AA12FF84; Sat, 7 Nov 2020 03:29:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A73T4DS099076; Sat, 7 Nov 2020 03:29:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A73T4Oe099075; Sat, 7 Nov 2020 03:29:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011070329.0A73T4Oe099075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 03:29:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367440 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 03:29:05 -0000 Author: kevans Date: Sat Nov 7 03:29:04 2020 New Revision: 367440 URL: https://svnweb.freebsd.org/changeset/base/367440 Log: epoch: support non-preemptible epochs checking in_epoch() Previously, non-preemptible epochs could not check; in_epoch() would always fail, usually because non-preemptible epochs don't imply THREAD_NO_SLEEPING. For default epochs, it's easy enough to verify that we're in the given epoch: if we're in a critical section and our record for the given epoch is active, then we're in it. This patch also adds some additional INVARIANTS bookkeeping. Notably, we set and check the recorded thread in epoch_enter/epoch_exit to try and catch some edge-cases for the caller. It also checks upon freeing that none of the records had a thread in the epoch, which may make it a little easier to diagnose some improper use if epoch_free() took place while some other thread was inside. This version differs slightly from what was just previously reviewed by the below-listed, in that in_epoch() will assert that no CPU has this thread recorded even if it *is* currently in a critical section. This is intended to catch cases where the caller might have somehow messed up critical section nesting, we can catch both if they exited the critical section or if they exited, migrated, then re-entered (on the wrong CPU). Reviewed by: kib, markj (both previous version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27098 Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Sat Nov 7 03:28:32 2020 (r367439) +++ head/sys/kern/subr_epoch.c Sat Nov 7 03:29:04 2020 (r367440) @@ -72,6 +72,10 @@ typedef struct epoch_record { volatile struct epoch_tdlist er_tdlist; volatile uint32_t er_gen; uint32_t er_cpuid; +#ifdef INVARIANTS + /* Used to verify record ownership for non-preemptible epochs. */ + struct thread *er_td; +#endif } __aligned(EPOCH_ALIGN) *epoch_record_t; struct epoch { @@ -377,6 +381,9 @@ done: void epoch_free(epoch_t epoch) { +#ifdef INVARIANTS + int cpu; +#endif EPOCH_LOCK(); @@ -390,6 +397,21 @@ epoch_free(epoch_t epoch) * to zero, by calling epoch_wait() on the global_epoch: */ epoch_wait(global_epoch); +#ifdef INVARIANTS + CPU_FOREACH(cpu) { + epoch_record_t er; + + er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); + + /* + * Sanity check: none of the records should be in use anymore. + * We drained callbacks above and freeing the pcpu records is + * imminent. + */ + MPASS(er->er_td == NULL); + MPASS(TAILQ_EMPTY(&er->er_tdlist)); + } +#endif uma_zfree_pcpu(pcpu_zone_record, epoch->e_pcpu_record); mtx_destroy(&epoch->e_drain_mtx); sx_destroy(&epoch->e_drain_sx); @@ -434,6 +456,8 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et sched_pin(); td->td_pre_epoch_prio = td->td_priority; er = epoch_currecord(epoch); + /* Record-level tracking is reserved for non-preemptible epochs. */ + MPASS(er->er_td == NULL); TAILQ_INSERT_TAIL(&er->er_tdlist, et, et_link); ck_epoch_begin(&er->er_record, &et->et_section); critical_exit(); @@ -448,6 +472,15 @@ epoch_enter(epoch_t epoch) INIT_CHECK(epoch); critical_enter(); er = epoch_currecord(epoch); +#ifdef INVARIANTS + if (er->er_record.active == 0) { + MPASS(er->er_td == NULL); + er->er_td = curthread; + } else { + /* We've recursed, just make sure our accounting isn't wrong. */ + MPASS(er->er_td == curthread); + } +#endif ck_epoch_begin(&er->er_record, NULL); } @@ -468,6 +501,8 @@ _epoch_exit_preempt(epoch_t epoch, epoch_tracker_t et MPASS(et->et_td == td); #ifdef INVARIANTS et->et_td = (void*)0xDEADBEEF; + /* Record-level tracking is reserved for non-preemptible epochs. */ + MPASS(er->er_td == NULL); #endif ck_epoch_end(&er->er_record, &et->et_section); TAILQ_REMOVE(&er->er_tdlist, et, et_link); @@ -488,6 +523,11 @@ epoch_exit(epoch_t epoch) INIT_CHECK(epoch); er = epoch_currecord(epoch); ck_epoch_end(&er->er_record, NULL); +#ifdef INVARIANTS + MPASS(er->er_td == curthread); + if (er->er_record.active == 0) + er->er_td = NULL; +#endif critical_exit(); } @@ -777,18 +817,18 @@ epoch_call_task(void *arg __unused) } } -int -in_epoch_verbose(epoch_t epoch, int dump_onfail) +static int +in_epoch_verbose_preempt(epoch_t epoch, int dump_onfail) { + epoch_record_t er; struct epoch_tracker *tdwait; struct thread *td; - epoch_record_t er; + MPASS(epoch != NULL); + MPASS((epoch->e_flags & EPOCH_PREEMPT) != 0); td = curthread; if (THREAD_CAN_SLEEP()) return (0); - if (__predict_false((epoch) == NULL)) - return (0); critical_enter(); er = epoch_currecord(epoch); TAILQ_FOREACH(tdwait, &er->er_tdlist, et_link) @@ -807,6 +847,66 @@ in_epoch_verbose(epoch_t epoch, int dump_onfail) #endif critical_exit(); return (0); +} + +#ifdef INVARIANTS +static void +epoch_assert_nocpu(epoch_t epoch, struct thread *td) +{ + epoch_record_t er; + int cpu; + bool crit; + + crit = td->td_critnest > 0; + + /* Check for a critical section mishap. */ + CPU_FOREACH(cpu) { + er = zpcpu_get_cpu(epoch->e_pcpu_record, cpu); + KASSERT(er->er_td != td, + ("%s critical section in epoch '%s', from cpu %d", + (crit ? "exited" : "re-entered"), epoch->e_name, cpu)); + } +} +#else +#define epoch_assert_nocpu(e, td) +#endif + +int +in_epoch_verbose(epoch_t epoch, int dump_onfail) +{ + epoch_record_t er; + struct thread *td; + + if (__predict_false((epoch) == NULL)) + return (0); + if ((epoch->e_flags & EPOCH_PREEMPT) != 0) + return (in_epoch_verbose_preempt(epoch, dump_onfail)); + + /* + * The thread being in a critical section is a necessary + * condition to be correctly inside a non-preemptible epoch, + * so it's definitely not in this epoch. + */ + td = curthread; + if (td->td_critnest == 0) { + epoch_assert_nocpu(epoch, td); + return (0); + } + + /* + * The current cpu is in a critical section, so the epoch record will be + * stable for the rest of this function. Knowing that the record is not + * active is sufficient for knowing whether we're in this epoch or not, + * since it's a pcpu record. + */ + er = epoch_currecord(epoch); + if (er->er_record.active == 0) { + epoch_assert_nocpu(epoch, td); + return (0); + } + + MPASS(er->er_td == td); + return (1); } int From owner-svn-src-head@freebsd.org Sat Nov 7 03:43:46 2020 Return-Path: Delivered-To: svn-src-head@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 3E4502E12B4; Sat, 7 Nov 2020 03:43:46 +0000 (UTC) (envelope-from kevans@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 4CSjm21Lqgz3l4q; Sat, 7 Nov 2020 03:43:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16A1C2FD71; Sat, 7 Nov 2020 03:43:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A73hjU3011427; Sat, 7 Nov 2020 03:43:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A73hjJF011426; Sat, 7 Nov 2020 03:43:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011070343.0A73hjJF011426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 03:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367441 - head/usr.sbin/binmiscctl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/binmiscctl X-SVN-Commit-Revision: 367441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 03:43:46 -0000 Author: kevans Date: Sat Nov 7 03:43:45 2020 New Revision: 367441 URL: https://svnweb.freebsd.org/changeset/base/367441 Log: binmiscctl(8): miscellaneous cleanup - Bad whitespace in Makefile. - Reordered headers, sys/ first. - Annotated fatal/usage __dead2 to help `make analyze` out a little bit. - Spell a couple of sizeof constructs as "nitems" and "howmany" instead. MFC after: 1 week Modified: head/usr.sbin/binmiscctl/Makefile head/usr.sbin/binmiscctl/binmiscctl.c Modified: head/usr.sbin/binmiscctl/Makefile ============================================================================== --- head/usr.sbin/binmiscctl/Makefile Sat Nov 7 03:29:04 2020 (r367440) +++ head/usr.sbin/binmiscctl/Makefile Sat Nov 7 03:43:45 2020 (r367441) @@ -3,7 +3,7 @@ # .include - + PROG= binmiscctl MAN= binmiscctl.8 Modified: head/usr.sbin/binmiscctl/binmiscctl.c ============================================================================== --- head/usr.sbin/binmiscctl/binmiscctl.c Sat Nov 7 03:29:04 2020 (r367440) +++ head/usr.sbin/binmiscctl/binmiscctl.c Sat Nov 7 03:43:45 2020 (r367441) @@ -28,6 +28,12 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include + #include #include #include @@ -37,12 +43,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include -#include -#include - enum cmd { CMD_ADD = 0, CMD_REMOVE, @@ -134,7 +134,7 @@ static char const *cmd_sysctl_name[] = { IBE_SYSCTL_NAME_LIST }; -static void +static void __dead2 usage(const char *format, ...) { va_list args; @@ -150,7 +150,7 @@ usage(const char *format, ...) fprintf(stderr, "\n"); fprintf(stderr, "usage: %s command [args...]\n\n", __progname); - for(i = 0; i < ( sizeof (cmds) / sizeof (cmds[0])); i++) { + for(i = 0; i < nitems(cmds); i++) { fprintf(stderr, "%s:\n", cmds[i].desc); fprintf(stderr, "\t%s %s %s\n\n", __progname, cmds[i].name, cmds[i].args); @@ -159,7 +159,7 @@ usage(const char *format, ...) exit (error); } -static void +static void __dead2 fatal(const char *format, ...) { va_list args; @@ -232,7 +232,7 @@ demux_cmd(__unused int argc, char *const argv[]) optind = 1; optreset = 1; - for(i = 0; i < ( sizeof (cmds) / sizeof (cmds[0])); i++) { + for(i = 0; i < nitems(cmds); i++) { if (!strcasecmp(cmds[i].name, argv[0])) { return (i); } @@ -505,7 +505,7 @@ main(int argc, char **argv) free(xbe_outp); fatal("Fatal: %s", strerror(errno)); } - for(i = 0; i < (xbe_out_sz / sizeof(xbe_out)); i++) + for(i = 0; i < howmany(xbe_out_sz, sizeof(xbe_out)); i++) printxbe(&xbe_outp[i]); } From owner-svn-src-head@freebsd.org Sat Nov 7 04:10:23 2020 Return-Path: Delivered-To: svn-src-head@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 D3C952E2622; Sat, 7 Nov 2020 04:10:23 +0000 (UTC) (envelope-from kevans@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 4CSkLl5gPBz3mbR; Sat, 7 Nov 2020 04:10:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B59196A3; Sat, 7 Nov 2020 04:10:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A74ANRi023775; Sat, 7 Nov 2020 04:10:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A74ANkW023773; Sat, 7 Nov 2020 04:10:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011070410.0A74ANkW023773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 04:10:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367442 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 04:10:23 -0000 Author: kevans Date: Sat Nov 7 04:10:23 2020 New Revision: 367442 URL: https://svnweb.freebsd.org/changeset/base/367442 Log: imgact_binmisc: validate flags coming from userland We may want to reserve bits in the future for kernel-only use, so start rejecting any that aren't the two that we're currently expecting from userland. MFC after: 1 week Modified: head/sys/kern/imgact_binmisc.c head/sys/sys/imgact_binmisc.h Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Sat Nov 7 03:43:45 2020 (r367441) +++ head/sys/kern/imgact_binmisc.c Sat Nov 7 04:10:23 2020 (r367442) @@ -434,6 +434,8 @@ sysctl_kern_binmisc(SYSCTL_HANDLER_ARGS) return (error); if (IBE_VERSION != xbe.xbe_version) return (EINVAL); + if ((xbe.xbe_flags & ~IBF_VALID_UFLAGS) != 0) + return (EINVAL); if (interp_list_entry_count == IBE_MAX_ENTRIES) return (ENOSPC); error = imgact_binmisc_add_entry(&xbe); Modified: head/sys/sys/imgact_binmisc.h ============================================================================== --- head/sys/sys/imgact_binmisc.h Sat Nov 7 03:43:45 2020 (r367441) +++ head/sys/sys/imgact_binmisc.h Sat Nov 7 04:10:23 2020 (r367442) @@ -53,6 +53,8 @@ #define IBF_ENABLED 0x0001 /* Entry is active. */ #define IBF_USE_MASK 0x0002 /* Use mask on header magic field. */ +#define IBF_VALID_UFLAGS 0x0003 /* Bits allowed from userland. */ + /* * Used with sysctlbyname() to pass imgact bin misc entries in and out of the * kernel. From owner-svn-src-head@freebsd.org Sat Nov 7 04:15:26 2020 Return-Path: Delivered-To: svn-src-head@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 27A4A2E2A23; Sat, 7 Nov 2020 04:15:26 +0000 (UTC) (envelope-from rew@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 4CSkSY5hTyz3nBD; Sat, 7 Nov 2020 04:15:25 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 B6CA75EA; Sat, 7 Nov 2020 04:15:25 +0000 (UTC) (envelope-from rew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A74FPlL030518; Sat, 7 Nov 2020 04:15:25 GMT (envelope-from rew@FreeBSD.org) Received: (from rew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A74FOmq030514; Sat, 7 Nov 2020 04:15:25 GMT (envelope-from rew@FreeBSD.org) Message-Id: <202011070415.0A74FOmq030514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rew set sender to rew@FreeBSD.org using -f From: Robert Wing Date: Sat, 7 Nov 2020 04:15:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367443 - in head: share/man/man5 usr.sbin/periodic usr.sbin/periodic/etc/daily X-SVN-Group: head X-SVN-Commit-Author: rew X-SVN-Commit-Paths: in head: share/man/man5 usr.sbin/periodic usr.sbin/periodic/etc/daily X-SVN-Commit-Revision: 367443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 04:15:26 -0000 Author: rew Date: Sat Nov 7 04:15:24 2020 New Revision: 367443 URL: https://svnweb.freebsd.org/changeset/base/367443 Log: Add a periodic script to backup output generated from `gmirror list`. Disabled by default. PR: 86388 Submitted by: Miroslav Lachman <000.fbsd@quip.cz> Reviewed by: allanjude, gbe Approved by: allanjude (mentor) MFC after: 4 weeks Event: July 2020 Bugathon Differential Revision: https://reviews.freebsd.org/D25631 Added: head/usr.sbin/periodic/etc/daily/222.backup-gmirror (contents, props changed) Modified: head/share/man/man5/periodic.conf.5 head/usr.sbin/periodic/etc/daily/Makefile head/usr.sbin/periodic/periodic.conf Modified: head/share/man/man5/periodic.conf.5 ============================================================================== --- head/share/man/man5/periodic.conf.5 Sat Nov 7 04:10:23 2020 (r367442) +++ head/share/man/man5/periodic.conf.5 Sat Nov 7 04:15:24 2020 (r367443) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 6, 2020 +.Dd November 7, 2020 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -257,6 +257,20 @@ as configured in Set to .Dq Li YES to create backup of EFI System Partition (ESP). +.It Va daily_backup_gmirror_enable +.Pq Vt bool +Set to +.Dq Li YES +to create backup of gmirror information (i.e., output of +.Nm gmirror Cm list ) , +see +.Xr gmirror 8 . +.It Va daily_backup_gmirror_verbose +.Pq Vt bool +Set to +.Dq Li YES +to report a diff between the new backup and the existing backup +in the daily output. .It Va daily_backup_gpart_enable .Pq Vt bool Set to Added: head/usr.sbin/periodic/etc/daily/222.backup-gmirror ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/periodic/etc/daily/222.backup-gmirror Sat Nov 7 04:15:24 2020 (r367443) @@ -0,0 +1,72 @@ +#!/bin/sh + +# $FreeBSD$ +# Created by: Miroslav Lachman <000.fbsd@quip.cz> + +# Backup output from `gmirror list`, which provides detailed information +# of all gmirrors. The backup will be stored in /var/backups/. + +# If there is a global system configuration file, suck it in. +# +if [ -r /etc/defaults/periodic.conf ] +then + . /etc/defaults/periodic.conf + source_periodic_confs +fi + +bak_dir=/var/backups + +rotate() { + base_name=$1 + show_diff=$2 + file="$bak_dir/$base_name" + + if [ -f "${file}.bak" ]; then + rc=0 + if cmp -s "${file}.bak" "${file}.tmp"; then + rm "${file}.tmp" + else + rc=1 + [ -n "$show_diff" ] && diff "${file}.bak" "${file}.tmp" + mv "${file}.bak" "${file}.bak2" || rc=3 + mv "${file}.tmp" "${file}.bak" || rc=3 + fi + else + rc=1 + mv "${file}.tmp" "${file}.bak" || rc=3 + [ -n "$show_diff" ] && cat "${file}.bak" + fi +} + +case "$daily_backup_gmirror_verbose" in + [Yy][Ee][Ss]) show="YES" +esac + +case "$daily_backup_gmirror_enable" in + [Yy][Ee][Ss]) + + gmirrors=$(gmirror status 2> /dev/null | \ + awk '$1 ~ /^mirror\// { sub(/mirror\//, ""); print $1 }') + + if [ -z "$gmirrors" ]; then + echo "" + echo "daily_backup_gmirror_enable is set to YES but no gmirrors found." + rc=2 + else + echo "" + echo "Backup of gmirror information for:"; + + for m in ${gmirrors}; do + echo "$m" + safe_name=$(echo "gmirror.${m}" | tr -cs ".[:alnum:]\n" "_") + if ! gmirror status -s "${m}" | grep -F -v "COMPLETE"; then + gmirror list "${m}" > "$bak_dir/$safe_name.tmp" + rotate "$safe_name" $show + fi + done + fi + ;; + *) rc=0;; +esac + +exit $rc Modified: head/usr.sbin/periodic/etc/daily/Makefile ============================================================================== --- head/usr.sbin/periodic/etc/daily/Makefile Sat Nov 7 04:10:23 2020 (r367442) +++ head/usr.sbin/periodic/etc/daily/Makefile Sat Nov 7 04:15:24 2020 (r367443) @@ -11,6 +11,7 @@ CONFS= 100.clean-disks \ 200.backup-passwd \ 210.backup-aliases \ 221.backup-gpart \ + 222.backup-gmirror \ 330.news \ 400.status-disks \ 401.status-graid \ Modified: head/usr.sbin/periodic/periodic.conf ============================================================================== --- head/usr.sbin/periodic/periodic.conf Sat Nov 7 04:10:23 2020 (r367442) +++ head/usr.sbin/periodic/periodic.conf Sat Nov 7 04:15:24 2020 (r367443) @@ -79,8 +79,12 @@ daily_backup_aliases_enable="YES" # Backup mail alia # 221.backup-gpart daily_backup_gpart_enable="YES" # Backup partition table/boot partition/MBR -daily_backup_gpart_verbose="NO" # Be verbose if new backup differs from the new one +daily_backup_gpart_verbose="NO" # Be verbose if new backup differs from the old one daily_backup_efi_enable="NO" # Backup EFI system partition (ESP) + +# 222.backup-gmirror +daily_backup_gmirror_enable="NO" # Backup of gmirror info (i.e., output of `gmirror list`) +daily_backup_gmirror_verbose="NO" # Log diff if new backup differs from the old one # 223.backup-zfs daily_backup_zfs_enable="NO" # Backup output from zpool/zfs list From owner-svn-src-head@freebsd.org Sat Nov 7 05:10:46 2020 Return-Path: Delivered-To: svn-src-head@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 B7B6D2E3FDB; Sat, 7 Nov 2020 05:10:46 +0000 (UTC) (envelope-from kevans@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 4CSlhQ4kY6z3r3R; Sat, 7 Nov 2020 05:10:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94D861394; Sat, 7 Nov 2020 05:10:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A75Akbr061120; Sat, 7 Nov 2020 05:10:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A75Akhe061119; Sat, 7 Nov 2020 05:10:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011070510.0A75Akhe061119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 05:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367444 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 05:10:46 -0000 Author: kevans Date: Sat Nov 7 05:10:46 2020 New Revision: 367444 URL: https://svnweb.freebsd.org/changeset/base/367444 Log: imgact_binmisc: abstract away the list lock (NFC) This module handles relatively few execs (initial qemu-user-static, then qemu-user-static handles exec'ing itself for binaries it's already running), but all execs pay the price of at least taking the relatively expensive sx/slock to check for a match when this module is loaded. Future work will almost certainly swap this out for another lock, perhaps an rmslock. The RLOCK/WLOCK phrasing was chosen based on what the callers are really wanting, rather than using the verbiage typically appropriate for an sx. MFC after: 1 week Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Sat Nov 7 04:15:24 2020 (r367443) +++ head/sys/kern/imgact_binmisc.c Sat Nov 7 05:10:46 2020 (r367444) @@ -98,6 +98,16 @@ static int interp_list_entry_count; static struct sx interp_list_sx; +#define INTERP_LIST_WLOCK() sx_xlock(&interp_list_sx) +#define INTERP_LIST_RLOCK() sx_slock(&interp_list_sx) +#define INTERP_LIST_WUNLOCK() sx_xunlock(&interp_list_sx) +#define INTERP_LIST_RUNLOCK() sx_sunlock(&interp_list_sx) + +#define INTERP_LIST_LOCK_INIT() sx_init(&interp_list_sx, KMOD_NAME) +#define INTERP_LIST_LOCK_DESTROY() sx_destroy(&interp_list_sx) + +#define INTERP_LIST_ASSERT_LOCKED() sx_assert(&interp_list_sx, SA_LOCKED) + /* * Populate the entry with the information about the interpreter. */ @@ -198,7 +208,7 @@ imgact_binmisc_find_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_assert(&interp_list_sx, SA_LOCKED); + INTERP_LIST_ASSERT_LOCKED(); SLIST_FOREACH(ibe, &interpreter_list, link) { if (strncmp(name, ibe->ibe_name, IBE_NAME_MAX) == 0) @@ -256,9 +266,9 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) } } - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if (imgact_binmisc_find_entry(xbe->xbe_name) != NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (EEXIST); } @@ -267,7 +277,7 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) SLIST_INSERT_HEAD(&interpreter_list, ibe, link); interp_list_entry_count++; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (0); } @@ -281,14 +291,14 @@ imgact_binmisc_remove_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (ENOENT); } SLIST_REMOVE(&interpreter_list, ibe, imgact_binmisc_entry, link); interp_list_entry_count--; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); imgact_binmisc_destroy_entry(ibe); @@ -304,14 +314,14 @@ imgact_binmisc_disable_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (ENOENT); } ibe->ibe_flags &= ~IBF_ENABLED; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (0); } @@ -325,14 +335,14 @@ imgact_binmisc_enable_entry(char *name) { imgact_binmisc_entry_t *ibe; - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (ENOENT); } ibe->ibe_flags |= IBF_ENABLED; - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); return (0); } @@ -343,8 +353,7 @@ imgact_binmisc_populate_xbe(ximgact_binmisc_entry_t *x { uint32_t i; - sx_assert(&interp_list_sx, SA_LOCKED); - + INTERP_LIST_ASSERT_LOCKED(); memset(xbe, 0, sizeof(*xbe)); strlcpy(xbe->xbe_name, ibe->ibe_name, IBE_NAME_MAX); @@ -375,14 +384,14 @@ imgact_binmisc_lookup_entry(char *name, ximgact_binmis imgact_binmisc_entry_t *ibe; int error = 0; - sx_slock(&interp_list_sx); + INTERP_LIST_RLOCK(); if ((ibe = imgact_binmisc_find_entry(name)) == NULL) { - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); return (ENOENT); } error = imgact_binmisc_populate_xbe(xbe, ibe); - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); return (error); } @@ -397,7 +406,7 @@ imgact_binmisc_get_all_entries(struct sysctl_req *req) imgact_binmisc_entry_t *ibe; int error = 0, count; - sx_slock(&interp_list_sx); + INTERP_LIST_RLOCK(); count = interp_list_entry_count; xbe = malloc(sizeof(*xbe) * count, M_BINMISC, M_WAITOK|M_ZERO); @@ -407,7 +416,7 @@ imgact_binmisc_get_all_entries(struct sysctl_req *req) if (error) break; } - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); if (!error) error = SYSCTL_OUT(req, xbe, sizeof(*xbe) * count); @@ -546,7 +555,7 @@ imgact_binmisc_find_interpreter(const char *image_head int i; size_t sz; - sx_assert(&interp_list_sx, SA_LOCKED); + INTERP_LIST_ASSERT_LOCKED(); SLIST_FOREACH(ibe, &interpreter_list, link) { if (!(IBF_ENABLED & ibe->ibe_flags)) @@ -584,7 +593,7 @@ imgact_binmisc_exec(struct image_params *imgp) sname = NULL; /* Do we have an interpreter for the given image header? */ - sx_slock(&interp_list_sx); + INTERP_LIST_RLOCK(); if ((ibe = imgact_binmisc_find_interpreter(image_header)) == NULL) { error = -1; goto done; @@ -702,7 +711,7 @@ imgact_binmisc_exec(struct image_params *imgp) imgp->interpreter_name = imgp->args->begin_argv; done: - sx_sunlock(&interp_list_sx); + INTERP_LIST_RUNLOCK(); if (sname) sbuf_delete(sname); return (error); @@ -712,7 +721,7 @@ static void imgact_binmisc_init(void *arg) { - sx_init(&interp_list_sx, KMOD_NAME); + INTERP_LIST_LOCK_INIT(); } static void @@ -721,15 +730,15 @@ imgact_binmisc_fini(void *arg) imgact_binmisc_entry_t *ibe, *ibe_tmp; /* Free all the interpreters. */ - sx_xlock(&interp_list_sx); + INTERP_LIST_WLOCK(); SLIST_FOREACH_SAFE(ibe, &interpreter_list, link, ibe_tmp) { SLIST_REMOVE(&interpreter_list, ibe, imgact_binmisc_entry, link); imgact_binmisc_destroy_entry(ibe); } - sx_xunlock(&interp_list_sx); + INTERP_LIST_WUNLOCK(); - sx_destroy(&interp_list_sx); + INTERP_LIST_LOCK_DESTROY(); } SYSINIT(imgact_binmisc, SI_SUB_EXEC, SI_ORDER_MIDDLE, imgact_binmisc_init, From owner-svn-src-head@freebsd.org Sat Nov 7 13:09:51 2020 Return-Path: Delivered-To: svn-src-head@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 B879B2EF3DC; Sat, 7 Nov 2020 13:09:51 +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 4CSyKC4tY7z4n3G; Sat, 7 Nov 2020 13:09:51 +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 9ACE37189; Sat, 7 Nov 2020 13:09:51 +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 0A7D9pbe046518; Sat, 7 Nov 2020 13:09:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7D9pcm046517; Sat, 7 Nov 2020 13:09:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <202011071309.0A7D9pcm046517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 7 Nov 2020 13:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367445 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 13:09:51 -0000 Author: trasz Date: Sat Nov 7 13:09:51 2020 New Revision: 367445 URL: https://svnweb.freebsd.org/changeset/base/367445 Log: Move TDB_USERWR check under 'if (traced)'. If we hadn't been traced in the first place when syscallenter() started executing, we can ignore TDB_USERWR. TDB_USERWR can get set, sure, but if it does, it's because the debugger raced with the syscall, and it cannot depend on winning that race. Reviewed by: kib MFC after: 2 weeks Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D26585 Modified: head/sys/kern/subr_syscall.c Modified: head/sys/kern/subr_syscall.c ============================================================================== --- head/sys/kern/subr_syscall.c Sat Nov 7 05:10:46 2020 (r367444) +++ head/sys/kern/subr_syscall.c Sat Nov 7 13:09:51 2020 (r367445) @@ -97,21 +97,22 @@ syscallenter(struct thread *td) if (p->p_ptevents & PTRACE_SCE) ptracestop((td), SIGTRAP, NULL); PROC_UNLOCK(p); - } - if (__predict_false((td->td_dbgflags & TDB_USERWR) != 0)) { - /* - * Reread syscall number and arguments if debugger - * modified registers or memory. - */ - error = (p->p_sysent->sv_fetch_syscall_args)(td); - se = sa->callp; + + if ((td->td_dbgflags & TDB_USERWR) != 0) { + /* + * Reread syscall number and arguments if debugger + * modified registers or memory. + */ + error = (p->p_sysent->sv_fetch_syscall_args)(td); + se = sa->callp; #ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(sa->code, se->sy_narg, sa->args); + if (KTRPOINT(td, KTR_SYSCALL)) + ktrsyscall(sa->code, se->sy_narg, sa->args); #endif - if (error != 0) { - td->td_errno = error; - goto retval; + if (error != 0) { + td->td_errno = error; + goto retval; + } } } From owner-svn-src-head@freebsd.org Sat Nov 7 14:58:02 2020 Return-Path: Delivered-To: svn-src-head@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 5EAC4461A63; Sat, 7 Nov 2020 14:58:02 +0000 (UTC) (envelope-from mmel@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 4CT0k21dsFz4tmS; Sat, 7 Nov 2020 14:58:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 2AF5B1080D; Sat, 7 Nov 2020 14:58:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7Ew25i015368; Sat, 7 Nov 2020 14:58:02 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7Ew1Px015367; Sat, 7 Nov 2020 14:58:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011071458.0A7Ew1Px015367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 7 Nov 2020 14:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367447 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 14:58:02 -0000 Author: mmel Date: Sat Nov 7 14:58:01 2020 New Revision: 367447 URL: https://svnweb.freebsd.org/changeset/base/367447 Log: Add a method to determine whether given interrupt is per CPU or not. MFC after: 2 weeks Modified: head/sys/kern/subr_intr.c head/sys/sys/intr.h Modified: head/sys/kern/subr_intr.c ============================================================================== --- head/sys/kern/subr_intr.c Sat Nov 7 13:16:11 2020 (r367446) +++ head/sys/kern/subr_intr.c Sat Nov 7 14:58:01 2020 (r367447) @@ -946,6 +946,21 @@ intr_resolve_irq(device_t dev, intptr_t xref, struct i } } +bool +intr_is_per_cpu(struct resource *res) +{ + u_int res_id; + struct intr_irqsrc *isrc; + + res_id = (u_int)rman_get_start(res); + isrc = intr_map_get_isrc(res_id); + + if (isrc == NULL) + panic("Attempt to get isrc for non-active resource id: %u\n", + res_id); + return ((isrc->isrc_flags & INTR_ISRCF_PPI) != 0); +} + int intr_activate_irq(device_t dev, struct resource *res) { Modified: head/sys/sys/intr.h ============================================================================== --- head/sys/sys/intr.h Sat Nov 7 13:16:11 2020 (r367446) +++ head/sys/sys/intr.h Sat Nov 7 14:58:01 2020 (r367447) @@ -115,6 +115,7 @@ int intr_pic_deregister(device_t, intptr_t); int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *, u_int); struct intr_pic *intr_pic_add_handler(device_t, struct intr_pic *, intr_child_irq_filter_t *, void *, uintptr_t, uintptr_t); +bool intr_is_per_cpu(struct resource *); extern device_t intr_irq_root_dev; From owner-svn-src-head@freebsd.org Sat Nov 7 15:38:02 2020 Return-Path: Delivered-To: svn-src-head@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 23DF4462C76; Sat, 7 Nov 2020 15:38:02 +0000 (UTC) (envelope-from kevans@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 4CT1c9753lz3CT5; Sat, 7 Nov 2020 15:38:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5C4C10E1D; Sat, 7 Nov 2020 15:38:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7Fc1vp040114; Sat, 7 Nov 2020 15:38:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7Fc1MM040113; Sat, 7 Nov 2020 15:38:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011071538.0A7Fc1MM040113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 15:38:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367448 - head/sys/dev/vt X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/vt X-SVN-Commit-Revision: 367448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 15:38:02 -0000 Author: kevans Date: Sat Nov 7 15:38:01 2020 New Revision: 367448 URL: https://svnweb.freebsd.org/changeset/base/367448 Log: vt: resolve conflict between VT_ALT_TO_ESC_HACK and DBG When using the ALT+CTRL+ESC sequence to break into kdb, the keyboard is completely borked when you return. watch(8) shows that it's working, but it's inserting escape sequences. Further investigation revealed that VT_ALT_TO_ESC_HACK is the default and directly conflicts with this sequence, so upon return from the debugger ALKED is set. If they triggered the break to debugger, it's safe to assume they didn't mean to use VT_ALT_TO_ESC_HACK, so just unset it to reduce the surprise when the keyboard seems non-functional upon return. Reviewed by: tsoome MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27109 Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Sat Nov 7 14:58:01 2020 (r367447) +++ head/sys/dev/vt/vt_core.c Sat Nov 7 15:38:01 2020 (r367448) @@ -725,13 +725,22 @@ vt_scroll(struct vt_window *vw, int offset, int whence } static int -vt_machine_kbdevent(int c) +vt_machine_kbdevent(struct vt_device *vd, int c) { switch (c) { case SPCLKEY | DBG: /* kbdmap(5) keyword `debug`. */ - if (vt_kbd_debug) + if (vt_kbd_debug) { kdb_enter(KDB_WHY_BREAK, "manual escape to debugger"); +#if VT_ALT_TO_ESC_HACK + /* + * There's an unfortunate conflict between SPCLKEY|DBG + * and VT_ALT_TO_ESC_HACK. Just assume they didn't mean + * it if we got to here. + */ + vd->vd_kbstate &= ~ALKED; +#endif + } return (1); case SPCLKEY | HALT: /* kbdmap(5) keyword `halt`. */ if (vt_kbd_halt) @@ -864,7 +873,7 @@ vt_processkey(keyboard_t *kbd, struct vt_device *vd, i return (0); #endif - if (vt_machine_kbdevent(c)) + if (vt_machine_kbdevent(vd, c)) return (0); if (vw->vw_flags & VWF_SCROLL) { From owner-svn-src-head@freebsd.org Sat Nov 7 16:42:00 2020 Return-Path: Delivered-To: svn-src-head@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 717C1464B04; Sat, 7 Nov 2020 16:42:00 +0000 (UTC) (envelope-from kevans@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 4CT3202t3Xz3J8V; Sat, 7 Nov 2020 16:42:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 562C6119C2; Sat, 7 Nov 2020 16:42:00 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7Gg0sD083573; Sat, 7 Nov 2020 16:42:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7Gg0B6083572; Sat, 7 Nov 2020 16:42:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011071642.0A7Gg0B6083572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 16:42:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367452 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 16:42:00 -0000 Author: kevans Date: Sat Nov 7 16:41:59 2020 New Revision: 367452 URL: https://svnweb.freebsd.org/changeset/base/367452 Log: imgact_binmisc: reorder members of struct imgact_binmisc_entry (NFC) This doesn't change anything at the moment since the out-of-order elements were a pair of uint32_t, but future additions may have caused unnecessary padding by following the existing precedent. MFC after: 1 week Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Sat Nov 7 16:35:48 2020 (r367451) +++ head/sys/kern/imgact_binmisc.c Sat Nov 7 16:41:59 2020 (r367452) @@ -58,16 +58,16 @@ __FBSDID("$FreeBSD$"); * Node of the interpreter list. */ typedef struct imgact_binmisc_entry { + SLIST_ENTRY(imgact_binmisc_entry) link; char *ibe_name; uint8_t *ibe_magic; - uint32_t ibe_moffset; - uint32_t ibe_msize; uint8_t *ibe_mask; uint8_t *ibe_interpreter; uint32_t ibe_interp_argcnt; uint32_t ibe_interp_length; uint32_t ibe_flags; - SLIST_ENTRY(imgact_binmisc_entry) link; + uint32_t ibe_moffset; + uint32_t ibe_msize; } imgact_binmisc_entry_t; /* From owner-svn-src-head@freebsd.org Sat Nov 7 16:57:54 2020 Return-Path: Delivered-To: svn-src-head@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 D777F464FA3; Sat, 7 Nov 2020 16:57: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 4CT3NL5qG0z3Jff; Sat, 7 Nov 2020 16:57: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 BAA1F11FB3; Sat, 7 Nov 2020 16:57: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 0A7Gvsqw091058; Sat, 7 Nov 2020 16:57:54 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7Gvsef091054; Sat, 7 Nov 2020 16:57:54 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011071657.0A7Gvsef091054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 7 Nov 2020 16:57:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367453 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 367453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 16:57:54 -0000 Author: mjg Date: Sat Nov 7 16:57:53 2020 New Revision: 367453 URL: https://svnweb.freebsd.org/changeset/base/367453 Log: rms: several cleanups + debug read lockers handling This adds a dedicated counter updated with atomics when INVARIANTS is used. As a side effect one can reliably determine the lock is held for reading by at least one thread, but it's still not possible to find out whether curthread has the lock in said mode. This should be good enough in practice. Problem spotted by avg. Modified: head/sys/kern/kern_rmlock.c head/sys/sys/_rmlock.h head/sys/sys/rmlock.h Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sat Nov 7 16:41:59 2020 (r367452) +++ head/sys/kern/kern_rmlock.c Sat Nov 7 16:57:53 2020 (r367453) @@ -878,10 +878,105 @@ db_show_rm(const struct lock_object *lock) * problem at some point. The easiest way to lessen it is to provide a bitmap. */ +#define rms_int_membar() __compiler_membar() + #define RMS_NOOWNER ((void *)0x1) #define RMS_TRANSIENT ((void *)0x2) #define RMS_FLAGMASK 0xf +struct rmslock_pcpu { + int influx; + int readers; +}; + +_Static_assert(sizeof(struct rmslock_pcpu) == 8, "bad size"); + +/* + * Internal routines + */ +static struct rmslock_pcpu * +rms_int_pcpu(struct rmslock *rms) +{ + + CRITICAL_ASSERT(curthread); + return (zpcpu_get(rms->pcpu)); +} + +static struct rmslock_pcpu * +rms_int_remote_pcpu(struct rmslock *rms, int cpu) +{ + + return (zpcpu_get_cpu(rms->pcpu, cpu)); +} + +static void +rms_int_influx_enter(struct rmslock *rms, struct rmslock_pcpu *pcpu) +{ + + CRITICAL_ASSERT(curthread); + MPASS(pcpu->influx == 0); + pcpu->influx = 1; +} + +static void +rms_int_influx_exit(struct rmslock *rms, struct rmslock_pcpu *pcpu) +{ + + CRITICAL_ASSERT(curthread); + MPASS(pcpu->influx == 1); + pcpu->influx = 0; +} + +#ifdef INVARIANTS +static void +rms_int_debug_readers_inc(struct rmslock *rms) +{ + int old; + old = atomic_fetchadd_int(&rms->debug_readers, 1); + KASSERT(old >= 0, ("%s: bad readers count %d\n", __func__, old)); +} + +static void +rms_int_debug_readers_dec(struct rmslock *rms) +{ + int old; + + old = atomic_fetchadd_int(&rms->debug_readers, -1); + KASSERT(old > 0, ("%s: bad readers count %d\n", __func__, old)); +} +#else +static void +rms_int_debug_readers_inc(struct rmslock *rms) +{ +} + +static void +rms_int_debug_readers_dec(struct rmslock *rms) +{ +} +#endif + +static void +rms_int_readers_inc(struct rmslock *rms, struct rmslock_pcpu *pcpu) +{ + + CRITICAL_ASSERT(curthread); + rms_int_debug_readers_inc(rms); + pcpu->readers++; +} + +static void +rms_int_readers_dec(struct rmslock *rms, struct rmslock_pcpu *pcpu) +{ + + CRITICAL_ASSERT(curthread); + rms_int_debug_readers_dec(rms); + pcpu->readers--; +} + +/* + * Public API + */ void rms_init(struct rmslock *rms, const char *name) { @@ -889,9 +984,9 @@ rms_init(struct rmslock *rms, const char *name) rms->owner = RMS_NOOWNER; rms->writers = 0; rms->readers = 0; + rms->debug_readers = 0; mtx_init(&rms->mtx, name, NULL, MTX_DEF | MTX_NEW); - rms->readers_pcpu = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); - rms->readers_influx = uma_zalloc_pcpu(pcpu_zone_4, M_WAITOK | M_ZERO); + rms->pcpu = uma_zalloc_pcpu(pcpu_zone_8, M_WAITOK | M_ZERO); } void @@ -901,23 +996,21 @@ rms_destroy(struct rmslock *rms) MPASS(rms->writers == 0); MPASS(rms->readers == 0); mtx_destroy(&rms->mtx); - uma_zfree_pcpu(pcpu_zone_4, rms->readers_pcpu); - uma_zfree_pcpu(pcpu_zone_4, rms->readers_influx); + uma_zfree_pcpu(pcpu_zone_8, rms->pcpu); } static void __noinline rms_rlock_fallback(struct rmslock *rms) { - zpcpu_set_protected(rms->readers_influx, 0); + rms_int_influx_exit(rms, rms_int_pcpu(rms)); critical_exit(); mtx_lock(&rms->mtx); - MPASS(*zpcpu_get(rms->readers_pcpu) == 0); while (rms->writers > 0) msleep(&rms->readers, &rms->mtx, PUSER - 1, mtx_name(&rms->mtx), 0); critical_enter(); - zpcpu_add_protected(rms->readers_pcpu, 1); + rms_int_readers_inc(rms, rms_int_pcpu(rms)); mtx_unlock(&rms->mtx); critical_exit(); } @@ -925,43 +1018,46 @@ rms_rlock_fallback(struct rmslock *rms) void rms_rlock(struct rmslock *rms) { + struct rmslock_pcpu *pcpu; WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); MPASS(atomic_load_ptr(&rms->owner) != curthread); critical_enter(); - zpcpu_set_protected(rms->readers_influx, 1); - __compiler_membar(); + pcpu = rms_int_pcpu(rms); + rms_int_influx_enter(rms, pcpu); + rms_int_membar(); if (__predict_false(rms->writers > 0)) { rms_rlock_fallback(rms); return; } - __compiler_membar(); - zpcpu_add_protected(rms->readers_pcpu, 1); - __compiler_membar(); - zpcpu_set_protected(rms->readers_influx, 0); + rms_int_membar(); + rms_int_readers_inc(rms, pcpu); + rms_int_membar(); + rms_int_influx_exit(rms, pcpu); critical_exit(); } int rms_try_rlock(struct rmslock *rms) { + struct rmslock_pcpu *pcpu; MPASS(atomic_load_ptr(&rms->owner) != curthread); critical_enter(); - zpcpu_set_protected(rms->readers_influx, 1); - __compiler_membar(); + pcpu = rms_int_pcpu(rms); + rms_int_influx_enter(rms, pcpu); + rms_int_membar(); if (__predict_false(rms->writers > 0)) { - __compiler_membar(); - zpcpu_set_protected(rms->readers_influx, 0); + rms_int_influx_exit(rms, pcpu); critical_exit(); return (0); } - __compiler_membar(); - zpcpu_add_protected(rms->readers_pcpu, 1); - __compiler_membar(); - zpcpu_set_protected(rms->readers_influx, 0); + rms_int_membar(); + rms_int_readers_inc(rms, pcpu); + rms_int_membar(); + rms_int_influx_exit(rms, pcpu); critical_exit(); return (1); } @@ -970,13 +1066,14 @@ static void __noinline rms_runlock_fallback(struct rmslock *rms) { - zpcpu_set_protected(rms->readers_influx, 0); + rms_int_influx_exit(rms, rms_int_pcpu(rms)); critical_exit(); mtx_lock(&rms->mtx); - MPASS(*zpcpu_get(rms->readers_pcpu) == 0); MPASS(rms->writers > 0); MPASS(rms->readers > 0); + MPASS(rms->debug_readers == rms->readers); + rms_int_debug_readers_dec(rms); rms->readers--; if (rms->readers == 0) wakeup_one(&rms->writers); @@ -986,18 +1083,20 @@ rms_runlock_fallback(struct rmslock *rms) void rms_runlock(struct rmslock *rms) { + struct rmslock_pcpu *pcpu; critical_enter(); - zpcpu_set_protected(rms->readers_influx, 1); - __compiler_membar(); + pcpu = rms_int_pcpu(rms); + rms_int_influx_enter(rms, pcpu); + rms_int_membar(); if (__predict_false(rms->writers > 0)) { rms_runlock_fallback(rms); return; } - __compiler_membar(); - zpcpu_sub_protected(rms->readers_pcpu, 1); - __compiler_membar(); - zpcpu_set_protected(rms->readers_influx, 0); + rms_int_membar(); + rms_int_readers_dec(rms, pcpu); + rms_int_membar(); + rms_int_influx_exit(rms, pcpu); critical_exit(); } @@ -1010,17 +1109,19 @@ static void rms_action_func(void *arg) { struct rmslock_ipi *rmsipi; + struct rmslock_pcpu *pcpu; struct rmslock *rms; - int readers; rmsipi = __containerof(arg, struct rmslock_ipi, srcra); rms = rmsipi->rms; + pcpu = rms_int_pcpu(rms); - if (*zpcpu_get(rms->readers_influx)) + if (pcpu->influx) return; - readers = zpcpu_replace(rms->readers_pcpu, 0); - if (readers != 0) - atomic_add_int(&rms->readers, readers); + if (pcpu->readers != 0) { + atomic_add_int(&rms->readers, pcpu->readers); + pcpu->readers = 0; + } smp_rendezvous_cpus_done(arg); } @@ -1028,18 +1129,40 @@ static void rms_wait_func(void *arg, int cpu) { struct rmslock_ipi *rmsipi; + struct rmslock_pcpu *pcpu; struct rmslock *rms; - int *in_op; rmsipi = __containerof(arg, struct rmslock_ipi, srcra); rms = rmsipi->rms; + pcpu = rms_int_remote_pcpu(rms, cpu); - in_op = zpcpu_get_cpu(rms->readers_influx, cpu); - while (atomic_load_int(in_op)) + while (atomic_load_int(&pcpu->influx)) cpu_spinwait(); } +#ifdef INVARIANTS static void +rms_assert_no_pcpu_readers(struct rmslock *rms) +{ + struct rmslock_pcpu *pcpu; + int cpu; + + CPU_FOREACH(cpu) { + pcpu = rms_int_remote_pcpu(rms, cpu); + if (pcpu->readers != 0) { + panic("%s: got %d readers on cpu %d\n", __func__, + pcpu->readers, cpu); + } + } +} +#else +static void +rms_assert_no_pcpu_readers(struct rmslock *rms) +{ +} +#endif + +static void rms_wlock_switch(struct rmslock *rms) { struct rmslock_ipi rmsipi; @@ -1080,6 +1203,7 @@ rms_wlock(struct rmslock *rms) ("%s: unexpected owner value %p\n", __func__, rms->owner)); rms_wlock_switch(rms); + rms_assert_no_pcpu_readers(rms); if (rms->readers > 0) { msleep(&rms->writers, &rms->mtx, (PUSER - 1), @@ -1088,6 +1212,7 @@ rms_wlock(struct rmslock *rms) out_grab: rms->owner = curthread; + rms_assert_no_pcpu_readers(rms); mtx_unlock(&rms->mtx); MPASS(rms->readers == 0); } Modified: head/sys/sys/_rmlock.h ============================================================================== --- head/sys/sys/_rmlock.h Sat Nov 7 16:41:59 2020 (r367452) +++ head/sys/sys/_rmlock.h Sat Nov 7 16:57:53 2020 (r367453) @@ -70,13 +70,15 @@ struct rm_priotracker { #include +struct rmslock_pcpu; + struct rmslock { struct mtx mtx; struct thread *owner; + struct rmslock_pcpu *pcpu; int writers; int readers; - int *readers_pcpu; - int *readers_influx; + int debug_readers; }; #endif /* !_SYS__RMLOCK_H_ */ Modified: head/sys/sys/rmlock.h ============================================================================== --- head/sys/sys/rmlock.h Sat Nov 7 16:41:59 2020 (r367452) +++ head/sys/sys/rmlock.h Sat Nov 7 16:57:53 2020 (r367453) @@ -149,14 +149,18 @@ rms_wowned(struct rmslock *rms) return (rms->owner == curthread); } +#ifdef INVARIANTS /* - * Only valid to call if you hold the lock in some manner. + * For assertion purposes. + * + * Main limitation is that we at best can tell there are readers, but not + * whether curthread is one of them. */ static inline int rms_rowned(struct rmslock *rms) { - return (rms->readers > 0); + return (rms->debug_readers > 0); } static inline int @@ -168,6 +172,7 @@ rms_owned_any(struct rmslock *rms) return (rms_rowned(rms)); } +#endif #endif /* _KERNEL */ #endif /* !_SYS_RMLOCK_H_ */ From owner-svn-src-head@freebsd.org Sat Nov 7 16:58:38 2020 Return-Path: Delivered-To: svn-src-head@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 DE9E1464DAA; Sat, 7 Nov 2020 16:58:38 +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 4CT3PB5xgjz3K09; Sat, 7 Nov 2020 16:58:38 +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 B457011D2B; Sat, 7 Nov 2020 16:58:38 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7Gwcvk091139; Sat, 7 Nov 2020 16:58:38 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7Gwcsd091138; Sat, 7 Nov 2020 16:58:38 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202011071658.0A7Gwcsd091138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 7 Nov 2020 16:58:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367454 - head/sys/contrib/openzfs/module/os/freebsd/zfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/contrib/openzfs/module/os/freebsd/zfs X-SVN-Commit-Revision: 367454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 16:58:38 -0000 Author: mjg Date: Sat Nov 7 16:58:38 2020 New Revision: 367454 URL: https://svnweb.freebsd.org/changeset/base/367454 Log: zfs: remove 2 assertions that teardown lock is not held They are not very useful and hard to implement with rms. This has a side effect of simplying the code. Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c ============================================================================== --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Sat Nov 7 16:57:53 2020 (r367453) +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vnops.c Sat Nov 7 16:58:38 2020 (r367454) @@ -1451,10 +1451,6 @@ zfs_lookup_lock(vnode_t *dvp, vnode_t *vp, const char if (zfsvfs->z_replay == B_FALSE) ASSERT_VOP_LOCKED(dvp, __func__); -#ifdef DIAGNOSTIC - if ((zdp->z_pflags & ZFS_XATTR) == 0) - VERIFY(!ZFS_TEARDOWN_HELD(zfsvfs)); -#endif if (name[0] == 0 || (name[0] == '.' && name[1] == 0)) { ASSERT3P(dvp, ==, vp); @@ -6523,39 +6519,6 @@ zfs_vptocnp(struct vop_vptocnp_args *ap) return (error); } -#ifdef DIAGNOSTIC -#ifndef _SYS_SYSPROTO_H_ -struct vop_lock1_args { - struct vnode *a_vp; - int a_flags; - char *file; - int line; -}; -#endif - -static int -zfs_lock(struct vop_lock1_args *ap) -{ - vnode_t *vp; - znode_t *zp; - int err; - -#if __FreeBSD_version >= 1300064 - err = vop_lock(ap); -#else - err = vop_stdlock(ap); -#endif - if (err == 0 && (ap->a_flags & LK_NOWAIT) == 0) { - vp = ap->a_vp; - zp = vp->v_data; - if (vp->v_mount != NULL && !VN_IS_DOOMED(vp) && - zp != NULL && (zp->z_pflags & ZFS_XATTR) == 0) - VERIFY(!ZFS_TEARDOWN_HELD(zp->z_zfsvfs)); - } - return (err); -} -#endif - struct vop_vector zfs_vnodeops; struct vop_vector zfs_fifoops; struct vop_vector zfs_shareops; @@ -6606,17 +6569,9 @@ struct vop_vector zfs_vnodeops = { .vop_putpages = zfs_freebsd_putpages, .vop_vptocnp = zfs_vptocnp, #if __FreeBSD_version >= 1300064 -#ifdef DIAGNOSTIC - .vop_lock1 = zfs_lock, -#else .vop_lock1 = vop_lock, -#endif .vop_unlock = vop_unlock, .vop_islocked = vop_islocked, -#else -#ifdef DIAGNOSTIC - .vop_lock1 = zfs_lock, -#endif #endif }; VFS_VOP_VECTOR_REGISTER(zfs_vnodeops); From owner-svn-src-head@freebsd.org Sat Nov 7 17:18:45 2020 Return-Path: Delivered-To: svn-src-head@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 9F0DB465596; Sat, 7 Nov 2020 17:18:45 +0000 (UTC) (envelope-from bdrewery@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 4CT3rP3vfmz3LLM; Sat, 7 Nov 2020 17:18:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7427E1219C; Sat, 7 Nov 2020 17:18:45 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7HIjs9003916; Sat, 7 Nov 2020 17:18:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7HIjDY003915; Sat, 7 Nov 2020 17:18:45 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <202011071718.0A7HIjDY003915@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Sat, 7 Nov 2020 17:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367455 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 367455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 17:18:45 -0000 Author: bdrewery Date: Sat Nov 7 17:18:44 2020 New Revision: 367455 URL: https://svnweb.freebsd.org/changeset/base/367455 Log: syslogd: Stop trying to send remote messages through special sockets Specifically this was causing the /dev/klog fd and the signal pipe handling fd to get a sendmsg(2) called on them and always returned [ENOTSOCK]. r310350 combined these sockets into the main socket list and properly skipped AF_UNSPEC at the sendmsg(2) call but later in r344739 it was broken such that these special sockets were no longer excluded since the AF_UNSPEC check specifically excluded these special sockets. Only these special sockets have sl_sa = NULL. The sl_family checks should be redundant now but are left in case of future changes so the intent is clearer. MFC after: 2 weeks Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Nov 7 16:58:38 2020 (r367454) +++ head/usr.sbin/syslogd/syslogd.c Sat Nov 7 17:18:44 2020 (r367455) @@ -1871,9 +1871,9 @@ fprintlog_write(struct filed *f, struct iovlist *il, i STAILQ_FOREACH(sl, &shead, next) { if (sl->sl_socket < 0) continue; - if (sl->sl_sa != NULL && - (sl->sl_family == AF_LOCAL || - sl->sl_family == AF_UNSPEC)) + if (sl->sl_sa == NULL || + sl->sl_family == AF_UNSPEC || + sl->sl_family == AF_LOCAL) { continue; lsent = sendmsg(sl->sl_socket, &msghdr, 0); if (lsent == (ssize_t)il->totalsize) From owner-svn-src-head@freebsd.org Sat Nov 7 17:54:27 2020 Return-Path: Delivered-To: svn-src-head@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 441424660FE; Sat, 7 Nov 2020 17:54:27 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CT4dZ61r5z3NCZ; Sat, 7 Nov 2020 17:54:26 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id bSPvkaAqJRAWfbSPwk3T8f; Sat, 07 Nov 2020 10:54:25 -0700 X-Authority-Analysis: v=2.4 cv=P9aEOgMu c=1 sm=1 tr=0 ts=5fa6df51 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=nNwsprhYR40A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=44SlTVGIrHYTBSnO2aoA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id A4CE4F3; Sat, 7 Nov 2020 09:54:22 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 0A7HsMN5063934; Sat, 7 Nov 2020 09:54:22 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202011071754.0A7HsMN5063934@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bryan Drewery cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r367455 - head/usr.sbin/syslogd In-reply-to: <202011071718.0A7HIjDY003915@repo.freebsd.org> References: <202011071718.0A7HIjDY003915@repo.freebsd.org> Comments: In-reply-to Bryan Drewery message dated "Sat, 07 Nov 2020 17:18:45 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 07 Nov 2020 09:54:22 -0800 X-CMAE-Envelope: MS4xfI+rbBeUgXTjz3eNEz36AVe7w+10YjplXt5T9T4int01r9/FJHILlFmnJQN+EwjTnj8CKqeSFO0GGD8IX8B05HmIMNR1UCDVZqehaEQQlHK0zL6B4Aqx 7cYZ4Qcqnd3IV9X2Jzct+7afR2RbYGwVd2ymGL2oi1nxP9Dm5Y6jbPyvMTc7EBGWgkJuOXDn8jFNMnEwXx38EJ1huMCdLtABbQZ5lRW29UZyfvh16nshEg2c 7qniuUd0MiNnIE7n8LHc5Aez3O3XV5uixK5lNulb8mQGn8EackRZRUAgYew+tEhO5+emFZlGNsVEJDKsGUSM6Q== X-Rspamd-Queue-Id: 4CT4dZ61r5z3NCZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 17:54:27 -0000 In message <202011071718.0A7HIjDY003915@repo.freebsd.org>, Bryan Drewery writes : > Author: bdrewery > Date: Sat Nov 7 17:18:44 2020 > New Revision: 367455 > URL: https://svnweb.freebsd.org/changeset/base/367455 > > Log: > syslogd: Stop trying to send remote messages through special sockets > > Specifically this was causing the /dev/klog fd and the signal pipe > handling fd to get a sendmsg(2) called on them and always returned > [ENOTSOCK]. > > r310350 combined these sockets into the main socket list and properly > skipped AF_UNSPEC at the sendmsg(2) call but later in r344739 it was > broken such that these special sockets were no longer excluded since > the AF_UNSPEC check specifically excluded these special sockets. Only > these special sockets have sl_sa = NULL. The sl_family checks should > be redundant now but are left in case of future changes so the intent > is clearer. > > MFC after: 2 weeks > > Modified: > head/usr.sbin/syslogd/syslogd.c > > Modified: head/usr.sbin/syslogd/syslogd.c > ============================================================================= > = > --- head/usr.sbin/syslogd/syslogd.c Sat Nov 7 16:58:38 2020 (r36745 > 4) > +++ head/usr.sbin/syslogd/syslogd.c Sat Nov 7 17:18:44 2020 (r36745 > 5) > @@ -1871,9 +1871,9 @@ fprintlog_write(struct filed *f, struct iovlist *il, i > STAILQ_FOREACH(sl, &shead, next) { > if (sl->sl_socket < 0) > continue; > - if (sl->sl_sa != NULL && > - (sl->sl_family == AF_LOCAL || > - sl->sl_family == AF_UNSPEC)) > + if (sl->sl_sa == NULL || > + sl->sl_family == AF_UNSPEC || > + sl->sl_family == AF_LOCAL) { The extraneous left brace broke the build. > continue; > lsent = sendmsg(sl->sl_socket, &msghdr, 0); > if (lsent == (ssize_t)il->totalsize) > -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sat Nov 7 18:07:56 2020 Return-Path: Delivered-To: svn-src-head@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 6ED454661D4; Sat, 7 Nov 2020 18:07:56 +0000 (UTC) (envelope-from kevans@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 4CT4x82kcfz3NrQ; Sat, 7 Nov 2020 18:07:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50BEC12750; Sat, 7 Nov 2020 18:07:56 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7I7u6x035449; Sat, 7 Nov 2020 18:07:56 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7I7uFU035448; Sat, 7 Nov 2020 18:07:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202011071807.0A7I7uFU035448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 7 Nov 2020 18:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367456 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 18:07:56 -0000 Author: kevans Date: Sat Nov 7 18:07:55 2020 New Revision: 367456 URL: https://svnweb.freebsd.org/changeset/base/367456 Log: imgact_binmisc: move some calculations out of the exec path The offset we need to account for in the interpreter string comes in two variants: 1. Fixed - macros other than #a that will not vary from invocation to invocation 2. Variable - #a, which is substitued with the argv0 that we're replacing Note that we don't have a mechanism to modify an existing entry. By recording both of these offset requirements when the interpreter is added, we can avoid some unnecessary calculations in the exec path. Most importantly, we can know up-front whether we need to grab calculate/grab the the filename for this interpreter. We also get to avoid walking the string a first time looking for macros. For most invocations, it's a swift exit as they won't have any, but there's no point entering a loop and searching for the macro indicator if we already know there will not be one. While we're here, go ahead and only calculate the argv0 name length once per invocation. While it's unlikely that we'll have more than one #a, there's no reason to recalculate it every time we encounter an #a when it will not change. I have not bothered trying to benchmark this at all, because it's arguably a minor and straightforward/obvious improvement. MFC after: 1 week Modified: head/sys/kern/imgact_binmisc.c Modified: head/sys/kern/imgact_binmisc.c ============================================================================== --- head/sys/kern/imgact_binmisc.c Sat Nov 7 17:18:44 2020 (r367455) +++ head/sys/kern/imgact_binmisc.c Sat Nov 7 18:07:55 2020 (r367456) @@ -63,8 +63,10 @@ typedef struct imgact_binmisc_entry { uint8_t *ibe_magic; uint8_t *ibe_mask; uint8_t *ibe_interpreter; + ssize_t ibe_interp_offset; uint32_t ibe_interp_argcnt; uint32_t ibe_interp_length; + uint32_t ibe_argv0_cnt; uint32_t ibe_flags; uint32_t ibe_moffset; uint32_t ibe_msize; @@ -154,7 +156,8 @@ imgact_binmisc_populate_interp(char *str, imgact_binmi * Allocate memory and populate a new entry for the interpreter table. */ static imgact_binmisc_entry_t * -imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe) +imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe, ssize_t interp_offset, + int argv0_cnt) { imgact_binmisc_entry_t *ibe = NULL; size_t namesz = min(strlen(xbe->xbe_name) + 1, IBE_NAME_MAX); @@ -175,7 +178,8 @@ imgact_binmisc_new_entry(ximgact_binmisc_entry_t *xbe) ibe->ibe_moffset = xbe->xbe_moffset; ibe->ibe_msize = xbe->xbe_msize; ibe->ibe_flags = xbe->xbe_flags; - + ibe->ibe_interp_offset = interp_offset; + ibe->ibe_argv0_cnt = argv0_cnt; return (ibe); } @@ -227,7 +231,8 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) { imgact_binmisc_entry_t *ibe; char *p; - int cnt; + ssize_t interp_offset; + int argv0_cnt, cnt; if (xbe->xbe_msize > IBE_MAGIC_MAX) return (EINVAL); @@ -242,23 +247,21 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) /* Make sure we don't have any invalid #'s. */ p = xbe->xbe_interpreter; - while (1) { - p = strchr(p, '#'); - if (!p) - break; - + interp_offset = 0; + argv0_cnt = 0; + while ((p = strchr(p, '#')) != NULL) { p++; switch(*p) { case ISM_POUND: /* "##" */ p++; + interp_offset--; break; - case ISM_OLD_ARGV0: /* "#a" */ p++; + argv0_cnt++; break; - case 0: default: /* Anything besides the above is invalid. */ @@ -273,7 +276,7 @@ imgact_binmisc_add_entry(ximgact_binmisc_entry_t *xbe) } /* Preallocate a new entry. */ - ibe = imgact_binmisc_new_entry(xbe); + ibe = imgact_binmisc_new_entry(xbe, interp_offset, argv0_cnt); SLIST_INSERT_HEAD(&interpreter_list, ibe, link); interp_list_entry_count++; @@ -586,12 +589,16 @@ imgact_binmisc_exec(struct image_params *imgp) const char *image_header = imgp->image_header; const char *fname = NULL; int error = 0; - size_t offset, l; +#ifdef INVARIANTS + int argv0_cnt = 0; +#endif + size_t namelen, offset; imgact_binmisc_entry_t *ibe; struct sbuf *sname; char *s, *d; sname = NULL; + namelen = 0; /* Do we have an interpreter for the given image header? */ INTERP_LIST_RLOCK(); if ((ibe = imgact_binmisc_find_interpreter(image_header)) == NULL) { @@ -607,14 +614,22 @@ imgact_binmisc_exec(struct image_params *imgp) imgp->interpreted |= IMGACT_BINMISC; - if (imgp->args->fname != NULL) { - fname = imgp->args->fname; - } else { - /* Use the fdescfs(5) path for fexecve(2). */ - sname = sbuf_new_auto(); - sbuf_printf(sname, "/dev/fd/%d", imgp->args->fd); - sbuf_finish(sname); - fname = sbuf_data(sname); + /* + * Don't bother with the overhead of putting fname together if we're not + * using #a. + */ + if (ibe->ibe_argv0_cnt != 0) { + if (imgp->args->fname != NULL) { + fname = imgp->args->fname; + } else { + /* Use the fdescfs(5) path for fexecve(2). */ + sname = sbuf_new_auto(); + sbuf_printf(sname, "/dev/fd/%d", imgp->args->fd); + sbuf_finish(sname); + fname = sbuf_data(sname); + } + + namelen = strlen(fname); } /* @@ -622,39 +637,15 @@ imgact_binmisc_exec(struct image_params *imgp) * we first shift all the other values in the `begin_argv' area to * provide the exact amount of room for the values added. Set up * `offset' as the number of bytes to be added to the `begin_argv' - * area. + * area. ibe_interp_offset is the fixed offset from macros present in + * the interpreter string. */ - offset = ibe->ibe_interp_length; + offset = ibe->ibe_interp_length + ibe->ibe_interp_offset; - /* Adjust the offset for #'s. */ - s = ibe->ibe_interpreter; - while (1) { - s = strchr(s, '#'); - if (!s) - break; + /* Variable offset to be added from macros to the interpreter string. */ + MPASS(ibe->ibe_argv0_cnt == 0 || namelen > 0); + offset += ibe->ibe_argv0_cnt * (namelen - 2); - s++; - switch(*s) { - case ISM_POUND: - /* "##" -> "#": reduce offset by one. */ - offset--; - break; - - case ISM_OLD_ARGV0: - /* "#a" -> (old argv0): increase offset to fit fname */ - offset += strlen(fname) - 2; - break; - - default: - /* Hmm... This shouldn't happen. */ - printf("%s: Unknown macro #%c sequence in " - "interpreter string\n", KMOD_NAME, *(s + 1)); - error = EINVAL; - goto done; - } - s++; - } - /* Make room for the interpreter */ error = exec_args_adjust_args(imgp->args, 0, offset); if (error != 0) { @@ -680,26 +671,20 @@ imgact_binmisc_exec(struct image_params *imgp) /* "##": Replace with a single '#' */ *d++ = '#'; break; - case ISM_OLD_ARGV0: /* "#a": Replace with old arg0 (fname). */ - if ((l = strlen(fname)) != 0) { - memcpy(d, fname, l); - d += l; - } + MPASS(ibe->ibe_argv0_cnt >= ++argv0_cnt); + memcpy(d, fname, namelen); + d += namelen; break; - default: - /* Shouldn't happen but skip it if it does. */ - break; + __assert_unreachable(); } break; - case ' ': /* Replace space with NUL to separate arguments. */ *d++ = '\0'; break; - default: *d++ = *s; break; @@ -708,6 +693,8 @@ imgact_binmisc_exec(struct image_params *imgp) } *d = '\0'; + /* Catch ibe->ibe_argv0_cnt counting more #a than we did. */ + MPASS(ibe->ibe_argv0_cnt == argv0_cnt); imgp->interpreter_name = imgp->args->begin_argv; done: From owner-svn-src-head@freebsd.org Sat Nov 7 19:17:37 2020 Return-Path: Delivered-To: svn-src-head@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 AD2C7467C73; Sat, 7 Nov 2020 19:17:37 +0000 (UTC) (envelope-from cy@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 4CT6TY4VgKz3hfs; Sat, 7 Nov 2020 19:17:37 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CAE7139C0; Sat, 7 Nov 2020 19:17:37 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7JHbjD079061; Sat, 7 Nov 2020 19:17:37 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7JHbUS079060; Sat, 7 Nov 2020 19:17:37 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202011071917.0A7JHbUS079060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Nov 2020 19:17:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367459 - head/usr.sbin/syslogd X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/usr.sbin/syslogd X-SVN-Commit-Revision: 367459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 19:17:37 -0000 Author: cy Date: Sat Nov 7 19:17:37 2020 New Revision: 367459 URL: https://svnweb.freebsd.org/changeset/base/367459 Log: Fix build post-r367455. MFC after: 2 weeks X-MFC with: r367455 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c ============================================================================== --- head/usr.sbin/syslogd/syslogd.c Sat Nov 7 18:15:29 2020 (r367458) +++ head/usr.sbin/syslogd/syslogd.c Sat Nov 7 19:17:37 2020 (r367459) @@ -1873,7 +1873,7 @@ fprintlog_write(struct filed *f, struct iovlist *il, i continue; if (sl->sl_sa == NULL || sl->sl_family == AF_UNSPEC || - sl->sl_family == AF_LOCAL) { + sl->sl_family == AF_LOCAL) continue; lsent = sendmsg(sl->sl_socket, &msghdr, 0); if (lsent == (ssize_t)il->totalsize) From owner-svn-src-head@freebsd.org Sat Nov 7 21:17:50 2020 Return-Path: Delivered-To: svn-src-head@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 1ABC62D1E4C; Sat, 7 Nov 2020 21:17:50 +0000 (UTC) (envelope-from tuexen@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 4CT98F72g3z3pQn; Sat, 7 Nov 2020 21:17:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E003514EED; Sat, 7 Nov 2020 21:17:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7LHnPh054448; Sat, 7 Nov 2020 21:17:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7LHnKR054447; Sat, 7 Nov 2020 21:17:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <202011072117.0A7LHnKR054447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 7 Nov 2020 21:17:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367464 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 367464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 21:17:50 -0000 Author: tuexen Date: Sat Nov 7 21:17:49 2020 New Revision: 367464 URL: https://svnweb.freebsd.org/changeset/base/367464 Log: The ioctl() calls using FIONREAD, FIONWRITE, FIONSPACE, and SIOCATMARK access the socket send or receive buffer. This is not possible for listening sockets since r319722. Because send()/recv() calls fail on listening sockets, fail also ioctl() indicating EINVAL. PR: 250366 Reported by: Yong-Hao Zou Reviewed by: glebius, rscheff MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D26897 Modified: head/sys/kern/sys_socket.c Modified: head/sys/kern/sys_socket.c ============================================================================== --- head/sys/kern/sys_socket.c Sat Nov 7 19:57:19 2020 (r367463) +++ head/sys/kern/sys_socket.c Sat Nov 7 21:17:49 2020 (r367464) @@ -207,21 +207,34 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, str case FIONREAD: /* Unlocked read. */ - *(int *)data = sbavail(&so->so_rcv); + if (SOLISTENING(so)) { + error = EINVAL; + } else { + *(int *)data = sbavail(&so->so_rcv); + } break; case FIONWRITE: /* Unlocked read. */ - *(int *)data = sbavail(&so->so_snd); + if (SOLISTENING(so)) { + error = EINVAL; + } else { + *(int *)data = sbavail(&so->so_snd); + } break; case FIONSPACE: /* Unlocked read. */ - if ((so->so_snd.sb_hiwat < sbused(&so->so_snd)) || - (so->so_snd.sb_mbmax < so->so_snd.sb_mbcnt)) - *(int *)data = 0; - else - *(int *)data = sbspace(&so->so_snd); + if (SOLISTENING(so)) { + error = EINVAL; + } else { + if ((so->so_snd.sb_hiwat < sbused(&so->so_snd)) || + (so->so_snd.sb_mbmax < so->so_snd.sb_mbcnt)) { + *(int *)data = 0; + } else { + *(int *)data = sbspace(&so->so_snd); + } + } break; case FIOSETOWN: @@ -242,7 +255,11 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, str case SIOCATMARK: /* Unlocked read. */ - *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0; + if (SOLISTENING(so)) { + error = EINVAL; + } else { + *(int *)data = (so->so_rcv.sb_state & SBS_RCVATMARK) != 0; + } break; default: /* From owner-svn-src-head@freebsd.org Sat Nov 7 21:46:29 2020 Return-Path: Delivered-To: svn-src-head@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 11D9F2D25E3; Sat, 7 Nov 2020 21:46:29 +0000 (UTC) (envelope-from sjg@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 4CT9nJ6xntz3qWX; Sat, 7 Nov 2020 21:46:28 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E08BA154E2; Sat, 7 Nov 2020 21:46:28 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0A7LkSeG072790; Sat, 7 Nov 2020 21:46:28 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0A7LkRaP072784; Sat, 7 Nov 2020 21:46:27 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <202011072146.0A7LkRaP072784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sat, 7 Nov 2020 21:46:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367465 - in head: contrib/bmake contrib/bmake/filemon contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head: contrib/bmake contrib/bmake/filemon contrib/bmake/mk contrib/bmake/unit-tests usr.bin/bmake usr.bin/bmake/unit-tests X-SVN-Commit-Revision: 367465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Nov 2020 21:46:29 -0000 Author: sjg Date: Sat Nov 7 21:46:27 2020 New Revision: 367465 URL: https://svnweb.freebsd.org/changeset/base/367465 Log: Update to bmake-20201101 Lots of new unit-tests increase code coverage. Lots of refactoring, cleanup and simlpification to reduce code size. Fixes for Bug 223564 and 245807 Updates to dirdeps.mk and meta2deps.py Added: head/contrib/bmake/unit-tests/cond-cmp-unary.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/cond-cmp-unary.exp head/contrib/bmake/unit-tests/cond-cmp-unary.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/cond-cmp-unary.mk head/contrib/bmake/unit-tests/cond-undef-lint.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/cond-undef-lint.exp head/contrib/bmake/unit-tests/cond-undef-lint.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/cond-undef-lint.mk head/contrib/bmake/unit-tests/counter-append.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/counter-append.exp head/contrib/bmake/unit-tests/counter-append.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/counter-append.mk head/contrib/bmake/unit-tests/dep-colon-bug-cross-file.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/dep-colon-bug-cross-file.exp head/contrib/bmake/unit-tests/dep-colon-bug-cross-file.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/dep-colon-bug-cross-file.mk head/contrib/bmake/unit-tests/dep-double-colon-indep.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/dep-double-colon-indep.exp head/contrib/bmake/unit-tests/dep-double-colon-indep.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/dep-double-colon-indep.mk head/contrib/bmake/unit-tests/dep-percent.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/dep-percent.exp head/contrib/bmake/unit-tests/dep-percent.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/dep-percent.mk head/contrib/bmake/unit-tests/depsrc-end.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/depsrc-end.exp head/contrib/bmake/unit-tests/depsrc-end.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/depsrc-end.mk head/contrib/bmake/unit-tests/deptgt-end-jobs.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/deptgt-end-jobs.exp head/contrib/bmake/unit-tests/deptgt-end-jobs.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/deptgt-end-jobs.mk head/contrib/bmake/unit-tests/directive-dinclude.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-dinclude.exp head/contrib/bmake/unit-tests/directive-dinclude.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-dinclude.mk head/contrib/bmake/unit-tests/directive-export-gmake.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-export-gmake.exp head/contrib/bmake/unit-tests/directive-export-gmake.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-export-gmake.mk head/contrib/bmake/unit-tests/directive-hyphen-include.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-hyphen-include.exp head/contrib/bmake/unit-tests/directive-hyphen-include.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-hyphen-include.mk head/contrib/bmake/unit-tests/directive-include-fatal.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-include-fatal.exp head/contrib/bmake/unit-tests/directive-include-fatal.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-include-fatal.mk head/contrib/bmake/unit-tests/directive-include.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-include.exp head/contrib/bmake/unit-tests/directive-include.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-include.mk head/contrib/bmake/unit-tests/directive-sinclude.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-sinclude.exp head/contrib/bmake/unit-tests/directive-sinclude.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/directive-sinclude.mk head/contrib/bmake/unit-tests/hanoi-include.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/hanoi-include.exp head/contrib/bmake/unit-tests/hanoi-include.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/hanoi-include.mk head/contrib/bmake/unit-tests/job-output-long-lines.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/job-output-long-lines.exp head/contrib/bmake/unit-tests/job-output-long-lines.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/job-output-long-lines.mk head/contrib/bmake/unit-tests/opt-debug-all.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-all.exp head/contrib/bmake/unit-tests/opt-debug-all.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-all.mk head/contrib/bmake/unit-tests/opt-debug-archive.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-archive.exp head/contrib/bmake/unit-tests/opt-debug-archive.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-archive.mk head/contrib/bmake/unit-tests/opt-debug-cond.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-cond.exp head/contrib/bmake/unit-tests/opt-debug-cond.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-cond.mk head/contrib/bmake/unit-tests/opt-debug-curdir.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-curdir.exp head/contrib/bmake/unit-tests/opt-debug-curdir.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-curdir.mk head/contrib/bmake/unit-tests/opt-debug-dir.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-dir.exp head/contrib/bmake/unit-tests/opt-debug-dir.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-dir.mk head/contrib/bmake/unit-tests/opt-debug-errors.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-errors.exp head/contrib/bmake/unit-tests/opt-debug-errors.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-errors.mk head/contrib/bmake/unit-tests/opt-debug-file.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-file.exp head/contrib/bmake/unit-tests/opt-debug-file.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-file.mk head/contrib/bmake/unit-tests/opt-debug-for.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-for.exp head/contrib/bmake/unit-tests/opt-debug-for.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-for.mk head/contrib/bmake/unit-tests/opt-debug-graph1.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-graph1.exp head/contrib/bmake/unit-tests/opt-debug-graph1.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-graph1.mk head/contrib/bmake/unit-tests/opt-debug-graph2.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-graph2.exp head/contrib/bmake/unit-tests/opt-debug-graph2.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-graph2.mk head/contrib/bmake/unit-tests/opt-debug-graph3.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-graph3.exp head/contrib/bmake/unit-tests/opt-debug-graph3.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-graph3.mk head/contrib/bmake/unit-tests/opt-debug-hash.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-hash.exp head/contrib/bmake/unit-tests/opt-debug-hash.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-hash.mk head/contrib/bmake/unit-tests/opt-debug-jobs.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-jobs.exp head/contrib/bmake/unit-tests/opt-debug-jobs.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-jobs.mk head/contrib/bmake/unit-tests/opt-debug-lint.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-lint.exp head/contrib/bmake/unit-tests/opt-debug-lint.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-lint.mk head/contrib/bmake/unit-tests/opt-debug-loud.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-loud.exp head/contrib/bmake/unit-tests/opt-debug-loud.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-loud.mk head/contrib/bmake/unit-tests/opt-debug-making.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-making.exp head/contrib/bmake/unit-tests/opt-debug-making.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-making.mk head/contrib/bmake/unit-tests/opt-debug-meta.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-meta.exp head/contrib/bmake/unit-tests/opt-debug-meta.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-meta.mk head/contrib/bmake/unit-tests/opt-debug-no-rm.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-no-rm.exp head/contrib/bmake/unit-tests/opt-debug-no-rm.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-no-rm.mk head/contrib/bmake/unit-tests/opt-debug-parse.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-parse.exp head/contrib/bmake/unit-tests/opt-debug-parse.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-parse.mk head/contrib/bmake/unit-tests/opt-debug-suff.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-suff.exp head/contrib/bmake/unit-tests/opt-debug-suff.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-suff.mk head/contrib/bmake/unit-tests/opt-debug-targets.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-targets.exp head/contrib/bmake/unit-tests/opt-debug-targets.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-targets.mk head/contrib/bmake/unit-tests/opt-debug-var.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-var.exp head/contrib/bmake/unit-tests/opt-debug-var.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-var.mk head/contrib/bmake/unit-tests/opt-debug-varraw.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-varraw.exp head/contrib/bmake/unit-tests/opt-debug-varraw.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-varraw.mk head/contrib/bmake/unit-tests/opt-debug-x-trace.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-x-trace.exp head/contrib/bmake/unit-tests/opt-debug-x-trace.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/opt-debug-x-trace.mk head/contrib/bmake/unit-tests/parse-var.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/parse-var.exp head/contrib/bmake/unit-tests/parse-var.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/parse-var.mk head/contrib/bmake/unit-tests/shell-csh.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-csh.exp head/contrib/bmake/unit-tests/shell-csh.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-csh.mk head/contrib/bmake/unit-tests/shell-custom.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-custom.exp head/contrib/bmake/unit-tests/shell-custom.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-custom.mk head/contrib/bmake/unit-tests/shell-ksh.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-ksh.exp head/contrib/bmake/unit-tests/shell-ksh.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-ksh.mk head/contrib/bmake/unit-tests/shell-sh.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-sh.exp head/contrib/bmake/unit-tests/shell-sh.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/shell-sh.mk head/contrib/bmake/unit-tests/suff-add-later.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-add-later.exp head/contrib/bmake/unit-tests/suff-add-later.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-add-later.mk head/contrib/bmake/unit-tests/suff-clear-regular.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-clear-regular.exp head/contrib/bmake/unit-tests/suff-clear-regular.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-clear-regular.mk head/contrib/bmake/unit-tests/suff-clear-single.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-clear-single.exp head/contrib/bmake/unit-tests/suff-clear-single.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-clear-single.mk head/contrib/bmake/unit-tests/suff-lookup.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-lookup.exp head/contrib/bmake/unit-tests/suff-lookup.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-lookup.mk head/contrib/bmake/unit-tests/suff-main.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-main.exp head/contrib/bmake/unit-tests/suff-main.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-main.mk head/contrib/bmake/unit-tests/suff-rebuild.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-rebuild.exp head/contrib/bmake/unit-tests/suff-rebuild.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-rebuild.mk head/contrib/bmake/unit-tests/suff-transform-endless.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-transform-endless.exp head/contrib/bmake/unit-tests/suff-transform-endless.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-transform-endless.mk head/contrib/bmake/unit-tests/suff-transform-expand.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-transform-expand.exp head/contrib/bmake/unit-tests/suff-transform-expand.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-transform-expand.mk head/contrib/bmake/unit-tests/suff-transform-select.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-transform-select.exp head/contrib/bmake/unit-tests/suff-transform-select.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/suff-transform-select.mk head/contrib/bmake/unit-tests/var-op-sunsh.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/var-op-sunsh.exp head/contrib/bmake/unit-tests/var-op-sunsh.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/var-op-sunsh.mk head/contrib/bmake/unit-tests/var-recursive.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/var-recursive.exp head/contrib/bmake/unit-tests/var-recursive.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/var-recursive.mk head/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varname-make_print_var_on_error-jobs.exp head/contrib/bmake/unit-tests/varname-make_print_var_on_error-jobs.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varname-make_print_var_on_error-jobs.mk head/contrib/bmake/unit-tests/varname-makefile.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varname-makefile.exp head/contrib/bmake/unit-tests/varname-makefile.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varname-makefile.mk head/contrib/bmake/unit-tests/varparse-mod.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varparse-mod.exp head/contrib/bmake/unit-tests/varparse-mod.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varparse-mod.mk head/contrib/bmake/unit-tests/varparse-undef-partial.exp - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varparse-undef-partial.exp head/contrib/bmake/unit-tests/varparse-undef-partial.mk - copied unchanged from r367461, vendor/NetBSD/bmake/dist/unit-tests/varparse-undef-partial.mk Deleted: head/contrib/bmake/strlist.c head/contrib/bmake/strlist.h head/contrib/bmake/unit-tests/cond2.exp head/contrib/bmake/unit-tests/cond2.mk head/contrib/bmake/unit-tests/hash.exp head/contrib/bmake/unit-tests/hash.mk head/contrib/bmake/unit-tests/misc.exp head/contrib/bmake/unit-tests/misc.mk head/contrib/bmake/unit-tests/opt-debug-g1.exp head/contrib/bmake/unit-tests/opt-debug-g1.mk head/contrib/bmake/unit-tests/suffixes.exp head/contrib/bmake/unit-tests/suffixes.mk head/contrib/bmake/unit-tests/sysv.exp head/contrib/bmake/unit-tests/sysv.mk Modified: head/contrib/bmake/ChangeLog head/contrib/bmake/FILES head/contrib/bmake/Makefile head/contrib/bmake/VERSION head/contrib/bmake/arch.c head/contrib/bmake/bmake.1 head/contrib/bmake/bmake.cat1 head/contrib/bmake/boot-strap head/contrib/bmake/buf.c head/contrib/bmake/buf.h head/contrib/bmake/compat.c head/contrib/bmake/cond.c head/contrib/bmake/configure head/contrib/bmake/configure.in head/contrib/bmake/dir.c head/contrib/bmake/dir.h head/contrib/bmake/enum.c head/contrib/bmake/enum.h head/contrib/bmake/filemon/filemon.h head/contrib/bmake/filemon/filemon_ktrace.c head/contrib/bmake/for.c head/contrib/bmake/hash.c head/contrib/bmake/hash.h head/contrib/bmake/job.c head/contrib/bmake/job.h head/contrib/bmake/lst.c head/contrib/bmake/lst.h head/contrib/bmake/main.c head/contrib/bmake/make-bootstrap.sh.in head/contrib/bmake/make-conf.h head/contrib/bmake/make.1 head/contrib/bmake/make.c head/contrib/bmake/make.h head/contrib/bmake/make_malloc.c head/contrib/bmake/make_malloc.h head/contrib/bmake/meta.c head/contrib/bmake/meta.h head/contrib/bmake/metachar.c head/contrib/bmake/metachar.h head/contrib/bmake/mk/ChangeLog head/contrib/bmake/mk/dirdeps-cache-update.mk head/contrib/bmake/mk/dirdeps.mk head/contrib/bmake/mk/install-mk head/contrib/bmake/mk/meta2deps.py head/contrib/bmake/mk/meta2deps.sh head/contrib/bmake/mk/sys.vars.mk head/contrib/bmake/nonints.h head/contrib/bmake/parse.c head/contrib/bmake/str.c head/contrib/bmake/suff.c head/contrib/bmake/targ.c head/contrib/bmake/trace.c head/contrib/bmake/trace.h head/contrib/bmake/unit-tests/Makefile head/contrib/bmake/unit-tests/archive.exp head/contrib/bmake/unit-tests/archive.mk head/contrib/bmake/unit-tests/comment.exp head/contrib/bmake/unit-tests/comment.mk head/contrib/bmake/unit-tests/cond-cmp-numeric-eq.exp head/contrib/bmake/unit-tests/cond-cmp-numeric-eq.mk head/contrib/bmake/unit-tests/cond-cmp-numeric-ge.mk head/contrib/bmake/unit-tests/cond-cmp-numeric-gt.mk head/contrib/bmake/unit-tests/cond-cmp-numeric-le.mk head/contrib/bmake/unit-tests/cond-cmp-numeric-lt.mk head/contrib/bmake/unit-tests/cond-cmp-numeric-ne.mk head/contrib/bmake/unit-tests/cond-cmp-numeric.exp head/contrib/bmake/unit-tests/cond-cmp-numeric.mk head/contrib/bmake/unit-tests/cond-cmp-string.exp head/contrib/bmake/unit-tests/cond-cmp-string.mk head/contrib/bmake/unit-tests/cond-func-commands.mk head/contrib/bmake/unit-tests/cond-func-defined.mk head/contrib/bmake/unit-tests/cond-func-empty.mk head/contrib/bmake/unit-tests/cond-func-exists.mk head/contrib/bmake/unit-tests/cond-func-make.exp head/contrib/bmake/unit-tests/cond-func-make.mk head/contrib/bmake/unit-tests/cond-func-target.mk head/contrib/bmake/unit-tests/cond-func.mk head/contrib/bmake/unit-tests/cond-op-and.exp head/contrib/bmake/unit-tests/cond-op-and.mk head/contrib/bmake/unit-tests/cond-op-not.mk head/contrib/bmake/unit-tests/cond-op-or.exp head/contrib/bmake/unit-tests/cond-op-or.mk head/contrib/bmake/unit-tests/cond-op.exp head/contrib/bmake/unit-tests/cond-op.mk head/contrib/bmake/unit-tests/cond-short.mk head/contrib/bmake/unit-tests/cond-token-number.exp head/contrib/bmake/unit-tests/cond-token-number.mk head/contrib/bmake/unit-tests/cond-token-plain.exp head/contrib/bmake/unit-tests/cond-token-plain.mk head/contrib/bmake/unit-tests/cond-token-var.mk head/contrib/bmake/unit-tests/cond1.exp head/contrib/bmake/unit-tests/cond1.mk head/contrib/bmake/unit-tests/counter.exp head/contrib/bmake/unit-tests/counter.mk head/contrib/bmake/unit-tests/dep-colon.exp head/contrib/bmake/unit-tests/dep-colon.mk head/contrib/bmake/unit-tests/dep-double-colon.mk head/contrib/bmake/unit-tests/dep-var.exp head/contrib/bmake/unit-tests/dep-var.mk head/contrib/bmake/unit-tests/dep-wildcards.exp head/contrib/bmake/unit-tests/dep-wildcards.mk head/contrib/bmake/unit-tests/depsrc-exec.exp head/contrib/bmake/unit-tests/depsrc-exec.mk head/contrib/bmake/unit-tests/depsrc-made.exp head/contrib/bmake/unit-tests/depsrc-made.mk head/contrib/bmake/unit-tests/depsrc-make.exp head/contrib/bmake/unit-tests/depsrc-make.mk head/contrib/bmake/unit-tests/depsrc-notmain.exp head/contrib/bmake/unit-tests/depsrc-notmain.mk head/contrib/bmake/unit-tests/depsrc-optional.exp head/contrib/bmake/unit-tests/depsrc-optional.mk head/contrib/bmake/unit-tests/depsrc-phony.exp head/contrib/bmake/unit-tests/depsrc-phony.mk head/contrib/bmake/unit-tests/depsrc-recursive.exp head/contrib/bmake/unit-tests/depsrc-recursive.mk head/contrib/bmake/unit-tests/depsrc-wait.exp head/contrib/bmake/unit-tests/depsrc-wait.mk head/contrib/bmake/unit-tests/deptgt-delete_on_error.exp head/contrib/bmake/unit-tests/deptgt-delete_on_error.mk head/contrib/bmake/unit-tests/deptgt-end.exp head/contrib/bmake/unit-tests/deptgt-end.mk head/contrib/bmake/unit-tests/deptgt-makeflags.exp head/contrib/bmake/unit-tests/deptgt-makeflags.mk head/contrib/bmake/unit-tests/deptgt-silent.exp head/contrib/bmake/unit-tests/deptgt-silent.mk head/contrib/bmake/unit-tests/deptgt-suffixes.exp head/contrib/bmake/unit-tests/deptgt.exp head/contrib/bmake/unit-tests/deptgt.mk head/contrib/bmake/unit-tests/dir.exp head/contrib/bmake/unit-tests/dir.mk head/contrib/bmake/unit-tests/directive-else.mk head/contrib/bmake/unit-tests/directive-export-literal.exp head/contrib/bmake/unit-tests/directive-export-literal.mk head/contrib/bmake/unit-tests/directive-export.mk head/contrib/bmake/unit-tests/directive-for.exp head/contrib/bmake/unit-tests/directive-for.mk head/contrib/bmake/unit-tests/directive-ifndef.exp head/contrib/bmake/unit-tests/directive-ifndef.mk head/contrib/bmake/unit-tests/directive-ifnmake.exp head/contrib/bmake/unit-tests/directive-ifnmake.mk head/contrib/bmake/unit-tests/directive-undef.mk head/contrib/bmake/unit-tests/directive-unexport.exp head/contrib/bmake/unit-tests/directive-unexport.mk head/contrib/bmake/unit-tests/directives.mk head/contrib/bmake/unit-tests/doterror.mk head/contrib/bmake/unit-tests/dotwait.mk head/contrib/bmake/unit-tests/envfirst.mk head/contrib/bmake/unit-tests/error.exp head/contrib/bmake/unit-tests/error.mk head/contrib/bmake/unit-tests/escape.mk head/contrib/bmake/unit-tests/export-all.mk head/contrib/bmake/unit-tests/export-env.mk head/contrib/bmake/unit-tests/export-variants.mk head/contrib/bmake/unit-tests/export.exp head/contrib/bmake/unit-tests/export.mk head/contrib/bmake/unit-tests/forloop.exp head/contrib/bmake/unit-tests/forloop.mk head/contrib/bmake/unit-tests/forsubst.mk head/contrib/bmake/unit-tests/include-main.exp head/contrib/bmake/unit-tests/include-main.mk head/contrib/bmake/unit-tests/include-sub.mk head/contrib/bmake/unit-tests/include-subsub.mk head/contrib/bmake/unit-tests/lint.exp head/contrib/bmake/unit-tests/lint.mk head/contrib/bmake/unit-tests/make-exported.exp head/contrib/bmake/unit-tests/make-exported.mk head/contrib/bmake/unit-tests/moderrs.exp head/contrib/bmake/unit-tests/moderrs.mk head/contrib/bmake/unit-tests/modmatch.mk head/contrib/bmake/unit-tests/modmisc.mk head/contrib/bmake/unit-tests/modts.mk head/contrib/bmake/unit-tests/modword.exp head/contrib/bmake/unit-tests/modword.mk head/contrib/bmake/unit-tests/opt-debug.exp head/contrib/bmake/unit-tests/opt-debug.mk head/contrib/bmake/unit-tests/opt-ignore.exp head/contrib/bmake/unit-tests/opt-ignore.mk head/contrib/bmake/unit-tests/opt-keep-going.exp head/contrib/bmake/unit-tests/opt-keep-going.mk head/contrib/bmake/unit-tests/phony-end.mk head/contrib/bmake/unit-tests/posix.mk head/contrib/bmake/unit-tests/posix1.mk head/contrib/bmake/unit-tests/qequals.mk head/contrib/bmake/unit-tests/recursive.mk head/contrib/bmake/unit-tests/sh-dots.exp head/contrib/bmake/unit-tests/sh-dots.mk head/contrib/bmake/unit-tests/sunshcmd.mk head/contrib/bmake/unit-tests/ternary.mk head/contrib/bmake/unit-tests/unexport-env.mk head/contrib/bmake/unit-tests/unexport.mk head/contrib/bmake/unit-tests/var-class-local.exp head/contrib/bmake/unit-tests/var-class-local.mk head/contrib/bmake/unit-tests/var-op-append.exp head/contrib/bmake/unit-tests/var-op-append.mk head/contrib/bmake/unit-tests/var-op-assign.mk head/contrib/bmake/unit-tests/varcmd.mk head/contrib/bmake/unit-tests/vardebug.exp head/contrib/bmake/unit-tests/vardebug.mk head/contrib/bmake/unit-tests/varmisc.mk head/contrib/bmake/unit-tests/varmod-assign.exp head/contrib/bmake/unit-tests/varmod-assign.mk head/contrib/bmake/unit-tests/varmod-defined.mk head/contrib/bmake/unit-tests/varmod-edge.mk head/contrib/bmake/unit-tests/varmod-exclam-shell.mk head/contrib/bmake/unit-tests/varmod-gmtime.exp head/contrib/bmake/unit-tests/varmod-gmtime.mk head/contrib/bmake/unit-tests/varmod-hash.mk head/contrib/bmake/unit-tests/varmod-ifelse.exp head/contrib/bmake/unit-tests/varmod-ifelse.mk head/contrib/bmake/unit-tests/varmod-l-name-to-value.mk head/contrib/bmake/unit-tests/varmod-localtime.exp head/contrib/bmake/unit-tests/varmod-localtime.mk head/contrib/bmake/unit-tests/varmod-loop.exp head/contrib/bmake/unit-tests/varmod-loop.mk head/contrib/bmake/unit-tests/varmod-match-escape.exp head/contrib/bmake/unit-tests/varmod-match-escape.mk head/contrib/bmake/unit-tests/varmod-match.exp head/contrib/bmake/unit-tests/varmod-match.mk head/contrib/bmake/unit-tests/varmod-order-reverse.mk head/contrib/bmake/unit-tests/varmod-order-shuffle.mk head/contrib/bmake/unit-tests/varmod-order.mk head/contrib/bmake/unit-tests/varmod-quote.mk head/contrib/bmake/unit-tests/varmod-range.exp head/contrib/bmake/unit-tests/varmod-range.mk head/contrib/bmake/unit-tests/varmod-subst-regex.mk head/contrib/bmake/unit-tests/varmod-subst.mk head/contrib/bmake/unit-tests/varmod-sysv.exp head/contrib/bmake/unit-tests/varmod-sysv.mk head/contrib/bmake/unit-tests/varmod-to-lower.mk head/contrib/bmake/unit-tests/varmod-to-separator.exp head/contrib/bmake/unit-tests/varmod-to-separator.mk head/contrib/bmake/unit-tests/varmod-to-upper.mk head/contrib/bmake/unit-tests/varmod-undefined.mk head/contrib/bmake/unit-tests/varmod.exp head/contrib/bmake/unit-tests/varmod.mk head/contrib/bmake/unit-tests/varname-dot-curdir.mk head/contrib/bmake/unit-tests/varname-dot-includes.mk head/contrib/bmake/unit-tests/varname-dot-libs.mk head/contrib/bmake/unit-tests/varname-dot-newline.mk head/contrib/bmake/unit-tests/varname-dot-parsedir.exp head/contrib/bmake/unit-tests/varname-dot-parsedir.mk head/contrib/bmake/unit-tests/varname-dot-parsefile.exp head/contrib/bmake/unit-tests/varname-dot-parsefile.mk head/contrib/bmake/unit-tests/varname-dot-path.mk head/contrib/bmake/unit-tests/varname-dot-shell.exp head/contrib/bmake/unit-tests/varname-dot-shell.mk head/contrib/bmake/unit-tests/varname-empty.exp head/contrib/bmake/unit-tests/varname-empty.mk head/contrib/bmake/unit-tests/varname-make_print_var_on_error.exp head/contrib/bmake/unit-tests/varname-make_print_var_on_error.mk head/contrib/bmake/unit-tests/varname.mk head/contrib/bmake/unit-tests/varparse-dynamic.mk head/contrib/bmake/unit-tests/varshell.exp head/contrib/bmake/unit-tests/varshell.mk head/contrib/bmake/util.c head/contrib/bmake/var.c head/usr.bin/bmake/Makefile head/usr.bin/bmake/Makefile.config head/usr.bin/bmake/config.h head/usr.bin/bmake/unit-tests/Makefile Directory Properties: head/contrib/bmake/ (props changed) Modified: head/contrib/bmake/ChangeLog ============================================================================== --- head/contrib/bmake/ChangeLog Sat Nov 7 21:17:49 2020 (r367464) +++ head/contrib/bmake/ChangeLog Sat Nov 7 21:46:27 2020 (r367465) @@ -1,3 +1,267 @@ +2020-11-01 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201101 + Merge with NetBSD make, pick up + o negate NoExecute to GNode_ShouldExecute + o job.c: rename JobMatchShell to FindShellByName + extract EscapeShellDblQuot from JobPrintCommand + extract ParseRunOptions from JobPrintCommand + o var.c: extract ApplyModifiersIndirect from ApplyModifiers + treat malformed :range, :ts and :[...] as errors + add tests for the variable modifiers :[words] and :range + +2020-10-31 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201031 + Merge with NetBSD make, pick up + o format #include directives consistently + o do not look up local variables like .TARGET anywhere else + o main.c: Main_SetObjdir is first called for curdir which may be + readonly + reduce the scope where recursive expressions are detected + remove redundant :tl from getBoolean + clean up mkTempFile + o meta.c: simplify memory allocation in meta_create and meta_oodate + o parse.c: extract loadedfile_mmap from loadfile + o trace.c: document possible undefined behavior with .CURDIR + o var.c: make parsing of the :gmtime and :localtime modifiers stricter + rename ismeta to is_shell_metachar + remove debug logging for the :Q variable modifier + rename VarIsDynamic to VarnameIsDynamic + use consistent parameter order in varname parsing functions + extract ParseVarnameLong from Var_Parse + extract ParseVarnameShort from Var_Parse + fix type of ParseModifierPart parameter delim + extract IsEscapedModifierPart from ParseModifierPart + clean up ModifyWords + add test for combining the :@ and :? variable modifiers + +2020-10-30 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201030 + Merge with NetBSD make, pick up + o change char * to void * in Var_Value + o make iterating over HashTable simpler + o rename VAR_CMD to VAR_CMDLINE + o cond.c: clean up is_separator + fix parse error in string literal in conditional + o main.c: do not use objdir that is not writable + in lint mode, exit with error status on errors + o parse.c: clean up StrContainsWord + fix out-of-bounds pointer in ParseTrackInput + o var.c: rename Str_SYSVMatch and its parameters + remove unsatisfiable conditions in Var_Set_with_flags + document where the variable name is expanded + fix documentation for VARP_SUB_ONE + rename VAR_EXPORTED_YES to VAR_EXPORTED_SOME + document VAR_READONLY + prevent appending to read-only variables + extract MayExport from Var_Export1 + remove redundant evaluations in VarFind + replace VarFindFlags with a simple Boolean + rename FIND_CMD to FIND_CMDLINE, to match VAR_CMDLINE + +2020-10-28 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201028 + Merge with NetBSD make, pick up + o rename defIncPath to defSysIncPath + o initialize all CmdOpts fields + o lst.c: inline Vector_Get + o main.c: refactor main extract + InitMaxJobs,InitObjdir,InitVarMake,InitRandom, + ReadMakefiles,CleanUp,InitVpath,ReadBuiltinRules, + InitDefIncPath,CmdOpts_Init,UnlimitFiles + o parse.c: merge curFile into includes + rename predecessor to order_pred + sort ParseSpecial alphabetically + remove unused, undocumented .NOEXPORT + rename ParseSpecial enum values consistently + rename some fields of struct IFile + +2020-10-26 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201026 + Merge with NetBSD make, pick up + o group the command line options and arguments into a struct + o rename GNode.cmgn to youngestChild + o rename hash functions to identify the type name + o negate OP_NOP and rename it to GNode_IsTarget + o add GNode_Path to access the path of a GNode + o remove macros MIN and MAX + o remove unused Lst_Find and Lst_FindFrom + o arch.c: and make Arch_FindLib simpler + clean up code layout + make Arch_ParseArchive simpler + o cond.c: inline CondFindStrMatch into FuncMake + o dir.c: replace Dir_CopyDir with Dir_CopyDirSearchPath + omit trailing space in debug output for expanding file patterns + refactor DirMatchFiles + document that the SearchPath of Dir_FindFile may be NULL + remove UNCONST from Dir_Expand + inline DirFindName + o for.c: clean up code for handling .for loops + o hash.c: print hash in debug log with fixed width + clean up hash table functions + reduce amount of string hashing + o job.c: refactor JobDeleteTarget + use proper enum constants for aborting + convert result of JobStart from macros to enum + convert abort reason macros to enum + rework Job_CheckCommands to reduce indentation + rename Shell fields + add field names in declaration of DEFSHELL_CUSTOM + convert JobState and JobFlags to enum types + move handling of the "..." command to JobPrintCommands + o lst.c: clean up + refactor LstNodeNew + remove Lst_Open, Lst_Next, Lst_Close + remove code for circular lists from Lst_Next + o main.c: do not attempt to read .MAKE.DEPENFILE if set to + /dev/null or anything starting with "no" + convert macros for debug flags into enum + o make.c: inline Lst_Copy in Make_ExpandUse + o meta.c: inline Lst_Find in meta_oodate + make Lst_RemoveIf simpler in meta_oodate + o parse.c: convert error level for Parse_Error to an enum + o suff.c: properly terminate debug output with newline + add more details to DEBUG_SRC log + replace Dir_CopyDir with Dir_CopyDirSearchPath + don't modify GNode name while rebuilding the suffix graph + o var.c: reduce duplicate code in VarFind + +2020-10-22 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201022 + Merge with NetBSD make, pick up + o more refactoring and simplification to reduce code size + o var.c: extract CanonicalVarname from VarFind + o make.c: extract UpdateImplicitParentsVars from Make_Update + o main.c: extract PrintVar from doPrintVars + extract HandlePWD from main + o lst.c: inline simple Lst getters + remove unused Lst_ForEach + o job.c: move struct Shell from job.h to job.c + o more unit tests + +2020-10-19 Simon J Gerraty + + * configure.in: remove inappropriate use of AC_INCLUDES_DEFAULT + +2020-10-18 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201018 + Merge with NetBSD make, pick up + o remove USE_IOVEC + o rename some Hash_* apis to Hash* + o replace execError with execDie + o rename Lst_Init to Lst_New + o add tags to enum types + o rename Stack to Vector + o parse.c: more refactoring + o unit-tests: make some tests use line buffered stdout + o unit-tests/Makefile: in meta mode do not make all tests depend on + Makefile, it isn't necessary. + +2020-10-10 Simon J Gerraty + + * main.c: check for CTL_HW being defined. + * unit-tests/Makefile: ensure export tests output are POSIX compliant + disable opt-debug-jobs test until it works on ubuntu + + * VERSION (_MAKE_VERSION): 20201010 + Merge with NetBSD make, pick up + o dir.c: remove pathname limit for Dir_FindHereOrAbove + o hash.c: replace strcpy with memcpy in Hash_CreateEntry + o main.c: extract init_machine and init_machine_arch from main + allow to disable debug logging options + o parse.c: enable format string truncation warnings + extract parsing of sources from ParseDoDependency + split ParseDoSrc into smaller functions + hide implementation details from Parse_DoVar + clean up parsing of variable assignments + split Parse_DoVar into manageable pieces + don't modify the given line during Parse_DoVar + fix out-of-bounds memory access in Parse_DoVar + fix parsing of the :sh assignment modifier + o var.c: rework memory allocation for the name of variables + extract ApplyModifier_Literal into separate function + in lint mode, reject modifiers without delimiter + do not export variable names starting with '-' + o fix double-free bug in -DCLEANUP mode + o more cleanup to enable higher warnings level + o more unit tests + +2020-10-02 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201002 + Merge with NetBSD make, pick up + o dir.c: use hash table for looking up open directories by name + o main.c: clean up option handling + o parse.c: add missing const for Parse_AddIncludeDir + o var.c: ApplyModifier_To, update pp in each branch + o remove redundant function prototypes + o more unit tests + +2020-10-01 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20201001 + Merge with NetBSD make, pick up + o compat.c: comment about "..." + +2020-09-30 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200930 + Merge with NetBSD make, pick up + o job.c: split Job.jobPipe into 2 separate fields + replace Lst_Open with direct iteration + o lst.c: remove redundant assertions + o targ.c: replace Lst_Open with direct iteration + o var.c: fix bug in evaluation of indirect variable modifiers + extract ApplyModifier_Quote into separate function + o make debug logging simpler + +2020-09-27 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200927 + Merge with NetBSD make, pick up + o parse.c: ensure parse errors result in 'stopped in' message. + o compat.c: make parameter of Compat_RunCommand const + o main.c: extract InitVarTarget from main + o parse.c: rename ParseFinishLine to FinishDependencyGroup + refactor ParseDoDependency + o var.c: Var_Subst no longer returns string result + rename Var_ParsePP back to Var_Parse + in lint mode, improve error handling for undefined variables + extract ParseVarname from Var_Parse + o rename Lst_ForEach to Lst_ForEachUntil + o inline Lst_ForEachUntil in several cases + o clean up API for finding and creating GNodes + o fix assertion failure in -j mode with .END node + o inline and remove LstNode_Prev and LstNode_Next + o use fine-grained type names for lists and their nodes + o more unit tests + +2020-09-11 Simon J Gerraty + + * VERSION (_MAKE_VERSION): 20200911 + Merge with NetBSD make, pick up + o cond.c: split EvalComparison into smaller functions + reorder parameters of condition parsing functions + reduce code size in CondParser_Eval + rename CondGetString to CondParser_String + add CondLexer_SkipWhitespace + group the condition parsing state into a struct + in CondGetString, replace repeated Buf_Add with Buf_AddStr + o migrate Var_Parse to Var_ParsePP + o add wrappers around ctype.h functions + o lst.c: use a stack instead of a list for the nested include path + o more unit tests + +2020-09-04 Simon J Gerraty + + * make-bootstrap.sh.in: adjust object list + 2020-09-02 Simon J Gerraty * VERSION (_MAKE_VERSION): 20200902 Modified: head/contrib/bmake/FILES ============================================================================== --- head/contrib/bmake/FILES Sat Nov 7 21:17:49 2020 (r367464) +++ head/contrib/bmake/FILES Sat Nov 7 21:46:27 2020 (r367465) @@ -65,18 +65,16 @@ sigcompat.c str.c stresep.c strlcpy.c -strlist.c -strlist.h suff.c targ.c trace.c trace.h unit-tests/Makefile unit-tests/Makefile.config.in -unit-tests/archive.exp -unit-tests/archive.mk unit-tests/archive-suffix.exp unit-tests/archive-suffix.mk +unit-tests/archive.exp +unit-tests/archive.mk unit-tests/cmd-interrupt.exp unit-tests/cmd-interrupt.mk unit-tests/cmdline.exp @@ -99,8 +97,8 @@ unit-tests/cond-cmp-numeric.exp unit-tests/cond-cmp-numeric.mk unit-tests/cond-cmp-string.exp unit-tests/cond-cmp-string.mk -unit-tests/cond-func.exp -unit-tests/cond-func.mk +unit-tests/cond-cmp-unary.exp +unit-tests/cond-cmp-unary.mk unit-tests/cond-func-commands.exp unit-tests/cond-func-commands.mk unit-tests/cond-func-defined.exp @@ -113,6 +111,8 @@ unit-tests/cond-func-make.exp unit-tests/cond-func-make.mk unit-tests/cond-func-target.exp unit-tests/cond-func-target.mk +unit-tests/cond-func.exp +unit-tests/cond-func.mk unit-tests/cond-late.exp unit-tests/cond-late.mk unit-tests/cond-op-and.exp @@ -135,26 +135,36 @@ unit-tests/cond-token-string.exp unit-tests/cond-token-string.mk unit-tests/cond-token-var.exp unit-tests/cond-token-var.mk +unit-tests/cond-undef-lint.exp +unit-tests/cond-undef-lint.mk unit-tests/cond1.exp unit-tests/cond1.mk -unit-tests/cond2.exp -unit-tests/cond2.mk +unit-tests/counter-append.exp +unit-tests/counter-append.mk unit-tests/counter.exp unit-tests/counter.mk +unit-tests/dep-colon-bug-cross-file.exp +unit-tests/dep-colon-bug-cross-file.mk unit-tests/dep-colon.exp unit-tests/dep-colon.mk +unit-tests/dep-double-colon-indep.exp +unit-tests/dep-double-colon-indep.mk unit-tests/dep-double-colon.exp unit-tests/dep-double-colon.mk unit-tests/dep-exclam.exp unit-tests/dep-exclam.mk unit-tests/dep-none.exp unit-tests/dep-none.mk +unit-tests/dep-percent.exp +unit-tests/dep-percent.mk unit-tests/dep-var.exp unit-tests/dep-var.mk unit-tests/dep-wildcards.exp unit-tests/dep-wildcards.mk unit-tests/dep.exp unit-tests/dep.mk +unit-tests/depsrc-end.exp +unit-tests/depsrc-end.mk unit-tests/depsrc-exec.exp unit-tests/depsrc-exec.mk unit-tests/depsrc-ignore.exp @@ -185,10 +195,10 @@ unit-tests/depsrc-silent.exp unit-tests/depsrc-silent.mk unit-tests/depsrc-use.exp unit-tests/depsrc-use.mk -unit-tests/depsrc-usebefore.exp -unit-tests/depsrc-usebefore.mk unit-tests/depsrc-usebefore-double-colon.exp unit-tests/depsrc-usebefore-double-colon.mk +unit-tests/depsrc-usebefore.exp +unit-tests/depsrc-usebefore.mk unit-tests/depsrc-wait.exp unit-tests/depsrc-wait.mk unit-tests/depsrc.exp @@ -199,6 +209,8 @@ unit-tests/deptgt-default.exp unit-tests/deptgt-default.mk unit-tests/deptgt-delete_on_error.exp unit-tests/deptgt-delete_on_error.mk +unit-tests/deptgt-end-jobs.exp +unit-tests/deptgt-end-jobs.mk unit-tests/deptgt-end.exp unit-tests/deptgt-end.mk unit-tests/deptgt-error.exp @@ -239,10 +251,12 @@ unit-tests/deptgt-suffixes.exp unit-tests/deptgt-suffixes.mk unit-tests/deptgt.exp unit-tests/deptgt.mk -unit-tests/dir.exp -unit-tests/dir.mk unit-tests/dir-expand-path.exp unit-tests/dir-expand-path.mk +unit-tests/dir.exp +unit-tests/dir.mk +unit-tests/directive-dinclude.exp +unit-tests/directive-dinclude.mk unit-tests/directive-elif.exp unit-tests/directive-elif.mk unit-tests/directive-elifdef.exp @@ -261,14 +275,18 @@ unit-tests/directive-error.exp unit-tests/directive-error.mk unit-tests/directive-export-env.exp unit-tests/directive-export-env.mk +unit-tests/directive-export-gmake.exp +unit-tests/directive-export-gmake.mk unit-tests/directive-export-literal.exp unit-tests/directive-export-literal.mk unit-tests/directive-export.exp unit-tests/directive-export.mk -unit-tests/directive-for.exp -unit-tests/directive-for.mk unit-tests/directive-for-generating-endif.exp unit-tests/directive-for-generating-endif.mk +unit-tests/directive-for.exp +unit-tests/directive-for.mk +unit-tests/directive-hyphen-include.exp +unit-tests/directive-hyphen-include.mk unit-tests/directive-if.exp unit-tests/directive-if.mk unit-tests/directive-ifdef.exp @@ -279,8 +297,14 @@ unit-tests/directive-ifndef.exp unit-tests/directive-ifndef.mk unit-tests/directive-ifnmake.exp unit-tests/directive-ifnmake.mk +unit-tests/directive-include-fatal.exp +unit-tests/directive-include-fatal.mk +unit-tests/directive-include.exp +unit-tests/directive-include.mk unit-tests/directive-info.exp unit-tests/directive-info.mk +unit-tests/directive-sinclude.exp +unit-tests/directive-sinclude.mk unit-tests/directive-undef.exp unit-tests/directive-undef.mk unit-tests/directive-unexport-env.exp @@ -317,20 +341,20 @@ unit-tests/forloop.exp unit-tests/forloop.mk unit-tests/forsubst.exp unit-tests/forsubst.mk -unit-tests/hash.exp -unit-tests/hash.mk +unit-tests/hanoi-include.exp +unit-tests/hanoi-include.mk unit-tests/impsrc.exp unit-tests/impsrc.mk unit-tests/include-main.exp unit-tests/include-main.mk unit-tests/include-sub.mk unit-tests/include-subsub.mk +unit-tests/job-output-long-lines.exp +unit-tests/job-output-long-lines.mk unit-tests/lint.exp unit-tests/lint.mk unit-tests/make-exported.exp unit-tests/make-exported.mk -unit-tests/misc.exp -unit-tests/misc.mk unit-tests/moderrs.exp unit-tests/moderrs.mk unit-tests/modmatch.exp @@ -345,10 +369,56 @@ unit-tests/opt-backwards.exp unit-tests/opt-backwards.mk unit-tests/opt-chdir.exp unit-tests/opt-chdir.mk +unit-tests/opt-debug-all.exp +unit-tests/opt-debug-all.mk +unit-tests/opt-debug-archive.exp +unit-tests/opt-debug-archive.mk +unit-tests/opt-debug-cond.exp +unit-tests/opt-debug-cond.mk +unit-tests/opt-debug-curdir.exp +unit-tests/opt-debug-curdir.mk +unit-tests/opt-debug-dir.exp +unit-tests/opt-debug-dir.mk +unit-tests/opt-debug-errors.exp +unit-tests/opt-debug-errors.mk +unit-tests/opt-debug-file.exp +unit-tests/opt-debug-file.mk +unit-tests/opt-debug-for.exp +unit-tests/opt-debug-for.mk +unit-tests/opt-debug-graph1.exp +unit-tests/opt-debug-graph1.mk +unit-tests/opt-debug-graph2.exp +unit-tests/opt-debug-graph2.mk +unit-tests/opt-debug-graph3.exp +unit-tests/opt-debug-graph3.mk +unit-tests/opt-debug-hash.exp +unit-tests/opt-debug-hash.mk +unit-tests/opt-debug-jobs.exp +unit-tests/opt-debug-jobs.mk +unit-tests/opt-debug-lint.exp +unit-tests/opt-debug-lint.mk +unit-tests/opt-debug-loud.exp +unit-tests/opt-debug-loud.mk +unit-tests/opt-debug-making.exp +unit-tests/opt-debug-making.mk +unit-tests/opt-debug-meta.exp +unit-tests/opt-debug-meta.mk +unit-tests/opt-debug-no-rm.exp +unit-tests/opt-debug-no-rm.mk +unit-tests/opt-debug-parse.exp +unit-tests/opt-debug-parse.mk +unit-tests/opt-debug-suff.exp +unit-tests/opt-debug-suff.mk +unit-tests/opt-debug-targets.exp +unit-tests/opt-debug-targets.mk +unit-tests/opt-debug-var.exp +unit-tests/opt-debug-var.mk +unit-tests/opt-debug-varraw.exp +unit-tests/opt-debug-varraw.mk +unit-tests/opt-debug-x-trace.exp +unit-tests/opt-debug-x-trace.mk unit-tests/opt-debug.exp unit-tests/opt-debug.mk -unit-tests/opt-debug-g1.exp -unit-tests/opt-debug-g1.mk unit-tests/opt-define.exp unit-tests/opt-define.mk unit-tests/opt-env.exp @@ -395,6 +465,8 @@ unit-tests/opt.exp unit-tests/opt.mk unit-tests/order.exp unit-tests/order.mk +unit-tests/parse-var.exp +unit-tests/parse-var.mk unit-tests/phony-end.exp unit-tests/phony-end.mk unit-tests/posix.exp @@ -425,12 +497,34 @@ unit-tests/sh-single-line.exp unit-tests/sh-single-line.mk unit-tests/sh.exp unit-tests/sh.mk -unit-tests/suffixes.exp -unit-tests/suffixes.mk +unit-tests/shell-csh.exp +unit-tests/shell-csh.mk +unit-tests/shell-custom.exp +unit-tests/shell-custom.mk +unit-tests/shell-ksh.exp +unit-tests/shell-ksh.mk +unit-tests/shell-sh.exp +unit-tests/shell-sh.mk +unit-tests/suff-add-later.exp +unit-tests/suff-add-later.mk +unit-tests/suff-clear-regular.exp +unit-tests/suff-clear-regular.mk +unit-tests/suff-clear-single.exp +unit-tests/suff-clear-single.mk +unit-tests/suff-lookup.exp +unit-tests/suff-lookup.mk +unit-tests/suff-main.exp +unit-tests/suff-main.mk +unit-tests/suff-rebuild.exp +unit-tests/suff-rebuild.mk +unit-tests/suff-transform-endless.exp +unit-tests/suff-transform-endless.mk +unit-tests/suff-transform-expand.exp +unit-tests/suff-transform-expand.mk +unit-tests/suff-transform-select.exp +unit-tests/suff-transform-select.mk unit-tests/sunshcmd.exp unit-tests/sunshcmd.mk -unit-tests/sysv.exp -unit-tests/sysv.mk unit-tests/ternary.exp unit-tests/ternary.mk unit-tests/unexport-env.exp @@ -461,8 +555,12 @@ unit-tests/var-op-expand.exp unit-tests/var-op-expand.mk unit-tests/var-op-shell.exp unit-tests/var-op-shell.mk +unit-tests/var-op-sunsh.exp +unit-tests/var-op-sunsh.mk unit-tests/var-op.exp unit-tests/var-op.mk +unit-tests/var-recursive.exp +unit-tests/var-recursive.mk unit-tests/varcmd.exp unit-tests/varcmd.mk unit-tests/vardebug.exp @@ -555,12 +653,12 @@ unit-tests/varname-dot-alltargets.exp unit-tests/varname-dot-alltargets.mk unit-tests/varname-dot-curdir.exp unit-tests/varname-dot-curdir.mk -unit-tests/varname-dot-includes.exp -unit-tests/varname-dot-includes.mk unit-tests/varname-dot-includedfromdir.exp unit-tests/varname-dot-includedfromdir.mk unit-tests/varname-dot-includedfromfile.exp unit-tests/varname-dot-includedfromfile.mk +unit-tests/varname-dot-includes.exp +unit-tests/varname-dot-includes.mk unit-tests/varname-dot-libs.exp unit-tests/varname-dot-libs.mk unit-tests/varname-dot-make-dependfile.exp @@ -623,8 +721,12 @@ unit-tests/varname-empty.exp unit-tests/varname-empty.mk unit-tests/varname-make.exp unit-tests/varname-make.mk +unit-tests/varname-make_print_var_on_error-jobs.exp +unit-tests/varname-make_print_var_on_error-jobs.mk unit-tests/varname-make_print_var_on_error.exp unit-tests/varname-make_print_var_on_error.mk +unit-tests/varname-makefile.exp +unit-tests/varname-makefile.mk unit-tests/varname-makeflags.exp unit-tests/varname-makeflags.mk unit-tests/varname-pwd.exp @@ -635,6 +737,10 @@ unit-tests/varname.exp unit-tests/varname.mk unit-tests/varparse-dynamic.exp unit-tests/varparse-dynamic.mk +unit-tests/varparse-mod.exp +unit-tests/varparse-mod.mk +unit-tests/varparse-undef-partial.exp +unit-tests/varparse-undef-partial.mk unit-tests/varquote.exp unit-tests/varquote.mk unit-tests/varshell.exp Modified: head/contrib/bmake/Makefile ============================================================================== --- head/contrib/bmake/Makefile Sat Nov 7 21:17:49 2020 (r367464) +++ head/contrib/bmake/Makefile Sat Nov 7 21:46:27 2020 (r367465) @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.112 2020/08/28 16:26:17 sjg Exp $ +# $Id: Makefile,v 1.113 2020/10/26 17:55:09 sjg Exp $ PROG= bmake @@ -20,7 +20,6 @@ SRCS= \ metachar.c \ parse.c \ str.c \ - strlist.c \ suff.c \ targ.c \ trace.c \ Modified: head/contrib/bmake/VERSION ============================================================================== --- head/contrib/bmake/VERSION Sat Nov 7 21:17:49 2020 (r367464) +++ head/contrib/bmake/VERSION Sat Nov 7 21:46:27 2020 (r367465) @@ -1,2 +1,2 @@ # keep this compatible with sh and make -_MAKE_VERSION=20200902 +_MAKE_VERSION=20201101 Modified: head/contrib/bmake/arch.c ============================================================================== --- head/contrib/bmake/arch.c Sat Nov 7 21:17:49 2020 (r367464) +++ head/contrib/bmake/arch.c Sat Nov 7 21:46:27 2020 (r367465) @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.107 2020/08/30 11:15:05 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.151 2020/10/31 18:41:07 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -68,19 +68,6 @@ * SUCH DAMAGE. */ -#ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: arch.c,v 1.107 2020/08/30 11:15:05 rillig Exp $"; -#else -#include -#ifndef lint -#if 0 -static char sccsid[] = "@(#)arch.c 8.2 (Berkeley) 1/2/94"; -#else -__RCSID("$NetBSD: arch.c,v 1.107 2020/08/30 11:15:05 rillig Exp $"); -#endif -#endif /* not lint */ -#endif - /*- * arch.c -- * Functions to manipulate libraries, archives and their members. @@ -92,52 +79,53 @@ __RCSID("$NetBSD: arch.c,v 1.107 2020/08/30 11:15:05 r * is referenced. * * The interface to this module is: - * Arch_ParseArchive Given an archive specification, return a list - * of GNode's, one for each member in the spec. - * FALSE is returned if the specification is - * invalid for some reason. + * Arch_ParseArchive + * Given an archive specification, return a list + * of GNode's, one for each member in the spec. + * FALSE is returned if the specification is + * invalid for some reason. * - * Arch_Touch Alter the modification time of the archive - * member described by the given node to be - * the current time. + * Arch_Touch Alter the modification time of the archive + * member described by the given node to be + * the current time. * - * Arch_TouchLib Update the modification time of the library - * described by the given node. This is special - * because it also updates the modification time - * of the library's table of contents. + * Arch_TouchLib Update the modification time of the library + * described by the given node. This is special + * because it also updates the modification time + * of the library's table of contents. * - * Arch_MTime Find the modification time of a member of - * an archive *in the archive*. The time is also - * placed in the member's GNode. Returns the - * modification time. + * Arch_MTime Find the modification time of a member of + * an archive *in the archive*. The time is also + * placed in the member's GNode. Returns the + * modification time. * - * Arch_MemTime Find the modification time of a member of - * an archive. Called when the member doesn't - * already exist. Looks in the archive for the - * modification time. Returns the modification - * time. + * Arch_MemTime Find the modification time of a member of + * an archive. Called when the member doesn't + * already exist. Looks in the archive for the + * modification time. Returns the modification + * time. * - * Arch_FindLib Search for a library along a path. The - * library name in the GNode should be in - * -l format. + * Arch_FindLib Search for a library along a path. The + * library name in the GNode should be in + * -l format. * - * Arch_LibOODate Special function to decide if a library node - * is out-of-date. + * Arch_LibOODate Special function to decide if a library node + * is out-of-date. * - * Arch_Init Initialize this module. + * Arch_Init Initialize this module. * - * Arch_End Cleanup this module. + * Arch_End Clean up this module. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include -#include -#include -#include +#include +#include +#include +#include #ifdef HAVE_AR_H -#include +#include #else struct ar_hdr { char ar_name[16]; /* name */ @@ -153,18 +141,18 @@ struct ar_hdr { }; #endif #if defined(HAVE_RANLIB_H) && !(defined(__ELF__) || defined(NO_RANLIB)) -#include +#include #endif -#include -#include #ifdef HAVE_UTIME_H -#include +#include #endif -#include "make.h" -#include "hash.h" -#include "dir.h" +#include "make.h" +#include "dir.h" +/* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ +MAKE_RCSID("$NetBSD: arch.c,v 1.151 2020/10/31 18:41:07 rillig Exp $"); + #ifdef TARGET_MACHINE #undef MAKE_MACHINE #define MAKE_MACHINE TARGET_MACHINE @@ -174,17 +162,19 @@ struct ar_hdr { #define MAKE_MACHINE_ARCH TARGET_MACHINE_ARCH #endif -static Lst archives; /* Lst of archives we've already examined */ +typedef struct List ArchList; +typedef struct ListNode ArchListNode; +static ArchList *archives; /* The archives we've already examined */ + typedef struct Arch { - char *name; /* Name of archive */ - Hash_Table members; /* All the members of the archive described - * by key/value pairs */ - char *fnametab; /* Extended name table strings */ - size_t fnamesize; /* Size of the string table */ + char *name; /* Name of archive */ + HashTable members; /* All the members of the archive described + * by key/value pairs */ + char *fnametab; /* Extended name table strings */ + size_t fnamesize; /* Size of the string table */ } Arch; -static struct ar_hdr *ArchStatMember(const char *, const char *, Boolean); static FILE *ArchFindMember(const char *, const char *, struct ar_hdr *, const char *); #if defined(__svr4__) || defined(__SVR4) || defined(__ELF__) @@ -219,25 +209,22 @@ static int ArchSVR4Entry(Arch *, char *, size_t, FILE # define SARMAG 8 #endif -#define AR_MAX_NAME_LEN (sizeof(arh.AR_NAME)-1) #ifdef CLEANUP static void ArchFree(void *ap) { - Arch *a = (Arch *)ap; - Hash_Search search; - Hash_Entry *entry; + Arch *a = ap; + HashIter hi; /* Free memory from hash entries */ - for (entry = Hash_EnumFirst(&a->members, &search); - entry != NULL; - entry = Hash_EnumNext(&search)) - free(Hash_GetValue(entry)); + HashIter_Init(&hi, &a->members); + while (HashIter_Next(&hi) != NULL) + free(hi.entry->value); free(a->name); free(a->fnametab); - Hash_DeleteTable(&a->members); + HashTable_Done(&a->members); free(a); } #endif @@ -262,46 +249,49 @@ ArchFree(void *ap) *----------------------------------------------------------------------- */ Boolean -Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode *ctxt) +Arch_ParseArchive(char **linePtr, GNodeList *nodeLst, GNode *ctxt) { - char *cp; /* Pointer into line */ - GNode *gn; /* New node */ - char *libName; /* Library-part of specification */ - char *memName; /* Member-part of specification */ - char saveChar; /* Ending delimiter of member-name */ - Boolean subLibName; /* TRUE if libName should have/had - * variable substitution performed on it */ + char *cp; /* Pointer into line */ + GNode *gn; /* New node */ + char *libName; /* Library-part of specification */ + char *memName; /* Member-part of specification */ + char saveChar; /* Ending delimiter of member-name */ + Boolean subLibName; /* TRUE if libName should have/had + * variable substitution performed on it */ libName = *linePtr; subLibName = FALSE; - for (cp = libName; *cp != '(' && *cp != '\0'; cp++) { + for (cp = libName; *cp != '(' && *cp != '\0';) { if (*cp == '$') { /* * Variable spec, so call the Var module to parse the puppy * so we can safely advance beyond it... */ - int length; - void *result_freeIt; - const char *result; + const char *nested_p = cp; + void *result_freeIt; + const char *result; Boolean isError; - result = Var_Parse(cp, ctxt, VARE_UNDEFERR|VARE_WANTRES, - &length, &result_freeIt); + (void)Var_Parse(&nested_p, ctxt, VARE_UNDEFERR|VARE_WANTRES, + &result, &result_freeIt); + /* TODO: handle errors */ isError = result == var_Error; free(result_freeIt); if (isError) return FALSE; subLibName = TRUE; - cp += length - 1; - } + cp += nested_p - cp; + } else + cp++; } *cp++ = '\0'; if (subLibName) { - libName = Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES); + (void)Var_Subst(libName, ctxt, VARE_UNDEFERR|VARE_WANTRES, &libName); + /* TODO: handle errors */ } @@ -311,25 +301,25 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * * place and skip to the end of it (either white-space or * a close paren). */ - Boolean doSubst = FALSE; /* TRUE if need to substitute in memName */ + Boolean doSubst = FALSE; /* TRUE if need to substitute in memName */ - while (*cp != '\0' && *cp != ')' && isspace ((unsigned char)*cp)) { - cp++; - } + pp_skip_whitespace(&cp); + memName = cp; - while (*cp != '\0' && *cp != ')' && !isspace ((unsigned char)*cp)) { + while (*cp != '\0' && *cp != ')' && !ch_isspace(*cp)) { if (*cp == '$') { /* * Variable spec, so call the Var module to parse the puppy * so we can safely advance beyond it... */ - int length; - void *freeIt; + void *freeIt; const char *result; Boolean isError; + const char *nested_p = cp; - result = Var_Parse(cp, ctxt, VARE_UNDEFERR|VARE_WANTRES, - &length, &freeIt); + (void)Var_Parse(&nested_p, ctxt, VARE_UNDEFERR|VARE_WANTRES, + &result, &freeIt); + /* TODO: handle errors */ isError = result == var_Error; free(freeIt); @@ -337,7 +327,7 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * return FALSE; doSubst = TRUE; - cp += length; + cp += nested_p - cp; } else { cp++; } @@ -376,11 +366,13 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * * later. */ if (doSubst) { - char *buf; - char *sacrifice; - char *oldMemName = memName; + char *buf; + char *sacrifice; + char *oldMemName = memName; - memName = Var_Subst(memName, ctxt, VARE_UNDEFERR | VARE_WANTRES); + (void)Var_Subst(memName, ctxt, VARE_UNDEFERR|VARE_WANTRES, + &memName); + /* TODO: handle errors */ /* * Now form an archive spec and recurse to deal with nested @@ -395,85 +387,48 @@ Arch_ParseArchive(char **linePtr, Lst nodeLst, GNode * * Just create an ARCHV node for the thing and let * SuffExpandChildren handle it... */ - gn = Targ_FindNode(buf, TARG_CREATE); + gn = Targ_GetNode(buf); + gn->type |= OP_ARCHV; + Lst_Append(nodeLst, gn); - if (gn == NULL) { - free(buf); - return FALSE; - } else { - gn->type |= OP_ARCHV; - Lst_Append(nodeLst, gn); - } } else if (!Arch_ParseArchive(&sacrifice, nodeLst, ctxt)) { - /* - * Error in nested call -- free buffer and return FALSE - * ourselves. - */ + /* Error in nested call. */ free(buf); return FALSE; } - /* - * Free buffer and continue with our work. - */ free(buf); - } else if (Dir_HasWildcards(memName)) { - Lst members = Lst_Init(); - Buffer nameBuf; - Buf_Init(&nameBuf, 0); + } else if (Dir_HasWildcards(memName)) { + StringList *members = Lst_New(); Dir_Expand(memName, dirSearchPath, members); + while (!Lst_IsEmpty(members)) { char *member = Lst_Dequeue(members); - *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***