From owner-svn-src-stable@freebsd.org Sun Aug 2 04:25:15 2020 Return-Path: Delivered-To: svn-src-stable@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 3AAB1370E4C; Sun, 2 Aug 2020 04:25:15 +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 4BK7Gg0Qkyz44Gj; Sun, 2 Aug 2020 04:25:15 +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 E59591E19A; Sun, 2 Aug 2020 04:25:14 +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 0724PENa050127; Sun, 2 Aug 2020 04:25:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0724PCxX050114; Sun, 2 Aug 2020 04:25:12 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008020425.0724PCxX050114@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 2 Aug 2020 04:25:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363768 - in stable/12: contrib/ipfilter/iplang contrib/ipfilter/ipsend libexec/rc/rc.d sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable/12: contrib/ipfilter/iplang contrib/ipfilter/ipsend libexec/rc/rc.d sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 363768 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Aug 2020 04:25:15 -0000 Author: cy Date: Sun Aug 2 04:25:11 2020 New Revision: 363768 URL: https://svnweb.freebsd.org/changeset/base/363768 Log: MFC r363284-r363285, r363452, r363670 r363284: pfil_run_hooks() can be called recursively, so we have to define FASTROUTE_RECURSION in fil.c Submitted by: christos@NetBSD.org Reported by: christos@NetBSD.org Obtained from: NetBSD r1.31 r363285: Fix incorrect byte order in ipfstat -f output. - make sure frag is initialized to 0 - initialize ipfr_p field NetBSD PR: 55137 Submitted by: christos@NetBSD.org Reported by: christos@NetBSD.org Obtained from: NetBSD fil.c r1.32, ip_frag.c r1.8 r363452: Load ipfilter, ipnat, and ippool rules, and start ipmon in a vnet jail. PR: 248109 Reported by: joeb1@a1poweruser.com r363670: Continued ipfilter #ifdef cleanup. The r343701 log entry contains a complete description. Modified: stable/12/contrib/ipfilter/iplang/iplang_y.y stable/12/contrib/ipfilter/ipsend/arp.c stable/12/contrib/ipfilter/ipsend/ipresend.c stable/12/contrib/ipfilter/ipsend/ipsend.c stable/12/contrib/ipfilter/ipsend/iptest.c stable/12/contrib/ipfilter/ipsend/iptests.c stable/12/contrib/ipfilter/ipsend/sock.c stable/12/libexec/rc/rc.d/ipfilter stable/12/libexec/rc/rc.d/ipmon stable/12/libexec/rc/rc.d/ipnat stable/12/libexec/rc/rc.d/ippool stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_frag.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/ipfilter/iplang/iplang_y.y ============================================================================== --- stable/12/contrib/ipfilter/iplang/iplang_y.y Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/iplang/iplang_y.y Sun Aug 2 04:25:11 2020 (r363768) @@ -45,11 +45,6 @@ #include "ipf.h" #include "iplang.h" -#if !defined(__NetBSD__) && (!defined(__FreeBSD_version) && \ - __FreeBSD_version < 400020) && (!SOLARIS || SOLARIS2 < 10) -extern struct ether_addr *ether_aton __P((char *)); -#endif - extern int opts; extern struct ipopt_names ionames[]; extern int state, state, lineNum, token; @@ -58,11 +53,7 @@ extern char yytext[]; extern FILE *yyin; int yylex __P((void)); #define YYDEBUG 1 -#if !defined(ultrix) && !defined(hpux) int yydebug = 1; -#else -extern int yydebug; -#endif iface_t *iflist = NULL, **iftail = &iflist; iface_t *cifp = NULL; Modified: stable/12/contrib/ipfilter/ipsend/arp.c ============================================================================== --- stable/12/contrib/ipfilter/ipsend/arp.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/ipsend/arp.c Sun Aug 2 04:25:11 2020 (r363768) @@ -11,17 +11,13 @@ static const char rcsid[] = "@(#)$Id$"; #endif #include #include -#if !defined(ultrix) && !defined(hpux) && !defined(__hpux) && !defined(__osf__) && !defined(_AIX51) # include -#endif #include #include #include #include #include -#ifndef ultrix # include -#endif #include #include #include Modified: stable/12/contrib/ipfilter/ipsend/ipresend.c ============================================================================== --- stable/12/contrib/ipfilter/ipsend/ipresend.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/ipsend/ipresend.c Sun Aug 2 04:25:11 2020 (r363768) @@ -38,15 +38,7 @@ int opts = 0; # ifdef sun char default_device[] = "le0"; # else -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "lan0"; -# endif -# endif # endif #else char default_device[] = DEFAULT_DEVICE; Modified: stable/12/contrib/ipfilter/ipsend/ipsend.c ============================================================================== --- stable/12/contrib/ipfilter/ipsend/ipsend.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/ipsend/ipsend.c Sun Aug 2 04:25:11 2020 (r363768) @@ -33,15 +33,7 @@ extern void iplang __P((FILE *)); char options[68]; int opts; -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "le0"; -# endif /* __bsdi__ */ -# endif /* ultrix */ static void usage __P((char *)); Modified: stable/12/contrib/ipfilter/ipsend/iptest.c ============================================================================== --- stable/12/contrib/ipfilter/ipsend/iptest.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/ipsend/iptest.c Sun Aug 2 04:25:11 2020 (r363768) @@ -34,15 +34,7 @@ char options[68]; # ifdef sun char default_device[] = "le0"; # else -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "lan0"; -# endif -# endif # endif static void usage __P((char *)); Modified: stable/12/contrib/ipfilter/ipsend/iptests.c ============================================================================== --- stable/12/contrib/ipfilter/ipsend/iptests.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/ipsend/iptests.c Sun Aug 2 04:25:11 2020 (r363768) @@ -36,18 +36,13 @@ typedef int boolean_t; # endif # undef _KERNEL # undef KERNEL -#if !defined(solaris) && !defined(linux) && !defined(__sgi) +#if !defined(solaris) # include # include # include #endif -#if !defined(ultrix) && !defined(hpux) && !defined(linux) && \ - !defined(__sgi) && !defined(__osf__) && !defined(_AIX51) # include -#endif -#ifndef ultrix # include -#endif #if defined(solaris) # include #else @@ -57,11 +52,9 @@ typedef int boolean_t; #include #include #endif -#if BSD >= 199103 # include # include # include -#endif #include #include #include @@ -74,7 +67,7 @@ typedef int boolean_t; #include #include #include -#if defined(__SVR4) || defined(__svr4__) || defined(__sgi) +#if defined(__SVR4) || defined(__svr4__) # include #endif #include @@ -82,7 +75,7 @@ typedef int boolean_t; #include #include # include -# if !defined(__hpux) && !defined(solaris) +# if !defined(solaris) # include # endif #include "ipsend.h" Modified: stable/12/contrib/ipfilter/ipsend/sock.c ============================================================================== --- stable/12/contrib/ipfilter/ipsend/sock.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/contrib/ipfilter/ipsend/sock.c Sun Aug 2 04:25:11 2020 (r363768) @@ -21,14 +21,8 @@ static const char rcsid[] = "@(#)$Id$"; */ typedef int boolean_t; #endif -#ifndef ultrix #include -#endif -#if (__FreeBSD_version >= 300000) # include -#else -# include -#endif # ifdef __NetBSD__ # include # endif @@ -38,10 +32,6 @@ typedef int boolean_t; # define _KERNEL # define KERNEL # endif -# ifdef ultrix -# undef LOCORE -# include -# endif # include # ifdef __FreeBSD__ # undef _WANT_FILE @@ -54,18 +44,14 @@ typedef int boolean_t; #include #include #include -#if !defined(ultrix) && !defined(hpux) && !defined(__osf__) # include -#endif #ifdef sun #include #include #endif -#if BSD >= 199103 #include #include #include -#endif #include #include #include @@ -143,128 +129,10 @@ int kmemcpy(buf, pos, n) struct nlist names[4] = { { "_proc" }, { "_nproc" }, -#ifdef ultrix - { "_u" }, -#else { NULL }, -#endif { NULL } }; -#if BSD < 199103 -static struct proc *getproc() -{ - struct proc *p; - pid_t pid = getpid(); - int siz, n; - - n = nlist(KERNEL, names); - if (n != 0) - { - fprintf(stderr, "nlist(%#x) == %d\n", names, n); - return NULL; - } - if (KMCPY(&nproc, names[1].n_value, sizeof(nproc)) == -1) - { - fprintf(stderr, "read nproc (%#x)\n", names[1].n_value); - return NULL; - } - siz = nproc * sizeof(struct proc); - if (KMCPY(&p, names[0].n_value, sizeof(p)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) proc\n", - names[0].n_value, &p, sizeof(p)); - return NULL; - } - proc = (struct proc *)malloc(siz); - if (KMCPY(proc, p, siz) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) proc\n", - p, proc, siz); - return NULL; - } - - p = proc; - - for (n = nproc; n; n--, p++) - if (p->p_pid == pid) - break; - if (!n) - return NULL; - - return p; -} - - -struct tcpcb *find_tcp(fd, ti) - int fd; - struct tcpiphdr *ti; -{ - struct tcpcb *t; - struct inpcb *i; - struct socket *s; - struct user *up; - struct proc *p; - struct file *f, **o; - - if (!(p = getproc())) - return NULL; - up = (struct user *)malloc(sizeof(*up)); -#ifndef ultrix - if (KMCPY(up, p->p_uarea, sizeof(*up)) == -1) - { - fprintf(stderr, "read(%#x,%#x) failed\n", p, p->p_uarea); - return NULL; - } -#else - if (KMCPY(up, names[2].n_value, sizeof(*up)) == -1) - { - fprintf(stderr, "read(%#x,%#x) failed\n", p, names[2].n_value); - return NULL; - } -#endif - - o = (struct file **)calloc(up->u_lastfile + 1, sizeof(*o)); - if (KMCPY(o, up->u_ofile, (up->u_lastfile + 1) * sizeof(*o)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - u_ofile - failed\n", - up->u_ofile, o, sizeof(*o)); - return NULL; - } - f = (struct file *)calloc(1, sizeof(*f)); - if (KMCPY(f, o[fd], sizeof(*f)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - o[fd] - failed\n", - up->u_ofile[fd], f, sizeof(*f)); - return NULL; - } - - s = (struct socket *)calloc(1, sizeof(*s)); - if (KMCPY(s, f->f_data, sizeof(*s)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - f_data - failed\n", - o[fd], s, sizeof(*s)); - return NULL; - } - - i = (struct inpcb *)calloc(1, sizeof(*i)); - if (KMCPY(i, s->so_pcb, sizeof(*i)) == -1) - { - fprintf(stderr, "kvm_read(%#x,%#x,%d) - so_pcb - failed\n", - s->so_pcb, i, sizeof(*i)); - return NULL; - } - - t = (struct tcpcb *)calloc(1, sizeof(*t)); - if (KMCPY(t, i->inp_ppcb, sizeof(*t)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - inp_ppcb - failed\n", - i->inp_ppcb, t, sizeof(*t)); - return NULL; - } - return (struct tcpcb *)i->inp_ppcb; -} -#else static struct kinfo_proc *getproc() { static struct kinfo_proc kp; @@ -304,7 +172,7 @@ struct tcpcb *find_tcp(tfd, ti) fd = (struct filedesc *)malloc(sizeof(*fd)); if (fd == NULL) return NULL; -#if defined( __FreeBSD_version) && __FreeBSD_version >= 500013 +#if defined( __FreeBSD_version) if (KMCPY(fd, p->ki_fd, sizeof(*fd)) == -1) { fprintf(stderr, "read(%#lx,%#lx) failed\n", @@ -381,7 +249,6 @@ finderror: free(t); return NULL; } -#endif /* BSD < 199301 */ int do_socket(dev, mtu, ti, gwip) char *dev; Modified: stable/12/libexec/rc/rc.d/ipfilter ============================================================================== --- stable/12/libexec/rc/rc.d/ipfilter Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/libexec/rc/rc.d/ipfilter Sun Aug 2 04:25:11 2020 (r363768) @@ -5,7 +5,7 @@ # PROVIDE: ipfilter # REQUIRE: FILESYSTEMS -# KEYWORD: nojail +# KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/libexec/rc/rc.d/ipmon ============================================================================== --- stable/12/libexec/rc/rc.d/ipmon Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/libexec/rc/rc.d/ipmon Sun Aug 2 04:25:11 2020 (r363768) @@ -6,7 +6,7 @@ # PROVIDE: ipmon # REQUIRE: FILESYSTEMS hostname sysctl ipfilter # BEFORE: SERVERS -# KEYWORD: nojail +# KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/libexec/rc/rc.d/ipnat ============================================================================== --- stable/12/libexec/rc/rc.d/ipnat Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/libexec/rc/rc.d/ipnat Sun Aug 2 04:25:11 2020 (r363768) @@ -5,7 +5,7 @@ # PROVIDE: ipnat # REQUIRE: ipfilter -# KEYWORD: nojail +# KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/libexec/rc/rc.d/ippool ============================================================================== --- stable/12/libexec/rc/rc.d/ippool Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/libexec/rc/rc.d/ippool Sun Aug 2 04:25:11 2020 (r363768) @@ -6,7 +6,7 @@ # PROVIDE: ippool # REQUIRE: FILESYSTEMS # BEFORE: ipfilter -# KEYWORD: nojail +# KEYWORD: nojailvnet . /etc/rc.subr Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Sun Aug 2 04:25:11 2020 (r363768) @@ -115,6 +115,8 @@ extern int opts; extern int blockreason; #endif /* _KERNEL */ +#define FASTROUTE_RECURSION + #define LBUMP(x) softc->x++ #define LBUMPD(x, y) do { softc->x.y++; DT(y); } while (0) @@ -1696,7 +1698,7 @@ ipf_pr_ipv4hdr(fin) fi->fi_p = p; fin->fin_crc = p; fi->fi_tos = ip->ip_tos; - fin->fin_id = ip->ip_id; + fin->fin_id = ntohs(ip->ip_id); off = ntohs(ip->ip_off); /* Get both TTL and protocol */ Modified: stable/12/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_frag.c Sat Aug 1 16:02:32 2020 (r363767) +++ stable/12/sys/contrib/ipfilter/netinet/ip_frag.c Sun Aug 2 04:25:11 2020 (r363768) @@ -404,6 +404,7 @@ ipfr_frag_new(softc, softf, fin, pass, table } } + memset(&frag, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; @@ -452,6 +453,7 @@ ipfr_frag_new(softc, softf, fin, pass, table FBUMPD(ifs_nomem); return NULL; } + memset(fran, 0, sizeof(*fran)); WRITE_ENTER(lock); @@ -489,6 +491,7 @@ ipfr_frag_new(softc, softf, fin, pass, table table[idx] = fra; bcopy((char *)&frag.ipfr_ifp, (char *)&fra->ipfr_ifp, IPFR_CMPSZ); fra->ipfr_v = fin->fin_v; + fra->ipfr_p = fin->fin_p; fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl; fra->ipfr_firstend = frag.ipfr_firstend; @@ -677,6 +680,7 @@ ipf_frag_lookup(softc, softf, fin, table * * build up a hash value to index the table with. */ + memset(&frag, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; From owner-svn-src-stable@freebsd.org Sun Aug 2 04:25:38 2020 Return-Path: Delivered-To: svn-src-stable@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 B39FA370DE0; Sun, 2 Aug 2020 04:25:38 +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 4BK7H64LnYz44Q1; Sun, 2 Aug 2020 04:25:38 +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 5E54E1E08F; Sun, 2 Aug 2020 04:25:38 +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 0724PcVv050209; Sun, 2 Aug 2020 04:25:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0724PaY2050201; Sun, 2 Aug 2020 04:25:36 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202008020425.0724PaY2050201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 2 Aug 2020 04:25:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363769 - in stable/11: contrib/ipfilter/iplang contrib/ipfilter/ipsend sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable/11: contrib/ipfilter/iplang contrib/ipfilter/ipsend sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 363769 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Aug 2020 04:25:38 -0000 Author: cy Date: Sun Aug 2 04:25:36 2020 New Revision: 363769 URL: https://svnweb.freebsd.org/changeset/base/363769 Log: MFC r363284-r363285, r363670 r363284: pfil_run_hooks() can be called recursively, so we have to define FASTROUTE_RECURSION in fil.c Submitted by: christos@NetBSD.org Reported by: christos@NetBSD.org Obtained from: NetBSD r1.31 r363285: Fix incorrect byte order in ipfstat -f output. - make sure frag is initialized to 0 - initialize ipfr_p field NetBSD PR: 55137 Submitted by: christos@NetBSD.org Reported by: christos@NetBSD.org Obtained from: NetBSD fil.c r1.32, ip_frag.c r1.8 r363670: Continued ipfilter #ifdef cleanup. The r343701 log entry contains a complete description. Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y stable/11/contrib/ipfilter/ipsend/arp.c stable/11/contrib/ipfilter/ipsend/ipresend.c stable/11/contrib/ipfilter/ipsend/ipsend.c stable/11/contrib/ipfilter/ipsend/iptest.c stable/11/contrib/ipfilter/ipsend/iptests.c stable/11/contrib/ipfilter/ipsend/sock.c stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_frag.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ipfilter/iplang/iplang_y.y ============================================================================== --- stable/11/contrib/ipfilter/iplang/iplang_y.y Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/iplang/iplang_y.y Sun Aug 2 04:25:36 2020 (r363769) @@ -45,11 +45,6 @@ #include "ipf.h" #include "iplang.h" -#if !defined(__NetBSD__) && (!defined(__FreeBSD_version) && \ - __FreeBSD_version < 400020) && (!SOLARIS || SOLARIS2 < 10) -extern struct ether_addr *ether_aton __P((char *)); -#endif - extern int opts; extern struct ipopt_names ionames[]; extern int state, state, lineNum, token; @@ -58,11 +53,7 @@ extern char yytext[]; extern FILE *yyin; int yylex __P((void)); #define YYDEBUG 1 -#if !defined(ultrix) && !defined(hpux) int yydebug = 1; -#else -extern int yydebug; -#endif iface_t *iflist = NULL, **iftail = &iflist; iface_t *cifp = NULL; Modified: stable/11/contrib/ipfilter/ipsend/arp.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/arp.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/arp.c Sun Aug 2 04:25:36 2020 (r363769) @@ -11,17 +11,13 @@ static const char rcsid[] = "@(#)$Id$"; #endif #include #include -#if !defined(ultrix) && !defined(hpux) && !defined(__hpux) && !defined(__osf__) && !defined(_AIX51) # include -#endif #include #include #include #include #include -#ifndef ultrix # include -#endif #include #include #include Modified: stable/11/contrib/ipfilter/ipsend/ipresend.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/ipresend.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/ipresend.c Sun Aug 2 04:25:36 2020 (r363769) @@ -38,15 +38,7 @@ int opts = 0; # ifdef sun char default_device[] = "le0"; # else -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "lan0"; -# endif -# endif # endif #else char default_device[] = DEFAULT_DEVICE; Modified: stable/11/contrib/ipfilter/ipsend/ipsend.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/ipsend.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/ipsend.c Sun Aug 2 04:25:36 2020 (r363769) @@ -33,15 +33,7 @@ extern void iplang __P((FILE *)); char options[68]; int opts; -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "le0"; -# endif /* __bsdi__ */ -# endif /* ultrix */ static void usage __P((char *)); Modified: stable/11/contrib/ipfilter/ipsend/iptest.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/iptest.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/iptest.c Sun Aug 2 04:25:36 2020 (r363769) @@ -34,15 +34,7 @@ char options[68]; # ifdef sun char default_device[] = "le0"; # else -# ifdef ultrix -char default_device[] = "ln0"; -# else -# ifdef __bsdi__ -char default_device[] = "ef0"; -# else char default_device[] = "lan0"; -# endif -# endif # endif static void usage __P((char *)); Modified: stable/11/contrib/ipfilter/ipsend/iptests.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/iptests.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/iptests.c Sun Aug 2 04:25:36 2020 (r363769) @@ -36,18 +36,13 @@ typedef int boolean_t; # endif # undef _KERNEL # undef KERNEL -#if !defined(solaris) && !defined(linux) && !defined(__sgi) +#if !defined(solaris) # include # include # include #endif -#if !defined(ultrix) && !defined(hpux) && !defined(linux) && \ - !defined(__sgi) && !defined(__osf__) && !defined(_AIX51) # include -#endif -#ifndef ultrix # include -#endif #if defined(solaris) # include #else @@ -57,11 +52,9 @@ typedef int boolean_t; #include #include #endif -#if BSD >= 199103 # include # include # include -#endif #include #include #include @@ -74,7 +67,7 @@ typedef int boolean_t; #include #include #include -#if defined(__SVR4) || defined(__svr4__) || defined(__sgi) +#if defined(__SVR4) || defined(__svr4__) # include #endif #include @@ -82,7 +75,7 @@ typedef int boolean_t; #include #include # include -# if !defined(__hpux) && !defined(solaris) +# if !defined(solaris) # include # endif #include "ipsend.h" Modified: stable/11/contrib/ipfilter/ipsend/sock.c ============================================================================== --- stable/11/contrib/ipfilter/ipsend/sock.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/contrib/ipfilter/ipsend/sock.c Sun Aug 2 04:25:36 2020 (r363769) @@ -21,14 +21,8 @@ static const char rcsid[] = "@(#)$Id$"; */ typedef int boolean_t; #endif -#ifndef ultrix #include -#endif -#if (__FreeBSD_version >= 300000) # include -#else -# include -#endif # ifdef __NetBSD__ # include # endif @@ -38,10 +32,6 @@ typedef int boolean_t; # define _KERNEL # define KERNEL # endif -# ifdef ultrix -# undef LOCORE -# include -# endif # include # ifdef __FreeBSD__ # undef _WANT_FILE @@ -54,18 +44,14 @@ typedef int boolean_t; #include #include #include -#if !defined(ultrix) && !defined(hpux) && !defined(__osf__) # include -#endif #ifdef sun #include #include #endif -#if BSD >= 199103 #include #include #include -#endif #include #include #include @@ -141,128 +127,10 @@ int kmemcpy(buf, pos, n) struct nlist names[4] = { { "_proc" }, { "_nproc" }, -#ifdef ultrix - { "_u" }, -#else { NULL }, -#endif { NULL } }; -#if BSD < 199103 -static struct proc *getproc() -{ - struct proc *p; - pid_t pid = getpid(); - int siz, n; - - n = nlist(KERNEL, names); - if (n != 0) - { - fprintf(stderr, "nlist(%#x) == %d\n", names, n); - return NULL; - } - if (KMCPY(&nproc, names[1].n_value, sizeof(nproc)) == -1) - { - fprintf(stderr, "read nproc (%#x)\n", names[1].n_value); - return NULL; - } - siz = nproc * sizeof(struct proc); - if (KMCPY(&p, names[0].n_value, sizeof(p)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) proc\n", - names[0].n_value, &p, sizeof(p)); - return NULL; - } - proc = (struct proc *)malloc(siz); - if (KMCPY(proc, p, siz) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) proc\n", - p, proc, siz); - return NULL; - } - - p = proc; - - for (n = nproc; n; n--, p++) - if (p->p_pid == pid) - break; - if (!n) - return NULL; - - return p; -} - - -struct tcpcb *find_tcp(fd, ti) - int fd; - struct tcpiphdr *ti; -{ - struct tcpcb *t; - struct inpcb *i; - struct socket *s; - struct user *up; - struct proc *p; - struct file *f, **o; - - if (!(p = getproc())) - return NULL; - up = (struct user *)malloc(sizeof(*up)); -#ifndef ultrix - if (KMCPY(up, p->p_uarea, sizeof(*up)) == -1) - { - fprintf(stderr, "read(%#x,%#x) failed\n", p, p->p_uarea); - return NULL; - } -#else - if (KMCPY(up, names[2].n_value, sizeof(*up)) == -1) - { - fprintf(stderr, "read(%#x,%#x) failed\n", p, names[2].n_value); - return NULL; - } -#endif - - o = (struct file **)calloc(up->u_lastfile + 1, sizeof(*o)); - if (KMCPY(o, up->u_ofile, (up->u_lastfile + 1) * sizeof(*o)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - u_ofile - failed\n", - up->u_ofile, o, sizeof(*o)); - return NULL; - } - f = (struct file *)calloc(1, sizeof(*f)); - if (KMCPY(f, o[fd], sizeof(*f)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - o[fd] - failed\n", - up->u_ofile[fd], f, sizeof(*f)); - return NULL; - } - - s = (struct socket *)calloc(1, sizeof(*s)); - if (KMCPY(s, f->f_data, sizeof(*s)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - f_data - failed\n", - o[fd], s, sizeof(*s)); - return NULL; - } - - i = (struct inpcb *)calloc(1, sizeof(*i)); - if (KMCPY(i, s->so_pcb, sizeof(*i)) == -1) - { - fprintf(stderr, "kvm_read(%#x,%#x,%d) - so_pcb - failed\n", - s->so_pcb, i, sizeof(*i)); - return NULL; - } - - t = (struct tcpcb *)calloc(1, sizeof(*t)); - if (KMCPY(t, i->inp_ppcb, sizeof(*t)) == -1) - { - fprintf(stderr, "read(%#x,%#x,%d) - inp_ppcb - failed\n", - i->inp_ppcb, t, sizeof(*t)); - return NULL; - } - return (struct tcpcb *)i->inp_ppcb; -} -#else static struct kinfo_proc *getproc() { static struct kinfo_proc kp; @@ -302,7 +170,7 @@ struct tcpcb *find_tcp(tfd, ti) fd = (struct filedesc *)malloc(sizeof(*fd)); if (fd == NULL) return NULL; -#if defined( __FreeBSD_version) && __FreeBSD_version >= 500013 +#if defined( __FreeBSD_version) if (KMCPY(fd, p->ki_fd, sizeof(*fd)) == -1) { fprintf(stderr, "read(%#lx,%#lx) failed\n", @@ -379,7 +247,6 @@ finderror: free(t); return NULL; } -#endif /* BSD < 199301 */ int do_socket(dev, mtu, ti, gwip) char *dev; Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Sun Aug 2 04:25:36 2020 (r363769) @@ -115,6 +115,8 @@ extern int opts; extern int blockreason; #endif /* _KERNEL */ +#define FASTROUTE_RECURSION + #define LBUMP(x) softc->x++ #define LBUMPD(x, y) do { softc->x.y++; DT(y); } while (0) @@ -1696,7 +1698,7 @@ ipf_pr_ipv4hdr(fin) fi->fi_p = p; fin->fin_crc = p; fi->fi_tos = ip->ip_tos; - fin->fin_id = ip->ip_id; + fin->fin_id = ntohs(ip->ip_id); off = ntohs(ip->ip_off); /* Get both TTL and protocol */ Modified: stable/11/sys/contrib/ipfilter/netinet/ip_frag.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_frag.c Sun Aug 2 04:25:11 2020 (r363768) +++ stable/11/sys/contrib/ipfilter/netinet/ip_frag.c Sun Aug 2 04:25:36 2020 (r363769) @@ -404,6 +404,7 @@ ipfr_frag_new(softc, softf, fin, pass, table } } + memset(&frag, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; @@ -452,6 +453,7 @@ ipfr_frag_new(softc, softf, fin, pass, table FBUMPD(ifs_nomem); return NULL; } + memset(fran, 0, sizeof(*fran)); WRITE_ENTER(lock); @@ -489,6 +491,7 @@ ipfr_frag_new(softc, softf, fin, pass, table table[idx] = fra; bcopy((char *)&frag.ipfr_ifp, (char *)&fra->ipfr_ifp, IPFR_CMPSZ); fra->ipfr_v = fin->fin_v; + fra->ipfr_p = fin->fin_p; fra->ipfr_ttl = softc->ipf_ticks + softf->ipfr_ttl; fra->ipfr_firstend = frag.ipfr_firstend; @@ -677,6 +680,7 @@ ipf_frag_lookup(softc, softf, fin, table * * build up a hash value to index the table with. */ + memset(&frag, 0, sizeof(frag)); frag.ipfr_v = fin->fin_v; idx = fin->fin_v; frag.ipfr_p = fin->fin_p; From owner-svn-src-stable@freebsd.org Mon Aug 3 01:00:20 2020 Return-Path: Delivered-To: svn-src-stable@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 B166B3ABEDD; Mon, 3 Aug 2020 01:00:20 +0000 (UTC) (envelope-from cperciva@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 4BKfgm4Jqbz485w; Mon, 3 Aug 2020 01:00:20 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 7781BC61B; Mon, 3 Aug 2020 01:00:20 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07310KTG011529; Mon, 3 Aug 2020 01:00:20 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07310K97011528; Mon, 3 Aug 2020 01:00:20 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <202008030100.07310K97011528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 3 Aug 2020 01:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363786 - stable/12/release/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: stable/12/release/tools X-SVN-Commit-Revision: 363786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 01:00:20 -0000 Author: cperciva Date: Mon Aug 3 01:00:20 2020 New Revision: 363786 URL: https://svnweb.freebsd.org/changeset/base/363786 Log: MFC r362791: Make EC2 AMIs use portsnap and freebsd-update mirrors hosted in AWS Modified: stable/12/release/tools/ec2.conf Directory Properties: stable/12/ (props changed) Modified: stable/12/release/tools/ec2.conf ============================================================================== --- stable/12/release/tools/ec2.conf Sun Aug 2 23:50:55 2020 (r363785) +++ stable/12/release/tools/ec2.conf Mon Aug 3 01:00:20 2020 (r363786) @@ -111,6 +111,12 @@ vm_extra_pre_umount() { 's/^#ChallengeResponseAuthentication yes/ChallengeResponseAuthentication no/' \ ${DESTDIR}/etc/ssh/sshd_config + # Use FreeBSD Update and Portsnap mirrors hosted in AWS + sed -i '' -e 's/update.FreeBSD.org/aws.update.FreeBSD.org/' \ + ${DESTDIR}/etc/freebsd-update.conf + sed -i '' -e 's/portsnap.FreeBSD.org/aws.portsnap.FreeBSD.org/' \ + ${DESTDIR}/etc/portsnap.conf + # Use the NTP service provided by Amazon sed -i '' -e 's/^pool/#pool/' \ -e '1,/^#server/s/^#server.*/server 169.254.169.123 iburst/' \ From owner-svn-src-stable@freebsd.org Mon Aug 3 06:10:14 2020 Return-Path: Delivered-To: svn-src-stable@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 9D47F37030A; Mon, 3 Aug 2020 06:10:14 +0000 (UTC) (envelope-from avg@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 4BKnYL3hM6z4MGw; Mon, 3 Aug 2020 06:10:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5ED4BF9F8; Mon, 3 Aug 2020 06:10:14 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0736AEUK003270; Mon, 3 Aug 2020 06:10:14 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0736AEFM003269; Mon, 3 Aug 2020 06:10:14 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008030610.0736AEFM003269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 3 Aug 2020 06:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363787 - stable/12/sys/arm/allwinner/clkng X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/arm/allwinner/clkng X-SVN-Commit-Revision: 363787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 06:10:14 -0000 Author: avg Date: Mon Aug 3 06:10:13 2020 New Revision: 363787 URL: https://svnweb.freebsd.org/changeset/base/363787 Log: MFC r363597: actually enable gate control for allwinner's r-ccu ir clock Modified: stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c ============================================================================== --- stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c Mon Aug 3 01:00:20 2020 (r363786) +++ stable/12/sys/arm/allwinner/clkng/ccu_sun8i_r.c Mon Aug 3 06:10:13 2020 (r363787) @@ -122,7 +122,7 @@ NM_CLK(r_ccu_ir_clk, 16, 2, 0, 0, /* M flags */ 24, 2, /* mux */ 31, /* gate */ - AW_CLK_HAS_MUX | AW_CLK_REPARENT); /* flags */ + AW_CLK_HAS_MUX | AW_CLK_REPARENT | AW_CLK_HAS_GATE);/* flags */ static const char *a83t_ir_parents[] = {"osc16M", "osc24M"}; static struct aw_clk_nm_def a83t_ir_clk = { From owner-svn-src-stable@freebsd.org Mon Aug 3 06:54:05 2020 Return-Path: Delivered-To: svn-src-stable@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 199A0370F99; Mon, 3 Aug 2020 06:54:05 +0000 (UTC) (envelope-from pstef@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 4BKpWw6w1Pz4P7c; Mon, 3 Aug 2020 06:54:04 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 D087410468; Mon, 3 Aug 2020 06:54:04 +0000 (UTC) (envelope-from pstef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0736s4RX033342; Mon, 3 Aug 2020 06:54:04 GMT (envelope-from pstef@FreeBSD.org) Received: (from pstef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0736s4jd033341; Mon, 3 Aug 2020 06:54:04 GMT (envelope-from pstef@FreeBSD.org) Message-Id: <202008030654.0736s4jd033341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pstef set sender to pstef@FreeBSD.org using -f From: Piotr Pawel Stefaniak Date: Mon, 3 Aug 2020 06:54:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363788 - stable/12/bin/sh X-SVN-Group: stable-12 X-SVN-Commit-Author: pstef X-SVN-Commit-Paths: stable/12/bin/sh X-SVN-Commit-Revision: 363788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 06:54:05 -0000 Author: pstef Date: Mon Aug 3 06:54:04 2020 New Revision: 363788 URL: https://svnweb.freebsd.org/changeset/base/363788 Log: MFC 363621: sh(1): print a newline when ^D quits sh Modified: stable/12/bin/sh/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/sh/main.c ============================================================================== --- stable/12/bin/sh/main.c Mon Aug 3 06:10:13 2020 (r363787) +++ stable/12/bin/sh/main.c Mon Aug 3 06:54:04 2020 (r363788) @@ -241,6 +241,10 @@ cmdloop(int top) } } popstackmark(&smark); + if (top && iflag) { + out2c('\n'); + flushout(out2); + } } From owner-svn-src-stable@freebsd.org Mon Aug 3 09:11:11 2020 Return-Path: Delivered-To: svn-src-stable@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 4D622373CEC; Mon, 3 Aug 2020 09:11:11 +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 4BKsZ71BRkz4Wtc; Mon, 3 Aug 2020 09:11:11 +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 0C5B811E4E; Mon, 3 Aug 2020 09:11:11 +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 0739BAOs017508; Mon, 3 Aug 2020 09:11:10 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0739BAmB017507; Mon, 3 Aug 2020 09:11:10 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008030911.0739BAmB017507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 3 Aug 2020 09:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363789 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 363789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 09:11:11 -0000 Author: hselasky Date: Mon Aug 3 09:11:10 2020 New Revision: 363789 URL: https://svnweb.freebsd.org/changeset/base/363789 Log: MFC r361549: Add overflow.h to the LinuxKPI. Only add check_add_overflow and check_mul_overflow as those are the only two needed function by DRM v5.3. Both gcc and clang have builtin to do this check so use them directly but throw an error if the compiler/code checker doesn't support this builtin. Sponsored-by: The FreeBSD Foundation Reviewed by: hselsasky Differential Revision: https://reviews.freebsd.org/D25015 Added: stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h - copied unchanged from r361549, head/sys/compat/linuxkpi/common/include/linux/overflow.h Modified: Directory Properties: stable/12/ (props changed) Copied: stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h (from r361549, head/sys/compat/linuxkpi/common/include/linux/overflow.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h Mon Aug 3 09:11:10 2020 (r363789, copy of r361549, head/sys/compat/linuxkpi/common/include/linux/overflow.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_OVERFLOW_H__ +#define __LINUX_OVERFLOW_H__ + +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + +#if __has_builtin(__builtin_add_overflow) +#define check_add_overflow(a, b, c) \ + __builtin_add_overflow(a, b, c) +#else +#error "Compiler does not support __builtin_add_overflow" +#endif + +#if __has_builtin(__builtin_mul_overflow) +#define check_mul_overflow(a, b, c) \ + __builtin_mul_overflow(a, b, c) +#else +#error "Compiler does not support __builtin_mul_overflow" +#endif + +#endif /* __LINUX_OVERFLOW_H__ */ From owner-svn-src-stable@freebsd.org Mon Aug 3 09:13:07 2020 Return-Path: Delivered-To: svn-src-stable@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 35F75373F8A; Mon, 3 Aug 2020 09:13:07 +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 4BKscM0dbGz4X0l; Mon, 3 Aug 2020 09:13:07 +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 ED46B1211E; Mon, 3 Aug 2020 09:13:06 +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 0739D6GQ020627; Mon, 3 Aug 2020 09:13:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0739D6NH020625; Mon, 3 Aug 2020 09:13:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008030913.0739D6NH020625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 3 Aug 2020 09:13:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363790 - in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 363790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 09:13:07 -0000 Author: hselasky Date: Mon Aug 3 09:13:06 2020 New Revision: 363790 URL: https://svnweb.freebsd.org/changeset/base/363790 Log: MFC r363077: Implement the array_size() function in the LinuxKPI. This function basically multiplies its two arguments and returns SIZE_MAX if the result overflows the size_t type. Else the product of the two arguments is returned. Bump the FreeBSD_version to mitigate issues with existing implementation of array_size() in drm-devel-kmod. Discussed with: manu@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h Mon Aug 3 09:11:10 2020 (r363789) +++ stable/12/sys/compat/linuxkpi/common/include/linux/overflow.h Mon Aug 3 09:13:06 2020 (r363790) @@ -31,6 +31,9 @@ #ifndef __LINUX_OVERFLOW_H__ #define __LINUX_OVERFLOW_H__ +#include +#include + #ifndef __has_builtin #define __has_builtin(x) 0 #endif @@ -45,6 +48,16 @@ #if __has_builtin(__builtin_mul_overflow) #define check_mul_overflow(a, b, c) \ __builtin_mul_overflow(a, b, c) + +static inline size_t +array_size(size_t x, size_t y) +{ + size_t retval; + + if (__builtin_mul_overflow(x, y, &retval)) + retval = SIZE_MAX; + return (retval); +} #else #error "Compiler does not support __builtin_mul_overflow" #endif Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Mon Aug 3 09:11:10 2020 (r363789) +++ stable/12/sys/sys/param.h Mon Aug 3 09:13:06 2020 (r363790) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201520 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201521 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Aug 3 09:14:16 2020 Return-Path: Delivered-To: svn-src-stable@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 C9D9A373F19; Mon, 3 Aug 2020 09:14:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BKsdh4xm3z4XSJ; Mon, 3 Aug 2020 09:14:16 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D8D812061; Mon, 3 Aug 2020 09:14:16 +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 0739EGTN020733; Mon, 3 Aug 2020 09:14:16 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0739EGgt020732; Mon, 3 Aug 2020 09:14:16 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008030914.0739EGgt020732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 3 Aug 2020 09:14:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363791 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 363791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 09:14:16 -0000 Author: hselasky Date: Mon Aug 3 09:14:16 2020 New Revision: 363791 URL: https://svnweb.freebsd.org/changeset/base/363791 Log: MFC r361549: Add overflow.h to the LinuxKPI. Only add check_add_overflow and check_mul_overflow as those are the only two needed function by DRM v5.3. Both gcc and clang have builtin to do this check so use them directly but throw an error if the compiler/code checker doesn't support this builtin. Sponsored-by: The FreeBSD Foundation Reviewed by: hselsasky Differential Revision: https://reviews.freebsd.org/D25015 Added: stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h - copied unchanged from r361549, head/sys/compat/linuxkpi/common/include/linux/overflow.h Modified: Directory Properties: stable/11/ (props changed) Copied: stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h (from r361549, head/sys/compat/linuxkpi/common/include/linux/overflow.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h Mon Aug 3 09:14:16 2020 (r363791, copy of r361549, head/sys/compat/linuxkpi/common/include/linux/overflow.h) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Emmanuel Vadot under sponsorship + * from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LINUX_OVERFLOW_H__ +#define __LINUX_OVERFLOW_H__ + +#ifndef __has_builtin +#define __has_builtin(x) 0 +#endif + +#if __has_builtin(__builtin_add_overflow) +#define check_add_overflow(a, b, c) \ + __builtin_add_overflow(a, b, c) +#else +#error "Compiler does not support __builtin_add_overflow" +#endif + +#if __has_builtin(__builtin_mul_overflow) +#define check_mul_overflow(a, b, c) \ + __builtin_mul_overflow(a, b, c) +#else +#error "Compiler does not support __builtin_mul_overflow" +#endif + +#endif /* __LINUX_OVERFLOW_H__ */ From owner-svn-src-stable@freebsd.org Mon Aug 3 09:15:39 2020 Return-Path: Delivered-To: svn-src-stable@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 837E2373FB0; Mon, 3 Aug 2020 09:15:39 +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 4BKsgH2pmlz4XQZ; Mon, 3 Aug 2020 09:15:39 +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 43EEC12062; Mon, 3 Aug 2020 09:15:39 +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 0739FdoG020862; Mon, 3 Aug 2020 09:15:39 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0739Fcqh020861; Mon, 3 Aug 2020 09:15:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008030915.0739Fcqh020861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 3 Aug 2020 09:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363792 - in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/11/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 363792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 09:15:39 -0000 Author: hselasky Date: Mon Aug 3 09:15:38 2020 New Revision: 363792 URL: https://svnweb.freebsd.org/changeset/base/363792 Log: MFC r363077: Implement the array_size() function in the LinuxKPI. This function basically multiplies its two arguments and returns SIZE_MAX if the result overflows the size_t type. Else the product of the two arguments is returned. Bump the FreeBSD_version to mitigate issues with existing implementation of array_size() in drm-devel-kmod. Discussed with: manu@ Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h stable/11/sys/sys/param.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h Mon Aug 3 09:14:16 2020 (r363791) +++ stable/11/sys/compat/linuxkpi/common/include/linux/overflow.h Mon Aug 3 09:15:38 2020 (r363792) @@ -31,6 +31,9 @@ #ifndef __LINUX_OVERFLOW_H__ #define __LINUX_OVERFLOW_H__ +#include +#include + #ifndef __has_builtin #define __has_builtin(x) 0 #endif @@ -45,6 +48,16 @@ #if __has_builtin(__builtin_mul_overflow) #define check_mul_overflow(a, b, c) \ __builtin_mul_overflow(a, b, c) + +static inline size_t +array_size(size_t x, size_t y) +{ + size_t retval; + + if (__builtin_mul_overflow(x, y, &retval)) + retval = SIZE_MAX; + return (retval); +} #else #error "Compiler does not support __builtin_mul_overflow" #endif Modified: stable/11/sys/sys/param.h ============================================================================== --- stable/11/sys/sys/param.h Mon Aug 3 09:14:16 2020 (r363791) +++ stable/11/sys/sys/param.h Mon Aug 3 09:15:38 2020 (r363792) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1104503 /* Master, propagated to newvers */ +#define __FreeBSD_version 1104504 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Mon Aug 3 09:19:00 2020 Return-Path: Delivered-To: svn-src-stable@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 54E923743A8; Mon, 3 Aug 2020 09:19:00 +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 4BKsl81cSJz4Xfm; Mon, 3 Aug 2020 09:19:00 +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 170401227D; Mon, 3 Aug 2020 09:19:00 +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 0739Ixgw021061; Mon, 3 Aug 2020 09:18:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0739Ixib021060; Mon, 3 Aug 2020 09:18:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008030918.0739Ixib021060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 3 Aug 2020 09:18:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363793 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 363793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 09:19:00 -0000 Author: hselasky Date: Mon Aug 3 09:18:59 2020 New Revision: 363793 URL: https://svnweb.freebsd.org/changeset/base/363793 Log: MFC r363078: Implement the bitmap_subset() function in the LinuxKPI. This function checks if the bitmap pointed to by the first argument is a subset of the bitmap pointed to by the second argument. The function returns one on success and zero on failure. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h Mon Aug 3 09:15:38 2020 (r363792) +++ stable/12/sys/compat/linuxkpi/common/include/linux/bitmap.h Mon Aug 3 09:18:59 2020 (r363793) @@ -243,6 +243,28 @@ bitmap_equal(const unsigned long *pa, return (1); } +static inline int +bitmap_subset(const unsigned long *pa, + const unsigned long *pb, unsigned size) +{ + const unsigned end = BIT_WORD(size); + const unsigned tail = size & (BITS_PER_LONG - 1); + unsigned i; + + for (i = 0; i != end; i++) { + if (pa[i] & ~pb[i]) + return (0); + } + + if (tail) { + const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + + if (pa[end] & ~pb[end] & mask) + return (0); + } + return (1); +} + static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, const unsigned int size) From owner-svn-src-stable@freebsd.org Mon Aug 3 09:20:33 2020 Return-Path: Delivered-To: svn-src-stable@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 528063743E6; Mon, 3 Aug 2020 09:20:33 +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 4BKsmx1bTxz4XvQ; Mon, 3 Aug 2020 09:20:33 +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 1A0B212068; Mon, 3 Aug 2020 09:20:33 +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 0739KWdO021224; Mon, 3 Aug 2020 09:20:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0739KWEk021223; Mon, 3 Aug 2020 09:20:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202008030920.0739KWEk021223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 3 Aug 2020 09:20:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363794 - stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 363794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 09:20:33 -0000 Author: hselasky Date: Mon Aug 3 09:20:32 2020 New Revision: 363794 URL: https://svnweb.freebsd.org/changeset/base/363794 Log: MFC r363078: Implement the bitmap_subset() function in the LinuxKPI. This function checks if the bitmap pointed to by the first argument is a subset of the bitmap pointed to by the second argument. The function returns one on success and zero on failure. Sponsored by: Mellanox Technologies Modified: stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h ============================================================================== --- stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h Mon Aug 3 09:18:59 2020 (r363793) +++ stable/11/sys/compat/linuxkpi/common/include/linux/bitmap.h Mon Aug 3 09:20:32 2020 (r363794) @@ -243,6 +243,28 @@ bitmap_equal(const unsigned long *pa, return (1); } +static inline int +bitmap_subset(const unsigned long *pa, + const unsigned long *pb, unsigned size) +{ + const unsigned end = BIT_WORD(size); + const unsigned tail = size & (BITS_PER_LONG - 1); + unsigned i; + + for (i = 0; i != end; i++) { + if (pa[i] & ~pb[i]) + return (0); + } + + if (tail) { + const unsigned long mask = BITMAP_LAST_WORD_MASK(tail); + + if (pa[end] & ~pb[end] & mask) + return (0); + } + return (1); +} + static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, const unsigned int size) From owner-svn-src-stable@freebsd.org Mon Aug 3 23:05:47 2020 Return-Path: Delivered-To: svn-src-stable@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 EED423A9364; Mon, 3 Aug 2020 23:05:47 +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 4BLD5765HYz4VMG; Mon, 3 Aug 2020 23:05:47 +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 B43151BB74; Mon, 3 Aug 2020 23:05:47 +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 073N5lIs038843; Mon, 3 Aug 2020 23:05:47 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 073N5lIs038842; Mon, 3 Aug 2020 23:05:47 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008032305.073N5lIs038842@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 3 Aug 2020 23:05:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363814 - stable/12/sys/dev/cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe X-SVN-Commit-Revision: 363814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 23:05:48 -0000 Author: markj Date: Mon Aug 3 23:05:47 2020 New Revision: 363814 URL: https://svnweb.freebsd.org/changeset/base/363814 Log: MFC r363623: cxgbe(4): Stop checking for failures from malloc(M_WAITOK). Modified: stable/12/sys/dev/cxgbe/t4_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Mon Aug 3 22:13:02 2020 (r363813) +++ stable/12/sys/dev/cxgbe/t4_main.c Mon Aug 3 23:05:47 2020 (r363814) @@ -9667,10 +9667,6 @@ load_fw(struct adapter *sc, struct t4_data *fw) } fw_data = malloc(fw->len, M_CXGBE, M_WAITOK); - if (fw_data == NULL) { - rc = ENOMEM; - goto done; - } rc = copyin(fw->data, fw_data, fw->len); if (rc == 0) @@ -9699,10 +9695,6 @@ load_cfg(struct adapter *sc, struct t4_data *cfg) } cfg_data = malloc(cfg->len, M_CXGBE, M_WAITOK); - if (cfg_data == NULL) { - rc = ENOMEM; - goto done; - } rc = copyin(cfg->data, cfg_data, cfg->len); if (rc == 0) @@ -9748,10 +9740,6 @@ load_boot(struct adapter *sc, struct t4_bootrom *br) } br_data = malloc(br->len, M_CXGBE, M_WAITOK); - if (br_data == NULL) { - rc = ENOMEM; - goto done; - } rc = copyin(br->data, br_data, br->len); if (rc == 0) @@ -9780,10 +9768,6 @@ load_bootcfg(struct adapter *sc, struct t4_data *bc) } bc_data = malloc(bc->len, M_CXGBE, M_WAITOK); - if (bc_data == NULL) { - rc = ENOMEM; - goto done; - } rc = copyin(bc->data, bc_data, bc->len); if (rc == 0) From owner-svn-src-stable@freebsd.org Mon Aug 3 23:06:34 2020 Return-Path: Delivered-To: svn-src-stable@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 D78F03A936D; Mon, 3 Aug 2020 23:06: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 4BLD625Rpmz4VNJ; Mon, 3 Aug 2020 23:06: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 9E8461BE2D; Mon, 3 Aug 2020 23:06: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 073N6Ycw038927; Mon, 3 Aug 2020 23:06:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 073N6XbV038920; Mon, 3 Aug 2020 23:06:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008032306.073N6XbV038920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 3 Aug 2020 23:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363815 - in stable/12/sys/dev: mpr mps X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys/dev: mpr mps X-SVN-Commit-Revision: 363815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Aug 2020 23:06:34 -0000 Author: markj Date: Mon Aug 3 23:06:33 2020 New Revision: 363815 URL: https://svnweb.freebsd.org/changeset/base/363815 Log: MFC r363608: mpr(4), mps(4): Stop checking for failures from malloc(M_WAITOK). Modified: stable/12/sys/dev/mpr/mpr.c stable/12/sys/dev/mpr/mpr_sas.c stable/12/sys/dev/mpr/mpr_user.c stable/12/sys/dev/mps/mps.c stable/12/sys/dev/mps/mps_sas.c stable/12/sys/dev/mps/mps_user.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mpr/mpr.c ============================================================================== --- stable/12/sys/dev/mpr/mpr.c Mon Aug 3 23:05:47 2020 (r363814) +++ stable/12/sys/dev/mpr/mpr.c Mon Aug 3 23:06:33 2020 (r363815) @@ -1562,10 +1562,6 @@ mpr_alloc_requests(struct mpr_softc *sc) */ sc->commands = malloc(sizeof(struct mpr_command) * sc->num_reqs, M_MPR, M_WAITOK | M_ZERO); - if (!sc->commands) { - mpr_dprint(sc, MPR_ERROR, "Cannot allocate command memory\n"); - return (ENOMEM); - } for (i = 1; i < sc->num_reqs; i++) { cm = &sc->commands[i]; cm->cm_req = sc->req_frames + i * sc->reqframesz; @@ -2716,11 +2712,6 @@ mpr_register_events(struct mpr_softc *sc, uint8_t *mas int error = 0; eh = malloc(sizeof(struct mpr_event_handle), M_MPR, M_WAITOK|M_ZERO); - if (!eh) { - mpr_dprint(sc, MPR_EVENT|MPR_ERROR, - "Cannot allocate event memory\n"); - return (ENOMEM); - } eh->callback = cb; eh->data = data; TAILQ_INSERT_TAIL(&sc->event_list, eh, eh_list); Modified: stable/12/sys/dev/mpr/mpr_sas.c ============================================================================== --- stable/12/sys/dev/mpr/mpr_sas.c Mon Aug 3 23:05:47 2020 (r363814) +++ stable/12/sys/dev/mpr/mpr_sas.c Mon Aug 3 23:06:33 2020 (r363815) @@ -755,11 +755,6 @@ mpr_attach_sas(struct mpr_softc *sc) mpr_dprint(sc, MPR_INIT, "%s entered\n", __func__); sassc = malloc(sizeof(struct mprsas_softc), M_MPR, M_WAITOK|M_ZERO); - if (!sassc) { - mpr_dprint(sc, MPR_INIT|MPR_ERROR, - "Cannot allocate SAS subsystem memory\n"); - return (ENOMEM); - } /* * XXX MaxTargets could change during a reinit. Since we don't @@ -770,12 +765,6 @@ mpr_attach_sas(struct mpr_softc *sc) sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes; sassc->targets = malloc(sizeof(struct mprsas_target) * sassc->maxtargets, M_MPR, M_WAITOK|M_ZERO); - if (!sassc->targets) { - mpr_dprint(sc, MPR_INIT|MPR_ERROR, - "Cannot allocate SAS target memory\n"); - free(sassc, M_MPR); - return (ENOMEM); - } sc->sassc = sassc; sassc->sc = sc; @@ -3960,8 +3949,4 @@ mprsas_realloc_targets(struct mpr_softc *sc, int maxta sassc->targets = malloc(sizeof(struct mprsas_target) * maxtargets, M_MPR, M_WAITOK|M_ZERO); - if (!sassc->targets) { - panic("%s failed to alloc targets with error %d\n", - __func__, ENOMEM); - } } Modified: stable/12/sys/dev/mpr/mpr_user.c ============================================================================== --- stable/12/sys/dev/mpr/mpr_user.c Mon Aug 3 23:05:47 2020 (r363814) +++ stable/12/sys/dev/mpr/mpr_user.c Mon Aug 3 23:06:33 2020 (r363815) @@ -1533,13 +1533,6 @@ mpr_diag_register(struct mpr_softc *sc, mpr_fw_diag_re bzero(sc->fw_diag_buffer, buffer_size); ctx = malloc(sizeof(*ctx), M_MPR, M_WAITOK | M_ZERO); - if (ctx == NULL) { - device_printf(sc->mpr_dev, "%s: context malloc failed\n", - __func__); - *return_code = MPR_FW_DIAG_ERROR_NO_BUFFER; - status = MPR_DIAG_FAILURE; - goto bailout; - } ctx->addr = &sc->fw_diag_busaddr; ctx->buffer_dmat = sc->fw_diag_dmat; ctx->buffer_dmamap = sc->fw_diag_map; Modified: stable/12/sys/dev/mps/mps.c ============================================================================== --- stable/12/sys/dev/mps/mps.c Mon Aug 3 23:05:47 2020 (r363814) +++ stable/12/sys/dev/mps/mps.c Mon Aug 3 23:06:33 2020 (r363815) @@ -1513,10 +1513,6 @@ mps_alloc_requests(struct mps_softc *sc) */ sc->commands = malloc(sizeof(struct mps_command) * sc->num_reqs, M_MPT2, M_WAITOK | M_ZERO); - if(!sc->commands) { - mps_dprint(sc, MPS_ERROR, "Cannot allocate command memory\n"); - return (ENOMEM); - } for (i = 1; i < sc->num_reqs; i++) { cm = &sc->commands[i]; cm->cm_req = sc->req_frames + i * sc->reqframesz; @@ -2584,10 +2580,6 @@ mps_register_events(struct mps_softc *sc, u32 *mask, int error = 0; eh = malloc(sizeof(struct mps_event_handle), M_MPT2, M_WAITOK|M_ZERO); - if(!eh) { - mps_dprint(sc, MPS_ERROR, "Cannot allocate event memory\n"); - return (ENOMEM); - } eh->callback = cb; eh->data = data; TAILQ_INSERT_TAIL(&sc->event_list, eh, eh_list); Modified: stable/12/sys/dev/mps/mps_sas.c ============================================================================== --- stable/12/sys/dev/mps/mps_sas.c Mon Aug 3 23:05:47 2020 (r363814) +++ stable/12/sys/dev/mps/mps_sas.c Mon Aug 3 23:06:33 2020 (r363815) @@ -738,11 +738,6 @@ mps_attach_sas(struct mps_softc *sc) mps_dprint(sc, MPS_INIT, "%s entered\n", __func__); sassc = malloc(sizeof(struct mpssas_softc), M_MPT2, M_WAITOK|M_ZERO); - if(!sassc) { - mps_dprint(sc, MPS_INIT|MPS_ERROR, - "Cannot allocate SAS controller memory\n"); - return (ENOMEM); - } /* * XXX MaxTargets could change during a reinit. Since we don't @@ -753,12 +748,6 @@ mps_attach_sas(struct mps_softc *sc) sassc->maxtargets = sc->facts->MaxTargets + sc->facts->MaxVolumes; sassc->targets = malloc(sizeof(struct mpssas_target) * sassc->maxtargets, M_MPT2, M_WAITOK|M_ZERO); - if(!sassc->targets) { - mps_dprint(sc, MPS_INIT|MPS_ERROR, - "Cannot allocate SAS target memory\n"); - free(sassc, M_MPT2); - return (ENOMEM); - } sc->sassc = sassc; sassc->sc = sc; @@ -3671,8 +3660,4 @@ mpssas_realloc_targets(struct mps_softc *sc, int maxta sassc->targets = malloc(sizeof(struct mpssas_target) * maxtargets, M_MPT2, M_WAITOK|M_ZERO); - if (!sassc->targets) { - panic("%s failed to alloc targets with error %d\n", - __func__, ENOMEM); - } } Modified: stable/12/sys/dev/mps/mps_user.c ============================================================================== --- stable/12/sys/dev/mps/mps_user.c Mon Aug 3 23:05:47 2020 (r363814) +++ stable/12/sys/dev/mps/mps_user.c Mon Aug 3 23:06:33 2020 (r363815) @@ -1436,13 +1436,6 @@ mps_diag_register(struct mps_softc *sc, mps_fw_diag_re bzero(sc->fw_diag_buffer, buffer_size); ctx = malloc(sizeof(*ctx), M_MPSUSER, M_WAITOK | M_ZERO); - if (ctx == NULL) { - device_printf(sc->mps_dev, "%s: context malloc failed\n", - __func__); - *return_code = MPS_FW_DIAG_ERROR_NO_BUFFER; - status = MPS_DIAG_FAILURE; - goto bailout; - } ctx->addr = &sc->fw_diag_busaddr; ctx->buffer_dmat = sc->fw_diag_dmat; ctx->buffer_dmamap = sc->fw_diag_map; From owner-svn-src-stable@freebsd.org Tue Aug 4 00:28:06 2020 Return-Path: Delivered-To: svn-src-stable@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 D6C063AB28F; Tue, 4 Aug 2020 00:28:06 +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 4BLFw65Pg1z4ZN9; Tue, 4 Aug 2020 00:28:06 +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 9CDBD1CE8A; Tue, 4 Aug 2020 00:28:06 +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 0740S60o088808; Tue, 4 Aug 2020 00:28:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0740S6QJ088807; Tue, 4 Aug 2020 00:28:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008040028.0740S6QJ088807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Aug 2020 00:28:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363816 - stable/12/bin/ps X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/bin/ps X-SVN-Commit-Revision: 363816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 00:28:06 -0000 Author: markj Date: Tue Aug 4 00:28:06 2020 New Revision: 363816 URL: https://svnweb.freebsd.org/changeset/base/363816 Log: MFC r363649: ps(1): Fix formatting of the "command" field for kernel threads. Modified: stable/12/bin/ps/ps.c Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/ps/ps.c ============================================================================== --- stable/12/bin/ps/ps.c Mon Aug 3 23:06:33 2020 (r363815) +++ stable/12/bin/ps/ps.c Tue Aug 4 00:28:06 2020 (r363816) @@ -1264,6 +1264,7 @@ fmt(char **(*fn)(kvm_t *, const struct kinfo_proc *, i static void saveuser(KINFO *ki) { + char tdname[COMMLEN + 1]; char *argsp; if (ki->ki_p->ki_flag & P_INMEM) { @@ -1280,12 +1281,14 @@ saveuser(KINFO *ki) * save arguments if needed */ if (needcomm) { - if (ki->ki_p->ki_stat == SZOMB) + if (ki->ki_p->ki_stat == SZOMB) { ki->ki_args = strdup(""); - else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL)) + } else if (UREADOK(ki) || (ki->ki_p->ki_args != NULL)) { + (void)snprintf(tdname, sizeof(tdname), "%s%s", + ki->ki_p->ki_tdname, ki->ki_p->ki_moretdname); ki->ki_args = fmt(kvm_getargv, ki, - ki->ki_p->ki_comm, ki->ki_p->ki_tdname, MAXCOMLEN); - else { + ki->ki_p->ki_comm, tdname, COMMLEN * 2 + 1); + } else { asprintf(&argsp, "(%s)", ki->ki_p->ki_comm); ki->ki_args = argsp; } From owner-svn-src-stable@freebsd.org Tue Aug 4 02:31:53 2020 Return-Path: Delivered-To: svn-src-stable@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 962C03AE806; Tue, 4 Aug 2020 02:31:53 +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 4BLJfx3WkXz3Sf3; Tue, 4 Aug 2020 02:31:53 +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 5C1AA1E41F; Tue, 4 Aug 2020 02:31:53 +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 0742VrVg068325; Tue, 4 Aug 2020 02:31:53 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0742VrvG068324; Tue, 4 Aug 2020 02:31:53 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008040231.0742VrvG068324@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 4 Aug 2020 02:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363822 - stable/12/usr.sbin/ctld X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/usr.sbin/ctld X-SVN-Commit-Revision: 363822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 02:31:53 -0000 Author: mav Date: Tue Aug 4 02:31:52 2020 New Revision: 363822 URL: https://svnweb.freebsd.org/changeset/base/363822 Log: MFC r363656: When modifying LUN pass "special" options too. Before switching to nvlists CTL merged previous and new options, so any options not passed just kept previous value. Now CTL completely replaces them, so we must pass everything still relevant. Modified: stable/12/usr.sbin/ctld/kernel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/ctld/kernel.c ============================================================================== --- stable/12/usr.sbin/ctld/kernel.c Tue Aug 4 02:20:15 2020 (r363821) +++ stable/12/usr.sbin/ctld/kernel.c Tue Aug 4 02:31:52 2020 (r363822) @@ -776,6 +776,30 @@ kernel_lun_modify(struct lun *lun) req.reqdata.modify.lun_id = lun->l_ctl_lun; req.reqdata.modify.lun_size_bytes = lun->l_size; + if (lun->l_path != NULL) { + o = option_find(&lun->l_options, "file"); + if (o != NULL) { + option_set(o, lun->l_path); + } else { + o = option_new(&lun->l_options, "file", lun->l_path); + assert(o != NULL); + } + } + + o = option_find(&lun->l_options, "ctld_name"); + if (o != NULL) { + option_set(o, lun->l_name); + } else { + o = option_new(&lun->l_options, "ctld_name", lun->l_name); + assert(o != NULL); + } + + o = option_find(&lun->l_options, "scsiname"); + if (o == NULL && lun->l_scsiname != NULL) { + o = option_new(&lun->l_options, "scsiname", lun->l_scsiname); + assert(o != NULL); + } + if (!TAILQ_EMPTY(&lun->l_options)) { req.args_nvl = nvlist_create(0); if (req.args_nvl == NULL) { From owner-svn-src-stable@freebsd.org Tue Aug 4 12:04:48 2020 Return-Path: Delivered-To: svn-src-stable@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 7FF1937226F; Tue, 4 Aug 2020 12:04:48 +0000 (UTC) (envelope-from freqlabs@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 4BLYN02pGCz4H0h; Tue, 4 Aug 2020 12:04:48 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 4373524F58; Tue, 4 Aug 2020 12:04:48 +0000 (UTC) (envelope-from freqlabs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 074C4m6G020736; Tue, 4 Aug 2020 12:04:48 GMT (envelope-from freqlabs@FreeBSD.org) Received: (from freqlabs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074C4lCp020734; Tue, 4 Aug 2020 12:04:47 GMT (envelope-from freqlabs@FreeBSD.org) Message-Id: <202008041204.074C4lCp020734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: freqlabs set sender to freqlabs@FreeBSD.org using -f From: Ryan Moeller Date: Tue, 4 Aug 2020 12:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363831 - in stable/12: lib/libpmc sys/dev/hwpmc X-SVN-Group: stable-12 X-SVN-Commit-Author: freqlabs X-SVN-Commit-Paths: in stable/12: lib/libpmc sys/dev/hwpmc X-SVN-Commit-Revision: 363831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 12:04:48 -0000 Author: freqlabs Date: Tue Aug 4 12:04:47 2020 New Revision: 363831 URL: https://svnweb.freebsd.org/changeset/base/363831 Log: MFC r363630: libpmc: Use known pmc_cpuid buffer size Use the existing PMC_CPUID_LEN to size pmc_cpuid in the kernel and various buffers for reading it in libpmc. This avoids some extra syscalls and malloc/frees. While in here, use strlcpy to copy a user-provided cpuid string instead of memcpy, to make sure we terminate the buffer. Reviewed by: mav Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D25679 Modified: stable/12/lib/libpmc/libpmc_pmu_util.c stable/12/sys/dev/hwpmc/hwpmc_mod.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libpmc/libpmc_pmu_util.c ============================================================================== --- stable/12/lib/libpmc/libpmc_pmu_util.c Tue Aug 4 11:13:13 2020 (r363830) +++ stable/12/lib/libpmc/libpmc_pmu_util.c Tue Aug 4 12:04:47 2020 (r363831) @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -89,20 +90,13 @@ static struct pmu_alias pmu_amd_alias_table[] = { static pmu_mfr_t pmu_events_mfr(void) { - char *buf; - size_t s; + char buf[PMC_CPUID_LEN]; + size_t s = sizeof(buf); pmu_mfr_t mfr; - if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, &s, + if (sysctlbyname("kern.hwpmc.cpuid", buf, &s, (void *)NULL, 0) == -1) return (PMU_INVALID); - if ((buf = malloc(s + 1)) == NULL) - return (PMU_INVALID); - if (sysctlbyname("kern.hwpmc.cpuid", buf, &s, - (void *)NULL, 0) == -1) { - free(buf); - return (PMU_INVALID); - } if (strcasestr(buf, "AuthenticAMD") != NULL || strcasestr(buf, "HygonGenuine") != NULL) mfr = PMU_AMD; @@ -110,7 +104,6 @@ pmu_events_mfr(void) mfr = PMU_INTEL; else mfr = PMU_INVALID; - free(buf); return (mfr); } @@ -169,17 +162,14 @@ pmu_events_map_get(const char *cpuid) { regex_t re; regmatch_t pmatch[1]; - size_t s; - char buf[64]; + char buf[PMC_CPUID_LEN]; + size_t s = sizeof(buf); int match; const struct pmu_events_map *pme; if (cpuid != NULL) { - memcpy(buf, cpuid, 64); + strlcpy(buf, cpuid, s); } else { - if (sysctlbyname("kern.hwpmc.cpuid", (void *)NULL, &s, - (void *)NULL, 0) == -1) - return (NULL); if (sysctlbyname("kern.hwpmc.cpuid", buf, &s, (void *)NULL, 0) == -1) return (NULL); Modified: stable/12/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/12/sys/dev/hwpmc/hwpmc_mod.c Tue Aug 4 11:13:13 2020 (r363830) +++ stable/12/sys/dev/hwpmc/hwpmc_mod.c Tue Aug 4 12:04:47 2020 (r363831) @@ -304,7 +304,7 @@ static int pmc_callchaindepth = PMC_CALLCHAIN_DEPTH; SYSCTL_INT(_kern_hwpmc, OID_AUTO, callchaindepth, CTLFLAG_RDTUN, &pmc_callchaindepth, 0, "depth of call chain records"); -char pmc_cpuid[64]; +char pmc_cpuid[PMC_CPUID_LEN]; SYSCTL_STRING(_kern_hwpmc, OID_AUTO, cpuid, CTLFLAG_RD, pmc_cpuid, 0, "cpu version string"); #ifdef HWPMC_DEBUG From owner-svn-src-stable@freebsd.org Tue Aug 4 12:42:57 2020 Return-Path: Delivered-To: svn-src-stable@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 39855372EE7; Tue, 4 Aug 2020 12:42:57 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BLZD10knNz4JbG; Tue, 4 Aug 2020 12:42:57 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F08F825871; Tue, 4 Aug 2020 12:42:56 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 074CguhT044970; Tue, 4 Aug 2020 12:42:56 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074Cgtmn044962; Tue, 4 Aug 2020 12:42:55 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202008041242.074Cgtmn044962@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Tue, 4 Aug 2020 12:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363832 - in stable/12/sys: compat/freebsd32 kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: in stable/12/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 363832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 12:42:57 -0000 Author: kaktus Date: Tue Aug 4 12:42:55 2020 New Revision: 363832 URL: https://svnweb.freebsd.org/changeset/base/363832 Log: MFC kernel part of r351729 Add sysctlbyname system call The two syscalls that exists in head but not in stable/12 are marked as UNIMPL to keep the __sysctlbyname syscall number the same (570). Userland part to be commited in about a week time. Requested by: mjg Discussed with: kib Modified: stable/12/sys/compat/freebsd32/freebsd32_misc.c stable/12/sys/compat/freebsd32/syscalls.master stable/12/sys/kern/capabilities.conf stable/12/sys/kern/kern_sysctl.c stable/12/sys/kern/syscalls.master stable/12/sys/sys/param.h stable/12/sys/sys/syscall.mk stable/12/sys/sys/sysctl.h Modified: stable/12/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_misc.c Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/compat/freebsd32/freebsd32_misc.c Tue Aug 4 12:42:55 2020 (r363832) @@ -2279,6 +2279,32 @@ freebsd32___sysctl(struct thread *td, struct freebsd32 } int +freebsd32___sysctlbyname(struct thread *td, + struct freebsd32___sysctlbyname_args *uap) +{ + size_t oldlen, rv; + int error; + uint32_t tmp; + + if (uap->oldlenp != NULL) { + error = fueword32(uap->oldlenp, &tmp); + oldlen = tmp; + } else { + error = oldlen = 0; + } + if (error != 0) + return (EFAULT); + error = kern___sysctlbyname(td, uap->name, uap->namelen, uap->old, + &oldlen, uap->new, uap->newlen, &rv, SCTL_MASK32, 1); + if (error != 0) + return (error); + if (uap->oldlenp != NULL) + error = suword32(uap->oldlenp, rv); + + return (error); +} + +int freebsd32_jail(struct thread *td, struct freebsd32_jail_args *uap) { uint32_t version; Modified: stable/12/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/12/sys/compat/freebsd32/syscalls.master Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/compat/freebsd32/syscalls.master Tue Aug 4 12:42:55 2020 (r363832) @@ -1127,5 +1127,10 @@ const char *to); } 567 AUE_NULL NOPROTO { int fhreadlink( struct fhandle *fhp, char *buf, \ size_t bufsize); } +568 AUE_NULL UNIMPL funlinkat +569 AUE_NULL UNIMPL copy_file_range +570 AUE_SYSCTL STD { int freebsd32___sysctlbyname(const char *name, \ + size_t namelen, void *old, uint32_t *oldlenp, \ + void *new, size_t newlen); } ; vim: syntax=off Modified: stable/12/sys/kern/capabilities.conf ============================================================================== --- stable/12/sys/kern/capabilities.conf Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/kern/capabilities.conf Tue Aug 4 12:42:55 2020 (r363832) @@ -63,6 +63,7 @@ __mac_set_proc ## proxying daemon in userspace. ## __sysctl +__sysctlbyname ## ## Allow umtx operations as these are scoped by address space. Modified: stable/12/sys/kern/kern_sysctl.c ============================================================================== --- stable/12/sys/kern/kern_sysctl.c Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/kern/kern_sysctl.c Tue Aug 4 12:42:55 2020 (r363832) @@ -2102,6 +2102,68 @@ sys___sysctl(struct thread *td, struct sysctl_args *ua return (error); } +int +kern___sysctlbyname(struct thread *td, const char *oname, size_t namelen, + void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval, + int flags, bool inkernel) +{ + int oid[CTL_MAXNAME]; + char namebuf[16]; + char *name; + size_t oidlen; + int error; + + if (namelen > MAXPATHLEN || namelen == 0) + return (EINVAL); + name = namebuf; + if (namelen > sizeof(namebuf)) + name = malloc(namelen, M_SYSCTL, M_WAITOK); + error = copyin(oname, name, namelen); + if (error != 0) + goto out; + + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; + oidlen = sizeof(oid); + error = kernel_sysctl(td, oid, 2, oid, &oidlen, (void *)name, namelen, + retval, flags); + if (error != 0) + goto out; + error = userland_sysctl(td, oid, *retval / sizeof(int), old, oldlenp, + inkernel, new, newlen, retval, flags); + +out: + if (namelen > sizeof(namebuf)) + free(name, M_SYSCTL); + return (error); +} + +#ifndef _SYS_SYSPROTO_H_ +struct __sysctlbyname_args { + const char *name; + size_t namelen; + void *old; + size_t *oldlenp; + void *new; + size_t newlen; +}; +#endif +int +sys___sysctlbyname(struct thread *td, struct __sysctlbyname_args *uap) +{ + size_t rv; + int error; + + error = kern___sysctlbyname(td, uap->name, uap->namelen, uap->old, + uap->oldlenp, uap->new, uap->newlen, &rv, 0, 0); + if (error != 0) + return (error); + if (uap->oldlenp != NULL) + error = copyout(&rv, uap->oldlenp, sizeof(rv)); + + return (error); +} + /* * This is used from various compatibility syscalls too. That's why name * must be in kernel space. Modified: stable/12/sys/kern/syscalls.master ============================================================================== --- stable/12/sys/kern/syscalls.master Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/kern/syscalls.master Tue Aug 4 12:42:55 2020 (r363832) @@ -1368,6 +1368,19 @@ size_t bufsize \ ); \ } +568 AUE_NULL UNIMPL funlinkat +569 AUE_NULL UNIMPL copy_file_range +570 AUE_SYSCTL STD { \ + int __sysctlbyname( \ + _In_reads_(namelen) const char *name, \ + size_t namelen, \ + _Out_writes_bytes_opt_(*oldlenp) void *old, \ + _Inout_opt_ size_t *oldlenp, \ + _In_reads_bytes_opt_(newlen) void *new, \ + size_t newlen \ + ); \ + } + ; Please copy any additions and changes to the following compatability tables: ; sys/compat/freebsd32/syscalls.master Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/sys/param.h Tue Aug 4 12:42:55 2020 (r363832) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1201521 /* Master, propagated to newvers */ +#define __FreeBSD_version 1201522 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/12/sys/sys/syscall.mk ============================================================================== --- stable/12/sys/sys/syscall.mk Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/sys/syscall.mk Tue Aug 4 12:42:55 2020 (r363832) @@ -408,4 +408,5 @@ MIASM = \ getfhat.o \ fhlink.o \ fhlinkat.o \ - fhreadlink.o + fhreadlink.o \ + __sysctlbyname.o Modified: stable/12/sys/sys/sysctl.h ============================================================================== --- stable/12/sys/sys/sysctl.h Tue Aug 4 12:04:47 2020 (r363831) +++ stable/12/sys/sys/sysctl.h Tue Aug 4 12:42:55 2020 (r363832) @@ -1102,6 +1102,9 @@ int sysctl_find_oid(int *name, u_int namelen, struct s void sysctl_wlock(void); void sysctl_wunlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); +int kern___sysctlbyname(struct thread *td, const char *name, + size_t namelen, void *old, size_t *oldlenp, void *new, + size_t newlen, size_t *retval, int flags, bool inkernel); struct sbuf; struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int, From owner-svn-src-stable@freebsd.org Tue Aug 4 12:44:50 2020 Return-Path: Delivered-To: svn-src-stable@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 86DAC372EF8; Tue, 4 Aug 2020 12:44:50 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BLZGB30Rmz4K49; Tue, 4 Aug 2020 12:44:50 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45D34259C0; Tue, 4 Aug 2020 12:44:50 +0000 (UTC) (envelope-from kaktus@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 074Cio2U045164; Tue, 4 Aug 2020 12:44:50 GMT (envelope-from kaktus@FreeBSD.org) Received: (from kaktus@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074CimgQ045155; Tue, 4 Aug 2020 12:44:48 GMT (envelope-from kaktus@FreeBSD.org) Message-Id: <202008041244.074CimgQ045155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kaktus set sender to kaktus@FreeBSD.org using -f From: Pawel Biernacki Date: Tue, 4 Aug 2020 12:44:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363833 - in stable/12/sys: compat/freebsd32 kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kaktus X-SVN-Commit-Paths: in stable/12/sys: compat/freebsd32 kern sys X-SVN-Commit-Revision: 363833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 12:44:50 -0000 Author: kaktus Date: Tue Aug 4 12:44:47 2020 New Revision: 363833 URL: https://svnweb.freebsd.org/changeset/base/363833 Log: regen Modified: stable/12/sys/compat/freebsd32/freebsd32_proto.h stable/12/sys/compat/freebsd32/freebsd32_syscall.h stable/12/sys/compat/freebsd32/freebsd32_syscalls.c stable/12/sys/compat/freebsd32/freebsd32_sysent.c stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c stable/12/sys/kern/init_sysent.c stable/12/sys/kern/syscalls.c stable/12/sys/kern/systrace_args.c stable/12/sys/sys/syscall.h stable/12/sys/sys/sysproto.h Modified: stable/12/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_proto.h Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/compat/freebsd32/freebsd32_proto.h Tue Aug 4 12:44:47 2020 (r363833) @@ -728,6 +728,14 @@ struct freebsd32_cpuset_setdomain_args { char mask_l_[PADL_(domainset_t *)]; domainset_t * mask; char mask_r_[PADR_(domainset_t *)]; char policy_l_[PADL_(int)]; int policy; char policy_r_[PADR_(int)]; }; +struct freebsd32___sysctlbyname_args { + char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; + char namelen_l_[PADL_(size_t)]; size_t namelen; char namelen_r_[PADR_(size_t)]; + char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)]; + char oldlenp_l_[PADL_(uint32_t *)]; uint32_t * oldlenp; char oldlenp_r_[PADR_(uint32_t *)]; + char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; + char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; +}; #if !defined(PAD64_REQUIRED) && (defined(__powerpc__) || defined(__mips__)) #define PAD64_REQUIRED #endif @@ -865,6 +873,7 @@ int freebsd32_mknodat(struct thread *, struct freebsd3 int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *); int freebsd32_cpuset_getdomain(struct thread *, struct freebsd32_cpuset_getdomain_args *); int freebsd32_cpuset_setdomain(struct thread *, struct freebsd32_cpuset_setdomain_args *); +int freebsd32___sysctlbyname(struct thread *, struct freebsd32___sysctlbyname_args *); #ifdef COMPAT_43 @@ -1419,6 +1428,7 @@ int freebsd11_freebsd32_fstatat(struct thread *, struc #define FREEBSD32_SYS_AUE_freebsd32_kevent AUE_KEVENT #define FREEBSD32_SYS_AUE_freebsd32_cpuset_getdomain AUE_NULL #define FREEBSD32_SYS_AUE_freebsd32_cpuset_setdomain AUE_NULL +#define FREEBSD32_SYS_AUE_freebsd32___sysctlbyname AUE_SYSCTL #undef PAD_ #undef PADL_ Modified: stable/12/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_syscall.h Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/compat/freebsd32/freebsd32_syscall.h Tue Aug 4 12:44:47 2020 (r363833) @@ -494,4 +494,5 @@ #define FREEBSD32_SYS_fhlink 565 #define FREEBSD32_SYS_fhlinkat 566 #define FREEBSD32_SYS_fhreadlink 567 -#define FREEBSD32_SYS_MAXSYSCALL 568 +#define FREEBSD32_SYS_freebsd32___sysctlbyname 570 +#define FREEBSD32_SYS_MAXSYSCALL 571 Modified: stable/12/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_syscalls.c Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/compat/freebsd32/freebsd32_syscalls.c Tue Aug 4 12:44:47 2020 (r363833) @@ -604,4 +604,7 @@ const char *freebsd32_syscallnames[] = { "fhlink", /* 565 = fhlink */ "fhlinkat", /* 566 = fhlinkat */ "fhreadlink", /* 567 = fhreadlink */ + "#568", /* 568 = funlinkat */ + "#569", /* 569 = copy_file_range */ + "freebsd32___sysctlbyname", /* 570 = freebsd32___sysctlbyname */ }; Modified: stable/12/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_sysent.c Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/compat/freebsd32/freebsd32_sysent.c Tue Aug 4 12:44:47 2020 (r363833) @@ -651,4 +651,7 @@ struct sysent freebsd32_sysent[] = { { AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 565 = fhlink */ { AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 566 = fhlinkat */ { AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 567 = fhreadlink */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 568 = funlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 569 = copy_file_range */ + { AS(freebsd32___sysctlbyname_args), (sy_call_t *)freebsd32___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 570 = freebsd32___sysctlbyname */ }; Modified: stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c Tue Aug 4 12:44:47 2020 (r363833) @@ -3310,6 +3310,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } + /* freebsd32___sysctlbyname */ + case 570: { + struct freebsd32___sysctlbyname_args *p = params; + uarg[0] = (intptr_t) p->name; /* const char * */ + uarg[1] = p->namelen; /* size_t */ + uarg[2] = (intptr_t) p->old; /* void * */ + uarg[3] = (intptr_t) p->oldlenp; /* uint32_t * */ + uarg[4] = (intptr_t) p->new; /* void * */ + uarg[5] = p->newlen; /* size_t */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -8905,6 +8917,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* freebsd32___sysctlbyname */ + case 570: + switch(ndx) { + case 0: + p = "userland const char *"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "userland void *"; + break; + case 3: + p = "userland uint32_t *"; + break; + case 4: + p = "userland void *"; + break; + case 5: + p = "size_t"; + break; + default: + break; + }; + break; default: break; }; @@ -10771,6 +10808,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* fhreadlink */ case 567: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* freebsd32___sysctlbyname */ + case 570: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: stable/12/sys/kern/init_sysent.c ============================================================================== --- stable/12/sys/kern/init_sysent.c Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/kern/init_sysent.c Tue Aug 4 12:44:47 2020 (r363833) @@ -617,4 +617,7 @@ struct sysent sysent[] = { { AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 565 = fhlink */ { AS(fhlinkat_args), (sy_call_t *)sys_fhlinkat, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 566 = fhlinkat */ { AS(fhreadlink_args), (sy_call_t *)sys_fhreadlink, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 567 = fhreadlink */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 568 = funlinkat */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 569 = copy_file_range */ + { AS(__sysctlbyname_args), (sy_call_t *)sys___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 570 = __sysctlbyname */ }; Modified: stable/12/sys/kern/syscalls.c ============================================================================== --- stable/12/sys/kern/syscalls.c Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/kern/syscalls.c Tue Aug 4 12:44:47 2020 (r363833) @@ -574,4 +574,7 @@ const char *syscallnames[] = { "fhlink", /* 565 = fhlink */ "fhlinkat", /* 566 = fhlinkat */ "fhreadlink", /* 567 = fhreadlink */ + "#568", /* 568 = funlinkat */ + "#569", /* 569 = copy_file_range */ + "__sysctlbyname", /* 570 = __sysctlbyname */ }; Modified: stable/12/sys/kern/systrace_args.c ============================================================================== --- stable/12/sys/kern/systrace_args.c Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/kern/systrace_args.c Tue Aug 4 12:44:47 2020 (r363833) @@ -3302,6 +3302,18 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 3; break; } + /* __sysctlbyname */ + case 570: { + struct __sysctlbyname_args *p = params; + uarg[0] = (intptr_t) p->name; /* const char * */ + uarg[1] = p->namelen; /* size_t */ + uarg[2] = (intptr_t) p->old; /* void * */ + uarg[3] = (intptr_t) p->oldlenp; /* size_t * */ + uarg[4] = (intptr_t) p->new; /* void * */ + uarg[5] = p->newlen; /* size_t */ + *n_args = 6; + break; + } default: *n_args = 0; break; @@ -8810,6 +8822,31 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* __sysctlbyname */ + case 570: + switch(ndx) { + case 0: + p = "userland const char *"; + break; + case 1: + p = "size_t"; + break; + case 2: + p = "userland void *"; + break; + case 3: + p = "userland size_t *"; + break; + case 4: + p = "userland void *"; + break; + case 5: + p = "size_t"; + break; + default: + break; + }; + break; default: break; }; @@ -10703,6 +10740,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* fhreadlink */ case 567: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* __sysctlbyname */ + case 570: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: stable/12/sys/sys/syscall.h ============================================================================== --- stable/12/sys/sys/syscall.h Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/sys/syscall.h Tue Aug 4 12:44:47 2020 (r363833) @@ -503,4 +503,5 @@ #define SYS_fhlink 565 #define SYS_fhlinkat 566 #define SYS_fhreadlink 567 -#define SYS_MAXSYSCALL 568 +#define SYS___sysctlbyname 570 +#define SYS_MAXSYSCALL 571 Modified: stable/12/sys/sys/sysproto.h ============================================================================== --- stable/12/sys/sys/sysproto.h Tue Aug 4 12:42:55 2020 (r363832) +++ stable/12/sys/sys/sysproto.h Tue Aug 4 12:44:47 2020 (r363833) @@ -1790,6 +1790,14 @@ struct fhreadlink_args { char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; char bufsize_l_[PADL_(size_t)]; size_t bufsize; char bufsize_r_[PADR_(size_t)]; }; +struct __sysctlbyname_args { + char name_l_[PADL_(const char *)]; const char * name; char name_r_[PADR_(const char *)]; + char namelen_l_[PADL_(size_t)]; size_t namelen; char namelen_r_[PADR_(size_t)]; + char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)]; + char oldlenp_l_[PADL_(size_t *)]; size_t * oldlenp; char oldlenp_r_[PADR_(size_t *)]; + char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; + char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2174,6 +2182,7 @@ int sys_getfhat(struct thread *, struct getfhat_args * int sys_fhlink(struct thread *, struct fhlink_args *); int sys_fhlinkat(struct thread *, struct fhlinkat_args *); int sys_fhreadlink(struct thread *, struct fhreadlink_args *); +int sys___sysctlbyname(struct thread *, struct __sysctlbyname_args *); #ifdef COMPAT_43 @@ -3075,6 +3084,7 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_fhlink AUE_NULL #define SYS_AUE_fhlinkat AUE_NULL #define SYS_AUE_fhreadlink AUE_NULL +#define SYS_AUE___sysctlbyname AUE_SYSCTL #undef PAD_ #undef PADL_ From owner-svn-src-stable@freebsd.org Tue Aug 4 15:48:13 2020 Return-Path: Delivered-To: svn-src-stable@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 EBCD0377AA4; Tue, 4 Aug 2020 15:48:13 +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 4BLfKn6Ndsz4W8Q; Tue, 4 Aug 2020 15:48:13 +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 A5E1A278B8; Tue, 4 Aug 2020 15:48:13 +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 074FmDxP056209; Tue, 4 Aug 2020 15:48:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074FmCUp056205; Tue, 4 Aug 2020 15:48:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008041548.074FmCUp056205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Aug 2020 15:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363844 - in stable/12/sys: dev/vmware/vmxnet3 net X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: dev/vmware/vmxnet3 net X-SVN-Commit-Revision: 363844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 15:48:14 -0000 Author: markj Date: Tue Aug 4 15:48:12 2020 New Revision: 363844 URL: https://svnweb.freebsd.org/changeset/base/363844 Log: MFC r358996 (by pkelsey): Fix iflib zero-length fragment handling MFC r358997 (by pkelsey): Remove freelist contiguous-indexes assertion from rxd_frag_to_sd() MFC r358998 (by pkelsey): Allow iflib drivers to specify the buffer size used for each receive queue MFC r358999 (by pkelsey): Remove refill budget from iflib MFC r359000 (by pkelsey): Fix if_vmx receive checksum offload bug and harden against the device skipping receive descriptors MFC r359001 (by pkelsey): Adjust if_vmx default receive parameters for better out-of-box performance MFC r359002 (by pkelsey): Remove extraneous code from iflib MFC r359029 (by pkelsey): Restore power-of-2 queue count constraint from r290948 Tested by: marcus, mav Modified: stable/12/sys/dev/vmware/vmxnet3/if_vmx.c stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h stable/12/sys/net/iflib.c stable/12/sys/net/iflib.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- stable/12/sys/dev/vmware/vmxnet3/if_vmx.c Tue Aug 4 15:27:32 2020 (r363843) +++ stable/12/sys/dev/vmware/vmxnet3/if_vmx.c Tue Aug 4 15:48:12 2020 (r363844) @@ -321,6 +321,13 @@ vmxnet3_register(device_t dev) } static int +trunc_powerof2(int val) +{ + + return (1U << (fls(val) - 1)); +} + +static int vmxnet3_attach_pre(if_ctx_t ctx) { device_t dev; @@ -349,12 +356,16 @@ vmxnet3_attach_pre(if_ctx_t ctx) /* If 0, the iflib tunable was not set, so set to the default */ if (scctx->isc_nrxqsets == 0) scctx->isc_nrxqsets = VMXNET3_DEF_RX_QUEUES; + scctx->isc_nrxqsets = trunc_powerof2(scctx->isc_nrxqsets); scctx->isc_nrxqsets_max = min(VMXNET3_MAX_RX_QUEUES, mp_ncpus); + scctx->isc_nrxqsets_max = trunc_powerof2(scctx->isc_nrxqsets_max); /* If 0, the iflib tunable was not set, so set to the default */ if (scctx->isc_ntxqsets == 0) scctx->isc_ntxqsets = VMXNET3_DEF_TX_QUEUES; + scctx->isc_ntxqsets = trunc_powerof2(scctx->isc_ntxqsets); scctx->isc_ntxqsets_max = min(VMXNET3_MAX_TX_QUEUES, mp_ncpus); + scctx->isc_ntxqsets_max = trunc_powerof2(scctx->isc_ntxqsets_max); /* * Enforce that the transmit completion queue descriptor count is @@ -381,6 +392,12 @@ vmxnet3_attach_pre(if_ctx_t ctx) scctx->isc_rxqsizes[2] = sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[2]; + /* + * Initialize the max frame size and descriptor queue buffer + * sizes. + */ + vmxnet3_mtu_set(ctx, if_getmtu(sc->vmx_ifp)); + scctx->isc_rss_table_size = UPT1_RSS_MAX_IND_TABLE_SIZE; /* Map PCI BARs */ @@ -1494,6 +1511,7 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) int cqidx; uint16_t total_len; uint8_t nfrags; + uint8_t i; uint8_t flid; sc = vsc; @@ -1517,6 +1535,7 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) KASSERT(rxcd->sop && rxcd->eop, ("%s: zero-length packet without both sop and eop set", __func__)); + rxc->vxcr_zero_length++; if (++cqidx == rxc->vxcr_ndesc) { cqidx = 0; rxc->vxcr_gen ^= 1; @@ -1572,31 +1591,6 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) } } - /* VLAN */ - if (rxcd->vlan) { - ri->iri_flags |= M_VLANTAG; - ri->iri_vtag = rxcd->vtag; - } - - /* Checksum offload */ - if (!rxcd->no_csum) { - uint32_t csum_flags = 0; - - if (rxcd->ipv4) { - csum_flags |= CSUM_IP_CHECKED; - if (rxcd->ipcsum_ok) - csum_flags |= CSUM_IP_VALID; - } - if (!rxcd->fragment && (rxcd->tcp || rxcd->udp)) { - csum_flags |= CSUM_L4_CALC; - if (rxcd->csum_ok) { - csum_flags |= CSUM_L4_VALID; - ri->iri_csum_data = 0xffff; - } - } - ri->iri_csum_flags = csum_flags; - } - /* * The queue numbering scheme used for rxcd->qid is as follows: * - All of the command ring 0s are numbered [0, nrxqsets - 1] @@ -1632,6 +1626,46 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t ri) ri->iri_nfrags = nfrags; ri->iri_len = total_len; + /* + * If there's an error, the last descriptor in the packet will + * have the error indicator set. In this case, set all + * fragment lengths to zero. This will cause iflib to discard + * the packet, but process all associated descriptors through + * the refill mechanism. + */ + if (__predict_false(rxcd->error)) { + rxc->vxcr_pkt_errors++; + for (i = 0; i < nfrags; i++) { + frag = &ri->iri_frags[i]; + frag->irf_len = 0; + } + } else { + /* Checksum offload information is in the last descriptor. */ + if (!rxcd->no_csum) { + uint32_t csum_flags = 0; + + if (rxcd->ipv4) { + csum_flags |= CSUM_IP_CHECKED; + if (rxcd->ipcsum_ok) + csum_flags |= CSUM_IP_VALID; + } + if (!rxcd->fragment && (rxcd->tcp || rxcd->udp)) { + csum_flags |= CSUM_L4_CALC; + if (rxcd->csum_ok) { + csum_flags |= CSUM_L4_VALID; + ri->iri_csum_data = 0xffff; + } + } + ri->iri_csum_flags = csum_flags; + } + + /* VLAN information is in the last descriptor. */ + if (rxcd->vlan) { + ri->iri_flags |= M_VLANTAG; + ri->iri_vtag = rxcd->vtag; + } + } + return (0); } @@ -1645,14 +1679,13 @@ vmxnet3_isc_rxd_refill(void *vsc, if_rxd_update_t iru) uint64_t *paddrs; int count; int len; - int pidx; + int idx; int i; uint8_t flid; uint8_t btype; count = iru->iru_count; len = iru->iru_buf_size; - pidx = iru->iru_pidx; flid = iru->iru_flidx; paddrs = iru->iru_paddrs; @@ -1666,17 +1699,32 @@ vmxnet3_isc_rxd_refill(void *vsc, if_rxd_update_t iru) * command ring 1 is filled with BTYPE_BODY descriptors. */ btype = (flid == 0) ? VMXNET3_BTYPE_HEAD : VMXNET3_BTYPE_BODY; - for (i = 0; i < count; i++) { - rxd[pidx].addr = paddrs[i]; - rxd[pidx].len = len; - rxd[pidx].btype = btype; - rxd[pidx].gen = rxr->vxrxr_gen; + /* + * The refill entries from iflib will advance monotonically, + * but the refilled descriptors may not be contiguous due to + * earlier skipping of descriptors by the device. The refill + * entries from iflib need an entire state update, while the + * descriptors previously skipped by the device only need to + * have their generation numbers updated. + */ + idx = rxr->vxrxr_refill_start; + i = 0; + do { + if (idx == iru->iru_idxs[i]) { + rxd[idx].addr = paddrs[i]; + rxd[idx].len = len; + rxd[idx].btype = btype; + i++; + } else + rxr->vxrxr_desc_skips++; + rxd[idx].gen = rxr->vxrxr_gen; - if (++pidx == rxr->vxrxr_ndesc) { - pidx = 0; + if (++idx == rxr->vxrxr_ndesc) { + idx = 0; rxr->vxrxr_gen ^= 1; } - } + } while (i != count); + rxr->vxrxr_refill_start = idx; } static void @@ -1825,6 +1873,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet for (i = 0; i < sc->vmx_sctx->isc_nrxqs - 1; i++) { rxr = &rxq->vxrxq_cmd_ring[i]; rxr->vxrxr_gen = VMXNET3_INIT_GEN; + rxr->vxrxr_desc_skips = 0; + rxr->vxrxr_refill_start = 0; /* * iflib has zeroed out the descriptor array during the * prior attach or stop @@ -1834,6 +1884,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet for (/**/; i < VMXNET3_RXRINGS_PERQ; i++) { rxr = &rxq->vxrxq_cmd_ring[i]; rxr->vxrxr_gen = 0; + rxr->vxrxr_desc_skips = 0; + rxr->vxrxr_refill_start = 0; bzero(rxr->vxrxr_rxd, rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); } @@ -1841,6 +1893,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct vmxnet rxc = &rxq->vxrxq_comp_ring; rxc->vxcr_next = 0; rxc->vxcr_gen = VMXNET3_INIT_GEN; + rxc->vxcr_zero_length = 0; + rxc->vxcr_pkt_errors = 0; /* * iflib has zeroed out the descriptor array during the prior attach * or stop @@ -1906,14 +1960,9 @@ static void vmxnet3_init(if_ctx_t ctx) { struct vmxnet3_softc *sc; - if_softc_ctx_t scctx; sc = iflib_get_softc(ctx); - scctx = sc->vmx_scctx; - scctx->isc_max_frame_size = if_getmtu(iflib_get_ifp(ctx)) + - ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; - /* Use the current MAC address. */ bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); vmxnet3_set_lladdr(sc); @@ -1938,11 +1987,37 @@ vmxnet3_multi_set(if_ctx_t ctx) static int vmxnet3_mtu_set(if_ctx_t ctx, uint32_t mtu) { + struct vmxnet3_softc *sc; + if_softc_ctx_t scctx; + sc = iflib_get_softc(ctx); + scctx = sc->vmx_scctx; + if (mtu > VMXNET3_TX_MAXSIZE - (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN)) return (EINVAL); + /* + * Update the max frame size so that the rx mbuf size is + * chosen based on the new mtu during the interface init that + * will occur after this routine returns. + */ + scctx->isc_max_frame_size = mtu + + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; + /* RX completion queue - n/a */ + scctx->isc_rxd_buf_size[0] = 0; + /* + * For header-type descriptors (used for first segment of + * packet), let iflib determine the buffer size based on the + * max frame size. + */ + scctx->isc_rxd_buf_size[1] = 0; + /* + * For body-type descriptors (used for jumbo frames and LRO), + * always use page-sized buffers. + */ + scctx->isc_rxd_buf_size[2] = MJUMPAGESIZE; + return (0); } @@ -2288,14 +2363,22 @@ vmxnet3_setup_debug_sysctl(struct vmxnet3_softc *sc, &rxq->vxrxq_cmd_ring[0].vxrxr_ndesc, 0, ""); SYSCTL_ADD_INT(ctx, list, OID_AUTO, "cmd0_gen", CTLFLAG_RD, &rxq->vxrxq_cmd_ring[0].vxrxr_gen, 0, ""); + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "cmd0_desc_skips", CTLFLAG_RD, + &rxq->vxrxq_cmd_ring[0].vxrxr_desc_skips, 0, ""); SYSCTL_ADD_UINT(ctx, list, OID_AUTO, "cmd1_ndesc", CTLFLAG_RD, &rxq->vxrxq_cmd_ring[1].vxrxr_ndesc, 0, ""); SYSCTL_ADD_INT(ctx, list, OID_AUTO, "cmd1_gen", CTLFLAG_RD, &rxq->vxrxq_cmd_ring[1].vxrxr_gen, 0, ""); + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "cmd1_desc_skips", CTLFLAG_RD, + &rxq->vxrxq_cmd_ring[1].vxrxr_desc_skips, 0, ""); SYSCTL_ADD_UINT(ctx, list, OID_AUTO, "comp_ndesc", CTLFLAG_RD, &rxq->vxrxq_comp_ring.vxcr_ndesc, 0,""); SYSCTL_ADD_INT(ctx, list, OID_AUTO, "comp_gen", CTLFLAG_RD, &rxq->vxrxq_comp_ring.vxcr_gen, 0, ""); + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "comp_zero_length", CTLFLAG_RD, + &rxq->vxrxq_comp_ring.vxcr_zero_length, 0, ""); + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "comp_pkt_errors", CTLFLAG_RD, + &rxq->vxrxq_comp_ring.vxcr_pkt_errors, 0, ""); } } Modified: stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h ============================================================================== --- stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h Tue Aug 4 15:27:32 2020 (r363843) +++ stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h Tue Aug 4 15:48:12 2020 (r363844) @@ -41,7 +41,7 @@ struct vmxnet3_softc; #define VMXNET3_MAX_TX_NDESC 4096 #define VMXNET3_MIN_TX_NDESC 32 #define VMXNET3_MASK_TX_NDESC 0x1F -#define VMXNET3_DEF_RX_NDESC 256 +#define VMXNET3_DEF_RX_NDESC 512 #define VMXNET3_MAX_RX_NDESC 2048 #define VMXNET3_MIN_RX_NDESC 32 #define VMXNET3_MASK_RX_NDESC 0x1F @@ -63,6 +63,8 @@ struct vmxnet3_rxring { u_int vxrxr_ndesc; int vxrxr_gen; bus_addr_t vxrxr_paddr; + uint64_t vxrxr_desc_skips; + uint16_t vxrxr_refill_start; }; struct vmxnet3_comp_ring { @@ -78,6 +80,8 @@ struct vmxnet3_comp_ring { u_int vxcr_ndesc; int vxcr_gen; bus_addr_t vxcr_paddr; + uint64_t vxcr_zero_length; + uint64_t vxcr_pkt_errors; }; struct vmxnet3_txqueue { Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Tue Aug 4 15:27:32 2020 (r363843) +++ stable/12/sys/net/iflib.c Tue Aug 4 15:48:12 2020 (r363844) @@ -453,7 +453,6 @@ typedef struct if_rxsd { caddr_t *ifsd_cl; struct mbuf **ifsd_m; iflib_fl_t ifsd_fl; - qidx_t ifsd_cidx; } *if_rxsd_t; /* multiple of word size */ @@ -713,6 +712,7 @@ static int iflib_altq_if_transmit(if_t ifp, struct mbu static int iflib_register(if_ctx_t); static void iflib_deregister(if_ctx_t); static void iflib_unregister_vlan_handlers(if_ctx_t ctx); +static uint16_t iflib_get_mbuf_size_for(unsigned int size); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); static void iflib_add_device_sysctl_post(if_ctx_t ctx); @@ -2130,7 +2130,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun } static __inline uint8_t -__iflib_fl_refill_lt(if_ctx_t ctx, iflib_fl_t fl, int max) +__iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) { /* we avoid allowing pidx to catch up with cidx as it confuses ixl */ int32_t reclaimable = fl->ifl_size - fl->ifl_credits - 1; @@ -2142,7 +2142,7 @@ __iflib_fl_refill_lt(if_ctx_t ctx, iflib_fl_t fl, int MPASS(reclaimable == delta); if (reclaimable > 0) - return (_iflib_fl_refill(ctx, fl, min(max, reclaimable))); + return (_iflib_fl_refill(ctx, fl, reclaimable)); return (0); } @@ -2213,6 +2213,8 @@ iflib_fl_setup(iflib_fl_t fl) { iflib_rxq_t rxq = fl->ifl_rxq; if_ctx_t ctx = rxq->ifr_ctx; + if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; + int qidx; bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1); /* @@ -2221,7 +2223,16 @@ iflib_fl_setup(iflib_fl_t fl) iflib_fl_bufs_free(fl); /* Now replenish the mbufs */ MPASS(fl->ifl_credits == 0); - fl->ifl_buf_size = ctx->ifc_rx_mbuf_sz; + qidx = rxq->ifr_fl_offset + fl->ifl_id; + if (scctx->isc_rxd_buf_size[qidx] != 0) + fl->ifl_buf_size = scctx->isc_rxd_buf_size[qidx]; + else + fl->ifl_buf_size = ctx->ifc_rx_mbuf_sz; + /* + * ifl_buf_size may be a driver-supplied value, so pull it up + * to the selected mbuf size. + */ + fl->ifl_buf_size = iflib_get_mbuf_size_for(fl->ifl_buf_size); if (fl->ifl_buf_size > ctx->ifc_max_fl_buf_size) ctx->ifc_max_fl_buf_size = fl->ifl_buf_size; fl->ifl_cltype = m_gettype(fl->ifl_buf_size); @@ -2353,6 +2364,16 @@ iflib_timer(void *arg) STATE_UNLOCK(ctx); } +static uint16_t +iflib_get_mbuf_size_for(unsigned int size) +{ + + if (size <= MCLBYTES) + return (MCLBYTES); + else + return (MJUMPAGESIZE); +} + static void iflib_calc_rx_mbuf_sz(if_ctx_t ctx) { @@ -2362,10 +2383,8 @@ iflib_calc_rx_mbuf_sz(if_ctx_t ctx) * XXX don't set the max_frame_size to larger * than the hardware can handle */ - if (sctx->isc_max_frame_size <= MCLBYTES) - ctx->ifc_rx_mbuf_sz = MCLBYTES; - else - ctx->ifc_rx_mbuf_sz = MJUMPAGESIZE; + ctx->ifc_rx_mbuf_sz = + iflib_get_mbuf_size_for(sctx->isc_max_frame_size); } uint32_t @@ -2578,7 +2597,6 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int cidx = irf->irf_idx; fl = &rxq->ifr_fl[flid]; sd->ifsd_fl = fl; - sd->ifsd_cidx = cidx; sd->ifsd_m = &fl->ifl_sds.ifsd_m[cidx]; sd->ifsd_cl = &fl->ifl_sds.ifsd_cl[cidx]; fl->ifl_credits--; @@ -2590,12 +2608,10 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); prefetch(&fl->ifl_sds.ifsd_map[next]); map = fl->ifl_sds.ifsd_map[cidx]; - next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); - /* not valid assert if bxe really does SGE from non-contiguous elements */ - MPASS(fl->ifl_cidx == cidx); bus_dmamap_sync(fl->ifl_buf_tag, map, BUS_DMASYNC_POSTREAD); - if (unload) + + if (unload && irf->irf_len != 0) bus_dmamap_unload(fl->ifl_buf_tag, map); fl->ifl_cidx = (fl->ifl_cidx + 1) & (fl->ifl_size-1); if (__predict_false(fl->ifl_cidx == 0)) @@ -2667,6 +2683,7 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) /* should I merge this back in now that the two paths are basically duplicated? */ if (ri->iri_nfrags == 1 && + ri->iri_frags[0].irf_len != 0 && ri->iri_frags[0].irf_len <= MIN(IFLIB_RX_COPY_THRESH, MHLEN)) { rxd_frag_to_sd(rxq, &ri->iri_frags[0], FALSE, &sd); m = *sd.ifsd_m; @@ -2680,6 +2697,8 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) m->m_len = ri->iri_frags[0].irf_len; } else { m = assemble_segments(rxq, ri, &sd); + if (m == NULL) + return (NULL); } m->m_pkthdr.len = ri->iri_len; m->m_pkthdr.rcvif = ri->iri_ifp; @@ -2780,7 +2799,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) cidxp = &rxq->ifr_fl[0].ifl_cidx; if ((avail = iflib_rxd_avail(ctx, rxq, *cidxp, budget)) == 0) { for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_lt(ctx, fl, budget + 8); + retval |= __iflib_fl_refill_all(ctx, fl); DBG_COUNTER_INC(rx_unavail); return (retval); } @@ -2836,7 +2855,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) } /* make sure that we can refill faster than drain */ for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_lt(ctx, fl, budget + 8); + retval |= __iflib_fl_refill_all(ctx, fl); lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO); if (lro_enabled) @@ -6702,6 +6721,9 @@ iflib_add_device_sysctl_post(if_ctx_t ctx) SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, "credits", CTLFLAG_RD, &fl->ifl_credits, 1, "credits available"); + SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, "buf_size", + CTLFLAG_RD, + &fl->ifl_buf_size, 1, "buffer size"); #if MEMORY_LOGGING SYSCTL_ADD_QUAD(ctx_list, fl_list, OID_AUTO, "fl_m_enqueued", CTLFLAG_RD, Modified: stable/12/sys/net/iflib.h ============================================================================== --- stable/12/sys/net/iflib.h Tue Aug 4 15:27:32 2020 (r363843) +++ stable/12/sys/net/iflib.h Tue Aug 4 15:48:12 2020 (r363844) @@ -221,6 +221,9 @@ typedef struct if_softc_ctx { uint32_t isc_tx_qdepth; iflib_intr_mode_t isc_intr; + uint16_t isc_rxd_buf_size[8]; /* set at init time by driver, 0 + means use iflib-calculated size + based on isc_max_frame_size */ uint16_t isc_max_frame_size; /* set at init time by driver */ uint16_t isc_min_frame_size; /* set at init time by driver, only used if IFLIB_NEED_ETHER_PAD is set. */ From owner-svn-src-stable@freebsd.org Tue Aug 4 15:54:16 2020 Return-Path: Delivered-To: svn-src-stable@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 B52F03781E9; Tue, 4 Aug 2020 15:54:16 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from creme-brulee.marcuscom.com (creme-brulee.marcuscom.com [IPv6:2607:fc50:1:f300::2]) (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 "*.marcuscom.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BLfSm078Zz4Wnl; Tue, 4 Aug 2020 15:54:15 +0000 (UTC) (envelope-from jclarke@marcuscom.com) Received: from rtp-jclarke-nitro9.cisco.com ([173.38.117.79]) (authenticated bits=0) by creme-brulee.marcuscom.com (8.16.1/8.16.1) with ESMTPSA id 074FsBbH030503 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 4 Aug 2020 11:54:12 -0400 (EDT) (envelope-from jclarke@marcuscom.com) X-Authentication-Warning: creme-brulee.marcuscom.com: Host [173.38.117.79] claimed to be rtp-jclarke-nitro9.cisco.com From: Joe Clarke Message-Id: <591D9FE1-043F-4025-83F8-E6100D680EB2@marcuscom.com> Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r363844 - in stable/12/sys: dev/vmware/vmxnet3 net Date: Tue, 4 Aug 2020 11:54:06 -0400 In-Reply-To: <202008041548.074FmCUp056205@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org To: Mark Johnston References: <202008041548.074FmCUp056205@repo.freebsd.org> X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Spam-Status: No, score=3.4 required=5.0 tests=HTML_MESSAGE, RDNS_NONE, TW_CQ, TW_DX,TW_MX,TW_NR,TW_QS,TW_RX,TW_SV,TW_TX,TW_VM,TW_XC,TW_XQ,TW_XS autolearn=disabled version=3.4.4 X-Spam-Level: *** X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on creme-brulee.marcuscom.com X-Rspamd-Queue-Id: 4BLfSm078Zz4Wnl X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of jclarke@marcuscom.com has no SPF policy when checking 2607:fc50:1:f300::2) smtp.mailfrom=jclarke@marcuscom.com X-Spamd-Result: default: False [1.95 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; HAS_XAW(0.00)[]; DMARC_NA(0.00)[marcuscom.com]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_SPAM_MEDIUM(0.34)[0.344]; NEURAL_HAM_SHORT(-0.10)[-0.101]; NEURAL_SPAM_LONG(0.31)[0.311]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:36236, ipnet:2607:fc50::/36, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 15:54:16 -0000 Thanks, Mark. Joe > On Aug 4, 2020, at 11:48, Mark Johnston wrote: >=20 > Author: markj > Date: Tue Aug 4 15:48:12 2020 > New Revision: 363844 > URL: https://svnweb.freebsd.org/changeset/base/363844 >=20 > Log: > MFC r358996 (by pkelsey): > Fix iflib zero-length fragment handling >=20 > MFC r358997 (by pkelsey): > Remove freelist contiguous-indexes assertion from rxd_frag_to_sd() >=20 > MFC r358998 (by pkelsey): > Allow iflib drivers to specify the buffer size used for each receive = queue >=20 > MFC r358999 (by pkelsey): > Remove refill budget from iflib >=20 > MFC r359000 (by pkelsey): > Fix if_vmx receive checksum offload bug and harden against the device > skipping receive descriptors >=20 > MFC r359001 (by pkelsey): > Adjust if_vmx default receive parameters for better out-of-box = performance >=20 > MFC r359002 (by pkelsey): > Remove extraneous code from iflib >=20 > MFC r359029 (by pkelsey): > Restore power-of-2 queue count constraint from r290948 >=20 > Tested by: marcus, mav >=20 > Modified: > stable/12/sys/dev/vmware/vmxnet3/if_vmx.c > stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h > stable/12/sys/net/iflib.c > stable/12/sys/net/iflib.h > Directory Properties: > stable/12/ (props changed) >=20 > Modified: stable/12/sys/dev/vmware/vmxnet3/if_vmx.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 > --- stable/12/sys/dev/vmware/vmxnet3/if_vmx.c Tue Aug 4 15:27:32 2020 = (r363843) > +++ stable/12/sys/dev/vmware/vmxnet3/if_vmx.c Tue Aug 4 15:48:12 2020 = (r363844) > @@ -321,6 +321,13 @@ vmxnet3_register(device_t dev) > } >=20 > static int > +trunc_powerof2(int val) > +{ > + > + return (1U << (fls(val) - 1)); > +} > + > +static int > vmxnet3_attach_pre(if_ctx_t ctx) > { > device_t dev; > @@ -349,12 +356,16 @@ vmxnet3_attach_pre(if_ctx_t ctx) > /* If 0, the iflib tunable was not set, so set to the default */ > if (scctx->isc_nrxqsets =3D=3D 0) > scctx->isc_nrxqsets =3D VMXNET3_DEF_RX_QUEUES; > + scctx->isc_nrxqsets =3D trunc_powerof2(scctx->isc_nrxqsets); > scctx->isc_nrxqsets_max =3D min(VMXNET3_MAX_RX_QUEUES, = mp_ncpus); > + scctx->isc_nrxqsets_max =3D = trunc_powerof2(scctx->isc_nrxqsets_max); >=20 > /* If 0, the iflib tunable was not set, so set to the default */ > if (scctx->isc_ntxqsets =3D=3D 0) > scctx->isc_ntxqsets =3D VMXNET3_DEF_TX_QUEUES; > + scctx->isc_ntxqsets =3D trunc_powerof2(scctx->isc_ntxqsets); > scctx->isc_ntxqsets_max =3D min(VMXNET3_MAX_TX_QUEUES, = mp_ncpus); > + scctx->isc_ntxqsets_max =3D = trunc_powerof2(scctx->isc_ntxqsets_max); >=20 > /* > * Enforce that the transmit completion queue descriptor count = is > @@ -381,6 +392,12 @@ vmxnet3_attach_pre(if_ctx_t ctx) > scctx->isc_rxqsizes[2] =3D > sizeof(struct vmxnet3_rxdesc) * scctx->isc_nrxd[2]; >=20 > + /* > + * Initialize the max frame size and descriptor queue buffer > + * sizes. > + */ > + vmxnet3_mtu_set(ctx, if_getmtu(sc->vmx_ifp)); > + > scctx->isc_rss_table_size =3D UPT1_RSS_MAX_IND_TABLE_SIZE; >=20 > /* Map PCI BARs */ > @@ -1494,6 +1511,7 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t = ri) > int cqidx; > uint16_t total_len; > uint8_t nfrags; > + uint8_t i; > uint8_t flid; >=20 > sc =3D vsc; > @@ -1517,6 +1535,7 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, if_rxd_info_t = ri) > KASSERT(rxcd->sop && rxcd->eop, > ("%s: zero-length packet without both sop and eop = set", > __func__)); > + rxc->vxcr_zero_length++; > if (++cqidx =3D=3D rxc->vxcr_ndesc) { > cqidx =3D 0; > rxc->vxcr_gen ^=3D 1; > @@ -1572,31 +1591,6 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, = if_rxd_info_t ri) > } > } >=20 > - /* VLAN */ > - if (rxcd->vlan) { > - ri->iri_flags |=3D M_VLANTAG; > - ri->iri_vtag =3D rxcd->vtag; > - } > - > - /* Checksum offload */ > - if (!rxcd->no_csum) { > - uint32_t csum_flags =3D 0; > - > - if (rxcd->ipv4) { > - csum_flags |=3D CSUM_IP_CHECKED; > - if (rxcd->ipcsum_ok) > - csum_flags |=3D CSUM_IP_VALID; > - } > - if (!rxcd->fragment && (rxcd->tcp || rxcd->udp)) { > - csum_flags |=3D CSUM_L4_CALC; > - if (rxcd->csum_ok) { > - csum_flags |=3D CSUM_L4_VALID; > - ri->iri_csum_data =3D 0xffff; > - } > - } > - ri->iri_csum_flags =3D csum_flags; > - } > - > /* > * The queue numbering scheme used for rxcd->qid is as follows: > * - All of the command ring 0s are numbered [0, nrxqsets - 1] > @@ -1632,6 +1626,46 @@ vmxnet3_isc_rxd_pkt_get(void *vsc, = if_rxd_info_t ri) > ri->iri_nfrags =3D nfrags; > ri->iri_len =3D total_len; >=20 > + /* > + * If there's an error, the last descriptor in the packet will > + * have the error indicator set. In this case, set all > + * fragment lengths to zero. This will cause iflib to discard > + * the packet, but process all associated descriptors through > + * the refill mechanism. > + */ > + if (__predict_false(rxcd->error)) { > + rxc->vxcr_pkt_errors++; > + for (i =3D 0; i < nfrags; i++) { > + frag =3D &ri->iri_frags[i]; > + frag->irf_len =3D 0; > + } > + } else { > + /* Checksum offload information is in the last = descriptor. */ > + if (!rxcd->no_csum) { > + uint32_t csum_flags =3D 0; > + > + if (rxcd->ipv4) { > + csum_flags |=3D CSUM_IP_CHECKED; > + if (rxcd->ipcsum_ok) > + csum_flags |=3D CSUM_IP_VALID; > + } > + if (!rxcd->fragment && (rxcd->tcp || rxcd->udp)) = { > + csum_flags |=3D CSUM_L4_CALC; > + if (rxcd->csum_ok) { > + csum_flags |=3D CSUM_L4_VALID; > + ri->iri_csum_data =3D 0xffff; > + } > + } > + ri->iri_csum_flags =3D csum_flags; > + } > + > + /* VLAN information is in the last descriptor. */ > + if (rxcd->vlan) { > + ri->iri_flags |=3D M_VLANTAG; > + ri->iri_vtag =3D rxcd->vtag; > + } > + } > + > return (0); > } >=20 > @@ -1645,14 +1679,13 @@ vmxnet3_isc_rxd_refill(void *vsc, = if_rxd_update_t iru) > uint64_t *paddrs; > int count; > int len; > - int pidx; > + int idx; > int i; > uint8_t flid; > uint8_t btype; >=20 > count =3D iru->iru_count; > len =3D iru->iru_buf_size; > - pidx =3D iru->iru_pidx; > flid =3D iru->iru_flidx; > paddrs =3D iru->iru_paddrs; >=20 > @@ -1666,17 +1699,32 @@ vmxnet3_isc_rxd_refill(void *vsc, = if_rxd_update_t iru) > * command ring 1 is filled with BTYPE_BODY descriptors. > */ > btype =3D (flid =3D=3D 0) ? VMXNET3_BTYPE_HEAD : = VMXNET3_BTYPE_BODY; > - for (i =3D 0; i < count; i++) { > - rxd[pidx].addr =3D paddrs[i]; > - rxd[pidx].len =3D len; > - rxd[pidx].btype =3D btype; > - rxd[pidx].gen =3D rxr->vxrxr_gen; > + /* > + * The refill entries from iflib will advance monotonically, > + * but the refilled descriptors may not be contiguous due to > + * earlier skipping of descriptors by the device. The refill > + * entries from iflib need an entire state update, while the > + * descriptors previously skipped by the device only need to > + * have their generation numbers updated. > + */ > + idx =3D rxr->vxrxr_refill_start; > + i =3D 0; > + do { > + if (idx =3D=3D iru->iru_idxs[i]) { > + rxd[idx].addr =3D paddrs[i]; > + rxd[idx].len =3D len; > + rxd[idx].btype =3D btype; > + i++; > + } else > + rxr->vxrxr_desc_skips++; > + rxd[idx].gen =3D rxr->vxrxr_gen; >=20 > - if (++pidx =3D=3D rxr->vxrxr_ndesc) { > - pidx =3D 0; > + if (++idx =3D=3D rxr->vxrxr_ndesc) { > + idx =3D 0; > rxr->vxrxr_gen ^=3D 1; > } > - } > + } while (i !=3D count); > + rxr->vxrxr_refill_start =3D idx; > } >=20 > static void > @@ -1825,6 +1873,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct = vmxnet > for (i =3D 0; i < sc->vmx_sctx->isc_nrxqs - 1; i++) { > rxr =3D &rxq->vxrxq_cmd_ring[i]; > rxr->vxrxr_gen =3D VMXNET3_INIT_GEN; > + rxr->vxrxr_desc_skips =3D 0; > + rxr->vxrxr_refill_start =3D 0; > /* > * iflib has zeroed out the descriptor array during the > * prior attach or stop > @@ -1834,6 +1884,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct = vmxnet > for (/**/; i < VMXNET3_RXRINGS_PERQ; i++) { > rxr =3D &rxq->vxrxq_cmd_ring[i]; > rxr->vxrxr_gen =3D 0; > + rxr->vxrxr_desc_skips =3D 0; > + rxr->vxrxr_refill_start =3D 0; > bzero(rxr->vxrxr_rxd, > rxr->vxrxr_ndesc * sizeof(struct vmxnet3_rxdesc)); > } > @@ -1841,6 +1893,8 @@ vmxnet3_rxinit(struct vmxnet3_softc *sc, struct = vmxnet > rxc =3D &rxq->vxrxq_comp_ring; > rxc->vxcr_next =3D 0; > rxc->vxcr_gen =3D VMXNET3_INIT_GEN; > + rxc->vxcr_zero_length =3D 0; > + rxc->vxcr_pkt_errors =3D 0; > /* > * iflib has zeroed out the descriptor array during the prior = attach > * or stop > @@ -1906,14 +1960,9 @@ static void > vmxnet3_init(if_ctx_t ctx) > { > struct vmxnet3_softc *sc; > - if_softc_ctx_t scctx; > =09 > sc =3D iflib_get_softc(ctx); > - scctx =3D sc->vmx_scctx; >=20 > - scctx->isc_max_frame_size =3D if_getmtu(iflib_get_ifp(ctx)) + > - ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; > - > /* Use the current MAC address. */ > bcopy(IF_LLADDR(sc->vmx_ifp), sc->vmx_lladdr, ETHER_ADDR_LEN); > vmxnet3_set_lladdr(sc); > @@ -1938,11 +1987,37 @@ vmxnet3_multi_set(if_ctx_t ctx) > static int > vmxnet3_mtu_set(if_ctx_t ctx, uint32_t mtu) > { > + struct vmxnet3_softc *sc; > + if_softc_ctx_t scctx; >=20 > + sc =3D iflib_get_softc(ctx); > + scctx =3D sc->vmx_scctx; > + > if (mtu > VMXNET3_TX_MAXSIZE - (ETHER_HDR_LEN + = ETHER_VLAN_ENCAP_LEN + > ETHER_CRC_LEN)) > return (EINVAL); >=20 > + /* > + * Update the max frame size so that the rx mbuf size is > + * chosen based on the new mtu during the interface init that > + * will occur after this routine returns. > + */ > + scctx->isc_max_frame_size =3D mtu + > + ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + ETHER_CRC_LEN; > + /* RX completion queue - n/a */ > + scctx->isc_rxd_buf_size[0] =3D 0; > + /* > + * For header-type descriptors (used for first segment of > + * packet), let iflib determine the buffer size based on the > + * max frame size. > + */ > + scctx->isc_rxd_buf_size[1] =3D 0; > + /* > + * For body-type descriptors (used for jumbo frames and LRO), > + * always use page-sized buffers. > + */ > + scctx->isc_rxd_buf_size[2] =3D MJUMPAGESIZE; > + > return (0); > } >=20 > @@ -2288,14 +2363,22 @@ vmxnet3_setup_debug_sysctl(struct = vmxnet3_softc *sc, > &rxq->vxrxq_cmd_ring[0].vxrxr_ndesc, 0, ""); > SYSCTL_ADD_INT(ctx, list, OID_AUTO, "cmd0_gen", = CTLFLAG_RD, > &rxq->vxrxq_cmd_ring[0].vxrxr_gen, 0, ""); > + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "cmd0_desc_skips", = CTLFLAG_RD, > + &rxq->vxrxq_cmd_ring[0].vxrxr_desc_skips, 0, ""); > SYSCTL_ADD_UINT(ctx, list, OID_AUTO, "cmd1_ndesc", = CTLFLAG_RD, > &rxq->vxrxq_cmd_ring[1].vxrxr_ndesc, 0, ""); > SYSCTL_ADD_INT(ctx, list, OID_AUTO, "cmd1_gen", = CTLFLAG_RD, > &rxq->vxrxq_cmd_ring[1].vxrxr_gen, 0, ""); > + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "cmd1_desc_skips", = CTLFLAG_RD, > + &rxq->vxrxq_cmd_ring[1].vxrxr_desc_skips, 0, ""); > SYSCTL_ADD_UINT(ctx, list, OID_AUTO, "comp_ndesc", = CTLFLAG_RD, > &rxq->vxrxq_comp_ring.vxcr_ndesc, 0,""); > SYSCTL_ADD_INT(ctx, list, OID_AUTO, "comp_gen", = CTLFLAG_RD, > &rxq->vxrxq_comp_ring.vxcr_gen, 0, ""); > + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "comp_zero_length", = CTLFLAG_RD, > + &rxq->vxrxq_comp_ring.vxcr_zero_length, 0, ""); > + SYSCTL_ADD_U64(ctx, list, OID_AUTO, "comp_pkt_errors", = CTLFLAG_RD, > + &rxq->vxrxq_comp_ring.vxcr_pkt_errors, 0, ""); > } > } >=20 >=20 > Modified: stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h Tue Aug 4 = 15:27:32 2020 (r363843) > +++ stable/12/sys/dev/vmware/vmxnet3/if_vmxvar.h Tue Aug 4 = 15:48:12 2020 (r363844) > @@ -41,7 +41,7 @@ struct vmxnet3_softc; > #define VMXNET3_MAX_TX_NDESC 4096 > #define VMXNET3_MIN_TX_NDESC 32 > #define VMXNET3_MASK_TX_NDESC 0x1F > -#define VMXNET3_DEF_RX_NDESC 256 > +#define VMXNET3_DEF_RX_NDESC 512 > #define VMXNET3_MAX_RX_NDESC 2048 > #define VMXNET3_MIN_RX_NDESC 32 > #define VMXNET3_MASK_RX_NDESC 0x1F > @@ -63,6 +63,8 @@ struct vmxnet3_rxring { > u_int vxrxr_ndesc; > int vxrxr_gen; > bus_addr_t vxrxr_paddr; > + uint64_t vxrxr_desc_skips; > + uint16_t vxrxr_refill_start; > }; >=20 > struct vmxnet3_comp_ring { > @@ -78,6 +80,8 @@ struct vmxnet3_comp_ring { > u_int vxcr_ndesc; > int vxcr_gen; > bus_addr_t vxcr_paddr; > + uint64_t vxcr_zero_length; > + uint64_t vxcr_pkt_errors; > }; >=20 > struct vmxnet3_txqueue { >=20 > Modified: stable/12/sys/net/iflib.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 > --- stable/12/sys/net/iflib.c Tue Aug 4 15:27:32 2020 = (r363843) > +++ stable/12/sys/net/iflib.c Tue Aug 4 15:48:12 2020 = (r363844) > @@ -453,7 +453,6 @@ typedef struct if_rxsd { > caddr_t *ifsd_cl; > struct mbuf **ifsd_m; > iflib_fl_t ifsd_fl; > - qidx_t ifsd_cidx; > } *if_rxsd_t; >=20 > /* multiple of word size */ > @@ -713,6 +712,7 @@ static int iflib_altq_if_transmit(if_t ifp, struct = mbu > static int iflib_register(if_ctx_t); > static void iflib_deregister(if_ctx_t); > static void iflib_unregister_vlan_handlers(if_ctx_t ctx); > +static uint16_t iflib_get_mbuf_size_for(unsigned int size); > static void iflib_init_locked(if_ctx_t ctx); > static void iflib_add_device_sysctl_pre(if_ctx_t ctx); > static void iflib_add_device_sysctl_post(if_ctx_t ctx); > @@ -2130,7 +2130,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, = int coun > } >=20 > static __inline uint8_t > -__iflib_fl_refill_lt(if_ctx_t ctx, iflib_fl_t fl, int max) > +__iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) > { > /* we avoid allowing pidx to catch up with cidx as it confuses = ixl */ > int32_t reclaimable =3D fl->ifl_size - fl->ifl_credits - 1; > @@ -2142,7 +2142,7 @@ __iflib_fl_refill_lt(if_ctx_t ctx, iflib_fl_t = fl, int=20 > MPASS(reclaimable =3D=3D delta); >=20 > if (reclaimable > 0) > - return (_iflib_fl_refill(ctx, fl, min(max, = reclaimable))); > + return (_iflib_fl_refill(ctx, fl, reclaimable)); > return (0); > } >=20 > @@ -2213,6 +2213,8 @@ iflib_fl_setup(iflib_fl_t fl) > { > iflib_rxq_t rxq =3D fl->ifl_rxq; > if_ctx_t ctx =3D rxq->ifr_ctx; > + if_softc_ctx_t scctx =3D &ctx->ifc_softc_ctx; > + int qidx; >=20 > bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1); > /* > @@ -2221,7 +2223,16 @@ iflib_fl_setup(iflib_fl_t fl) > iflib_fl_bufs_free(fl); > /* Now replenish the mbufs */ > MPASS(fl->ifl_credits =3D=3D 0); > - fl->ifl_buf_size =3D ctx->ifc_rx_mbuf_sz; > + qidx =3D rxq->ifr_fl_offset + fl->ifl_id; > + if (scctx->isc_rxd_buf_size[qidx] !=3D 0) > + fl->ifl_buf_size =3D scctx->isc_rxd_buf_size[qidx]; > + else > + fl->ifl_buf_size =3D ctx->ifc_rx_mbuf_sz; > + /* > + * ifl_buf_size may be a driver-supplied value, so pull it up > + * to the selected mbuf size. > + */ > + fl->ifl_buf_size =3D iflib_get_mbuf_size_for(fl->ifl_buf_size); > if (fl->ifl_buf_size > ctx->ifc_max_fl_buf_size) > ctx->ifc_max_fl_buf_size =3D fl->ifl_buf_size; > fl->ifl_cltype =3D m_gettype(fl->ifl_buf_size); > @@ -2353,6 +2364,16 @@ iflib_timer(void *arg) > STATE_UNLOCK(ctx); > } >=20 > +static uint16_t > +iflib_get_mbuf_size_for(unsigned int size) > +{ > + > + if (size <=3D MCLBYTES) > + return (MCLBYTES); > + else > + return (MJUMPAGESIZE); > +} > + > static void > iflib_calc_rx_mbuf_sz(if_ctx_t ctx) > { > @@ -2362,10 +2383,8 @@ iflib_calc_rx_mbuf_sz(if_ctx_t ctx) > * XXX don't set the max_frame_size to larger > * than the hardware can handle > */ > - if (sctx->isc_max_frame_size <=3D MCLBYTES) > - ctx->ifc_rx_mbuf_sz =3D MCLBYTES; > - else > - ctx->ifc_rx_mbuf_sz =3D MJUMPAGESIZE; > + ctx->ifc_rx_mbuf_sz =3D > + iflib_get_mbuf_size_for(sctx->isc_max_frame_size); > } >=20 > uint32_t > @@ -2578,7 +2597,6 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t = irf, int > cidx =3D irf->irf_idx; > fl =3D &rxq->ifr_fl[flid]; > sd->ifsd_fl =3D fl; > - sd->ifsd_cidx =3D cidx; > sd->ifsd_m =3D &fl->ifl_sds.ifsd_m[cidx]; > sd->ifsd_cl =3D &fl->ifl_sds.ifsd_cl[cidx]; > fl->ifl_credits--; > @@ -2590,12 +2608,10 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t = irf, int > next =3D (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); > prefetch(&fl->ifl_sds.ifsd_map[next]); > map =3D fl->ifl_sds.ifsd_map[cidx]; > - next =3D (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); >=20 > - /* not valid assert if bxe really does SGE from non-contiguous = elements */ > - MPASS(fl->ifl_cidx =3D=3D cidx); > bus_dmamap_sync(fl->ifl_buf_tag, map, BUS_DMASYNC_POSTREAD); > - if (unload) > + > + if (unload && irf->irf_len !=3D 0) > bus_dmamap_unload(fl->ifl_buf_tag, map); > fl->ifl_cidx =3D (fl->ifl_cidx + 1) & (fl->ifl_size-1); > if (__predict_false(fl->ifl_cidx =3D=3D 0)) > @@ -2667,6 +2683,7 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t = ri) >=20 > /* should I merge this back in now that the two paths are = basically duplicated? */ > if (ri->iri_nfrags =3D=3D 1 && > + ri->iri_frags[0].irf_len !=3D 0 && > ri->iri_frags[0].irf_len <=3D MIN(IFLIB_RX_COPY_THRESH, = MHLEN)) { > rxd_frag_to_sd(rxq, &ri->iri_frags[0], FALSE, &sd); > m =3D *sd.ifsd_m; > @@ -2680,6 +2697,8 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t = ri) > m->m_len =3D ri->iri_frags[0].irf_len; > } else { > m =3D assemble_segments(rxq, ri, &sd); > + if (m =3D=3D NULL) > + return (NULL); > } > m->m_pkthdr.len =3D ri->iri_len; > m->m_pkthdr.rcvif =3D ri->iri_ifp; > @@ -2780,7 +2799,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) > cidxp =3D &rxq->ifr_fl[0].ifl_cidx; > if ((avail =3D iflib_rxd_avail(ctx, rxq, *cidxp, budget)) =3D=3D = 0) { > for (i =3D 0, fl =3D &rxq->ifr_fl[0]; i < sctx->isc_nfl; = i++, fl++) > - retval |=3D __iflib_fl_refill_lt(ctx, fl, budget = + 8); > + retval |=3D __iflib_fl_refill_all(ctx, fl); > DBG_COUNTER_INC(rx_unavail); > return (retval); > } > @@ -2836,7 +2855,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) > } > /* make sure that we can refill faster than drain */ > for (i =3D 0, fl =3D &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, = fl++) > - retval |=3D __iflib_fl_refill_lt(ctx, fl, budget + 8); > + retval |=3D __iflib_fl_refill_all(ctx, fl); >=20 > lro_enabled =3D (if_getcapenable(ifp) & IFCAP_LRO); > if (lro_enabled) > @@ -6702,6 +6721,9 @@ iflib_add_device_sysctl_post(if_ctx_t ctx) > SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, = "credits", > CTLFLAG_RD, > &fl->ifl_credits, 1, "credits = available"); > + SYSCTL_ADD_U16(ctx_list, fl_list, OID_AUTO, = "buf_size", > + CTLFLAG_RD, > + &fl->ifl_buf_size, 1, "buffer = size"); > #if MEMORY_LOGGING > SYSCTL_ADD_QUAD(ctx_list, fl_list, OID_AUTO, = "fl_m_enqueued", > CTLFLAG_RD, >=20 > Modified: stable/12/sys/net/iflib.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- stable/12/sys/net/iflib.h Tue Aug 4 15:27:32 2020 = (r363843) > +++ stable/12/sys/net/iflib.h Tue Aug 4 15:48:12 2020 = (r363844) > @@ -221,6 +221,9 @@ typedef struct if_softc_ctx { > uint32_t isc_tx_qdepth; >=20 > iflib_intr_mode_t isc_intr; > + uint16_t isc_rxd_buf_size[8]; /* set at init time by driver, 0 > + means use iflib-calculated size > + based on isc_max_frame_size */ > uint16_t isc_max_frame_size; /* set at init time by driver */ > uint16_t isc_min_frame_size; /* set at init time by driver, only = used if > IFLIB_NEED_ETHER_PAD is set. */ > _______________________________________________ > 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" --- PGP Key : http://www.marcuscom.com/pgp.asc From owner-svn-src-stable@freebsd.org Tue Aug 4 16:06:59 2020 Return-Path: Delivered-To: svn-src-stable@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 546DB378A65; Tue, 4 Aug 2020 16:06:59 +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 4BLflR1YVnz4XVj; Tue, 4 Aug 2020 16:06:59 +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 1A13227E5D; Tue, 4 Aug 2020 16:06:59 +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 074G6wI0068480; Tue, 4 Aug 2020 16:06:58 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074G6wrr068478; Tue, 4 Aug 2020 16:06:58 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008041606.074G6wrr068478@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 4 Aug 2020 16:06:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363845 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 363845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 16:06:59 -0000 Author: markj Date: Tue Aug 4 16:06:58 2020 New Revision: 363845 URL: https://svnweb.freebsd.org/changeset/base/363845 Log: MFC r362962, r362963: iflib: Fix handling of mbuf cluster allocation failures. Modified: stable/12/sys/net/iflib.c stable/12/sys/net/iflib.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Tue Aug 4 15:48:12 2020 (r363844) +++ stable/12/sys/net/iflib.c Tue Aug 4 16:06:58 2020 (r363845) @@ -207,8 +207,6 @@ struct iflib_ctx { #define isc_rxd_pkt_get ifc_txrx.ift_rxd_pkt_get #define isc_rxd_refill ifc_txrx.ift_rxd_refill #define isc_rxd_flush ifc_txrx.ift_rxd_flush -#define isc_rxd_refill ifc_txrx.ift_rxd_refill -#define isc_rxd_refill ifc_txrx.ift_rxd_refill #define isc_legacy_intr ifc_txrx.ift_legacy_intr eventhandler_tag ifc_vlan_attach_event; eventhandler_tag ifc_vlan_detach_event; @@ -394,8 +392,7 @@ struct iflib_fl { bus_dma_tag_t ifl_buf_tag; iflib_dma_info_t ifl_ifdi; uint64_t ifl_bus_addrs[IFLIB_MAX_RX_REFRESH] __aligned(CACHE_LINE_SIZE); - caddr_t ifl_vm_addrs[IFLIB_MAX_RX_REFRESH]; - qidx_t ifl_rxd_idxs[IFLIB_MAX_RX_REFRESH]; + qidx_t ifl_rxd_idxs[IFLIB_MAX_RX_REFRESH]; } __aligned(CACHE_LINE_SIZE); static inline qidx_t @@ -859,7 +856,6 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ return netmap_ring_reinit(kring); - fl->ifl_vm_addrs[tmp_pidx] = addr; if (__predict_false(init)) { netmap_load_map(na, fl->ifl_buf_tag, map[nic_i], addr); @@ -1333,7 +1329,6 @@ iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t fl = &rxq->ifr_fl[flid]; iru->iru_paddrs = fl->ifl_bus_addrs; - iru->iru_vaddrs = &fl->ifl_vm_addrs[0]; iru->iru_idxs = fl->ifl_rxd_idxs; iru->iru_qsidx = rxq->ifr_id; iru->iru_buf_size = fl->ifl_buf_size; @@ -1987,7 +1982,7 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int } /** - * _iflib_fl_refill - refill an rxq free-buffer list + * iflib_fl_refill - refill an rxq free-buffer list * @ctx: the iflib context * @fl: the free list to refill * @count: the number of new buffers to allocate @@ -1996,7 +1991,7 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int * The caller must assure that @count does not exceed the queue's capacity. */ static uint8_t -_iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) +iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) { struct if_rxd_update iru; struct rxq_refill_cb_arg cb_arg; @@ -2033,12 +2028,13 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun if (n > 8) DBG_COUNTER_INC(fl_refills_large); iru_init(&iru, fl->ifl_rxq, fl->ifl_id); - while (n--) { + while (n-- > 0) { /* * We allocate an uninitialized mbuf + cluster, mbuf is * initialized after rx. * - * If the cluster is still set then we know a minimum sized packet was received + * If the cluster is still set then we know a minimum sized + * packet was received */ bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, &frag_idx); @@ -2046,7 +2042,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); MPASS(frag_idx >= 0); if ((cl = sd_cl[frag_idx]) == NULL) { - if ((cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) + cl = uma_zalloc(fl->ifl_zone, M_NOWAIT); + if (__predict_false(cl == NULL)) break; cb_arg.error = 0; @@ -2054,16 +2051,12 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun err = bus_dmamap_load(fl->ifl_buf_tag, sd_map[frag_idx], cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, BUS_DMA_NOWAIT); - if (err != 0 || cb_arg.error) { - /* - * !zone_pack ? - */ - if (fl->ifl_zone == zone_pack) - uma_zfree(fl->ifl_zone, cl); + if (__predict_false(err != 0 || cb_arg.error)) { + uma_zfree(fl->ifl_zone, cl); break; } - sd_ba[frag_idx] = bus_addr = cb_arg.seg.ds_addr; + sd_ba[frag_idx] = bus_addr = cb_arg.seg.ds_addr; sd_cl[frag_idx] = cl; #if MEMORY_LOGGING fl->ifl_cl_enqueued++; @@ -2075,9 +2068,9 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun BUS_DMASYNC_PREREAD); MPASS(sd_m[frag_idx] == NULL); - if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { + m = m_gethdr(M_NOWAIT, MT_NOINIT); + if (__predict_false(m == NULL)) break; - } sd_m[frag_idx] = m; bit_set(fl->ifl_rx_bitmap, frag_idx); #if MEMORY_LOGGING @@ -2087,50 +2080,58 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun DBG_COUNTER_INC(rx_allocs); fl->ifl_rxd_idxs[i] = frag_idx; fl->ifl_bus_addrs[i] = bus_addr; - fl->ifl_vm_addrs[i] = cl; credits++; i++; MPASS(credits <= fl->ifl_size); if (++idx == fl->ifl_size) { +#ifdef INVARIANTS fl->ifl_gen = 1; +#endif idx = 0; } if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { iru.iru_pidx = pidx; iru.iru_count = i; ctx->isc_rxd_refill(ctx->ifc_softc, &iru); - i = 0; - pidx = idx; fl->ifl_pidx = idx; fl->ifl_credits = credits; + pidx = idx; + i = 0; } } - if (i) { - iru.iru_pidx = pidx; - iru.iru_count = i; - ctx->isc_rxd_refill(ctx->ifc_softc, &iru); - fl->ifl_pidx = idx; - fl->ifl_credits = credits; + if (n < count - 1) { + if (i != 0) { + iru.iru_pidx = pidx; + iru.iru_count = i; + ctx->isc_rxd_refill(ctx->ifc_softc, &iru); + fl->ifl_pidx = idx; + fl->ifl_credits = credits; + } + DBG_COUNTER_INC(rxd_flush); + if (fl->ifl_pidx == 0) + pidx = fl->ifl_size - 1; + else + pidx = fl->ifl_pidx - 1; + + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, + fl->ifl_id, pidx); + if (__predict_true(bit_test(fl->ifl_rx_bitmap, frag_idx))) { + fl->ifl_fragidx = frag_idx + 1; + if (fl->ifl_fragidx == fl->ifl_size) + fl->ifl_fragidx = 0; + } else { + fl->ifl_fragidx = frag_idx; + } } - DBG_COUNTER_INC(rxd_flush); - if (fl->ifl_pidx == 0) - pidx = fl->ifl_size - 1; - else - pidx = fl->ifl_pidx - 1; - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map, - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); - ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx); - fl->ifl_fragidx = frag_idx + 1; - if (fl->ifl_fragidx == fl->ifl_size) - fl->ifl_fragidx = 0; - return (n == -1 ? 0 : IFLIB_RXEOF_EMPTY); } -static __inline uint8_t -__iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) +static inline uint8_t +iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) { /* we avoid allowing pidx to catch up with cidx as it confuses ixl */ int32_t reclaimable = fl->ifl_size - fl->ifl_credits - 1; @@ -2142,7 +2143,7 @@ __iflib_fl_refill_all(if_ctx_t ctx, iflib_fl_t fl) MPASS(reclaimable == delta); if (reclaimable > 0) - return (_iflib_fl_refill(ctx, fl, reclaimable)); + return (iflib_fl_refill(ctx, fl, reclaimable)); return (0); } @@ -2173,22 +2174,20 @@ iflib_fl_bufs_free(iflib_fl_t fl) bus_dmamap_sync(fl->ifl_buf_tag, sd_map, BUS_DMASYNC_POSTREAD); bus_dmamap_unload(fl->ifl_buf_tag, sd_map); - if (*sd_cl != NULL) - uma_zfree(fl->ifl_zone, *sd_cl); + uma_zfree(fl->ifl_zone, *sd_cl); + *sd_cl = NULL; if (*sd_m != NULL) { m_init(*sd_m, M_NOWAIT, MT_DATA, 0); uma_zfree(zone_mbuf, *sd_m); + *sd_m = NULL; } } else { - MPASS(*sd_cl == NULL); MPASS(*sd_m == NULL); } #if MEMORY_LOGGING fl->ifl_m_dequeued++; fl->ifl_cl_dequeued++; #endif - *sd_cl = NULL; - *sd_m = NULL; } #ifdef INVARIANTS for (i = 0; i < fl->ifl_size; i++) { @@ -2242,7 +2241,7 @@ iflib_fl_setup(iflib_fl_t fl) /* avoid pre-allocating zillions of clusters to an idle card * potentially speeding up attach */ - (void) _iflib_fl_refill(ctx, fl, min(128, fl->ifl_size)); + (void)iflib_fl_refill(ctx, fl, min(128, fl->ifl_size)); MPASS(min(128, fl->ifl_size) == fl->ifl_credits); if (min(128, fl->ifl_size) != fl->ifl_credits) return (ENOBUFS); @@ -2799,7 +2798,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) cidxp = &rxq->ifr_fl[0].ifl_cidx; if ((avail = iflib_rxd_avail(ctx, rxq, *cidxp, budget)) == 0) { for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_all(ctx, fl); + retval |= iflib_fl_refill_all(ctx, fl); DBG_COUNTER_INC(rx_unavail); return (retval); } @@ -2855,7 +2854,7 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) } /* make sure that we can refill faster than drain */ for (i = 0, fl = &rxq->ifr_fl[0]; i < sctx->isc_nfl; i++, fl++) - retval |= __iflib_fl_refill_all(ctx, fl); + retval |= iflib_fl_refill_all(ctx, fl); lro_enabled = (if_getcapenable(ifp) & IFCAP_LRO); if (lro_enabled) Modified: stable/12/sys/net/iflib.h ============================================================================== --- stable/12/sys/net/iflib.h Tue Aug 4 15:48:12 2020 (r363844) +++ stable/12/sys/net/iflib.h Tue Aug 4 16:06:58 2020 (r363845) @@ -95,7 +95,6 @@ typedef struct if_rxd_info { typedef struct if_rxd_update { uint64_t *iru_paddrs; - caddr_t *iru_vaddrs; qidx_t *iru_idxs; qidx_t iru_pidx; uint16_t iru_qsidx; From owner-svn-src-stable@freebsd.org Tue Aug 4 23:30:11 2020 Return-Path: Delivered-To: svn-src-stable@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 B34673A2EA9; Tue, 4 Aug 2020 23:30:11 +0000 (UTC) (envelope-from erj@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 4BLrZq4WJ5z42X3; Tue, 4 Aug 2020 23:30:11 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 61C58CDD1; Tue, 4 Aug 2020 23:30:11 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 074NUBPK039710; Tue, 4 Aug 2020 23:30:11 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 074NUAvl039703; Tue, 4 Aug 2020 23:30:10 GMT (envelope-from erj@FreeBSD.org) Message-Id: <202008042330.074NUAvl039703@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 4 Aug 2020 23:30:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363876 - in stable/12/sys: conf dev/ixl modules/ixl X-SVN-Group: stable-12 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in stable/12/sys: conf dev/ixl modules/ixl X-SVN-Commit-Revision: 363876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Aug 2020 23:30:11 -0000 Author: erj Date: Tue Aug 4 23:30:10 2020 New Revision: 363876 URL: https://svnweb.freebsd.org/changeset/base/363876 Log: MFC r361992: ixl(4): Add FW recovery mode support and other things Update the iflib version of ixl driver based on the OOT version ixl-1.11.29. Major changes: - Extract iflib specific functions from ixl_pf_main.c to ixl_pf_iflib.c to simplify code sharing between legacy and iflib version of driver - Add support for most recent FW API version (1.10), which extends FW LLDP Agent control by user to X722 devices - Improve handling of device global reset - Add support for the FW recovery mode - Use virtchnl function to validate virtual channel messages instead of using separate checks - Fix MAC/VLAN filters accounting Relnotes: yes Sponsored by: Intel Corporation Added: stable/12/sys/dev/ixl/ixl_pf_iflib.c - copied unchanged from r361992, head/sys/dev/ixl/ixl_pf_iflib.c Modified: stable/12/sys/conf/files.amd64 stable/12/sys/conf/files.powerpc stable/12/sys/dev/ixl/i40e_adminq.c stable/12/sys/dev/ixl/i40e_adminq_cmd.h stable/12/sys/dev/ixl/i40e_common.c stable/12/sys/dev/ixl/i40e_dcb.c stable/12/sys/dev/ixl/i40e_dcb.h stable/12/sys/dev/ixl/i40e_devids.h stable/12/sys/dev/ixl/i40e_lan_hmc.c stable/12/sys/dev/ixl/i40e_nvm.c stable/12/sys/dev/ixl/i40e_osdep.c stable/12/sys/dev/ixl/i40e_prototype.h stable/12/sys/dev/ixl/i40e_register.h stable/12/sys/dev/ixl/i40e_type.h stable/12/sys/dev/ixl/if_iavf.c stable/12/sys/dev/ixl/if_ixl.c stable/12/sys/dev/ixl/ixl.h stable/12/sys/dev/ixl/ixl_pf.h stable/12/sys/dev/ixl/ixl_pf_i2c.c stable/12/sys/dev/ixl/ixl_pf_iov.c stable/12/sys/dev/ixl/ixl_pf_main.c stable/12/sys/dev/ixl/ixl_txrx.c stable/12/sys/modules/ixl/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files.amd64 ============================================================================== --- stable/12/sys/conf/files.amd64 Tue Aug 4 23:09:15 2020 (r363875) +++ stable/12/sys/conf/files.amd64 Tue Aug 4 23:30:10 2020 (r363876) @@ -272,6 +272,8 @@ dev/ixl/if_ixl.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_main.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_iflib.c optional ixl pci \ + compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_qmgr.c optional ixl pci \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_iov.c optional ixl pci pci_iov \ Modified: stable/12/sys/conf/files.powerpc ============================================================================== --- stable/12/sys/conf/files.powerpc Tue Aug 4 23:09:15 2020 (r363875) +++ stable/12/sys/conf/files.powerpc Tue Aug 4 23:30:10 2020 (r363876) @@ -47,6 +47,8 @@ dev/ixl/if_ixl.c optional ixl pci powerpc64 \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_main.c optional ixl pci powerpc64 \ compile-with "${NORMAL_C} -I$S/dev/ixl" +dev/ixl/ixl_pf_iflib.c optional ixl pci powerpc64 \ + compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_qmgr.c optional ixl pci powerpc64 \ compile-with "${NORMAL_C} -I$S/dev/ixl" dev/ixl/ixl_pf_iov.c optional ixl pci pci_iov powerpc64 \ Modified: stable/12/sys/dev/ixl/i40e_adminq.c ============================================================================== --- stable/12/sys/dev/ixl/i40e_adminq.c Tue Aug 4 23:09:15 2020 (r363875) +++ stable/12/sys/dev/ixl/i40e_adminq.c Tue Aug 4 23:30:10 2020 (r363876) @@ -125,6 +125,7 @@ enum i40e_status_code i40e_alloc_adminq_arq_ring(struc **/ void i40e_free_adminq_asq(struct i40e_hw *hw) { + i40e_free_virt_mem(hw, &hw->aq.asq.cmd_buf); i40e_free_dma_mem(hw, &hw->aq.asq.desc_buf); } @@ -404,7 +405,7 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw /* initialize base registers */ ret_code = i40e_config_asq_regs(hw); if (ret_code != I40E_SUCCESS) - goto init_adminq_free_rings; + goto init_config_regs; /* success! */ hw->aq.asq.count = hw->aq.num_asq_entries; @@ -412,7 +413,11 @@ enum i40e_status_code i40e_init_asq(struct i40e_hw *hw init_adminq_free_rings: i40e_free_adminq_asq(hw); + return ret_code; +init_config_regs: + i40e_free_asq_bufs(hw); + init_adminq_exit: return ret_code; } @@ -563,6 +568,70 @@ static void i40e_resume_aq(struct i40e_hw *hw) } /** + * i40e_set_hw_flags - set HW flags + * @hw: pointer to the hardware structure + **/ +static void i40e_set_hw_flags(struct i40e_hw *hw) +{ + struct i40e_adminq_info *aq = &hw->aq; + + hw->flags = 0; + + switch (hw->mac.type) { + case I40E_MAC_XL710: + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710)) { + hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; + hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE; + /* The ability to RX (not drop) 802.1ad frames */ + hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE; + } + break; + case I40E_MAC_X722: + hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE | + I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722)) + hw->flags |= I40E_HW_FLAG_FW_LLDP_STOPPABLE; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_X722)) + hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= I40E_MINOR_VER_FW_REQUEST_FEC_X722)) + hw->flags |= I40E_HW_FLAG_X722_FEC_REQUEST_CAPABLE; + + /* fall through */ + default: + break; + } + + /* Newer versions of firmware require lock when reading the NVM */ + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= 5)) + hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= 8)) { + hw->flags |= I40E_HW_FLAG_FW_LLDP_PERSISTENT; + hw->flags |= I40E_HW_FLAG_DROP_MODE; + } + + if (aq->api_maj_ver > 1 || + (aq->api_maj_ver == 1 && + aq->api_min_ver >= 9)) + hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_EXTENDED; +} + +/** * i40e_init_adminq - main initialization routine for Admin Queue * @hw: pointer to the hardware structure * @@ -575,21 +644,22 @@ static void i40e_resume_aq(struct i40e_hw *hw) **/ enum i40e_status_code i40e_init_adminq(struct i40e_hw *hw) { + struct i40e_adminq_info *aq = &hw->aq; + enum i40e_status_code ret_code; u16 cfg_ptr, oem_hi, oem_lo; u16 eetrack_lo, eetrack_hi; - enum i40e_status_code ret_code; int retry = 0; /* verify input for valid configuration */ - if ((hw->aq.num_arq_entries == 0) || - (hw->aq.num_asq_entries == 0) || - (hw->aq.arq_buf_size == 0) || - (hw->aq.asq_buf_size == 0)) { + if (aq->num_arq_entries == 0 || + aq->num_asq_entries == 0 || + aq->arq_buf_size == 0 || + aq->asq_buf_size == 0) { ret_code = I40E_ERR_CONFIG; goto init_adminq_exit; } - i40e_init_spinlock(&hw->aq.asq_spinlock); - i40e_init_spinlock(&hw->aq.arq_spinlock); + i40e_init_spinlock(&aq->asq_spinlock); + i40e_init_spinlock(&aq->arq_spinlock); /* Set up register offsets */ i40e_adminq_init_regs(hw); @@ -616,11 +686,11 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw */ do { ret_code = i40e_aq_get_firmware_version(hw, - &hw->aq.fw_maj_ver, - &hw->aq.fw_min_ver, - &hw->aq.fw_build, - &hw->aq.api_maj_ver, - &hw->aq.api_min_ver, + &aq->fw_maj_ver, + &aq->fw_min_ver, + &aq->fw_build, + &aq->api_maj_ver, + &aq->api_min_ver, NULL); if (ret_code != I40E_ERR_ADMIN_QUEUE_TIMEOUT) break; @@ -631,6 +701,12 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw if (ret_code != I40E_SUCCESS) goto init_adminq_free_arq; + /* + * Some features were introduced in different FW API version + * for different MAC type. + */ + i40e_set_hw_flags(hw); + /* get the NVM version info */ i40e_read_nvm_word(hw, I40E_SR_NVM_DEV_STARTER_VERSION, &hw->nvm.version); @@ -644,25 +720,7 @@ enum i40e_status_code i40e_init_adminq(struct i40e_hw &oem_lo); hw->nvm.oem_ver = ((u32)oem_hi << 16) | oem_lo; - /* The ability to RX (not drop) 802.1ad frames was added in API 1.7 */ - if ((hw->aq.api_maj_ver > 1) || - ((hw->aq.api_maj_ver == 1) && - (hw->aq.api_min_ver >= 7))) - hw->flags |= I40E_HW_FLAG_802_1AD_CAPABLE; - - if (hw->mac.type == I40E_MAC_XL710 && - hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && - hw->aq.api_min_ver >= I40E_MINOR_VER_GET_LINK_INFO_XL710) { - hw->flags |= I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE; - } - - /* Newer versions of firmware require lock when reading the NVM */ - if ((hw->aq.api_maj_ver > 1) || - ((hw->aq.api_maj_ver == 1) && - (hw->aq.api_min_ver >= 5))) - hw->flags |= I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; - - if (hw->aq.api_maj_ver > I40E_FW_API_VERSION_MAJOR) { + if (aq->api_maj_ver > I40E_FW_API_VERSION_MAJOR) { ret_code = I40E_ERR_FIRMWARE_API_VERSION; goto init_adminq_free_arq; } @@ -682,8 +740,8 @@ init_adminq_free_arq: init_adminq_free_asq: i40e_shutdown_asq(hw); init_adminq_destroy_spinlocks: - i40e_destroy_spinlock(&hw->aq.asq_spinlock); - i40e_destroy_spinlock(&hw->aq.arq_spinlock); + i40e_destroy_spinlock(&aq->asq_spinlock); + i40e_destroy_spinlock(&aq->arq_spinlock); init_adminq_exit: return ret_code; @@ -728,7 +786,7 @@ u16 i40e_clean_asq(struct i40e_hw *hw) desc = I40E_ADMINQ_DESC(*asq, ntc); details = I40E_ADMINQ_DETAILS(*asq, ntc); while (rd32(hw, hw->aq.asq.head) != ntc) { - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head)); if (details->callback) { @@ -808,7 +866,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40 if (val >= hw->aq.num_asq_entries) { i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: head overrun at %d\n", val); - status = I40E_ERR_QUEUE_EMPTY; + status = I40E_ERR_ADMIN_QUEUE_FULL; goto asq_send_command_error; } @@ -896,7 +954,7 @@ enum i40e_status_code i40e_asq_send_command(struct i40 } /* bump the tail */ - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQTX: desc and buffer:\n"); + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc_on_ring, buff, buff_size); (hw->aq.asq.next_to_use)++; @@ -942,12 +1000,14 @@ enum i40e_status_code i40e_asq_send_command(struct i40 cmd_completed = TRUE; if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_OK) status = I40E_SUCCESS; + else if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_EBUSY) + status = I40E_ERR_NOT_READY; else status = I40E_ERR_ADMIN_QUEUE_ERROR; hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval; } - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQTX: desc and buffer writeback:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, buff, buff_size); @@ -1063,7 +1123,7 @@ enum i40e_status_code i40e_clean_arq_element(struct i4 hw->aq.arq.r.arq_bi[desc_idx].va, e->msg_len, I40E_DMA_TO_NONDMA); - i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE, "AQRX: desc and buffer:\n"); + i40e_debug(hw, I40E_DEBUG_AQ_COMMAND, "AQRX: desc and buffer:\n"); i40e_debug_aq(hw, I40E_DEBUG_AQ_COMMAND, (void *)desc, e->msg_buf, hw->aq.arq_buf_size); Modified: stable/12/sys/dev/ixl/i40e_adminq_cmd.h ============================================================================== --- stable/12/sys/dev/ixl/i40e_adminq_cmd.h Tue Aug 4 23:09:15 2020 (r363875) +++ stable/12/sys/dev/ixl/i40e_adminq_cmd.h Tue Aug 4 23:30:10 2020 (r363876) @@ -43,8 +43,8 @@ #define I40E_FW_API_VERSION_MAJOR 0x0001 -#define I40E_FW_API_VERSION_MINOR_X722 0x0005 -#define I40E_FW_API_VERSION_MINOR_X710 0x0007 +#define I40E_FW_API_VERSION_MINOR_X722 0x000A +#define I40E_FW_API_VERSION_MINOR_X710 0x000A #define I40E_FW_MINOR_VERSION(_h) ((_h)->mac.type == I40E_MAC_XL710 ? \ I40E_FW_API_VERSION_MINOR_X710 : \ @@ -52,6 +52,12 @@ /* API version 1.7 implements additional link and PHY-specific APIs */ #define I40E_MINOR_VER_GET_LINK_INFO_XL710 0x0007 +/* API version 1.9 for X722 implements additional link and PHY-specific APIs */ +#define I40E_MINOR_VER_GET_LINK_INFO_X722 0x0009 +/* API version 1.6 for X722 devices adds ability to stop FW LLDP agent */ +#define I40E_MINOR_VER_FW_LLDP_STOPPABLE_X722 0x0006 +/* API version 1.10 for X722 devices adds ability to request FEC encoding */ +#define I40E_MINOR_VER_FW_REQUEST_FEC_X722 0x000A struct i40e_aq_desc { __le16 flags; @@ -204,6 +210,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_add_cloud_filters = 0x025C, i40e_aqc_opc_remove_cloud_filters = 0x025D, i40e_aqc_opc_clear_wol_switch_filters = 0x025E, + i40e_aqc_opc_replace_cloud_filters = 0x025F, i40e_aqc_opc_add_mirror_rule = 0x0260, i40e_aqc_opc_delete_mirror_rule = 0x0261, @@ -289,6 +296,7 @@ enum i40e_admin_queue_opc { i40e_aqc_opc_get_cee_dcb_cfg = 0x0A07, i40e_aqc_opc_lldp_set_local_mib = 0x0A08, i40e_aqc_opc_lldp_stop_start_spec_agent = 0x0A09, + i40e_aqc_opc_lldp_restore = 0x0A0A, /* Tunnel commands */ i40e_aqc_opc_add_udp_tunnel = 0x0B00, @@ -1382,14 +1390,17 @@ struct i40e_aqc_add_remove_cloud_filters { #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT 0 #define I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_MASK (0x3FF << \ I40E_AQC_ADD_CLOUD_CMD_SEID_NUM_SHIFT) - u8 reserved2[4]; + u8 big_buffer_flag; +#define I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER 1 +#define I40E_AQC_ADD_CLOUD_CMD_BB 1 + u8 reserved2[3]; __le32 addr_high; __le32 addr_low; }; I40E_CHECK_CMD_LENGTH(i40e_aqc_add_remove_cloud_filters); -struct i40e_aqc_add_remove_cloud_filters_element_data { +struct i40e_aqc_cloud_filters_element_data { u8 outer_mac[6]; u8 inner_mac[6]; __le16 inner_vlan; @@ -1401,13 +1412,16 @@ struct i40e_aqc_add_remove_cloud_filters_element_data struct { u8 data[16]; } v6; + struct { + __le16 data[8]; + } raw_v6; } ipaddr; __le16 flags; #define I40E_AQC_ADD_CLOUD_FILTER_SHIFT 0 #define I40E_AQC_ADD_CLOUD_FILTER_MASK (0x3F << \ I40E_AQC_ADD_CLOUD_FILTER_SHIFT) /* 0x0000 reserved */ -#define I40E_AQC_ADD_CLOUD_FILTER_OIP 0x0001 +/* 0x0001 reserved */ /* 0x0002 reserved */ #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN 0x0003 #define I40E_AQC_ADD_CLOUD_FILTER_IMAC_IVLAN_TEN_ID 0x0004 @@ -1419,6 +1433,13 @@ struct i40e_aqc_add_remove_cloud_filters_element_data #define I40E_AQC_ADD_CLOUD_FILTER_IMAC 0x000A #define I40E_AQC_ADD_CLOUD_FILTER_OMAC_TEN_ID_IMAC 0x000B #define I40E_AQC_ADD_CLOUD_FILTER_IIP 0x000C +/* 0x000D reserved */ +/* 0x000E reserved */ +/* 0x000F reserved */ +/* 0x0010 to 0x0017 is for custom filters */ +#define I40E_AQC_ADD_CLOUD_FILTER_IP_PORT 0x0010 /* Dest IP + L4 Port */ +#define I40E_AQC_ADD_CLOUD_FILTER_MAC_PORT 0x0011 /* Dest MAC + L4 Port */ +#define I40E_AQC_ADD_CLOUD_FILTER_MAC_VLAN_PORT 0x0012 /* Dest MAC + VLAN + L4 Port */ #define I40E_AQC_ADD_CLOUD_FLAGS_TO_QUEUE 0x0080 #define I40E_AQC_ADD_CLOUD_VNK_SHIFT 6 @@ -1453,6 +1474,88 @@ struct i40e_aqc_add_remove_cloud_filters_element_data u8 response_reserved[7]; }; +/* i40e_aqc_add_rm_cloud_filt_elem_ext is used when + * I40E_AQC_ADD_REM_CLOUD_CMD_BIG_BUFFER flag is set. + */ +struct i40e_aqc_add_rm_cloud_filt_elem_ext { + struct i40e_aqc_cloud_filters_element_data element; + u16 general_fields[32]; +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD0 0 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD1 1 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD2 2 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0 3 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1 4 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2 5 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD0 6 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD1 7 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD2 8 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD0 9 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD1 10 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD2 11 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD0 12 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD1 13 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD2 14 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD0 15 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD1 16 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD2 17 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD3 18 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD4 19 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD5 20 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD6 21 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD7 22 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD0 23 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD1 24 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD2 25 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD3 26 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD4 27 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD5 28 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD6 29 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD7 30 +}; + +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_cloud_filters_element_data); + +/* i40e_aqc_cloud_filters_element_bb is used when + * I40E_AQC_CLOUD_CMD_BB flag is set. + */ +struct i40e_aqc_cloud_filters_element_bb { + struct i40e_aqc_cloud_filters_element_data element; + u16 general_fields[32]; +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD0 0 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD1 1 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X10_WORD2 2 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD0 3 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD1 4 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X11_WORD2 5 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD0 6 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD1 7 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X12_WORD2 8 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD0 9 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD1 10 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X13_WORD2 11 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD0 12 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD1 13 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X14_WORD2 14 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD0 15 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD1 16 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD2 17 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD3 18 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD4 19 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD5 20 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD6 21 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X16_WORD7 22 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD0 23 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD1 24 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD2 25 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD3 26 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD4 27 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD5 28 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD6 29 +#define I40E_AQC_ADD_CLOUD_FV_FLU_0X17_WORD7 30 +}; + +I40E_CHECK_STRUCT_LEN(0x80, i40e_aqc_cloud_filters_element_bb); + struct i40e_aqc_remove_cloud_filters_completion { __le16 perfect_ovlan_used; __le16 perfect_ovlan_free; @@ -1464,6 +1567,61 @@ struct i40e_aqc_remove_cloud_filters_completion { I40E_CHECK_CMD_LENGTH(i40e_aqc_remove_cloud_filters_completion); +/* Replace filter Command 0x025F + * uses the i40e_aqc_replace_cloud_filters, + * and the generic indirect completion structure + */ +struct i40e_filter_data { + u8 filter_type; + u8 input[3]; +}; + +I40E_CHECK_STRUCT_LEN(4, i40e_filter_data); + +struct i40e_aqc_replace_cloud_filters_cmd { + u8 valid_flags; +#define I40E_AQC_REPLACE_L1_FILTER 0x0 +#define I40E_AQC_REPLACE_CLOUD_FILTER 0x1 +#define I40E_AQC_GET_CLOUD_FILTERS 0x2 +#define I40E_AQC_MIRROR_CLOUD_FILTER 0x4 +#define I40E_AQC_HIGH_PRIORITY_CLOUD_FILTER 0x8 + u8 old_filter_type; + u8 new_filter_type; + u8 tr_bit; + u8 tr_bit2; + u8 reserved[3]; + __le32 addr_high; + __le32 addr_low; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_replace_cloud_filters_cmd); + +struct i40e_aqc_replace_cloud_filters_cmd_buf { + u8 data[32]; +/* Filter type INPUT codes*/ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_ENTRIES_MAX 3 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED (1 << 7UL) + +/* Field Vector offsets */ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_MAC_DA 0 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_ETH 6 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG 7 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_VLAN 8 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_OVLAN 9 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_IVLAN 10 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TUNNLE_KEY 11 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IMAC 12 +/* big FLU */ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_IP_DA 14 +/* big FLU */ +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_OIP_DA 15 + +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_INNER_VLAN 37 + struct i40e_filter_data filters[8]; +}; + +I40E_CHECK_STRUCT_LEN(0x40, i40e_aqc_replace_cloud_filters_cmd_buf); + /* Add Mirror Rule (indirect or direct 0x0260) * Delete Mirror Rule (indirect or direct 0x0261) * note: some rule types (4,5) do not use an external buffer. @@ -1865,6 +2023,7 @@ struct i40e_aq_get_phy_abilities_resp { #define I40E_AQ_PHY_FEC_ABILITY_KR 0x40 #define I40E_AQ_PHY_FEC_ABILITY_RS 0x80 __le16 eee_capability; +#define I40E_AQ_EEE_AUTO 0x0001 #define I40E_AQ_EEE_100BASE_TX 0x0002 #define I40E_AQ_EEE_1000BASE_T 0x0004 #define I40E_AQ_EEE_10GBASE_T 0x0008 @@ -1931,20 +2090,21 @@ I40E_CHECK_CMD_LENGTH(i40e_aq_set_phy_config); struct i40e_aq_set_mac_config { __le16 max_frame_size; u8 params; -#define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04 -#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78 -#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3 -#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0 -#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF -#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9 -#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8 -#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7 -#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6 -#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5 -#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4 -#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3 -#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2 -#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1 +#define I40E_AQ_SET_MAC_CONFIG_CRC_EN 0x04 +#define I40E_AQ_SET_MAC_CONFIG_PACING_MASK 0x78 +#define I40E_AQ_SET_MAC_CONFIG_PACING_SHIFT 3 +#define I40E_AQ_SET_MAC_CONFIG_PACING_NONE 0x0 +#define I40E_AQ_SET_MAC_CONFIG_PACING_1B_13TX 0xF +#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_9TX 0x9 +#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_4TX 0x8 +#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_7TX 0x7 +#define I40E_AQ_SET_MAC_CONFIG_PACING_2DW_3TX 0x6 +#define I40E_AQ_SET_MAC_CONFIG_PACING_1DW_1TX 0x5 +#define I40E_AQ_SET_MAC_CONFIG_PACING_3DW_2TX 0x4 +#define I40E_AQ_SET_MAC_CONFIG_PACING_7DW_3TX 0x3 +#define I40E_AQ_SET_MAC_CONFIG_PACING_4DW_1TX 0x2 +#define I40E_AQ_SET_MAC_CONFIG_PACING_9DW_1TX 0x1 +#define I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN 0x80 u8 tx_timer_priority; /* bitmap */ __le16 tx_timer_value; __le16 fc_refresh_threshold; @@ -2077,8 +2237,8 @@ struct i40e_aqc_set_lb_mode { #define I40E_AQ_LB_SERDES 2 #define I40E_AQ_LB_PHY_INT 3 #define I40E_AQ_LB_PHY_EXT 4 -#define I40E_AQ_LB_CPVL_PCS 5 -#define I40E_AQ_LB_CPVL_EXT 6 +#define I40E_AQ_LB_BASE_T_PCS 5 +#define I40E_AQ_LB_BASE_T_EXT 6 #define I40E_AQ_LB_PHY_LOCAL 0x01 #define I40E_AQ_LB_PHY_REMOTE 0x02 #define I40E_AQ_LB_MAC_LOCAL 0x04 @@ -2142,7 +2302,13 @@ struct i40e_aqc_phy_register_access { #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL 1 #define I40E_AQ_PHY_REG_ACCESS_EXTERNAL_MODULE 2 u8 dev_addres; - u8 reserved1[2]; + u8 cmd_flags; +#define I40E_AQ_PHY_REG_ACCESS_DONT_CHANGE_QSFP_PAGE 0x01 +#define I40E_AQ_PHY_REG_ACCESS_SET_MDIO_IF_NUMBER 0x02 +#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT 2 +#define I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_MASK (0x3 << \ + I40E_AQ_PHY_REG_ACCESS_MDIO_IF_NUMBER_SHIFT) + u8 reserved1; __le32 reg_address; __le32 reg_value; u8 reserved2[4]; @@ -2157,6 +2323,8 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_phy_register_access); struct i40e_aqc_nvm_update { u8 command_flags; #define I40E_AQ_NVM_LAST_CMD 0x01 +#define I40E_AQ_NVM_REARRANGE_TO_FLAT 0x20 +#define I40E_AQ_NVM_REARRANGE_TO_STRUCT 0x40 #define I40E_AQ_NVM_FLASH_ONLY 0x80 #define I40E_AQ_NVM_PRESERVATION_FLAGS_SHIFT 1 #define I40E_AQ_NVM_PRESERVATION_FLAGS_MASK 0x03 @@ -2404,18 +2572,19 @@ I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_update_tlv); /* Stop LLDP (direct 0x0A05) */ struct i40e_aqc_lldp_stop { u8 command; -#define I40E_AQ_LLDP_AGENT_STOP 0x0 -#define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1 +#define I40E_AQ_LLDP_AGENT_STOP 0x0 +#define I40E_AQ_LLDP_AGENT_SHUTDOWN 0x1 +#define I40E_AQ_LLDP_AGENT_STOP_PERSIST 0x2 u8 reserved[15]; }; I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop); /* Start LLDP (direct 0x0A06) */ - struct i40e_aqc_lldp_start { u8 command; -#define I40E_AQ_LLDP_AGENT_START 0x1 +#define I40E_AQ_LLDP_AGENT_START 0x1 +#define I40E_AQ_LLDP_AGENT_START_PERSIST 0x2 u8 reserved[15]; }; @@ -2534,6 +2703,16 @@ struct i40e_aqc_lldp_stop_start_specific_agent { }; I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_stop_start_specific_agent); + +/* Restore LLDP Agent factory settings (direct 0x0A0A) */ +struct i40e_aqc_lldp_restore { + u8 command; +#define I40E_AQ_LLDP_AGENT_RESTORE_NOT 0x0 +#define I40E_AQ_LLDP_AGENT_RESTORE 0x1 + u8 reserved[15]; +}; + +I40E_CHECK_CMD_LENGTH(i40e_aqc_lldp_restore); /* Add Udp Tunnel command and completion (direct 0x0B00) */ struct i40e_aqc_add_udp_tunnel { Modified: stable/12/sys/dev/ixl/i40e_common.c ============================================================================== --- stable/12/sys/dev/ixl/i40e_common.c Tue Aug 4 23:09:15 2020 (r363875) +++ stable/12/sys/dev/ixl/i40e_common.c Tue Aug 4 23:30:10 2020 (r363876) @@ -66,6 +66,8 @@ enum i40e_status_code i40e_set_mac_type(struct i40e_hw case I40E_DEV_ID_20G_KR2_A: case I40E_DEV_ID_25G_B: case I40E_DEV_ID_25G_SFP28: + case I40E_DEV_ID_X710_N3000: + case I40E_DEV_ID_XXV710_N3000: hw->mac.type = I40E_MAC_XL710; break; case I40E_DEV_ID_KX_X722: @@ -319,32 +321,37 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug void *buffer, u16 buf_len) { struct i40e_aq_desc *aq_desc = (struct i40e_aq_desc *)desc; + u32 effective_mask = hw->debug_mask & mask; u8 *buf = (u8 *)buffer; u16 len; - u16 i = 0; + u16 i; - if ((!(mask & hw->debug_mask)) || (desc == NULL)) + if (!effective_mask || !desc) return; len = LE16_TO_CPU(aq_desc->datalen); - i40e_debug(hw, mask, + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, "AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n", LE16_TO_CPU(aq_desc->opcode), LE16_TO_CPU(aq_desc->flags), LE16_TO_CPU(aq_desc->datalen), LE16_TO_CPU(aq_desc->retval)); - i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n", + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, + "\tcookie (h,l) 0x%08X 0x%08X\n", LE32_TO_CPU(aq_desc->cookie_high), LE32_TO_CPU(aq_desc->cookie_low)); - i40e_debug(hw, mask, "\tparam (0,1) 0x%08X 0x%08X\n", + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, + "\tparam (0,1) 0x%08X 0x%08X\n", LE32_TO_CPU(aq_desc->params.internal.param0), LE32_TO_CPU(aq_desc->params.internal.param1)); - i40e_debug(hw, mask, "\taddr (h,l) 0x%08X 0x%08X\n", + i40e_debug(hw, mask & I40E_DEBUG_AQ_DESCRIPTOR, + "\taddr (h,l) 0x%08X 0x%08X\n", LE32_TO_CPU(aq_desc->params.external.addr_high), LE32_TO_CPU(aq_desc->params.external.addr_low)); - if ((buffer != NULL) && (aq_desc->datalen != 0)) { + if (buffer && (buf_len != 0) && (len != 0) && + (effective_mask & I40E_DEBUG_AQ_DESC_BUFFER)) { i40e_debug(hw, mask, "AQ CMD Buffer:\n"); if (buf_len < len) len = buf_len; @@ -1011,10 +1018,18 @@ enum i40e_status_code i40e_init_shared_code(struct i40 else hw->pf_id = (u8)(func_rid & 0x7); - if (hw->mac.type == I40E_MAC_X722) - hw->flags |= I40E_HW_FLAG_AQ_SRCTL_ACCESS_ENABLE | - I40E_HW_FLAG_NVM_READ_REQUIRES_LOCK; + /* NVMUpdate features structure initialization */ + hw->nvmupd_features.major = I40E_NVMUPD_FEATURES_API_VER_MAJOR; + hw->nvmupd_features.minor = I40E_NVMUPD_FEATURES_API_VER_MINOR; + hw->nvmupd_features.size = sizeof(hw->nvmupd_features); + i40e_memset(hw->nvmupd_features.features, 0x0, + I40E_NVMUPD_FEATURES_API_FEATURES_ARRAY_LEN * + sizeof(*hw->nvmupd_features.features), + I40E_NONDMA_MEM); + /* No features supported at the moment */ + hw->nvmupd_features.features[0] = 0; + status = i40e_init_nvm(hw); return status; } @@ -1272,6 +1287,29 @@ static enum i40e_media_type i40e_get_media_type(struct return media; } +/** + * i40e_poll_globr - Poll for Global Reset completion + * @hw: pointer to the hardware structure + * @retry_limit: how many times to retry before failure + **/ +static enum i40e_status_code i40e_poll_globr(struct i40e_hw *hw, + u32 retry_limit) +{ + u32 cnt, reg = 0; + + for (cnt = 0; cnt < retry_limit; cnt++) { + reg = rd32(hw, I40E_GLGEN_RSTAT); + if (!(reg & I40E_GLGEN_RSTAT_DEVSTATE_MASK)) + return I40E_SUCCESS; + i40e_msec_delay(100); + } + + DEBUGOUT("Global reset failed.\n"); + DEBUGOUT1("I40E_GLGEN_RSTAT = 0x%x\n", reg); + + return I40E_ERR_RESET_FAILED; +} + #define I40E_PF_RESET_WAIT_COUNT 200 /** * i40e_pf_reset - Reset the PF @@ -1295,7 +1333,7 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw I40E_GLGEN_RSTCTL_GRSTDEL_MASK) >> I40E_GLGEN_RSTCTL_GRSTDEL_SHIFT; - grst_del = grst_del * 20; + grst_del = min(grst_del * 20, 160U); for (cnt = 0; cnt < grst_del; cnt++) { reg = rd32(hw, I40E_GLGEN_RSTAT); @@ -1341,14 +1379,14 @@ enum i40e_status_code i40e_pf_reset(struct i40e_hw *hw if (!(reg & I40E_PFGEN_CTRL_PFSWR_MASK)) break; reg2 = rd32(hw, I40E_GLGEN_RSTAT); - if (reg2 & I40E_GLGEN_RSTAT_DEVSTATE_MASK) { - DEBUGOUT("Core reset upcoming. Skipping PF reset request.\n"); - DEBUGOUT1("I40E_GLGEN_RSTAT = 0x%x\n", reg2); - return I40E_ERR_NOT_READY; - } + if (reg2 & I40E_GLGEN_RSTAT_DEVSTATE_MASK) + break; i40e_msec_delay(1); } - if (reg & I40E_PFGEN_CTRL_PFSWR_MASK) { + if (reg2 & I40E_GLGEN_RSTAT_DEVSTATE_MASK) { + if (i40e_poll_globr(hw, grst_del) != I40E_SUCCESS) + return I40E_ERR_RESET_FAILED; + } else if (reg & I40E_PFGEN_CTRL_PFSWR_MASK) { DEBUGOUT("PF reset polling failed to complete.\n"); return I40E_ERR_RESET_FAILED; } @@ -1480,7 +1518,6 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int id if (!hw->func_caps.led[idx]) return 0; - gpio_val = rd32(hw, I40E_GLGEN_GPIO_CTL(idx)); port = (gpio_val & I40E_GLGEN_GPIO_CTL_PRT_NUM_MASK) >> I40E_GLGEN_GPIO_CTL_PRT_NUM_SHIFT; @@ -1499,8 +1536,15 @@ static u32 i40e_led_is_mine(struct i40e_hw *hw, int id #define I40E_FILTER_ACTIVITY 0xE #define I40E_LINK_ACTIVITY 0xC #define I40E_MAC_ACTIVITY 0xD +#define I40E_FW_LED BIT(4) +#define I40E_LED_MODE_VALID (I40E_GLGEN_GPIO_CTL_LED_MODE_MASK >> \ + I40E_GLGEN_GPIO_CTL_LED_MODE_SHIFT) + #define I40E_LED0 22 +#define I40E_PIN_FUNC_SDP 0x0 +#define I40E_PIN_FUNC_LED 0x1 + /** * i40e_led_get - return current on/off mode * @hw: pointer to the hw struct @@ -1562,8 +1606,10 @@ void i40e_led_set(struct i40e_hw *hw, u32 mode, bool b u32 current_mode = 0; int i; - if (mode & 0xfffffff0) + if (mode & ~I40E_LED_MODE_VALID) { DEBUGOUT1("invalid mode passed in %X\n", mode); + return; + } /* as per the documentation GPIO 22-29 are the LED * GPIO pins named LED0..LED7 @@ -1648,20 +1694,23 @@ enum i40e_status_code i40e_aq_get_phy_capabilities(str status = i40e_asq_send_command(hw, &desc, abilities, abilities_size, cmd_details); - if (status != I40E_SUCCESS) - break; - - if (hw->aq.asq_last_status == I40E_AQ_RC_EIO) { + switch (hw->aq.asq_last_status) { + case I40E_AQ_RC_EIO: status = I40E_ERR_UNKNOWN_PHY; break; - } else if (hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) { + case I40E_AQ_RC_EAGAIN: i40e_msec_delay(1); total_delay++; status = I40E_ERR_TIMEOUT; + break; + /* also covers I40E_AQ_RC_OK */ + default: + break; } - } while ((hw->aq.asq_last_status != I40E_AQ_RC_OK) && - (total_delay < max_delay)); + } while ((hw->aq.asq_last_status == I40E_AQ_RC_EAGAIN) && + (total_delay < max_delay)); + if (status != I40E_SUCCESS) return status; @@ -1803,6 +1852,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, * @max_frame_size: Maximum Frame Size to be supported by the port * @crc_en: Tell HW to append a CRC to outgoing frames * @pacing: Pacing configurations + * @auto_drop_blocking_packets: Tell HW to drop packets if TC queue is blocked * @cmd_details: pointer to command details structure or NULL * * Configure MAC settings for frame size, jumbo frame support and the @@ -1811,6 +1861,7 @@ enum i40e_status_code i40e_set_fc(struct i40e_hw *hw, enum i40e_status_code i40e_aq_set_mac_config(struct i40e_hw *hw, u16 max_frame_size, bool crc_en, u16 pacing, + bool auto_drop_blocking_packets, struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; @@ -1829,6 +1880,19 @@ enum i40e_status_code i40e_aq_set_mac_config(struct i4 if (crc_en) cmd->params |= I40E_AQ_SET_MAC_CONFIG_CRC_EN; + if (auto_drop_blocking_packets) { + if (hw->flags & I40E_HW_FLAG_DROP_MODE) + cmd->params |= + I40E_AQ_SET_MAC_CONFIG_DROP_BLOCKING_PACKET_EN; + else + i40e_debug(hw, I40E_DEBUG_ALL, + "This FW api version does not support drop mode.\n"); + } + +#define I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD 0x7FFF + cmd->fc_refresh_threshold = + CPU_TO_LE16(I40E_AQ_SET_MAC_CONFIG_FC_DEFAULT_THRESHOLD); + status = i40e_asq_send_command(hw, &desc, NULL, 0, cmd_details); return status; @@ -1969,8 +2033,8 @@ enum i40e_status_code i40e_aq_get_link_info(struct i40 hw->aq.fw_min_ver < 40)) && hw_link_info->phy_type == 0xE) hw_link_info->phy_type = I40E_PHY_TYPE_10GBASE_SFPP_CU; - if (hw->aq.api_maj_ver == I40E_FW_API_VERSION_MAJOR && - hw->aq.api_min_ver >= 7) { + if (hw->flags & I40E_HW_FLAG_AQ_PHY_ACCESS_CAPABLE && + hw->mac.type != I40E_MAC_X722) { __le32 tmp; i40e_memcpy(&tmp, resp->link_type, sizeof(tmp), @@ -2198,7 +2262,7 @@ enum i40e_status_code i40e_aq_add_vsi(struct i40e_hw * desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); status = i40e_asq_send_command(hw, &desc, &vsi_ctx->info, - sizeof(vsi_ctx->info), cmd_details); + sizeof(vsi_ctx->info), cmd_details); if (status != I40E_SUCCESS) goto aq_add_vsi_exit; @@ -2615,7 +2679,7 @@ enum i40e_status_code i40e_aq_update_vsi_params(struct desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); status = i40e_asq_send_command(hw, &desc, &vsi_ctx->info, - sizeof(vsi_ctx->info), cmd_details); + sizeof(vsi_ctx->info), cmd_details); vsi_ctx->vsis_allocated = LE16_TO_CPU(resp->vsi_used); vsi_ctx->vsis_unallocated = LE16_TO_CPU(resp->vsi_free); @@ -2830,9 +2894,16 @@ enum i40e_status_code i40e_update_link_info(struct i40 if (status) return status; - hw->phy.link_info.req_fec_info = - abilities.fec_cfg_curr_mod_ext_info & - (I40E_AQ_REQUEST_FEC_KR | I40E_AQ_REQUEST_FEC_RS); + if (abilities.fec_cfg_curr_mod_ext_info & + I40E_AQ_ENABLE_FEC_AUTO) + hw->phy.link_info.req_fec_info = + (I40E_AQ_REQUEST_FEC_KR | + I40E_AQ_REQUEST_FEC_RS); + else + hw->phy.link_info.req_fec_info = + abilities.fec_cfg_curr_mod_ext_info & + (I40E_AQ_REQUEST_FEC_KR | + I40E_AQ_REQUEST_FEC_RS); i40e_memcpy(hw->phy.link_info.module_type, &abilities.module_type, sizeof(hw->phy.link_info.module_type), I40E_NONDMA_TO_NONDMA); @@ -4209,7 +4280,7 @@ enum i40e_status_code i40e_aq_set_lldp_mib(struct i40e cmd->type = mib_type; cmd->length = CPU_TO_LE16(buff_size); - cmd->address_high = CPU_TO_LE32(I40E_HI_WORD((u64)buff)); + cmd->address_high = CPU_TO_LE32(I40E_HI_DWORD((u64)buff)); cmd->address_low = CPU_TO_LE32(I40E_LO_DWORD((u64)buff)); status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details); @@ -4245,164 +4316,54 @@ enum i40e_status_code i40e_aq_cfg_lldp_mib_change_even } /** - * i40e_aq_add_lldp_tlv + * i40e_aq_restore_lldp * @hw: pointer to the hw struct - * @bridge_type: type of bridge - * @buff: buffer with TLV to add - * @buff_size: length of the buffer - * @tlv_len: length of the TLV to be added - * @mib_len: length of the LLDP MIB returned in response + * @setting: pointer to factory setting variable or NULL + * @restore: True if factory settings should be restored * @cmd_details: pointer to command details structure or NULL * - * Add the specified TLV to LLDP Local MIB for the given bridge type, - * it is responsibility of the caller to make sure that the TLV is not - * already present in the LLDPDU. - * In return firmware will write the complete LLDP MIB with the newly - * added TLV in the response buffer. + * Restore LLDP Agent factory settings if @restore set to True. In other case + * only returns factory setting in AQ response. **/ -enum i40e_status_code i40e_aq_add_lldp_tlv(struct i40e_hw *hw, u8 bridge_type, - void *buff, u16 buff_size, u16 tlv_len, - u16 *mib_len, - struct i40e_asq_cmd_details *cmd_details) +enum i40e_status_code +i40e_aq_restore_lldp(struct i40e_hw *hw, u8 *setting, bool restore, + struct i40e_asq_cmd_details *cmd_details) { struct i40e_aq_desc desc; - struct i40e_aqc_lldp_add_tlv *cmd = - (struct i40e_aqc_lldp_add_tlv *)&desc.params.raw; + struct i40e_aqc_lldp_restore *cmd = + (struct i40e_aqc_lldp_restore *)&desc.params.raw; enum i40e_status_code status; - if (buff_size == 0 || !buff || tlv_len == 0) - return I40E_ERR_PARAM; - - i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_lldp_add_tlv); - - /* Indirect Command */ - desc.flags |= CPU_TO_LE16((u16)(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD)); - if (buff_size > I40E_AQ_LARGE_BUF) - desc.flags |= CPU_TO_LE16((u16)I40E_AQ_FLAG_LB); - desc.datalen = CPU_TO_LE16(buff_size); - - cmd->type = ((bridge_type << I40E_AQ_LLDP_BRIDGE_TYPE_SHIFT) & - I40E_AQ_LLDP_BRIDGE_TYPE_MASK); - cmd->len = CPU_TO_LE16(tlv_len); - - status = i40e_asq_send_command(hw, &desc, buff, buff_size, cmd_details); - if (!status) { - if (mib_len != NULL) - *mib_len = LE16_TO_CPU(desc.datalen); + if (!(hw->flags & I40E_HW_FLAG_FW_LLDP_PERSISTENT)) { + i40e_debug(hw, I40E_DEBUG_ALL, + "Restore LLDP not supported by current FW version.\n"); + return I40E_ERR_DEVICE_NOT_SUPPORTED; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Wed Aug 5 01:43:40 2020 Return-Path: Delivered-To: svn-src-stable@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 E13D53A5843; Wed, 5 Aug 2020 01:43:40 +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 4BLvXr5g56z47b2; Wed, 5 Aug 2020 01:43:40 +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 A638DEC0E; Wed, 5 Aug 2020 01:43:40 +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 0751heav024929; Wed, 5 Aug 2020 01:43:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0751hePL024928; Wed, 5 Aug 2020 01:43:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008050143.0751hePL024928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 5 Aug 2020 01:43:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363877 - in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 363877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 01:43:41 -0000 Author: mav Date: Wed Aug 5 01:43:40 2020 New Revision: 363877 URL: https://svnweb.freebsd.org/changeset/base/363877 Log: MFC r363431: Untie nmi_handle_intr() from DEV_ISA. The only part of nmi_handle_intr() depending on ISA is isa_nmi(), which is already wrapped. Entering debugger on NMI does not really depend on ISA. Modified: stable/12/sys/amd64/amd64/trap.c stable/12/sys/i386/i386/trap.c Modified: stable/12/sys/amd64/amd64/trap.c ============================================================================== --- stable/12/sys/amd64/amd64/trap.c Tue Aug 4 23:30:10 2020 (r363876) +++ stable/12/sys/amd64/amd64/trap.c Wed Aug 5 01:43:40 2020 (r363877) @@ -357,11 +357,9 @@ trap(struct trapframe *frame) signo = SIGFPE; break; -#ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); return; -#endif case T_OFLOW: /* integer overflow fault */ ucode = FPE_INTOVF; @@ -587,11 +585,9 @@ trap(struct trapframe *frame) #endif break; -#ifdef DEV_ISA case T_NMI: nmi_handle_intr(type, frame); return; -#endif } trap_fatal(frame, 0); Modified: stable/12/sys/i386/i386/trap.c ============================================================================== --- stable/12/sys/i386/i386/trap.c Tue Aug 4 23:30:10 2020 (r363876) +++ stable/12/sys/i386/i386/trap.c Wed Aug 5 01:43:40 2020 (r363877) @@ -413,7 +413,6 @@ user_trctrap_out: signo = SIGFPE; break; -#ifdef DEV_ISA case T_NMI: #ifdef POWERFAIL_NMI #ifndef TIMER_FREQ @@ -429,7 +428,6 @@ user_trctrap_out: nmi_handle_intr(type, frame); return; #endif /* POWERFAIL_NMI */ -#endif /* DEV_ISA */ case T_OFLOW: /* integer overflow fault */ ucode = FPE_INTOVF; @@ -675,7 +673,6 @@ kernel_trctrap: #endif break; -#ifdef DEV_ISA case T_NMI: #ifdef POWERFAIL_NMI if (time_second - lastalert > 10) { @@ -688,7 +685,6 @@ kernel_trctrap: nmi_handle_intr(type, frame); return; #endif /* POWERFAIL_NMI */ -#endif /* DEV_ISA */ } trap_fatal(frame, eva); From owner-svn-src-stable@freebsd.org Wed Aug 5 03:30:04 2020 Return-Path: Delivered-To: svn-src-stable@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 87F6D3A8B42; Wed, 5 Aug 2020 03:30: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 4BLxvc2vs0z4F0t; Wed, 5 Aug 2020 03:30: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 472F0FD92; Wed, 5 Aug 2020 03:30: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 0753U4hl088147; Wed, 5 Aug 2020 03:30:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0753U4p0088146; Wed, 5 Aug 2020 03:30:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008050330.0753U4p0088146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 5 Aug 2020 03:30:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363878 - stable/12/sys/bsm X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/bsm X-SVN-Commit-Revision: 363878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 03:30:04 -0000 Author: kevans Date: Wed Aug 5 03:30:03 2020 New Revision: 363878 URL: https://svnweb.freebsd.org/changeset/base/363878 Log: MFC r360235: bsm: add AUE_CLOSERANGE Modified: stable/12/sys/bsm/audit_kevents.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/bsm/audit_kevents.h ============================================================================== --- stable/12/sys/bsm/audit_kevents.h Wed Aug 5 01:43:40 2020 (r363877) +++ stable/12/sys/bsm/audit_kevents.h Wed Aug 5 03:30:03 2020 (r363878) @@ -644,6 +644,7 @@ #define AUE_SETLOGINCLASS 43238 /* FreeBSD-specific. */ #define AUE_POSIX_FADVISE 43239 /* FreeBSD-specific. */ #define AUE_SCTP_GENERIC_SENDMSG_IOV 43240 /* FreeBSD-specific. */ +#define AUE_CLOSERANGE 43265 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the From owner-svn-src-stable@freebsd.org Wed Aug 5 03:54:02 2020 Return-Path: Delivered-To: svn-src-stable@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 805DE3A9524; Wed, 5 Aug 2020 03:54: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 4BLyRG39N1z4GLg; Wed, 5 Aug 2020 03:54:02 +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 4FF58104E9; Wed, 5 Aug 2020 03:54:02 +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 0753s2X9006358; Wed, 5 Aug 2020 03:54:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0753rv6L006334; Wed, 5 Aug 2020 03:53:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008050353.0753rv6L006334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 5 Aug 2020 03:53:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363879 - in stable/12: include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/file X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: include lib/libc/sys sys/compat/freebsd32 sys/kern sys/sys tests/sys/file X-SVN-Commit-Revision: 363879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 03:54:02 -0000 Author: kevans Date: Wed Aug 5 03:53:57 2020 New Revision: 363879 URL: https://svnweb.freebsd.org/changeset/base/363879 Log: MFC r359836-r359837, r359891, r360236-r360237: close_range(2) This commit diverges from our usual procedure of committing generated files separately because the original commit, r359836, conflated userland use (in tests) with the implementation. __FreeBSD_version was already bumped ~15 hours prior to this MFC, 1201522 marks the introduction of close_range. CPython will use this syscall for some pretty sizable performance gains. r359836: Implement a close_range(2) syscall close_range(min, max, flags) allows for a range of descriptors to be closed. The Python folk have indicated that they would much prefer this interface to closefrom(2), as the case may be that they/someone have special fds dup'd to higher in the range and they can't necessarily closefrom(min) because they don't want to hit the upper range, but relocating them to lower isn't necessarily feasible. sys_closefrom has been rewritten to use kern_close_range() using ~0U to indicate closing to the end of the range. This was chosen rather than requiring callers of kern_close_range() to hold FILEDESC_SLOCK across the call to kern_close_range for simplicity. The flags argument of close_range(2) is currently unused, so any flags set is currently EINVAL. It was added to the interface in Linux so that future flags could be added for, e.g., "halt on first error" and things of this nature. This patch is based on a syscall of the same design that is expected to be merged into Linux. r359837: sysent: re-roll after introduction of close_range in r359836 r359891: close_range/closefrom: fix regression from close_range introduction close_range will clamp the range between [0, fdp->fd_lastfile], but failed to take into account that fdp->fd_lastfile can become -1 if all fds are closed. =-( In this scenario, just return because there's nothing further we can do at the moment. Add a test case for this, fork() and simply closefrom(0) twice in the child; on the second invocation, fdp->fd_lastfile == -1 and will trigger a panic before this change. r360236: close_range(2): use newly assigned AUE_CLOSERANGE r360237: sysent: re-roll after 360236 (AUE_CLOSERANGE used) Modified: stable/12/include/unistd.h stable/12/lib/libc/sys/Makefile.inc stable/12/lib/libc/sys/Symbol.map stable/12/lib/libc/sys/closefrom.2 stable/12/sys/compat/freebsd32/freebsd32_syscall.h stable/12/sys/compat/freebsd32/freebsd32_syscalls.c stable/12/sys/compat/freebsd32/freebsd32_sysent.c stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c stable/12/sys/compat/freebsd32/syscalls.master stable/12/sys/kern/capabilities.conf stable/12/sys/kern/init_sysent.c stable/12/sys/kern/kern_descrip.c stable/12/sys/kern/syscalls.c stable/12/sys/kern/syscalls.master stable/12/sys/kern/systrace_args.c stable/12/sys/sys/syscall.h stable/12/sys/sys/syscall.mk stable/12/sys/sys/syscallsubr.h stable/12/sys/sys/sysproto.h stable/12/tests/sys/file/closefrom_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/include/unistd.h ============================================================================== --- stable/12/include/unistd.h Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/include/unistd.h Wed Aug 5 03:53:57 2020 (r363879) @@ -494,6 +494,7 @@ struct crypt_data { int acct(const char *); int async_daemon(void); int check_utility_compat(const char *); +int close_range(unsigned int, unsigned int, int); const char * crypt_get_format(void); char *crypt_r(const char *, const char *, struct crypt_data *); Modified: stable/12/lib/libc/sys/Makefile.inc ============================================================================== --- stable/12/lib/libc/sys/Makefile.inc Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/lib/libc/sys/Makefile.inc Wed Aug 5 03:53:57 2020 (r363879) @@ -372,6 +372,7 @@ MLINKS+=chown.2 fchown.2 \ chown.2 lchown.2 MLINKS+=clock_gettime.2 clock_getres.2 \ clock_gettime.2 clock_settime.2 +MLINKS+=closefrom.2 close_range.2 MLINKS+=nanosleep.2 clock_nanosleep.2 MLINKS+=cpuset.2 cpuset_getid.2 \ cpuset.2 cpuset_setid.2 Modified: stable/12/lib/libc/sys/Symbol.map ============================================================================== --- stable/12/lib/libc/sys/Symbol.map Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/lib/libc/sys/Symbol.map Wed Aug 5 03:53:57 2020 (r363879) @@ -402,6 +402,7 @@ FBSD_1.5 { }; FBSD_1.6 { + close_range; fhlink; fhlinkat; fhreadlink; Modified: stable/12/lib/libc/sys/closefrom.2 ============================================================================== --- stable/12/lib/libc/sys/closefrom.2 Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/lib/libc/sys/closefrom.2 Wed Aug 5 03:53:57 2020 (r363879) @@ -25,11 +25,12 @@ .\" .\" $FreeBSD$ .\" -.Dd June 12, 2009 +.Dd April 12, 2020 .Dt CLOSEFROM 2 .Os .Sh NAME -.Nm closefrom +.Nm closefrom , +.Nm close_range .Nd delete open file descriptors .Sh LIBRARY .Lb libc @@ -37,6 +38,8 @@ .In unistd.h .Ft void .Fn closefrom "int lowfd" +.Ft int +.Fn close_range "u_int lowfd" "u_int highfd" "int flags" .Sh DESCRIPTION The .Fn closefrom @@ -44,6 +47,40 @@ system call deletes all open file descriptors greater .Fa lowfd from the per-process object reference table. Any errors encountered while closing file descriptors are ignored. +.Pp +The +.Fn close_range +system call deletes all open file descriptors between +.Fa lowfd +and +.Fa highfd +inclusive, clamped to the range of open file descriptors. +Any errors encountered while closing file descriptors are ignored. +There are currently no defined +.Fa flags . +.Sh RETURN VALUES +Upon successful completion, +.Fn close_range +returns a value +of 0. +Otherwise, a value of -1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh ERRORS +The +.Fn close_range +system call +will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Fa highfd +argument is lower than the +.Fa lowfd +argument. +.It Bq Er EINVAL +An invalid flag was set. +.El .Sh SEE ALSO .Xr close 2 .Sh HISTORY Modified: stable/12/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_syscall.h Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/compat/freebsd32/freebsd32_syscall.h Wed Aug 5 03:53:57 2020 (r363879) @@ -495,4 +495,5 @@ #define FREEBSD32_SYS_fhlinkat 566 #define FREEBSD32_SYS_fhreadlink 567 #define FREEBSD32_SYS_freebsd32___sysctlbyname 570 -#define FREEBSD32_SYS_MAXSYSCALL 571 +#define FREEBSD32_SYS_close_range 575 +#define FREEBSD32_SYS_MAXSYSCALL 576 Modified: stable/12/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_syscalls.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/compat/freebsd32/freebsd32_syscalls.c Wed Aug 5 03:53:57 2020 (r363879) @@ -607,4 +607,9 @@ const char *freebsd32_syscallnames[] = { "#568", /* 568 = funlinkat */ "#569", /* 569 = copy_file_range */ "freebsd32___sysctlbyname", /* 570 = freebsd32___sysctlbyname */ + "#571", /* 571 = shm_open2 */ + "#572", /* 572 = shm_rename */ + "#573", /* 573 = sigfastblock */ + "#574", /* 574 = __realpathat */ + "close_range", /* 575 = close_range */ }; Modified: stable/12/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_sysent.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/compat/freebsd32/freebsd32_sysent.c Wed Aug 5 03:53:57 2020 (r363879) @@ -654,4 +654,9 @@ struct sysent freebsd32_sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 568 = funlinkat */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 569 = copy_file_range */ { AS(freebsd32___sysctlbyname_args), (sy_call_t *)freebsd32___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 570 = freebsd32___sysctlbyname */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 571 = shm_open2 */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 572 = shm_rename */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 573 = sigfastblock */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 574 = __realpathat */ + { AS(close_range_args), (sy_call_t *)sys_close_range, AUE_CLOSERANGE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 575 = close_range */ }; Modified: stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/compat/freebsd32/freebsd32_systrace_args.c Wed Aug 5 03:53:57 2020 (r363879) @@ -3322,6 +3322,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 6; break; } + /* close_range */ + case 575: { + struct close_range_args *p = params; + uarg[0] = p->lowfd; /* u_int */ + uarg[1] = p->highfd; /* u_int */ + iarg[2] = p->flags; /* int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8942,6 +8951,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* close_range */ + case 575: + switch(ndx) { + case 0: + p = "u_int"; + break; + case 1: + p = "u_int"; + break; + case 2: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10813,6 +10838,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* freebsd32___sysctlbyname */ case 570: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* close_range */ + case 575: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: stable/12/sys/compat/freebsd32/syscalls.master ============================================================================== --- stable/12/sys/compat/freebsd32/syscalls.master Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/compat/freebsd32/syscalls.master Wed Aug 5 03:53:57 2020 (r363879) @@ -1132,5 +1132,11 @@ 570 AUE_SYSCTL STD { int freebsd32___sysctlbyname(const char *name, \ size_t namelen, void *old, uint32_t *oldlenp, \ void *new, size_t newlen); } +571 AUE_NULL UNIMPL shm_open2 +572 AUE_NULL UNIMPL shm_rename +573 AUE_NULL UNIMPL sigfastblock +574 AUE_NULL UNIMPL __realpathat +575 AUE_CLOSERANGE NOPROTO { int close_range(u_int lowfd, u_int highfd, \ + int flags); } ; vim: syntax=off Modified: stable/12/sys/kern/capabilities.conf ============================================================================== --- stable/12/sys/kern/capabilities.conf Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/kern/capabilities.conf Wed Aug 5 03:53:57 2020 (r363879) @@ -131,6 +131,7 @@ clock_gettime ## Always allow file descriptor close(2). ## close +close_range closefrom ## Modified: stable/12/sys/kern/init_sysent.c ============================================================================== --- stable/12/sys/kern/init_sysent.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/kern/init_sysent.c Wed Aug 5 03:53:57 2020 (r363879) @@ -620,4 +620,9 @@ struct sysent sysent[] = { { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 568 = funlinkat */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 569 = copy_file_range */ { AS(__sysctlbyname_args), (sy_call_t *)sys___sysctlbyname, AUE_SYSCTL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 570 = __sysctlbyname */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 571 = shm_open2 */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 572 = shm_rename */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 573 = sigfastblock */ + { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 574 = __realpathat */ + { AS(close_range_args), (sy_call_t *)sys_close_range, AUE_CLOSERANGE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 575 = close_range */ }; Modified: stable/12/sys/kern/kern_descrip.c ============================================================================== --- stable/12/sys/kern/kern_descrip.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/kern/kern_descrip.c Wed Aug 5 03:53:57 2020 (r363879) @@ -1263,6 +1263,65 @@ kern_close(struct thread *td, int fd) return (closefp(fdp, fd, fp, td, 1)); } +int +kern_close_range(struct thread *td, u_int lowfd, u_int highfd) +{ + struct filedesc *fdp; + int fd, ret; + + ret = 0; + fdp = td->td_proc->p_fd; + FILEDESC_SLOCK(fdp); + + /* + * Check this prior to clamping; closefrom(3) with only fd 0, 1, and 2 + * open should not be a usage error. From a close_range() perspective, + * close_range(3, ~0U, 0) in the same scenario should also likely not + * be a usage error as all fd above 3 are in-fact already closed. + */ + if (highfd < lowfd) { + ret = EINVAL; + goto out; + } + + /* + * If fdp->fd_lastfile == -1, we're dealing with either a fresh file + * table or one in which every fd has been closed. Just return + * successful; there's nothing left to do. + */ + if (fdp->fd_lastfile == -1) + goto out; + /* Clamped to [lowfd, fd_lastfile] */ + highfd = MIN(highfd, fdp->fd_lastfile); + for (fd = lowfd; fd <= highfd; fd++) { + if (fdp->fd_ofiles[fd].fde_file != NULL) { + FILEDESC_SUNLOCK(fdp); + (void)kern_close(td, fd); + FILEDESC_SLOCK(fdp); + } + } +out: + FILEDESC_SUNLOCK(fdp); + return (ret); +} + +#ifndef _SYS_SYSPROTO_H_ +struct close_range_args { + u_int lowfd; + u_int highfd; + int flags; +}; +#endif +int +sys_close_range(struct thread *td, struct close_range_args *uap) +{ + + /* No flags currently defined */ + if (uap->flags != 0) + return (EINVAL); + return (kern_close_range(td, uap->lowfd, uap->highfd)); +} + /* * Close open file descriptors. */ @@ -1275,28 +1334,16 @@ struct closefrom_args { int sys_closefrom(struct thread *td, struct closefrom_args *uap) { - struct filedesc *fdp; - int fd; + u_int lowfd; - fdp = td->td_proc->p_fd; AUDIT_ARG_FD(uap->lowfd); /* * Treat negative starting file descriptor values identical to * closefrom(0) which closes all files. */ - if (uap->lowfd < 0) - uap->lowfd = 0; - FILEDESC_SLOCK(fdp); - for (fd = uap->lowfd; fd <= fdp->fd_lastfile; fd++) { - if (fdp->fd_ofiles[fd].fde_file != NULL) { - FILEDESC_SUNLOCK(fdp); - (void)kern_close(td, fd); - FILEDESC_SLOCK(fdp); - } - } - FILEDESC_SUNLOCK(fdp); - return (0); + lowfd = MAX(0, uap->lowfd); + return (kern_close_range(td, lowfd, ~0U)); } #if defined(COMPAT_43) Modified: stable/12/sys/kern/syscalls.c ============================================================================== --- stable/12/sys/kern/syscalls.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/kern/syscalls.c Wed Aug 5 03:53:57 2020 (r363879) @@ -577,4 +577,9 @@ const char *syscallnames[] = { "#568", /* 568 = funlinkat */ "#569", /* 569 = copy_file_range */ "__sysctlbyname", /* 570 = __sysctlbyname */ + "#571", /* 571 = shm_open2 */ + "#572", /* 572 = shm_rename */ + "#573", /* 573 = sigfastblock */ + "#574", /* 574 = __realpathat */ + "close_range", /* 575 = close_range */ }; Modified: stable/12/sys/kern/syscalls.master ============================================================================== --- stable/12/sys/kern/syscalls.master Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/kern/syscalls.master Wed Aug 5 03:53:57 2020 (r363879) @@ -1380,6 +1380,17 @@ size_t newlen \ ); \ } +571 AUE_NULL UNIMPL shm_open2 +572 AUE_NULL UNIMPL shm_rename +573 AUE_NULL UNIMPL sigfastblock +574 AUE_NULL UNIMPL __realpathat +575 AUE_CLOSERANGE STD { \ + int close_range( \ + u_int lowfd, \ + u_int highfd, \ + int flags \ + ); \ + } ; Please copy any additions and changes to the following compatability tables: Modified: stable/12/sys/kern/systrace_args.c ============================================================================== --- stable/12/sys/kern/systrace_args.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/kern/systrace_args.c Wed Aug 5 03:53:57 2020 (r363879) @@ -3314,6 +3314,15 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 6; break; } + /* close_range */ + case 575: { + struct close_range_args *p = params; + uarg[0] = p->lowfd; /* u_int */ + uarg[1] = p->highfd; /* u_int */ + iarg[2] = p->flags; /* int */ + *n_args = 3; + break; + } default: *n_args = 0; break; @@ -8847,6 +8856,22 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; + /* close_range */ + case 575: + switch(ndx) { + case 0: + p = "u_int"; + break; + case 1: + p = "u_int"; + break; + case 2: + p = "int"; + break; + default: + break; + }; + break; default: break; }; @@ -10745,6 +10770,11 @@ systrace_return_setargdesc(int sysnum, int ndx, char * break; /* __sysctlbyname */ case 570: + if (ndx == 0 || ndx == 1) + p = "int"; + break; + /* close_range */ + case 575: if (ndx == 0 || ndx == 1) p = "int"; break; Modified: stable/12/sys/sys/syscall.h ============================================================================== --- stable/12/sys/sys/syscall.h Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/sys/syscall.h Wed Aug 5 03:53:57 2020 (r363879) @@ -504,4 +504,5 @@ #define SYS_fhlinkat 566 #define SYS_fhreadlink 567 #define SYS___sysctlbyname 570 -#define SYS_MAXSYSCALL 571 +#define SYS_close_range 575 +#define SYS_MAXSYSCALL 576 Modified: stable/12/sys/sys/syscall.mk ============================================================================== --- stable/12/sys/sys/syscall.mk Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/sys/syscall.mk Wed Aug 5 03:53:57 2020 (r363879) @@ -409,4 +409,5 @@ MIASM = \ fhlink.o \ fhlinkat.o \ fhreadlink.o \ - __sysctlbyname.o + __sysctlbyname.o \ + close_range.o Modified: stable/12/sys/sys/syscallsubr.h ============================================================================== --- stable/12/sys/sys/syscallsubr.h Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/sys/syscallsubr.h Wed Aug 5 03:53:57 2020 (r363879) @@ -93,6 +93,7 @@ int kern_clock_nanosleep(struct thread *td, clockid_t const struct timespec *rqtp, struct timespec *rmtp); int kern_clock_settime(struct thread *td, clockid_t clock_id, struct timespec *ats); +int kern_close_range(struct thread *td, u_int lowfd, u_int highfd); int kern_close(struct thread *td, int fd); int kern_connectat(struct thread *td, int dirfd, int fd, struct sockaddr *sa); Modified: stable/12/sys/sys/sysproto.h ============================================================================== --- stable/12/sys/sys/sysproto.h Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/sys/sys/sysproto.h Wed Aug 5 03:53:57 2020 (r363879) @@ -1798,6 +1798,11 @@ struct __sysctlbyname_args { char new_l_[PADL_(void *)]; void * new; char new_r_[PADR_(void *)]; char newlen_l_[PADL_(size_t)]; size_t newlen; char newlen_r_[PADR_(size_t)]; }; +struct close_range_args { + char lowfd_l_[PADL_(u_int)]; u_int lowfd; char lowfd_r_[PADR_(u_int)]; + char highfd_l_[PADL_(u_int)]; u_int highfd; char highfd_r_[PADR_(u_int)]; + char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; +}; int nosys(struct thread *, struct nosys_args *); void sys_sys_exit(struct thread *, struct sys_exit_args *); int sys_fork(struct thread *, struct fork_args *); @@ -2183,6 +2188,7 @@ int sys_fhlink(struct thread *, struct fhlink_args *); int sys_fhlinkat(struct thread *, struct fhlinkat_args *); int sys_fhreadlink(struct thread *, struct fhreadlink_args *); int sys___sysctlbyname(struct thread *, struct __sysctlbyname_args *); +int sys_close_range(struct thread *, struct close_range_args *); #ifdef COMPAT_43 @@ -3085,6 +3091,7 @@ int freebsd11_mknodat(struct thread *, struct freebsd1 #define SYS_AUE_fhlinkat AUE_NULL #define SYS_AUE_fhreadlink AUE_NULL #define SYS_AUE___sysctlbyname AUE_SYSCTL +#define SYS_AUE_close_range AUE_CLOSERANGE #undef PAD_ #undef PADL_ Modified: stable/12/tests/sys/file/closefrom_test.c ============================================================================== --- stable/12/tests/sys/file/closefrom_test.c Wed Aug 5 03:30:03 2020 (r363878) +++ stable/12/tests/sys/file/closefrom_test.c Wed Aug 5 03:53:57 2020 (r363879) @@ -146,7 +146,7 @@ main(void) pid_t pid; int fd, i, start; - printf("1..15\n"); + printf("1..20\n"); /* We better start up with fd's 0, 1, and 2 open. */ start = devnull(); @@ -270,6 +270,60 @@ main(void) if (fd != 3) fail("closefrom", "highest fd %d", fd); ok("closefrom"); + + /* Chew up another 8 fd */ + for (i = 0; i < 8; i++) + (void)devnull(); + fd = highest_fd(); + start = fd - 7; + + /* close_range() a hole in the middle */ + close_range(start + 3, start + 5, 0); + for (i = start + 3; i < start + 6; ++i) { + if (close(i) == 0 || errno != EBADF) { + --i; + break; + } + } + if (i != start + 6) + fail("close_range", "failed to close at %d in %d - %d", i + 1, + start + 3, start + 6); + ok("close_range"); + + /* close_range from the middle of the hole */ + close_range(start + 4, start + 6, 0); + if ((i = highest_fd()) != fd) + fail("close_range", "highest fd %d", i); + ok("close_range"); + + /* close_range to the end; effectively closefrom(2) */ + close_range(start + 3, ~0L, 0); + if ((i = highest_fd()) != start + 2) + fail("close_range", "highest fd %d", i); + ok("close_range"); + + /* Now close the rest */ + close_range(start, start + 4, 0); + fd = highest_fd(); + if (fd != 3) + fail("close_range", "highest fd %d", fd); + ok("close_range"); + + /* Fork a child process to test closefrom(0) twice. */ + pid = fork(); + if (pid < 0) + fail_err("fork"); + if (pid == 0) { + /* Child. */ + closefrom(0); + closefrom(0); + cok(info, "closefrom(0)"); + } + if (wait(NULL) < 0) + fail_err("wait"); + if (info->failed) + fail(info->tag, "%s", info->message); + ok(info->tag); return (0); } From owner-svn-src-stable@freebsd.org Wed Aug 5 14:38:54 2020 Return-Path: Delivered-To: svn-src-stable@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 F316F37860C; Wed, 5 Aug 2020 14:38:54 +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 4BMDlL6Fhsz4v15; Wed, 5 Aug 2020 14:38:54 +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 B9DE117822; Wed, 5 Aug 2020 14:38:54 +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 075EcsIG001787; Wed, 5 Aug 2020 14:38:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 075EcsZq001786; Wed, 5 Aug 2020 14:38:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008051438.075EcsZq001786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 5 Aug 2020 14:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363912 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 363912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 14:38:55 -0000 Author: kevans Date: Wed Aug 5 14:38:54 2020 New Revision: 363912 URL: https://svnweb.freebsd.org/changeset/base/363912 Log: MFC r360833, r360882, r361149: installworld certctl nop The last one reverts the other two, but here are the commit messages: r360833: installworld: attempt a certctl rehash at the tail end This can be run as root or normal user with no problem; if they hadn't twisted the WITHOUT_CAROOT knob, we'll attempt to use the host certctl to rehash the DESTDIR. This would allow one to build systems WITHOUT_OPENSSL + WITH_CAROOT with a populated /etc/ssl that they can then use with an appropriate *ssl from somewhere else. Cross-builds are fine because this will always use the host certctl, or just nag if it's missing and it wasn't a WITHOUT_CAROOT build. r360882: buildworld: add back in missing semicolon if foo; then blah else blah; fi has a drastically different meaning than if foo; then blah; else blah; fi. Fix it. r361149: Revert r360833, r360882: certctl rehash in installworld This was solving the correct-ish problem in the wrong place. Noted by brooks; while he didn't request a prompt revert, doing so now will facilitate proper testing for the revised version of this. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-stable@freebsd.org Wed Aug 5 14:40:09 2020 Return-Path: Delivered-To: svn-src-stable@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 ED24F378880; Wed, 5 Aug 2020 14:40:09 +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 4BMDmn4kw6z4vK9; Wed, 5 Aug 2020 14:40:09 +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 85DB117768; Wed, 5 Aug 2020 14:40:09 +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 075Ee9br001939; Wed, 5 Aug 2020 14:40:09 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 075Ee9pL001938; Wed, 5 Aug 2020 14:40:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008051440.075Ee9pL001938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 5 Aug 2020 14:40:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363913 - stable/12/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 363913 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 14:40:10 -0000 Author: kevans Date: Wed Aug 5 14:40:09 2020 New Revision: 363913 URL: https://svnweb.freebsd.org/changeset/base/363913 Log: MFC r361257: bsdinstall: do a `certctl rehash` upon installation of config If certctl is installed on the system we're configuring, do a certctl rehash. Note that certctl may not be present if the world we've installed was built either WITHOUT_OPENSSL or WITHOUT_CAROOT. In this scenario, we don't currently see if the host has a certctl as this may be an indication that the system *shouldn't* have certs installed into /etc/ssl. Modified: stable/12/usr.sbin/bsdinstall/scripts/config Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bsdinstall/scripts/config ============================================================================== --- stable/12/usr.sbin/bsdinstall/scripts/config Wed Aug 5 14:38:54 2020 (r363912) +++ stable/12/usr.sbin/bsdinstall/scripts/config Wed Aug 5 14:40:09 2020 (r363913) @@ -55,6 +55,9 @@ cp $BSDINSTALL_TMPBOOT/* $BSDINSTALL_CHROOT/boot # Set up other things from installed config chroot $BSDINSTALL_CHROOT /usr/bin/newaliases > /dev/null 2>&1 +if [ -x $BSDINSTALL_CHROOT/usr/sbin/certctl ]; then + chroot $BSDINSTALL_CHROOT /usr/sbin/certctl rehash +fi exit 0 From owner-svn-src-stable@freebsd.org Wed Aug 5 14:42:46 2020 Return-Path: Delivered-To: svn-src-stable@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 C85683786D6; Wed, 5 Aug 2020 14:42: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 4BMDqp4xmmz4vRh; Wed, 5 Aug 2020 14:42: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 8C78817BC7; Wed, 5 Aug 2020 14:42: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 075EgkAw008011; Wed, 5 Aug 2020 14:42:46 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 075EgkPS008009; Wed, 5 Aug 2020 14:42:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008051442.075EgkPS008009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 5 Aug 2020 14:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363914 - in stable/12/stand: common efi/include efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: common efi/include efi/libefi X-SVN-Commit-Revision: 363914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 14:42:46 -0000 Author: kevans Date: Wed Aug 5 14:42:45 2020 New Revision: 363914 URL: https://svnweb.freebsd.org/changeset/base/363914 Log: MFC r362564: stand: remove redundant declarations These are picked out by the amd64-gcc6 build; time() is declared in and delay() is declared in . These are the correct places for these in stand/, so remove the duplicate declarations and make sure the delay() consumer in libefi that depended on the extra delay() declaration includes . Modified: stable/12/stand/common/bootstrap.h stable/12/stand/efi/include/efilib.h stable/12/stand/efi/libefi/efihttp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/bootstrap.h ============================================================================== --- stable/12/stand/common/bootstrap.h Wed Aug 5 14:40:09 2020 (r363913) +++ stable/12/stand/common/bootstrap.h Wed Aug 5 14:42:45 2020 (r363914) @@ -345,8 +345,6 @@ void delay(int delay); void dev_cleanup(void); -time_t time(time_t *tloc); - #ifndef CTASSERT #define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #endif Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Wed Aug 5 14:40:09 2020 (r363913) +++ stable/12/stand/efi/include/efilib.h Wed Aug 5 14:42:45 2020 (r363914) @@ -111,7 +111,6 @@ EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABL EFI_STATUS main(int argc, CHAR16 *argv[]); void efi_exit(EFI_STATUS status) __dead2; -void delay(int usecs); /* EFI environment initialization. */ void efi_init_environment(void); Modified: stable/12/stand/efi/libefi/efihttp.c ============================================================================== --- stable/12/stand/efi/libefi/efihttp.c Wed Aug 5 14:40:09 2020 (r363913) +++ stable/12/stand/efi/libefi/efihttp.c Wed Aug 5 14:42:45 2020 (r363914) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include From owner-svn-src-stable@freebsd.org Wed Aug 5 17:07:14 2020 Return-Path: Delivered-To: svn-src-stable@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 07E2037BE19; Wed, 5 Aug 2020 17:07:14 +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 4BMJ2T6Rpcz3ZqT; Wed, 5 Aug 2020 17:07:13 +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 C1DFD1943A; Wed, 5 Aug 2020 17:07:13 +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 075H7DkG094276; Wed, 5 Aug 2020 17:07:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 075H7Dc9094275; Wed, 5 Aug 2020 17:07:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008051707.075H7Dc9094275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Aug 2020 17:07:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363918 - stable/12/sys/compat/freebsd32 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/compat/freebsd32 X-SVN-Commit-Revision: 363918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 17:07:14 -0000 Author: markj Date: Wed Aug 5 17:07:13 2020 New Revision: 363918 URL: https://svnweb.freebsd.org/changeset/base/363918 Log: MFC r363917: Fix a TOCTOU vulnerability in freebsd32_copyin_control(). PR: 248257 Reported by: m00nbsd working with Trend Micro Zero Day Initiative Reviewed by: kib Security: SA-20:23.sendmsg Security: CVE-2020-7460 Security: ZDI-CAN-11543 Modified: stable/12/sys/compat/freebsd32/freebsd32_misc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 5 17:06:14 2020 (r363917) +++ stable/12/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 5 17:07:13 2020 (r363918) @@ -1260,78 +1260,90 @@ freebsd32_recvmsg(td, uap) static int freebsd32_copyin_control(struct mbuf **mp, caddr_t buf, u_int buflen) { + struct cmsghdr *cm; struct mbuf *m; - void *md; - u_int idx, len, msglen; + void *in, *in1, *md; + u_int msglen, outlen; int error; - buflen = FREEBSD32_ALIGN(buflen); - if (buflen > MCLBYTES) return (EINVAL); + in = malloc(buflen, M_TEMP, M_WAITOK); + error = copyin(buf, in, buflen); + if (error != 0) + goto out; + /* - * Iterate over the buffer and get the length of each message - * in there. This has 32-bit alignment and padding. Use it to - * determine the length of these messages when using 64-bit - * alignment and padding. + * Make a pass over the input buffer to determine the amount of space + * required for 64 bit-aligned copies of the control messages. */ - idx = 0; - len = 0; - while (idx < buflen) { - error = copyin(buf + idx, &msglen, sizeof(msglen)); - if (error) - return (error); - if (msglen < sizeof(struct cmsghdr)) - return (EINVAL); - msglen = FREEBSD32_ALIGN(msglen); - if (idx + msglen > buflen) - return (EINVAL); - idx += msglen; - msglen += CMSG_ALIGN(sizeof(struct cmsghdr)) - - FREEBSD32_ALIGN(sizeof(struct cmsghdr)); - len += CMSG_ALIGN(msglen); - } - - if (len > MCLBYTES) - return (EINVAL); - - m = m_get(M_WAITOK, MT_CONTROL); - if (len > MLEN) - MCLGET(m, M_WAITOK); - m->m_len = len; - - md = mtod(m, void *); + in1 = in; + outlen = 0; while (buflen > 0) { - error = copyin(buf, md, sizeof(struct cmsghdr)); - if (error) + if (buflen < sizeof(*cm)) { + error = EINVAL; break; - msglen = *(u_int *)md; - msglen = FREEBSD32_ALIGN(msglen); + } + cm = (struct cmsghdr *)in1; + if (cm->cmsg_len < FREEBSD32_ALIGN(sizeof(*cm))) { + error = EINVAL; + break; + } + msglen = FREEBSD32_ALIGN(cm->cmsg_len); + if (msglen > buflen || msglen < cm->cmsg_len) { + error = EINVAL; + break; + } + buflen -= msglen; - /* Modify the message length to account for alignment. */ - *(u_int *)md = msglen + CMSG_ALIGN(sizeof(struct cmsghdr)) - - FREEBSD32_ALIGN(sizeof(struct cmsghdr)); + in1 = (char *)in1 + msglen; + outlen += CMSG_ALIGN(sizeof(*cm)) + + CMSG_ALIGN(msglen - FREEBSD32_ALIGN(sizeof(*cm))); + } + if (error == 0 && outlen > MCLBYTES) { + /* + * XXXMJ This implies that the upper limit on 32-bit aligned + * control messages is less than MCLBYTES, and so we are not + * perfectly compatible. However, there is no platform + * guarantee that mbuf clusters larger than MCLBYTES can be + * allocated. + */ + error = EINVAL; + } + if (error != 0) + goto out; - md = (char *)md + CMSG_ALIGN(sizeof(struct cmsghdr)); - buf += FREEBSD32_ALIGN(sizeof(struct cmsghdr)); - buflen -= FREEBSD32_ALIGN(sizeof(struct cmsghdr)); + m = m_get2(outlen, M_WAITOK, MT_CONTROL, 0); + m->m_len = outlen; + md = mtod(m, void *); - msglen -= FREEBSD32_ALIGN(sizeof(struct cmsghdr)); - if (msglen > 0) { - error = copyin(buf, md, msglen); - if (error) - break; - md = (char *)md + CMSG_ALIGN(msglen); - buf += msglen; - buflen -= msglen; - } + /* + * Make a second pass over input messages, copying them into the output + * buffer. + */ + in1 = in; + while (outlen > 0) { + /* Copy the message header and align the length field. */ + cm = md; + memcpy(cm, in1, sizeof(*cm)); + msglen = cm->cmsg_len - FREEBSD32_ALIGN(sizeof(*cm)); + cm->cmsg_len = CMSG_ALIGN(sizeof(*cm)) + msglen; + + /* Copy the message body. */ + in1 = (char *)in1 + FREEBSD32_ALIGN(sizeof(*cm)); + md = (char *)md + CMSG_ALIGN(sizeof(*cm)); + memcpy(md, in1, msglen); + in1 = (char *)in1 + FREEBSD32_ALIGN(msglen); + md = (char *)md + CMSG_ALIGN(msglen); + KASSERT(outlen >= CMSG_ALIGN(sizeof(*cm)) + CMSG_ALIGN(msglen), + ("outlen %u underflow, msglen %u", outlen, msglen)); + outlen -= CMSG_ALIGN(sizeof(*cm)) + CMSG_ALIGN(msglen); } - if (error) - m_free(m); - else - *mp = m; + *mp = m; +out: + free(in, M_TEMP); return (error); } From owner-svn-src-stable@freebsd.org Wed Aug 5 17:08:03 2020 Return-Path: Delivered-To: svn-src-stable@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 6B99E37BE23; Wed, 5 Aug 2020 17:08:03 +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 4BMJ3R2CY8z3b4y; Wed, 5 Aug 2020 17:08:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2F35F1969E; Wed, 5 Aug 2020 17:08:03 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 075H82aU094371; Wed, 5 Aug 2020 17:08:02 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 075H82SU094370; Wed, 5 Aug 2020 17:08:02 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008051708.075H82SU094370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Aug 2020 17:08:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363919 - stable/11/sys/compat/freebsd32 X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/11/sys/compat/freebsd32 X-SVN-Commit-Revision: 363919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 17:08:03 -0000 Author: markj Date: Wed Aug 5 17:08:02 2020 New Revision: 363919 URL: https://svnweb.freebsd.org/changeset/base/363919 Log: MFC r363917: Fix a TOCTOU vulnerability in freebsd32_copyin_control(). PR: 248257 Reported by: m00nbsd working with Trend Micro Zero Day Initiative Reviewed by: kib Security: SA-20:23.sendmsg Security: CVE-2020-7460 Security: ZDI-CAN-11543 Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/11/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 5 17:07:13 2020 (r363918) +++ stable/11/sys/compat/freebsd32/freebsd32_misc.c Wed Aug 5 17:08:02 2020 (r363919) @@ -1112,78 +1112,90 @@ freebsd32_recvmsg(td, uap) static int freebsd32_copyin_control(struct mbuf **mp, caddr_t buf, u_int buflen) { + struct cmsghdr *cm; struct mbuf *m; - void *md; - u_int idx, len, msglen; + void *in, *in1, *md; + u_int msglen, outlen; int error; - buflen = FREEBSD32_ALIGN(buflen); - if (buflen > MCLBYTES) return (EINVAL); + in = malloc(buflen, M_TEMP, M_WAITOK); + error = copyin(buf, in, buflen); + if (error != 0) + goto out; + /* - * Iterate over the buffer and get the length of each message - * in there. This has 32-bit alignment and padding. Use it to - * determine the length of these messages when using 64-bit - * alignment and padding. + * Make a pass over the input buffer to determine the amount of space + * required for 64 bit-aligned copies of the control messages. */ - idx = 0; - len = 0; - while (idx < buflen) { - error = copyin(buf + idx, &msglen, sizeof(msglen)); - if (error) - return (error); - if (msglen < sizeof(struct cmsghdr)) - return (EINVAL); - msglen = FREEBSD32_ALIGN(msglen); - if (idx + msglen > buflen) - return (EINVAL); - idx += msglen; - msglen += CMSG_ALIGN(sizeof(struct cmsghdr)) - - FREEBSD32_ALIGN(sizeof(struct cmsghdr)); - len += CMSG_ALIGN(msglen); - } - - if (len > MCLBYTES) - return (EINVAL); - - m = m_get(M_WAITOK, MT_CONTROL); - if (len > MLEN) - MCLGET(m, M_WAITOK); - m->m_len = len; - - md = mtod(m, void *); + in1 = in; + outlen = 0; while (buflen > 0) { - error = copyin(buf, md, sizeof(struct cmsghdr)); - if (error) + if (buflen < sizeof(*cm)) { + error = EINVAL; break; - msglen = *(u_int *)md; - msglen = FREEBSD32_ALIGN(msglen); + } + cm = (struct cmsghdr *)in1; + if (cm->cmsg_len < FREEBSD32_ALIGN(sizeof(*cm))) { + error = EINVAL; + break; + } + msglen = FREEBSD32_ALIGN(cm->cmsg_len); + if (msglen > buflen || msglen < cm->cmsg_len) { + error = EINVAL; + break; + } + buflen -= msglen; - /* Modify the message length to account for alignment. */ - *(u_int *)md = msglen + CMSG_ALIGN(sizeof(struct cmsghdr)) - - FREEBSD32_ALIGN(sizeof(struct cmsghdr)); + in1 = (char *)in1 + msglen; + outlen += CMSG_ALIGN(sizeof(*cm)) + + CMSG_ALIGN(msglen - FREEBSD32_ALIGN(sizeof(*cm))); + } + if (error == 0 && outlen > MCLBYTES) { + /* + * XXXMJ This implies that the upper limit on 32-bit aligned + * control messages is less than MCLBYTES, and so we are not + * perfectly compatible. However, there is no platform + * guarantee that mbuf clusters larger than MCLBYTES can be + * allocated. + */ + error = EINVAL; + } + if (error != 0) + goto out; - md = (char *)md + CMSG_ALIGN(sizeof(struct cmsghdr)); - buf += FREEBSD32_ALIGN(sizeof(struct cmsghdr)); - buflen -= FREEBSD32_ALIGN(sizeof(struct cmsghdr)); + m = m_get2(outlen, M_WAITOK, MT_CONTROL, 0); + m->m_len = outlen; + md = mtod(m, void *); - msglen -= FREEBSD32_ALIGN(sizeof(struct cmsghdr)); - if (msglen > 0) { - error = copyin(buf, md, msglen); - if (error) - break; - md = (char *)md + CMSG_ALIGN(msglen); - buf += msglen; - buflen -= msglen; - } + /* + * Make a second pass over input messages, copying them into the output + * buffer. + */ + in1 = in; + while (outlen > 0) { + /* Copy the message header and align the length field. */ + cm = md; + memcpy(cm, in1, sizeof(*cm)); + msglen = cm->cmsg_len - FREEBSD32_ALIGN(sizeof(*cm)); + cm->cmsg_len = CMSG_ALIGN(sizeof(*cm)) + msglen; + + /* Copy the message body. */ + in1 = (char *)in1 + FREEBSD32_ALIGN(sizeof(*cm)); + md = (char *)md + CMSG_ALIGN(sizeof(*cm)); + memcpy(md, in1, msglen); + in1 = (char *)in1 + FREEBSD32_ALIGN(msglen); + md = (char *)md + CMSG_ALIGN(msglen); + KASSERT(outlen >= CMSG_ALIGN(sizeof(*cm)) + CMSG_ALIGN(msglen), + ("outlen %u underflow, msglen %u", outlen, msglen)); + outlen -= CMSG_ALIGN(sizeof(*cm)) + CMSG_ALIGN(msglen); } - if (error) - m_free(m); - else - *mp = m; + *mp = m; +out: + free(in, M_TEMP); return (error); } From owner-svn-src-stable@freebsd.org Thu Aug 6 04:52:31 2020 Return-Path: Delivered-To: svn-src-stable@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 1B7353B1847; Thu, 6 Aug 2020 04:52:31 +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 4BMbhG6s2Nz4d74; Thu, 6 Aug 2020 04:52:30 +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 CFD5921D0B; Thu, 6 Aug 2020 04:52:30 +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 0764qUd0031463; Thu, 6 Aug 2020 04:52:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0764qUcF031462; Thu, 6 Aug 2020 04:52:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008060452.0764qUcF031462@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Aug 2020 04:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363940 - stable/12/usr.sbin/pkg X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.sbin/pkg X-SVN-Commit-Revision: 363940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 04:52:31 -0000 Author: kevans Date: Thu Aug 6 04:52:30 2020 New Revision: 363940 URL: https://svnweb.freebsd.org/changeset/base/363940 Log: MFC r363421: pkg-bootstrap: complain on improper `pkg bootstrap` usage Right now, the bootstrap will gloss over things like pkg bootstrap -x or pkg bootstrap -f pkg. Make it more clear that this is incorrect, and hint at the correct formatting. Modified: stable/12/usr.sbin/pkg/pkg.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/pkg/pkg.c ============================================================================== --- stable/12/usr.sbin/pkg/pkg.c Thu Aug 6 04:20:14 2020 (r363939) +++ stable/12/usr.sbin/pkg/pkg.c Thu Aug 6 04:52:30 2020 (r363940) @@ -1050,8 +1050,16 @@ main(int argc, char *argv[]) if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) { bootstrap_only = true; - if (argc == 3 && strcmp(argv[2], "-f") == 0) + if (argc > 3) { + fprintf(stderr, "Too many arguments\nUsage: pkg bootstrap [-f]\n"); + exit(EXIT_FAILURE); + } + if (argc == 3 && strcmp(argv[2], "-f") == 0) { force = true; + } else if (argc == 3) { + fprintf(stderr, "Invalid argument specified\nUsage: pkg bootstrap [-f]\n"); + exit(EXIT_FAILURE); + } } if ((bootstrap_only && force) || access(pkgpath, X_OK) == -1) { From owner-svn-src-stable@freebsd.org Thu Aug 6 04:55:00 2020 Return-Path: Delivered-To: svn-src-stable@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 6410A3B13D0; Thu, 6 Aug 2020 04:55: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 4BMbl821b6z4dQW; Thu, 6 Aug 2020 04:55: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 288B621C85; Thu, 6 Aug 2020 04:55: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 0764t0ud031659; Thu, 6 Aug 2020 04:55:00 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0764t0A9031658; Thu, 6 Aug 2020 04:55:00 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008060455.0764t0A9031658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Aug 2020 04:55:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363941 - stable/12/lib/libbe X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/libbe X-SVN-Commit-Revision: 363941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 04:55:00 -0000 Author: kevans Date: Thu Aug 6 04:54:59 2020 New Revision: 363941 URL: https://svnweb.freebsd.org/changeset/base/363941 Log: MFC r363409: libbe: annotate lbh as __unused in be_is_auto_snapshot_name lbh is included for consistency with other functions and in case future work needs to use it, but it is currently unused. Mark it, and a post-OpenZFS-import world will be able to raise WARNS of libbe to the default (pending some minor changes to openzfs libzfs). Modified: stable/12/lib/libbe/be.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libbe/be.c ============================================================================== --- stable/12/lib/libbe/be.c Thu Aug 6 04:52:30 2020 (r363940) +++ stable/12/lib/libbe/be.c Thu Aug 6 04:54:59 2020 (r363941) @@ -563,7 +563,7 @@ be_setup_snapshot_name(libbe_handle_t *lbh, char *buf, } bool -be_is_auto_snapshot_name(libbe_handle_t *lbh, const char *name) +be_is_auto_snapshot_name(libbe_handle_t *lbh __unused, const char *name) { const char *snap; int day, hour, minute, month, second, serial, year; From owner-svn-src-stable@freebsd.org Thu Aug 6 08:06:07 2020 Return-Path: Delivered-To: svn-src-stable@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 EF9C737A592; Thu, 6 Aug 2020 08:06:07 +0000 (UTC) (envelope-from avg@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 4BMgzg6Qgbz3Zxy; Thu, 6 Aug 2020 08:06:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5A4623AE2; Thu, 6 Aug 2020 08:06:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 076867Ht047984; Thu, 6 Aug 2020 08:06:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076867xS047983; Thu, 6 Aug 2020 08:06:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202008060806.076867xS047983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 6 Aug 2020 08:06:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363944 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 363944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 08:06:08 -0000 Author: avg Date: Thu Aug 6 08:06:07 2020 New Revision: 363944 URL: https://svnweb.freebsd.org/changeset/base/363944 Log: MFC r362042: iicbb: rebuild the bit-banging algorithms using different primitives I2C_SET was quite inflexible, it used too long delays as well as some unnecessary delays. The new building blocks are iicbb_clockin and iicbb_clockout. The former sets SDA and starts the high period of SCL, the latter executes the low period of SCL. What happens during the high phase depends on the operation. For writes we just hold both lines, for reads we poll SDA. S, Sr and P change SDA in the middle of the high period. Also, the calculation of udelay has been updated, so that the resulting period more closely corresponds the requested bus frequency. There is a new knob, io_delay, that allows to further adjust udelay based on the estimated latency of pin toggling operations. Finally, I slightly changed debug tracing and added error indicators to it. The debug prints are compiled in but disabled by default. This can be of use if there is any fallout from this change. Modified: stable/12/sys/dev/iicbus/iicbb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iicbb.c ============================================================================== --- stable/12/sys/dev/iicbus/iicbb.c Thu Aug 6 07:26:31 2020 (r363943) +++ stable/12/sys/dev/iicbus/iicbb.c Thu Aug 6 08:06:07 2020 (r363944) @@ -75,6 +75,7 @@ __FBSDID("$FreeBSD$"); struct iicbb_softc { device_t iicbus; u_int udelay; /* signal toggle delay in usec */ + u_int io_latency; /* approximate pin toggling latency */ u_int scl_low_timeout; }; @@ -86,6 +87,7 @@ static int iicbb_probe(device_t); static int iicbb_callback(device_t, int, caddr_t); static int iicbb_start(device_t, u_char, int); +static int iicbb_repstart(device_t, u_char, int); static int iicbb_stop(device_t); static int iicbb_write(device_t, const char *, int, int *, int); static int iicbb_read(device_t, char *, int, int *, int, int); @@ -109,7 +111,7 @@ static device_method_t iicbb_methods[] = { /* iicbus interface */ DEVMETHOD(iicbus_callback, iicbb_callback), DEVMETHOD(iicbus_start, iicbb_start), - DEVMETHOD(iicbus_repeated_start, iicbb_start), + DEVMETHOD(iicbus_repeated_start, iicbb_repstart), DEVMETHOD(iicbus_stop, iicbb_stop), DEVMETHOD(iicbus_write, iicbb_write), DEVMETHOD(iicbus_read, iicbb_read), @@ -160,6 +162,11 @@ iicbb_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, "scl_low_timeout", CTLFLAG_RWTUN, &sc->scl_low_timeout, 0, "SCL low timeout, microseconds"); + SYSCTL_ADD_UINT(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "io_latency", CTLFLAG_RWTUN, &sc->io_latency, + 0, "Estimate of pin toggling latency, microseconds"); + bus_generic_attach(dev); return (0); } @@ -217,80 +224,105 @@ iicbb_print_child(device_t bus, device_t dev) return (retval); } +#define IICBB_DEBUG +#ifdef IICBB_DEBUG +static int i2c_debug = 0; + +static SYSCTL_NODE(_hw, OID_AUTO, i2c, CTLFLAG_RW, 0, "i2c debug"); +SYSCTL_INT(_hw_i2c, OID_AUTO, iicbb_debug, CTLFLAG_RWTUN, + &i2c_debug, 0, "Enable i2c bit-banging driver debug"); + +#define I2C_DEBUG(x) do { \ + if (i2c_debug) (x); \ + } while (0) +#else +#define I2C_DEBUG(x) +#endif + #define I2C_GETSDA(dev) (IICBB_GETSDA(device_get_parent(dev))) #define I2C_SETSDA(dev, x) (IICBB_SETSDA(device_get_parent(dev), x)) #define I2C_GETSCL(dev) (IICBB_GETSCL(device_get_parent(dev))) #define I2C_SETSCL(dev, x) (IICBB_SETSCL(device_get_parent(dev), x)) -#define I2C_SET(sc, dev, ctrl, val) do { \ - iicbb_setscl(dev, ctrl); \ - I2C_SETSDA(dev, val); \ - DELAY(sc->udelay); \ - } while (0) - -static int i2c_debug = 0; -#define I2C_DEBUG(x) do { \ - if (i2c_debug) (x); \ - } while (0) - -#define I2C_LOG(format,args...) do { \ - printf(format, args); \ - } while (0) - -static void -iicbb_setscl(device_t dev, int val) +static int +iicbb_waitforscl(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); - sbintime_t now, end; - int fast_timeout; + sbintime_t fast_timeout; + sbintime_t now, timeout; - I2C_SETSCL(dev, val); - DELAY(sc->udelay); - - /* Pulling low cannot fail. */ - if (!val) - return; - - /* Use DELAY for up to 1 ms, then switch to pause. */ - end = sbinuptime() + sc->scl_low_timeout * SBT_1US; - fast_timeout = MIN(sc->scl_low_timeout, 1000); - while (fast_timeout > 0) { + /* Spin for up to 1 ms, then switch to pause. */ + now = sbinuptime(); + fast_timeout = now + SBT_1MS; + timeout = now + sc->scl_low_timeout * SBT_1US; + do { if (I2C_GETSCL(dev)) - return; - I2C_SETSCL(dev, 1); /* redundant ? */ - DELAY(sc->udelay); - fast_timeout -= sc->udelay; - } - - while (!I2C_GETSCL(dev)) { + return (0); now = sbinuptime(); - if (now >= end) - break; + } while (now < fast_timeout); + do { + I2C_DEBUG(printf(".")); pause_sbt("iicbb-scl-low", SBT_1MS, C_PREL(8), 0); - } + if (I2C_GETSCL(dev)) + return (0); + now = sbinuptime(); + } while (now < timeout); + I2C_DEBUG(printf("*")); + return (IIC_ETIMEOUT); } +/* Start the high phase of the clock. */ +static int +iicbb_clockin(device_t dev, int sda) +{ + + /* + * Precondition: SCL is low. + * Action: + * - set SDA to the value; + * - release SCL and wait until it's high. + * The caller is responsible for keeping SCL high for udelay. + * + * There should be a data set-up time, 250 ns minimum, between setting + * SDA and raising SCL. It's expected that the I/O access latency will + * naturally provide that delay. + */ + I2C_SETSDA(dev, sda); + I2C_SETSCL(dev, 1); + return (iicbb_waitforscl(dev)); +} + +/* + * End the high phase of the clock and wait out the low phase + * as nothing interesting happens during it anyway. + */ static void -iicbb_one(device_t dev, int timeout) +iicbb_clockout(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); - I2C_SET(sc,dev,0,1); - I2C_SET(sc,dev,1,1); - I2C_SET(sc,dev,0,1); - return; + /* + * Precondition: SCL is high. + * Action: + * - pull SCL low and hold for udelay. + */ + I2C_SETSCL(dev, 0); + DELAY(sc->udelay); } -static void -iicbb_zero(device_t dev, int timeout) +static int +iicbb_sendbit(device_t dev, int bit) { struct iicbb_softc *sc = device_get_softc(dev); + int err; - I2C_SET(sc,dev,0,0); - I2C_SET(sc,dev,1,0); - I2C_SET(sc,dev,0,0); - return; + err = iicbb_clockin(dev, bit); + if (err != 0) + return (err); + DELAY(sc->udelay); + iicbb_clockout(dev); + return (0); } /* @@ -308,71 +340,84 @@ iicbb_zero(device_t dev, int timeout) * line low and then the SLAVE will release the SDA (data) line. */ static int -iicbb_ack(device_t dev, int timeout) +iicbb_getack(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); - int noack; - int k = 0; + int noack, err; + int t; - I2C_SET(sc,dev,0,1); - I2C_SET(sc,dev,1,1); + /* Release SDA so that the slave can drive it. */ + err = iicbb_clockin(dev, 1); + if (err != 0) { + I2C_DEBUG(printf("! ")); + return (err); + } - /* SCL must be high now. */ - if (!I2C_GETSCL(dev)) - return (IIC_ETIMEOUT); - - do { + /* Sample SDA until ACK (low) or udelay runs out. */ + for (t = 0; t < sc->udelay; t++) { noack = I2C_GETSDA(dev); if (!noack) break; DELAY(1); - k++; - } while (k < timeout); + } - I2C_SET(sc,dev,0,1); - I2C_DEBUG(printf("%c ",noack?'-':'+')); + DELAY(sc->udelay - t); + iicbb_clockout(dev); + I2C_DEBUG(printf("%c ", noack ? '-' : '+')); return (noack ? IIC_ENOACK : 0); } -static void -iicbb_sendbyte(device_t dev, u_char data, int timeout) +static int +iicbb_sendbyte(device_t dev, uint8_t data) { - int i; + int err, i; - for (i=7; i>=0; i--) { - if (data&(1<= 0; i--) { + err = iicbb_sendbit(dev, (data & (1 << i)) != 0); + if (err != 0) { + I2C_DEBUG(printf("w!")); + return (err); } } - I2C_DEBUG(printf("w%02x",(int)data)); - return; + I2C_DEBUG(printf("w%02x", data)); + return (0); } -static u_char -iicbb_readbyte(device_t dev, int last, int timeout) +static int +iicbb_readbyte(device_t dev, bool last, uint8_t *data) { struct iicbb_softc *sc = device_get_softc(dev); - int i; - unsigned char data=0; + int i, err; - I2C_SET(sc,dev,0,1); - for (i=7; i>=0; i--) - { - I2C_SET(sc,dev,1,1); + /* + * Release SDA so that the slave can drive it. + * We do not use iicbb_clockin() here because we need to release SDA + * only once and then we just pulse the SCL. + */ + *data = 0; + I2C_SETSDA(dev, 1); + for (i = 7; i >= 0; i--) { + I2C_SETSCL(dev, 1); + err = iicbb_waitforscl(dev); + if (err != 0) { + I2C_DEBUG(printf("r! ")); + return (err); + } + DELAY((sc->udelay + 1) / 2); if (I2C_GETSDA(dev)) - data |= (1<udelay + 1) / 2); + iicbb_clockout(dev); } - if (last) { - iicbb_one(dev, timeout); - } else { - iicbb_zero(dev, timeout); - } - I2C_DEBUG(printf("r%02x%c ",(int)data,last?'-':'+')); - return (data); + + /* + * Send master->slave ACK (low) for more data, + * NoACK (high) otherwise. + */ + iicbb_sendbit(dev, last); + I2C_DEBUG(printf("r%02x%c ", *data, last ? '-' : '+')); + return (0); } static int @@ -389,63 +434,106 @@ iicbb_reset(device_t dev, u_char speed, u_char addr, u } static int -iicbb_start(device_t dev, u_char slave, int timeout) +iicbb_start_impl(device_t dev, u_char slave, bool repstart) { struct iicbb_softc *sc = device_get_softc(dev); int error; - I2C_DEBUG(printf("<")); + if (!repstart) { + I2C_DEBUG(printf("<<")); - I2C_SET(sc,dev,1,1); + /* SCL must be high on the idle bus. */ + if (iicbb_waitforscl(dev) != 0) { + I2C_DEBUG(printf("C!\n")); + return (IIC_EBUSERR); + } + } else { + I2C_DEBUG(printf("<")); + error = iicbb_clockin(dev, 1); + if (error != 0) + return (error); - /* SCL must be high now. */ - if (!I2C_GETSCL(dev)) - return (IIC_ETIMEOUT); + /* SDA will go low in the middle of the SCL high phase. */ + DELAY((sc->udelay + 1) / 2); + } - I2C_SET(sc,dev,1,0); - I2C_SET(sc,dev,0,0); + /* + * SDA must be high after the earlier stop condition or the end + * of Ack/NoAck pulse. + */ + if (!I2C_GETSDA(dev)) { + I2C_DEBUG(printf("D!\n")); + return (IIC_EBUSERR); + } + /* Start: SDA high->low. */ + I2C_SETSDA(dev, 0); + + /* Wait the second half of the SCL high phase. */ + DELAY((sc->udelay + 1) / 2); + + /* Pull SCL low to keep the bus reserved. */ + iicbb_clockout(dev); + /* send address */ - iicbb_sendbyte(dev, slave, timeout); + error = iicbb_sendbyte(dev, slave); /* check for ack */ - error = iicbb_ack(dev, timeout); if (error == 0) - return (0); - - iicbb_stop(dev); + error = iicbb_getack(dev); + if (error != 0) + (void)iicbb_stop(dev); return (error); } +/* NB: the timeout is ignored. */ static int +iicbb_start(device_t dev, u_char slave, int timeout) +{ + return (iicbb_start_impl(dev, slave, false)); +} + +/* NB: the timeout is ignored. */ +static int +iicbb_repstart(device_t dev, u_char slave, int timeout) +{ + return (iicbb_start_impl(dev, slave, true)); +} + +static int iicbb_stop(device_t dev) { struct iicbb_softc *sc = device_get_softc(dev); + int err = 0; - I2C_SET(sc,dev,0,0); - I2C_SET(sc,dev,1,0); - I2C_SET(sc,dev,1,1); - I2C_DEBUG(printf(">")); - I2C_DEBUG(printf("\n")); + /* + * Stop: SDA goes from low to high in the middle of the SCL high phase. + */ + err = iicbb_clockin(dev, 0); + if (err != 0) + return (err); + DELAY((sc->udelay + 1) / 2); + I2C_SETSDA(dev, 1); + DELAY((sc->udelay + 1) / 2); - /* SCL must be high now. */ - if (!I2C_GETSCL(dev)) - return (IIC_ETIMEOUT); - return (0); + I2C_DEBUG(printf("%s>>", err != 0 ? "!" : "")); + I2C_DEBUG(printf("\n")); + return (err); } +/* NB: the timeout is ignored. */ static int iicbb_write(device_t dev, const char *buf, int len, int *sent, int timeout) { int bytes, error = 0; bytes = 0; - while (len) { + while (len > 0) { /* send byte */ - iicbb_sendbyte(dev,(u_char)*buf++, timeout); + iicbb_sendbyte(dev, (uint8_t)*buf++); /* check for ack */ - error = iicbb_ack(dev, timeout); + error = iicbb_getack(dev); if (error != 0) break; bytes++; @@ -456,22 +544,25 @@ iicbb_write(device_t dev, const char *buf, int len, in return (error); } +/* NB: whatever delay is, it's ignored. */ static int -iicbb_read(device_t dev, char * buf, int len, int *read, int last, int delay) +iicbb_read(device_t dev, char *buf, int len, int *read, int last, int delay) { - int bytes; + int bytes = 0; + int err = 0; - bytes = 0; - while (len) { - /* XXX should insert delay here */ - *buf++ = (char)iicbb_readbyte(dev, (len == 1) ? last : 0, delay); - - bytes ++; - len --; + while (len > 0) { + err = iicbb_readbyte(dev, (len == 1) ? last : 0, + (uint8_t *)buf); + if (err != 0) + break; + buf++; + bytes++; + len--; } *read = bytes; - return (0); + return (err); } static int @@ -492,18 +583,15 @@ iicbb_transfer(device_t dev, struct iic_msg *msgs, uin static void iicbb_set_speed(struct iicbb_softc *sc, u_char speed) { - u_int busfreq, period; + u_int busfreq; + int period; /* - * NB: the resulting frequency will be a quarter (even less) of the - * configured bus frequency. This is for historic reasons. The default - * bus frequency is 100 kHz. And the historic default udelay is 10 - * microseconds. The cycle of sending a bit takes four udelay-s plus - * SCL is kept low for extra two udelay-s. The actual I/O toggling also - * has an overhead. + * udelay is half a period, the clock is held high or low for this long. */ busfreq = IICBUS_GET_FREQUENCY(sc->iicbus, speed); - period = 1000000 / busfreq; /* Hz -> uS */ + period = 1000000 / 2 / busfreq; /* Hz -> uS */ + period -= sc->io_latency; sc->udelay = MAX(period, 1); } From owner-svn-src-stable@freebsd.org Thu Aug 6 10:12:40 2020 Return-Path: Delivered-To: svn-src-stable@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 3942B37C7D5; Thu, 6 Aug 2020 10:12:40 +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 4BMknh0hVdz3gnP; Thu, 6 Aug 2020 10:12:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F04B62570E; Thu, 6 Aug 2020 10:12:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 076ACdDp026958; Thu, 6 Aug 2020 10:12:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076ACduT026957; Thu, 6 Aug 2020 10:12:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202008061012.076ACduT026957@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 6 Aug 2020 10:12:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363947 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 363947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 10:12:40 -0000 Author: kib Date: Thu Aug 6 10:12:39 2020 New Revision: 363947 URL: https://svnweb.freebsd.org/changeset/base/363947 Log: MFC r248454: Provide more correct description for sysctl kern.smp.cores. PR: 248454 Modified: stable/12/sys/kern/subr_smp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_smp.c ============================================================================== --- stable/12/sys/kern/subr_smp.c Thu Aug 6 08:48:23 2020 (r363946) +++ stable/12/sys/kern/subr_smp.c Thu Aug 6 10:12:39 2020 (r363947) @@ -104,7 +104,7 @@ SYSCTL_INT(_kern_smp, OID_AUTO, threads_per_core, CTLF int mp_ncores = -1; /* how many physical cores running */ SYSCTL_INT(_kern_smp, OID_AUTO, cores, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_ncores, 0, - "Number of CPUs online"); + "Number of physical cores online"); int smp_topology = 0; /* Which topology we're using. */ SYSCTL_INT(_kern_smp, OID_AUTO, topology, CTLFLAG_RDTUN, &smp_topology, 0, From owner-svn-src-stable@freebsd.org Thu Aug 6 14:07:50 2020 Return-Path: Delivered-To: svn-src-stable@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 8BC7E3A361C; Thu, 6 Aug 2020 14:07:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BMr123BwNz498x; Thu, 6 Aug 2020 14:07:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5132280FE; Thu, 6 Aug 2020 14:07:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 076E7oWO066936; Thu, 6 Aug 2020 14:07:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076E7nHJ066933; Thu, 6 Aug 2020 14:07:49 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008061407.076E7nHJ066933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Aug 2020 14:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363952 - in stable/12/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-SVN-Commit-Revision: 363952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 14:07:50 -0000 Author: markj Date: Thu Aug 6 14:07:49 2020 New Revision: 363952 URL: https://svnweb.freebsd.org/changeset/base/363952 Log: MFC r363447: MFOpenZFS: Fix zpool history unbounded memory usage PR: 247557 Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Aug 6 13:41:42 2020 (r363951) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Aug 6 14:07:49 2020 (r363952) @@ -6226,25 +6226,13 @@ typedef struct hist_cbdata { boolean_t internal; } hist_cbdata_t; -/* - * Print out the command history for a specific pool. - */ -static int -get_history_one(zpool_handle_t *zhp, void *data) +static void +print_history_records(nvlist_t *nvhis, hist_cbdata_t *cb) { - nvlist_t *nvhis; nvlist_t **records; uint_t numrecords; - int ret, i; - hist_cbdata_t *cb = (hist_cbdata_t *)data; + int i; - cb->first = B_FALSE; - - (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp)); - - if ((ret = zpool_get_history(zhp, &nvhis)) != 0) - return (ret); - verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, &records, &numrecords) == 0); for (i = 0; i < numrecords; i++) { @@ -6344,8 +6332,32 @@ get_history_one(zpool_handle_t *zhp, void *data) (void) printf("]"); (void) printf("\n"); } +} + +/* + * Print out the command history for a specific pool. + */ +static int +get_history_one(zpool_handle_t *zhp, void *data) +{ + nvlist_t *nvhis; + int ret; + hist_cbdata_t *cb = (hist_cbdata_t *)data; + uint64_t off = 0; + boolean_t eof = B_FALSE; + + cb->first = B_FALSE; + + (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp)); + + while (!eof) { + if ((ret = zpool_get_history(zhp, &nvhis, &off, &eof)) != 0) + return (ret); + + print_history_records(nvhis, cb); + nvlist_free(nvhis); + } (void) printf("\n"); - nvlist_free(nvhis); return (ret); } Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Aug 6 13:41:42 2020 (r363951) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Aug 6 14:07:49 2020 (r363952) @@ -440,7 +440,8 @@ typedef enum { extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, int name_flags); extern int zpool_upgrade(zpool_handle_t *, uint64_t); -extern int zpool_get_history(zpool_handle_t *, nvlist_t **); +extern int zpool_get_history(zpool_handle_t *, nvlist_t **, uint64_t *, + boolean_t *); extern int zpool_history_unpack(char *, uint64_t, uint64_t *, nvlist_t ***, uint_t *); extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Aug 6 13:41:42 2020 (r363951) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Aug 6 14:07:49 2020 (r363952) @@ -4124,33 +4124,37 @@ zpool_history_unpack(char *buf, uint64_t bytes_read, u * Retrieve the command history of a pool. */ int -zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp) +zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp, uint64_t *off, + boolean_t *eof) { char *buf; uint64_t buflen = HIS_BUF_LEN_DEF; - uint64_t off = 0; nvlist_t **records = NULL; uint_t numrecords = 0; int err, i; + uint64_t start = *off; buf = malloc(buflen); if (buf == NULL) return (ENOMEM); - do { + /* process about 1MB at a time */ + while (*off - start < 1024 * 1024) { uint64_t bytes_read = buflen; uint64_t leftover; - if ((err = get_history(zhp, buf, &off, &bytes_read)) != 0) + if ((err = get_history(zhp, buf, off, &bytes_read)) != 0) break; /* if nothing else was read in, we're at EOF, just return */ - if (bytes_read == 0) + if (bytes_read == 0) { + *eof = B_TRUE; break; + } if ((err = zpool_history_unpack(buf, bytes_read, &leftover, &records, &numrecords)) != 0) break; - off -= leftover; + *off -= leftover; if (leftover == bytes_read) { /* * no progress made, because buffer is not big enough @@ -4165,9 +4169,7 @@ zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhi break; } } - - /* CONSTCOND */ - } while (1); + } free(buf); From owner-svn-src-stable@freebsd.org Thu Aug 6 14:08:24 2020 Return-Path: Delivered-To: svn-src-stable@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 499913A335E; Thu, 6 Aug 2020 14:08: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 4BMr1h1Hxpz49SS; Thu, 6 Aug 2020 14:08: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 0FF7227FAF; Thu, 6 Aug 2020 14:08: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 076E8NMe067023; Thu, 6 Aug 2020 14:08:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076E8Nfj067022; Thu, 6 Aug 2020 14:08:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008061408.076E8Nfj067022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Aug 2020 14:08:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363953 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 363953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 14:08:24 -0000 Author: markj Date: Thu Aug 6 14:08:23 2020 New Revision: 363953 URL: https://svnweb.freebsd.org/changeset/base/363953 Log: MFC r363682: Fix a logic error in uipc_ready_scan(). Modified: stable/12/sys/kern/uipc_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_usrreq.c ============================================================================== --- stable/12/sys/kern/uipc_usrreq.c Thu Aug 6 14:07:49 2020 (r363952) +++ stable/12/sys/kern/uipc_usrreq.c Thu Aug 6 14:08:23 2020 (r363953) @@ -1276,7 +1276,8 @@ uipc_ready_scan(struct socket *so, struct mbuf *m, int mb = mb->m_next; if (mb == NULL) { mb = n; - n = mb->m_nextpkt; + if (mb != NULL) + n = mb->m_nextpkt; } } } From owner-svn-src-stable@freebsd.org Thu Aug 6 14:16:08 2020 Return-Path: Delivered-To: svn-src-stable@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 498313A3643; Thu, 6 Aug 2020 14:16:08 +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 4BMrBc1FKrz4B2H; Thu, 6 Aug 2020 14:16:08 +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 0E16E27FC9; Thu, 6 Aug 2020 14:16:08 +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 076EG7NJ073259; Thu, 6 Aug 2020 14:16:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076EG7Q0073256; Thu, 6 Aug 2020 14:16:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008061416.076EG7Q0073256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Aug 2020 14:16:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r363954 - in stable/11/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/11/cddl/contrib/opensolaris: cmd/zpool lib/libzfs/common X-SVN-Commit-Revision: 363954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 14:16:08 -0000 Author: markj Date: Thu Aug 6 14:16:07 2020 New Revision: 363954 URL: https://svnweb.freebsd.org/changeset/base/363954 Log: MFC r363447: MFOpenZFS: Fix zpool history unbounded memory usage PR: 247557 Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Aug 6 14:08:23 2020 (r363953) +++ stable/11/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Aug 6 14:16:07 2020 (r363954) @@ -5870,25 +5870,13 @@ typedef struct hist_cbdata { boolean_t internal; } hist_cbdata_t; -/* - * Print out the command history for a specific pool. - */ -static int -get_history_one(zpool_handle_t *zhp, void *data) +static void +print_history_records(nvlist_t *nvhis, hist_cbdata_t *cb) { - nvlist_t *nvhis; nvlist_t **records; uint_t numrecords; - int ret, i; - hist_cbdata_t *cb = (hist_cbdata_t *)data; + int i; - cb->first = B_FALSE; - - (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp)); - - if ((ret = zpool_get_history(zhp, &nvhis)) != 0) - return (ret); - verify(nvlist_lookup_nvlist_array(nvhis, ZPOOL_HIST_RECORD, &records, &numrecords) == 0); for (i = 0; i < numrecords; i++) { @@ -5988,8 +5976,32 @@ get_history_one(zpool_handle_t *zhp, void *data) (void) printf("]"); (void) printf("\n"); } +} + +/* + * Print out the command history for a specific pool. + */ +static int +get_history_one(zpool_handle_t *zhp, void *data) +{ + nvlist_t *nvhis; + int ret; + hist_cbdata_t *cb = (hist_cbdata_t *)data; + uint64_t off = 0; + boolean_t eof = B_FALSE; + + cb->first = B_FALSE; + + (void) printf(gettext("History for '%s':\n"), zpool_get_name(zhp)); + + while (!eof) { + if ((ret = zpool_get_history(zhp, &nvhis, &off, &eof)) != 0) + return (ret); + + print_history_records(nvhis, cb); + nvlist_free(nvhis); + } (void) printf("\n"); - nvlist_free(nvhis); return (ret); } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Aug 6 14:08:23 2020 (r363953) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Thu Aug 6 14:16:07 2020 (r363954) @@ -422,7 +422,8 @@ extern const char *zfs_history_event_names[]; extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, boolean_t verbose); extern int zpool_upgrade(zpool_handle_t *, uint64_t); -extern int zpool_get_history(zpool_handle_t *, nvlist_t **); +extern int zpool_get_history(zpool_handle_t *, nvlist_t **, uint64_t *, + boolean_t *); extern int zpool_history_unpack(char *, uint64_t, uint64_t *, nvlist_t ***, uint_t *); extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Aug 6 14:08:23 2020 (r363953) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Aug 6 14:16:07 2020 (r363954) @@ -3998,33 +3998,37 @@ zpool_history_unpack(char *buf, uint64_t bytes_read, u * Retrieve the command history of a pool. */ int -zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp) +zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhisp, uint64_t *off, + boolean_t *eof) { char *buf; uint64_t buflen = HIS_BUF_LEN_DEF; - uint64_t off = 0; nvlist_t **records = NULL; uint_t numrecords = 0; int err, i; + uint64_t start = *off; buf = malloc(buflen); if (buf == NULL) return (ENOMEM); - do { + /* process about 1MB at a time */ + while (*off - start < 1024 * 1024) { uint64_t bytes_read = buflen; uint64_t leftover; - if ((err = get_history(zhp, buf, &off, &bytes_read)) != 0) + if ((err = get_history(zhp, buf, off, &bytes_read)) != 0) break; /* if nothing else was read in, we're at EOF, just return */ - if (bytes_read == 0) + if (bytes_read == 0) { + *eof = B_TRUE; break; + } if ((err = zpool_history_unpack(buf, bytes_read, &leftover, &records, &numrecords)) != 0) break; - off -= leftover; + *off -= leftover; if (leftover == bytes_read) { /* * no progress made, because buffer is not big enough @@ -4039,9 +4043,7 @@ zpool_get_history(zpool_handle_t *zhp, nvlist_t **nvhi break; } } - - /* CONSTCOND */ - } while (1); + } free(buf); From owner-svn-src-stable@freebsd.org Thu Aug 6 15:20:32 2020 Return-Path: Delivered-To: svn-src-stable@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 0F9B83A4D37; Thu, 6 Aug 2020 15:20:32 +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 4BMscv6lGwz4DrP; Thu, 6 Aug 2020 15:20:31 +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 CC14A8CE9; Thu, 6 Aug 2020 15:20:31 +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 076FKVTR010579; Thu, 6 Aug 2020 15:20:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076FKV2E010578; Thu, 6 Aug 2020 15:20:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008061520.076FKV2E010578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 6 Aug 2020 15:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363956 - stable/12/sys/dev/sound/pci/hda X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 363956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 15:20:32 -0000 Author: mav Date: Thu Aug 6 15:20:31 2020 New Revision: 363956 URL: https://svnweb.freebsd.org/changeset/base/363956 Log: MFC r340071: Adjust SiS 966/968 HDA controller naming. Modified: stable/12/sys/dev/sound/pci/hda/hdac.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdac.c Thu Aug 6 15:17:44 2020 (r363955) +++ stable/12/sys/dev/sound/pci/hda/hdac.c Thu Aug 6 15:20:31 2020 (r363956) @@ -185,7 +185,7 @@ static const struct { { HDA_AMD_HUDSON2, "AMD Hudson-2", 0, 0 }, { HDA_RDC_M3010, "RDC M3010", 0, 0 }, { HDA_VIA_VT82XX, "VIA VT8251/8237A",0, 0 }, - { HDA_SIS_966, "SiS 966", 0, 0 }, + { HDA_SIS_966, "SiS 966/968", 0, 0 }, { HDA_ULI_M5461, "ULI M5461", 0, 0 }, /* Unknown */ { HDA_INTEL_ALL, "Intel", 0, 0 }, From owner-svn-src-stable@freebsd.org Thu Aug 6 15:23:53 2020 Return-Path: Delivered-To: svn-src-stable@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 089E33A4DE8; Thu, 6 Aug 2020 15:23:53 +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 4BMshm6T6cz4FQ7; Thu, 6 Aug 2020 15:23:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C1940929B; Thu, 6 Aug 2020 15:23:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 076FNqKY016623; Thu, 6 Aug 2020 15:23:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076FNq7e016621; Thu, 6 Aug 2020 15:23:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008061523.076FNq7e016621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 6 Aug 2020 15:23:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363957 - stable/12/sys/dev/sound/pci/hda X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 363957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 15:23:53 -0000 Author: mav Date: Thu Aug 6 15:23:51 2020 New Revision: 363957 URL: https://svnweb.freebsd.org/changeset/base/363957 Log: MFC r354143 (by scottl): Add device IDs for the next generation of Intel HDA audio. Modified: stable/12/sys/dev/sound/pci/hda/hdac.c stable/12/sys/dev/sound/pci/hda/hdac.h stable/12/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdac.c Thu Aug 6 15:20:31 2020 (r363956) +++ stable/12/sys/dev/sound/pci/hda/hdac.c Thu Aug 6 15:23:51 2020 (r363957) @@ -108,6 +108,10 @@ static const struct { { HDA_INTEL_CFLK, "Intel Coffee Lake", 0, 0 }, { HDA_INTEL_CMLKS, "Intel Comet Lake-S", 0, 0 }, { HDA_INTEL_CNLK, "Intel Cannon Lake", 0, 0 }, + { HDA_INTEL_ICLK, "Intel Ice Lake", 0, 0 }, + { HDA_INTEL_CMLKLP, "Intel Comet Lake-LP", 0, 0 }, + { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, + { HDA_INTEL_GMLK, "Intel Gemini Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: stable/12/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdac.h Thu Aug 6 15:20:31 2020 (r363956) +++ stable/12/sys/dev/sound/pci/hda/hdac.h Thu Aug 6 15:23:51 2020 (r363957) @@ -87,6 +87,10 @@ #define HDA_INTEL_CFLK HDA_MODEL_CONSTRUCT(INTEL, 0xa348) #define HDA_INTEL_CMLKS HDA_MODEL_CONSTRUCT(INTEL, 0xa3f0) #define HDA_INTEL_CNLK HDA_MODEL_CONSTRUCT(INTEL, 0x9dc8) +#define HDA_INTEL_ICLK HDA_MODEL_CONSTRUCT(INTEL, 0x34c8) +#define HDA_INTEL_CMLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x02c8) +#define HDA_INTEL_CMLKH HDA_MODEL_CONSTRUCT(INTEL, 0x06c8) +#define HDA_INTEL_GMLK HDA_MODEL_CONSTRUCT(INTEL, 0x3198) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) /* Nvidia */ @@ -709,6 +713,7 @@ /* INTEL */ #define HDA_CODEC_INTELIP HDA_CODEC_CONSTRUCT(INTEL, 0x0054) +#define HDA_CODEC_INTELGMLK HDA_CODEC_CONSTRUCT(INTEL, 0x2800) #define HDA_CODEC_INTELBL HDA_CODEC_CONSTRUCT(INTEL, 0x2801) #define HDA_CODEC_INTELCA HDA_CODEC_CONSTRUCT(INTEL, 0x2802) #define HDA_CODEC_INTELEL HDA_CODEC_CONSTRUCT(INTEL, 0x2803) @@ -718,7 +723,11 @@ #define HDA_CODEC_INTELHSW HDA_CODEC_CONSTRUCT(INTEL, 0x2807) #define HDA_CODEC_INTELBDW HDA_CODEC_CONSTRUCT(INTEL, 0x2808) #define HDA_CODEC_INTELSKLK HDA_CODEC_CONSTRUCT(INTEL, 0x2809) +#define HDA_CODEC_INTELBXTN HDA_CODEC_CONSTRUCT(INTEL, 0x280a) #define HDA_CODEC_INTELKBLK HDA_CODEC_CONSTRUCT(INTEL, 0x280b) +#define HDA_CODEC_INTELCNLK HDA_CODEC_CONSTRUCT(INTEL, 0x280c) +#define HDA_CODEC_INTELGMLK1 HDA_CODEC_CONSTRUCT(INTEL, 0x280d) +#define HDA_CODEC_INTELICLK HDA_CODEC_CONSTRUCT(INTEL, 0x280f) #define HDA_CODEC_INTELJLK HDA_CODEC_CONSTRUCT(INTEL, 0x281a) #define HDA_CODEC_INTELELLK HDA_CODEC_CONSTRUCT(INTEL, 0x281b) #define HDA_CODEC_INTELCT HDA_CODEC_CONSTRUCT(INTEL, 0x2880) Modified: stable/12/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdacc.c Thu Aug 6 15:20:31 2020 (r363956) +++ stable/12/sys/dev/sound/pci/hda/hdacc.c Thu Aug 6 15:23:51 2020 (r363957) @@ -387,6 +387,11 @@ static const struct { { HDA_CODEC_INTELVV2, 0, "Intel Valleyview2" }, { HDA_CODEC_INTELBR, 0, "Intel Braswell" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, + { HDA_CODEC_INTELBXTN, 0, "Intel Broxton" }, + { HDA_CODEC_INTELCNLK, 0, "Intel Cannonlake" }, + { HDA_CODEC_INTELGMLK, 0, "Intel Geminilake" }, + { HDA_CODEC_INTELGMLK1, 0, "Intel Geminilake" }, + { HDA_CODEC_INTELICLK, 0, "Intel Icelake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ From owner-svn-src-stable@freebsd.org Thu Aug 6 15:25:12 2020 Return-Path: Delivered-To: svn-src-stable@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 9F3543A503A; Thu, 6 Aug 2020 15:25:12 +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 4BMskJ3h7qz4FP7; Thu, 6 Aug 2020 15:25:12 +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 61C758F43; Thu, 6 Aug 2020 15:25:12 +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 076FPCxo016770; Thu, 6 Aug 2020 15:25:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076FPB2d016766; Thu, 6 Aug 2020 15:25:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008061525.076FPB2d016766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 6 Aug 2020 15:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363958 - stable/12/sys/dev/sound/pci/hda X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 363958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 15:25:12 -0000 Author: mav Date: Thu Aug 6 15:25:11 2020 New Revision: 363958 URL: https://svnweb.freebsd.org/changeset/base/363958 Log: MFC r355429 (by scottl): Add support for new sound HDA hardware Modified: stable/12/sys/dev/sound/pci/hda/hdac.c stable/12/sys/dev/sound/pci/hda/hdac.h stable/12/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdac.c Thu Aug 6 15:23:51 2020 (r363957) +++ stable/12/sys/dev/sound/pci/hda/hdac.c Thu Aug 6 15:25:11 2020 (r363958) @@ -111,6 +111,7 @@ static const struct { { HDA_INTEL_ICLK, "Intel Ice Lake", 0, 0 }, { HDA_INTEL_CMLKLP, "Intel Comet Lake-LP", 0, 0 }, { HDA_INTEL_CMLKH, "Intel Comet Lake-H", 0, 0 }, + { HDA_INTEL_TGLK, "Intel Tiger Lake", 0, 0 }, { HDA_INTEL_GMLK, "Intel Gemini Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, Modified: stable/12/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdac.h Thu Aug 6 15:23:51 2020 (r363957) +++ stable/12/sys/dev/sound/pci/hda/hdac.h Thu Aug 6 15:25:11 2020 (r363958) @@ -90,6 +90,7 @@ #define HDA_INTEL_ICLK HDA_MODEL_CONSTRUCT(INTEL, 0x34c8) #define HDA_INTEL_CMLKLP HDA_MODEL_CONSTRUCT(INTEL, 0x02c8) #define HDA_INTEL_CMLKH HDA_MODEL_CONSTRUCT(INTEL, 0x06c8) +#define HDA_INTEL_TGLK HDA_MODEL_CONSTRUCT(INTEL, 0xa0c8) #define HDA_INTEL_GMLK HDA_MODEL_CONSTRUCT(INTEL, 0x3198) #define HDA_INTEL_ALL HDA_MODEL_CONSTRUCT(INTEL, 0xffff) @@ -728,6 +729,7 @@ #define HDA_CODEC_INTELCNLK HDA_CODEC_CONSTRUCT(INTEL, 0x280c) #define HDA_CODEC_INTELGMLK1 HDA_CODEC_CONSTRUCT(INTEL, 0x280d) #define HDA_CODEC_INTELICLK HDA_CODEC_CONSTRUCT(INTEL, 0x280f) +#define HDA_CODEC_INTELTGLK HDA_CODEC_CONSTRUCT(INTEL, 0x2812) #define HDA_CODEC_INTELJLK HDA_CODEC_CONSTRUCT(INTEL, 0x281a) #define HDA_CODEC_INTELELLK HDA_CODEC_CONSTRUCT(INTEL, 0x281b) #define HDA_CODEC_INTELCT HDA_CODEC_CONSTRUCT(INTEL, 0x2880) Modified: stable/12/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/12/sys/dev/sound/pci/hda/hdacc.c Thu Aug 6 15:23:51 2020 (r363957) +++ stable/12/sys/dev/sound/pci/hda/hdacc.c Thu Aug 6 15:25:11 2020 (r363958) @@ -392,6 +392,7 @@ static const struct { { HDA_CODEC_INTELGMLK, 0, "Intel Geminilake" }, { HDA_CODEC_INTELGMLK1, 0, "Intel Geminilake" }, { HDA_CODEC_INTELICLK, 0, "Intel Icelake" }, + { HDA_CODEC_INTELTGLK, 0, "Intel Tigerlake" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, /* Unknown CODECs */ From owner-svn-src-stable@freebsd.org Thu Aug 6 18:13:46 2020 Return-Path: Delivered-To: svn-src-stable@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 4AD1B3A8244; Thu, 6 Aug 2020 18:13: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 4BMxSp12Ghz4QZp; Thu, 6 Aug 2020 18:13: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 08171B045; Thu, 6 Aug 2020 18:13: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 076IDjI5021512; Thu, 6 Aug 2020 18:13:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076IDjdu021510; Thu, 6 Aug 2020 18:13:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008061813.076IDjdu021510@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Aug 2020 18:13:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363973 - in stable/12: etc etc/mail usr.sbin/mailwrapper X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: etc etc/mail usr.sbin/mailwrapper X-SVN-Commit-Revision: 363973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 18:13:46 -0000 Author: kevans Date: Thu Aug 6 18:13:45 2020 New Revision: 363973 URL: https://svnweb.freebsd.org/changeset/base/363973 Log: MFC r361720, r362787: Simplify mailer.conf installation r361720: pkgbase: resolve mailer.conf conflict WITHOUT_SENDMAIL When WITHOUT_SENDMAIL is set, we end up with two different mailer.conf that conflict, and hilarity ensues. There's currently three different places that we might install mailer.conf: - ^/etc/Makefile (package=runtime, contingent on MK_MAIL != no) - ^/libexec/dma/dmagent/Makefile (package=dma, contingent on MK_SENDMAIL != no) - ^/usr.sbin/mailwrapper/Makefile (package=utilities, contingent on not-installed) The mailwrapper installation will effectively never happen because the ^/etc one will first. This patch simplifies the whole situation; remove the ^/etc/Makefile version and install it primarily in mailwrapper if MK_MAILWRAPPER != "no". The scenarios covered in mailwrapper are: - sendmail(8) is installed, dma(8) may or may not be installed - neither sendmail(8) nor dma(8) is installed In the first scenario, sendmail(8) is dominant so we can go ahead and install the version in ^/etc/mail. In the unlisted scenario, sendmail(8) is not installed but dma(8) is, we'll let ^/libexec/dma/dmagent do the installation. In the second listed scenario, we still want to install an example mailer.conf so just install the base sendmail(8) version. r362787: mailwrapper: switch mailer.conf to CONFS This matches what was already being done in dma(8), and should again make this merge with etcupdate/mergemaster. Modified: stable/12/etc/Makefile stable/12/etc/mail/mailer.conf stable/12/usr.sbin/mailwrapper/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/etc/Makefile ============================================================================== --- stable/12/etc/Makefile Thu Aug 6 17:49:19 2020 (r363972) +++ stable/12/etc/Makefile Thu Aug 6 18:13:45 2020 (r363973) @@ -25,11 +25,10 @@ BIN1= \ BIN1+= rc.sendmail .endif -.if ${MK_SENDMAIL} == "no" -ETCMAIL=mailer.conf aliases -.else -ETCMAIL=Makefile README mailer.conf access.sample virtusertable.sample \ - mailertable.sample aliases +ETCMAIL=aliases +.if ${MK_SENDMAIL} != "no" +ETCMAIL+=Makefile README access.sample virtusertable.sample \ + mailertable.sample .endif # Special top level files for FreeBSD Modified: stable/12/etc/mail/mailer.conf ============================================================================== --- stable/12/etc/mail/mailer.conf Thu Aug 6 17:49:19 2020 (r363972) +++ stable/12/etc/mail/mailer.conf Thu Aug 6 18:13:45 2020 (r363973) @@ -2,6 +2,9 @@ # # Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail # +# If dma(8) is installed, an example mailer.conf that uses dma(8) instead can +# can be found in /usr/share/examples/dma. +# sendmail /usr/libexec/sendmail/sendmail mailq /usr/libexec/sendmail/sendmail newaliases /usr/libexec/sendmail/sendmail Modified: stable/12/usr.sbin/mailwrapper/Makefile ============================================================================== --- stable/12/usr.sbin/mailwrapper/Makefile Thu Aug 6 17:49:19 2020 (r363972) +++ stable/12/usr.sbin/mailwrapper/Makefile Thu Aug 6 18:13:45 2020 (r363973) @@ -26,10 +26,14 @@ SYMLINKS+= ..${BINDIR}/mailwrapper /bin/rmail .endif .if ${MK_MAILWRAPPER} != "no" -.if !exists(${DESTDIR}/etc/mail/mailer.conf) -FILES= ${SRCTOP}/etc/mail/mailer.conf -FILESDIR= /etc/mail -FILESMODE= 644 +# We install here if either sendmail(8) is enabled, or dma(8) isn't. In the +# latter scenario, we take care of the possibility that neither sendmail(8) nor +# dma(8) are installed and simply provide a default that can be changed for an +# alternative in ports. +.if ${MK_SENDMAIL} != "no" || ${MK_DMAGENT} == "no" +CONFS= ${SRCTOP}/etc/mail/mailer.conf +CONFSDIR= /etc/mail +CONFSMODE= 644 .endif .endif From owner-svn-src-stable@freebsd.org Thu Aug 6 18:17:20 2020 Return-Path: Delivered-To: svn-src-stable@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 7B59B3A8277; Thu, 6 Aug 2020 18:17:20 +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 4BMxXw2jWdz4R68; Thu, 6 Aug 2020 18:17:20 +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 3C112AE64; Thu, 6 Aug 2020 18:17:20 +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 076IHK4T021726; Thu, 6 Aug 2020 18:17:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076IHKe8021725; Thu, 6 Aug 2020 18:17:20 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202008061817.076IHKe8021725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 6 Aug 2020 18:17:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363974 - stable/12/usr.bin/diff/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/usr.bin/diff/tests X-SVN-Commit-Revision: 363974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 18:17:20 -0000 Author: kevans Date: Thu Aug 6 18:17:19 2020 New Revision: 363974 URL: https://svnweb.freebsd.org/changeset/base/363974 Log: MFC r363692: diff: fix side_by_side It's currently unclear to me how this could have worked previously; \n here is not a literal newline but actual '\' 'n', and was getting passed to the underlying regex engine as such. regex(3) does not translate this to a newline, and this became an error because we don't really allow escaping of arbitrary ordinary characters anymore. Run the pattern strings through printf to make sure we're dealing with real newlines before passing them through to atf_check, which ultimately feeds them directly to regcomp(3). This fix is different than that will be needed for sed, in that this is the proper way to inject newlines into search strings as long as regex(3) won't combine \ + n as folks might expect. Modified: stable/12/usr.bin/diff/tests/diff_test.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/diff/tests/diff_test.sh ============================================================================== --- stable/12/usr.bin/diff/tests/diff_test.sh Thu Aug 6 18:13:45 2020 (r363973) +++ stable/12/usr.bin/diff/tests/diff_test.sh Thu Aug 6 18:17:19 2020 (r363974) @@ -106,8 +106,8 @@ side_by_side_body() atf_check -o save:A printf "A\nB\nC\n" atf_check -o save:B printf "D\nB\nE\n" - exp_output="A[[:space:]]+|[[:space:]]+D\nB[[:space:]]+B\nC[[:space:]]+|[[:space:]]+E" - exp_output_suppressed="A[[:space:]]+|[[:space:]]+D\nC[[:space:]]+|[[:space:]]+E" + exp_output=$(printf "A[[:space:]]+|[[:space:]]+D\nB[[:space:]]+B\nC[[:space:]]+|[[:space:]]+E") + exp_output_suppressed=$(printf "A[[:space:]]+|[[:space:]]+D\nC[[:space:]]+|[[:space:]]+E") atf_check -o match:"$exp_output" -s exit:1 \ diff --side-by-side A B From owner-svn-src-stable@freebsd.org Thu Aug 6 20:44:19 2020 Return-Path: Delivered-To: svn-src-stable@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 8C3E43AA79B; Thu, 6 Aug 2020 20:44:19 +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 4BN0pW3CfLz4Ysx; Thu, 6 Aug 2020 20:44:19 +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 51704CA4A; Thu, 6 Aug 2020 20:44:19 +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 076KiJ4x013543; Thu, 6 Aug 2020 20:44:19 GMT (envelope-from alfredo@FreeBSD.org) Received: (from alfredo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 076KiI65013541; Thu, 6 Aug 2020 20:44:18 GMT (envelope-from alfredo@FreeBSD.org) Message-Id: <202008062044.076KiI65013541@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alfredo set sender to alfredo@FreeBSD.org using -f From: "Alfredo Dal'Ava Junior" Date: Thu, 6 Aug 2020 20:44:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363990 - stable/12/lib/libkvm/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: alfredo X-SVN-Commit-Paths: stable/12/lib/libkvm/tests X-SVN-Commit-Revision: 363990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2020 20:44:19 -0000 Author: alfredo Date: Thu Aug 6 20:44:18 2020 New Revision: 363990 URL: https://svnweb.freebsd.org/changeset/base/363990 Log: MFC r363020: test: add libkvm read test This test checks if value received from kvm_read is sane, based on value returned by sysctl interface. Reviewed by: jhb Approved by: jhibbits (mentor) Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D23783 Added: stable/12/lib/libkvm/tests/kvm_read_test.c - copied unchanged from r363020, head/lib/libkvm/tests/kvm_read_test.c Modified: stable/12/lib/libkvm/tests/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libkvm/tests/Makefile ============================================================================== --- stable/12/lib/libkvm/tests/Makefile Thu Aug 6 20:33:17 2020 (r363989) +++ stable/12/lib/libkvm/tests/Makefile Thu Aug 6 20:44:18 2020 (r363990) @@ -6,8 +6,10 @@ ATF_TESTS_C+= kvm_close_test ATF_TESTS_C+= kvm_geterr_test ATF_TESTS_C+= kvm_open_test ATF_TESTS_C+= kvm_open2_test +ATF_TESTS_C+= kvm_read_test CFLAGS.kvm_geterr_test+= -I${.CURDIR:H} +CFLAGS.kvm_read_test+= -I${.CURDIR:H} LIBADD+= kvm @@ -15,7 +17,7 @@ WARNS?= 6 BINDIR= ${TESTSDIR} -.for t in kvm_geterr_test kvm_open_test kvm_open2_test +.for t in kvm_geterr_test kvm_open_test kvm_open2_test kvm_read_test SRCS.$t= $t.c kvm_test_common.c .endfor Copied: stable/12/lib/libkvm/tests/kvm_read_test.c (from r363020, head/lib/libkvm/tests/kvm_read_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/lib/libkvm/tests/kvm_read_test.c Thu Aug 6 20:44:18 2020 (r363990, copy of r363020, head/lib/libkvm/tests/kvm_read_test.c) @@ -0,0 +1,98 @@ +/*- + * Copyright (c) 2020 Alfredo Dal'Ava Junior + * Copyright (c) 2017 Enji Cooper + * + * 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. + * + * From: FreeBSD: src/lib/libkvm/tests/kvm_geterr_test.c + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "kvm_test_common.h" + +ATF_TC(kvm_read_positive_test_no_error); +ATF_TC_HEAD(kvm_read_positive_test_no_error, tc) +{ + + atf_tc_set_md_var(tc, "descr", + "test that kvm_read returns a sane value"); + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(kvm_read_positive_test_no_error, tc) +{ + kvm_t *kd; + struct nlist nl[] = { +#define SYMNAME "_mp_maxcpus" +#define X_MAXCPUS 0 + { SYMNAME, 0, 0, 0, 0 }, + { NULL, 0, 0, 0, 0 }, + }; + ssize_t rc; + int sysctl_maxcpus, mp_maxcpus, retcode; + size_t len = sizeof(sysctl_maxcpus); + + errbuf_clear(); + kd = kvm_open(NULL, NULL, NULL, O_RDONLY, errbuf); + ATF_CHECK(!errbuf_has_error(errbuf)); + ATF_REQUIRE_MSG(kd != NULL, "kvm_open failed: %s", errbuf); + retcode = kvm_nlist(kd, nl); + ATF_REQUIRE_MSG(retcode != -1, + "kvm_nlist failed (returned %d): %s", retcode, kvm_geterr(kd)); + if (nl[X_MAXCPUS].n_type == 0) + atf_tc_skip("symbol (\"%s\") couldn't be found", SYMNAME); + + rc = kvm_read(kd, nl[X_MAXCPUS].n_value, &mp_maxcpus, + sizeof(mp_maxcpus)); + + ATF_REQUIRE_MSG(rc != -1, "kvm_read failed: %s", kvm_geterr(kd)); + ATF_REQUIRE_MSG(kvm_close(kd) == 0, "kvm_close failed: %s", + strerror(errno)); + + /* Check if value read from kvm_read is sane */ + retcode = sysctlbyname("kern.smp.maxcpus", &sysctl_maxcpus, &len, NULL, 0); + ATF_REQUIRE_MSG(retcode == 0, "sysctl read failed : %d", retcode); + ATF_REQUIRE_EQ_MSG(mp_maxcpus, sysctl_maxcpus, + "failed: kvm_read of mp_maxcpus returned %d but sysctl maxcpus returned %d", + mp_maxcpus, sysctl_maxcpus); +} + +ATF_TP_ADD_TCS(tp) +{ + + ATF_TP_ADD_TC(tp, kvm_read_positive_test_no_error); + return (atf_no_error()); +} From owner-svn-src-stable@freebsd.org Fri Aug 7 00:26:16 2020 Return-Path: Delivered-To: svn-src-stable@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 EE6203AEEB7; Fri, 7 Aug 2020 00:26:16 +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 4BN5kc67BFz3Xt5; Fri, 7 Aug 2020 00:26:16 +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 B5A5EF68B; Fri, 7 Aug 2020 00:26:16 +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 0770QGEp048875; Fri, 7 Aug 2020 00:26:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0770QGwn048874; Fri, 7 Aug 2020 00:26:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008070026.0770QGwn048874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 00:26:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363998 - stable/12/sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/x86/x86 X-SVN-Commit-Revision: 363998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 00:26:17 -0000 Author: mav Date: Fri Aug 7 00:26:16 2020 New Revision: 363998 URL: https://svnweb.freebsd.org/changeset/base/363998 Log: MFC r363490: Make lapic_ipi_vectored(APIC_IPI_DEST_SELF) NMI safe. Sending IPI to self or all CPUs does not require write into upper part of the ICR, prone to races. Previously the code disabled interrupts, but it was not enough for NMIs. Instead of that when possible write only lower part of the register, or use special SELF IPI register in x2APIC mode. This also removes ICR reads used to preserve reserved bits on write. It was there from the beginning, but I failed to find explanation why, neither I see Linux doing it. Specification even tells that ICR content may be lost in deep C-states, so if hardware does not bother to preserve it, why should we? Modified: stable/12/sys/x86/x86/local_apic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/local_apic.c ============================================================================== --- stable/12/sys/x86/x86/local_apic.c Thu Aug 6 21:37:38 2020 (r363997) +++ stable/12/sys/x86/x86/local_apic.c Fri Aug 7 00:26:16 2020 (r363998) @@ -253,22 +253,6 @@ lapic_write32_nofence(enum LAPIC_REGISTERS reg, uint32 #ifdef SMP static uint64_t -lapic_read_icr(void) -{ - uint64_t v; - uint32_t vhi, vlo; - - if (x2apic_mode) { - v = rdmsr(MSR_APIC_000 + LAPIC_ICR_LO); - } else { - vhi = lapic_read32(LAPIC_ICR_HI); - vlo = lapic_read32(LAPIC_ICR_LO); - v = ((uint64_t)vhi << 32) | vlo; - } - return (v); -} - -static uint64_t lapic_read_icr_lo(void) { @@ -278,6 +262,7 @@ lapic_read_icr_lo(void) static void lapic_write_icr(uint32_t vhi, uint32_t vlo) { + register_t saveintr; uint64_t v; if (x2apic_mode) { @@ -285,10 +270,32 @@ lapic_write_icr(uint32_t vhi, uint32_t vlo) mfence(); wrmsr(MSR_APIC_000 + LAPIC_ICR_LO, v); } else { + saveintr = intr_disable(); lapic_write32(LAPIC_ICR_HI, vhi); lapic_write32(LAPIC_ICR_LO, vlo); + intr_restore(saveintr); } } + +static void +lapic_write_icr_lo(uint32_t vlo) +{ + + if (x2apic_mode) { + mfence(); + wrmsr(MSR_APIC_000 + LAPIC_ICR_LO, vlo); + } else { + lapic_write32(LAPIC_ICR_LO, vlo); + } +} + +static void +lapic_write_self_ipi(uint32_t vector) +{ + + KASSERT(x2apic_mode, ("SELF IPI write in xAPIC mode")); + wrmsr(MSR_APIC_000 + LAPIC_SELF_IPI, vector); +} #endif /* SMP */ static void @@ -1997,9 +2004,7 @@ native_lapic_ipi_wait(int delay) static void native_lapic_ipi_raw(register_t icrlo, u_int dest) { - uint64_t icr; - uint32_t vhi, vlo; - register_t saveintr; + uint32_t icrhi; /* XXX: Need more sanity checking of icrlo? */ KASSERT(x2apic_mode || lapic_map != NULL, @@ -2010,35 +2015,15 @@ native_lapic_ipi_raw(register_t icrlo, u_int dest) KASSERT((icrlo & APIC_ICRLO_RESV_MASK) == 0, ("%s: reserved bits set in ICR LO register", __func__)); - /* Set destination in ICR HI register if it is being used. */ - if (!x2apic_mode) { - saveintr = intr_disable(); - icr = lapic_read_icr(); - } - if ((icrlo & APIC_DEST_MASK) == APIC_DEST_DESTFLD) { - if (x2apic_mode) { - vhi = dest; - } else { - vhi = icr >> 32; - vhi &= ~APIC_ID_MASK; - vhi |= dest << APIC_ID_SHIFT; - } + if (x2apic_mode) + icrhi = dest; + else + icrhi = dest << APIC_ID_SHIFT; + lapic_write_icr(icrhi, icrlo); } else { - vhi = 0; + lapic_write_icr_lo(icrlo); } - - /* Program the contents of the IPI and dispatch it. */ - if (x2apic_mode) { - vlo = icrlo; - } else { - vlo = icr; - vlo &= APIC_ICRLO_RESV_MASK; - vlo |= icrlo; - } - lapic_write_icr(vhi, vlo); - if (!x2apic_mode) - intr_restore(saveintr); } #define BEFORE_SPIN 50000 @@ -2054,33 +2039,38 @@ native_lapic_ipi_vectored(u_int vector, int dest) KASSERT((vector & ~APIC_VECTOR_MASK) == 0, ("%s: invalid vector %d", __func__, vector)); - icrlo = APIC_DESTMODE_PHY | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT; - - /* - * NMI IPIs are just fake vectors used to send a NMI. Use special rules - * regarding NMIs if passed, otherwise specify the vector. - */ - if (vector >= IPI_NMI_FIRST) - icrlo |= APIC_DELMODE_NMI; - else - icrlo |= vector | APIC_DELMODE_FIXED; destfield = 0; switch (dest) { case APIC_IPI_DEST_SELF: - icrlo |= APIC_DEST_SELF; + if (x2apic_mode && vector < IPI_NMI_FIRST) { + lapic_write_self_ipi(vector); + return; + } + icrlo = APIC_DEST_SELF; break; case APIC_IPI_DEST_ALL: - icrlo |= APIC_DEST_ALLISELF; + icrlo = APIC_DEST_ALLISELF; break; case APIC_IPI_DEST_OTHERS: - icrlo |= APIC_DEST_ALLESELF; + icrlo = APIC_DEST_ALLESELF; break; default: + icrlo = 0; KASSERT(x2apic_mode || (dest & ~(APIC_ID_MASK >> APIC_ID_SHIFT)) == 0, ("%s: invalid destination 0x%x", __func__, dest)); destfield = dest; } + + /* + * NMI IPIs are just fake vectors used to send a NMI. Use special rules + * regarding NMIs if passed, otherwise specify the vector. + */ + if (vector >= IPI_NMI_FIRST) + icrlo |= APIC_DELMODE_NMI; + else + icrlo |= vector | APIC_DELMODE_FIXED; + icrlo |= APIC_DESTMODE_PHY | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT; /* Wait for an earlier IPI to finish. */ if (!lapic_ipi_wait(BEFORE_SPIN)) { From owner-svn-src-stable@freebsd.org Fri Aug 7 00:33:29 2020 Return-Path: Delivered-To: svn-src-stable@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 7F5E33AF12E; Fri, 7 Aug 2020 00:33:29 +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 4BN5tx2qdYz3Y9q; Fri, 7 Aug 2020 00:33:29 +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 4472BF7C2; Fri, 7 Aug 2020 00:33:29 +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 0770XTI1054770; Fri, 7 Aug 2020 00:33:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0770XShW054768; Fri, 7 Aug 2020 00:33:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008070033.0770XShW054768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 00:33:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r363999 - in stable/12/sys/x86: include x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/x86: include x86 X-SVN-Commit-Revision: 363999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 00:33:29 -0000 Author: mav Date: Fri Aug 7 00:33:28 2020 New Revision: 363999 URL: https://svnweb.freebsd.org/changeset/base/363999 Log: MFC r363495: Introduce ipi_self_from_nmi(). It allows safe IPI sending to current CPU from NMI context. Unlike other ipi_*() functions this waits for delivery to leave LAPIC in a state safe for interrupted code. Modified: stable/12/sys/x86/include/x86_smp.h stable/12/sys/x86/x86/mp_x86.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/include/x86_smp.h ============================================================================== --- stable/12/sys/x86/include/x86_smp.h Fri Aug 7 00:26:16 2020 (r363998) +++ stable/12/sys/x86/include/x86_smp.h Fri Aug 7 00:33:28 2020 (r363999) @@ -101,6 +101,7 @@ void ipi_bitmap_handler(struct trapframe frame); void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); void ipi_selected(cpuset_t cpus, u_int ipi); +void ipi_self_from_nmi(u_int vector); void set_interrupt_apic_ids(void); void smp_cache_flush(smp_invl_cb_t curcpu_cb); void smp_masked_invlpg(cpuset_t mask, vm_offset_t addr, struct pmap *pmap, Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Fri Aug 7 00:26:16 2020 (r363998) +++ stable/12/sys/x86/x86/mp_x86.c Fri Aug 7 00:33:28 2020 (r363999) @@ -1350,6 +1350,21 @@ ipi_all_but_self(u_int ipi) lapic_ipi_vectored(ipi, APIC_IPI_DEST_OTHERS); } +void +ipi_self_from_nmi(u_int vector) +{ + + lapic_ipi_vectored(vector, APIC_IPI_DEST_SELF); + + /* Wait for IPI to finish. */ + if (!lapic_ipi_wait(50000)) { + if (KERNEL_PANICKED()) + return; + else + panic("APIC: IPI is stuck"); + } +} + int ipi_nmi_handler(void) { From owner-svn-src-stable@freebsd.org Fri Aug 7 00:40:31 2020 Return-Path: Delivered-To: svn-src-stable@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 AF67E3AF2C4; Fri, 7 Aug 2020 00:40:31 +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 4BN6334Ckdz3YZ6; Fri, 7 Aug 2020 00:40:31 +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 6F5EBF88D; Fri, 7 Aug 2020 00:40:31 +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 0770eVRq055217; Fri, 7 Aug 2020 00:40:31 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0770eS4D055204; Fri, 7 Aug 2020 00:40:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008070040.0770eS4D055204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 00:40:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364000 - in stable/12: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/kern sys/sys sys/x86/include sys/x86/x86 sys/x86/xen X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: share/man/man9 sys/amd64/amd64 sys/amd64/include sys/i386/i386 sys/kern sys/sys sys/x86/include sys/x86/x86 sys/x86/xen X-SVN-Commit-Revision: 364000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 00:40:31 -0000 Author: mav Date: Fri Aug 7 00:40:28 2020 New Revision: 364000 URL: https://svnweb.freebsd.org/changeset/base/364000 Log: MFC r363527: Allow swi_sched() to be called from NMI context. For purposes of handling hardware error reported via NMIs I need a way to escape NMI context, being too restrictive to do something significant. To do it this change introduces new swi_sched() flag SWI_FROMNMI, making it careful about used KPIs. On platforms allowing IPI sending from NMI context (x86 for now) it immediately wakes clk_intr_event via new IPI_SWI, otherwise it works just like SWI_DELAY. Modified: stable/12/share/man/man9/swi.9 stable/12/sys/amd64/amd64/apic_vector.S stable/12/sys/amd64/amd64/mp_machdep.c stable/12/sys/amd64/include/smp.h stable/12/sys/i386/i386/apic_vector.s stable/12/sys/i386/i386/mp_machdep.c stable/12/sys/kern/kern_intr.c stable/12/sys/sys/interrupt.h stable/12/sys/x86/include/apicvar.h stable/12/sys/x86/include/x86_smp.h stable/12/sys/x86/x86/mp_x86.c stable/12/sys/x86/xen/xen_apic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man9/swi.9 ============================================================================== --- stable/12/share/man/man9/swi.9 Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/share/man/man9/swi.9 Fri Aug 7 00:40:28 2020 (r364000) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 19, 2012 +.Dd July 25, 2020 .Dt SWI 9 .Os .Sh NAME @@ -133,7 +133,7 @@ The .Fa flags argument specifies how and when the handler should be run and is a mask of one or more of the following flags: -.Bl -tag -width SWI_DELAY +.Bl -tag -width SWI_FROMNMI .It Dv SWI_DELAY Specifies that the kernel should mark the specified handler as needing to run, but the kernel should not schedule the software interrupt thread to run. @@ -147,6 +147,13 @@ functionality performed by .Fn setdelayed in earlier versions of .Fx . +.It Dv SWI_FROMNMI +Specifies that +.Fn swi_sched +is called from NMI context and should be careful about used KPIs. +On platforms allowing IPI sending from NMI context it immediately wakes +.Va clk_intr_event +via the IPI, otherwise it works just like SWI_DELAY. .El .Pp The Modified: stable/12/sys/amd64/amd64/apic_vector.S ============================================================================== --- stable/12/sys/amd64/amd64/apic_vector.S Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/amd64/amd64/apic_vector.S Fri Aug 7 00:40:28 2020 (r364000) @@ -256,6 +256,16 @@ invltlb_ret: jmp doreti /* + * Executed by a CPU when it receives an IPI_SWI. + */ + INTR_HANDLER ipi_swi + call as_lapic_eoi + FAKE_MCOUNT(TF_RIP(%rsp)) + call ipi_swi_handler + MEXITCOUNT + jmp doreti + +/* * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU. * * - Calls the generic rendezvous action function. Modified: stable/12/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/mp_machdep.c Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/amd64/amd64/mp_machdep.c Fri Aug 7 00:40:28 2020 (r364000) @@ -251,6 +251,10 @@ cpu_mp_start(void) setidt(IPI_SUSPEND, pti ? IDTVEC(cpususpend_pti) : IDTVEC(cpususpend), SDT_SYSIGT, SEL_KPL, 0); + /* Install an IPI for calling delayed SWI */ + setidt(IPI_SWI, pti ? IDTVEC(ipi_swi_pti) : IDTVEC(ipi_swi), + SDT_SYSIGT, SEL_KPL, 0); + /* Set boot_cpu_id if needed. */ if (boot_cpu_id == -1) { boot_cpu_id = PCPU_GET(apic_id); Modified: stable/12/sys/amd64/include/smp.h ============================================================================== --- stable/12/sys/amd64/include/smp.h Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/amd64/include/smp.h Fri Aug 7 00:40:28 2020 (r364000) @@ -46,6 +46,7 @@ inthand_t IDTVEC(invlrng_pcid), IDTVEC(invlcache_pti), IDTVEC(ipi_intr_bitmap_handler_pti), + IDTVEC(ipi_swi_pti), IDTVEC(cpustop_pti), IDTVEC(cpususpend_pti), IDTVEC(rendezvous_pti); Modified: stable/12/sys/i386/i386/apic_vector.s ============================================================================== --- stable/12/sys/i386/i386/apic_vector.s Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/i386/i386/apic_vector.s Fri Aug 7 00:40:28 2020 (r364000) @@ -309,6 +309,23 @@ IDTVEC(cpususpend) jmp doreti /* + * Executed by a CPU when it receives an IPI_SWI. + */ + .text + SUPERALIGN_TEXT +IDTVEC(ipi_swi) + PUSH_FRAME + SET_KERNEL_SREGS + cld + KENTER + call as_lapic_eoi + FAKE_MCOUNT(TF_EIP(%esp)) + movl $ipi_swi_handler, %eax + call *%eax + MEXITCOUNT + jmp doreti + +/* * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU. * * - Calls the generic rendezvous action function. Modified: stable/12/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/12/sys/i386/i386/mp_machdep.c Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/i386/i386/mp_machdep.c Fri Aug 7 00:40:28 2020 (r364000) @@ -188,6 +188,10 @@ cpu_mp_start(void) setidt(IPI_SUSPEND, IDTVEC(cpususpend), SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); + /* Install an IPI for calling delayed SWI */ + setidt(IPI_SWI, IDTVEC(ipi_swi), + SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); + /* Set boot_cpu_id if needed. */ if (boot_cpu_id == -1) { boot_cpu_id = PCPU_GET(apic_id); Modified: stable/12/sys/kern/kern_intr.c ============================================================================== --- stable/12/sys/kern/kern_intr.c Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/kern/kern_intr.c Fri Aug 7 00:40:28 2020 (r364000) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifdef DDB #include @@ -994,7 +995,7 @@ swi_add(struct intr_event **eventp, const char *name, void *arg, int pri, enum intr_type flags, void **cookiep) { struct intr_event *ie; - int error; + int error = 0; if (flags & INTR_ENTROPY) return (EINVAL); @@ -1012,8 +1013,10 @@ swi_add(struct intr_event **eventp, const char *name, if (eventp != NULL) *eventp = ie; } - error = intr_event_add_handler(ie, name, NULL, handler, arg, - PI_SWI(pri), flags, cookiep); + if (handler != NULL) { + error = intr_event_add_handler(ie, name, NULL, handler, arg, + PI_SWI(pri), flags, cookiep); + } return (error); } @@ -1031,9 +1034,11 @@ swi_sched(void *cookie, int flags) CTR3(KTR_INTR, "swi_sched: %s %s need=%d", ie->ie_name, ih->ih_name, ih->ih_need); - entropy.event = (uintptr_t)ih; - entropy.td = curthread; - random_harvest_queue(&entropy, sizeof(entropy), RANDOM_SWI); + if ((flags & SWI_FROMNMI) == 0) { + entropy.event = (uintptr_t)ih; + entropy.td = curthread; + random_harvest_queue(&entropy, sizeof(entropy), RANDOM_SWI); + } /* * Set ih_need for this handler so that if the ithread is already @@ -1042,7 +1047,16 @@ swi_sched(void *cookie, int flags) */ ih->ih_need = 1; - if (!(flags & SWI_DELAY)) { + if (flags & SWI_DELAY) + return; + + if (flags & SWI_FROMNMI) { +#if defined(SMP) && (defined(__i386__) || defined(__amd64__)) + KASSERT(ie == clk_intr_event, + ("SWI_FROMNMI used not with clk_intr_event")); + ipi_self_from_nmi(IPI_SWI); +#endif + } else { VM_CNT_INC(v_soft); error = intr_event_schedule_thread(ie); KASSERT(error == 0, ("stray software interrupt")); @@ -1303,6 +1317,8 @@ intr_event_handle(struct intr_event *ie, struct trapfr CK_SLIST_FOREACH(ih, &ie->ie_handlers, ih_next) { if ((ih->ih_flags & IH_SUSP) != 0) + continue; + if ((ie->ie_flags & IE_SOFT) != 0 && ih->ih_need == 0) continue; if (ih->ih_filter == NULL) { thread = true; Modified: stable/12/sys/sys/interrupt.h ============================================================================== --- stable/12/sys/sys/interrupt.h Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/sys/interrupt.h Fri Aug 7 00:40:28 2020 (r364000) @@ -133,7 +133,8 @@ struct intr_event { #define IE_ENTROPY 0x000002 /* Interrupt is an entropy source. */ #define IE_ADDING_THREAD 0x000004 /* Currently building an ithread. */ -/* Flags to pass to sched_swi. */ +/* Flags to pass to swi_sched. */ +#define SWI_FROMNMI 0x1 #define SWI_DELAY 0x2 /* Modified: stable/12/sys/x86/include/apicvar.h ============================================================================== --- stable/12/sys/x86/include/apicvar.h Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/x86/include/apicvar.h Fri Aug 7 00:40:28 2020 (r364000) @@ -129,7 +129,8 @@ #define IPI_STOP (APIC_IPI_INTS + 6) /* Stop CPU until restarted. */ #define IPI_SUSPEND (APIC_IPI_INTS + 7) /* Suspend CPU until restarted. */ -#define IPI_DYN_FIRST (APIC_IPI_INTS + 8) +#define IPI_SWI (APIC_IPI_INTS + 8) /* Run clk_intr_event. */ +#define IPI_DYN_FIRST (APIC_IPI_INTS + 9) #define IPI_DYN_LAST (253) /* IPIs allocated at runtime */ /* Modified: stable/12/sys/x86/include/x86_smp.h ============================================================================== --- stable/12/sys/x86/include/x86_smp.h Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/x86/include/x86_smp.h Fri Aug 7 00:40:28 2020 (r364000) @@ -76,6 +76,7 @@ inthand_t IDTVEC(invlrng), /* TLB shootdowns - page range */ IDTVEC(invlcache), /* Write back and invalidate cache */ IDTVEC(ipi_intr_bitmap_handler), /* Bitmap based IPIs */ + IDTVEC(ipi_swi), /* Runs delayed SWI */ IDTVEC(cpustop), /* CPU stops & waits to be restarted */ IDTVEC(cpususpend), /* CPU suspends & waits to be resumed */ IDTVEC(rendezvous); /* handle CPU rendezvous */ @@ -100,6 +101,7 @@ void ipi_all_but_self(u_int ipi); void ipi_bitmap_handler(struct trapframe frame); void ipi_cpu(int cpu, u_int ipi); int ipi_nmi_handler(void); +void ipi_swi_handler(struct trapframe frame); void ipi_selected(cpuset_t cpus, u_int ipi); void ipi_self_from_nmi(u_int vector); void set_interrupt_apic_ids(void); Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/x86/x86/mp_x86.c Fri Aug 7 00:40:28 2020 (r364000) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #ifdef GPROF #include #endif +#include #include #include #include @@ -1565,6 +1566,16 @@ invlcache_handler(void) generation = smp_tlb_generation; wbinvd(); PCPU_SET(smp_tlb_done, generation); +} + +/* + * Handle an IPI_SWI by waking delayed SWI thread. + */ +void +ipi_swi_handler(struct trapframe frame) +{ + + intr_event_handle(clk_intr_event, &frame); } /* Modified: stable/12/sys/x86/xen/xen_apic.c ============================================================================== --- stable/12/sys/x86/xen/xen_apic.c Fri Aug 7 00:33:28 2020 (r363999) +++ stable/12/sys/x86/xen/xen_apic.c Fri Aug 7 00:40:28 2020 (r364000) @@ -72,6 +72,7 @@ static driver_filter_t xen_invlcache; static driver_filter_t xen_ipi_bitmap_handler; static driver_filter_t xen_cpustop_handler; static driver_filter_t xen_cpususpend_handler; +static driver_filter_t xen_ipi_swi_handler; #endif /*---------------------------------- Macros ----------------------------------*/ @@ -95,6 +96,7 @@ static struct xen_ipi_handler xen_ipis[] = [IPI_TO_IDX(IPI_BITMAP_VECTOR)] = { xen_ipi_bitmap_handler, "b" }, [IPI_TO_IDX(IPI_STOP)] = { xen_cpustop_handler, "st" }, [IPI_TO_IDX(IPI_SUSPEND)] = { xen_cpususpend_handler, "sp" }, + [IPI_TO_IDX(IPI_SWI)] = { xen_ipi_swi_handler, "sw" }, }; #endif @@ -557,6 +559,15 @@ xen_cpususpend_handler(void *arg) { cpususpend_handler(); + return (FILTER_HANDLED); +} + +static int +xen_ipi_swi_handler(void *arg) +{ + struct trapframe *frame = arg; + + ipi_swi_handler(*frame); return (FILTER_HANDLED); } From owner-svn-src-stable@freebsd.org Fri Aug 7 00:50:42 2020 Return-Path: Delivered-To: svn-src-stable@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 3C57B3AF4C4; Fri, 7 Aug 2020 00:50: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 4BN6Gp0vNhz3Yxj; Fri, 7 Aug 2020 00:50: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 02365FA24; Fri, 7 Aug 2020 00:50: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 0770ofrQ063157; Fri, 7 Aug 2020 00:50:41 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0770ofr0063156; Fri, 7 Aug 2020 00:50:41 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008070050.0770ofr0063156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 00:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364001 - stable/12/sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/x86/x86 X-SVN-Commit-Revision: 364001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 00:50:42 -0000 Author: mav Date: Fri Aug 7 00:50:41 2020 New Revision: 364001 URL: https://svnweb.freebsd.org/changeset/base/364001 Log: Fix build after r363999. Modified: stable/12/sys/x86/x86/mp_x86.c Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Fri Aug 7 00:40:28 2020 (r364000) +++ stable/12/sys/x86/x86/mp_x86.c Fri Aug 7 00:50:41 2020 (r364001) @@ -1359,7 +1359,7 @@ ipi_self_from_nmi(u_int vector) /* Wait for IPI to finish. */ if (!lapic_ipi_wait(50000)) { - if (KERNEL_PANICKED()) + if (panicstr != NULL) return; else panic("APIC: IPI is stuck"); From owner-svn-src-stable@freebsd.org Fri Aug 7 00:56:21 2020 Return-Path: Delivered-To: svn-src-stable@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 A75FE3AF572; Fri, 7 Aug 2020 00:56:21 +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 4BN6PK3qNYz3ZJJ; Fri, 7 Aug 2020 00:56:21 +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 6675FFAC0; Fri, 7 Aug 2020 00:56:21 +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 0770uLM5067209; Fri, 7 Aug 2020 00:56:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0770uKfO067206; Fri, 7 Aug 2020 00:56:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008070056.0770uKfO067206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 00:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364002 - in stable/12/sys: kern sys x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: kern sys x86/x86 X-SVN-Commit-Revision: 364002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 00:56:21 -0000 Author: mav Date: Fri Aug 7 00:56:20 2020 New Revision: 364002 URL: https://svnweb.freebsd.org/changeset/base/364002 Log: MFC r360328 (by vangyzen): Fix handling of NMIs from unknown sources (BMC, hypervisor) Release kernels have no KDB backends enabled, so they discard an NMI if it is not due to a hardware failure. This includes NMIs from IPMI BMCs and hypervisors. Furthermore, the interaction of panic_on_nmi, kdb_on_nmi, and debugger_on_panic is confusing. Respond to all NMIs according to panic_on_nmi and debugger_on_panic. Remove kdb_on_nmi. Expand the meaning of panic_on_nmi by making it a bitfield. There are currently two bits: one for NMIs due to hardware failure, and one for all others. Leave room for more. If panic_on_nmi and debugger_on_panic are both true, don't actually panic, but directly enter the debugger, to allow someone to leave the debugger and [hopefully] resume normal execution. Relnotes: yes: machdep.kdb_on_nmi is gone; machdep.panic_on_nmi changed Modified: stable/12/sys/kern/kern_shutdown.c stable/12/sys/sys/kdb.h stable/12/sys/x86/x86/cpu_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_shutdown.c ============================================================================== --- stable/12/sys/kern/kern_shutdown.c Fri Aug 7 00:50:41 2020 (r364001) +++ stable/12/sys/kern/kern_shutdown.c Fri Aug 7 00:56:20 2020 (r364002) @@ -115,9 +115,9 @@ SYSCTL_INT(_kern, OID_AUTO, panic_reboot_wait_time, CT #ifdef KDB #ifdef KDB_UNATTENDED -static int debugger_on_panic = 0; +int debugger_on_panic = 0; #else -static int debugger_on_panic = 1; +int debugger_on_panic = 1; #endif SYSCTL_INT(_debug, OID_AUTO, debugger_on_panic, CTLFLAG_RWTUN | CTLFLAG_SECURE, Modified: stable/12/sys/sys/kdb.h ============================================================================== --- stable/12/sys/sys/kdb.h Fri Aug 7 00:50:41 2020 (r364001) +++ stable/12/sys/sys/kdb.h Fri Aug 7 00:56:20 2020 (r364002) @@ -62,6 +62,7 @@ struct kdb_dbbe { DATA_SET(kdb_dbbe_set, name##_dbbe) extern u_char kdb_active; /* Non-zero while in debugger. */ +extern int debugger_on_panic; /* enter the debugger on panic. */ extern int debugger_on_trap; /* enter the debugger on trap. */ extern struct kdb_dbbe *kdb_dbbe; /* Default debugger backend or NULL. */ extern struct trapframe *kdb_frame; /* Frame to kdb_trap(). */ Modified: stable/12/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 00:50:41 2020 (r364001) +++ stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 00:56:20 2020 (r364002) @@ -803,20 +803,14 @@ cpu_idle_tun(void *unused __unused) } SYSINIT(cpu_idle_tun, SI_SUB_CPU, SI_ORDER_MIDDLE, cpu_idle_tun, NULL); -static int panic_on_nmi = 1; +static int panic_on_nmi = 0xff; SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RWTUN, &panic_on_nmi, 0, - "Panic on NMI raised by hardware failure"); + "Panic on NMI: 1 = H/W failure; 2 = unknown; 0xff = all"); int nmi_is_broadcast = 1; SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, &nmi_is_broadcast, 0, "Chipset NMI is broadcast"); -#ifdef KDB -int kdb_on_nmi = 1; -SYSCTL_INT(_machdep, OID_AUTO, kdb_on_nmi, CTLFLAG_RWTUN, - &kdb_on_nmi, 0, - "Go to KDB on NMI with unknown source"); -#endif void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) @@ -827,19 +821,31 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe * /* machine/parity/power fail/"kitchen sink" faults */ if (isa_nmi(frame->tf_err)) { claimed = true; - if (panic_on_nmi) + if ((panic_on_nmi & 1) != 0) panic("NMI indicates hardware failure"); } #endif /* DEV_ISA */ + + /* + * NMIs can be useful for debugging. They can be hooked up to a + * pushbutton, usually on an ISA, PCI, or PCIe card. They can also be + * generated by an IPMI BMC, either manually or in response to a + * watchdog timeout. For example, see the "power diag" command in + * ports/sysutils/ipmitool. They can also be generated by a + * hypervisor; see "bhyvectl --inject-nmi". + */ + #ifdef KDB - if (!claimed && kdb_on_nmi) { - /* - * NMI can be hooked up to a pushbutton for debugging. - */ - printf("NMI/cpu%d ... going to debugger\n", cpu); - kdb_trap(type, 0, frame); + if (!claimed && (panic_on_nmi & 2) != 0) { + if (debugger_on_panic) { + printf("NMI/cpu%d ... going to debugger\n", cpu); + claimed = kdb_trap(type, 0, frame); + } } #endif /* KDB */ + + if (!claimed && panic_on_nmi != 0) + panic("NMI"); } void From owner-svn-src-stable@freebsd.org Fri Aug 7 01:05:13 2020 Return-Path: Delivered-To: svn-src-stable@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 09A993AF66E; Fri, 7 Aug 2020 01:05:13 +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 4BN6bX6CXHz3ZQf; Fri, 7 Aug 2020 01:05:12 +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 B8A3DF8DE; Fri, 7 Aug 2020 01:05:12 +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 07715CMi073446; Fri, 7 Aug 2020 01:05:12 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07715AZJ073437; Fri, 7 Aug 2020 01:05:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008070105.07715AZJ073437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 01:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364003 - in stable/12/sys: arm64/arm64 arm64/include conf dev/acpica dev/pci x86/include x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: arm64/arm64 arm64/include conf dev/acpica dev/pci x86/include x86/x86 X-SVN-Commit-Revision: 364003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 01:05:13 -0000 Author: mav Date: Fri Aug 7 01:05:10 2020 New Revision: 364003 URL: https://svnweb.freebsd.org/changeset/base/364003 Log: MFC r363624: Add initial driver for ACPI Platform Error Interfaces. APEI allows platform to report different kinds of errors to OS in several ways. We've found that Supermicro X10/X11 motherboards report PCIe errors appearing on hot-unplug via this interface using NMI. Without respective driver it ended up in kernel panic without any additional information. This driver introduces support for the APEI Generic Hardware Error Source reporting via NMI, SCI or polling. It decodes the reported errors and either pass them to pci(4) for processing or just logs otherwise. Errors marked as fatal still end up in kernel panic, but some more informative. When somebody get to native PCIe AER support implementation both of the reporting mechanisms should get common error recovery code. Since in our case errors happen when the device is already gone, there is nothing to recover, so the code just clears the error statuses, practically ignoring the otherwise destructive NMIs in nicer way. Relnotes: yes Sponsored by: iXsystems, Inc. Added: stable/12/sys/dev/acpica/acpi_apei.c - copied, changed from r363624, head/sys/dev/acpica/acpi_apei.c Modified: stable/12/sys/arm64/arm64/machdep.c stable/12/sys/arm64/include/acpica_machdep.h stable/12/sys/conf/files stable/12/sys/dev/acpica/acpi.c stable/12/sys/dev/pci/pci.c stable/12/sys/dev/pci/pcivar.h stable/12/sys/x86/include/acpica_machdep.h stable/12/sys/x86/x86/cpu_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 01:05:10 2020 (r364003) @@ -131,6 +131,8 @@ void pagezero_cache(void *); /* pagezero_simple is default pagezero */ void (*pagezero)(void *p) = pagezero_simple; +int (*apei_nmi)(void); + static void pan_setup(void) { Modified: stable/12/sys/arm64/include/acpica_machdep.h ============================================================================== --- stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) @@ -57,6 +57,8 @@ struct acpi_generic_address; int acpi_map_addr(struct acpi_generic_address *, bus_space_tag_t *, bus_space_handle_t *, bus_size_t); +extern int (*apei_nmi)(void); + #endif /* _KERNEL */ #endif /* __ACPICA_MACHDEP_H__ */ Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/conf/files Fri Aug 7 01:05:10 2020 (r364003) @@ -740,6 +740,7 @@ dev/acpica/Osd/OsdSynch.c optional acpi dev/acpica/Osd/OsdTable.c optional acpi dev/acpica/acpi.c optional acpi dev/acpica/acpi_acad.c optional acpi +dev/acpica/acpi_apei.c optional acpi dev/acpica/acpi_battery.c optional acpi dev/acpica/acpi_button.c optional acpi dev/acpica/acpi_cmbat.c optional acpi Modified: stable/12/sys/dev/acpica/acpi.c ============================================================================== --- stable/12/sys/dev/acpica/acpi.c Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/dev/acpica/acpi.c Fri Aug 7 01:05:10 2020 (r364003) @@ -151,6 +151,7 @@ static ACPI_STATUS acpi_device_scan_children(device_t int max_depth, acpi_scan_cb_t user_fn, void *arg); static int acpi_isa_pnp_probe(device_t bus, device_t child, struct isa_pnp_id *ids); +static void acpi_platform_osc(device_t dev); static void acpi_probe_children(device_t bus); static void acpi_probe_order(ACPI_HANDLE handle, int *order); static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, @@ -673,6 +674,8 @@ acpi_attach(device_t dev) /* Register ACPI again to pass the correct argument of pm_func. */ power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc); + acpi_platform_osc(dev); + if (!acpi_disabled("bus")) { EVENTHANDLER_REGISTER(dev_lookup, acpi_lookup, NULL, 1000); acpi_probe_children(dev); @@ -1919,6 +1922,34 @@ acpi_enable_pcie(void) alloc++; } #endif +} + +static void +acpi_platform_osc(device_t dev) +{ + ACPI_HANDLE sb_handle; + ACPI_STATUS status; + uint32_t cap_set[2]; + + /* 0811B06E-4A27-44F9-8D60-3CBBC22E7B48 */ + static uint8_t acpi_platform_uuid[ACPI_UUID_LENGTH] = { + 0x6e, 0xb0, 0x11, 0x08, 0x27, 0x4a, 0xf9, 0x44, + 0x8d, 0x60, 0x3c, 0xbb, 0xc2, 0x2e, 0x7b, 0x48 + }; + + if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle))) + return; + + cap_set[1] = 0x10; /* APEI Support */ + status = acpi_EvaluateOSC(sb_handle, acpi_platform_uuid, 1, + nitems(cap_set), cap_set, cap_set, false); + if (ACPI_FAILURE(status)) { + if (status == AE_NOT_FOUND) + return; + device_printf(dev, "_OSC failed: %s\n", + AcpiFormatException(status)); + return; + } } /* Copied and modified: stable/12/sys/dev/acpica/acpi_apei.c (from r363624, head/sys/dev/acpica/acpi_apei.c) ============================================================================== --- head/sys/dev/acpica/acpi_apei.c Mon Jul 27 21:19:41 2020 (r363624, copy source) +++ stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 7 01:05:10 2020 (r364003) @@ -574,7 +574,7 @@ apei_probe(device_t dev) if (acpi_find_table(ACPI_SIG_HEST) == 0) return (ENXIO); if (acpi_get_handle(dev) != NULL) - rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL); + rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) != NULL); else rv = 0; if (rv <= 0) Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/dev/pci/pci.c Fri Aug 7 01:05:10 2020 (r364003) @@ -6284,6 +6284,67 @@ pcie_get_max_completion_timeout(device_t dev) } } +void +pcie_apei_error(device_t dev, int sev, uint8_t *aerp) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + const char *s; + int aer; + uint32_t r, r1; + uint16_t rs; + + if (sev == PCIEM_STA_CORRECTABLE_ERROR) + s = "Correctable"; + else if (sev == PCIEM_STA_NON_FATAL_ERROR) + s = "Uncorrectable (Non-Fatal)"; + else + s = "Uncorrectable (Fatal)"; + device_printf(dev, "%s PCIe error reported by APEI\n", s); + if (aerp) { + if (sev == PCIEM_STA_CORRECTABLE_ERROR) { + r = le32dec(aerp + PCIR_AER_COR_STATUS); + r1 = le32dec(aerp + PCIR_AER_COR_MASK); + } else { + r = le32dec(aerp + PCIR_AER_UC_STATUS); + r1 = le32dec(aerp + PCIR_AER_UC_MASK); + } + device_printf(dev, "status 0x%08x mask 0x%08x", r, r1); + if (sev != PCIEM_STA_CORRECTABLE_ERROR) { + r = le32dec(aerp + PCIR_AER_UC_SEVERITY); + rs = le16dec(aerp + PCIR_AER_CAP_CONTROL); + printf(" severity 0x%08x first %d\n", + r, rs & 0x1f); + } else + printf("\n"); + } + + /* As kind of recovery just report and clear the error statuses. */ + if (pci_find_extcap(dev, PCIZ_AER, &aer) == 0) { + r = pci_read_config(dev, aer + PCIR_AER_UC_STATUS, 4); + if (r != 0) { + pci_write_config(dev, aer + PCIR_AER_UC_STATUS, r, 4); + device_printf(dev, "Clearing UC AER errors 0x%08x\n", r); + } + + r = pci_read_config(dev, aer + PCIR_AER_COR_STATUS, 4); + if (r != 0) { + pci_write_config(dev, aer + PCIR_AER_COR_STATUS, r, 4); + device_printf(dev, "Clearing COR AER errors 0x%08x\n", r); + } + } + if (dinfo->cfg.pcie.pcie_location != 0) { + rs = pci_read_config(dev, dinfo->cfg.pcie.pcie_location + + PCIER_DEVICE_STA, 2); + if ((rs & (PCIEM_STA_CORRECTABLE_ERROR | + PCIEM_STA_NON_FATAL_ERROR | PCIEM_STA_FATAL_ERROR | + PCIEM_STA_UNSUPPORTED_REQ)) != 0) { + pci_write_config(dev, dinfo->cfg.pcie.pcie_location + + PCIER_DEVICE_STA, rs, 2); + device_printf(dev, "Clearing PCIe errors 0x%04x\n", rs); + } + } +} + /* * Perform a Function Level Reset (FLR) on a device. * Modified: stable/12/sys/dev/pci/pcivar.h ============================================================================== --- stable/12/sys/dev/pci/pcivar.h Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/dev/pci/pcivar.h Fri Aug 7 01:05:10 2020 (r364003) @@ -679,6 +679,7 @@ uint32_t pcie_read_config(device_t dev, int reg, int w void pcie_write_config(device_t dev, int reg, uint32_t value, int width); uint32_t pcie_adjust_config(device_t dev, int reg, uint32_t mask, uint32_t value, int width); +void pcie_apei_error(device_t dev, int sev, uint8_t *aer); bool pcie_flr(device_t dev, u_int max_delay, bool force); int pcie_get_max_completion_timeout(device_t dev); bool pcie_wait_for_pending_transactions(device_t dev, u_int max_delay); Modified: stable/12/sys/x86/include/acpica_machdep.h ============================================================================== --- stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) @@ -84,6 +84,7 @@ void madt_parse_interrupt_values(void *entry, enum intr_trigger *trig, enum intr_polarity *pol); extern int madt_found_sci_override; +extern int (*apei_nmi)(void); #endif /* _KERNEL */ Modified: stable/12/sys/x86/x86/cpu_machdep.c ============================================================================== --- stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 00:56:20 2020 (r364002) +++ stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 01:05:10 2020 (r364003) @@ -811,6 +811,7 @@ int nmi_is_broadcast = 1; SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, &nmi_is_broadcast, 0, "Chipset NMI is broadcast"); +int (*apei_nmi)(void); void nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) @@ -825,6 +826,10 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe * panic("NMI indicates hardware failure"); } #endif /* DEV_ISA */ + + /* ACPI Platform Error Interfaces callback. */ + if (apei_nmi != NULL && (*apei_nmi)()) + claimed = true; /* * NMIs can be useful for debugging. They can be hooked up to a From owner-svn-src-stable@freebsd.org Fri Aug 7 08:59:32 2020 Return-Path: Delivered-To: svn-src-stable@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 D3C893B6294; Fri, 7 Aug 2020 08:59:32 +0000 (UTC) (envelope-from xxjack12xx@gmail.com) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (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 4BNK6r3Ftnz4BvX; Fri, 7 Aug 2020 08:59:32 +0000 (UTC) (envelope-from xxjack12xx@gmail.com) Received: by mail-qk1-x744.google.com with SMTP id l64so1062993qkb.8; Fri, 07 Aug 2020 01:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GHEwfTtiDKM5CevEU9Ou+nGgvYBRqqD2w38Lji/SqQw=; b=qaw9+tm0rdlfE9mdVM/e7RhNPHaGlTEopMYfOdnLsjSREJYbMThXviG4aBJgkOQ2n7 esIWjQysLLPTD5aBuA+N4QPbcUDDoXnpJZLC1AiSq6bdYvZSqN4KeGhZ4tCWHHiH4G/K CEh/7Vd7+djEaZIjeXDBEgpAuLW5VClv12bTWin8NtVyobfgdsMFeBTF+F2qa6WRGzQ6 yZsCQZkwcKxsOhiDnFe5wWQOromQMv5KwP2b3OMP823yxuHyL44VCayRzk5pvb4PGcUt vXadmcdLnA5BV0OJvr6eUMtPifzgRP2c0S43wBmZbVeS0ot+dSySmV2hCwhmE+q1HZkv ikhg== 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=GHEwfTtiDKM5CevEU9Ou+nGgvYBRqqD2w38Lji/SqQw=; b=bRg/ZBouFYjx0+0P0r3wvUMAkiX8fc6Zjjhzn5mrZFy4utOiLUUhl0rWRmaUaJRKhr RgKHhLzKkZdP+VRBA7BXvY7GFFtKefPCemujdUOAa7WYgmz89zjZTcENNpNG5kxF4uA4 paRmCFeZzkc/ysNxymht0p/R4KQiqKL1SH1bLqZUYHIk3z+r2fLWzJt6MbB4U2xmoaRc TqWEh1w9R4bfWrqFTKbBJ8uDZdiyKdkLbFm34cOUwVjKpGQXiFQu5e+dUffXeutJMzCx zACDDo37wECYZYj5cKhMTxs2aVw2E1rr4YQgdmOE21p8N0rNnqu6r+GEqmaYiX81hJf1 sSZA== X-Gm-Message-State: AOAM533NvoMFTYVBit3e/fn4M5OU7dZ/I3BNkMfyqDZEDxEZdsuWW0Mg N/01r0fw4wLYRkXhPsLst2RN6P16JTrcwdmiIATyOttB X-Google-Smtp-Source: ABdhPJxecxgYhLEX7wBBfByfL1RFZErv/Pa7c0X9biezWh8NzE3e798KCZzGjM8VZQmhYNH3mCyPNuRDt5bMtrj96Fo= X-Received: by 2002:a05:620a:125b:: with SMTP id a27mr13043894qkl.371.1596790771038; Fri, 07 Aug 2020 01:59:31 -0700 (PDT) MIME-Version: 1.0 References: <202008070105.07715AZJ073437@repo.freebsd.org> In-Reply-To: <202008070105.07715AZJ073437@repo.freebsd.org> From: "Jack L." Date: Fri, 7 Aug 2020 01:58:54 -0700 Message-ID: Subject: Re: svn commit: r364003 - in stable/12/sys: arm64/arm64 arm64/include conf dev/acpica dev/pci x86/include x86/x86 To: Alexander Motin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4BNK6r3Ftnz4BvX 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]; REPLY(-4.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 08:59:32 -0000 I'm getting apei1 platform error interface after installing the kernel with this commit on multiple Dell R610 servers. On Thu, Aug 6, 2020 at 6:05 PM Alexander Motin wrote: > > Author: mav > Date: Fri Aug 7 01:05:10 2020 > New Revision: 364003 > URL: https://svnweb.freebsd.org/changeset/base/364003 > > Log: > MFC r363624: Add initial driver for ACPI Platform Error Interfaces. > > APEI allows platform to report different kinds of errors to OS in several > ways. We've found that Supermicro X10/X11 motherboards report PCIe errors > appearing on hot-unplug via this interface using NMI. Without respective > driver it ended up in kernel panic without any additional information. > > This driver introduces support for the APEI Generic Hardware Error Source > reporting via NMI, SCI or polling. It decodes the reported errors and > either pass them to pci(4) for processing or just logs otherwise. Errors > marked as fatal still end up in kernel panic, but some more informative. > > When somebody get to native PCIe AER support implementation both of the > reporting mechanisms should get common error recovery code. Since in our > case errors happen when the device is already gone, there is nothing to > recover, so the code just clears the error statuses, practically ignoring > the otherwise destructive NMIs in nicer way. > > Relnotes: yes > Sponsored by: iXsystems, Inc. > > Added: > stable/12/sys/dev/acpica/acpi_apei.c > - copied, changed from r363624, head/sys/dev/acpica/acpi_apei.c > Modified: > stable/12/sys/arm64/arm64/machdep.c > stable/12/sys/arm64/include/acpica_machdep.h > stable/12/sys/conf/files > stable/12/sys/dev/acpica/acpi.c > stable/12/sys/dev/pci/pci.c > stable/12/sys/dev/pci/pcivar.h > stable/12/sys/x86/include/acpica_machdep.h > stable/12/sys/x86/x86/cpu_machdep.c > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/sys/arm64/arm64/machdep.c > ============================================================================== > --- stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 01:05:10 2020 (r364003) > @@ -131,6 +131,8 @@ void pagezero_cache(void *); > /* pagezero_simple is default pagezero */ > void (*pagezero)(void *p) = pagezero_simple; > > +int (*apei_nmi)(void); > + > static void > pan_setup(void) > { > > Modified: stable/12/sys/arm64/include/acpica_machdep.h > ============================================================================== > --- stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) > @@ -57,6 +57,8 @@ struct acpi_generic_address; > int acpi_map_addr(struct acpi_generic_address *, bus_space_tag_t *, > bus_space_handle_t *, bus_size_t); > > +extern int (*apei_nmi)(void); > + > #endif /* _KERNEL */ > > #endif /* __ACPICA_MACHDEP_H__ */ > > Modified: stable/12/sys/conf/files > ============================================================================== > --- stable/12/sys/conf/files Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/conf/files Fri Aug 7 01:05:10 2020 (r364003) > @@ -740,6 +740,7 @@ dev/acpica/Osd/OsdSynch.c optional acpi > dev/acpica/Osd/OsdTable.c optional acpi > dev/acpica/acpi.c optional acpi > dev/acpica/acpi_acad.c optional acpi > +dev/acpica/acpi_apei.c optional acpi > dev/acpica/acpi_battery.c optional acpi > dev/acpica/acpi_button.c optional acpi > dev/acpica/acpi_cmbat.c optional acpi > > Modified: stable/12/sys/dev/acpica/acpi.c > ============================================================================== > --- stable/12/sys/dev/acpica/acpi.c Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/dev/acpica/acpi.c Fri Aug 7 01:05:10 2020 (r364003) > @@ -151,6 +151,7 @@ static ACPI_STATUS acpi_device_scan_children(device_t > int max_depth, acpi_scan_cb_t user_fn, void *arg); > static int acpi_isa_pnp_probe(device_t bus, device_t child, > struct isa_pnp_id *ids); > +static void acpi_platform_osc(device_t dev); > static void acpi_probe_children(device_t bus); > static void acpi_probe_order(ACPI_HANDLE handle, int *order); > static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, > @@ -673,6 +674,8 @@ acpi_attach(device_t dev) > /* Register ACPI again to pass the correct argument of pm_func. */ > power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc); > > + acpi_platform_osc(dev); > + > if (!acpi_disabled("bus")) { > EVENTHANDLER_REGISTER(dev_lookup, acpi_lookup, NULL, 1000); > acpi_probe_children(dev); > @@ -1919,6 +1922,34 @@ acpi_enable_pcie(void) > alloc++; > } > #endif > +} > + > +static void > +acpi_platform_osc(device_t dev) > +{ > + ACPI_HANDLE sb_handle; > + ACPI_STATUS status; > + uint32_t cap_set[2]; > + > + /* 0811B06E-4A27-44F9-8D60-3CBBC22E7B48 */ > + static uint8_t acpi_platform_uuid[ACPI_UUID_LENGTH] = { > + 0x6e, 0xb0, 0x11, 0x08, 0x27, 0x4a, 0xf9, 0x44, > + 0x8d, 0x60, 0x3c, 0xbb, 0xc2, 0x2e, 0x7b, 0x48 > + }; > + > + if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle))) > + return; > + > + cap_set[1] = 0x10; /* APEI Support */ > + status = acpi_EvaluateOSC(sb_handle, acpi_platform_uuid, 1, > + nitems(cap_set), cap_set, cap_set, false); > + if (ACPI_FAILURE(status)) { > + if (status == AE_NOT_FOUND) > + return; > + device_printf(dev, "_OSC failed: %s\n", > + AcpiFormatException(status)); > + return; > + } > } > > /* > > Copied and modified: stable/12/sys/dev/acpica/acpi_apei.c (from r363624, head/sys/dev/acpica/acpi_apei.c) > ============================================================================== > --- head/sys/dev/acpica/acpi_apei.c Mon Jul 27 21:19:41 2020 (r363624, copy source) > +++ stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 7 01:05:10 2020 (r364003) > @@ -574,7 +574,7 @@ apei_probe(device_t dev) > if (acpi_find_table(ACPI_SIG_HEST) == 0) > return (ENXIO); > if (acpi_get_handle(dev) != NULL) > - rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL); > + rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) != NULL); > else > rv = 0; > if (rv <= 0) > > Modified: stable/12/sys/dev/pci/pci.c > ============================================================================== > --- stable/12/sys/dev/pci/pci.c Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/dev/pci/pci.c Fri Aug 7 01:05:10 2020 (r364003) > @@ -6284,6 +6284,67 @@ pcie_get_max_completion_timeout(device_t dev) > } > } > > +void > +pcie_apei_error(device_t dev, int sev, uint8_t *aerp) > +{ > + struct pci_devinfo *dinfo = device_get_ivars(dev); > + const char *s; > + int aer; > + uint32_t r, r1; > + uint16_t rs; > + > + if (sev == PCIEM_STA_CORRECTABLE_ERROR) > + s = "Correctable"; > + else if (sev == PCIEM_STA_NON_FATAL_ERROR) > + s = "Uncorrectable (Non-Fatal)"; > + else > + s = "Uncorrectable (Fatal)"; > + device_printf(dev, "%s PCIe error reported by APEI\n", s); > + if (aerp) { > + if (sev == PCIEM_STA_CORRECTABLE_ERROR) { > + r = le32dec(aerp + PCIR_AER_COR_STATUS); > + r1 = le32dec(aerp + PCIR_AER_COR_MASK); > + } else { > + r = le32dec(aerp + PCIR_AER_UC_STATUS); > + r1 = le32dec(aerp + PCIR_AER_UC_MASK); > + } > + device_printf(dev, "status 0x%08x mask 0x%08x", r, r1); > + if (sev != PCIEM_STA_CORRECTABLE_ERROR) { > + r = le32dec(aerp + PCIR_AER_UC_SEVERITY); > + rs = le16dec(aerp + PCIR_AER_CAP_CONTROL); > + printf(" severity 0x%08x first %d\n", > + r, rs & 0x1f); > + } else > + printf("\n"); > + } > + > + /* As kind of recovery just report and clear the error statuses. */ > + if (pci_find_extcap(dev, PCIZ_AER, &aer) == 0) { > + r = pci_read_config(dev, aer + PCIR_AER_UC_STATUS, 4); > + if (r != 0) { > + pci_write_config(dev, aer + PCIR_AER_UC_STATUS, r, 4); > + device_printf(dev, "Clearing UC AER errors 0x%08x\n", r); > + } > + > + r = pci_read_config(dev, aer + PCIR_AER_COR_STATUS, 4); > + if (r != 0) { > + pci_write_config(dev, aer + PCIR_AER_COR_STATUS, r, 4); > + device_printf(dev, "Clearing COR AER errors 0x%08x\n", r); > + } > + } > + if (dinfo->cfg.pcie.pcie_location != 0) { > + rs = pci_read_config(dev, dinfo->cfg.pcie.pcie_location + > + PCIER_DEVICE_STA, 2); > + if ((rs & (PCIEM_STA_CORRECTABLE_ERROR | > + PCIEM_STA_NON_FATAL_ERROR | PCIEM_STA_FATAL_ERROR | > + PCIEM_STA_UNSUPPORTED_REQ)) != 0) { > + pci_write_config(dev, dinfo->cfg.pcie.pcie_location + > + PCIER_DEVICE_STA, rs, 2); > + device_printf(dev, "Clearing PCIe errors 0x%04x\n", rs); > + } > + } > +} > + > /* > * Perform a Function Level Reset (FLR) on a device. > * > > Modified: stable/12/sys/dev/pci/pcivar.h > ============================================================================== > --- stable/12/sys/dev/pci/pcivar.h Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/dev/pci/pcivar.h Fri Aug 7 01:05:10 2020 (r364003) > @@ -679,6 +679,7 @@ uint32_t pcie_read_config(device_t dev, int reg, int w > void pcie_write_config(device_t dev, int reg, uint32_t value, int width); > uint32_t pcie_adjust_config(device_t dev, int reg, uint32_t mask, > uint32_t value, int width); > +void pcie_apei_error(device_t dev, int sev, uint8_t *aer); > bool pcie_flr(device_t dev, u_int max_delay, bool force); > int pcie_get_max_completion_timeout(device_t dev); > bool pcie_wait_for_pending_transactions(device_t dev, u_int max_delay); > > Modified: stable/12/sys/x86/include/acpica_machdep.h > ============================================================================== > --- stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) > @@ -84,6 +84,7 @@ void madt_parse_interrupt_values(void *entry, > enum intr_trigger *trig, enum intr_polarity *pol); > > extern int madt_found_sci_override; > +extern int (*apei_nmi)(void); > > #endif /* _KERNEL */ > > > Modified: stable/12/sys/x86/x86/cpu_machdep.c > ============================================================================== > --- stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 00:56:20 2020 (r364002) > +++ stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 01:05:10 2020 (r364003) > @@ -811,6 +811,7 @@ int nmi_is_broadcast = 1; > SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, > &nmi_is_broadcast, 0, > "Chipset NMI is broadcast"); > +int (*apei_nmi)(void); > > void > nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) > @@ -825,6 +826,10 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe * > panic("NMI indicates hardware failure"); > } > #endif /* DEV_ISA */ > + > + /* ACPI Platform Error Interfaces callback. */ > + if (apei_nmi != NULL && (*apei_nmi)()) > + claimed = true; > > /* > * NMIs can be useful for debugging. They can be hooked up to a > _______________________________________________ > 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-stable@freebsd.org Fri Aug 7 09:50:45 2020 Return-Path: Delivered-To: svn-src-stable@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 8535E3B66F6; Fri, 7 Aug 2020 09:50:45 +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 4BNLFx31Ptz4FK7; Fri, 7 Aug 2020 09:50:45 +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 4C60215D43; Fri, 7 Aug 2020 09:50:45 +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 0779ojfb094500; Fri, 7 Aug 2020 09:50:45 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0779ojVu094499; Fri, 7 Aug 2020 09:50:45 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202008070950.0779ojVu094499@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, 7 Aug 2020 09:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364007 - stable/12/share/man/man8 X-SVN-Group: stable-12 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/12/share/man/man8 X-SVN-Commit-Revision: 364007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 09:50:45 -0000 Author: 0mp (doc,ports committer) Date: Fri Aug 7 09:50:44 2020 New Revision: 364007 URL: https://svnweb.freebsd.org/changeset/base/364007 Log: MFC 363737: Point to rc(8) for more details about the autoboot variable Reviewed by: bcr, imp Differential Revision: https://reviews.freebsd.org/D25904 Modified: stable/12/share/man/man8/rc.subr.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man8/rc.subr.8 ============================================================================== --- stable/12/share/man/man8/rc.subr.8 Fri Aug 7 08:57:31 2020 (r364006) +++ stable/12/share/man/man8/rc.subr.8 Fri Aug 7 09:50:44 2020 (r364007) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 2020 +.Dd July 31, 2020 .Dt RC.SUBR 8 .Os .Sh NAME @@ -864,7 +864,11 @@ Prevent booting to multiuser mode. If the .Va autoboot variable is set to -.Ql yes , +.Ql yes +(see +.Xr rc 8 +to learn more about +.Va autoboot ) , or .Ic checkyesno Ar always indicates a truth value, then a From owner-svn-src-stable@freebsd.org Fri Aug 7 09:51:25 2020 Return-Path: Delivered-To: svn-src-stable@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 5507E3B6C9D; Fri, 7 Aug 2020 09:51:25 +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 4BNLGj1fQwz4F7v; Fri, 7 Aug 2020 09:51:25 +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 1D42E15D4D; Fri, 7 Aug 2020 09:51: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 0779pOg6096163; Fri, 7 Aug 2020 09:51:24 GMT (envelope-from 0mp@FreeBSD.org) Received: (from 0mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0779pObn096161; Fri, 7 Aug 2020 09:51:24 GMT (envelope-from 0mp@FreeBSD.org) Message-Id: <202008070951.0779pObn096161@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, 7 Aug 2020 09:51:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r364008 - stable/11/share/man/man8 X-SVN-Group: stable-11 X-SVN-Commit-Author: 0mp X-SVN-Commit-Paths: stable/11/share/man/man8 X-SVN-Commit-Revision: 364008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 09:51:25 -0000 Author: 0mp (doc,ports committer) Date: Fri Aug 7 09:51:24 2020 New Revision: 364008 URL: https://svnweb.freebsd.org/changeset/base/364008 Log: MFC 363737: Point to rc(8) for more details about the autoboot variable Reviewed by: bcr, imp Differential Revision: https://reviews.freebsd.org/D25904 Modified: stable/11/share/man/man8/rc.subr.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man8/rc.subr.8 ============================================================================== --- stable/11/share/man/man8/rc.subr.8 Fri Aug 7 09:50:44 2020 (r364007) +++ stable/11/share/man/man8/rc.subr.8 Fri Aug 7 09:51:24 2020 (r364008) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 24, 2020 +.Dd July 31, 2020 .Dt RC.SUBR 8 .Os .Sh NAME @@ -865,7 +865,11 @@ Prevent booting to multiuser mode. If the .Va autoboot variable is set to -.Ql yes , +.Ql yes +(see +.Xr rc 8 +to learn more about +.Va autoboot ) , or .Ic checkyesno Ar always indicates a truth value, then a From owner-svn-src-stable@freebsd.org Fri Aug 7 13:13:01 2020 Return-Path: Delivered-To: svn-src-stable@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 AE2C63BA7A4; Fri, 7 Aug 2020 13:13:01 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (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 4BNQlJ1pPjz4QHh; Fri, 7 Aug 2020 13:13:00 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x841.google.com with SMTP id k18so1176840qtm.10; Fri, 07 Aug 2020 06:13:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=C8jitdqiqMq2RwFDTDTAqWcgG//5RaKAO6FAB1PmJqc=; b=c8hgM5AlcFY74dIH4PSQEjGY+MpZieeH+7aIusg1FQa94ly2DJCRX5YQPF8WrR8bhz Jwxn57nIfIVxkEXf4aJID51U7MQgSaT4ISVXyOgNBe3rH283zGs77BdSVr+vh28oWDtm DDB/JO7SNhSb5htWh9epsso0bYTB9ea8bSWaa1JaWj7mJlsK6ZgugzkeS9h7S5EPVMZl H1lUyEgw63B7/e4Keg7ltX+HcI3asncoJaQChHe94T0flaTFjOlh4w7eSF9F/Y87hMbU b0/Cd+6CMiSxH3p5II49NVHghqV8BTbD8s9B4PnUZkWEFhZTggdU49WNoxBmK7Gj2asN QcTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=C8jitdqiqMq2RwFDTDTAqWcgG//5RaKAO6FAB1PmJqc=; b=gtX96NzQZcaW66dY3+m1Vu+RgDVtn+5QTfxPFpvAihOfEYdrJ0T/wmuXmydEkKerCL T90Iy1/yp9LqLY+4zPLr5jpvi3iU/o9XhGTBIWw+uQ1iri+SXFj/+pCiq3YaXVE+l0LL /UMgN1Av7oFYLWv2pvRr8mfJpW0Rhv1sNPTAKDgnR93fwtRS4KTba3Tg2uLFTWI4eatO BchrSiki2WUCut4r9BYjpHlY9ybEedVD2gFFlb0CE8bVij3fSbFfTWzuPuXn76DE3Mcb UeYJ1abwStiPpiQ7AqDpsuA6wrD0AHzWTZ9GsTKQNWqP4yZOnLQIZsmuZ2iNvsvD6535 FFhg== X-Gm-Message-State: AOAM531hACxiTXGYzkiGuNlYmCoPLj0wr9ypz9q524rj1JZO0fReb2wu TkNJO/TXGcWtsvxAtE69vGZgVA5R X-Google-Smtp-Source: ABdhPJwTnAzI53+Ik8Xfhmkrz2c2wIaEca3uWs7AF8fGgCmsuirvAObwwfabcO1JqNe/m2GKT4oS6g== X-Received: by 2002:aed:3728:: with SMTP id i37mr13996670qtb.347.1596805978117; Fri, 07 Aug 2020 06:12:58 -0700 (PDT) Received: from spectre.mavhome.dp.ua ([2600:1700:3580:3560:228:f8ff:fe04:d12]) by smtp.gmail.com with ESMTPSA id x24sm8043586qtj.8.2020.08.07.06.12.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2020 06:12:56 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r364003 - in stable/12/sys: arm64/arm64 arm64/include conf dev/acpica dev/pci x86/include x86/x86 To: "Jack L." Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <202008070105.07715AZJ073437@repo.freebsd.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <90100f43-7fe6-6b24-7417-5e2ded25f1be@FreeBSD.org> Date: Fri, 7 Aug 2020 09:12:56 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.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: 4BNQlJ1pPjz4QHh X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=c8hgM5Al; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::841 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-2.12 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-0.86)[-0.862]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.990]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.07)[-0.065]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::841:from]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 13:13:01 -0000 Do you mean you are getting two apeiX devices? That is unexpected. Could you send me `devinfo -vr` and `acpidump -t` outputs? And lets go private for debugging. On 07.08.2020 04:58, Jack L. wrote: > I'm getting > apei1 platform error interface > after installing the kernel with this commit on multiple Dell R610 servers. > > On Thu, Aug 6, 2020 at 6:05 PM Alexander Motin wrote: >> >> Author: mav >> Date: Fri Aug 7 01:05:10 2020 >> New Revision: 364003 >> URL: https://svnweb.freebsd.org/changeset/base/364003 >> >> Log: >> MFC r363624: Add initial driver for ACPI Platform Error Interfaces. >> >> APEI allows platform to report different kinds of errors to OS in several >> ways. We've found that Supermicro X10/X11 motherboards report PCIe errors >> appearing on hot-unplug via this interface using NMI. Without respective >> driver it ended up in kernel panic without any additional information. >> >> This driver introduces support for the APEI Generic Hardware Error Source >> reporting via NMI, SCI or polling. It decodes the reported errors and >> either pass them to pci(4) for processing or just logs otherwise. Errors >> marked as fatal still end up in kernel panic, but some more informative. >> >> When somebody get to native PCIe AER support implementation both of the >> reporting mechanisms should get common error recovery code. Since in our >> case errors happen when the device is already gone, there is nothing to >> recover, so the code just clears the error statuses, practically ignoring >> the otherwise destructive NMIs in nicer way. >> >> Relnotes: yes >> Sponsored by: iXsystems, Inc. >> >> Added: >> stable/12/sys/dev/acpica/acpi_apei.c >> - copied, changed from r363624, head/sys/dev/acpica/acpi_apei.c >> Modified: >> stable/12/sys/arm64/arm64/machdep.c >> stable/12/sys/arm64/include/acpica_machdep.h >> stable/12/sys/conf/files >> stable/12/sys/dev/acpica/acpi.c >> stable/12/sys/dev/pci/pci.c >> stable/12/sys/dev/pci/pcivar.h >> stable/12/sys/x86/include/acpica_machdep.h >> stable/12/sys/x86/x86/cpu_machdep.c >> Directory Properties: >> stable/12/ (props changed) >> >> Modified: stable/12/sys/arm64/arm64/machdep.c >> ============================================================================== >> --- stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 01:05:10 2020 (r364003) >> @@ -131,6 +131,8 @@ void pagezero_cache(void *); >> /* pagezero_simple is default pagezero */ >> void (*pagezero)(void *p) = pagezero_simple; >> >> +int (*apei_nmi)(void); >> + >> static void >> pan_setup(void) >> { >> >> Modified: stable/12/sys/arm64/include/acpica_machdep.h >> ============================================================================== >> --- stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) >> @@ -57,6 +57,8 @@ struct acpi_generic_address; >> int acpi_map_addr(struct acpi_generic_address *, bus_space_tag_t *, >> bus_space_handle_t *, bus_size_t); >> >> +extern int (*apei_nmi)(void); >> + >> #endif /* _KERNEL */ >> >> #endif /* __ACPICA_MACHDEP_H__ */ >> >> Modified: stable/12/sys/conf/files >> ============================================================================== >> --- stable/12/sys/conf/files Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/conf/files Fri Aug 7 01:05:10 2020 (r364003) >> @@ -740,6 +740,7 @@ dev/acpica/Osd/OsdSynch.c optional acpi >> dev/acpica/Osd/OsdTable.c optional acpi >> dev/acpica/acpi.c optional acpi >> dev/acpica/acpi_acad.c optional acpi >> +dev/acpica/acpi_apei.c optional acpi >> dev/acpica/acpi_battery.c optional acpi >> dev/acpica/acpi_button.c optional acpi >> dev/acpica/acpi_cmbat.c optional acpi >> >> Modified: stable/12/sys/dev/acpica/acpi.c >> ============================================================================== >> --- stable/12/sys/dev/acpica/acpi.c Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/dev/acpica/acpi.c Fri Aug 7 01:05:10 2020 (r364003) >> @@ -151,6 +151,7 @@ static ACPI_STATUS acpi_device_scan_children(device_t >> int max_depth, acpi_scan_cb_t user_fn, void *arg); >> static int acpi_isa_pnp_probe(device_t bus, device_t child, >> struct isa_pnp_id *ids); >> +static void acpi_platform_osc(device_t dev); >> static void acpi_probe_children(device_t bus); >> static void acpi_probe_order(ACPI_HANDLE handle, int *order); >> static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, >> @@ -673,6 +674,8 @@ acpi_attach(device_t dev) >> /* Register ACPI again to pass the correct argument of pm_func. */ >> power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc); >> >> + acpi_platform_osc(dev); >> + >> if (!acpi_disabled("bus")) { >> EVENTHANDLER_REGISTER(dev_lookup, acpi_lookup, NULL, 1000); >> acpi_probe_children(dev); >> @@ -1919,6 +1922,34 @@ acpi_enable_pcie(void) >> alloc++; >> } >> #endif >> +} >> + >> +static void >> +acpi_platform_osc(device_t dev) >> +{ >> + ACPI_HANDLE sb_handle; >> + ACPI_STATUS status; >> + uint32_t cap_set[2]; >> + >> + /* 0811B06E-4A27-44F9-8D60-3CBBC22E7B48 */ >> + static uint8_t acpi_platform_uuid[ACPI_UUID_LENGTH] = { >> + 0x6e, 0xb0, 0x11, 0x08, 0x27, 0x4a, 0xf9, 0x44, >> + 0x8d, 0x60, 0x3c, 0xbb, 0xc2, 0x2e, 0x7b, 0x48 >> + }; >> + >> + if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle))) >> + return; >> + >> + cap_set[1] = 0x10; /* APEI Support */ >> + status = acpi_EvaluateOSC(sb_handle, acpi_platform_uuid, 1, >> + nitems(cap_set), cap_set, cap_set, false); >> + if (ACPI_FAILURE(status)) { >> + if (status == AE_NOT_FOUND) >> + return; >> + device_printf(dev, "_OSC failed: %s\n", >> + AcpiFormatException(status)); >> + return; >> + } >> } >> >> /* >> >> Copied and modified: stable/12/sys/dev/acpica/acpi_apei.c (from r363624, head/sys/dev/acpica/acpi_apei.c) >> ============================================================================== >> --- head/sys/dev/acpica/acpi_apei.c Mon Jul 27 21:19:41 2020 (r363624, copy source) >> +++ stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 7 01:05:10 2020 (r364003) >> @@ -574,7 +574,7 @@ apei_probe(device_t dev) >> if (acpi_find_table(ACPI_SIG_HEST) == 0) >> return (ENXIO); >> if (acpi_get_handle(dev) != NULL) >> - rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL); >> + rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) != NULL); >> else >> rv = 0; >> if (rv <= 0) >> >> Modified: stable/12/sys/dev/pci/pci.c >> ============================================================================== >> --- stable/12/sys/dev/pci/pci.c Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/dev/pci/pci.c Fri Aug 7 01:05:10 2020 (r364003) >> @@ -6284,6 +6284,67 @@ pcie_get_max_completion_timeout(device_t dev) >> } >> } >> >> +void >> +pcie_apei_error(device_t dev, int sev, uint8_t *aerp) >> +{ >> + struct pci_devinfo *dinfo = device_get_ivars(dev); >> + const char *s; >> + int aer; >> + uint32_t r, r1; >> + uint16_t rs; >> + >> + if (sev == PCIEM_STA_CORRECTABLE_ERROR) >> + s = "Correctable"; >> + else if (sev == PCIEM_STA_NON_FATAL_ERROR) >> + s = "Uncorrectable (Non-Fatal)"; >> + else >> + s = "Uncorrectable (Fatal)"; >> + device_printf(dev, "%s PCIe error reported by APEI\n", s); >> + if (aerp) { >> + if (sev == PCIEM_STA_CORRECTABLE_ERROR) { >> + r = le32dec(aerp + PCIR_AER_COR_STATUS); >> + r1 = le32dec(aerp + PCIR_AER_COR_MASK); >> + } else { >> + r = le32dec(aerp + PCIR_AER_UC_STATUS); >> + r1 = le32dec(aerp + PCIR_AER_UC_MASK); >> + } >> + device_printf(dev, "status 0x%08x mask 0x%08x", r, r1); >> + if (sev != PCIEM_STA_CORRECTABLE_ERROR) { >> + r = le32dec(aerp + PCIR_AER_UC_SEVERITY); >> + rs = le16dec(aerp + PCIR_AER_CAP_CONTROL); >> + printf(" severity 0x%08x first %d\n", >> + r, rs & 0x1f); >> + } else >> + printf("\n"); >> + } >> + >> + /* As kind of recovery just report and clear the error statuses. */ >> + if (pci_find_extcap(dev, PCIZ_AER, &aer) == 0) { >> + r = pci_read_config(dev, aer + PCIR_AER_UC_STATUS, 4); >> + if (r != 0) { >> + pci_write_config(dev, aer + PCIR_AER_UC_STATUS, r, 4); >> + device_printf(dev, "Clearing UC AER errors 0x%08x\n", r); >> + } >> + >> + r = pci_read_config(dev, aer + PCIR_AER_COR_STATUS, 4); >> + if (r != 0) { >> + pci_write_config(dev, aer + PCIR_AER_COR_STATUS, r, 4); >> + device_printf(dev, "Clearing COR AER errors 0x%08x\n", r); >> + } >> + } >> + if (dinfo->cfg.pcie.pcie_location != 0) { >> + rs = pci_read_config(dev, dinfo->cfg.pcie.pcie_location + >> + PCIER_DEVICE_STA, 2); >> + if ((rs & (PCIEM_STA_CORRECTABLE_ERROR | >> + PCIEM_STA_NON_FATAL_ERROR | PCIEM_STA_FATAL_ERROR | >> + PCIEM_STA_UNSUPPORTED_REQ)) != 0) { >> + pci_write_config(dev, dinfo->cfg.pcie.pcie_location + >> + PCIER_DEVICE_STA, rs, 2); >> + device_printf(dev, "Clearing PCIe errors 0x%04x\n", rs); >> + } >> + } >> +} >> + >> /* >> * Perform a Function Level Reset (FLR) on a device. >> * >> >> Modified: stable/12/sys/dev/pci/pcivar.h >> ============================================================================== >> --- stable/12/sys/dev/pci/pcivar.h Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/dev/pci/pcivar.h Fri Aug 7 01:05:10 2020 (r364003) >> @@ -679,6 +679,7 @@ uint32_t pcie_read_config(device_t dev, int reg, int w >> void pcie_write_config(device_t dev, int reg, uint32_t value, int width); >> uint32_t pcie_adjust_config(device_t dev, int reg, uint32_t mask, >> uint32_t value, int width); >> +void pcie_apei_error(device_t dev, int sev, uint8_t *aer); >> bool pcie_flr(device_t dev, u_int max_delay, bool force); >> int pcie_get_max_completion_timeout(device_t dev); >> bool pcie_wait_for_pending_transactions(device_t dev, u_int max_delay); >> >> Modified: stable/12/sys/x86/include/acpica_machdep.h >> ============================================================================== >> --- stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) >> @@ -84,6 +84,7 @@ void madt_parse_interrupt_values(void *entry, >> enum intr_trigger *trig, enum intr_polarity *pol); >> >> extern int madt_found_sci_override; >> +extern int (*apei_nmi)(void); >> >> #endif /* _KERNEL */ >> >> >> Modified: stable/12/sys/x86/x86/cpu_machdep.c >> ============================================================================== >> --- stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 00:56:20 2020 (r364002) >> +++ stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 01:05:10 2020 (r364003) >> @@ -811,6 +811,7 @@ int nmi_is_broadcast = 1; >> SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, >> &nmi_is_broadcast, 0, >> "Chipset NMI is broadcast"); >> +int (*apei_nmi)(void); >> >> void >> nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) >> @@ -825,6 +826,10 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe * >> panic("NMI indicates hardware failure"); >> } >> #endif /* DEV_ISA */ >> + >> + /* ACPI Platform Error Interfaces callback. */ >> + if (apei_nmi != NULL && (*apei_nmi)()) >> + claimed = true; >> >> /* >> * NMIs can be useful for debugging. They can be hooked up to a >> _______________________________________________ >> 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" -- Alexander Motin From owner-svn-src-stable@freebsd.org Fri Aug 7 13:40:50 2020 Return-Path: Delivered-To: svn-src-stable@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 8836D3BB2A7; Fri, 7 Aug 2020 13:40:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BNRMQ3768z4RTG; Fri, 7 Aug 2020 13:40:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E68018C1A; Fri, 7 Aug 2020 13:40:50 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 077Deo65037316; Fri, 7 Aug 2020 13:40:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077DeoPN037315; Fri, 7 Aug 2020 13:40:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008071340.077DeoPN037315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Aug 2020 13:40:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364014 - stable/12/sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/netgraph X-SVN-Commit-Revision: 364014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 13:40:50 -0000 Author: markj Date: Fri Aug 7 13:40:49 2020 New Revision: 364014 URL: https://svnweb.freebsd.org/changeset/base/364014 Log: MFC r363735: ng_iface(4): Set the current VNET before calling netisr_dispatch(). PR: 242406 Modified: stable/12/sys/netgraph/ng_iface.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netgraph/ng_iface.c ============================================================================== --- stable/12/sys/netgraph/ng_iface.c Fri Aug 7 13:35:34 2020 (r364013) +++ stable/12/sys/netgraph/ng_iface.c Fri Aug 7 13:40:49 2020 (r364014) @@ -731,7 +731,9 @@ ng_iface_rcvdata(hook_p hook, item_p item) } random_harvest_queue(m, sizeof(*m), RANDOM_NET_NG); M_SETFIB(m, ifp->if_fib); + CURVNET_SET(ifp->if_vnet); netisr_dispatch(isr, m); + CURVNET_RESTORE(); return (0); } From owner-svn-src-stable@freebsd.org Fri Aug 7 13:42:49 2020 Return-Path: Delivered-To: svn-src-stable@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 259E43BB1AD; Fri, 7 Aug 2020 13:42:49 +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 4BNRPh6nfDz4S7W; Fri, 7 Aug 2020 13:42:48 +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 CE145189B6; Fri, 7 Aug 2020 13:42:48 +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 077Dgm3U040531; Fri, 7 Aug 2020 13:42:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077Dgm4g040528; Fri, 7 Aug 2020 13:42:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202008071342.077Dgm4g040528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 7 Aug 2020 13:42:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364015 - in stable/12: share/man/man4 sys/netgraph X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netgraph X-SVN-Commit-Revision: 364015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 13:42:49 -0000 Author: markj Date: Fri Aug 7 13:42:47 2020 New Revision: 364015 URL: https://svnweb.freebsd.org/changeset/base/364015 Log: MFC r363736: ng_iface(4): Remove unsupported protocols. Modified: stable/12/share/man/man4/ng_iface.4 stable/12/sys/netgraph/ng_iface.c stable/12/sys/netgraph/ng_iface.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ng_iface.4 ============================================================================== --- stable/12/share/man/man4/ng_iface.4 Fri Aug 7 13:40:49 2020 (r364014) +++ stable/12/share/man/man4/ng_iface.4 Fri Aug 7 13:42:47 2020 (r364015) @@ -35,7 +35,7 @@ .\" $FreeBSD$ .\" $Whistle: ng_iface.8,v 1.5 1999/01/25 23:46:26 archie Exp $ .\" -.Dd February 6, 2019 +.Dd July 31, 2020 .Dt NG_IFACE 4 .Os .Sh NAME @@ -70,7 +70,7 @@ Packets transmitted via the interface flow out the cor protocol-specific hook. Similarly, packets received on a hook appear on the interface as packets received into the corresponding protocol stack. -The currently supported protocols are IP, IPv6, ATM, NATM, and NS. +The currently supported protocols are IP and IPv6. .Pp An .Nm iface @@ -87,12 +87,6 @@ This node type supports the following hooks: Transmission and reception of IP packets. .It Va inet6 Transmission and reception of IPv6 packets. -.It Va atm -Transmission and reception of ATM packets. -.It Va natm -Transmission and reception of NATM packets. -.It Va ns -Transmission and reception of NS packets. .El .Sh CONTROL MESSAGES This node type supports the generic control messages, plus the following: Modified: stable/12/sys/netgraph/ng_iface.c ============================================================================== --- stable/12/sys/netgraph/ng_iface.c Fri Aug 7 13:40:49 2020 (r364014) +++ stable/12/sys/netgraph/ng_iface.c Fri Aug 7 13:42:47 2020 (r364015) @@ -111,8 +111,6 @@ typedef const struct iffam *iffam_p; const static struct iffam gFamilies[] = { { AF_INET, NG_IFACE_HOOK_INET }, { AF_INET6, NG_IFACE_HOOK_INET6 }, - { AF_ATM, NG_IFACE_HOOK_ATM }, - { AF_NATM, NG_IFACE_HOOK_NATM }, }; #define NUM_FAMILIES nitems(gFamilies) Modified: stable/12/sys/netgraph/ng_iface.h ============================================================================== --- stable/12/sys/netgraph/ng_iface.h Fri Aug 7 13:40:49 2020 (r364014) +++ stable/12/sys/netgraph/ng_iface.h Fri Aug 7 13:42:47 2020 (r364015) @@ -54,8 +54,6 @@ /* My hook names */ #define NG_IFACE_HOOK_INET "inet" #define NG_IFACE_HOOK_INET6 "inet6" -#define NG_IFACE_HOOK_ATM "atm" -#define NG_IFACE_HOOK_NATM "natm" /* MTU bounds */ #define NG_IFACE_MTU_MIN 72 From owner-svn-src-stable@freebsd.org Fri Aug 7 15:03:21 2020 Return-Path: Delivered-To: svn-src-stable@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 76F293BC9F4; Fri, 7 Aug 2020 15:03:21 +0000 (UTC) (envelope-from gbe@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 4BNTBd2XMVz4WKF; Fri, 7 Aug 2020 15:03:21 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 39E7C1999E; Fri, 7 Aug 2020 15:03:21 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 077F3LEP088820; Fri, 7 Aug 2020 15:03:21 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077F3Kfk088817; Fri, 7 Aug 2020 15:03:20 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008071503.077F3Kfk088817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 7 Aug 2020 15:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364016 - in stable/12: . share/man/man9 X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: in stable/12: . share/man/man9 X-SVN-Commit-Revision: 364016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 15:03:21 -0000 Author: gbe (doc committer) Date: Fri Aug 7 15:03:20 2020 New Revision: 364016 URL: https://svnweb.freebsd.org/changeset/base/364016 Log: MFC r363291: devstat(9): Update the man page to reflect the current implementation - Rename devstat_add_entry to devstat_new_entry - Update the description of devstat_trans_flags - Add manpage aliases for devstat_start_transaction_bio and devstat_end_transaction_bio PR: 157316 Submitted by: novel Reviewed by: cem, bcr Approved by: bcr Differential Revision: https://reviews.freebsd.org/D25677 Modified: stable/12/ObsoleteFiles.inc stable/12/share/man/man9/Makefile stable/12/share/man/man9/devstat.9 Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Fri Aug 7 13:42:47 2020 (r364015) +++ stable/12/ObsoleteFiles.inc Fri Aug 7 15:03:20 2020 (r364016) @@ -289,6 +289,9 @@ OLD_DIRS+=usr/lib/clang/10.0.0/lib/freebsd OLD_DIRS+=usr/lib/clang/10.0.0/lib OLD_DIRS+=usr/lib/clang/10.0.0 +# 20200715: rework of devstat(9) man page +OLD_FILES+=usr/share/man/man9/devstat_add_entry.9.gz + # 20200516: Remove bogus man links OLD_FILES+=usr/share/man/man3/getauusernam_R.3.gz OLD_FILES+=usr/share/man/man3/getauclassnam_3.3.gz Modified: stable/12/share/man/man9/Makefile ============================================================================== --- stable/12/share/man/man9/Makefile Fri Aug 7 13:42:47 2020 (r364015) +++ stable/12/share/man/man9/Makefile Fri Aug 7 15:03:20 2020 (r364016) @@ -903,10 +903,12 @@ MLINKS+=device_set_desc.9 device_get_desc.9 \ device_set_desc.9 device_set_desc_copy.9 MLINKS+=device_set_flags.9 device_get_flags.9 MLINKS+=devstat.9 devicestat.9 \ - devstat.9 devstat_add_entry.9 \ + devstat.9 devstat_new_entry.9 \ devstat.9 devstat_end_transaction.9 \ + devstat.9 devstat_end_transaction_bio.9 \ devstat.9 devstat_remove_entry.9 \ - devstat.9 devstat_start_transaction.9 + devstat.9 devstat_start_transaction.9 \ + devstat.9 devstat_start_transaction_bio.9 MLINKS+=disk.9 disk_add_alias.9 \ disk.9 disk_alloc.9 \ disk.9 disk_create.9 \ Modified: stable/12/share/man/man9/devstat.9 ============================================================================== --- stable/12/share/man/man9/devstat.9 Fri Aug 7 13:42:47 2020 (r364015) +++ stable/12/share/man/man9/devstat.9 Fri Aug 7 15:03:20 2020 (r364016) @@ -27,25 +27,24 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2018 +.Dd July 15, 2020 .Dt DEVSTAT 9 .Os .Sh NAME .Nm devstat , -.Nm devstat_add_entry , .Nm devstat_end_transaction , .Nm devstat_end_transaction_bio , .Nm devstat_end_transaction_bio_bt , +.Nm devstat_new_entry , .Nm devstat_remove_entry , .Nm devstat_start_transaction , .Nm devstat_start_transaction_bio .Nd kernel interface for keeping device statistics .Sh SYNOPSIS .In sys/devicestat.h -.Ft void -.Fo devstat_add_entry -.Fa "struct devstat *ds" -.Fa "const char *dev_name" +.Ft struct devstat * +.Fo devstat_new_entry +.Fa "const void *dev_name" .Fa "int unit_number" .Fa "uint32_t block_size" .Fa "devstat_support_flags flags" @@ -78,7 +77,6 @@ .Fa "struct devstat *ds" .Fa "const struct bio *bp" .Fc -.Fc .Ft void .Fo devstat_end_transaction_bio_bt .Fa "struct devstat *ds" @@ -103,19 +101,13 @@ for most disk-like drivers in the 2000s and beyond. New consumers of the interface should almost certainly use only the "bio" variants of the start and end transacation routines. .Pp -.Fn devstat_add_entry -registers a device with the -.Nm -subsystem. -The caller is expected to have already allocated \fBand zeroed\fR -the devstat structure before calling this function. -.Fn devstat_add_entry +.Fn devstat_new_entry +allocates and initializes +.Va devstat +structure and returns a pointer to it. +.Fn devstat_new_entry takes several arguments: .Bl -tag -width device_type -.It ds -The -.Va devstat -structure, allocated and zeroed by the client. .It dev_name The device name, e.g., da, cd, sa. .It unit_number @@ -386,6 +378,8 @@ to insert a device in the list. The second parameter is attach order. See below for a list of available priorities. +.It id +Identification for GEOM nodes. .El .Pp Each device is given a device type. @@ -478,7 +472,18 @@ typedef enum { DEVSTAT_WRITE = 0x02, DEVSTAT_FREE = 0x03 } devstat_trans_flags; +#define DEVSTAT_N_TRANS_FLAGS 4 .Ed +.Pp +DEVSTAT_NO_DATA is a type of transactions to the device which are neither +reads or writes. +For instance, +.Tn SCSI +drivers often send a test unit ready command to +.Tn SCSI +devices. +The test unit ready command does not read or write any data. +It merely causes the device to return its status. .Pp There are four possible values for the .Va tag_type From owner-svn-src-stable@freebsd.org Fri Aug 7 15:11:31 2020 Return-Path: Delivered-To: svn-src-stable@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 A16F83BD09C; Fri, 7 Aug 2020 15:11:31 +0000 (UTC) (envelope-from gbe@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 4BNTN33mGRz4WxF; Fri, 7 Aug 2020 15:11:31 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1: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 6456C197E6; Fri, 7 Aug 2020 15:11:31 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 077FBVsD091914; Fri, 7 Aug 2020 15:11:31 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077FBSwF091052; Fri, 7 Aug 2020 15:11:28 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202008071511.077FBSwF091052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 7 Aug 2020 15:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364017 - in stable/12/lib: libc/capability libc/gen libc/sys libcasper/libcasper libcasper/services/cap_dns libcasper/services/cap_grp libcasper/services/cap_pwd libcasper/services/cap... X-SVN-Group: stable-12 X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: in stable/12/lib: libc/capability libc/gen libc/sys libcasper/libcasper libcasper/services/cap_dns libcasper/services/cap_grp libcasper/services/cap_pwd libcasper/services/cap_sysctl libcasper/service... X-SVN-Commit-Revision: 364017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 15:11:31 -0000 Author: gbe (doc committer) Date: Fri Aug 7 15:11:27 2020 New Revision: 364017 URL: https://svnweb.freebsd.org/changeset/base/364017 Log: MFC r362230: libcasper(3): Document HISTORY within the manpages Reviewed by: bcr Approved by: bcr Differential Revision: https://reviews.freebsd.org/D24695 Modified: stable/12/lib/libc/capability/cap_rights_init.3 stable/12/lib/libc/gen/cap_rights_get.3 stable/12/lib/libc/gen/cap_sandboxed.3 stable/12/lib/libc/sys/cap_enter.2 stable/12/lib/libc/sys/cap_fcntls_limit.2 stable/12/lib/libc/sys/cap_ioctls_limit.2 stable/12/lib/libc/sys/cap_rights_limit.2 stable/12/lib/libcasper/libcasper/libcasper.3 stable/12/lib/libcasper/libcasper/libcasper_service.3 stable/12/lib/libcasper/services/cap_dns/cap_dns.3 stable/12/lib/libcasper/services/cap_grp/cap_grp.3 stable/12/lib/libcasper/services/cap_pwd/cap_pwd.3 stable/12/lib/libcasper/services/cap_sysctl/cap_sysctl.3 stable/12/lib/libcasper/services/cap_syslog/cap_syslog.3 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/capability/cap_rights_init.3 ============================================================================== --- stable/12/lib/libc/capability/cap_rights_init.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/capability/cap_rights_init.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd May 5, 2020 .Dt CAP_RIGHTS_INIT 3 .Os .Sh NAME @@ -232,6 +232,18 @@ if (cap_rights_limit(fd, &rights) < 0 && errno != ENOS .Xr capsicum 4 , .Xr rights 4 .Sh HISTORY +The functions +.Fn cap_rights_init , +.Fn cap_rights_set , +.Fn cap_rights_clear , +.Fn cap_rights_is_set , +.Fn cap_rights_is_valid , +.Fn cap_rights_merge , +.Fn cap_rights_remove +and +.Fn cap_rights_contains +first appeared in +.Fx 8.3 . Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. Modified: stable/12/lib/libc/gen/cap_rights_get.3 ============================================================================== --- stable/12/lib/libc/gen/cap_rights_get.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/gen/cap_rights_get.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd May 5, 2020 .Dt CAP_RIGHTS_GET 3 .Os .Sh NAME @@ -110,6 +110,10 @@ argument points at an invalid address. .Xr capsicum 4 , .Xr rights 4 .Sh HISTORY +The +.Fn cap_rights_get +function first appeared in +.Fx 9.2 . Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. Modified: stable/12/lib/libc/gen/cap_sandboxed.3 ============================================================================== --- stable/12/lib/libc/gen/cap_sandboxed.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/gen/cap_sandboxed.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd May 5, 2020 .Dt CAP_SANDBOXED 3 .Os .Sh NAME @@ -65,6 +65,11 @@ or .Sh SEE ALSO .Xr cap_enter 2 , .Xr capsicum 4 +.Sh HISTORY +The +.Fn cap_sandboxed +function first appeared in +.Fx 9.2 . .Sh AUTHORS This function was implemented and manual page was written by .An Pawel Jakub Dawidek Aq Mt pawel@dawidek.net Modified: stable/12/lib/libc/sys/cap_enter.2 ============================================================================== --- stable/12/lib/libc/sys/cap_enter.2 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/sys/cap_enter.2 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 23, 2017 +.Dd May 5, 2020 .Dt CAP_ENTER 2 .Os .Sh NAME @@ -150,6 +150,10 @@ points outside the process's allocated address space. .Xr capsicum 4 , .Xr sysctl 9 .Sh HISTORY +The +.Fn cap_getmode +system call first appeared in +.Fx 8.3 . Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. Modified: stable/12/lib/libc/sys/cap_fcntls_limit.2 ============================================================================== --- stable/12/lib/libc/sys/cap_fcntls_limit.2 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/sys/cap_fcntls_limit.2 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd May 5, 2020 .Dt CAP_FCNTLS_LIMIT 2 .Os .Sh NAME @@ -117,6 +117,12 @@ argument points at an invalid address. .Xr cap_rights_limit 2 , .Xr fcntl 2 .Sh HISTORY +The +.Fn cap_fcntls_get +and +.Fn cap_fcntls_limit +system calls first appeared in +.Fx 8.3 . Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. Modified: stable/12/lib/libc/sys/cap_ioctls_limit.2 ============================================================================== --- stable/12/lib/libc/sys/cap_ioctls_limit.2 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/sys/cap_ioctls_limit.2 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2015 +.Dd May 5, 2020 .Dt CAP_IOCTLS_LIMIT 2 .Os .Sh NAME @@ -150,6 +150,12 @@ argument points at invalid address. .Xr cap_rights_limit 2 , .Xr ioctl 2 .Sh HISTORY +The +.Fn cap_ioctls_get +and +.Fn cap_ioctls_limit +system calls first appeared in +.Fx 8.3 . Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. Modified: stable/12/lib/libc/sys/cap_rights_limit.2 ============================================================================== --- stable/12/lib/libc/sys/cap_rights_limit.2 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libc/sys/cap_rights_limit.2 Fri Aug 7 15:11:27 2020 (r364017) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2014 +.Dd May 5, 2020 .Dt CAP_RIGHTS_LIMIT 2 .Os .Sh NAME @@ -148,6 +148,10 @@ Capability rights list can only be reduced, never expa .Xr capsicum 4 , .Xr rights 4 .Sh HISTORY +The +.Fn cap_rights_limit +function first appeared in +.Fx 8.3 . Support for capabilities and capabilities mode was developed as part of the .Tn TrustedBSD Project. Modified: stable/12/lib/libcasper/libcasper/libcasper.3 ============================================================================== --- stable/12/lib/libcasper/libcasper/libcasper.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/libcasper/libcasper.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 5, 2018 +.Dd May 5, 2020 .Dt LIBCASPER 3 .Os .Sh NAME @@ -271,6 +271,11 @@ functions always succeed. .Xr capsicum 4 , .Xr unix 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm libcasper +library first appeared in +.Fx 10.3 . .Sh AUTHORS The .Nm libcasper Modified: stable/12/lib/libcasper/libcasper/libcasper_service.3 ============================================================================== --- stable/12/lib/libcasper/libcasper/libcasper_service.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/libcasper/libcasper_service.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 23, 2018 +.Dd May 5, 2020 .Dt LIBCASPER 3 .Os .Sh NAME @@ -103,6 +103,11 @@ flag. .Xr libcasper 3 , .Xr capsicum 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm libcasper +library first appeared in +.Fx 10.3 . .Sh AUTHORS The .Nm libcasper Modified: stable/12/lib/libcasper/services/cap_dns/cap_dns.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_dns/cap_dns.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/services/cap_dns/cap_dns.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 18, 2020 +.Dd May 5, 2020 .Dt CAP_DNS 3 .Os .Sh NAME @@ -198,6 +198,11 @@ printf("Name associated with %s is %s.\\n", ipstr, hp- .Xr getnameinfo 3 , .Xr capsicum 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm cap_dns +service first appeared in +.Fx 10.3 . .Sh AUTHORS The .Nm cap_dns Modified: stable/12/lib/libcasper/services/cap_grp/cap_grp.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_grp/cap_grp.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/services/cap_grp/cap_grp.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2018 +.Dd May 5, 2020 .Dt CAP_GRP 3 .Os .Sh NAME @@ -217,6 +217,11 @@ cap_close(capgrp); .Xr setgroupent 3 , .Xr capsicum 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm cap_grp +service first appeared in +.Fx 10.3 . .Sh AUTHORS The .Nm cap_grp Modified: stable/12/lib/libcasper/services/cap_pwd/cap_pwd.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_pwd/cap_pwd.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/services/cap_pwd/cap_pwd.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 20, 2018 +.Dd May 5, 2020 .Dt CAP_PWD 3 .Os .Sh NAME @@ -223,6 +223,11 @@ cap_close(cappwd); .Xr setpwent 3 , .Xr capsicum 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm cap_pwd +service first appeared in +.Fx 10.3 . .Sh AUTHORS The .Nm cap_pwd Modified: stable/12/lib/libcasper/services/cap_sysctl/cap_sysctl.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/services/cap_sysctl/cap_sysctl.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2018 +.Dd May 5, 2020 .Dt CAP_SYSCTL 3 .Os .Sh NAME @@ -132,6 +132,11 @@ cap_close(capsysctl); .Xr sysctlbyname 3 , .Xr capsicum 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm cap_sysctl +service first appeared in +.Fx 10.3 . .Sh AUTHORS The .Nm cap_sysctl Modified: stable/12/lib/libcasper/services/cap_syslog/cap_syslog.3 ============================================================================== --- stable/12/lib/libcasper/services/cap_syslog/cap_syslog.3 Fri Aug 7 15:03:20 2020 (r364016) +++ stable/12/lib/libcasper/services/cap_syslog/cap_syslog.3 Fri Aug 7 15:11:27 2020 (r364017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 27, 2018 +.Dd May 5, 2020 .Dt CAP_SYSLOG 3 .Os .Sh NAME @@ -103,5 +103,10 @@ cap_syslog(capsyslog, LOG_NOTICE, "System logs from ca .Xr vsyslog 3 , .Xr capsicum 4 , .Xr nv 9 +.Sh HISTORY +The +.Nm cap_syslog +service first appeared in +.Fx 10.3 . .Sh AUTHORS .An Mariusz Zaborski Aq Mt oshogbo@FreeBSD.org From owner-svn-src-stable@freebsd.org Fri Aug 7 15:58:23 2020 Return-Path: Delivered-To: svn-src-stable@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 E0E9B3BDFD3; Fri, 7 Aug 2020 15:58:23 +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 4BNVQ74jsYz4Zl7; Fri, 7 Aug 2020 15:58:23 +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 80B801A2C5; Fri, 7 Aug 2020 15:58:23 +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 077FwNEG020126; Fri, 7 Aug 2020 15:58:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077FwNlj020125; Fri, 7 Aug 2020 15:58:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008071558.077FwNlj020125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 15:58:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364020 - stable/12/sys/dev/acpica X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/acpica X-SVN-Commit-Revision: 364020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 15:58:23 -0000 Author: mav Date: Fri Aug 7 15:58:23 2020 New Revision: 364020 URL: https://svnweb.freebsd.org/changeset/base/364020 Log: Fix bug in r363624 12 adaptation. Modified: stable/12/sys/dev/acpica/acpi_apei.c Modified: stable/12/sys/dev/acpica/acpi_apei.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 7 15:32:42 2020 (r364019) +++ stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 7 15:58:23 2020 (r364020) @@ -574,7 +574,7 @@ apei_probe(device_t dev) if (acpi_find_table(ACPI_SIG_HEST) == 0) return (ENXIO); if (acpi_get_handle(dev) != NULL) - rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) != NULL); + rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) == NULL); else rv = 0; if (rv <= 0) From owner-svn-src-stable@freebsd.org Fri Aug 7 15:59:47 2020 Return-Path: Delivered-To: svn-src-stable@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 726293BE101; Fri, 7 Aug 2020 15:59:47 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) (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 4BNVRj5rpCz4Zlf; Fri, 7 Aug 2020 15:59:45 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qk1-x742.google.com with SMTP id 2so2125138qkf.10; Fri, 07 Aug 2020 08:59:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=x1PzYLAw+xmWTVxqMvqjIV/lEXuwS0BX59/r6I/K+I8=; b=ZuZEXv9dLKg4RfV/L4Td7/MPG4b4Lpcqd0N2fn/I7OgK6HUV90YFtVhcLZ60kb3Ym5 mfiMs7MOCTzmi0Yq5nDFa7IxWIA7pm+XXVvPHGfQUT31I4rh/f2TFp4Z0qagftRPPtqW K0ySmx7mrmXY0sDM5P4K50w+kC9FFEM+iF2xtoaDH++FurCpq/vEAZ8s8L8b+cqE69qq XYYgUjX0VUGZ1YR/xk9IkewB8/HvhDdGrdK09Gm5MqrLAxMB2SDdMsJQzgO0yS6LLSDN t/kj2tOBK0yMi2AbaKjWbzxZKDM3A3IeqPt0L88URKUGElPGg6CSHRToheZgZXPS/YsX d/5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=x1PzYLAw+xmWTVxqMvqjIV/lEXuwS0BX59/r6I/K+I8=; b=eiT51N7dzAbaEMZgw5wEjXFgpb/W4Hm2lWqwXSkE/429J6ovVnmSisZuFD6jbcg8hT D0zXoFd9R18MqovKFUC5fvLllOGPS69mLqFN6xQzAwohP3G0uFCQ3PTvxeBkgBW2Tx30 xjM6qHV2vl5F/LOecEO1dOW1MmprsAYzLVGndx0ZLdXwD59myxBt/MKckEh0UY6w+5wj oW2cUGXEGZv2PNJfLTRmvYsKbo0451Zk2q9GQbIQ16EQaNTdldR62TSpETgNNlg9k43H t0182yddkT8TY4zV0s7b+T3/BgluKezq6uDta/Nw2IWDZyEq5/5CUhkhceG3qyWMB0Qm Aenw== X-Gm-Message-State: AOAM530BFbtz4ce4FO0T+sV7fF6qbsl91kYZhAwptgok94Yvd5H95w9c upI8aKrVwHTY10O4+aNvGf8UmqX1 X-Google-Smtp-Source: ABdhPJw7UdHF3nOnrD3Y0QIChBcYC/OE8wveoNgTGQb9Eg9EUfGum7n0BCVOOMsG4XHvGDoyrlltgw== X-Received: by 2002:a37:6644:: with SMTP id a65mr14231354qkc.4.1596815984411; Fri, 07 Aug 2020 08:59:44 -0700 (PDT) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id n33sm6646891qtd.43.2020.08.07.08.59.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2020 08:59:41 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r364003 - in stable/12/sys: arm64/arm64 arm64/include conf dev/acpica dev/pci x86/include x86/x86 From: Alexander Motin To: "Jack L." Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <202008070105.07715AZJ073437@repo.freebsd.org> <90100f43-7fe6-6b24-7417-5e2ded25f1be@FreeBSD.org> Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <0e04d927-01cf-bc9c-aad5-05c1656fe388@FreeBSD.org> Date: Fri, 7 Aug 2020 11:59:40 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <90100f43-7fe6-6b24-7417-5e2ded25f1be@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4BNVRj5rpCz4Zlf X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ZuZEXv9d; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::742 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-2.29 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-0.86)[-0.862]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.84)[-0.840]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-0.38)[-0.384]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::742:from]; FREEMAIL_TO(0.00)[gmail.com]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 15:59:47 -0000 I'm sorry, it was my fault. Should be fixed by r364020. But I'd still look on the data just out of curiosity. On 07.08.2020 09:12, Alexander Motin wrote: > Do you mean you are getting two apeiX devices? That is unexpected. > Could you send me `devinfo -vr` and `acpidump -t` outputs? And lets go > private for debugging. > > On 07.08.2020 04:58, Jack L. wrote: >> I'm getting >> apei1 platform error interface >> after installing the kernel with this commit on multiple Dell R610 servers. >> >> On Thu, Aug 6, 2020 at 6:05 PM Alexander Motin wrote: >>> >>> Author: mav >>> Date: Fri Aug 7 01:05:10 2020 >>> New Revision: 364003 >>> URL: https://svnweb.freebsd.org/changeset/base/364003 >>> >>> Log: >>> MFC r363624: Add initial driver for ACPI Platform Error Interfaces. >>> >>> APEI allows platform to report different kinds of errors to OS in several >>> ways. We've found that Supermicro X10/X11 motherboards report PCIe errors >>> appearing on hot-unplug via this interface using NMI. Without respective >>> driver it ended up in kernel panic without any additional information. >>> >>> This driver introduces support for the APEI Generic Hardware Error Source >>> reporting via NMI, SCI or polling. It decodes the reported errors and >>> either pass them to pci(4) for processing or just logs otherwise. Errors >>> marked as fatal still end up in kernel panic, but some more informative. >>> >>> When somebody get to native PCIe AER support implementation both of the >>> reporting mechanisms should get common error recovery code. Since in our >>> case errors happen when the device is already gone, there is nothing to >>> recover, so the code just clears the error statuses, practically ignoring >>> the otherwise destructive NMIs in nicer way. >>> >>> Relnotes: yes >>> Sponsored by: iXsystems, Inc. >>> >>> Added: >>> stable/12/sys/dev/acpica/acpi_apei.c >>> - copied, changed from r363624, head/sys/dev/acpica/acpi_apei.c >>> Modified: >>> stable/12/sys/arm64/arm64/machdep.c >>> stable/12/sys/arm64/include/acpica_machdep.h >>> stable/12/sys/conf/files >>> stable/12/sys/dev/acpica/acpi.c >>> stable/12/sys/dev/pci/pci.c >>> stable/12/sys/dev/pci/pcivar.h >>> stable/12/sys/x86/include/acpica_machdep.h >>> stable/12/sys/x86/x86/cpu_machdep.c >>> Directory Properties: >>> stable/12/ (props changed) >>> >>> Modified: stable/12/sys/arm64/arm64/machdep.c >>> ============================================================================== >>> --- stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/arm64/arm64/machdep.c Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -131,6 +131,8 @@ void pagezero_cache(void *); >>> /* pagezero_simple is default pagezero */ >>> void (*pagezero)(void *p) = pagezero_simple; >>> >>> +int (*apei_nmi)(void); >>> + >>> static void >>> pan_setup(void) >>> { >>> >>> Modified: stable/12/sys/arm64/include/acpica_machdep.h >>> ============================================================================== >>> --- stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/arm64/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -57,6 +57,8 @@ struct acpi_generic_address; >>> int acpi_map_addr(struct acpi_generic_address *, bus_space_tag_t *, >>> bus_space_handle_t *, bus_size_t); >>> >>> +extern int (*apei_nmi)(void); >>> + >>> #endif /* _KERNEL */ >>> >>> #endif /* __ACPICA_MACHDEP_H__ */ >>> >>> Modified: stable/12/sys/conf/files >>> ============================================================================== >>> --- stable/12/sys/conf/files Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/conf/files Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -740,6 +740,7 @@ dev/acpica/Osd/OsdSynch.c optional acpi >>> dev/acpica/Osd/OsdTable.c optional acpi >>> dev/acpica/acpi.c optional acpi >>> dev/acpica/acpi_acad.c optional acpi >>> +dev/acpica/acpi_apei.c optional acpi >>> dev/acpica/acpi_battery.c optional acpi >>> dev/acpica/acpi_button.c optional acpi >>> dev/acpica/acpi_cmbat.c optional acpi >>> >>> Modified: stable/12/sys/dev/acpica/acpi.c >>> ============================================================================== >>> --- stable/12/sys/dev/acpica/acpi.c Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/dev/acpica/acpi.c Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -151,6 +151,7 @@ static ACPI_STATUS acpi_device_scan_children(device_t >>> int max_depth, acpi_scan_cb_t user_fn, void *arg); >>> static int acpi_isa_pnp_probe(device_t bus, device_t child, >>> struct isa_pnp_id *ids); >>> +static void acpi_platform_osc(device_t dev); >>> static void acpi_probe_children(device_t bus); >>> static void acpi_probe_order(ACPI_HANDLE handle, int *order); >>> static ACPI_STATUS acpi_probe_child(ACPI_HANDLE handle, UINT32 level, >>> @@ -673,6 +674,8 @@ acpi_attach(device_t dev) >>> /* Register ACPI again to pass the correct argument of pm_func. */ >>> power_pm_register(POWER_PM_TYPE_ACPI, acpi_pm_func, sc); >>> >>> + acpi_platform_osc(dev); >>> + >>> if (!acpi_disabled("bus")) { >>> EVENTHANDLER_REGISTER(dev_lookup, acpi_lookup, NULL, 1000); >>> acpi_probe_children(dev); >>> @@ -1919,6 +1922,34 @@ acpi_enable_pcie(void) >>> alloc++; >>> } >>> #endif >>> +} >>> + >>> +static void >>> +acpi_platform_osc(device_t dev) >>> +{ >>> + ACPI_HANDLE sb_handle; >>> + ACPI_STATUS status; >>> + uint32_t cap_set[2]; >>> + >>> + /* 0811B06E-4A27-44F9-8D60-3CBBC22E7B48 */ >>> + static uint8_t acpi_platform_uuid[ACPI_UUID_LENGTH] = { >>> + 0x6e, 0xb0, 0x11, 0x08, 0x27, 0x4a, 0xf9, 0x44, >>> + 0x8d, 0x60, 0x3c, 0xbb, 0xc2, 0x2e, 0x7b, 0x48 >>> + }; >>> + >>> + if (ACPI_FAILURE(AcpiGetHandle(ACPI_ROOT_OBJECT, "\\_SB_", &sb_handle))) >>> + return; >>> + >>> + cap_set[1] = 0x10; /* APEI Support */ >>> + status = acpi_EvaluateOSC(sb_handle, acpi_platform_uuid, 1, >>> + nitems(cap_set), cap_set, cap_set, false); >>> + if (ACPI_FAILURE(status)) { >>> + if (status == AE_NOT_FOUND) >>> + return; >>> + device_printf(dev, "_OSC failed: %s\n", >>> + AcpiFormatException(status)); >>> + return; >>> + } >>> } >>> >>> /* >>> >>> Copied and modified: stable/12/sys/dev/acpica/acpi_apei.c (from r363624, head/sys/dev/acpica/acpi_apei.c) >>> ============================================================================== >>> --- head/sys/dev/acpica/acpi_apei.c Mon Jul 27 21:19:41 2020 (r363624, copy source) >>> +++ stable/12/sys/dev/acpica/acpi_apei.c Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -574,7 +574,7 @@ apei_probe(device_t dev) >>> if (acpi_find_table(ACPI_SIG_HEST) == 0) >>> return (ENXIO); >>> if (acpi_get_handle(dev) != NULL) >>> - rv = ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids, NULL); >>> + rv = (ACPI_ID_PROBE(device_get_parent(dev), dev, apei_ids) != NULL); >>> else >>> rv = 0; >>> if (rv <= 0) >>> >>> Modified: stable/12/sys/dev/pci/pci.c >>> ============================================================================== >>> --- stable/12/sys/dev/pci/pci.c Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/dev/pci/pci.c Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -6284,6 +6284,67 @@ pcie_get_max_completion_timeout(device_t dev) >>> } >>> } >>> >>> +void >>> +pcie_apei_error(device_t dev, int sev, uint8_t *aerp) >>> +{ >>> + struct pci_devinfo *dinfo = device_get_ivars(dev); >>> + const char *s; >>> + int aer; >>> + uint32_t r, r1; >>> + uint16_t rs; >>> + >>> + if (sev == PCIEM_STA_CORRECTABLE_ERROR) >>> + s = "Correctable"; >>> + else if (sev == PCIEM_STA_NON_FATAL_ERROR) >>> + s = "Uncorrectable (Non-Fatal)"; >>> + else >>> + s = "Uncorrectable (Fatal)"; >>> + device_printf(dev, "%s PCIe error reported by APEI\n", s); >>> + if (aerp) { >>> + if (sev == PCIEM_STA_CORRECTABLE_ERROR) { >>> + r = le32dec(aerp + PCIR_AER_COR_STATUS); >>> + r1 = le32dec(aerp + PCIR_AER_COR_MASK); >>> + } else { >>> + r = le32dec(aerp + PCIR_AER_UC_STATUS); >>> + r1 = le32dec(aerp + PCIR_AER_UC_MASK); >>> + } >>> + device_printf(dev, "status 0x%08x mask 0x%08x", r, r1); >>> + if (sev != PCIEM_STA_CORRECTABLE_ERROR) { >>> + r = le32dec(aerp + PCIR_AER_UC_SEVERITY); >>> + rs = le16dec(aerp + PCIR_AER_CAP_CONTROL); >>> + printf(" severity 0x%08x first %d\n", >>> + r, rs & 0x1f); >>> + } else >>> + printf("\n"); >>> + } >>> + >>> + /* As kind of recovery just report and clear the error statuses. */ >>> + if (pci_find_extcap(dev, PCIZ_AER, &aer) == 0) { >>> + r = pci_read_config(dev, aer + PCIR_AER_UC_STATUS, 4); >>> + if (r != 0) { >>> + pci_write_config(dev, aer + PCIR_AER_UC_STATUS, r, 4); >>> + device_printf(dev, "Clearing UC AER errors 0x%08x\n", r); >>> + } >>> + >>> + r = pci_read_config(dev, aer + PCIR_AER_COR_STATUS, 4); >>> + if (r != 0) { >>> + pci_write_config(dev, aer + PCIR_AER_COR_STATUS, r, 4); >>> + device_printf(dev, "Clearing COR AER errors 0x%08x\n", r); >>> + } >>> + } >>> + if (dinfo->cfg.pcie.pcie_location != 0) { >>> + rs = pci_read_config(dev, dinfo->cfg.pcie.pcie_location + >>> + PCIER_DEVICE_STA, 2); >>> + if ((rs & (PCIEM_STA_CORRECTABLE_ERROR | >>> + PCIEM_STA_NON_FATAL_ERROR | PCIEM_STA_FATAL_ERROR | >>> + PCIEM_STA_UNSUPPORTED_REQ)) != 0) { >>> + pci_write_config(dev, dinfo->cfg.pcie.pcie_location + >>> + PCIER_DEVICE_STA, rs, 2); >>> + device_printf(dev, "Clearing PCIe errors 0x%04x\n", rs); >>> + } >>> + } >>> +} >>> + >>> /* >>> * Perform a Function Level Reset (FLR) on a device. >>> * >>> >>> Modified: stable/12/sys/dev/pci/pcivar.h >>> ============================================================================== >>> --- stable/12/sys/dev/pci/pcivar.h Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/dev/pci/pcivar.h Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -679,6 +679,7 @@ uint32_t pcie_read_config(device_t dev, int reg, int w >>> void pcie_write_config(device_t dev, int reg, uint32_t value, int width); >>> uint32_t pcie_adjust_config(device_t dev, int reg, uint32_t mask, >>> uint32_t value, int width); >>> +void pcie_apei_error(device_t dev, int sev, uint8_t *aer); >>> bool pcie_flr(device_t dev, u_int max_delay, bool force); >>> int pcie_get_max_completion_timeout(device_t dev); >>> bool pcie_wait_for_pending_transactions(device_t dev, u_int max_delay); >>> >>> Modified: stable/12/sys/x86/include/acpica_machdep.h >>> ============================================================================== >>> --- stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/x86/include/acpica_machdep.h Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -84,6 +84,7 @@ void madt_parse_interrupt_values(void *entry, >>> enum intr_trigger *trig, enum intr_polarity *pol); >>> >>> extern int madt_found_sci_override; >>> +extern int (*apei_nmi)(void); >>> >>> #endif /* _KERNEL */ >>> >>> >>> Modified: stable/12/sys/x86/x86/cpu_machdep.c >>> ============================================================================== >>> --- stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 00:56:20 2020 (r364002) >>> +++ stable/12/sys/x86/x86/cpu_machdep.c Fri Aug 7 01:05:10 2020 (r364003) >>> @@ -811,6 +811,7 @@ int nmi_is_broadcast = 1; >>> SYSCTL_INT(_machdep, OID_AUTO, nmi_is_broadcast, CTLFLAG_RWTUN, >>> &nmi_is_broadcast, 0, >>> "Chipset NMI is broadcast"); >>> +int (*apei_nmi)(void); >>> >>> void >>> nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame) >>> @@ -825,6 +826,10 @@ nmi_call_kdb(u_int cpu, u_int type, struct trapframe * >>> panic("NMI indicates hardware failure"); >>> } >>> #endif /* DEV_ISA */ >>> + >>> + /* ACPI Platform Error Interfaces callback. */ >>> + if (apei_nmi != NULL && (*apei_nmi)()) >>> + claimed = true; >>> >>> /* >>> * NMIs can be useful for debugging. They can be hooked up to a >>> _______________________________________________ >>> 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" > -- Alexander Motin From owner-svn-src-stable@freebsd.org Fri Aug 7 17:32:55 2020 Return-Path: Delivered-To: svn-src-stable@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 13DA63701A5; Fri, 7 Aug 2020 17:32:55 +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 4BNXWB6gV8z3TJm; Fri, 7 Aug 2020 17:32:54 +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 C80C41B72D; Fri, 7 Aug 2020 17:32:54 +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 077HWs94081454; Fri, 7 Aug 2020 17:32:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077HWsRr081452; Fri, 7 Aug 2020 17:32:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202008071732.077HWsRr081452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 7 Aug 2020 17:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364033 - in stable/12/sys/dev: acpica pci X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/dev: acpica pci X-SVN-Commit-Revision: 364033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 17:32:55 -0000 Author: mav Date: Fri Aug 7 17:32:53 2020 New Revision: 364033 URL: https://svnweb.freebsd.org/changeset/base/364033 Log: MFC r362661: Add mostly dummy hw.pci.enable_aspm tunable. The only thing this tunable enables now is reporting to ACPI _OSC that Active State Power Management and Clock Power Management Capability are "supported" by the OS. I've found that at least some Supermicro server boards do not allow OS to support native PCIe hot-plug unless it reports those capabilities. After spending significant time in PCIe specs I have found very little motivation for that, and none of it applies to those motherboards, not enabling ASPM themselves. So unless OS explicitly wants to save power, I see nothing for it to do there actually. I guess it may get sense to support ASPM when we get Thunderbolt support. Otherwise I have no system with PCIe hot-plug where power saving matters. It would be nice to enable this by default, but I worry that it affect power saving of some laptops, even though I haven't noticed that myself. Modified: stable/12/sys/dev/acpica/acpi_pcib_acpi.c stable/12/sys/dev/pci/pci.c stable/12/sys/dev/pci/pcivar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_pcib_acpi.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_pcib_acpi.c Fri Aug 7 17:25:56 2020 (r364032) +++ stable/12/sys/dev/acpica/acpi_pcib_acpi.c Fri Aug 7 17:32:53 2020 (r364033) @@ -326,6 +326,10 @@ acpi_pcib_osc(struct acpi_hpcib_softc *sc, uint32_t os /* Support Field: Extended PCI Config Space, PCI Segment Groups, MSI */ cap_set[PCI_OSC_SUPPORT] = PCIM_OSC_SUPPORT_EXT_PCI_CONF | PCIM_OSC_SUPPORT_SEG_GROUP | PCIM_OSC_SUPPORT_MSI; + /* Active State Power Management, Clock Power Management Capability */ + if (pci_enable_aspm) + cap_set[PCI_OSC_SUPPORT] |= PCIM_OSC_SUPPORT_ASPM | + PCIM_OSC_SUPPORT_CPMC; /* Control Field */ cap_set[PCI_OSC_CTL] = sc->ap_osc_ctl | osc_ctl; Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Fri Aug 7 17:25:56 2020 (r364032) +++ stable/12/sys/dev/pci/pci.c Fri Aug 7 17:32:53 2020 (r364033) @@ -411,6 +411,10 @@ static int pci_enable_ari = 1; SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, &pci_enable_ari, 0, "Enable support for PCIe Alternative RID Interpretation"); +int pci_enable_aspm; +SYSCTL_INT(_hw_pci, OID_AUTO, enable_aspm, CTLFLAG_RDTUN, &pci_enable_aspm, + 0, "Enable support for PCIe Active State Power Management"); + static int pci_clear_aer_on_attach = 0; SYSCTL_INT(_hw_pci, OID_AUTO, clear_aer_on_attach, CTLFLAG_RWTUN, &pci_clear_aer_on_attach, 0, Modified: stable/12/sys/dev/pci/pcivar.h ============================================================================== --- stable/12/sys/dev/pci/pcivar.h Fri Aug 7 17:25:56 2020 (r364032) +++ stable/12/sys/dev/pci/pcivar.h Fri Aug 7 17:32:53 2020 (r364033) @@ -258,6 +258,7 @@ typedef struct { } pcih2cfgregs; extern uint32_t pci_numdevs; +extern int pci_enable_aspm; struct pci_device_table { #if BYTE_ORDER == LITTLE_ENDIAN From owner-svn-src-stable@freebsd.org Fri Aug 7 23:31:46 2020 Return-Path: Delivered-To: svn-src-stable@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 A2353376FC5; Fri, 7 Aug 2020 23:31: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 4BNhTG3hpdz43m7; Fri, 7 Aug 2020 23:31: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 6246C1FA04; Fri, 7 Aug 2020 23:31: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 077NVkgS002197; Fri, 7 Aug 2020 23:31:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077NVknQ002196; Fri, 7 Aug 2020 23:31:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008072331.077NVknQ002196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Aug 2020 23:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364047 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 23:31:46 -0000 Author: mjg Date: Fri Aug 7 23:31:45 2020 New Revision: 364047 URL: https://svnweb.freebsd.org/changeset/base/364047 Log: MFC r363855,r363890,r363891 cache: add missing numcache detrement on insertion failure cache: convert ncnegnash into a macro cache: reduce zone alignment to 8 bytes Modified: stable/12/sys/kern/vfs_cache.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_cache.c ============================================================================== --- stable/12/sys/kern/vfs_cache.c Fri Aug 7 23:08:17 2020 (r364046) +++ stable/12/sys/kern/vfs_cache.c Fri Aug 7 23:31:45 2020 (r364047) @@ -102,9 +102,9 @@ SDT_PROBE_DEFINE2(vfs, namecache, shrink_negative, don */ struct namecache { - LIST_ENTRY(namecache) nc_hash; /* hash chain */ LIST_ENTRY(namecache) nc_src; /* source vnode list */ TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ + LIST_ENTRY(namecache) nc_hash; /* hash chain */ struct vnode *nc_dvp; /* vnode of parent of name */ union { struct vnode *nu_vp; /* vnode the name refers to */ @@ -121,6 +121,8 @@ struct namecache { * to be stored. The nc_dotdottime field is used when a cache entry is mapping * both a non-dotdot directory name plus dotdot for the directory's * parent. + * + * See below for alignment requirement. */ struct namecache_ts { struct timespec nc_time; /* timespec provided by fs */ @@ -129,6 +131,14 @@ struct namecache_ts { struct namecache nc_nc; }; +/* + * At least mips n32 performs 64-bit accesses to timespec as found + * in namecache_ts and requires them to be aligned. Since others + * may be in the same spot suffer a little bit and enforce the + * alignment for everyone. Note this is a nop for 64-bit platforms. + */ +#define CACHE_ZONE_ALIGNMENT UMA_ALIGNOF(time_t) + #define nc_vp n_un.nu_vp /* @@ -226,8 +236,8 @@ static struct neglist __read_mostly *neglists; static struct neglist ncneg_hot; static u_long numhotneg; -#define numneglists (ncneghash + 1) -static u_int __read_mostly ncneghash; +#define ncneghash 3 +#define numneglists (ncneghash + 1) static inline struct neglist * NCP2NEGLIST(struct namecache *ncp) { @@ -1853,6 +1863,7 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, return; out_unlock_free: cache_enter_unlock(&cel); + atomic_add_long(&numcache, -1); cache_free(ncp); return; } @@ -1878,19 +1889,19 @@ nchinit(void *dummy __unused) cache_zone_small = uma_zcreate("S VFS Cache", sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, - NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache), + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); cache_zone_small_ts = uma_zcreate("STS VFS Cache", sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, - NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts), + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); cache_zone_large = uma_zcreate("L VFS Cache", sizeof(struct namecache) + NAME_MAX + 1, - NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache), + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); cache_zone_large_ts = uma_zcreate("LTS VFS Cache", sizeof(struct namecache_ts) + NAME_MAX + 1, - NULL, NULL, NULL, NULL, UMA_ALIGNOF(struct namecache_ts), + NULL, NULL, NULL, NULL, CACHE_ZONE_ALIGNMENT, UMA_ZONE_ZINIT); ncsize = desiredvnodes * ncsizefactor; @@ -1911,7 +1922,6 @@ nchinit(void *dummy __unused) mtx_init(&vnodelocks[i], "ncvn", NULL, MTX_DUPOK | MTX_RECURSE); ncpurgeminvnodes = numbucketlocks * 2; - ncneghash = 3; neglists = malloc(sizeof(*neglists) * numneglists, M_VFSCACHE, M_WAITOK | M_ZERO); for (i = 0; i < numneglists; i++) { From owner-svn-src-stable@freebsd.org Fri Aug 7 23:32:43 2020 Return-Path: Delivered-To: svn-src-stable@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 5448F3772A9; Fri, 7 Aug 2020 23:32:43 +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 4BNhVM1Xchz4491; Fri, 7 Aug 2020 23:32:43 +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 181A41F85A; Fri, 7 Aug 2020 23:32:43 +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 077NWgHe003044; Fri, 7 Aug 2020 23:32:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 077NWg8U003043; Fri, 7 Aug 2020 23:32:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202008072332.077NWg8U003043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Fri, 7 Aug 2020 23:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364048 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 364048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Aug 2020 23:32:43 -0000 Author: mjg Date: Fri Aug 7 23:32:42 2020 New Revision: 364048 URL: https://svnweb.freebsd.org/changeset/base/364048 Log: MFC r363931: vfs hash: annotate the lock with __exclusive_cache_line Modified: stable/12/sys/kern/vfs_hash.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_hash.c ============================================================================== --- stable/12/sys/kern/vfs_hash.c Fri Aug 7 23:31:45 2020 (r364047) +++ stable/12/sys/kern/vfs_hash.c Fri Aug 7 23:32:42 2020 (r364048) @@ -43,7 +43,7 @@ static MALLOC_DEFINE(M_VFS_HASH, "vfs_hash", "VFS hash static LIST_HEAD(vfs_hash_head, vnode) *vfs_hash_tbl; static LIST_HEAD(,vnode) vfs_hash_side; static u_long vfs_hash_mask; -static struct rwlock vfs_hash_lock; +static struct rwlock __exclusive_cache_line vfs_hash_lock; static void vfs_hashinit(void *dummy __unused) From owner-svn-src-stable@freebsd.org Sat Aug 8 16:41:33 2020 Return-Path: Delivered-To: svn-src-stable@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 2CD2A37859A; Sat, 8 Aug 2020 16:41:33 +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 4BP7KT0Z1Kz47q0; Sat, 8 Aug 2020 16:41:33 +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 E9F0FB5FD; Sat, 8 Aug 2020 16:41:32 +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 078GfWa0047353; Sat, 8 Aug 2020 16:41:32 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 078GfSvr047332; Sat, 8 Aug 2020 16:41:28 GMT (envelope-from se@FreeBSD.org) Message-Id: <202008081641.078GfSvr047332@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: Sat, 8 Aug 2020 16:41:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r364052 - in stable/12: contrib/bc contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/manuals/bc contrib/bc/manuals/dc contrib/bc/src contrib/bc/src/bc contrib/bc/src/d... X-SVN-Group: stable-12 X-SVN-Commit-Author: se X-SVN-Commit-Paths: in stable/12: contrib/bc contrib/bc/include contrib/bc/locales contrib/bc/manuals contrib/bc/manuals/bc contrib/bc/manuals/dc contrib/bc/src contrib/bc/src/bc contrib/bc/src/dc contrib/bc/tests contri... X-SVN-Commit-Revision: 364052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Aug 2020 16:41:33 -0000 Author: se Date: Sat Aug 8 16:41:28 2020 New Revision: 364052 URL: https://svnweb.freebsd.org/changeset/base/364052 Log: MFC: 362681, 362697, 362914, 362984, 362986, 362987, 363091, 363172, 363809, 363810, 363811, 363915 Import new 2-clause BSD licenced implementation of the bc and dc commands These implementations of the bc and dc programs offer a number of advantages compared to the current implementations in the FreeBSD base system: - They do not depend on external large number functions (i.e. no dependency on OpenSSL or any other large-number library) - They implements all features found in GNU bc/dc (with the exception of the forking of sub-processes in dc, which the author of this version considers a security issue). - They are significantly faster than the current code in base (more than 2 orders of magnitude in some of my tests, e.g. for 12345^100000). - They should be fully compatible with all features and the behavior of the current implementations in FreeBSD (not formally verified). - They support POSIX message catalogs and come with localized messages in Chinese, Dutch, English, French, German, Japanese, Polish, Portuguese, and Russian. - They offer very detailed man-pages that provide far more information than the current ones. This code is not built and installed in FreeBSD-12, unless WITH_GH_BC=yes is set (e.g. in src.conf) during builworld and installworld. It has been imported and made the default in FreeBSD-CURRENT, and all improvements and changes requested for the version in -CURRENT are included in this initial import into a stable branch. Added: stable/12/contrib/bc/ - copied from r362987, head/contrib/bc/ stable/12/contrib/bc/tests/bc/misc6.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/misc6.txt stable/12/contrib/bc/tests/bc/misc6_results.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/misc6_results.txt stable/12/contrib/bc/tests/bc/misc7.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/misc7.txt stable/12/contrib/bc/tests/bc/misc7_results.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/misc7_results.txt stable/12/contrib/bc/tests/bc/stdin1.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/stdin1.txt stable/12/contrib/bc/tests/bc/stdin1_results.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/stdin1_results.txt stable/12/contrib/bc/tests/bc/stdin2.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/stdin2.txt stable/12/contrib/bc/tests/bc/stdin2_results.txt - copied unchanged from r363810, head/contrib/bc/tests/bc/stdin2_results.txt stable/12/usr.bin/gh-bc/ - copied from r362681, head/usr.bin/gh-bc/ stable/12/usr.bin/gh-bc/tests/ - copied from r363811, head/usr.bin/gh-bc/tests/ Modified: stable/12/contrib/bc/Makefile.in stable/12/contrib/bc/NEWS.md stable/12/contrib/bc/README.md stable/12/contrib/bc/configure.sh stable/12/contrib/bc/include/bc.h stable/12/contrib/bc/include/vm.h stable/12/contrib/bc/locale_install.sh stable/12/contrib/bc/locale_uninstall.sh stable/12/contrib/bc/locales/zh_CN.GB18030.msg stable/12/contrib/bc/locales/zh_CN.GB2312.msg stable/12/contrib/bc/locales/zh_CN.GBK.msg stable/12/contrib/bc/locales/zh_CN.UTF-8.msg stable/12/contrib/bc/locales/zh_CN.eucCN.msg stable/12/contrib/bc/manuals/bc.1.md.in stable/12/contrib/bc/manuals/bc/A.1 stable/12/contrib/bc/manuals/bc/A.1.md stable/12/contrib/bc/manuals/bc/E.1 stable/12/contrib/bc/manuals/bc/E.1.md stable/12/contrib/bc/manuals/bc/EH.1 stable/12/contrib/bc/manuals/bc/EH.1.md stable/12/contrib/bc/manuals/bc/EHN.1 stable/12/contrib/bc/manuals/bc/EHN.1.md stable/12/contrib/bc/manuals/bc/EHNP.1 stable/12/contrib/bc/manuals/bc/EHNP.1.md stable/12/contrib/bc/manuals/bc/EHP.1 stable/12/contrib/bc/manuals/bc/EHP.1.md stable/12/contrib/bc/manuals/bc/EN.1 stable/12/contrib/bc/manuals/bc/EN.1.md stable/12/contrib/bc/manuals/bc/ENP.1 stable/12/contrib/bc/manuals/bc/ENP.1.md stable/12/contrib/bc/manuals/bc/EP.1 stable/12/contrib/bc/manuals/bc/EP.1.md stable/12/contrib/bc/manuals/bc/H.1 stable/12/contrib/bc/manuals/bc/H.1.md stable/12/contrib/bc/manuals/bc/HN.1 stable/12/contrib/bc/manuals/bc/HN.1.md stable/12/contrib/bc/manuals/bc/HNP.1 stable/12/contrib/bc/manuals/bc/HNP.1.md stable/12/contrib/bc/manuals/bc/HP.1 stable/12/contrib/bc/manuals/bc/HP.1.md stable/12/contrib/bc/manuals/bc/N.1 stable/12/contrib/bc/manuals/bc/N.1.md stable/12/contrib/bc/manuals/bc/NP.1 stable/12/contrib/bc/manuals/bc/NP.1.md stable/12/contrib/bc/manuals/bc/P.1 stable/12/contrib/bc/manuals/bc/P.1.md stable/12/contrib/bc/manuals/build.md stable/12/contrib/bc/manuals/dc.1.md.in stable/12/contrib/bc/manuals/dc/A.1 stable/12/contrib/bc/manuals/dc/A.1.md stable/12/contrib/bc/manuals/dc/E.1 stable/12/contrib/bc/manuals/dc/E.1.md stable/12/contrib/bc/manuals/dc/EH.1 stable/12/contrib/bc/manuals/dc/EH.1.md stable/12/contrib/bc/manuals/dc/EHN.1 stable/12/contrib/bc/manuals/dc/EHN.1.md stable/12/contrib/bc/manuals/dc/EHNP.1 stable/12/contrib/bc/manuals/dc/EHNP.1.md stable/12/contrib/bc/manuals/dc/EHP.1 stable/12/contrib/bc/manuals/dc/EHP.1.md stable/12/contrib/bc/manuals/dc/EN.1 stable/12/contrib/bc/manuals/dc/EN.1.md stable/12/contrib/bc/manuals/dc/ENP.1 stable/12/contrib/bc/manuals/dc/ENP.1.md stable/12/contrib/bc/manuals/dc/EP.1 stable/12/contrib/bc/manuals/dc/EP.1.md stable/12/contrib/bc/manuals/dc/H.1 stable/12/contrib/bc/manuals/dc/H.1.md stable/12/contrib/bc/manuals/dc/HN.1 stable/12/contrib/bc/manuals/dc/HN.1.md stable/12/contrib/bc/manuals/dc/HNP.1 stable/12/contrib/bc/manuals/dc/HNP.1.md stable/12/contrib/bc/manuals/dc/HP.1 stable/12/contrib/bc/manuals/dc/HP.1.md stable/12/contrib/bc/manuals/dc/N.1 stable/12/contrib/bc/manuals/dc/N.1.md stable/12/contrib/bc/manuals/dc/NP.1 stable/12/contrib/bc/manuals/dc/NP.1.md stable/12/contrib/bc/manuals/dc/P.1 stable/12/contrib/bc/manuals/dc/P.1.md stable/12/contrib/bc/src/args.c stable/12/contrib/bc/src/bc/bc.c stable/12/contrib/bc/src/bc/parse.c stable/12/contrib/bc/src/dc/dc.c stable/12/contrib/bc/src/program.c stable/12/contrib/bc/src/vm.c stable/12/contrib/bc/tests/bc/all.txt stable/12/contrib/bc/tests/bc/stdin.txt stable/12/contrib/bc/tests/bc/stdin_results.txt stable/12/contrib/bc/tests/stdin.sh stable/12/etc/mtree/BSD.tests.dist stable/12/share/mk/src.opts.mk stable/12/usr.bin/Makefile stable/12/usr.bin/gh-bc/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/bc/Makefile.in ============================================================================== --- head/contrib/bc/Makefile.in Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/Makefile.in Sat Aug 8 16:41:28 2020 (r364052) @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.1.1 +VERSION = 3.1.5 SRC = %%SRC%% OBJ = %%OBJ%% @@ -335,7 +335,7 @@ clean_tests: clean clean_config clean_coverage @$(RM) -f bc.old install_locales: - $(LOCALE_INSTALL) $(NLSPATH) $(MAIN_EXEC) $(DESTDIR) + %%INSTALL_LOCALES%% install_bc_manpage: $(SAFE_INSTALL) $(MANPAGE_INSTALL_ARGS) $(BC_MANPAGE) $(DESTDIR)$(MAN1DIR)/$(BC_MANPAGE_NAME) Modified: stable/12/contrib/bc/NEWS.md ============================================================================== --- head/contrib/bc/NEWS.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/NEWS.md Sat Aug 8 16:41:28 2020 (r364052) @@ -1,5 +1,52 @@ # News +## 3.1.5 + +This is a production release that fixes the Chinese locales (which caused `bc` +to crash) and a crash caused by `bc` executing code when it should not have been +able to. + +***ALL USERS SHOULD UPGRADE.*** + +## 3.1.4 + +This is a production release that fixes one bug, changes two behaviors, and +removes one environment variable. + +The bug is like the one in the last release except it applies if files are being +executed. I also made the fix more general. + +The behavior that was changed is that `bc` now exits when given `-e`, `-f`, +`--expression` or `--file`. However, if the last one of those is `-f-` (using +`stdin` as the file), `bc` does not exit. If `-f-` exists and is not the last of +the `-e` and `-f` options (and equivalents), `bc` gives a fatal error and exits. + +Next, I removed the `BC_EXPR_EXIT` and `DC_EXPR_EXIT` environment variables +since their use is not needed with the behavior change. + +Finally, I made it so `bc` does not print the header, though the `-q` and +`--quiet` options were kept for compatibility with GNU `bc`. + +## 3.1.3 + +This is a production release that fixes one minor bug: if `bc` was invoked like +the following, it would error: + +``` +echo "if (1 < 3) 1" | bc +``` + +Unless users run into this bug, they do not need to upgrade, but it is suggested +that they do. + +## 3.1.2 + +This is a production release that adds a way to install *all* locales. Users do +***NOT*** need to upgrade. + +For package maintainers wishing to make use of the change, just pass `-l` to +`configure.sh`. + ## 3.1.1 This is a production release that adds two Spanish locales. Users do ***NOT*** Modified: stable/12/contrib/bc/README.md ============================================================================== --- head/contrib/bc/README.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/README.md Sat Aug 8 16:41:28 2020 (r364052) @@ -262,8 +262,8 @@ Other projects based on this bc are: toybox `bc` should be reported there. * [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better - to report bugs there, and the maintainers of the package will contact me if - necessary. + to [report bugs there][24], as well as [submit patches][25], and the + maintainers of the package will contact me if necessary. ## Language @@ -332,4 +332,6 @@ Folders: [20]: https://git.yzena.com/gavin/bc [21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ [22]: https://www.deepl.com/translator -[23]: https://github.com/freebsd/freebsd/tree/master/contrib/bc +[23]: https://svnweb.freebsd.org/base/head/contrib/bc/ +[24]: https://bugs.freebsd.org/ +[25]: https://reviews.freebsd.org/ Modified: stable/12/contrib/bc/configure.sh ============================================================================== --- head/contrib/bc/configure.sh Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/configure.sh Sat Aug 8 16:41:28 2020 (r364052) @@ -47,12 +47,12 @@ usage() { printf 'usage: %s -h\n' "$script" printf ' %s --help\n' "$script" - printf ' %s [-bD|-dB|-c] [-EfgGHMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" + printf ' %s [-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" printf ' %s \\\n' "$script" printf ' [--bc-only --disable-dc|--dc-only --disable-bc|--coverage] \\\n' printf ' [--debug --disable-extra-math --disable-generated-tests] \\\n' printf ' [--disable-history --disable-man-pages --disable-nls] \\\n' - printf ' [--disable-prompt --disable-strip] \\\n' + printf ' [--disable-prompt --disable-strip] [--install-all-locales] \\\n' printf ' [--opt=OPT_LEVEL] [--karatsuba-len=KARATSUBA_LEN] \\\n' printf ' [--prefix=PREFIX] [--bindir=BINDIR] [--datarootdir=DATAROOTDIR] \\\n' printf ' [--datadir=DATADIR] [--mandir=MANDIR] [--man1dir=MAN1DIR] \\\n' @@ -98,6 +98,10 @@ usage() { printf ' -k KARATSUBA_LEN, --karatsuba-len KARATSUBA_LEN\n' printf ' Set the karatsuba length to KARATSUBA_LEN (default is 64).\n' printf ' It is an error if KARATSUBA_LEN is not a number or is less than 16.\n' + printf ' -l, --install-all-locales\n' + printf ' Installs all locales, regardless of how many are on the system. This\n' + printf ' option is useful for package maintainers who want to make sure that\n' + printf ' a package contains all of the locales that end users might need.\n' printf ' -M, --disable-man-pages\n' printf ' Disable installing manpages.\n' printf ' -N, --disable-nls\n' @@ -319,8 +323,9 @@ nls=1 prompt=1 force=0 strip_bin=1 +all_locales=0 -while getopts "bBcdDEfgGhHk:MNO:PST-" opt; do +while getopts "bBcdDEfgGhHk:lMNO:PST-" opt; do case "$opt" in b) bc_only=1 ;; @@ -335,6 +340,7 @@ while getopts "bBcdDEfgGhHk:MNO:PST-" opt; do h) usage ;; H) hist=0 ;; k) karatsuba_len="$OPTARG" ;; + l) all_locales=1 ;; M) install_manpages=0 ;; N) nls=0 ;; O) optimization="$OPTARG" ;; @@ -423,6 +429,7 @@ while getopts "bBcdDEfgGhHk:MNO:PST-" opt; do disable-nls) nls=0 ;; disable-prompt) prompt=0 ;; disable-strip) strip_bin=0 ;; + install-all-locales) all_locales=1 ;; help* | bc-only* | dc-only* | coverage* | debug*) usage "No arg allowed for --$arg option" ;; disable-bc* | disable-dc* | disable-extra-math*) @@ -431,6 +438,8 @@ while getopts "bBcdDEfgGhHk:MNO:PST-" opt; do usage "No arg allowed for --$arg option" ;; disable-man-pages* | disable-nls* | disable-strip*) usage "No arg allowed for --$arg option" ;; + install-all-locales*) + usage "No arg allowed for --$arg option" ;; '') break ;; # "--" terminates argument processing * ) usage "Invalid option $LONG_OPTARG" ;; esac @@ -751,8 +760,15 @@ if [ "$nls" -ne 0 ]; then else install_locales_prereqs="" uninstall_locales_prereqs="" + all_locales=0 fi +if [ "$nls" -ne 0 ] && [ "$all_locales" -ne 0 ]; then + install_locales="\$(LOCALE_INSTALL) -l \$(NLSPATH) \$(MAIN_EXEC) \$(DESTDIR)" +else + install_locales="\$(LOCALE_INSTALL) \$(NLSPATH) \$(MAIN_EXEC) \$(DESTDIR)" +fi + if [ "$hist" -eq 1 ]; then set +e @@ -911,6 +927,7 @@ contents=$(replace "$contents" "HOSTCC" "$HOSTCC") contents=$(replace "$contents" "COVERAGE_OUTPUT" "$COVERAGE_OUTPUT") contents=$(replace "$contents" "COVERAGE_PREREQS" "$COVERAGE_PREREQS") contents=$(replace "$contents" "INSTALL_PREREQS" "$install_prereqs") +contents=$(replace "$contents" "INSTALL_LOCALES" "$install_locales") contents=$(replace "$contents" "INSTALL_LOCALES_PREREQS" "$install_locales_prereqs") contents=$(replace "$contents" "UNINSTALL_MAN_PREREQS" "$uninstall_man_prereqs") contents=$(replace "$contents" "UNINSTALL_PREREQS" "$uninstall_prereqs") Modified: stable/12/contrib/bc/include/bc.h ============================================================================== --- head/contrib/bc/include/bc.h Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/include/bc.h Sat Aug 8 16:41:28 2020 (r364052) @@ -159,9 +159,6 @@ void bc_parse_expr(BcParse *p, uint8_t flags); void bc_parse_parse(BcParse *p); void bc_parse_expr_status(BcParse *p, uint8_t flags, BcParseNext next); -// This is necessary to clear up for if statements at the end of files. -void bc_parse_noElse(BcParse *p); - extern const char bc_sig_msg[]; extern const uchar bc_sig_msg_len; Modified: stable/12/contrib/bc/include/vm.h ============================================================================== --- head/contrib/bc/include/vm.h Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/include/vm.h Sat Aug 8 16:41:28 2020 (r364052) @@ -102,20 +102,19 @@ #define BC_FLAG_G (UINTMAX_C(1)<<4) #endif // BC_ENABLED -#define BC_FLAG_Q (UINTMAX_C(1)<<5) -#define BC_FLAG_I (UINTMAX_C(1)<<6) -#define BC_FLAG_P (UINTMAX_C(1)<<7) -#define BC_FLAG_TTYIN (UINTMAX_C(1)<<8) -#define BC_FLAG_TTY (UINTMAX_C(1)<<9) +#define BC_FLAG_I (UINTMAX_C(1)<<5) +#define BC_FLAG_P (UINTMAX_C(1)<<6) +#define BC_FLAG_TTYIN (UINTMAX_C(1)<<7) +#define BC_FLAG_TTY (UINTMAX_C(1)<<8) #define BC_TTYIN (vm.flags & BC_FLAG_TTYIN) #define BC_TTY (vm.flags & BC_FLAG_TTY) #if BC_ENABLED -#define BC_S (BC_ENABLED && (vm.flags & BC_FLAG_S)) -#define BC_W (BC_ENABLED && (vm.flags & BC_FLAG_W)) -#define BC_L (BC_ENABLED && (vm.flags & BC_FLAG_L)) -#define BC_G (BC_ENABLED && (vm.flags & BC_FLAG_G)) +#define BC_S (vm.flags & BC_FLAG_S) +#define BC_W (vm.flags & BC_FLAG_W) +#define BC_L (vm.flags & BC_FLAG_L) +#define BC_G (vm.flags & BC_FLAG_G) #endif // BC_ENABLED @@ -279,12 +278,6 @@ #define BC_VM_INVALID_CATALOG ((nl_catd) -1) -// dc does not use is_stdin. -#if !BC_ENABLED -#define bc_vm_process(text, is_stdin) bc_vm_process(text) -#else // BC_ENABLED -#endif // BC_ENABLED - typedef struct BcVm { volatile sig_atomic_t status; @@ -310,6 +303,7 @@ typedef struct BcVm { uint16_t nchars; uint16_t line_len; + bool no_exit_exprs; bool eof; BcBigDig maxes[BC_PROG_GLOBALS_LEN + BC_ENABLE_EXTRA_MATH]; @@ -360,7 +354,7 @@ typedef struct BcVm { void bc_vm_info(const char* const help); void bc_vm_boot(int argc, char *argv[], const char *env_len, - const char* const env_args, const char* env_exp_quit); + const char* const env_args); void bc_vm_shutdown(void); void bc_vm_printf(const char *fmt, ...); Modified: stable/12/contrib/bc/locale_install.sh ============================================================================== --- head/contrib/bc/locale_install.sh Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/locale_install.sh Sat Aug 8 16:41:28 2020 (r364052) @@ -28,6 +28,9 @@ # usage() { + if [ $# -eq 1 ]; then + printf '%s\n' "$1" + fi printf "usage: %s NLSPATH main_exec [DESTDIR]\n" "$0" 1>&2 exit 1 } @@ -150,6 +153,17 @@ scriptdir=$(dirname "$script") . "$scriptdir/functions.sh" +all_locales=0 + +while getopts "l" opt; do + + case "$opt" in + l) all_locales=1 ; shift ;; + ?) usage "Invalid option $opt" ;; + esac + +done + test "$#" -ge 2 || usage nlspath="$1" @@ -180,19 +194,23 @@ fi for file in $locales_dir/*.msg; do locale=$(basename "$file" ".msg") - loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec") - localeexists "$locales" "$locale" "$destdir" - err="$?" + if [ "$all_locales" -eq 0 ]; then - if [ "$err" -eq 0 ]; then - continue + localeexists "$locales" "$locale" "$destdir" + err="$?" + + if [ "$err" -eq 0 ]; then + continue + fi fi if [ -L "$file" ]; then continue fi + loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec") + gencatfile "$loc" "$file" done @@ -200,14 +218,18 @@ done for file in $locales_dir/*.msg; do locale=$(basename "$file" ".msg") - loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec") - localeexists "$locales" "$locale" "$destdir" - err="$?" + if [ "$all_locales" -eq 0 ]; then - if [ "$err" -eq 0 ]; then - continue + localeexists "$locales" "$locale" "$destdir" + err="$?" + + if [ "$err" -eq 0 ]; then + continue + fi fi + + loc=$(gen_nlspath "$destdir/$nlspath" "$locale" "$main_exec") mkdir -p $(dirname "$loc") Modified: stable/12/contrib/bc/locale_uninstall.sh ============================================================================== --- head/contrib/bc/locale_uninstall.sh Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/locale_uninstall.sh Sat Aug 8 16:41:28 2020 (r364052) @@ -59,6 +59,7 @@ fi # This way, we can delete catalogs for locales that we had to install # because they are symlinks. locales=$(gen_nlspath "$destdir/$nlspath" "*" "$main_exec") +locales=$(ls $locales 2> /dev/null) for l in $locales; do rm -f "$l" Modified: stable/12/contrib/bc/locales/zh_CN.GB18030.msg ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/contrib/bc/locales/zh_CN.GB2312.msg ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/contrib/bc/locales/zh_CN.GBK.msg ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/contrib/bc/locales/zh_CN.UTF-8.msg ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/contrib/bc/locales/zh_CN.eucCN.msg ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/12/contrib/bc/manuals/bc.1.md.in ============================================================================== --- head/contrib/bc/manuals/bc.1.md.in Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc.1.md.in Sat Aug 8 16:41:28 2020 (r364052) @@ -195,11 +195,11 @@ The following are the options that bc(1) accepts. **-q**, **--quiet** -: Do not print copyright header. bc(1) will also suppress the header in - non-interactive mode. +: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. + Without this option, GNU bc(1) prints a copyright header. This bc(1) only + prints the copyright header if one or more of the **-v**, **-V**, or + **--version** options are given. - This is mostly for compatibility with the [GNU bc(1)][2]. - This is a **non-portable extension**. **-s**, **--standard** @@ -229,9 +229,10 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - In other bc(1) implementations, this option causes the program to execute - the expressions and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. + However, if any other **-e**, **--expression**, **-f**, or **--file** + arguments are given after that, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -241,9 +242,8 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - In other bc(1) implementations, this option causes the program to execute - the files and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. This is a **non-portable extension**. @@ -1614,12 +1614,6 @@ bc(1) recognizes the following environment variables: than **1** and is less than **UINT16_MAX** (**2\^16-1**), bc(1) will output lines to that length, including the backslash (**\\**). The default line length is **70**. - -**BC_EXPR_EXIT** - -: If this variable exists (no matter the contents), bc(1) will exit - immediately after executing expressions and files given by the **-e** and/or - **-f** command-line options (and any equivalents). # EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/A.1 ============================================================================== --- head/contrib/bc/manuals/bc/A.1 Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/A.1 Sat Aug 8 16:41:28 2020 (r364052) @@ -187,13 +187,13 @@ This is a \f[B]non\-portable extension\f[]. .RE .TP .B \f[B]\-q\f[], \f[B]\-\-quiet\f[] -Do not print copyright header. -bc(1) will also suppress the header in non\-interactive mode. +This option is for compatibility with the GNU +bc(1) (https://www.gnu.org/software/bc/); it is a no\-op. +Without this option, GNU bc(1) prints a copyright header. +This bc(1) only prints the copyright header if one or more of the +\f[B]\-v\f[], \f[B]\-V\f[], or \f[B]\-\-version\f[] options are given. .RS .PP -This is mostly for compatibility with the GNU -bc(1) (https://www.gnu.org/software/bc/). -.PP This is a \f[B]non\-portable extension\f[]. .RE .TP @@ -231,10 +231,12 @@ This means that if a file is given before an expressio read in and evaluated first. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the expressions and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. +However, if any other \f[B]\-e\f[], \f[B]\-\-expression\f[], +\f[B]\-f\f[], or \f[B]\-\-file\f[] arguments are given after that, bc(1) +will give a fatal error and exit. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -246,10 +248,9 @@ If expressions are also given (see above), the express in the order given. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the files and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -1913,14 +1914,6 @@ greater than \f[B]1\f[] and is less than \f[B]UINT16_M (\f[B]2^16\-1\f[]), bc(1) will output lines to that length, including the backslash (\f[B]\\\f[]). The default line length is \f[B]70\f[]. -.RS -.RE -.TP -.B \f[B]BC_EXPR_EXIT\f[] -If this variable exists (no matter the contents), bc(1) will exit -immediately after executing expressions and files given by the -\f[B]\-e\f[] and/or \f[B]\-f\f[] command\-line options (and any -equivalents). .RS .RE .SH EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/A.1.md ============================================================================== --- head/contrib/bc/manuals/bc/A.1.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/A.1.md Sat Aug 8 16:41:28 2020 (r364052) @@ -153,11 +153,11 @@ The following are the options that bc(1) accepts. **-q**, **--quiet** -: Do not print copyright header. bc(1) will also suppress the header in - non-interactive mode. +: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. + Without this option, GNU bc(1) prints a copyright header. This bc(1) only + prints the copyright header if one or more of the **-v**, **-V**, or + **--version** options are given. - This is mostly for compatibility with the [GNU bc(1)][2]. - This is a **non-portable extension**. **-s**, **--standard** @@ -187,9 +187,10 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - In other bc(1) implementations, this option causes the program to execute - the expressions and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. + However, if any other **-e**, **--expression**, **-f**, or **--file** + arguments are given after that, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -199,9 +200,8 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - In other bc(1) implementations, this option causes the program to execute - the files and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. This is a **non-portable extension**. @@ -1523,12 +1523,6 @@ bc(1) recognizes the following environment variables: than **1** and is less than **UINT16_MAX** (**2\^16-1**), bc(1) will output lines to that length, including the backslash (**\\**). The default line length is **70**. - -**BC_EXPR_EXIT** - -: If this variable exists (no matter the contents), bc(1) will exit - immediately after executing expressions and files given by the **-e** and/or - **-f** command-line options (and any equivalents). # EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/E.1 ============================================================================== --- head/contrib/bc/manuals/bc/E.1 Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/E.1 Sat Aug 8 16:41:28 2020 (r364052) @@ -148,13 +148,13 @@ This is a \f[B]non\-portable extension\f[]. .RE .TP .B \f[B]\-q\f[], \f[B]\-\-quiet\f[] -Do not print copyright header. -bc(1) will also suppress the header in non\-interactive mode. +This option is for compatibility with the GNU +bc(1) (https://www.gnu.org/software/bc/); it is a no\-op. +Without this option, GNU bc(1) prints a copyright header. +This bc(1) only prints the copyright header if one or more of the +\f[B]\-v\f[], \f[B]\-V\f[], or \f[B]\-\-version\f[] options are given. .RS .PP -This is mostly for compatibility with the GNU -bc(1) (https://www.gnu.org/software/bc/). -.PP This is a \f[B]non\-portable extension\f[]. .RE .TP @@ -192,10 +192,12 @@ This means that if a file is given before an expressio read in and evaluated first. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the expressions and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. +However, if any other \f[B]\-e\f[], \f[B]\-\-expression\f[], +\f[B]\-f\f[], or \f[B]\-\-file\f[] arguments are given after that, bc(1) +will give a fatal error and exit. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -207,10 +209,9 @@ If expressions are also given (see above), the express in the order given. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the files and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -1159,14 +1160,6 @@ greater than \f[B]1\f[] and is less than \f[B]UINT16_M (\f[B]2^16\-1\f[]), bc(1) will output lines to that length, including the backslash (\f[B]\\\f[]). The default line length is \f[B]70\f[]. -.RS -.RE -.TP -.B \f[B]BC_EXPR_EXIT\f[] -If this variable exists (no matter the contents), bc(1) will exit -immediately after executing expressions and files given by the -\f[B]\-e\f[] and/or \f[B]\-f\f[] command\-line options (and any -equivalents). .RS .RE .SH EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/E.1.md ============================================================================== --- head/contrib/bc/manuals/bc/E.1.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/E.1.md Sat Aug 8 16:41:28 2020 (r364052) @@ -137,11 +137,11 @@ The following are the options that bc(1) accepts. **-q**, **--quiet** -: Do not print copyright header. bc(1) will also suppress the header in - non-interactive mode. +: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. + Without this option, GNU bc(1) prints a copyright header. This bc(1) only + prints the copyright header if one or more of the **-v**, **-V**, or + **--version** options are given. - This is mostly for compatibility with the [GNU bc(1)][2]. - This is a **non-portable extension**. **-s**, **--standard** @@ -171,9 +171,10 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - In other bc(1) implementations, this option causes the program to execute - the expressions and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. + However, if any other **-e**, **--expression**, **-f**, or **--file** + arguments are given after that, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -183,9 +184,8 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - In other bc(1) implementations, this option causes the program to execute - the files and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. This is a **non-portable extension**. @@ -919,12 +919,6 @@ bc(1) recognizes the following environment variables: than **1** and is less than **UINT16_MAX** (**2\^16-1**), bc(1) will output lines to that length, including the backslash (**\\**). The default line length is **70**. - -**BC_EXPR_EXIT** - -: If this variable exists (no matter the contents), bc(1) will exit - immediately after executing expressions and files given by the **-e** and/or - **-f** command-line options (and any equivalents). # EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/EH.1 ============================================================================== --- head/contrib/bc/manuals/bc/EH.1 Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/EH.1 Sat Aug 8 16:41:28 2020 (r364052) @@ -145,13 +145,13 @@ This is a \f[B]non\-portable extension\f[]. .RE .TP .B \f[B]\-q\f[], \f[B]\-\-quiet\f[] -Do not print copyright header. -bc(1) will also suppress the header in non\-interactive mode. +This option is for compatibility with the GNU +bc(1) (https://www.gnu.org/software/bc/); it is a no\-op. +Without this option, GNU bc(1) prints a copyright header. +This bc(1) only prints the copyright header if one or more of the +\f[B]\-v\f[], \f[B]\-V\f[], or \f[B]\-\-version\f[] options are given. .RS .PP -This is mostly for compatibility with the GNU -bc(1) (https://www.gnu.org/software/bc/). -.PP This is a \f[B]non\-portable extension\f[]. .RE .TP @@ -189,10 +189,12 @@ This means that if a file is given before an expressio read in and evaluated first. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the expressions and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. +However, if any other \f[B]\-e\f[], \f[B]\-\-expression\f[], +\f[B]\-f\f[], or \f[B]\-\-file\f[] arguments are given after that, bc(1) +will give a fatal error and exit. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -204,10 +206,9 @@ If expressions are also given (see above), the express in the order given. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the files and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -1156,14 +1157,6 @@ greater than \f[B]1\f[] and is less than \f[B]UINT16_M (\f[B]2^16\-1\f[]), bc(1) will output lines to that length, including the backslash (\f[B]\\\f[]). The default line length is \f[B]70\f[]. -.RS -.RE -.TP -.B \f[B]BC_EXPR_EXIT\f[] -If this variable exists (no matter the contents), bc(1) will exit -immediately after executing expressions and files given by the -\f[B]\-e\f[] and/or \f[B]\-f\f[] command\-line options (and any -equivalents). .RS .RE .SH EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/EH.1.md ============================================================================== --- head/contrib/bc/manuals/bc/EH.1.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/EH.1.md Sat Aug 8 16:41:28 2020 (r364052) @@ -134,11 +134,11 @@ The following are the options that bc(1) accepts. **-q**, **--quiet** -: Do not print copyright header. bc(1) will also suppress the header in - non-interactive mode. +: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. + Without this option, GNU bc(1) prints a copyright header. This bc(1) only + prints the copyright header if one or more of the **-v**, **-V**, or + **--version** options are given. - This is mostly for compatibility with the [GNU bc(1)][2]. - This is a **non-portable extension**. **-s**, **--standard** @@ -168,9 +168,10 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - In other bc(1) implementations, this option causes the program to execute - the expressions and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. + However, if any other **-e**, **--expression**, **-f**, or **--file** + arguments are given after that, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -180,9 +181,8 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - In other bc(1) implementations, this option causes the program to execute - the files and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. This is a **non-portable extension**. @@ -916,12 +916,6 @@ bc(1) recognizes the following environment variables: than **1** and is less than **UINT16_MAX** (**2\^16-1**), bc(1) will output lines to that length, including the backslash (**\\**). The default line length is **70**. - -**BC_EXPR_EXIT** - -: If this variable exists (no matter the contents), bc(1) will exit - immediately after executing expressions and files given by the **-e** and/or - **-f** command-line options (and any equivalents). # EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/EHN.1 ============================================================================== --- head/contrib/bc/manuals/bc/EHN.1 Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/EHN.1 Sat Aug 8 16:41:28 2020 (r364052) @@ -145,13 +145,13 @@ This is a \f[B]non\-portable extension\f[]. .RE .TP .B \f[B]\-q\f[], \f[B]\-\-quiet\f[] -Do not print copyright header. -bc(1) will also suppress the header in non\-interactive mode. +This option is for compatibility with the GNU +bc(1) (https://www.gnu.org/software/bc/); it is a no\-op. +Without this option, GNU bc(1) prints a copyright header. +This bc(1) only prints the copyright header if one or more of the +\f[B]\-v\f[], \f[B]\-V\f[], or \f[B]\-\-version\f[] options are given. .RS .PP -This is mostly for compatibility with the GNU -bc(1) (https://www.gnu.org/software/bc/). -.PP This is a \f[B]non\-portable extension\f[]. .RE .TP @@ -189,10 +189,12 @@ This means that if a file is given before an expressio read in and evaluated first. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the expressions and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. +However, if any other \f[B]\-e\f[], \f[B]\-\-expression\f[], +\f[B]\-f\f[], or \f[B]\-\-file\f[] arguments are given after that, bc(1) +will give a fatal error and exit. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -204,10 +206,9 @@ If expressions are also given (see above), the express in the order given. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the files and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -1156,14 +1157,6 @@ greater than \f[B]1\f[] and is less than \f[B]UINT16_M (\f[B]2^16\-1\f[]), bc(1) will output lines to that length, including the backslash (\f[B]\\\f[]). The default line length is \f[B]70\f[]. -.RS -.RE -.TP -.B \f[B]BC_EXPR_EXIT\f[] -If this variable exists (no matter the contents), bc(1) will exit -immediately after executing expressions and files given by the -\f[B]\-e\f[] and/or \f[B]\-f\f[] command\-line options (and any -equivalents). .RS .RE .SH EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/EHN.1.md ============================================================================== --- head/contrib/bc/manuals/bc/EHN.1.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/EHN.1.md Sat Aug 8 16:41:28 2020 (r364052) @@ -134,11 +134,11 @@ The following are the options that bc(1) accepts. **-q**, **--quiet** -: Do not print copyright header. bc(1) will also suppress the header in - non-interactive mode. +: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. + Without this option, GNU bc(1) prints a copyright header. This bc(1) only + prints the copyright header if one or more of the **-v**, **-V**, or + **--version** options are given. - This is mostly for compatibility with the [GNU bc(1)][2]. - This is a **non-portable extension**. **-s**, **--standard** @@ -168,9 +168,10 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - In other bc(1) implementations, this option causes the program to execute - the expressions and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. + However, if any other **-e**, **--expression**, **-f**, or **--file** + arguments are given after that, bc(1) will give a fatal error and exit. This is a **non-portable extension**. @@ -180,9 +181,8 @@ The following are the options that bc(1) accepts. through **stdin**. If expressions are also given (see above), the expressions are evaluated in the order given. - In other bc(1) implementations, this option causes the program to execute - the files and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. This is a **non-portable extension**. @@ -916,12 +916,6 @@ bc(1) recognizes the following environment variables: than **1** and is less than **UINT16_MAX** (**2\^16-1**), bc(1) will output lines to that length, including the backslash (**\\**). The default line length is **70**. - -**BC_EXPR_EXIT** - -: If this variable exists (no matter the contents), bc(1) will exit - immediately after executing expressions and files given by the **-e** and/or - **-f** command-line options (and any equivalents). # EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/EHNP.1 ============================================================================== --- head/contrib/bc/manuals/bc/EHNP.1 Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/EHNP.1 Sat Aug 8 16:41:28 2020 (r364052) @@ -140,13 +140,13 @@ This is a \f[B]non\-portable extension\f[]. .RE .TP .B \f[B]\-q\f[], \f[B]\-\-quiet\f[] -Do not print copyright header. -bc(1) will also suppress the header in non\-interactive mode. +This option is for compatibility with the GNU +bc(1) (https://www.gnu.org/software/bc/); it is a no\-op. +Without this option, GNU bc(1) prints a copyright header. +This bc(1) only prints the copyright header if one or more of the +\f[B]\-v\f[], \f[B]\-V\f[], or \f[B]\-\-version\f[] options are given. .RS .PP -This is mostly for compatibility with the GNU -bc(1) (https://www.gnu.org/software/bc/). -.PP This is a \f[B]non\-portable extension\f[]. .RE .TP @@ -184,10 +184,12 @@ This means that if a file is given before an expressio read in and evaluated first. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the expressions and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. +However, if any other \f[B]\-e\f[], \f[B]\-\-expression\f[], +\f[B]\-f\f[], or \f[B]\-\-file\f[] arguments are given after that, bc(1) +will give a fatal error and exit. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -199,10 +201,9 @@ If expressions are also given (see above), the express in the order given. .RS .PP -In other bc(1) implementations, this option causes the program to -execute the files and then exit. -This bc(1) does not, unless the \f[B]BC_EXPR_EXIT\f[] is defined (see -the \f[B]ENVIRONMENT VARIABLES\f[] section). +After processing all expressions and files, bc(1) will exit, unless +\f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to +\f[B]\-f\f[] or \f[B]\-\-file\f[]. .PP This is a \f[B]non\-portable extension\f[]. .RE @@ -1151,14 +1152,6 @@ greater than \f[B]1\f[] and is less than \f[B]UINT16_M (\f[B]2^16\-1\f[]), bc(1) will output lines to that length, including the backslash (\f[B]\\\f[]). The default line length is \f[B]70\f[]. -.RS -.RE -.TP -.B \f[B]BC_EXPR_EXIT\f[] -If this variable exists (no matter the contents), bc(1) will exit -immediately after executing expressions and files given by the -\f[B]\-e\f[] and/or \f[B]\-f\f[] command\-line options (and any -equivalents). .RS .RE .SH EXIT STATUS Modified: stable/12/contrib/bc/manuals/bc/EHNP.1.md ============================================================================== --- head/contrib/bc/manuals/bc/EHNP.1.md Tue Jul 7 07:51:09 2020 (r362987) +++ stable/12/contrib/bc/manuals/bc/EHNP.1.md Sat Aug 8 16:41:28 2020 (r364052) @@ -130,11 +130,11 @@ The following are the options that bc(1) accepts. **-q**, **--quiet** -: Do not print copyright header. bc(1) will also suppress the header in - non-interactive mode. +: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op. + Without this option, GNU bc(1) prints a copyright header. This bc(1) only + prints the copyright header if one or more of the **-v**, **-V**, or + **--version** options are given. - This is mostly for compatibility with the [GNU bc(1)][2]. - This is a **non-portable extension**. **-s**, **--standard** @@ -164,9 +164,10 @@ The following are the options that bc(1) accepts. evaluated in the order given. This means that if a file is given before an expression, the file is read in and evaluated first. - In other bc(1) implementations, this option causes the program to execute - the expressions and then exit. This bc(1) does not, unless the - **BC_EXPR_EXIT** is defined (see the **ENVIRONMENT VARIABLES** section). + After processing all expressions and files, bc(1) will exit, unless **-** + (**stdin**) was given as an argument at least once to **-f** or **--file**. + However, if any other **-e**, **--expression**, **-f**, or **--file** + arguments are given after that, bc(1) will give a fatal error and exit. *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***