From owner-svn-src-all@freebsd.org Sun Dec 1 00:22:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2AE11BDADE; Sun, 1 Dec 2019 00:22:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QTTC5XZsz3DwW; Sun, 1 Dec 2019 00:22:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A12956666; Sun, 1 Dec 2019 00:22:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB10M7Zp001092; Sun, 1 Dec 2019 00:22:07 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB10M4qa001075; Sun, 1 Dec 2019 00:22:04 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912010022.xB10M4qa001075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 1 Dec 2019 00:22:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355254 - in head/sys: netinet netinet6 netipsec X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 netipsec X-SVN-Commit-Revision: 355254 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 00:22:07 -0000 Author: bz Date: Sun Dec 1 00:22:04 2019 New Revision: 355254 URL: https://svnweb.freebsd.org/changeset/base/355254 Log: Fix m_pullup() problem after removing PULLDOWN_TESTs and KAME EXT_*macros. r354748-354750 replaced the KAME macros with m_pulldown() calls. Contrary to the rest of the network stack m_len checks before m_pulldown() were not put in placed (see r354748). Put these m_len checks in place for now (to go along with the style of the network stack since the initial commits). These are not put in for performance but to avoid an error scenario (even though it also will help performance at the moment as it avoid allocating an extra mbuf; not because of the unconditional function call). The observed error case went like this: (1) an mbuf with M_EXT arrives and we call m_pullup() unconditionally on it. (2) m_pullup() will call m_get() unless the requested length is larger than MHLEN (in which case it'll m_freem() the perfectly fine mbuf) and migrate the requested length of data and pkthdr into the new mbuf. (3) If m_get() succeeds, a further m_pullup() call going over MHLEN will fail. This was observed with failing auto-configuration as an RA packet of 200 bytes exceeded MHLEN and the m_pullup() called from nd6_ra_input() dropped the mbuf. (Re-)adding the m_len checks before m_pullup() calls avoids this problems with mbufs using external storage for now. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet/ip_carp.c head/sys/netinet/tcp_input.c head/sys/netinet6/dest6.c head/sys/netinet6/frag6.c head/sys/netinet6/icmp6.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_mroute.c head/sys/netinet6/mld6.c head/sys/netinet6/nd6_nbr.c head/sys/netinet6/nd6_rtr.c head/sys/netinet6/route6.c head/sys/netinet6/sctp6_usrreq.c head/sys/netinet6/udp6_usrreq.c head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet/ip_carp.c Sun Dec 1 00:22:04 2019 (r355254) @@ -566,12 +566,14 @@ carp6_input(struct mbuf **mp, int *offp, int proto) } /* verify that we have a complete carp packet */ - len = m->m_len; - m = m_pullup(m, *offp + sizeof(*ch)); - if (m == NULL) { - CARPSTATS_INC(carps_badlen); - CARP_DEBUG("%s: packet size %u too small\n", __func__, len); - return (IPPROTO_DONE); + if (m->m_len < *offp + sizeof(*ch)) { + len = m->m_len; + m = m_pullup(m, *offp + sizeof(*ch)); + if (m == NULL) { + CARPSTATS_INC(carps_badlen); + CARP_DEBUG("%s: packet size %u too small\n", __func__, len); + return (IPPROTO_DONE); + } } ch = (struct carp_header *)(mtod(m, caddr_t) + *offp); Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet/tcp_input.c Sun Dec 1 00:22:04 2019 (r355254) @@ -517,11 +517,13 @@ tcp6_input(struct mbuf **mp, int *offp, int proto) struct ip6_hdr *ip6; m = *mp; - m = m_pullup(m, *offp + sizeof(struct tcphdr)); - if (m == NULL) { - *mp = m; - TCPSTAT_INC(tcps_rcvshort); - return (IPPROTO_DONE); + if (m->m_len < *offp + sizeof(struct tcphdr)) { + m = m_pullup(m, *offp + sizeof(struct tcphdr)); + if (m == NULL) { + *mp = m; + TCPSTAT_INC(tcps_rcvshort); + return (IPPROTO_DONE); + } } /* @@ -708,10 +710,12 @@ tcp_input(struct mbuf **mp, int *offp, int proto) if (off > sizeof (struct tcphdr)) { #ifdef INET6 if (isipv6) { - m = m_pullup(m, off0 + off); - if (m == NULL) { - TCPSTAT_INC(tcps_rcvshort); - return (IPPROTO_DONE); + if (m->m_len < off0 + off) { + m = m_pullup(m, off0 + off); + if (m == NULL) { + TCPSTAT_INC(tcps_rcvshort); + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); th = (struct tcphdr *)((caddr_t)ip6 + off0); Modified: head/sys/netinet6/dest6.c ============================================================================== --- head/sys/netinet6/dest6.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/dest6.c Sun Dec 1 00:22:04 2019 (r355254) @@ -73,20 +73,24 @@ dest6_input(struct mbuf **mp, int *offp, int proto) off = *offp; /* Validation of the length of the header. */ - m = m_pullup(m, off + sizeof(*dstopts)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(*dstopts)) { + m = m_pullup(m, off + sizeof(*dstopts)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } } dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); dstoptlen = (dstopts->ip6d_len + 1) << 3; - m = m_pullup(m, off + dstoptlen); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (IPPROTO_DONE); + if (m->m_len < off + dstoptlen) { + m = m_pullup(m, off + dstoptlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } } dstopts = (struct ip6_dest *)(mtod(m, caddr_t) + off); off += dstoptlen; Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/frag6.c Sun Dec 1 00:22:04 2019 (r355254) @@ -389,11 +389,13 @@ frag6_input(struct mbuf **mp, int *offp, int proto) M_ASSERTPKTHDR(m); - m = m_pullup(m, offset + sizeof(struct ip6_frag)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (IPPROTO_DONE); + if (m->m_len < offset + sizeof(struct ip6_frag)) { + m = m_pullup(m, offset + sizeof(struct ip6_frag)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/icmp6.c Sun Dec 1 00:22:04 2019 (r355254) @@ -317,10 +317,12 @@ icmp6_error(struct mbuf *m, int type, int code, int pa if (off >= 0 && nxt == IPPROTO_ICMPV6) { struct icmp6_hdr *icp; - m = m_pullup(m, off + sizeof(struct icmp6_hdr)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return; + if (m->m_len < off + sizeof(struct icmp6_hdr)) { + m = m_pullup(m, off + sizeof(struct icmp6_hdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return; + } } oip6 = mtod(m, struct ip6_hdr *); icp = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); @@ -401,11 +403,13 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) m = *mp; off = *offp; - m = m_pullup(m, off + sizeof(struct icmp6_hdr)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(struct icmp6_hdr)) { + m = m_pullup(m, off + sizeof(struct icmp6_hdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } } /* @@ -566,10 +570,12 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n->m_pkthdr.len = n0len + (noff - off); n->m_next = n0; } else { - n = m_pullup(n, off + sizeof(*nicmp6)); - if (n == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - break; + if (n->m_len < off + sizeof(*nicmp6)) { + n = m_pullup(n, off + sizeof(*nicmp6)); + if (n == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + break; + } } nicmp6 = (struct icmp6_hdr *)(mtod(n, caddr_t) + off); noff = off; @@ -635,11 +641,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) if (pr == NULL) pr = curthread->td_ucred->cr_prison; if (mode == FQDN) { - m = m_pullup(m, off + sizeof(struct icmp6_nodeinfo)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(struct icmp6_nodeinfo)) { + m = m_pullup(m, off + + sizeof(struct icmp6_nodeinfo)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (IPPROTO_DONE); + } } n = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (n) @@ -725,11 +734,13 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) if (icmp6len < sizeof(struct nd_router_solicit)) goto badlen; if (send_sendso_input_hook != NULL) { - m = m_pullup(m, off + icmp6len); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (IPPROTO_DONE); + if (m->m_len < off + icmp6len) { + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } } error = send_sendso_input_hook(m, ifp, SND_IN, ip6len); if (error == 0) { @@ -891,11 +902,13 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp goto freeit; } - m = m_pullup(m, off + sizeof(*icmp6) + sizeof(struct ip6_hdr)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (-1); + if (m->m_len < off + sizeof(*icmp6) + sizeof(struct ip6_hdr)) { + m = m_pullup(m, off + sizeof(*icmp6) + sizeof(struct ip6_hdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (-1); + } } icmp6 = (struct icmp6_hdr *)(mtod(m, caddr_t) + off); eip6 = (struct ip6_hdr *)(icmp6 + 1); @@ -921,11 +934,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp case IPPROTO_HOPOPTS: case IPPROTO_DSTOPTS: case IPPROTO_AH: - m = m_pullup(m, eoff + sizeof(struct ip6_ext)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (-1); + if (m->m_len < eoff + sizeof(struct ip6_ext)) { + m = m_pullup(m, eoff + + sizeof(struct ip6_ext)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (-1); + } } eh = (struct ip6_ext *) (mtod(m, caddr_t) + eoff); @@ -944,11 +960,13 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp * information that depends on the final * destination (e.g. path MTU). */ - m = m_pullup(m, eoff + sizeof(*rth)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (-1); + if (m->m_len < eoff + sizeof(*rth)) { + m = m_pullup(m, eoff + sizeof(*rth)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (-1); + } } rth = (struct ip6_rthdr *) (mtod(m, caddr_t) + eoff); @@ -965,11 +983,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp rth->ip6r_type == IPV6_RTHDR_TYPE_0) { int hops; - m = m_pullup(m, eoff + rthlen); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (-1); + if (m->m_len < eoff + rthlen) { + m = m_pullup(m, eoff + rthlen); + if (m == NULL) { + IP6STAT_INC( + ip6s_exthdrtoolong); + *mp = m; + return (-1); + } } rth0 = (struct ip6_rthdr0 *) (mtod(m, caddr_t) + eoff); @@ -982,11 +1003,14 @@ icmp6_notify_error(struct mbuf **mp, int off, int icmp nxt = rth->ip6r_nxt; break; case IPPROTO_FRAGMENT: - m = m_pullup(m, eoff + sizeof(struct ip6_frag)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = m; - return (-1); + if (m->m_len < eoff + sizeof(struct ip6_frag)) { + m = m_pullup(m, eoff + + sizeof(struct ip6_frag)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = m; + return (-1); + } } fh = (struct ip6_frag *)(mtod(m, caddr_t) + eoff); @@ -1295,11 +1319,14 @@ ni6_input(struct mbuf *m, int off, struct prison *pr) mtx_unlock(&pr->pr_mtx); if (!n || n->m_next || n->m_len == 0) goto bad; - m = m_pullup(m, off + sizeof(struct icmp6_nodeinfo) + - subjlen); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - goto bad; + if (m->m_len < off + sizeof(struct icmp6_nodeinfo) + + subjlen) { + m = m_pullup(m, off + + sizeof(struct icmp6_nodeinfo) + subjlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + goto bad; + } } /* ip6 possibly invalid but not used after. */ ni6 = (struct icmp6_nodeinfo *)(mtod(m, caddr_t) + off); @@ -2201,10 +2228,12 @@ icmp6_redirect_input(struct mbuf *m, int off) ip6 = mtod(m, struct ip6_hdr *); icmp6len = ntohs(ip6->ip6_plen); - m = m_pullup(m, off + icmp6len); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return; + if (m->m_len < off + icmp6len) { + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return; + } } ip6 = mtod(m, struct ip6_hdr *); nd_rd = (struct nd_redirect *)((caddr_t)ip6 + off); Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/ip6_input.c Sun Dec 1 00:22:04 2019 (r355254) @@ -969,20 +969,24 @@ ip6_hopopts_input(u_int32_t *plenp, u_int32_t *rtalert struct ip6_hbh *hbh; /* validation of the length of the header */ - m = m_pullup(m, off + sizeof(*hbh)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (-1); + if (m->m_len < off + sizeof(*hbh)) { + m = m_pullup(m, off + sizeof(*hbh)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (-1); + } } hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); hbhlen = (hbh->ip6h_len + 1) << 3; - m = m_pullup(m, off + hbhlen); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (-1); + if (m->m_len < off + hbhlen) { + m = m_pullup(m, off + hbhlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (-1); + } } hbh = (struct ip6_hbh *)(mtod(m, caddr_t) + off); off += hbhlen; Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/ip6_mroute.c Sun Dec 1 00:22:04 2019 (r355254) @@ -1745,10 +1745,12 @@ pim6_input(struct mbuf *m, int off, int proto, void *a * Make sure that the IP6 and PIM headers in contiguous memory, and * possibly the PIM REGISTER header */ - m = m_pullup(m, off + minlen); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return (IPPROTO_DONE); + if (m->m_len < off + minlen) { + m = m_pullup(m, off + minlen); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); pim = (struct pim *)((caddr_t)ip6 + off); Modified: head/sys/netinet6/mld6.c ============================================================================== --- head/sys/netinet6/mld6.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/mld6.c Sun Dec 1 00:22:04 2019 (r355254) @@ -1263,10 +1263,12 @@ mld_input(struct mbuf **mp, int off, int icmp6len) ifp = m->m_pkthdr.rcvif; /* Pullup to appropriate size. */ - m = m_pullup(m, off + sizeof(*mld)); - if (m == NULL) { - ICMP6STAT_INC(icp6s_badlen); - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(*mld)) { + m = m_pullup(m, off + sizeof(*mld)); + if (m == NULL) { + ICMP6STAT_INC(icp6s_badlen); + return (IPPROTO_DONE); + } } mld = (struct mld_hdr *)(mtod(m, uint8_t *) + off); if (mld->mld_type == MLD_LISTENER_QUERY && @@ -1275,10 +1277,12 @@ mld_input(struct mbuf **mp, int off, int icmp6len) } else { mldlen = sizeof(struct mld_hdr); } - m = m_pullup(m, off + mldlen); - if (m == NULL) { - ICMP6STAT_INC(icp6s_badlen); - return (IPPROTO_DONE); + if (m->m_len < off + mldlen) { + m = m_pullup(m, off + mldlen); + if (m == NULL) { + ICMP6STAT_INC(icp6s_badlen); + return (IPPROTO_DONE); + } } *mp = m; ip6 = mtod(m, struct ip6_hdr *); Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/nd6_nbr.c Sun Dec 1 00:22:04 2019 (r355254) @@ -148,10 +148,12 @@ nd6_ns_input(struct mbuf *m, int off, int icmp6len) goto bads; } - m = m_pullup(m, off + icmp6len); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return; + if (m->m_len < off + icmp6len) { + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return; + } } ip6 = mtod(m, struct ip6_hdr *); nd_ns = (struct nd_neighbor_solicit *)((caddr_t)ip6 + off); @@ -652,10 +654,12 @@ nd6_na_input(struct mbuf *m, int off, int icmp6len) goto bad; } - m = m_pullup(m, off + icmp6len); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return; + if (m->m_len < off + icmp6len) { + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return; + } } ip6 = mtod(m, struct ip6_hdr *); nd_na = (struct nd_neighbor_advert *)((caddr_t)ip6 + off); Modified: head/sys/netinet6/nd6_rtr.c ============================================================================== --- head/sys/netinet6/nd6_rtr.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/nd6_rtr.c Sun Dec 1 00:22:04 2019 (r355254) @@ -190,10 +190,12 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len) if (IN6_IS_ADDR_UNSPECIFIED(&saddr6)) goto freeit; - m = m_pullup(m, off + icmp6len); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return; + if (m->m_len < off + icmp6len) { + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return; + } } ip6 = mtod(m, struct ip6_hdr *); nd_rs = (struct nd_router_solicit *)((caddr_t)ip6 + off); @@ -388,10 +390,12 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len) goto bad; } - m = m_pullup(m, off + icmp6len); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - return; + if (m->m_len < off + icmp6len) { + m = m_pullup(m, off + icmp6len); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + return; + } } ip6 = mtod(m, struct ip6_hdr *); nd_ra = (struct nd_router_advert *)((caddr_t)ip6 + off); Modified: head/sys/netinet6/route6.c ============================================================================== --- head/sys/netinet6/route6.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/route6.c Sun Dec 1 00:22:04 2019 (r355254) @@ -83,11 +83,13 @@ route6_input(struct mbuf **mp, int *offp, int proto) } #endif - m = m_pullup(m, off + sizeof(*rh)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(*rh)) { + m = m_pullup(m, off + sizeof(*rh)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); rh = (struct ip6_rthdr *)((caddr_t)ip6 + off); Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/sctp6_usrreq.c Sun Dec 1 00:22:04 2019 (r355254) @@ -103,10 +103,12 @@ sctp6_input_with_port(struct mbuf **i_pak, int *offp, SCTP_STAT_INCR_COUNTER64(sctps_inpackets); /* Get IP, SCTP, and first chunk header together in the first mbuf. */ offset = iphlen + sizeof(struct sctphdr) + sizeof(struct sctp_chunkhdr); - m = m_pullup(m, offset); - if (m == NULL) { - SCTP_STAT_INCR(sctps_hdrops); - return (IPPROTO_DONE); + if (m->m_len < offset) { + m = m_pullup(m, offset); + if (m == NULL) { + SCTP_STAT_INCR(sctps_hdrops); + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); sh = (struct sctphdr *)(mtod(m, caddr_t) + iphlen); Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netinet6/udp6_usrreq.c Sun Dec 1 00:22:04 2019 (r355254) @@ -223,11 +223,13 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ifp = m->m_pkthdr.rcvif; - m = m_pullup(m, off + sizeof(struct udphdr)); - if (m == NULL) { - IP6STAT_INC(ip6s_exthdrtoolong); - *mp = NULL; - return (IPPROTO_DONE); + if (m->m_len < off + sizeof(struct udphdr)) { + m = m_pullup(m, off + sizeof(struct udphdr)); + if (m == NULL) { + IP6STAT_INC(ip6s_exthdrtoolong); + *mp = NULL; + return (IPPROTO_DONE); + } } ip6 = mtod(m, struct ip6_hdr *); uh = (struct udphdr *)((caddr_t)ip6 + off); Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netipsec/xform_ah.c Sun Dec 1 00:22:04 2019 (r355254) @@ -575,12 +575,14 @@ ah_input(struct mbuf *m, struct secasvar *sav, int ski /* Figure out header size. */ rplen = HDRSIZE(sav); - m = m_pullup(m, skip + rplen); - if (m == NULL) { - DPRINTF(("ah_input: cannot pullup header\n")); - AHSTAT_INC(ahs_hdrops); /*XXX*/ - error = ENOBUFS; - goto bad; + if (m->m_len < skip + rplen) { + m = m_pullup(m, skip + rplen); + if (m == NULL) { + DPRINTF(("ah_input: cannot pullup header\n")); + AHSTAT_INC(ahs_hdrops); /*XXX*/ + error = ENOBUFS; + goto bad; + } } ah = (struct newah *)(mtod(m, caddr_t) + skip); Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Sat Nov 30 21:11:17 2019 (r355253) +++ head/sys/netipsec/xform_esp.c Sun Dec 1 00:22:04 2019 (r355254) @@ -308,12 +308,14 @@ esp_input(struct mbuf *m, struct secasvar *sav, int sk goto bad; } - m = m_pullup(m, skip + sizeof(*esp)); - if (m == NULL) { - DPRINTF(("%s: cannot pullup header\n", __func__)); - ESPSTAT_INC(esps_hdrops); /*XXX*/ - error = ENOBUFS; - goto bad; + if (m->m_len < skip + sizeof(*esp)) { + m = m_pullup(m, skip + sizeof(*esp)); + if (m == NULL) { + DPRINTF(("%s: cannot pullup header\n", __func__)); + ESPSTAT_INC(esps_hdrops); /*XXX*/ + error = ENOBUFS; + goto bad; + } } esp = (struct newesp *)(mtod(m, caddr_t) + skip); From owner-svn-src-all@freebsd.org Sun Dec 1 00:34:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C525E1BDF7C; Sun, 1 Dec 2019 00:34:49 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QTls4mglz3FNF; Sun, 1 Dec 2019 00:34:49 +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 80A626952; Sun, 1 Dec 2019 00:34:49 +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 xB10Yn70009602; Sun, 1 Dec 2019 00:34:49 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB10YnHq009601; Sun, 1 Dec 2019 00:34:49 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912010034.xB10YnHq009601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 1 Dec 2019 00:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355255 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 355255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 00:34:49 -0000 Author: mjg Date: Sun Dec 1 00:34:49 2019 New Revision: 355255 URL: https://svnweb.freebsd.org/changeset/base/355255 Log: tmpfs: use proper macros for permission values in tmpfs_access While here group them in one var to prevent overy long lines. Perhaps a general macro of the same sort should be introduced. Requested by: kib Modified: head/sys/fs/tmpfs/tmpfs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 00:22:04 2019 (r355254) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 00:34:49 2019 (r355255) @@ -323,7 +323,7 @@ tmpfs_access(struct vop_access_args *v) struct vnode *vp = v->a_vp; accmode_t accmode = v->a_accmode; struct ucred *cred = v->a_cred; - + mode_t all_x = S_IXUSR | S_IXGRP | S_IXOTH; int error; struct tmpfs_node *node; @@ -334,7 +334,7 @@ tmpfs_access(struct vop_access_args *v) /* * Common case path lookup. */ - if (__predict_true(accmode == VEXEC && (node->tn_mode & 0111) == 0111)) + if (__predict_true(accmode == VEXEC && (node->tn_mode & all_x) == all_x)) return (0); switch (vp->v_type) { From owner-svn-src-all@freebsd.org Sun Dec 1 00:35:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39C301BE065; Sun, 1 Dec 2019 00:35:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QTmF0qwgz3FcK; Sun, 1 Dec 2019 00:35:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F41566953; Sun, 1 Dec 2019 00:35:08 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB10Z863009679; Sun, 1 Dec 2019 00:35:08 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB10Z8du009677; Sun, 1 Dec 2019 00:35:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912010035.xB10Z8du009677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 1 Dec 2019 00:35:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355256 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 355256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 00:35:09 -0000 Author: mjg Date: Sun Dec 1 00:35:08 2019 New Revision: 355256 URL: https://svnweb.freebsd.org/changeset/base/355256 Log: lockmgr: remove more remnants of adaptive spinning Sponsored by: The FreeBSD Foundation Modified: head/sys/kern/kern_lock.c head/sys/sys/lockmgr.h Modified: head/sys/kern/kern_lock.c ============================================================================== --- head/sys/kern/kern_lock.c Sun Dec 1 00:34:49 2019 (r355255) +++ head/sys/kern/kern_lock.c Sun Dec 1 00:35:08 2019 (r355256) @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); PMC_SOFT_DECLARE( , , lock, failed); #endif -CTASSERT(((LK_ADAPTIVE | LK_NOSHARE) & LO_CLASSFLAGS) == - (LK_ADAPTIVE | LK_NOSHARE)); CTASSERT(LK_UNLOCKED == (LK_UNLOCKED & ~(LK_ALL_WAITERS | LK_EXCLUSIVE_SPINNERS))); @@ -136,10 +134,6 @@ LK_CAN_SHARE(uintptr_t x, int flags, bool fp) #define LK_TRYWIT(x) \ (LK_TRYOP(x) ? LOP_TRYLOCK : 0) -#define LK_CAN_ADAPT(lk, f) \ - (((lk)->lock_object.lo_flags & LK_ADAPTIVE) != 0 && \ - ((f) & LK_SLEEPFAIL) == 0) - #define lockmgr_disowned(lk) \ (((lk)->lk_lock & ~(LK_FLAGMASK & ~LK_SHARE)) == LK_KERNPROC) @@ -453,7 +447,7 @@ lockinit(struct lock *lk, int pri, const char *wmesg, iflags |= LO_IS_VNODE; if (flags & LK_NEW) iflags |= LO_NEW; - iflags |= flags & (LK_ADAPTIVE | LK_NOSHARE); + iflags |= flags & LK_NOSHARE; lock_init(&lk->lock_object, &lock_class_lockmgr, wmesg, NULL, iflags); lk->lk_lock = LK_UNLOCKED; Modified: head/sys/sys/lockmgr.h ============================================================================== --- head/sys/sys/lockmgr.h Sun Dec 1 00:34:49 2019 (r355255) +++ head/sys/sys/lockmgr.h Sun Dec 1 00:35:08 2019 (r355256) @@ -150,7 +150,7 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct #define LK_NOSHARE 0x000008 #define LK_NOWITNESS 0x000010 #define LK_QUIET 0x000020 -#define LK_ADAPTIVE 0x000040 +#define LK_UNUSED0 0x000040 /* Was LK_ADAPTIVE */ #define LK_IS_VNODE 0x000080 /* Tell WITNESS about a VNODE lock */ #define LK_NEW 0x000100 From owner-svn-src-all@freebsd.org Sun Dec 1 03:56:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C63721C567B; Sun, 1 Dec 2019 03:56:19 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QZDM3yrGz3wch; Sun, 1 Dec 2019 03:56:19 +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 67F6F8EA0; Sun, 1 Dec 2019 03:56:19 +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 xB13uJNV027419; Sun, 1 Dec 2019 03:56:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB13uIH1027417; Sun, 1 Dec 2019 03:56:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912010356.xB13uIH1027417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 1 Dec 2019 03:56:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355257 - head/sys/dev/usb/input X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/usb/input X-SVN-Commit-Revision: 355257 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 03:56:19 -0000 Author: kevans Date: Sun Dec 1 03:56:18 2019 New Revision: 355257 URL: https://svnweb.freebsd.org/changeset/base/355257 Log: usb: remove some extraneous tty.h includes Modified: head/sys/dev/usb/input/uep.c head/sys/dev/usb/input/ukbd.c head/sys/dev/usb/input/ums.c Modified: head/sys/dev/usb/input/uep.c ============================================================================== --- head/sys/dev/usb/input/uep.c Sun Dec 1 00:35:08 2019 (r355256) +++ head/sys/dev/usb/input/uep.c Sun Dec 1 03:56:18 2019 (r355257) @@ -57,7 +57,6 @@ #else #include #include -#include #endif #define USB_DEBUG_VAR uep_debug Modified: head/sys/dev/usb/input/ukbd.c ============================================================================== --- head/sys/dev/usb/input/ukbd.c Sun Dec 1 00:35:08 2019 (r355256) +++ head/sys/dev/usb/input/ukbd.c Sun Dec 1 03:56:18 2019 (r355257) @@ -80,7 +80,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/dev/usb/input/ums.c ============================================================================== --- head/sys/dev/usb/input/ums.c Sun Dec 1 00:35:08 2019 (r355256) +++ head/sys/dev/usb/input/ums.c Sun Dec 1 03:56:18 2019 (r355257) @@ -79,7 +79,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #ifdef USB_DEBUG From owner-svn-src-all@freebsd.org Sun Dec 1 04:00:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EDFD1C57CA; Sun, 1 Dec 2019 04:00:09 +0000 (UTC) (envelope-from anish@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QZJm6dhBz3wnt; Sun, 1 Dec 2019 04:00:08 +0000 (UTC) (envelope-from anish@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9FA08EB6; Sun, 1 Dec 2019 04:00:08 +0000 (UTC) (envelope-from anish@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1408g5027679; Sun, 1 Dec 2019 04:00:08 GMT (envelope-from anish@FreeBSD.org) Received: (from anish@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB14089u027678; Sun, 1 Dec 2019 04:00:08 GMT (envelope-from anish@FreeBSD.org) Message-Id: <201912010400.xB14089u027678@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: anish set sender to anish@FreeBSD.org using -f From: Anish Gupta Date: Sun, 1 Dec 2019 04:00:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355258 - head/sys/amd64/vmm/amd X-SVN-Group: head X-SVN-Commit-Author: anish X-SVN-Commit-Paths: head/sys/amd64/vmm/amd X-SVN-Commit-Revision: 355258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 04:00:09 -0000 Author: anish Date: Sun Dec 1 04:00:08 2019 New Revision: 355258 URL: https://svnweb.freebsd.org/changeset/base/355258 Log: bhyve amd: amdvi_dump_cmds() log the command for which the command completion failed. Completion is checked in poll mode although it can be done using interrupts. No need to log all the commands in command ring but only the last one for which completion failed. Reported by: np@freebsd.org Reviewed by: np, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22566 Modified: head/sys/amd64/vmm/amd/amdvi_hw.c Modified: head/sys/amd64/vmm/amd/amdvi_hw.c ============================================================================== --- head/sys/amd64/vmm/amd/amdvi_hw.c Sun Dec 1 03:56:18 2019 (r355257) +++ head/sys/amd64/vmm/amd/amdvi_hw.c Sun Dec 1 04:00:08 2019 (r355258) @@ -66,7 +66,7 @@ SYSCTL_NODE(_hw_vmm, OID_AUTO, amdvi, CTLFLAG_RW, NULL /* Print RID or device ID in PCI string format. */ #define RID2PCI_STR(d) PCI_RID2BUS(d), PCI_RID2SLOT(d), PCI_RID2FUNC(d) -static void amdvi_dump_cmds(struct amdvi_softc *softc); +static void amdvi_dump_cmds(struct amdvi_softc *softc, int count); static void amdvi_print_dev_cap(struct amdvi_softc *softc); MALLOC_DEFINE(M_AMDVI, "amdvi", "amdvi"); @@ -321,9 +321,7 @@ amdvi_cmd_cmp(struct amdvi_softc *softc, const uint64_ pa = vtophys(&softc->cmp_data); cmd->opcode = AMDVI_CMP_WAIT_OPCODE; - cmd->word0 = (pa & 0xFFFFFFF8) | - (AMDVI_CMP_WAIT_STORE); - //(AMDVI_CMP_WAIT_FLUSH | AMDVI_CMP_WAIT_STORE); + cmd->word0 = (pa & 0xFFFFFFF8) | AMDVI_CMP_WAIT_STORE; cmd->word1 = (pa >> 32) & 0xFFFFF; cmd->addr = data; @@ -492,26 +490,26 @@ amdvi_wait(struct amdvi_softc *softc) device_printf(softc->dev, "Error: completion failed" " tail:0x%x, head:0x%x.\n", ctrl->cmd_tail, ctrl->cmd_head); - amdvi_dump_cmds(softc); + /* Dump the last command. */ + amdvi_dump_cmds(softc, 1); } static void -amdvi_dump_cmds(struct amdvi_softc *softc) +amdvi_dump_cmds(struct amdvi_softc *softc, int count) { struct amdvi_ctrl *ctrl; struct amdvi_cmd *cmd; int off, i; ctrl = softc->ctrl; - device_printf(softc->dev, "Dump all the commands:\n"); + device_printf(softc->dev, "Dump last %d command(s):\n", count); /* * If h/w is stuck in completion, it is the previous command, * start dumping from previous command onward. */ off = MOD_DEC(ctrl->cmd_head, sizeof(struct amdvi_cmd), softc->cmd_max); - for (i = 0; off != ctrl->cmd_tail && - i < softc->cmd_max; i++) { + for (i = 0; off != ctrl->cmd_tail && i < count; i++) { cmd = (struct amdvi_cmd *)((uint8_t *)softc->cmd + off); printf(" [CMD%d, off:0x%x] opcode= 0x%x 0x%x" " 0x%x 0x%lx\n", i, off, cmd->opcode, From owner-svn-src-all@freebsd.org Sun Dec 1 08:04:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5CA821C337E; Sun, 1 Dec 2019 08:04:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Qgkb1X1Fz4Z40; Sun, 1 Dec 2019 08:04:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17A10BD52; Sun, 1 Dec 2019 08:04:23 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB184Ms1073373; Sun, 1 Dec 2019 08:04:22 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB184MIA073371; Sun, 1 Dec 2019 08:04:22 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912010804.xB184MIA073371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 1 Dec 2019 08:04:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355260 - head/libexec/getty X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/libexec/getty X-SVN-Commit-Revision: 355260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 08:04:23 -0000 Author: delphij Date: Sun Dec 1 08:04:22 2019 New Revision: 355260 URL: https://svnweb.freebsd.org/changeset/base/355260 Log: Simplify code with strlcpy/strlcat. MFC after: 2 weeks Modified: head/libexec/getty/main.c head/libexec/getty/subr.c Modified: head/libexec/getty/main.c ============================================================================== --- head/libexec/getty/main.c Sun Dec 1 07:44:21 2019 (r355259) +++ head/libexec/getty/main.c Sun Dec 1 08:04:22 2019 (r355260) @@ -97,7 +97,6 @@ static int crmod, digit, lower, upper; char hostname[MAXHOSTNAMELEN]; static char name[MAXLOGNAME*3]; -static char dev[] = _PATH_DEV; static char ttyn[32]; #define OBUFSIZ 128 @@ -218,8 +217,8 @@ main(int argc, char *argv[]) if (argc <= 2 || strcmp(argv[2], "-") == 0) strcpy(ttyn, ttyname(STDIN_FILENO)); else { - strcpy(ttyn, dev); - strncat(ttyn, argv[2], sizeof(ttyn)-sizeof(dev)); + strcpy(ttyn, _PATH_DEV); + strlcat(ttyn, argv[2], sizeof(ttyn)); if (strcmp(argv[0], "+") != 0) { chown(ttyn, 0, 0); chmod(ttyn, 0600); Modified: head/libexec/getty/subr.c ============================================================================== --- head/libexec/getty/subr.c Sun Dec 1 07:44:21 2019 (r355259) +++ head/libexec/getty/subr.c Sun Dec 1 08:04:22 2019 (r355260) @@ -89,10 +89,8 @@ gettable(const char *name, char *buf) l = 2; else l = strlen(sp->value) + 1; - if ((p = malloc(l)) != NULL) { - strncpy(p, sp->value, l); - p[l-1] = '\0'; - } + if ((p = malloc(l)) != NULL) + strlcpy(p, sp->value, l); /* * replace, even if NULL, else we'll * have problems with free()ing static mem From owner-svn-src-all@freebsd.org Sun Dec 1 15:29:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 450601AECF1; Sun, 1 Dec 2019 15:29:49 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QscY17HHz3Qdp; Sun, 1 Dec 2019 15:29:49 +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 0572A18B74; Sun, 1 Dec 2019 15:29:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1FTmNx032597; Sun, 1 Dec 2019 15:29:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1FTm1F032596; Sun, 1 Dec 2019 15:29:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912011529.xB1FTm1F032596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 15:29: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: r355261 - stable/12/sys/fs/tmpfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/tmpfs X-SVN-Commit-Revision: 355261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 15:29:49 -0000 Author: kib Date: Sun Dec 1 15:29:48 2019 New Revision: 355261 URL: https://svnweb.freebsd.org/changeset/base/355261 Log: MFC r355061: tmpfs: resolve deadlock between rename and unmount. Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/12/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 08:04:22 2019 (r355260) +++ stable/12/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 15:29:48 2019 (r355261) @@ -792,7 +792,6 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tdvp = v->a_tdvp; struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; - struct mount *mp = NULL; char *newname; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; @@ -829,18 +828,10 @@ tmpfs_rename(struct vop_rename_args *v) */ if (fdvp != tdvp && fdvp != tvp) { if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - mp = tdvp->v_mount; - error = vfs_busy(mp, 0); - if (error != 0) { - mp = NULL; - goto out; - } error = tmpfs_rename_relock(fdvp, &fvp, tdvp, &tvp, fcnp, tcnp); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } ASSERT_VOP_ELOCKED(fdvp, "tmpfs_rename: fdvp not locked"); ASSERT_VOP_ELOCKED(tdvp, @@ -1083,9 +1074,6 @@ out: /* Release source nodes. */ vrele(fdvp); vrele(fvp); - - if (mp != NULL) - vfs_unbusy(mp); return (error); } From owner-svn-src-all@freebsd.org Sun Dec 1 15:59:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D43B31AFB28; Sun, 1 Dec 2019 15:59:04 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QtGJ5L2gz3xWb; Sun, 1 Dec 2019 15:59:04 +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 9605C190C7; Sun, 1 Dec 2019 15:59:04 +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 xB1Fx4ub050895; Sun, 1 Dec 2019 15:59:04 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1Fx4nP050894; Sun, 1 Dec 2019 15:59:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912011559.xB1Fx4nP050894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 15:59:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355262 - stable/11/sys/fs/tmpfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/fs/tmpfs X-SVN-Commit-Revision: 355262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 15:59:04 -0000 Author: kib Date: Sun Dec 1 15:59:04 2019 New Revision: 355262 URL: https://svnweb.freebsd.org/changeset/base/355262 Log: MFC r355061: tmpfs: resolve deadlock between rename and unmount. Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/11/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 15:29:48 2019 (r355261) +++ stable/11/sys/fs/tmpfs/tmpfs_vnops.c Sun Dec 1 15:59:04 2019 (r355262) @@ -786,7 +786,6 @@ tmpfs_rename(struct vop_rename_args *v) struct vnode *tdvp = v->a_tdvp; struct vnode *tvp = v->a_tvp; struct componentname *tcnp = v->a_tcnp; - struct mount *mp = NULL; char *newname; struct tmpfs_dirent *de; struct tmpfs_mount *tmp; @@ -823,18 +822,10 @@ tmpfs_rename(struct vop_rename_args *v) */ if (fdvp != tdvp && fdvp != tvp) { if (vn_lock(fdvp, LK_EXCLUSIVE | LK_NOWAIT) != 0) { - mp = tdvp->v_mount; - error = vfs_busy(mp, 0); - if (error != 0) { - mp = NULL; - goto out; - } error = tmpfs_rename_relock(fdvp, &fvp, tdvp, &tvp, fcnp, tcnp); - if (error != 0) { - vfs_unbusy(mp); + if (error != 0) return (error); - } ASSERT_VOP_ELOCKED(fdvp, "tmpfs_rename: fdvp not locked"); ASSERT_VOP_ELOCKED(tdvp, @@ -1077,9 +1068,6 @@ out: /* Release source nodes. */ vrele(fdvp); vrele(fvp); - - if (mp != NULL) - vfs_unbusy(mp); return (error); } From owner-svn-src-all@freebsd.org Sun Dec 1 16:02:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32D581AFD75; Sun, 1 Dec 2019 16:02:16 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QtL00gdrz3xrf; Sun, 1 Dec 2019 16:02:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFE0B1926D; Sun, 1 Dec 2019 16:02:15 +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 xB1G2F29055677; Sun, 1 Dec 2019 16:02:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1G2FMA055676; Sun, 1 Dec 2019 16:02:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912011602.xB1G2FMA055676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 16:02:15 +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: r355263 - stable/12/sys/amd64/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/include X-SVN-Commit-Revision: 355263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 16:02:16 -0000 Author: kib Date: Sun Dec 1 16:02:15 2019 New Revision: 355263 URL: https://svnweb.freebsd.org/changeset/base/355263 Log: MFC r355060: amd64: assert that EARLY_COUNTER does not corrupt memory. Modified: stable/12/sys/amd64/include/counter.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/include/counter.h ============================================================================== --- stable/12/sys/amd64/include/counter.h Sun Dec 1 15:59:04 2019 (r355262) +++ stable/12/sys/amd64/include/counter.h Sun Dec 1 16:02:15 2019 (r355263) @@ -82,6 +82,7 @@ static inline void counter_u64_add(counter_u64_t c, int64_t inc) { + KASSERT(IS_BSP() || c != EARLY_COUNTER, ("EARLY_COUNTER used on AP")); __asm __volatile("addq\t%1,%%gs:(%0)" : : "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc) From owner-svn-src-all@freebsd.org Sun Dec 1 16:14:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B7221B026E; Sun, 1 Dec 2019 16:14:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QtcP0tJCz3yPd; Sun, 1 Dec 2019 16:14:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 017221946E; Sun, 1 Dec 2019 16:14:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1GEiF1062629; Sun, 1 Dec 2019 16:14:44 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1GEi5h062628; Sun, 1 Dec 2019 16:14:44 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912011614.xB1GEi5h062628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 16:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355264 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 355264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 16:14:45 -0000 Author: tuexen Date: Sun Dec 1 16:14:44 2019 New Revision: 355264 URL: https://svnweb.freebsd.org/changeset/base/355264 Log: Update the hostcache also for PTB messages received for SCTP/IPv6. The corresponding code for SCTP/IPv4 was introduced in https://svnweb.freebsd.org/base?view=revision&revision=317597 Submitted by: Julius Flohr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22605 Modified: head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Dec 1 16:02:15 2019 (r355263) +++ head/sys/netinet6/sctp6_usrreq.c Sun Dec 1 16:14:44 2019 (r355264) @@ -240,6 +240,11 @@ sctp6_notify(struct sctp_inpcb *inp, } if (net->mtu > next_mtu) { net->mtu = next_mtu; + if (net->port) { + sctp_hc_set_mtu(&net->ro._l_addr, inp->fibnum, next_mtu + sizeof(struct udphdr)); + } else { + sctp_hc_set_mtu(&net->ro._l_addr, inp->fibnum, next_mtu); + } } /* Update the association MTU */ if (stcb->asoc.smallest_mtu > next_mtu) { From owner-svn-src-all@freebsd.org Sun Dec 1 17:35:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 689E51B23C1; Sun, 1 Dec 2019 17:35:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47QwPj294rz4399; Sun, 1 Dec 2019 17:35:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D74D1A2DB; Sun, 1 Dec 2019 17:35:37 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1HZbP9010003; Sun, 1 Dec 2019 17:35:37 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1HZb9H010002; Sun, 1 Dec 2019 17:35:37 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912011735.xB1HZb9H010002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 17:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355265 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 355265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 17:35:37 -0000 Author: tuexen Date: Sun Dec 1 17:35:36 2019 New Revision: 355265 URL: https://svnweb.freebsd.org/changeset/base/355265 Log: When changing the MTU of an SCTP path, not only cancel all ongoing RTT measurements, but also scheldule new ones for the future. Submitted by: Julius Flohr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22547 Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Dec 1 16:14:44 2019 (r355264) +++ head/sys/netinet/sctp_usrreq.c Sun Dec 1 17:35:36 2019 (r355265) @@ -143,7 +143,10 @@ sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_ chk->rec.data.tsn); } /* Clear any time so NO RTT is being done */ - chk->do_rtt = 0; + if (chk->do_rtt == 1) { + chk->do_rtt = 0; + chk->whoTo->rto_needed = 1; + } } } } From owner-svn-src-all@freebsd.org Sun Dec 1 18:05:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E84D1B36F3; Sun, 1 Dec 2019 18:05:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Qx3h0xTbz44qW; Sun, 1 Dec 2019 18:05:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 037081A859; Sun, 1 Dec 2019 18:05:04 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1I532x028003; Sun, 1 Dec 2019 18:05:03 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1I52J4027996; Sun, 1 Dec 2019 18:05:02 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912011805.xB1I52J4027996@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 18:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355266 - in head/sys: dev/cxgbe/tom netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: dev/cxgbe/tom netinet X-SVN-Commit-Revision: 355266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 18:05:04 -0000 Author: tuexen Date: Sun Dec 1 18:05:02 2019 New Revision: 355266 URL: https://svnweb.freebsd.org/changeset/base/355266 Log: In order for the TCP Handshake to support ECN++, and further ECN-related improvements, the ECN bits need to be exposed to the TCP SYNcache. This change is a minimal modification to the function headers, without any functional change intended. Submitted by: Richard Scheffenegger Reviewed by: rgrimes@, rrs@, tuexen@ Differential Revision: https://reviews.freebsd.org/D22436 Modified: head/sys/dev/cxgbe/tom/t4_listen.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_syncache.h head/sys/netinet/toecore.c head/sys/netinet/toecore.h Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Sun Dec 1 17:35:36 2019 (r355265) +++ head/sys/dev/cxgbe/tom/t4_listen.c Sun Dec 1 18:05:02 2019 (r355266) @@ -988,7 +988,7 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc static void pass_accept_req_to_protohdrs(struct adapter *sc, const struct mbuf *m, - struct in_conninfo *inc, struct tcphdr *th) + struct in_conninfo *inc, struct tcphdr *th, uint8_t *iptos) { const struct cpl_pass_accept_req *cpl = mtod(m, const void *); const struct ether_header *eh; @@ -1005,6 +1005,21 @@ pass_accept_req_to_protohdrs(struct adapter *sc, const tcp = (const void *)(l3hdr + G_IP_HDR_LEN(hlen)); } + /* extract TOS (DiffServ + ECN) byte for AccECN */ + if (iptos) { + if (((struct ip *)l3hdr)->ip_v == IPVERSION) { + const struct ip *ip = (const void *)l3hdr; + *iptos = ip->ip_tos; + } +#ifdef INET6 + else + if (((struct ip *)l3hdr)->ip_v == (IPV6_VERSION >> 4)) { + const struct ip6_hdr *ip6 = (const void *)l3hdr; + *iptos = (ntohl(ip6->ip6_flow) >> 20) & 0xff; + } +#endif /* INET */ + } + if (inc) { bzero(inc, sizeof(*inc)); inc->inc_fport = tcp->th_sport; @@ -1150,6 +1165,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); #endif struct offload_settings settings; + uint8_t iptos; KASSERT(opcode == CPL_PASS_ACCEPT_REQ, ("%s: unexpected opcode 0x%x", __func__, opcode)); @@ -1208,7 +1224,7 @@ found: if (lctx->vnet != ifp->if_vnet) REJECT_PASS_ACCEPT_REQ(true); - pass_accept_req_to_protohdrs(sc, m, &inc, &th); + pass_accept_req_to_protohdrs(sc, m, &inc, &th, &iptos); if (inc.inc_flags & INC_ISIPV6) { /* Don't offload if the ifcap isn't enabled */ @@ -1284,7 +1300,7 @@ found: * syncache_add. Note that syncache_add releases the pcb lock. */ t4opt_to_tcpopt(&cpl->tcpopt, &to); - toe_syncache_add(&inc, &to, &th, inp, tod, synqe); + toe_syncache_add(&inc, &to, &th, inp, tod, synqe, iptos); if (atomic_load_int(&synqe->ok_to_respond) > 0) { uint64_t opt0; @@ -1350,9 +1366,10 @@ synqe_to_protohdrs(struct adapter *sc, struct synq_ent struct tcphdr *th, struct tcpopt *to) { uint16_t tcp_opt = be16toh(cpl->tcp_opt); + uint8_t iptos; /* start off with the original SYN */ - pass_accept_req_to_protohdrs(sc, synqe->syn, inc, th); + pass_accept_req_to_protohdrs(sc, synqe->syn, inc, th, &iptos); /* modify parts to make it look like the ACK to our SYN|ACK */ th->th_flags = TH_ACK; Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Dec 1 17:35:36 2019 (r355265) +++ head/sys/netinet/tcp_input.c Sun Dec 1 18:05:02 2019 (r355266) @@ -1282,7 +1282,7 @@ tfo_socket_result: #endif TCP_PROBE3(debug__input, tp, th, m); tcp_dooptions(&to, optp, optlen, TO_SYN); - if (syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL)) + if (syncache_add(&inc, &to, th, inp, &so, m, NULL, NULL, iptos)) goto tfo_socket_result; /* Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sun Dec 1 17:35:36 2019 (r355265) +++ head/sys/netinet/tcp_syncache.c Sun Dec 1 18:05:02 2019 (r355266) @@ -1369,7 +1369,7 @@ syncache_tfo_expand(struct syncache *sc, struct socket int syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, struct inpcb *inp, struct socket **lsop, struct mbuf *m, void *tod, - void *todctx) + void *todctx, uint8_t iptos) { struct tcpcb *tp; struct socket *so; Modified: head/sys/netinet/tcp_syncache.h ============================================================================== --- head/sys/netinet/tcp_syncache.h Sun Dec 1 17:35:36 2019 (r355265) +++ head/sys/netinet/tcp_syncache.h Sun Dec 1 18:05:02 2019 (r355266) @@ -45,7 +45,7 @@ int syncache_expand(struct in_conninfo *, struct tcpo struct tcphdr *, struct socket **, struct mbuf *); int syncache_add(struct in_conninfo *, struct tcpopt *, struct tcphdr *, struct inpcb *, struct socket **, struct mbuf *, - void *, void *); + void *, void *, uint8_t); void syncache_chkrst(struct in_conninfo *, struct tcphdr *, struct mbuf *); void syncache_badack(struct in_conninfo *); int syncache_pcblist(struct sysctl_req *); Modified: head/sys/netinet/toecore.c ============================================================================== --- head/sys/netinet/toecore.c Sun Dec 1 17:35:36 2019 (r355265) +++ head/sys/netinet/toecore.c Sun Dec 1 18:05:02 2019 (r355266) @@ -346,13 +346,13 @@ unregister_toedev(struct toedev *tod) void toe_syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, - struct inpcb *inp, void *tod, void *todctx) + struct inpcb *inp, void *tod, void *todctx, uint8_t iptos) { struct socket *lso = inp->inp_socket; INP_WLOCK_ASSERT(inp); - syncache_add(inc, to, th, inp, &lso, NULL, tod, todctx); + syncache_add(inc, to, th, inp, &lso, NULL, tod, todctx, iptos); } int Modified: head/sys/netinet/toecore.h ============================================================================== --- head/sys/netinet/toecore.h Sun Dec 1 17:35:36 2019 (r355265) +++ head/sys/netinet/toecore.h Sun Dec 1 18:05:02 2019 (r355266) @@ -135,7 +135,7 @@ int toe_l2_resolve(struct toedev *, struct ifnet *, st void toe_connect_failed(struct toedev *, struct inpcb *, int); void toe_syncache_add(struct in_conninfo *, struct tcpopt *, struct tcphdr *, - struct inpcb *, void *, void *); + struct inpcb *, void *, void *, uint8_t); int toe_syncache_expand(struct in_conninfo *, struct tcpopt *, struct tcphdr *, struct socket **); From owner-svn-src-all@freebsd.org Sun Dec 1 18:47:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A9331B44D4; Sun, 1 Dec 2019 18:47:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Qy161K7Rz46fY; Sun, 1 Dec 2019 18:47:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 115241AF8D; Sun, 1 Dec 2019 18:47:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1IlrxX052066; Sun, 1 Dec 2019 18:47:53 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1Ilru6052064; Sun, 1 Dec 2019 18:47:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912011847.xB1Ilru6052064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 18:47:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355267 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 355267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 18:47:54 -0000 Author: tuexen Date: Sun Dec 1 18:47:53 2019 New Revision: 355267 URL: https://svnweb.freebsd.org/changeset/base/355267 Log: Make the IPTOS value available to all substate handlers. This will allow to add support for L4S or SCE, which require processing of the IP TOS field. Submitted by: Richard Scheffenegger Reviewed by: rgrimes@, rrs@, tuexen@ Differential Revision: https://reviews.freebsd.org/D22426 Modified: head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_stacks/tcp_rack.h Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Sun Dec 1 18:05:02 2019 (r355266) +++ head/sys/netinet/tcp_stacks/rack.c Sun Dec 1 18:47:53 2019 (r355267) @@ -390,39 +390,39 @@ static int32_t tcp_addrack(module_t mod, int32_t type, static int rack_do_close_wait(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_closing(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_established(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t nxt_pkt, uint8_t iptos); static int rack_do_fin_wait_1(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_fin_wait_2(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_lastack(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); static int rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, - int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt); + int32_t tlen, uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos); struct rack_sendmap * tcp_rack_output(struct tcpcb *tp, struct tcp_rack *rack, uint32_t tsused); @@ -5898,7 +5898,7 @@ dodata: /* XXX */ static int rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t nxt_pkt) + uint32_t tiwin, int32_t nxt_pkt, uint8_t iptos) { int32_t nsegs; int32_t newsize = 0; /* automatic sockbuf scaling */ @@ -6039,7 +6039,7 @@ rack_do_fastnewdata(struct mbuf *m, struct tcphdr *th, static int rack_fastack(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t nxt_pkt, uint32_t cts) + uint32_t tiwin, int32_t nxt_pkt, uint32_t cts, uint8_t iptos) { int32_t acked; int32_t nsegs; @@ -6225,7 +6225,7 @@ rack_fastack(struct mbuf *m, struct tcphdr *th, struct static int rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t tos) { int32_t ret_val = 0; int32_t todrop; @@ -6428,7 +6428,7 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, st static int rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { struct tcp_rack *rack; int32_t ret_val = 0; @@ -6624,7 +6624,7 @@ rack_do_syn_recv(struct mbuf *m, struct tcphdr *th, st static int rack_do_established(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { int32_t ret_val = 0; @@ -6651,12 +6651,12 @@ rack_do_established(struct mbuf *m, struct tcphdr *th, rack = (struct tcp_rack *)tp->t_fb_ptr; if (tlen == 0) { if (rack_fastack(m, th, so, tp, to, drop_hdrlen, tlen, - tiwin, nxt_pkt, rack->r_ctl.rc_rcvtime)) { + tiwin, nxt_pkt, rack->r_ctl.rc_rcvtime, iptos)) { return (0); } } else { if (rack_do_fastnewdata(m, th, so, tp, to, drop_hdrlen, tlen, - tiwin, nxt_pkt)) { + tiwin, nxt_pkt, iptos)) { return (0); } } @@ -6754,7 +6754,7 @@ rack_do_established(struct mbuf *m, struct tcphdr *th, static int rack_do_close_wait(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { int32_t ret_val = 0; @@ -6871,7 +6871,7 @@ rack_check_data_after_close(struct mbuf *m, static int rack_do_fin_wait_1(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { int32_t ret_val = 0; int32_t ourfinisacked = 0; @@ -6992,7 +6992,7 @@ rack_do_fin_wait_1(struct mbuf *m, struct tcphdr *th, static int rack_do_closing(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { int32_t ret_val = 0; int32_t ourfinisacked = 0; @@ -7099,7 +7099,7 @@ rack_do_closing(struct mbuf *m, struct tcphdr *th, str static int rack_do_lastack(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { int32_t ret_val = 0; int32_t ourfinisacked = 0; @@ -7207,7 +7207,7 @@ rack_do_lastack(struct mbuf *m, struct tcphdr *th, str static int rack_do_fin_wait_2(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, struct tcpopt *to, int32_t drop_hdrlen, int32_t tlen, - uint32_t tiwin, int32_t thflags, int32_t nxt_pkt) + uint32_t tiwin, int32_t thflags, int32_t nxt_pkt, uint8_t iptos) { int32_t ret_val = 0; int32_t ourfinisacked = 0; @@ -7837,7 +7837,7 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr rack_clear_rate_sample(rack); retval = (*rack->r_substate) (m, th, so, tp, &to, drop_hdrlen, - tlen, tiwin, thflags, nxt_pkt); + tlen, tiwin, thflags, nxt_pkt, iptos); #ifdef INVARIANTS if ((retval == 0) && (tp->t_inpcb == NULL)) { Modified: head/sys/netinet/tcp_stacks/tcp_rack.h ============================================================================== --- head/sys/netinet/tcp_stacks/tcp_rack.h Sun Dec 1 18:05:02 2019 (r355266) +++ head/sys/netinet/tcp_stacks/tcp_rack.h Sun Dec 1 18:47:53 2019 (r355267) @@ -300,7 +300,7 @@ struct tcp_rack { TAILQ_ENTRY(tcp_rack) r_hpts; /* hptsi queue next Lock(b) */ int32_t(*r_substate) (struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, struct tcpopt *, - int32_t, int32_t, uint32_t, int, int); /* Lock(a) */ + int32_t, int32_t, uint32_t, int, int, uint8_t); /* Lock(a) */ struct tcpcb *rc_tp; /* The tcpcb Lock(a) */ struct inpcb *rc_inp; /* The inpcb Lock(a) */ uint32_t rc_free_cnt; /* Number of free entries on the rc_free list From owner-svn-src-all@freebsd.org Sun Dec 1 19:20:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBC5C1B559D; Sun, 1 Dec 2019 19:20:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Qykh5w9bz491X; Sun, 1 Dec 2019 19:20:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB6B11B515; Sun, 1 Dec 2019 19:20:28 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1JKSKb072000; Sun, 1 Dec 2019 19:20:28 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1JKSOC071999; Sun, 1 Dec 2019 19:20:28 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912011920.xB1JKSOC071999@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 19:20:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355268 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 355268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 19:20:29 -0000 Author: tuexen Date: Sun Dec 1 19:20:28 2019 New Revision: 355268 URL: https://svnweb.freebsd.org/changeset/base/355268 Log: Add a description for the TCP sysctl variable rfc6675_pipe. It was introduced by r290122, but no documentation was provided. This is taken from https://reviews.freebsd.org/D21798, since it is not related to the feature added there. Submitted by: Richard Scheffenegger MFC after: 1 week Modified: head/share/man/man4/tcp.4 Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Sun Dec 1 18:47:53 2019 (r355267) +++ head/share/man/man4/tcp.4 Sun Dec 1 19:20:28 2019 (r355268) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd August 26, 2019 +.Dd December 1, 2019 .Dt TCP 4 .Os .Sh NAME @@ -538,6 +538,9 @@ The value should be relative to the link capacity. Start with small values for lower-capacity links. Large bursts can cause buffer overruns and packet drops if routers have small buffers or the link is experiencing congestion. +.It Va rfc6675_pipe +Calculate the bytes in flight using the algorithm described in RFC 6675, and +is also a prerequisite to enable Proportional Rate Reduction. .It Va rfc3042 Enable the Limited Transmit algorithm as described in RFC 3042. It helps avoid timeouts on lossy links and also when the congestion window From owner-svn-src-all@freebsd.org Sun Dec 1 20:35:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B27E01B7488; Sun, 1 Dec 2019 20:35:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R0PV4Bzfz4DWH; Sun, 1 Dec 2019 20:35:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7405F1C338; Sun, 1 Dec 2019 20:35:42 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1KZgBt018994; Sun, 1 Dec 2019 20:35:42 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1KZfbu018991; Sun, 1 Dec 2019 20:35:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912012035.xB1KZfbu018991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 20:35:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355269 - in head: share/man/man4 sys/netinet sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet sys/netinet/tcp_stacks X-SVN-Commit-Revision: 355269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 20:35:42 -0000 Author: tuexen Date: Sun Dec 1 20:35:41 2019 New Revision: 355269 URL: https://svnweb.freebsd.org/changeset/base/355269 Log: This is an initial step in implementing the new congestion window validation as specified in RFC 7661. Submitted by: Richard Scheffenegger Reviewed by: rrs@, tuexen@ Differential Revision: https://reviews.freebsd.org/D21798 Modified: head/share/man/man4/tcp.4 head/sys/netinet/tcp_input.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_var.h Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Sun Dec 1 19:20:28 2019 (r355268) +++ head/share/man/man4/tcp.4 Sun Dec 1 20:35:41 2019 (r355269) @@ -538,6 +538,12 @@ The value should be relative to the link capacity. Start with small values for lower-capacity links. Large bursts can cause buffer overruns and packet drops if routers have small buffers or the link is experiencing congestion. +.It Va newcwd +Enable the New Congestion Window Validation mechanism as described in RFC 7661. +This gently reduces the congestion window during periods, where TCP is +application limited and the network bandwidth is not utilized completely. +That prevents self-inflicted packet losses once the application starts to +transmit data at a higher speed. .It Va rfc6675_pipe Calculate the bytes in flight using the algorithm described in RFC 6675, and is also a prerequisite to enable Proportional Rate Reduction. Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Dec 1 19:20:28 2019 (r355268) +++ head/sys/netinet/tcp_input.c Sun Dec 1 20:35:41 2019 (r355269) @@ -150,6 +150,11 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFL &VNET_NAME(drop_synfin), 0, "Drop TCP packets with SYN+FIN set"); +VNET_DEFINE(int, tcp_do_newcwv) = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_do_newcwv), 0, + "Enable New Congestion Window Validation per RFC7661"); + VNET_DEFINE(int, tcp_do_rfc6675_pipe) = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, rfc6675_pipe, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_rfc6675_pipe), 0, @@ -297,7 +302,9 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, u tp->ccv->nsegs = nsegs; tp->ccv->bytes_this_ack = BYTES_THIS_ACK(tp, th); - if (tp->snd_cwnd <= tp->snd_wnd) + if ((!V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd)) || + (V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd) && + (tp->snd_cwnd < (tcp_compute_pipe(tp) * 2)))) tp->ccv->flags |= CCF_CWND_LIMITED; else tp->ccv->flags &= ~CCF_CWND_LIMITED; Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Sun Dec 1 19:20:28 2019 (r355268) +++ head/sys/netinet/tcp_stacks/rack.c Sun Dec 1 20:35:41 2019 (r355269) @@ -1663,7 +1663,9 @@ rack_ack_received(struct tcpcb *tp, struct tcp_rack *r tp->ccv->bytes_this_ack = max; } } - if (tp->snd_cwnd <= tp->snd_wnd) + if ((!V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd)) || + (V_tcp_do_newcwv && (tp->snd_cwnd <= tp->snd_wnd) && + (tp->snd_cwnd < (ctf_flight_size(tp, rack->r_ctl.rc_sacked) * 2)))) tp->ccv->flags |= CCF_CWND_LIMITED; else tp->ccv->flags &= ~CCF_CWND_LIMITED; Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Dec 1 19:20:28 2019 (r355268) +++ head/sys/netinet/tcp_var.h Sun Dec 1 20:35:41 2019 (r355269) @@ -767,6 +767,7 @@ VNET_DECLARE(int, tcp_delack_enabled); VNET_DECLARE(int, tcp_do_autorcvbuf); VNET_DECLARE(int, tcp_do_autosndbuf); VNET_DECLARE(int, tcp_do_ecn); +VNET_DECLARE(int, tcp_do_newcwv); VNET_DECLARE(int, tcp_do_rfc1323); VNET_DECLARE(int, tcp_do_rfc3042); VNET_DECLARE(int, tcp_do_rfc3390); @@ -789,6 +790,7 @@ VNET_DECLARE(int, tcp_sendspace); VNET_DECLARE(struct inpcbhead, tcb); VNET_DECLARE(struct inpcbinfo, tcbinfo); +#define V_tcp_do_newcwv VNET(tcp_do_newcwv) #define V_drop_synfin VNET(drop_synfin) #define V_path_mtu_discovery VNET(path_mtu_discovery) #define V_tcb VNET(tcb) From owner-svn-src-all@freebsd.org Sun Dec 1 20:43:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDF021B79FF; Sun, 1 Dec 2019 20:43:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R0Z16KwDz4F8q; Sun, 1 Dec 2019 20:43:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCA041C540; Sun, 1 Dec 2019 20:43:05 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1Kh5DV024486; Sun, 1 Dec 2019 20:43:05 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1Kh4TK024481; Sun, 1 Dec 2019 20:43:04 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912012043.xB1Kh4TK024481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 1 Dec 2019 20:43:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355270 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 20:43:05 -0000 Author: kib Date: Sun Dec 1 20:43:04 2019 New Revision: 355270 URL: https://svnweb.freebsd.org/changeset/base/355270 Log: Store the bottom of the shadow chain in OBJ_ANON object->handle member. The handle value is stable for all shadow objects in the inheritance chain. This allows to avoid descending the shadow chain to get to the bottom of it in vm_map_entry_set_vnode_text(), and eliminate corresponding object relocking which appeared to be contending. Change vm_object_allocate_anon() and vm_object_shadow() to handle more of the cred/charge initialization for the new shadow object, in addition to set up the handle. Reported by: jeff Reviewed by: alc (previous version), jeff (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation Differrential revision: https://reviews.freebsd.org/D22541 Modified: head/sys/vm/swap_pager.c head/sys/vm/vm_fault.c head/sys/vm/vm_map.c head/sys/vm/vm_object.c head/sys/vm/vm_object.h Modified: head/sys/vm/swap_pager.c ============================================================================== --- head/sys/vm/swap_pager.c Sun Dec 1 20:35:41 2019 (r355269) +++ head/sys/vm/swap_pager.c Sun Dec 1 20:43:04 2019 (r355270) @@ -690,7 +690,7 @@ swap_pager_dealloc(vm_object_t object) * Remove from list right away so lookups will fail if we block for * pageout completion. */ - if (object->handle != NULL) { + if ((object->flags & OBJ_ANON) == 0 && object->handle != NULL) { VM_OBJECT_WUNLOCK(object); sx_xlock(&sw_alloc_sx); TAILQ_REMOVE(NOBJLIST(object->handle), object, @@ -995,7 +995,8 @@ swap_pager_copy(vm_object_t srcobject, vm_object_t dst * If destroysource is set, we remove the source object from the * swap_pager internal queue now. */ - if (destroysource && srcobject->handle != NULL) { + if (destroysource && (srcobject->flags & OBJ_ANON) == 0 && + srcobject->handle != NULL) { vm_object_pip_add(srcobject, 1); VM_OBJECT_WUNLOCK(srcobject); vm_object_pip_add(dstobject, 1); @@ -1948,7 +1949,10 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t p object->type = OBJT_SWAP; object->un_pager.swp.writemappings = 0; - KASSERT(object->handle == NULL, ("default pager with handle")); + KASSERT((object->flags & OBJ_ANON) != 0 || + object->handle == NULL, + ("default pager %p with handle %p", + object, object->handle)); } rdpi = rounddown(pindex, SWAP_META_PAGES); Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Sun Dec 1 20:35:41 2019 (r355269) +++ head/sys/vm/vm_fault.c Sun Dec 1 20:43:04 2019 (r355270) @@ -1735,11 +1735,12 @@ vm_fault_copy_entry(vm_map_t dst_map, vm_map_t src_map vm_object_reference(dst_object); } else { /* - * Create the top-level object for the destination entry. (Doesn't - * actually shadow anything - we copy the pages directly.) + * Create the top-level object for the destination entry. + * Doesn't actually shadow anything - we copy the pages + * directly. */ - dst_object = vm_object_allocate_anon( - atop(dst_entry->end - dst_entry->start)); + dst_object = vm_object_allocate_anon(atop(dst_entry->end - + dst_entry->start), NULL, NULL, 0); #if VM_NRESERVLEVEL > 0 dst_object->flags |= OBJ_COLORED; dst_object->pg_color = atop(dst_entry->start); Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sun Dec 1 20:35:41 2019 (r355269) +++ head/sys/vm/vm_map.c Sun Dec 1 20:43:04 2019 (r355270) @@ -507,8 +507,9 @@ _vm_map_lock(vm_map_t map, const char *file, int line) void vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool add) { - vm_object_t object, object1; + vm_object_t object; struct vnode *vp; + bool vp_held; if ((entry->eflags & MAP_ENTRY_VN_EXEC) == 0) return; @@ -516,14 +517,21 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool ("Submap with execs")); object = entry->object.vm_object; KASSERT(object != NULL, ("No object for text, entry %p", entry)); - VM_OBJECT_RLOCK(object); - while ((object1 = object->backing_object) != NULL) { - VM_OBJECT_RLOCK(object1); - VM_OBJECT_RUNLOCK(object); - object = object1; - } + if ((object->flags & OBJ_ANON) != 0) + object = object->handle; + else + KASSERT(object->backing_object == NULL, + ("non-anon object %p shadows", object)); + KASSERT(object != NULL, ("No content object for text, entry %p obj %p", + entry, entry->object.vm_object)); + /* + * Mostly, we do not lock the backing object. It is + * referenced by the entry we are processing, so it cannot go + * away. + */ vp = NULL; + vp_held = false; if (object->type == OBJT_DEAD) { /* * For OBJT_DEAD objects, v_writecount was handled in @@ -540,8 +548,15 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool * OBJ_TMPFS_NODE flag set, but not OBJ_TMPFS. In * this case there is no v_writecount to adjust. */ - if ((object->flags & OBJ_TMPFS) != 0) + VM_OBJECT_RLOCK(object); + if ((object->flags & OBJ_TMPFS) != 0) { vp = object->un_pager.swp.swp_tmpfs; + if (vp != NULL) { + vhold(vp); + vp_held = true; + } + } + VM_OBJECT_RUNLOCK(object); } else { KASSERT(0, ("vm_map_entry_set_vnode_text: wrong object type, " @@ -550,17 +565,13 @@ vm_map_entry_set_vnode_text(vm_map_entry_t entry, bool if (vp != NULL) { if (add) { VOP_SET_TEXT_CHECKED(vp); - VM_OBJECT_RUNLOCK(object); } else { - vhold(vp); - VM_OBJECT_RUNLOCK(object); vn_lock(vp, LK_SHARED | LK_RETRY); VOP_UNSET_TEXT_CHECKED(vp); VOP_UNLOCK(vp, 0); - vdrop(vp); } - } else { - VM_OBJECT_RUNLOCK(object); + if (vp_held) + vdrop(vp); } } @@ -2203,14 +2214,11 @@ vm_map_entry_back(vm_map_entry_t entry) ("map entry %p has backing object", entry)); KASSERT((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0, ("map entry %p is a submap", entry)); - object = vm_object_allocate_anon(atop(entry->end - entry->start)); + object = vm_object_allocate_anon(atop(entry->end - entry->start), NULL, + entry->cred, entry->end - entry->start); entry->object.vm_object = object; entry->offset = 0; - if (entry->cred != NULL) { - object->cred = entry->cred; - object->charge = entry->end - entry->start; - entry->cred = NULL; - } + entry->cred = NULL; } /* @@ -4073,9 +4081,12 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c if (old_entry->eflags & MAP_ENTRY_NEEDS_COPY) { vm_object_shadow(&old_entry->object.vm_object, &old_entry->offset, - old_entry->end - old_entry->start); + old_entry->end - old_entry->start, + old_entry->cred, + /* Transfer the second reference too. */ + true); old_entry->eflags &= ~MAP_ENTRY_NEEDS_COPY; - /* Transfer the second reference too. */ + old_entry->cred = NULL; vm_object_reference( old_entry->object.vm_object); @@ -4086,32 +4097,37 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c */ vm_object_deallocate(object); object = old_entry->object.vm_object; - } - VM_OBJECT_WLOCK(object); - vm_object_clear_flag(object, OBJ_ONEMAPPING); - if (old_entry->cred != NULL) { - KASSERT(object->cred == NULL, ("vmspace_fork both cred")); - object->cred = old_entry->cred; - object->charge = old_entry->end - old_entry->start; - old_entry->cred = NULL; - } + } else { + VM_OBJECT_WLOCK(object); + vm_object_clear_flag(object, OBJ_ONEMAPPING); + if (old_entry->cred != NULL) { + KASSERT(object->cred == NULL, + ("vmspace_fork both cred")); + object->cred = old_entry->cred; + object->charge = old_entry->end - + old_entry->start; + old_entry->cred = NULL; + } - /* - * Assert the correct state of the vnode - * v_writecount while the object is locked, to - * not relock it later for the assertion - * correctness. - */ - if (old_entry->eflags & MAP_ENTRY_WRITECNT && - object->type == OBJT_VNODE) { - KASSERT(((struct vnode *)object->handle)-> - v_writecount > 0, - ("vmspace_fork: v_writecount %p", object)); - KASSERT(object->un_pager.vnp.writemappings > 0, - ("vmspace_fork: vnp.writecount %p", - object)); + /* + * Assert the correct state of the vnode + * v_writecount while the object is locked, to + * not relock it later for the assertion + * correctness. + */ + if (old_entry->eflags & MAP_ENTRY_WRITECNT && + object->type == OBJT_VNODE) { + KASSERT(((struct vnode *)object-> + handle)->v_writecount > 0, + ("vmspace_fork: v_writecount %p", + object)); + KASSERT(object->un_pager.vnp. + writemappings > 0, + ("vmspace_fork: vnp.writecount %p", + object)); + } + VM_OBJECT_WUNLOCK(object); } - VM_OBJECT_WUNLOCK(object); /* * Clone the entry, referencing the shared object. @@ -4739,6 +4755,7 @@ RetryLookupLocked: if (*wired) fault_type = entry->protection; size = entry->end - entry->start; + /* * If the entry was copy-on-write, we either ... */ @@ -4775,24 +4792,18 @@ RetryLookupLocked: } entry->cred = cred; } - vm_object_shadow(&entry->object.vm_object, - &entry->offset, size); - entry->eflags &= ~MAP_ENTRY_NEEDS_COPY; eobject = entry->object.vm_object; - if (eobject->cred != NULL) { + vm_object_shadow(&entry->object.vm_object, + &entry->offset, size, entry->cred, false); + if (eobject == entry->object.vm_object) { /* * The object was not shadowed. */ swap_release_by_cred(size, entry->cred); crfree(entry->cred); - entry->cred = NULL; - } else if (entry->cred != NULL) { - VM_OBJECT_WLOCK(eobject); - eobject->cred = entry->cred; - eobject->charge = size; - VM_OBJECT_WUNLOCK(eobject); - entry->cred = NULL; } + entry->cred = NULL; + entry->eflags &= ~MAP_ENTRY_NEEDS_COPY; vm_map_lock_downgrade(map); } else { @@ -4807,19 +4818,13 @@ RetryLookupLocked: /* * Create an object if necessary. */ - if (entry->object.vm_object == NULL && - !map->system_map) { + if (entry->object.vm_object == NULL && !map->system_map) { if (vm_map_lock_upgrade(map)) goto RetryLookup; - entry->object.vm_object = vm_object_allocate_anon(atop(size)); + entry->object.vm_object = vm_object_allocate_anon(atop(size), + NULL, entry->cred, entry->cred != NULL ? size : 0); entry->offset = 0; - if (entry->cred != NULL) { - VM_OBJECT_WLOCK(entry->object.vm_object); - entry->object.vm_object->cred = entry->cred; - entry->object.vm_object->charge = size; - VM_OBJECT_WUNLOCK(entry->object.vm_object); - entry->cred = NULL; - } + entry->cred = NULL; vm_map_lock_downgrade(map); } Modified: head/sys/vm/vm_object.c ============================================================================== --- head/sys/vm/vm_object.c Sun Dec 1 20:35:41 2019 (r355269) +++ head/sys/vm/vm_object.c Sun Dec 1 20:43:04 2019 (r355270) @@ -241,7 +241,7 @@ vm_object_zinit(void *mem, int size, int flags) static void _vm_object_allocate(objtype_t type, vm_pindex_t size, u_short flags, - vm_object_t object) + vm_object_t object, void *handle) { TAILQ_INIT(&object->memq); @@ -268,7 +268,7 @@ _vm_object_allocate(objtype_t type, vm_pindex_t size, object->memattr = VM_MEMATTR_DEFAULT; object->cred = NULL; object->charge = 0; - object->handle = NULL; + object->handle = handle; object->backing_object = NULL; object->backing_object_offset = (vm_ooffset_t) 0; #if VM_NRESERVLEVEL > 0 @@ -290,7 +290,7 @@ vm_object_init(void) rw_init(&kernel_object->lock, "kernel vm object"); _vm_object_allocate(OBJT_PHYS, atop(VM_MAX_KERNEL_ADDRESS - - VM_MIN_KERNEL_ADDRESS), OBJ_UNMANAGED, kernel_object); + VM_MIN_KERNEL_ADDRESS), OBJ_UNMANAGED, kernel_object, NULL); #if VM_NRESERVLEVEL > 0 kernel_object->flags |= OBJ_COLORED; kernel_object->pg_color = (u_short)atop(VM_MIN_KERNEL_ADDRESS); @@ -434,7 +434,7 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) panic("vm_object_allocate: type %d is undefined", type); } object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); - _vm_object_allocate(type, size, flags, object); + _vm_object_allocate(type, size, flags, object, NULL); return (object); } @@ -447,14 +447,22 @@ vm_object_allocate(objtype_t type, vm_pindex_t size) * to be initialized by the caller. */ vm_object_t -vm_object_allocate_anon(vm_pindex_t size) +vm_object_allocate_anon(vm_pindex_t size, vm_object_t backing_object, + struct ucred *cred, vm_size_t charge) { - vm_object_t object; + vm_object_t handle, object; - object = (vm_object_t)uma_zalloc(obj_zone, M_WAITOK); + if (backing_object == NULL) + handle = NULL; + else if ((backing_object->flags & OBJ_ANON) != 0) + handle = backing_object->handle; + else + handle = backing_object; + object = uma_zalloc(obj_zone, M_WAITOK); _vm_object_allocate(OBJT_DEFAULT, size, OBJ_ANON | OBJ_ONEMAPPING, - object); - + object, handle); + object->cred = cred; + object->charge = cred != NULL ? charge : 0; return (object); } @@ -1308,10 +1316,8 @@ next_pindex: * are returned in the source parameters. */ void -vm_object_shadow( - vm_object_t *object, /* IN/OUT */ - vm_ooffset_t *offset, /* IN/OUT */ - vm_size_t length) +vm_object_shadow(vm_object_t *object, vm_ooffset_t *offset, vm_size_t length, + struct ucred *cred, bool shared) { vm_object_t source; vm_object_t result; @@ -1333,7 +1339,7 @@ vm_object_shadow( /* * Allocate a new object with the given length. */ - result = vm_object_allocate_anon(atop(length)); + result = vm_object_allocate_anon(atop(length), source, cred, length); /* * Store the offset into the source object, and fix up the offset into @@ -1341,25 +1347,37 @@ vm_object_shadow( */ result->backing_object_offset = *offset; - /* - * The new object shadows the source object, adding a reference to it. - * Our caller changes his reference to point to the new object, - * removing a reference to the source object. Net result: no change - * of reference count. - * - * Try to optimize the result object's page color when shadowing - * in order to maintain page coloring consistency in the combined - * shadowed object. - */ - if (source != NULL) { + if (shared || source != NULL) { VM_OBJECT_WLOCK(result); - vm_object_backing_insert(result, source); - result->domain = source->domain; + + /* + * The new object shadows the source object, adding a + * reference to it. Our caller changes his reference + * to point to the new object, removing a reference to + * the source object. Net result: no change of + * reference count, unless the caller needs to add one + * more reference due to forking a shared map entry. + */ + if (shared) { + vm_object_reference_locked(result); + vm_object_clear_flag(result, OBJ_ONEMAPPING); + } + + /* + * Try to optimize the result object's page color when + * shadowing in order to maintain page coloring + * consistency in the combined shadowed object. + */ + if (source != NULL) { + vm_object_backing_insert(result, source); + result->domain = source->domain; #if VM_NRESERVLEVEL > 0 - result->flags |= source->flags & OBJ_COLORED; - result->pg_color = (source->pg_color + OFF_TO_IDX(*offset)) & - ((1 << (VM_NFREEORDER - 1)) - 1); + result->flags |= source->flags & OBJ_COLORED; + result->pg_color = (source->pg_color + + OFF_TO_IDX(*offset)) & ((1 << (VM_NFREEORDER - + 1)) - 1); #endif + } VM_OBJECT_WUNLOCK(result); } @@ -1399,7 +1417,8 @@ vm_object_split(vm_map_entry_t entry) * If swap_pager_copy() is later called, it will convert new_object * into a swap object. */ - new_object = vm_object_allocate_anon(size); + new_object = vm_object_allocate_anon(size, orig_object, + orig_object->cred, ptoa(size)); /* * At this point, the new object is still private, so the order in @@ -1416,6 +1435,7 @@ vm_object_split(vm_map_entry_t entry) VM_OBJECT_WUNLOCK(source); VM_OBJECT_WUNLOCK(orig_object); VM_OBJECT_WUNLOCK(new_object); + new_object->cred = NULL; vm_object_deallocate(new_object); VM_OBJECT_WLOCK(orig_object); return; @@ -1432,9 +1452,7 @@ vm_object_split(vm_map_entry_t entry) orig_object->backing_object_offset + entry->offset; } if (orig_object->cred != NULL) { - new_object->cred = orig_object->cred; crhold(orig_object->cred); - new_object->charge = ptoa(size); KASSERT(orig_object->charge >= ptoa(size), ("orig_object->charge < 0")); orig_object->charge -= ptoa(size); Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Sun Dec 1 20:35:41 2019 (r355269) +++ head/sys/vm/vm_object.h Sun Dec 1 20:43:04 2019 (r355270) @@ -341,7 +341,8 @@ void umtx_shm_object_terminated(vm_object_t object); extern int umtx_shm_vnobj_persistent; vm_object_t vm_object_allocate (objtype_t, vm_pindex_t); -vm_object_t vm_object_allocate_anon(vm_pindex_t); +vm_object_t vm_object_allocate_anon(vm_pindex_t, vm_object_t, struct ucred *, + vm_size_t); boolean_t vm_object_coalesce(vm_object_t, vm_ooffset_t, vm_size_t, vm_size_t, boolean_t); void vm_object_collapse (vm_object_t); @@ -363,7 +364,8 @@ void vm_object_print(long addr, boolean_t have_addr, l void vm_object_reference (vm_object_t); void vm_object_reference_locked(vm_object_t); int vm_object_set_memattr(vm_object_t object, vm_memattr_t memattr); -void vm_object_shadow (vm_object_t *, vm_ooffset_t *, vm_size_t); +void vm_object_shadow(vm_object_t *, vm_ooffset_t *, vm_size_t, struct ucred *, + bool); void vm_object_split(vm_map_entry_t); boolean_t vm_object_sync(vm_object_t, vm_ooffset_t, vm_size_t, boolean_t, boolean_t); From owner-svn-src-all@freebsd.org Sun Dec 1 20:43:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CCA71B7A81; Sun, 1 Dec 2019 20:43:40 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R0Zh1NW0z4FHP; Sun, 1 Dec 2019 20:43:40 +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 123BF1C544; Sun, 1 Dec 2019 20:43:40 +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 xB1KhdUT024564; Sun, 1 Dec 2019 20:43:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1KhcCa024554; Sun, 1 Dec 2019 20:43:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912012043.xB1KhcCa024554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 1 Dec 2019 20:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355271 - in head/sys: arm/samsung/exynos arm/versatile arm/xilinx dev/gpio dev/quicc dev/rp powerpc/psim X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys: arm/samsung/exynos arm/versatile arm/xilinx dev/gpio dev/quicc dev/rp powerpc/psim X-SVN-Commit-Revision: 355271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 20:43:40 -0000 Author: kevans Date: Sun Dec 1 20:43:37 2019 New Revision: 355271 URL: https://svnweb.freebsd.org/changeset/base/355271 Log: Remove more needless includes As part of my journey to make it easy to determine what's relying on tty bits, remove a couple more. Some of these just outright didn't need it, while others did rely on pollution for mutex headers. Modified: head/sys/arm/samsung/exynos/chrome_kb.c head/sys/arm/samsung/exynos/exynos_uart.c head/sys/arm/versatile/pl050.c head/sys/arm/xilinx/uart_dev_cdnc.c head/sys/dev/gpio/gpiokeys.c head/sys/dev/quicc/quicc_bfe_fdt.c head/sys/dev/rp/rp_isa.c head/sys/dev/rp/rp_pci.c head/sys/powerpc/psim/uart_iobus.c Modified: head/sys/arm/samsung/exynos/chrome_kb.c ============================================================================== --- head/sys/arm/samsung/exynos/chrome_kb.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/arm/samsung/exynos/chrome_kb.c Sun Dec 1 20:43:37 2019 (r355271) @@ -52,7 +52,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/samsung/exynos/exynos_uart.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos_uart.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/arm/samsung/exynos/exynos_uart.c Sun Dec 1 20:43:37 2019 (r355271) @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include Modified: head/sys/arm/versatile/pl050.c ============================================================================== --- head/sys/arm/versatile/pl050.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/arm/versatile/pl050.c Sun Dec 1 20:43:37 2019 (r355271) @@ -35,8 +35,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -52,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/arm/xilinx/uart_dev_cdnc.c ============================================================================== --- head/sys/arm/xilinx/uart_dev_cdnc.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/arm/xilinx/uart_dev_cdnc.c Sun Dec 1 20:43:37 2019 (r355271) @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/gpio/gpiokeys.c ============================================================================== --- head/sys/dev/gpio/gpiokeys.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/dev/gpio/gpiokeys.c Sun Dec 1 20:43:37 2019 (r355271) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include Modified: head/sys/dev/quicc/quicc_bfe_fdt.c ============================================================================== --- head/sys/dev/quicc/quicc_bfe_fdt.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/dev/quicc/quicc_bfe_fdt.c Sun Dec 1 20:43:37 2019 (r355271) @@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/rp/rp_isa.c ============================================================================== --- head/sys/dev/rp/rp_isa.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/dev/rp/rp_isa.c Sun Dec 1 20:43:37 2019 (r355271) @@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #include +#include #include #include #include Modified: head/sys/dev/rp/rp_pci.c ============================================================================== --- head/sys/dev/rp/rp_pci.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/dev/rp/rp_pci.c Sun Dec 1 20:43:37 2019 (r355271) @@ -42,10 +42,11 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include +#include #include +#include #include #include #include Modified: head/sys/powerpc/psim/uart_iobus.c ============================================================================== --- head/sys/powerpc/psim/uart_iobus.c Sun Dec 1 20:43:04 2019 (r355270) +++ head/sys/powerpc/psim/uart_iobus.c Sun Dec 1 20:43:37 2019 (r355271) @@ -42,7 +42,6 @@ #include #include #include -#include #include #include From owner-svn-src-all@freebsd.org Sun Dec 1 20:45:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BD751B7BAC; Sun, 1 Dec 2019 20:45:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R0d86vzFz4FTG; Sun, 1 Dec 2019 20:45:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1B481C55D; Sun, 1 Dec 2019 20:45:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1KjmXd024726; Sun, 1 Dec 2019 20:45:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1KjmhG024725; Sun, 1 Dec 2019 20:45:48 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912012045.xB1KjmhG024725@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 20:45:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355272 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 355272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 20:45:49 -0000 Author: tuexen Date: Sun Dec 1 20:45:48 2019 New Revision: 355272 URL: https://svnweb.freebsd.org/changeset/base/355272 Log: Make the TF_* flags easier readable by humans by adding leading zeroes to make them aligned. Submitted by: Richard Scheffenegger Reviewed by: rgrimes@, rrs@, tuexen@ Differential Revision: https://reviews.freebsd.org/D22428 Modified: head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Dec 1 20:43:37 2019 (r355271) +++ head/sys/netinet/tcp_var.h Sun Dec 1 20:45:48 2019 (r355272) @@ -312,32 +312,32 @@ TAILQ_HEAD(tcp_funchead, tcp_function); /* * Flags and utility macros for the t_flags field. */ -#define TF_ACKNOW 0x000001 /* ack peer immediately */ -#define TF_DELACK 0x000002 /* ack, but try to delay it */ -#define TF_NODELAY 0x000004 /* don't delay packets to coalesce */ -#define TF_NOOPT 0x000008 /* don't use tcp options */ -#define TF_SENTFIN 0x000010 /* have sent FIN */ -#define TF_REQ_SCALE 0x000020 /* have/will request window scaling */ -#define TF_RCVD_SCALE 0x000040 /* other side has requested scaling */ -#define TF_REQ_TSTMP 0x000080 /* have/will request timestamps */ -#define TF_RCVD_TSTMP 0x000100 /* a timestamp was received in SYN */ -#define TF_SACK_PERMIT 0x000200 /* other side said I could SACK */ -#define TF_NEEDSYN 0x000400 /* send SYN (implicit state) */ -#define TF_NEEDFIN 0x000800 /* send FIN (implicit state) */ -#define TF_NOPUSH 0x001000 /* don't push */ -#define TF_PREVVALID 0x002000 /* saved values for bad rxmit valid */ -#define TF_MORETOCOME 0x010000 /* More data to be appended to sock */ -#define TF_LQ_OVERFLOW 0x020000 /* listen queue overflow */ -#define TF_LASTIDLE 0x040000 /* connection was previously idle */ -#define TF_RXWIN0SENT 0x080000 /* sent a receiver win 0 in response */ -#define TF_FASTRECOVERY 0x100000 /* in NewReno Fast Recovery */ -#define TF_WASFRECOVERY 0x200000 /* was in NewReno Fast Recovery */ -#define TF_SIGNATURE 0x400000 /* require MD5 digests (RFC2385) */ -#define TF_FORCEDATA 0x800000 /* force out a byte */ -#define TF_TSO 0x1000000 /* TSO enabled on this connection */ -#define TF_TOE 0x2000000 /* this connection is offloaded */ -#define TF_ECN_PERMIT 0x4000000 /* connection ECN-ready */ -#define TF_ECN_SND_CWR 0x8000000 /* ECN CWR in queue */ +#define TF_ACKNOW 0x00000001 /* ack peer immediately */ +#define TF_DELACK 0x00000002 /* ack, but try to delay it */ +#define TF_NODELAY 0x00000004 /* don't delay packets to coalesce */ +#define TF_NOOPT 0x00000008 /* don't use tcp options */ +#define TF_SENTFIN 0x00000010 /* have sent FIN */ +#define TF_REQ_SCALE 0x00000020 /* have/will request window scaling */ +#define TF_RCVD_SCALE 0x00000040 /* other side has requested scaling */ +#define TF_REQ_TSTMP 0x00000080 /* have/will request timestamps */ +#define TF_RCVD_TSTMP 0x00000100 /* a timestamp was received in SYN */ +#define TF_SACK_PERMIT 0x00000200 /* other side said I could SACK */ +#define TF_NEEDSYN 0x00000400 /* send SYN (implicit state) */ +#define TF_NEEDFIN 0x00000800 /* send FIN (implicit state) */ +#define TF_NOPUSH 0x00001000 /* don't push */ +#define TF_PREVVALID 0x00002000 /* saved values for bad rxmit valid */ +#define TF_MORETOCOME 0x00010000 /* More data to be appended to sock */ +#define TF_LQ_OVERFLOW 0x00020000 /* listen queue overflow */ +#define TF_LASTIDLE 0x00040000 /* connection was previously idle */ +#define TF_RXWIN0SENT 0x00080000 /* sent a receiver win 0 in response */ +#define TF_FASTRECOVERY 0x00100000 /* in NewReno Fast Recovery */ +#define TF_WASFRECOVERY 0x00200000 /* was in NewReno Fast Recovery */ +#define TF_SIGNATURE 0x00400000 /* require MD5 digests (RFC2385) */ +#define TF_FORCEDATA 0x00800000 /* force out a byte */ +#define TF_TSO 0x01000000 /* TSO enabled on this connection */ +#define TF_TOE 0x02000000 /* this connection is offloaded */ +#define TF_ECN_PERMIT 0x04000000 /* connection ECN-ready */ +#define TF_ECN_SND_CWR 0x08000000 /* ECN CWR in queue */ #define TF_ECN_SND_ECE 0x10000000 /* ECN ECE in queue */ #define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ #define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */ From owner-svn-src-all@freebsd.org Sun Dec 1 21:01:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0167A1B901A; Sun, 1 Dec 2019 21:01:36 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R0zM6Hlbz4GxH; Sun, 1 Dec 2019 21:01:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBCF91C9FA; Sun, 1 Dec 2019 21:01:35 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1L1ZRk035039; Sun, 1 Dec 2019 21:01:35 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1L1Y8S035032; Sun, 1 Dec 2019 21:01:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201912012101.xB1L1Y8S035032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 1 Dec 2019 21:01:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355273 - in head/sys/netinet: . cc tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys/netinet: . cc tcp_stacks X-SVN-Commit-Revision: 355273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 21:01:36 -0000 Author: tuexen Date: Sun Dec 1 21:01:33 2019 New Revision: 355273 URL: https://svnweb.freebsd.org/changeset/base/355273 Log: Move all ECN related flags from the flags to the flags2 field. This allows adding more ECN related flags in the future. No functional change intended. Submitted by: Richard Scheffenegger Reviewed by: rrs@, tuexen@ Differential Revision: https://reviews.freebsd.org/D22497 Modified: head/sys/netinet/cc/cc_dctcp.c head/sys/netinet/tcp_input.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_stacks/rack.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/cc/cc_dctcp.c ============================================================================== --- head/sys/netinet/cc/cc_dctcp.c Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/cc/cc_dctcp.c Sun Dec 1 21:01:33 2019 (r355273) @@ -109,7 +109,7 @@ dctcp_ack_received(struct cc_var *ccv, uint16_t type) dctcp_data = ccv->cc_data; - if (CCV(ccv, t_flags) & TF_ECN_PERMIT) { + if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) { /* * DCTCP doesn't treat receipt of ECN marked packet as a * congestion event. Thus, DCTCP always executes the ACK @@ -168,7 +168,7 @@ dctcp_after_idle(struct cc_var *ccv) { struct dctcp *dctcp_data; - if (CCV(ccv, t_flags) & TF_ECN_PERMIT) { + if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) { dctcp_data = ccv->cc_data; /* Initialize internal parameters after idle time */ @@ -234,7 +234,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) struct dctcp *dctcp_data; u_int cwin, mss; - if (CCV(ccv, t_flags) & TF_ECN_PERMIT) { + if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) { dctcp_data = ccv->cc_data; cwin = CCV(ccv, snd_cwnd); mss = CCV(ccv, t_maxseg); @@ -284,7 +284,7 @@ dctcp_cong_signal(struct cc_var *ccv, uint32_t type) dctcp_data->ece_curr = 1; break; case CC_RTO: - CCV(ccv, t_flags) |= TF_ECN_SND_CWR; + CCV(ccv, t_flags2) |= TF2_ECN_SND_CWR; dctcp_update_alpha(ccv); dctcp_data->save_sndnxt += CCV(ccv, t_maxseg); dctcp_data->num_cong_events++; @@ -301,7 +301,7 @@ dctcp_conn_init(struct cc_var *ccv) dctcp_data = ccv->cc_data; - if (CCV(ccv, t_flags) & TF_ECN_PERMIT) + if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); } @@ -313,7 +313,7 @@ dctcp_post_recovery(struct cc_var *ccv) { newreno_cc_algo.post_recovery(ccv); - if (CCV(ccv, t_flags) & TF_ECN_PERMIT) + if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) dctcp_update_alpha(ccv); } @@ -344,12 +344,12 @@ dctcp_ecnpkt_handler(struct cc_var *ccv) if (!dctcp_data->ce_prev && (ccflag & CCF_DELACK)) delay_ack = 0; dctcp_data->ce_prev = 1; - CCV(ccv, t_flags) |= TF_ECN_SND_ECE; + CCV(ccv, t_flags2) |= TF2_ECN_SND_ECE; } else { if (dctcp_data->ce_prev && (ccflag & CCF_DELACK)) delay_ack = 0; dctcp_data->ce_prev = 0; - CCV(ccv, t_flags) &= ~TF_ECN_SND_ECE; + CCV(ccv, t_flags2) &= ~TF2_ECN_SND_ECE; } /* DCTCP sets delayed ack when this segment sets the CWR flag. */ Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/tcp_input.c Sun Dec 1 21:01:33 2019 (r355273) @@ -397,16 +397,16 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui case CC_NDUPACK: if (!IN_FASTRECOVERY(tp->t_flags)) { tp->snd_recover = tp->snd_max; - if (tp->t_flags & TF_ECN_PERMIT) - tp->t_flags |= TF_ECN_SND_CWR; + if (tp->t_flags2 & TF2_ECN_PERMIT) + tp->t_flags2 |= TF2_ECN_SND_CWR; } break; case CC_ECN: if (!IN_CONGRECOVERY(tp->t_flags)) { TCPSTAT_INC(tcps_ecn_rcwnd); tp->snd_recover = tp->snd_max; - if (tp->t_flags & TF_ECN_PERMIT) - tp->t_flags |= TF_ECN_SND_CWR; + if (tp->t_flags2 & TF2_ECN_PERMIT) + tp->t_flags2 |= TF2_ECN_SND_CWR; } break; case CC_RTO: @@ -1500,12 +1500,12 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru /* * TCP ECN processing. */ - if (tp->t_flags & TF_ECN_PERMIT) { + if (tp->t_flags2 & TF2_ECN_PERMIT) { if (thflags & TH_CWR) - tp->t_flags &= ~TF_ECN_SND_ECE; + tp->t_flags2 &= ~TF2_ECN_SND_ECE; switch (iptos & IPTOS_ECN_MASK) { case IPTOS_ECN_CE: - tp->t_flags |= TF_ECN_SND_ECE; + tp->t_flags2 |= TF2_ECN_SND_ECE; TCPSTAT_INC(tcps_ecn_ce); break; case IPTOS_ECN_ECT0: @@ -1934,7 +1934,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) && V_tcp_do_ecn) { - tp->t_flags |= TF_ECN_PERMIT; + tp->t_flags2 |= TF2_ECN_PERMIT; TCPSTAT_INC(tcps_ecn_shs); } Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/tcp_output.c Sun Dec 1 21:01:33 2019 (r355273) @@ -1135,7 +1135,7 @@ send: } if (tp->t_state == TCPS_ESTABLISHED && - (tp->t_flags & TF_ECN_PERMIT)) { + (tp->t_flags2 & TF2_ECN_PERMIT)) { /* * If the peer has ECN, mark data packets with * ECN capable transmission (ECT). @@ -1155,11 +1155,11 @@ send: /* * Reply with proper ECN notifications. */ - if (tp->t_flags & TF_ECN_SND_CWR) { + if (tp->t_flags2 & TF2_ECN_SND_CWR) { flags |= TH_CWR; - tp->t_flags &= ~TF_ECN_SND_CWR; + tp->t_flags2 &= ~TF2_ECN_SND_CWR; } - if (tp->t_flags & TF_ECN_SND_ECE) + if (tp->t_flags2 & TF2_ECN_SND_ECE) flags |= TH_ECE; } Modified: head/sys/netinet/tcp_stacks/rack.c ============================================================================== --- head/sys/netinet/tcp_stacks/rack.c Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/tcp_stacks/rack.c Sun Dec 1 21:01:33 2019 (r355273) @@ -1811,16 +1811,16 @@ rack_cong_signal(struct tcpcb *tp, struct tcphdr *th, rack_log_to_prr(rack, 2); rack->r_ctl.rc_prr_recovery_fs = tp->snd_max - tp->snd_una; tp->snd_recover = tp->snd_max; - if (tp->t_flags & TF_ECN_PERMIT) - tp->t_flags |= TF_ECN_SND_CWR; + if (tp->t_flags2 & TF2_ECN_PERMIT) + tp->t_flags2 |= TF2_ECN_SND_CWR; } break; case CC_ECN: if (!IN_CONGRECOVERY(tp->t_flags)) { TCPSTAT_INC(tcps_ecn_rcwnd); tp->snd_recover = tp->snd_max; - if (tp->t_flags & TF_ECN_PERMIT) - tp->t_flags |= TF_ECN_SND_CWR; + if (tp->t_flags2 & TF2_ECN_PERMIT) + tp->t_flags2 |= TF2_ECN_SND_CWR; } break; case CC_RTO: @@ -6309,7 +6309,7 @@ rack_do_syn_sent(struct mbuf *m, struct tcphdr *th, st if (((thflags & (TH_CWR | TH_ECE)) == TH_ECE) && V_tcp_do_ecn) { - tp->t_flags |= TF_ECN_PERMIT; + tp->t_flags2 |= TF2_ECN_PERMIT; TCPSTAT_INC(tcps_ecn_shs); } if (SEQ_GT(th->th_ack, tp->snd_una)) { @@ -7710,12 +7710,12 @@ rack_do_segment_nounlock(struct mbuf *m, struct tcphdr * TCP ECN processing. XXXJTL: If we ever use ECN, we need to move * this to occur after we've validated the segment. */ - if (tp->t_flags & TF_ECN_PERMIT) { + if (tp->t_flags2 & TF2_ECN_PERMIT) { if (thflags & TH_CWR) - tp->t_flags &= ~TF_ECN_SND_ECE; + tp->t_flags2 &= ~TF2_ECN_SND_ECE; switch (iptos & IPTOS_ECN_MASK) { case IPTOS_ECN_CE: - tp->t_flags |= TF_ECN_SND_ECE; + tp->t_flags2 |= TF2_ECN_SND_ECE; TCPSTAT_INC(tcps_ecn_ce); break; case IPTOS_ECN_ECT0: @@ -9472,7 +9472,7 @@ send: flags |= TH_ECE | TH_CWR; } if (tp->t_state == TCPS_ESTABLISHED && - (tp->t_flags & TF_ECN_PERMIT)) { + (tp->t_flags2 & TF2_ECN_PERMIT)) { /* * If the peer has ECN, mark data packets with ECN capable * transmission (ECT). Ignore pure ack packets, @@ -9491,11 +9491,11 @@ send: /* * Reply with proper ECN notifications. */ - if (tp->t_flags & TF_ECN_SND_CWR) { + if (tp->t_flags2 & TF2_ECN_SND_CWR) { flags |= TH_CWR; - tp->t_flags &= ~TF_ECN_SND_CWR; + tp->t_flags2 &= ~TF2_ECN_SND_CWR; } - if (tp->t_flags & TF_ECN_SND_ECE) + if (tp->t_flags2 & TF2_ECN_SND_ECE) flags |= TH_ECE; } /* Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/tcp_syncache.c Sun Dec 1 21:01:33 2019 (r355273) @@ -1023,7 +1023,7 @@ syncache_socket(struct syncache *sc, struct socket *ls } if (sc->sc_flags & SCF_ECN) - tp->t_flags |= TF_ECN_PERMIT; + tp->t_flags2 |= TF2_ECN_PERMIT; /* * Set up MSS and get cached values from tcp_hostcache. Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/tcp_usrreq.c Sun Dec 1 21:01:33 2019 (r355273) @@ -1572,7 +1572,7 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti) ti->tcpi_snd_wscale = tp->snd_scale; ti->tcpi_rcv_wscale = tp->rcv_scale; } - if (tp->t_flags & TF_ECN_PERMIT) + if (tp->t_flags2 & TF2_ECN_PERMIT) ti->tcpi_options |= TCPI_OPT_ECN; ti->tcpi_rto = tp->t_rxtcur * tick; @@ -2610,10 +2610,6 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_TSO", comma ? ", " : ""); comma = 1; } - if (t_flags & TF_ECN_PERMIT) { - db_printf("%sTF_ECN_PERMIT", comma ? ", " : ""); - comma = 1; - } if (t_flags & TF_FASTOPEN) { db_printf("%sTF_FASTOPEN", comma ? ", " : ""); comma = 1; @@ -2621,6 +2617,19 @@ db_print_tflags(u_int t_flags) } static void +db_print_tflags2(u_int t_flags2) +{ + int comma; + + comma = 0; + if (t_flags2 & TF2_ECN_PERMIT) { + db_printf("%sTF2_ECN_PERMIT", comma ? ", " : ""); + comma = 1; + } +} + + +static void db_print_toobflags(char t_oobflags) { int comma; @@ -2665,6 +2674,11 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int db_print_indent(indent); db_printf("t_flags: 0x%x (", tp->t_flags); db_print_tflags(tp->t_flags); + db_printf(")\n"); + + db_print_indent(indent); + db_printf("t_flags2: 0x%x (", tp->t_flags2); + db_print_tflags2(tp->t_flags2); db_printf(")\n"); db_print_indent(indent); Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Sun Dec 1 20:45:48 2019 (r355272) +++ head/sys/netinet/tcp_var.h Sun Dec 1 21:01:33 2019 (r355273) @@ -326,6 +326,8 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_NEEDFIN 0x00000800 /* send FIN (implicit state) */ #define TF_NOPUSH 0x00001000 /* don't push */ #define TF_PREVVALID 0x00002000 /* saved values for bad rxmit valid */ +#define TF_UNUSED1 0x00004000 /* unused */ +#define TF_UNUSED2 0x00008000 /* unused */ #define TF_MORETOCOME 0x00010000 /* More data to be appended to sock */ #define TF_LQ_OVERFLOW 0x00020000 /* listen queue overflow */ #define TF_LASTIDLE 0x00040000 /* connection was previously idle */ @@ -336,9 +338,9 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_FORCEDATA 0x00800000 /* force out a byte */ #define TF_TSO 0x01000000 /* TSO enabled on this connection */ #define TF_TOE 0x02000000 /* this connection is offloaded */ -#define TF_ECN_PERMIT 0x04000000 /* connection ECN-ready */ -#define TF_ECN_SND_CWR 0x08000000 /* ECN CWR in queue */ -#define TF_ECN_SND_ECE 0x10000000 /* ECN ECE in queue */ +#define TF_UNUSED3 0x04000000 /* unused */ +#define TF_UNUSED4 0x08000000 /* unused */ +#define TF_UNUSED5 0x10000000 /* unused */ #define TF_CONGRECOVERY 0x20000000 /* congestion recovery mode */ #define TF_WASCRECOVERY 0x40000000 /* was in congestion recovery */ #define TF_FASTOPEN 0x80000000 /* TCP Fast Open indication */ @@ -377,6 +379,10 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF2_PLPMTU_MAXSEGSNT 0x00000004 /* Last seg sent was full seg. */ #define TF2_LOG_AUTO 0x00000008 /* Session is auto-logging. */ #define TF2_DROP_AF_DATA 0x00000010 /* Drop after all data ack'd */ +#define TF2_ECN_PERMIT 0x00000020 /* connection ECN-ready */ +#define TF2_ECN_SND_CWR 0x00000040 /* ECN CWR in queue */ +#define TF2_ECN_SND_ECE 0x00000080 /* ECN ECE in queue */ +#define TF2_ACE_PERMIT 0x00000100 /* Accurate ECN mode */ /* * Structure to hold TCP options that are only used during segment From owner-svn-src-all@freebsd.org Sun Dec 1 21:27:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EB731B9E8B; Sun, 1 Dec 2019 21:27:11 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R1Xt6Zbcz4J9y; Sun, 1 Dec 2019 21:27:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0B111CE31; Sun, 1 Dec 2019 21:27:10 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1LRAGW048581; Sun, 1 Dec 2019 21:27:10 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1LRAMj048575; Sun, 1 Dec 2019 21:27:10 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912012127.xB1LRAMj048575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 1 Dec 2019 21:27:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355274 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 355274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 21:27:11 -0000 Author: ian Date: Sun Dec 1 21:27:09 2019 New Revision: 355274 URL: https://svnweb.freebsd.org/changeset/base/355274 Log: Move most of the gpio_pin_* functions from ofw_gpiobus.c to gpiobus.c so that they can be used by drivers on non-FDT-configured systems. Only the functions related to acquiring pins by parsing FDT data remain in ofw_gpiobus. Also, add two new functions for acquiring gpio pins based on child device_t and index, or on the bus device_t and pin number. And finally, defer reserving pins for gpiobus children until they acquire the pin, rather than reserving them as soon as the child is added (before it's even known whether the child will attach). This will allow drivers configured with hints (or any other mechanism) to use the same code as drivers configured via FDT data. Until now, a hinted driver and an FDT driver had to be two completely different sets of code, because hinted drivers could only use gpiobus calls to manipulate pins, while fdt-configured drivers could not use that API (due to not always being children of the bus that owns the pins) and had to use the newer gpio_pin_xxxx() functions. Now drivers can be written in the more traditional form, where most of the code is shared and only the resource acquisition code at attachment time changes. Modified: head/sys/dev/gpio/gpiobus.c head/sys/dev/gpio/gpiobusvar.h head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Sun Dec 1 21:01:33 2019 (r355273) +++ head/sys/dev/gpio/gpiobus.c Sun Dec 1 21:27:09 2019 (r355274) @@ -77,6 +77,8 @@ static int gpiobus_pin_set(device_t, device_t, uint32_ static int gpiobus_pin_get(device_t, device_t, uint32_t, unsigned int*); static int gpiobus_pin_toggle(device_t, device_t, uint32_t); +#define GPIO_ACTIVE_LOW 1 /* XXX Note that nothing currently sets this flag */ + /* * XXX -> Move me to better place - gpio_subr.c? * Also, this function must be changed when interrupt configuration @@ -135,6 +137,114 @@ gpio_check_flags(uint32_t caps, uint32_t flags) return (0); } +int +gpio_pin_get_by_bus_pinnum(device_t busdev, uint32_t pinnum, gpio_pin_t *ppin) +{ + gpio_pin_t pin; + int err; + + err = gpiobus_acquire_pin(busdev, pinnum); + if (err != 0) + return (EBUSY); + + pin = malloc(sizeof(*pin), M_DEVBUF, M_WAITOK | M_ZERO); + + pin->dev = device_get_parent(busdev); + pin->pin = pinnum; + GPIO_PIN_GETFLAGS(pin->dev, pin->pin, &pin->flags); + + *ppin = pin; + return (0); +} + +int +gpio_pin_get_by_child_index(device_t childdev, uint32_t idx, gpio_pin_t *ppin) +{ + struct gpiobus_ivar *devi; + + devi = GPIOBUS_IVAR(childdev); + if (idx >= devi->npins) + return (EINVAL); + + return (gpio_pin_get_by_bus_pinnum(device_get_parent(childdev), + devi->pins[idx], ppin)); +} + +int +gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps) +{ + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps)); +} + +int +gpio_pin_is_active(gpio_pin_t pin, bool *active) +{ + int rv; + uint32_t tmp; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + rv = GPIO_PIN_GET(pin->dev, pin->pin, &tmp); + if (rv != 0) { + return (rv); + } + + if (pin->flags & GPIO_ACTIVE_LOW) + *active = tmp == 0; + else + *active = tmp != 0; + return (0); +} + +void +gpio_pin_release(gpio_pin_t gpio) +{ + device_t busdev; + + if (gpio == NULL) + return; + + KASSERT(gpio->dev != NULL, ("GPIO pin device is NULL.")); + + busdev = GPIO_GET_BUS(gpio->dev); + if (busdev != NULL) + gpiobus_release_pin(busdev, gpio->pin); + + free(gpio, M_DEVBUF); +} + +int +gpio_pin_set_active(gpio_pin_t pin, bool active) +{ + int rv; + uint32_t tmp; + + if (pin->flags & GPIO_ACTIVE_LOW) + tmp = active ? 0 : 1; + else + tmp = active ? 1 : 0; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + rv = GPIO_PIN_SET(pin->dev, pin->pin, tmp); + return (rv); +} + +int +gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) +{ + int rv; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + + rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags); + return (rv); +} + static void gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen) { @@ -370,8 +480,6 @@ gpiobus_parse_pins(struct gpiobus_softc *sc, device_t devi->pins[npins++] = i; } - if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) - return (EINVAL); return (0); } @@ -425,8 +533,6 @@ gpiobus_parse_pin_list(struct gpiobus_softc *sc, devic p = endp + 1; } - if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) - return (EINVAL); return (0); } Modified: head/sys/dev/gpio/gpiobusvar.h ============================================================================== --- head/sys/dev/gpio/gpiobusvar.h Sun Dec 1 21:01:33 2019 (r355273) +++ head/sys/dev/gpio/gpiobusvar.h Sun Dec 1 21:27:09 2019 (r355274) @@ -141,7 +141,7 @@ int ofw_gpiobus_parse_gpios(device_t, char *, struct g void ofw_gpiobus_register_provider(device_t); void ofw_gpiobus_unregister_provider(device_t); -/* Consumers interface. */ +/* Acquire a pin by parsing FDT data. */ int gpio_pin_get_by_ofw_name(device_t consumer, phandle_t node, char *name, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t node, @@ -150,14 +150,29 @@ int gpio_pin_get_by_ofw_property(device_t consumer, ph char *name, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t node, char *name, int idx, gpio_pin_t *gpio); +#endif /* FDT */ + +/* Acquire a pin by bus and pin number. */ +int gpio_pin_get_by_bus_pinnum(device_t _bus, uint32_t _pinnum, gpio_pin_t *_gp); + +/* Acquire a pin by child and index (used by direct children of gpiobus). */ +int gpio_pin_get_by_child_index(device_t _child, uint32_t _idx, gpio_pin_t *_gp); + +/* Release a pin acquired via any gpio_pin_get_xxx() function. */ void gpio_pin_release(gpio_pin_t gpio); + +/* Work with gpio pins acquired using the functions above. */ int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps); int gpio_pin_is_active(gpio_pin_t pin, bool *active); int gpio_pin_set_active(gpio_pin_t pin, bool active); int gpio_pin_setflags(gpio_pin_t pin, uint32_t flags); -#endif struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, gpio_pin_t pin, uint32_t intr_mode); + +/* + * Functions shared between gpiobus and other bus classes that derive from it; + * these should not be called directly by other drivers. + */ int gpio_check_flags(uint32_t, uint32_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t); Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Sun Dec 1 21:01:33 2019 (r355273) +++ head/sys/dev/gpio/ofw_gpiobus.c Sun Dec 1 21:27:09 2019 (r355274) @@ -43,8 +43,6 @@ __FBSDID("$FreeBSD$"); #include "gpiobus_if.h" -#define GPIO_ACTIVE_LOW 1 - static struct ofw_gpiobus_devinfo *ofw_gpiobus_setup_devinfo(device_t, device_t, phandle_t); static void ofw_gpiobus_destroy_devinfo(device_t, struct ofw_gpiobus_devinfo *); @@ -138,82 +136,6 @@ gpio_pin_get_by_ofw_name(device_t consumer, phandle_t if (rv != 0) return (rv); return (gpio_pin_get_by_ofw_idx(consumer, node, idx, pin)); -} - -void -gpio_pin_release(gpio_pin_t gpio) -{ - device_t busdev; - - if (gpio == NULL) - return; - - KASSERT(gpio->dev != NULL, ("invalid pin state")); - - busdev = GPIO_GET_BUS(gpio->dev); - if (busdev != NULL) - gpiobus_release_pin(busdev, gpio->pin); - - /* XXXX Unreserve pin. */ - free(gpio, M_DEVBUF); -} - -int -gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps) -{ - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps)); -} - -int -gpio_pin_is_active(gpio_pin_t pin, bool *active) -{ - int rv; - uint32_t tmp; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - rv = GPIO_PIN_GET(pin->dev, pin->pin, &tmp); - if (rv != 0) { - return (rv); - } - - if (pin->flags & GPIO_ACTIVE_LOW) - *active = tmp == 0; - else - *active = tmp != 0; - return (0); -} - -int -gpio_pin_set_active(gpio_pin_t pin, bool active) -{ - int rv; - uint32_t tmp; - - if (pin->flags & GPIO_ACTIVE_LOW) - tmp = active ? 0 : 1; - else - tmp = active ? 1 : 0; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - rv = GPIO_PIN_SET(pin->dev, pin->pin, tmp); - return (rv); -} - -int -gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) -{ - int rv; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - - rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags); - return (rv); } /* From owner-svn-src-all@freebsd.org Sun Dec 1 21:29:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 386901B9F68; Sun, 1 Dec 2019 21:29:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R1bg0h95z4JKJ; Sun, 1 Dec 2019 21:29:35 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE8C61CE3E; Sun, 1 Dec 2019 21:29:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1LTYDO048790; Sun, 1 Dec 2019 21:29:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1LTYMl048789; Sun, 1 Dec 2019 21:29:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912012129.xB1LTYMl048789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 1 Dec 2019 21:29:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355275 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 355275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 21:29:35 -0000 Author: jhibbits Date: Sun Dec 1 21:29:34 2019 New Revision: 355275 URL: https://svnweb.freebsd.org/changeset/base/355275 Log: powerpc: Add 'show frame ' to show an arbitrary trap frame This lets us print, for example, the user's trap frame when a panic occurs. The frame address is given in the backtrace at the trap point, which can then be passed to 'show frame'. This is useful for debugging as it can show inputs that lead to a panic or fault. It can also be used to print trap frames from other CPUs that get stuck. i386 already has a similar command, but no others do. Modified: head/sys/powerpc/powerpc/machdep.c Modified: head/sys/powerpc/powerpc/machdep.c ============================================================================== --- head/sys/powerpc/powerpc/machdep.c Sun Dec 1 21:27:09 2019 (r355274) +++ head/sys/powerpc/powerpc/machdep.c Sun Dec 1 21:29:34 2019 (r355275) @@ -557,6 +557,50 @@ DB_SHOW_COMMAND(spr, db_show_spr) db_printf("SPR %d(%x): %lx\n", saved_sprno, saved_sprno, (unsigned long)spr); } + +DB_SHOW_COMMAND(frame, db_show_frame) +{ + struct trapframe *tf; + long reg; + int i; + + tf = have_addr ? (struct trapframe *)addr : curthread->td_frame; + + /* + * Everything casts through long to simplify the printing. + * 'long' is native register size anyway. + */ + db_printf("trap frame %p\n", tf); + for (i = 0; i < nitems(tf->fixreg); i++) { + reg = tf->fixreg[i]; + db_printf(" r%d:\t%#lx (%ld)\n", i, reg, reg); + } + reg = tf->lr; + db_printf(" lr:\t%#lx\n", reg); + reg = tf->cr; + db_printf(" cr:\t%#lx\n", reg); + reg = tf->xer; + db_printf(" xer:\t%#lx\n", reg); + reg = tf->ctr; + db_printf(" ctr:\t%#lx (%ld)\n", reg, reg); + reg = tf->srr0; + db_printf(" srr0:\t%#lx\n", reg); + reg = tf->srr1; + db_printf(" srr1:\t%#lx\n", reg); + reg = tf->exc; + db_printf(" exc:\t%#lx\n", reg); + reg = tf->dar; + db_printf(" dar:\t%#lx\n", reg); +#ifdef AIM + reg = tf->cpu.aim.dsisr; + db_printf(" dsisr:\t%#lx\n", reg); +#else + reg = tf->cpu.booke.esr; + db_printf(" esr:\t%#lx\n", reg); + reg = tf->cpu.booke.dbcr0; + db_printf(" dbcr0:\t%#lx\n", reg); +#endif +} #endif #undef bzero From owner-svn-src-all@freebsd.org Sun Dec 1 23:05:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 633111BC1BE; Sun, 1 Dec 2019 23:05:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R3k92VZ7z4N4x; Sun, 1 Dec 2019 23:05:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3585B1E004; Sun, 1 Dec 2019 23:05:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB1N5LBU007064; Sun, 1 Dec 2019 23:05:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB1N5KQq007061; Sun, 1 Dec 2019 23:05:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912012305.xB1N5KQq007061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 1 Dec 2019 23:05:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355276 - in head: share/man/man4 sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/gpio X-SVN-Commit-Revision: 355276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Dec 2019 23:05:21 -0000 Author: ian Date: Sun Dec 1 23:05:20 2019 New Revision: 355276 URL: https://svnweb.freebsd.org/changeset/base/355276 Log: Rewrite gpioiic(4) to use the gpio_pin_* API, and to conform to the modern FDT bindings document for gpio-i2c devices. Using the gpio_pin_* functions to acquire/release/manipulate gpio pins removes the constraint that both gpio pins must belong to the same gpio controller/bank, and that the gpioiic instance must be a child of gpiobus. Removing those constraints allows the driver to be fully compatible with the modern dts bindings for a gpio bitbanged i2c bus. For hinted attachment, the two gpio pins still must be on the same gpiobus, and the device instance must be a child of that bus. This preserves compatibility for existing installations that have use gpioiic(4) with hints. Modified: head/share/man/man4/gpioiic.4 head/sys/dev/gpio/gpioiic.c Modified: head/share/man/man4/gpioiic.4 ============================================================================== --- head/share/man/man4/gpioiic.4 Sun Dec 1 21:29:34 2019 (r355275) +++ head/share/man/man4/gpioiic.4 Sun Dec 1 23:05:20 2019 (r355276) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 2014 +.Dd December 1, 2019 .Dt GPIOIIC 4 .Os .Sh NAME @@ -37,38 +37,42 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device gpio" .Cd "device gpioiic" -.Cd "device iic" .Cd "device iicbb" .Cd "device iicbus" .Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +gpioiic_load="YES" +.Ed .Sh DESCRIPTION The .Nm driver provides an IIC bit-banging interface using two GPIO pins for the -SCL and SDA on the -.Nm gpiobus . +SCL and SDA lines on the bus. +.Pp .Nm -implements an open collector kind of output, as recommended by the standard, -when driving the pins on the -.Nm gpiobus , -i.e, they are never switched to the logical value of '1', -or they are '0' or simply open (Hi-Z/tri-state). -So the pullup resistors are required so -.Nm -can work. +simulates an open collector kind of output when managing the pins on the +bus, even on systems which don't directly support configuring gpio pins +in that mode. +The pins are never driven to the logical value of '1'. +They are driven to '0' or switched to input mode (Hi-Z/tri-state), and +an external pullup resistor pulls the line to the 1 state unless some +other device on the bus is driving it to 0. .Pp +.Sh HINTS CONFIGURATION On a .Xr device.hints 5 -based system, like -.Li MIPS , -these values are configurable for the +based system, such as MIPS, these values are configurable for .Nm : .Bl -tag -width ".Va hint.gpioiic.%d.atXXX" .It Va hint.gpioiic.%d.at The .Nm gpiobus you are attaching to. -Normally just gpiobus0. +Normally just gpiobus0 on systems with a single bank of gpio pins. .It Va hint.gpioiic.%d.pins This is a bitmask of the pins on the .Nm gpiobus @@ -78,6 +82,9 @@ To configure pin 0 and 7, use the bitmask of 0b10000001 and convert it to a hexadecimal value of 0x0081. Please note that this mask should only ever have two bits set (any other bits - i.e., pins - will be ignored). +Because +.Nm +must be a child of the gpiobus, both gpio pins must be part of that bus. .It Va hint.gpioiic.%d.scl Indicates which bit in the .Va hint.gpioiic.%d.pins @@ -91,35 +98,32 @@ should be used as the SDATA source. Optional, defaults to 1. .El -.Pp -On a +.Sh FDT CONFIGURATION +On an .Xr FDT 4 -based system, like -.Li ARM , -the DTS part for a +based system, such as ARM, the DTS node for .Nm gpioiic -device usually looks like: +conforms to the standard bindings document i2c/i2c-gpio.yaml. +The device node typically appears at the root of the device tree. +The following is an example of a +.Nm +node with one slave device +on the IIC bus: .Bd -literal -gpio: gpio { - - gpio-controller; - ... - +/ { gpioiic0 { - compatible = "gpioiic"; - /* - * Attach to GPIO pins 21 and 22. Set them - * initially as inputs. - */ - gpios = <&gpio 21 1 0 - &gpio 22 1 0>; - scl = <0>; /* GPIO pin 21 - optional */ - sda = <1>; /* GPIO pin 22 - optional */ + compatible = "i2c-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpioiic0>; + scl-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + sda-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>; + status = "okay"; - /* This is an example of a gpioiic child. */ - gpioiic-child0 { - compatible = "lm75"; - i2c-address = <0x4f>; + /* One slave device on the i2c bus. */ + rtc@51 { + compatible="nxp,pcf2127"; + reg = <0x51>; + status = "okay"; }; }; }; @@ -128,35 +132,19 @@ gpio: gpio { Where: .Bl -tag -width ".Va compatible" .It Va compatible -Should always be set to "gpioiic". -.It Va gpios -The -.Va gpios -property indicates which GPIO pins should be used for SCLOCK and SDATA -on the GPIO IIC bit-banging bus. -For more details about the -.Va gpios -property, please consult -.Pa /usr/src/sys/dts/bindings-gpio.txt . -.It Va scl -The -.Va scl -option indicates which bit in the -.Va gpios -should be used as the SCLOCK source. -Optional, defaults to 0. -.It Va sda -The -.Va sda -option indicates which bit in the -.Va gpios -should be used as the SDATA source. -Optional, defaults to 1. +Should be set to "i2c-gpio". +The deprecated string "gpioiic" is also accepted for backwards compatibility. +.It Va scl-gpios Va sda-gpios +These properties indicate which GPIO pins should be used for clock +and data on the GPIO IIC bit-banging bus. +There is no requirement that the two pins belong to the same gpio controller. +.It Va pinctrl-names pinctrl-0 +These properties may be required to configure the chosen pins as gpio +pins, unless the pins default to that state on your system. .El .Sh SEE ALSO .Xr fdt 4 , .Xr gpio 4 , -.Xr gpioled 4 , .Xr iic 4 , .Xr iicbb 4 , .Xr iicbus 4 Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun Dec 1 21:29:34 2019 (r355275) +++ head/sys/dev/gpio/gpioiic.c Sun Dec 1 23:05:20 2019 (r355276) @@ -1,9 +1,9 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2009 Oleksandr Tymoshenko - * Copyright (c) 2010 Luiz Otavio O Souza - * All rights reserved. + * Copyright (c) 2010 Luiz Otavio O Souza All rights reserved. + * Copyright (c) 2019 Ian Lepore * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,14 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FDT -#include -#include -#endif - #include #include -#include #include "gpiobus_if.h" #include "iicbb_if.h" @@ -57,200 +51,281 @@ __FBSDID("$FreeBSD$"); struct gpioiic_softc { - device_t sc_dev; - device_t sc_busdev; - int scl_pin; - int sda_pin; + device_t dev; + gpio_pin_t sclpin; + gpio_pin_t sdapin; }; -static int gpioiic_probe(device_t); -static int gpioiic_attach(device_t); +#ifdef FDT -/* iicbb interface */ -static void gpioiic_reset_bus(device_t); -static void gpioiic_setsda(device_t, int); -static void gpioiic_setscl(device_t, int); -static int gpioiic_getsda(device_t); -static int gpioiic_getscl(device_t); -static int gpioiic_reset(device_t, u_char, u_char, u_char *); +#include +static struct ofw_compat_data compat_data[] = { + {"i2c-gpio", true}, /* Standard devicetree compat string */ + {"gpioiic", true}, /* Deprecated old freebsd compat string */ + {NULL, false} +}; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); + +static phandle_t +gpioiic_get_node(device_t bus, device_t dev) +{ + + /* Share our fdt node with iicbus so it can find its child nodes. */ + return (ofw_bus_get_node(bus)); +} + static int -gpioiic_probe(device_t dev) +gpioiic_setup_fdt_pins(struct gpioiic_softc *sc) { - struct gpiobus_ivar *devi; + phandle_t node; + int err; -#ifdef FDT - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - if (!ofw_bus_is_compatible(dev, "gpioiic")) - return (ENXIO); -#endif - devi = GPIOBUS_IVAR(dev); - if (devi->npins < GPIOIIC_MIN_PINS) { - device_printf(dev, - "gpioiic needs at least %d GPIO pins (only %d given).\n", - GPIOIIC_MIN_PINS, devi->npins); - return (ENXIO); - } - device_set_desc(dev, "GPIO I2C bit-banging driver"); + node = ofw_bus_get_node(sc->dev); - return (BUS_PROBE_DEFAULT); + /* + * Historically, we used the first two array elements of the gpios + * property. The modern bindings specify separate scl-gpios and + * sda-gpios properties. We cope with whichever is present. + */ + if (OF_hasprop(node, "gpios")) { + if ((err = gpio_pin_get_by_ofw_idx(sc->dev, node, + GPIOIIC_SCL_DFLT, &sc->sclpin)) != 0) { + device_printf(sc->dev, "invalid gpios property\n"); + return (err); + } + if ((err = gpio_pin_get_by_ofw_idx(sc->dev, node, + GPIOIIC_SDA_DFLT, &sc->sdapin)) != 0) { + device_printf(sc->dev, "ivalid gpios property\n"); + return (err); + } + } else { + if ((err = gpio_pin_get_by_ofw_property(sc->dev, node, + "scl-gpios", &sc->sclpin)) != 0) { + device_printf(sc->dev, "missing scl-gpios property\n"); + return (err); + } + if ((err = gpio_pin_get_by_ofw_property(sc->dev, node, + "sda-gpios", &sc->sdapin)) != 0) { + device_printf(sc->dev, "missing sda-gpios property\n"); + return (err); + } + } + return (0); } +#endif /* FDT */ static int -gpioiic_attach(device_t dev) +gpioiic_setup_hinted_pins(struct gpioiic_softc *sc) { - device_t bitbang; -#ifdef FDT - phandle_t node; - pcell_t pin; -#endif - struct gpiobus_ivar *devi; - struct gpioiic_softc *sc; + device_t busdev; + const char *busname, *devname; + int err, numpins, sclnum, sdanum, unit; - sc = device_get_softc(dev); - sc->sc_dev = dev; - sc->sc_busdev = device_get_parent(dev); - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "scl", &sc->scl_pin)) - sc->scl_pin = GPIOIIC_SCL_DFLT; - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "sda", &sc->sda_pin)) - sc->sda_pin = GPIOIIC_SDA_DFLT; + devname = device_get_name(sc->dev); + unit = device_get_unit(sc->dev); + busdev = device_get_parent(sc->dev); + /* + * If there is not an "at" hint naming our actual parent, then we + * weren't instantiated as a child of gpiobus via hints, and we thus + * can't access ivars that only exist for such children. + */ + if (resource_string_value(devname, unit, "at", &busname) != 0 || + (strcmp(busname, device_get_nameunit(busdev)) != 0 && + strcmp(busname, device_get_name(busdev)) != 0)) { + return (ENOENT); + } + + /* Make sure there were hints for at least two pins. */ + numpins = gpiobus_get_npins(sc->dev); + if (numpins < GPIOIIC_MIN_PINS) { #ifdef FDT - if ((node = ofw_bus_get_node(dev)) == -1) - return (ENXIO); - if (OF_getencprop(node, "scl", &pin, sizeof(pin)) > 0) - sc->scl_pin = (int)pin; - if (OF_getencprop(node, "sda", &pin, sizeof(pin)) > 0) - sc->sda_pin = (int)pin; + /* + * Be silent when there are no hints on FDT systems; the FDT + * data will provide the pin config (we'll whine if it doesn't). + */ + if (numpins == 0) { + return (ENOENT); + } #endif + device_printf(sc->dev, + "invalid pins hint; it must contain at least %d pins\n", + GPIOIIC_MIN_PINS); + return (EINVAL); + } - if (sc->scl_pin < 0 || sc->scl_pin > 1) - sc->scl_pin = GPIOIIC_SCL_DFLT; - if (sc->sda_pin < 0 || sc->sda_pin > 1) - sc->sda_pin = GPIOIIC_SDA_DFLT; + /* + * Our parent bus has already parsed the pins hint and it will use that + * info when we call gpio_pin_get_by_child_index(). But we have to + * handle the scl/sda index hints that tell us which of the two pins is + * the clock and which is the data. They're optional, but if present + * they must be a valid index (0 <= index < numpins). + */ + if ((err = resource_int_value(devname, unit, "scl", &sclnum)) != 0) + sclnum = GPIOIIC_SCL_DFLT; + else if (sclnum < 0 || sclnum >= numpins) { + device_printf(sc->dev, "invalid scl hint %d\n", sclnum); + return (EINVAL); + } + if ((err = resource_int_value(devname, unit, "sda", &sdanum)) != 0) + sdanum = GPIOIIC_SDA_DFLT; + else if (sdanum < 0 || sdanum >= numpins) { + device_printf(sc->dev, "invalid sda hint %d\n", sdanum); + return (EINVAL); + } - devi = GPIOBUS_IVAR(dev); - device_printf(dev, "SCL pin: %d, SDA pin: %d\n", - devi->pins[sc->scl_pin], devi->pins[sc->sda_pin]); + /* Allocate gpiobus_pin structs for the pins we found above. */ + if ((err = gpio_pin_get_by_child_index(sc->dev, sclnum, + &sc->sclpin)) != 0) + return (err); + if ((err = gpio_pin_get_by_child_index(sc->dev, sdanum, + &sc->sdapin)) != 0) + return (err); - /* add generic bit-banging code */ - bitbang = device_add_child(dev, "iicbb", -1); - device_probe_and_attach(bitbang); - return (0); } -static int -gpioiic_detach(device_t dev) -{ - - bus_generic_detach(dev); - device_delete_children(dev); - return (0); -} - -/* - * Reset bus by setting SDA first and then SCL. - * Must always be called with gpio bus locked. - */ static void -gpioiic_reset_bus(device_t dev) +gpioiic_setsda(device_t dev, int val) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); + /* + * Some controllers cannot set an output value while a pin is in input + * mode; in that case we set the pin again after changing mode. + */ + err = gpio_pin_set_active(sc->sdapin, val); + gpio_pin_setflags(sc->sdapin, GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + if (err != 0) + gpio_pin_set_active(sc->sdapin, val); } static void -gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val) +gpioiic_setscl(device_t dev, int val) { - int err; + struct gpioiic_softc *sc = device_get_softc(dev); - if (val == 0) { - err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, - GPIO_PIN_OUTPUT); - - /* - * Some controllers cannot set output value while a pin is in - * input mode. - */ - if (err != 0) - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); - } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, - GPIO_PIN_INPUT); - } + gpio_pin_setflags(sc->sclpin, GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + gpio_pin_set_active(sc->sclpin, val); } -static void -gpioiic_setsda(device_t dev, int val) +static int +gpioiic_getscl(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + bool val; - gpioiic_setpin(sc, sc->sda_pin, val); + gpio_pin_setflags(sc->sclpin, GPIO_PIN_INPUT); + gpio_pin_is_active(sc->sclpin, &val); + return (val); } -static void -gpioiic_setscl(device_t dev, int val) +static int +gpioiic_getsda(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + bool val; - gpioiic_setpin(sc, sc->scl_pin, val); + gpio_pin_setflags(sc->sdapin, GPIO_PIN_INPUT); + gpio_pin_is_active(sc->sdapin, &val); + return (val); } static int -gpioiic_getpin(struct gpioiic_softc *sc, int pin) +gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) { - unsigned int val; + struct gpioiic_softc *sc = device_get_softc(dev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, &val); - return ((int)val); + /* Stop driving the bus pins. */ + gpio_pin_setflags(sc->sdapin, GPIO_PIN_INPUT); + gpio_pin_setflags(sc->sclpin, GPIO_PIN_INPUT); + + /* Indicate that we have no slave address (master mode). */ + return (IIC_ENOADDR); } -static int -gpioiic_getscl(device_t dev) +static void +gpioiic_cleanup(struct gpioiic_softc *sc) { - struct gpioiic_softc *sc = device_get_softc(dev); - return (gpioiic_getpin(sc, sc->scl_pin)); + device_delete_children(sc->dev); + + if (sc->sclpin != NULL) + gpio_pin_release(sc->sclpin); + + if (sc->sdapin != NULL) + gpio_pin_release(sc->sdapin); } static int -gpioiic_getsda(device_t dev) +gpioiic_probe(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + int rv; - return (gpioiic_getpin(sc, sc->sda_pin)); + /* + * By default we only bid to attach if specifically added by our parent + * (usually via hint.gpioiic.#.at=busname). On FDT systems we bid as + * the default driver based on being configured in the FDT data. + */ + rv = BUS_PROBE_NOWILDCARD; + +#ifdef FDT + if (ofw_bus_status_okay(dev) && + ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rv = BUS_PROBE_DEFAULT; +#endif + + device_set_desc(dev, "GPIO I2C"); + + return (rv); } static int -gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +gpioiic_attach(device_t dev) { - struct gpioiic_softc *sc; + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - sc = device_get_softc(dev); - gpioiic_reset_bus(sc->sc_dev); + sc->dev = dev; - return (IIC_ENOADDR); + /* Acquire our gpio pins. */ + err = gpioiic_setup_hinted_pins(sc); +#ifdef FDT + if (err != 0) + err = gpioiic_setup_fdt_pins(sc); +#endif + if (err != 0) { + device_printf(sc->dev, "no pins configured\n"); + gpioiic_cleanup(sc); + return (ENXIO); + } + + /* Say what we came up with for pin config. */ + device_printf(dev, "SCL pin: %s:%d, SDA pin: %s:%d\n", + device_get_nameunit(GPIO_GET_BUS(sc->sclpin->dev)), sc->sclpin->pin, + device_get_nameunit(GPIO_GET_BUS(sc->sdapin->dev)), sc->sdapin->pin); + + /* Add the bitbang driver as our only child; it will add iicbus. */ + device_add_child(sc->dev, "iicbb", -1); + return (bus_generic_attach(dev)); } -#ifdef FDT -static phandle_t -gpioiic_get_node(device_t bus, device_t dev) +static int +gpioiic_detach(device_t dev) { + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - /* We only have one child, the iicbb, which needs our own node. */ - return (ofw_bus_get_node(bus)); + if ((err = bus_generic_detach(dev)) != 0) + return (err); + + gpioiic_cleanup(sc); + + return (0); } -#endif static devclass_t gpioiic_devclass; @@ -282,6 +357,7 @@ static driver_t gpioiic_driver = { }; DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0); +DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0); DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1); From owner-svn-src-all@freebsd.org Mon Dec 2 00:00:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCD181BD893; Mon, 2 Dec 2019 00:00:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R4xk4c9dz4PxD; Mon, 2 Dec 2019 00:00:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80EF71E8EE; Mon, 2 Dec 2019 00:00:26 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB200QWq036577; Mon, 2 Dec 2019 00:00:26 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB200Qsm036576; Mon, 2 Dec 2019 00:00:26 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912020000.xB200Qsm036576@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 2 Dec 2019 00:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355277 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 355277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 00:00:26 -0000 Author: ian Date: Mon Dec 2 00:00:26 2019 New Revision: 355277 URL: https://svnweb.freebsd.org/changeset/base/355277 Log: Fix leading whitespace (spaces->tabs) in comments; no functional change. Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Sun Dec 1 23:05:20 2019 (r355276) +++ head/sys/dev/gpio/gpioiic.c Mon Dec 2 00:00:26 2019 (r355277) @@ -267,8 +267,8 @@ gpioiic_probe(device_t dev) /* * By default we only bid to attach if specifically added by our parent - * (usually via hint.gpioiic.#.at=busname). On FDT systems we bid as - * the default driver based on being configured in the FDT data. + * (usually via hint.gpioiic.#.at=busname). On FDT systems we bid as + * the default driver based on being configured in the FDT data. */ rv = BUS_PROBE_NOWILDCARD; From owner-svn-src-all@freebsd.org Mon Dec 2 00:39:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74DD11BEA0F; Mon, 2 Dec 2019 00:39:59 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47R5qM23TSz4Rbh; Mon, 2 Dec 2019 00:39:59 +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 238CD1EFEF; Mon, 2 Dec 2019 00:39:59 +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 xB20dwc0059999; Mon, 2 Dec 2019 00:39:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB20dwYS059998; Mon, 2 Dec 2019 00:39:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912020039.xB20dwYS059998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 2 Dec 2019 00:39: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: r355279 - stable/12/sys/fs/nfsclient X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/nfsclient X-SVN-Commit-Revision: 355279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 00:39:59 -0000 Author: kib Date: Mon Dec 2 00:39:58 2019 New Revision: 355279 URL: https://svnweb.freebsd.org/changeset/base/355279 Log: MFC r355210: In nfs_lock(), recheck vp->v_data after lock before accessing it. PR: 242184 Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clvnops.c Mon Dec 2 00:11:12 2019 (r355278) +++ stable/12/sys/fs/nfsclient/nfs_clvnops.c Mon Dec 2 00:39:58 2019 (r355279) @@ -287,6 +287,8 @@ nfs_lock(struct vop_lock1_args *ap) if (error != 0 || vp->v_op != &newnfs_vnodeops) return (error); np = VTONFS(vp); + if (np == NULL) + return (0); NFSLOCKNODE(np); if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED && lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE && @@ -320,6 +322,9 @@ nfs_lock(struct vop_lock1_args *ap) error = VOP_LOCK1_APV(&default_vnodeops, ap); if (error != 0 || vp->v_op != &newnfs_vnodeops) return (error); + if (vp->v_data == NULL) + goto downgrade; + MPASS(vp->v_data == np); NFSLOCKNODE(np); if ((np->n_flag & NVNSETSZSKIP) == 0) { NFSUNLOCKNODE(np); From owner-svn-src-all@freebsd.org Mon Dec 2 05:24:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A30151C5A3E; Mon, 2 Dec 2019 05:24:17 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RD7P3qHQz4f3Z; Mon, 2 Dec 2019 05:24:17 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6670A2239D; Mon, 2 Dec 2019 05:24:17 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB25OHrb030207; Mon, 2 Dec 2019 05:24:17 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB25OH8u030206; Mon, 2 Dec 2019 05:24:17 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201912020524.xB25OH8u030206@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Mon, 2 Dec 2019 05:24:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355280 - head/usr.sbin/bsdconfig/share X-SVN-Group: head X-SVN-Commit-Author: dteske X-SVN-Commit-Paths: head/usr.sbin/bsdconfig/share X-SVN-Commit-Revision: 355280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 05:24:17 -0000 Author: dteske Date: Mon Dec 2 05:24:16 2019 New Revision: 355280 URL: https://svnweb.freebsd.org/changeset/base/355280 Log: Fix spurious error from sysrc When using sysrc to modify a file, the file should be created silently. However, with the introduction of SVN r335280, an error of "No such file or directory" would appear despite everything else working as-expected. The nature of this spurious error is that SVN r335280 did not check if the file exists first, before trying to fixup the line-endings in the file just prior to modification. PR: bin/240875 Reported by: Jose Luis Duran MFC after: 3 days Modified: head/usr.sbin/bsdconfig/share/sysrc.subr Modified: head/usr.sbin/bsdconfig/share/sysrc.subr ============================================================================== --- head/usr.sbin/bsdconfig/share/sysrc.subr Mon Dec 2 00:39:58 2019 (r355279) +++ head/usr.sbin/bsdconfig/share/sysrc.subr Mon Dec 2 05:24:16 2019 (r355280) @@ -560,7 +560,7 @@ f_sysrc_set() # if [ "$not_found" ]; then # Add a newline if missing before appending to the file - awk 'BEGIN { wc = 0 } NR == 1 { + [ ! -e "$file" ] || awk 'BEGIN { wc = 0 } NR == 1 { (cmd = "wc -l " FILENAME) | getline close(cmd) wc = $1 From owner-svn-src-all@freebsd.org Mon Dec 2 07:20:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA5511C837A; Mon, 2 Dec 2019 07:20:32 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RGjX5Tgcz4kZv; Mon, 2 Dec 2019 07:20:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F6562379B; Mon, 2 Dec 2019 07:20:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB27KWZm095546; Mon, 2 Dec 2019 07:20:32 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB27KWh5095545; Mon, 2 Dec 2019 07:20:32 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912020720.xB27KWh5095545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 2 Dec 2019 07:20:32 +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: r355281 - stable/12/cddl/contrib/opensolaris/cmd/zpool X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zpool X-SVN-Commit-Revision: 355281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 07:20:32 -0000 Author: avg Date: Mon Dec 2 07:20:32 2019 New Revision: 355281 URL: https://svnweb.freebsd.org/changeset/base/355281 Log: MFC r354886: zpool.8: remove a paragraph about quorum disks Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 05:24:16 2019 (r355280) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 07:20:32 2019 (r355281) @@ -863,10 +863,6 @@ Displays the configuration that would be used without .Ar vdev Ns s. The actual pool creation can still fail due to insufficient privileges or device sharing. -.Pp -Do not add a disk that is currently configured as a quorum device to a zpool. -After a disk is in the pool, that disk can then be configured as a quorum -device. .El .It Xo .Nm From owner-svn-src-all@freebsd.org Mon Dec 2 07:22:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 948161C853D; Mon, 2 Dec 2019 07:22:02 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RGlG3T6qz4kmw; Mon, 2 Dec 2019 07:22:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5BBB32391A; Mon, 2 Dec 2019 07:22:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB27M2Yr000472; Mon, 2 Dec 2019 07:22:02 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB27M2qP000471; Mon, 2 Dec 2019 07:22:02 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912020722.xB27M2qP000471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 2 Dec 2019 07:22:02 +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: r355282 - stable/12/sys/i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/i386/i386 X-SVN-Commit-Revision: 355282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 07:22:02 -0000 Author: avg Date: Mon Dec 2 07:22:01 2019 New Revision: 355282 URL: https://svnweb.freebsd.org/changeset/base/355282 Log: MFC r354627: db_nextframe/i386: reduce the number of special frame types Modified: stable/12/sys/i386/i386/db_trace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/i386/i386/db_trace.c ============================================================================== --- stable/12/sys/i386/i386/db_trace.c Mon Dec 2 07:20:32 2019 (r355281) +++ stable/12/sys/i386/i386/db_trace.c Mon Dec 2 07:22:01 2019 (r355282) @@ -191,8 +191,6 @@ db_ss(struct db_variable *vp, db_expr_t *valuep, int o #define INTERRUPT 2 #define SYSCALL 3 #define DOUBLE_FAULT 4 -#define TRAP_INTERRUPT 5 -#define TRAP_TIMERINT 6 static void db_nextframe(struct i386_frame **, db_addr_t *, struct thread *); static int db_numargs(struct i386_frame *); @@ -299,6 +297,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st { struct trapframe *tf; int frame_type; + int narg; int eip, esp, ebp; db_expr_t offset; c_db_sym_t sym; @@ -317,6 +316,15 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st * actually made the call. */ frame_type = NORMAL; + + /* + * This is the number of arguments that a syscall / trap / interrupt + * service routine passes to its callee. This number is used only for + * special frame types. In most cases there is one argument: the trap + * frame address. + */ + narg = 1; + if (eip >= PMAP_TRM_MIN_ADDRESS) { sym = db_search_symbol(eip - 1 - setidt_disp, DB_STGY_ANY, &offset); @@ -329,20 +337,24 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st strcmp(name, "fork_trampoline") == 0) frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || - strncmp(name, "Xapic_isr", 9) == 0) + strncmp(name, "Xapic_isr", 9) == 0) { + /* Additional argument: vector number. */ + narg = 2; frame_type = INTERRUPT; - else if (strcmp(name, "Xlcall_syscall") == 0 || + } else if (strcmp(name, "Xlcall_syscall") == 0 || strcmp(name, "Xint0x80_syscall") == 0) frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - /* XXX: These are interrupts with trap frames. */ else if (strcmp(name, "Xtimerint") == 0) - frame_type = TRAP_TIMERINT; + frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || - strcmp(name, "Xipi_intr_bitmap_handler") == 0) - frame_type = TRAP_INTERRUPT; + strcmp(name, "Xipi_intr_bitmap_handler") == 0) { + /* No arguments. */ + narg = 0; + frame_type = INTERRUPT; + } } /* @@ -375,14 +387,11 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st /* * Point to base of trapframe which is just above the - * current frame. + * current frame. Note that struct i386_frame already accounts for one + * argument. */ - if (frame_type == INTERRUPT) - tf = (struct trapframe *)((int)*fp + 16); - else if (frame_type == TRAP_INTERRUPT) - tf = (struct trapframe *)((int)*fp + 8); - else - tf = (struct trapframe *)((int)*fp + 12); + tf = (struct trapframe *)((char *)*fp + sizeof(struct i386_frame) + + 4 * (narg - 1)); esp = get_esp(tf); eip = tf->tf_eip; @@ -395,8 +404,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st db_printf("--- syscall"); decode_syscall(tf->tf_eax, td); break; - case TRAP_TIMERINT: - case TRAP_INTERRUPT: case INTERRUPT: db_printf("--- interrupt"); break; @@ -407,8 +414,6 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st switch (frame_type) { case TRAP: - case TRAP_TIMERINT: - case TRAP_INTERRUPT: case INTERRUPT: if ((tf->tf_eflags & PSL_VM) != 0 || (tf->tf_cs & SEL_RPL_MASK) != 0) @@ -418,7 +423,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st ebp = 0; break; } - + *ip = (db_addr_t) eip; *fp = (struct i386_frame *) ebp; } From owner-svn-src-all@freebsd.org Mon Dec 2 07:39:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C63981C88D9; Mon, 2 Dec 2019 07:39:57 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RH7x4wqrz4lQy; Mon, 2 Dec 2019 07:39:57 +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 8C59023B26; Mon, 2 Dec 2019 07:39:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB27dvpm007478; Mon, 2 Dec 2019 07:39:57 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB27dtpY007470; Mon, 2 Dec 2019 07:39:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912020739.xB27dtpY007470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 2 Dec 2019 07:39: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: r355283 - in stable/12: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/co... X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common cddl/contrib/opensolaris/lib/libzfs_core/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/cont... X-SVN-Commit-Revision: 355283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 07:39:57 -0000 Author: avg Date: Mon Dec 2 07:39:55 2019 New Revision: 355283 URL: https://svnweb.freebsd.org/changeset/base/355283 Log: MFC r354436: MFV r354377: 10554 Implemented zpool sync command This addition will enable us to sync an open TXG to the main pool on demand. The functionality is similar to sync(2) but 'zpool sync' will return when data has hit the main storage instead of potentially just the ZIL as is the case with the sync(2) cmd. Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 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 stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Mon Dec 2 07:39:55 2019 (r355283) @@ -193,6 +193,9 @@ .Ar ... .Op Ar interval Op Ar count .Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Nm .Cm upgrade .Op Fl v .Nm @@ -1907,6 +1910,19 @@ unavailable. Warnings about pools not using the latest on-disk format, having non-native block size or disabled features will not be included. .El +.It Xo +.Nm +.Cm sync +.Oo Ar pool Oc Ns ... +.Xc +Forces all in-core dirty data to be written to the primary pool storage and +not the ZIL. +It will also update administrative information including quota reporting. +Without arguments, +.Nm zpool Cm sync +will sync all pools on the system. +Otherwise, it will only sync the specified +.Ar pool . .It Xo .Nm .Cm upgrade Modified: stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Mon Dec 2 07:39:55 2019 (r355283) @@ -100,6 +100,8 @@ static int zpool_do_history(int, char **); static int zpool_do_get(int, char **); static int zpool_do_set(int, char **); +static int zpool_do_sync(int, char **); + /* * These libumem hooks provide a reasonable set of defaults for the allocator's * debugging facilities. @@ -144,6 +146,7 @@ typedef enum { HELP_GET, HELP_SET, HELP_SPLIT, + HELP_SYNC, HELP_REGUID, HELP_REOPEN } zpool_help_t; @@ -200,6 +203,7 @@ static zpool_command_t command_table[] = { { "history", zpool_do_history, HELP_HISTORY }, { "get", zpool_do_get, HELP_GET }, { "set", zpool_do_set, HELP_SET }, + { "sync", zpool_do_sync, HELP_SYNC }, }; #define NCOMMAND (sizeof (command_table) / sizeof (command_table[0])) @@ -285,6 +289,8 @@ get_usage(zpool_help_t idx) "[ ...]\n")); case HELP_REGUID: return (gettext("\treguid \n")); + case HELP_SYNC: + return (gettext("\tsync [pool] ...\n")); } abort(); @@ -2646,6 +2652,45 @@ error: free(searchdirs); return (err ? 1 : 0); +} + +/* + * zpool sync [-f] [pool] ... + * + * -f (undocumented) force uberblock (and config including zpool cache file) + * update. + * + * Sync the specified pool(s). + * Without arguments "zpool sync" will sync all pools. + * This command initiates TXG sync(s) and will return after the TXG(s) commit. + * + */ +static int +zpool_do_sync(int argc, char **argv) +{ + int ret; + boolean_t force = B_FALSE; + + /* check options */ + while ((ret = getopt(argc, argv, "f")) != -1) { + switch (ret) { + case 'f': + force = B_TRUE; + break; + case '?': + (void) fprintf(stderr, gettext("invalid option '%c'\n"), + optopt); + usage(B_FALSE); + } + } + + argc -= optind; + argv += optind; + + /* if argc == 0 we will execute zpool_sync_one on all pools */ + ret = for_each_pool(argc, argv, B_FALSE, NULL, zpool_sync_one, &force); + + return (ret); } typedef struct iostat_cbdata { Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Mon Dec 2 07:39:55 2019 (r355283) @@ -271,6 +271,8 @@ extern int zpool_clear(zpool_handle_t *, const char *, extern int zpool_reguid(zpool_handle_t *); extern int zpool_reopen(zpool_handle_t *); +extern int zpool_sync_one(zpool_handle_t *, void *); + extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Mon Dec 2 07:39:55 2019 (r355283) @@ -3515,6 +3515,27 @@ zpool_reopen(zpool_handle_t *zhp) return (zpool_standard_error(hdl, errno, msg)); } +/* call into libzfs_core to execute the sync IOCTL per pool */ +int +zpool_sync_one(zpool_handle_t *zhp, void *data) +{ + int ret; + libzfs_handle_t *hdl = zpool_get_handle(zhp); + const char *pool_name = zpool_get_name(zhp); + boolean_t *force = data; + nvlist_t *innvl = fnvlist_alloc(); + + fnvlist_add_boolean_value(innvl, "force", *force); + if ((ret = lzc_sync(pool_name, innvl, NULL)) != 0) { + nvlist_free(innvl); + return (zpool_standard_error_fmt(hdl, ret, + dgettext(TEXT_DOMAIN, "sync '%s' failed"), pool_name)); + } + nvlist_free(innvl); + + return (0); +} + /* * Convert from a devid string to a path. */ Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c Mon Dec 2 07:39:55 2019 (r355283) @@ -24,6 +24,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ /* @@ -137,16 +138,17 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, { zfs_cmd_t zc = { 0 }; int error = 0; - char *packed; + char *packed = NULL; #ifdef __FreeBSD__ nvlist_t *oldsource; #endif - size_t size; + size_t size = 0; ASSERT3S(g_refcount, >, 0); VERIFY3S(g_fd, !=, -1); - (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); + if (name != NULL) + (void) strlcpy(zc.zc_name, name, sizeof (zc.zc_name)); #ifdef __FreeBSD__ if (zfs_ioctl_version == ZFS_IOCVER_UNDEF) @@ -160,9 +162,11 @@ lzc_ioctl(zfs_ioc_t ioc, const char *name, } #endif - packed = fnvlist_pack(source, &size); - zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; - zc.zc_nvlist_src_size = size; + if (source != NULL) { + packed = fnvlist_pack(source, &size); + zc.zc_nvlist_src = (uint64_t)(uintptr_t)packed; + zc.zc_nvlist_src_size = size; + } if (resultp != NULL) { *resultp = NULL; @@ -463,6 +467,18 @@ lzc_exists(const char *dataset) } /* + * outnvl is unused. + * It was added to preserve the function signature in case it is + * needed in the future. + */ +/*ARGSUSED*/ +int +lzc_sync(const char *pool_name, nvlist_t *innvl, nvlist_t **outnvl) +{ + return (lzc_ioctl(ZFS_IOC_POOL_SYNC, pool_name, innvl, NULL)); +} + +/* * Create "user holds" on snapshots. If there is a hold on a snapshot, * the snapshot can not be destroyed. (However, it can be marked for deletion * by lzc_destroy_snaps(defer=B_TRUE).) @@ -562,11 +578,7 @@ lzc_release(nvlist_t *holds, nvlist_t **errlist) int lzc_get_holds(const char *snapname, nvlist_t **holdsp) { - int error; - nvlist_t *innvl = fnvlist_alloc(); - error = lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, innvl, holdsp); - fnvlist_free(innvl); - return (error); + return (lzc_ioctl(ZFS_IOC_GET_HOLDS, snapname, NULL, holdsp)); } /* Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.h Mon Dec 2 07:39:55 2019 (r355283) @@ -23,6 +23,7 @@ * Copyright (c) 2012, 2016 by Delphix. All rights reserved. * Copyright (c) 2013 by Martin Matuska . All rights reserved. * Copyright 2017 RackTop Systems. + * Copyright (c) 2017 Datto Inc. */ #ifndef _LIBZFS_CORE_H @@ -90,6 +91,8 @@ boolean_t lzc_exists(const char *); int lzc_rollback(const char *, char *, int); int lzc_rollback_to(const char *, const char *); + +int lzc_sync(const char *, nvlist_t *, nvlist_t **); int lzc_rename(const char *, const char *); int lzc_destroy(const char *); Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Mon Dec 2 07:39:55 2019 (r355283) @@ -5836,6 +5836,7 @@ zfs_ioc_hold(const char *pool, nvlist_t *args, nvlist_ static int zfs_ioc_get_holds(const char *snapname, nvlist_t *args, nvlist_t *outnvl) { + ASSERT3P(args, ==, NULL); return (dsl_dataset_get_holds(snapname, outnvl)); } @@ -6134,6 +6135,44 @@ out: return (error); } +/* + * Sync the currently open TXG to disk for the specified pool. + * This is somewhat similar to 'zfs_sync()'. + * For cases that do not result in error this ioctl will wait for + * the currently open TXG to commit before returning back to the caller. + * + * innvl: { + * "force" -> when true, force uberblock update even if there is no dirty data. + * In addition this will cause the vdev configuration to be written + * out including updating the zpool cache file. (boolean_t) + * } + * + * onvl is unused + */ +/* ARGSUSED */ +static int +zfs_ioc_pool_sync(const char *pool, nvlist_t *innvl, nvlist_t *onvl) +{ + int err; + boolean_t force; + spa_t *spa; + + if ((err = spa_open(pool, &spa, FTAG)) != 0) + return (err); + + force = fnvlist_lookup_boolean_value(innvl, "force"); + if (force) { + spa_config_enter(spa, SCL_CONFIG, FTAG, RW_WRITER); + vdev_config_dirty(spa->spa_root_vdev); + spa_config_exit(spa, SCL_CONFIG, FTAG); + } + txg_wait_synced(spa_get_dsl(spa), 0); + + spa_close(spa, FTAG); + + return (err); +} + static zfs_ioc_vec_t zfs_ioc_vec[ZFS_IOC_LAST - ZFS_IOC_FIRST]; static void @@ -6323,6 +6362,10 @@ zfs_ioctl_init(void) zfs_ioctl_register("initialize", ZFS_IOC_POOL_INITIALIZE, zfs_ioc_pool_initialize, zfs_secpolicy_config, POOL_NAME, POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_TRUE, B_TRUE); + + zfs_ioctl_register("sync", ZFS_IOC_POOL_SYNC, + zfs_ioc_pool_sync, zfs_secpolicy_none, POOL_NAME, + POOL_CHECK_SUSPENDED | POOL_CHECK_READONLY, B_FALSE, B_FALSE); /* IOCTLS that use the legacy function signature */ Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Dec 2 07:22:01 2019 (r355282) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Mon Dec 2 07:39:55 2019 (r355283) @@ -1016,6 +1016,7 @@ typedef enum zfs_ioc { ZFS_IOC_POOL_CHECKPOINT, ZFS_IOC_POOL_DISCARD_CHECKPOINT, ZFS_IOC_POOL_INITIALIZE, + ZFS_IOC_POOL_SYNC, ZFS_IOC_LAST } zfs_ioc_t; From owner-svn-src-all@freebsd.org Mon Dec 2 09:57:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2B571CC4FF; Mon, 2 Dec 2019 09:57:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RLBD4B3xz4t5D; Mon, 2 Dec 2019 09:57:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72D8525420; Mon, 2 Dec 2019 09:57:08 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB29v82U090030; Mon, 2 Dec 2019 09:57:08 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB29v8jF090028; Mon, 2 Dec 2019 09:57:08 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912020957.xB29v8jF090028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 09:57:08 +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: r355284 - in stable/12/stand/efi: boot1 gptboot X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12/stand/efi: boot1 gptboot X-SVN-Commit-Revision: 355284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 09:57:08 -0000 Author: tsoome Date: Mon Dec 2 09:57:07 2019 New Revision: 355284 URL: https://svnweb.freebsd.org/changeset/base/355284 Log: r353501 did mimerge r350654 boot1 and gptboot were left out Replace left over BS->HandleProtocol by OpenProtocolByHandle. Reported by: Harry Schmalzbauer Modified: stable/12/stand/efi/boot1/proto.c stable/12/stand/efi/gptboot/proto.c Modified: stable/12/stand/efi/boot1/proto.c ============================================================================== --- stable/12/stand/efi/boot1/proto.c Mon Dec 2 07:39:55 2019 (r355283) +++ stable/12/stand/efi/boot1/proto.c Mon Dec 2 09:57:07 2019 (r355284) @@ -61,7 +61,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) int preferred; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status == EFI_UNSUPPORTED) return (0); @@ -77,7 +77,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) efi_free_devpath_name(text); } #endif - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status == EFI_UNSUPPORTED) return (0); Modified: stable/12/stand/efi/gptboot/proto.c ============================================================================== --- stable/12/stand/efi/gptboot/proto.c Mon Dec 2 07:39:55 2019 (r355283) +++ stable/12/stand/efi/gptboot/proto.c Mon Dec 2 09:57:07 2019 (r355284) @@ -146,7 +146,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) EFI_STATUS status; /* Figure out if we're dealing with an actual partition. */ - status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); if (status != EFI_SUCCESS) return; #ifdef EFI_DEBUG @@ -169,7 +169,7 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) return; } } - status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); if (status != EFI_SUCCESS) { DPRINTF("Can't get the block I/O protocol block\n"); return; From owner-svn-src-all@freebsd.org Mon Dec 2 11:44:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C30E41CEB23; Mon, 2 Dec 2019 11:44:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RNZL4l9wz3G9p; Mon, 2 Dec 2019 11:44:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8624226785; Mon, 2 Dec 2019 11:44:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Big6D054273; Mon, 2 Dec 2019 11:44:42 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2BieqZ054262; Mon, 2 Dec 2019 11:44:40 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021144.xB2BieqZ054262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 11:44: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: r355285 - in stable/12: cddl/lib/libzpool stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/lz4 ... X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in stable/12: cddl/lib/libzpool stand/efi/boot1 stand/i386/gptzfsboot stand/i386/zfsboot stand/libsa stand/libsa/zfs sys/cddl/boot/zfs sys/cddl/contrib/opensolaris/common/lz4 sys/cddl/contrib/opensola... X-SVN-Commit-Revision: 355285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 11:44:42 -0000 Author: tsoome Date: Mon Dec 2 11:44:39 2019 New Revision: 355285 URL: https://svnweb.freebsd.org/changeset/base/355285 Log: MFC r354253, r354254, r354264, r354265 Remove duplicate lz4 implementations Port illumos change: https://www.illumos.org/issues/11667 Move lz4.c out of zfs tree to opensolaris/common/lz4, adjust it to be usable from kernel/stand/userland builds, so we can use just one single source. Add lz4.h to declare lz4_compress() and lz4_decompress(). Differential Revision: https://reviews.freebsd.org/D22037 Added: stable/12/sys/cddl/contrib/opensolaris/common/lz4/ - copied from r354265, head/sys/cddl/contrib/opensolaris/common/lz4/ Deleted: stable/12/sys/cddl/boot/zfs/lz4.c stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c Modified: stable/12/cddl/lib/libzpool/Makefile stable/12/stand/efi/boot1/Makefile stable/12/stand/i386/gptzfsboot/Makefile stable/12/stand/i386/zfsboot/Makefile stable/12/stand/libsa/Makefile stable/12/stand/libsa/zfs/Makefile.inc stable/12/sys/cddl/boot/zfs/zfssubr.c stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files stable/12/sys/conf/files stable/12/sys/conf/kern.pre.mk stable/12/sys/modules/zfs/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/lib/libzpool/Makefile ============================================================================== --- stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -8,6 +8,8 @@ .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua # ZFS_SHARED_SRCS .PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +# LZ4_COMMON_SRCS +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 # KERNEL_SRCS .PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libzpool/common # LIST_SRCS @@ -32,6 +34,7 @@ LIB= zpool ZFS_COMMON_SRCS= ${ZFS_COMMON_OBJS:C/.o$/.c/} trim_map.c ZFS_SHARED_SRCS= ${ZFS_SHARED_OBJS:C/.o$/.c/} +LZ4_COMMON_SRCS= lz4.c LUA_SRCS= ${LUA_OBJS:C/.o$/.c/} KERNEL_SRCS= kernel.c taskq.c util.c LIST_SRCS= list.c @@ -39,7 +42,7 @@ UNICODE_SRCS= u8_textprep.c LIBCMDUTILS_SRCS=nicenum.c SRCS= ${ZFS_COMMON_SRCS} ${ZFS_SHARED_SRCS} ${LUA_SRCS} \ - ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ + ${LZ4_COMMON_SRCS} ${KERNEL_SRCS} ${LIST_SRCS} ${ATOMIC_SRCS} \ ${UNICODE_SRCS} ${LIBCMDUTILS_SRCS} WARNS?= 0 @@ -50,6 +53,7 @@ CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libz CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/lua CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs +CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 CFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/head CFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/libnvpair @@ -61,6 +65,8 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${SRCTOP}/lib/libpthread/thread CFLAGS+= -I${SRCTOP}/lib/libpthread/sys CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include +CFLAGS.lz4.o+= -D_FAKE_KERNEL +CFLAGS.lz4.pico+= -D_FAKE_KERNEL CFLAGS.gcc+= -fms-extensions LIBADD= md pthread z nvpair avl umem Modified: stable/12/stand/efi/boot1/Makefile ============================================================================== --- stable/12/stand/efi/boot1/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/efi/boot1/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -37,6 +37,7 @@ CFLAGS.zfs_module.c+= -I${ZFSSRC} CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/boot/zfs CFLAGS.zfs_module.c+= -I${SYSDIR}/crypto/skein CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common +CFLAGS.zfs_module.c+= -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 CFLAGS+= -DEFI_ZFS_BOOT .endif Modified: stable/12/stand/i386/gptzfsboot/Makefile ============================================================================== --- stable/12/stand/i386/gptzfsboot/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/i386/gptzfsboot/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -29,6 +29,7 @@ CFLAGS+=-DBOOTPROG=\"gptzfsboot\" \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \ -I${BOOTSRC}/i386/btx/lib \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast \ Modified: stable/12/stand/i386/zfsboot/Makefile ============================================================================== --- stable/12/stand/i386/zfsboot/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/i386/zfsboot/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -28,6 +28,7 @@ CFLAGS+=-DBOOTPROG=\"zfsboot\" \ -I${SYSDIR}/crypto/skein \ -I${SYSDIR}/cddl/boot/zfs \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SYSDIR}/cddl/contrib/opensolaris/common/lz4 \ -I${BOOTSRC}/i386/boot2 \ -Wall -Waggregate-return -Wbad-function-cast -Wno-cast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ Modified: stable/12/stand/libsa/Makefile ============================================================================== --- stable/12/stand/libsa/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/libsa/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -102,6 +102,11 @@ CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c +# lz4 decompression functionality +.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 +SRCS+= lz4.c +CFLAGS.lz4.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 + # Create a subset of includes that are safe, as well as adjusting those that aren't # The lists may drive people nuts, but they are explicitly opt-in FAKE_DIRS=xlocale arpa Modified: stable/12/stand/libsa/zfs/Makefile.inc ============================================================================== --- stable/12/stand/libsa/zfs/Makefile.inc Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/stand/libsa/zfs/Makefile.inc Mon Dec 2 11:44:39 2019 (r355285) @@ -12,4 +12,6 @@ CFLAGS+= -I${SYSDIR}/cddl/boot/zfs CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/common CFLAGS+= -I${SYSDIR}/crypto/skein +CFLAGS.zfs.c+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/lz4 + CFLAGS+= -Wformat -Wall Modified: stable/12/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/12/sys/cddl/boot/zfs/zfssubr.c Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/cddl/boot/zfs/zfssubr.c Mon Dec 2 11:44:39 2019 (r355285) @@ -26,6 +26,8 @@ #include __FBSDID("$FreeBSD$"); +#include + static uint64_t zfs_crc64_table[256]; #define ECKSUM 666 @@ -161,7 +163,6 @@ typedef struct zio_compress_info { #include "lzjb.c" #include "zle.c" -#include "lz4.c" /* * Compression vectors. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/Makefile.files Mon Dec 2 11:44:39 2019 (r355285) @@ -98,7 +98,6 @@ ZFS_COMMON_OBJS += \ dsl_scan.o \ zfeature.o \ gzip.o \ - lz4.o \ lzjb.o \ metaslab.o \ multilist.o \ Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/conf/files Mon Dec 2 11:44:39 2019 (r355285) @@ -139,6 +139,7 @@ cddl/compat/opensolaris/kern/opensolaris_vm.c optio cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/lz4/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" @@ -189,7 +190,6 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/uts/common/fs/zfs/multilist.c optional zfs compile-with "${ZFS_C}" Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/conf/kern.pre.mk Mon Dec 2 11:44:39 2019 (r355285) @@ -163,6 +163,7 @@ CDDL_C= ${CC} -c ${CDDL_CFLAGS} ${WERROR} ${PROF} ${. ZFS_CFLAGS= -DBUILDING_ZFS -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common/fs/zfs/lua ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/uts/common/zmod +ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/lz4 ZFS_CFLAGS+= -I$S/cddl/contrib/opensolaris/common/zfs ZFS_CFLAGS+= ${CDDL_CFLAGS} ZFS_ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${ZFS_CFLAGS} Modified: stable/12/sys/modules/zfs/Makefile ============================================================================== --- stable/12/sys/modules/zfs/Makefile Mon Dec 2 09:57:07 2019 (r355284) +++ stable/12/sys/modules/zfs/Makefile Mon Dec 2 11:44:39 2019 (r355285) @@ -18,6 +18,8 @@ SRCS+= opensolaris_nvpair_alloc_fixed.c SRCS+= opensolaris_fnvpair.c .PATH: ${SYSDIR}/cddl/contrib/opensolaris/common/unicode SRCS+= u8_textprep.c +.PATH: ${SUNW}/common/lz4 +SRCS+= lz4.c .PATH: ${SYSDIR}/cddl/compat/opensolaris/kern SRCS+= opensolaris_acl.c @@ -93,6 +95,7 @@ CFLAGS+=-I${SUNW}/uts/common/zmod CFLAGS+=-I${SUNW}/uts/common CFLAGS+=-I${SYSDIR} CFLAGS+=-I${SUNW}/common/zfs +CFLAGS+=-I${SUNW}/common/lz4 CFLAGS+=-I${SUNW}/common CFLAGS+=-DBUILDING_ZFS CFLAGS.gcc+=-fms-extensions From owner-svn-src-all@freebsd.org Mon Dec 2 12:26:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BC641A8A8F; Mon, 2 Dec 2019 12:26:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RPVw1nXnz3JZn; Mon, 2 Dec 2019 12:26:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2128D26EBE; Mon, 2 Dec 2019 12:26:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2CQmB4077611; Mon, 2 Dec 2019 12:26:48 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2CQmLX077610; Mon, 2 Dec 2019 12:26:48 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021226.xB2CQmLX077610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 12:26: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: r355286 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 355286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 12:26:48 -0000 Author: tsoome Date: Mon Dec 2 12:26:47 2019 New Revision: 355286 URL: https://svnweb.freebsd.org/changeset/base/355286 Log: MFC r354267: r354264 did mix up the directory path The correct path is sys/cddl/contrib/opensolaris/common/lz4, not sys/cddl/contrib/opensolaris/lz4 Reported by: Michael Butler Modified: stable/12/sys/conf/files Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Mon Dec 2 11:44:39 2019 (r355285) +++ stable/12/sys/conf/files Mon Dec 2 12:26:47 2019 (r355286) @@ -139,7 +139,7 @@ cddl/compat/opensolaris/kern/opensolaris_vm.c optio cddl/compat/opensolaris/kern/opensolaris_zone.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/acl/acl_common.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/avl/avl.c optional zfs compile-with "${ZFS_C}" -cddl/contrib/opensolaris/lz4/lz4.c optional zfs compile-with "${ZFS_C}" +cddl/contrib/opensolaris/common/lz4/lz4.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_fnvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c optional zfs compile-with "${ZFS_C}" cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair_alloc_fixed.c optional zfs compile-with "${ZFS_C}" From owner-svn-src-all@freebsd.org Mon Dec 2 14:21:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CC7F1AB4F3; Mon, 2 Dec 2019 14:21:41 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RS3S6cX0z3Ph1; Mon, 2 Dec 2019 14:21: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 C6753444; Mon, 2 Dec 2019 14:21:40 +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 xB2ELev5043348; Mon, 2 Dec 2019 14:21:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2ELeaF043347; Mon, 2 Dec 2019 14:21:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912021421.xB2ELeaF043347@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 2 Dec 2019 14:21:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355287 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 355287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 14:21:41 -0000 Author: kib Date: Mon Dec 2 14:21:40 2019 New Revision: 355287 URL: https://svnweb.freebsd.org/changeset/base/355287 Log: mlx5: Downgrade assert about misbehaving hardware to error message. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 2 12:26:47 2019 (r355286) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 2 14:21:40 2019 (r355287) @@ -137,9 +137,11 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) mdev->dump_rege[++i].addr = next_addr; addr = next_addr; } - KASSERT(i + 1 == sz, - ("inconsistent hw crspace reads: sz %u i %u addr %#lx", - sz, i, (unsigned long)addr)); + if (i + 1 != sz) { + mlx5_core_err(mdev, + "Inconsistent hw crspace reads: sz %u i %u addr %#lx", + sz, i, (unsigned long)addr); + } mdev->dump_size = mlx5_fwdump_getsize(mdev->dump_rege); mdev->dump_data = malloc(mdev->dump_size * sizeof(uint32_t), From owner-svn-src-all@freebsd.org Mon Dec 2 14:22:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45E1B1AB5DD; Mon, 2 Dec 2019 14:22:56 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RS4w17GDz3Q03; Mon, 2 Dec 2019 14:22:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B9C2493; Mon, 2 Dec 2019 14:22:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2EMtIE047961; Mon, 2 Dec 2019 14:22:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2EMtPt047960; Mon, 2 Dec 2019 14:22:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912021422.xB2EMtPt047960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 2 Dec 2019 14:22:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355288 - head/sys/dev/mlx5/mlx5_core X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_core X-SVN-Commit-Revision: 355288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 14:22:56 -0000 Author: kib Date: Mon Dec 2 14:22:55 2019 New Revision: 355288 URL: https://svnweb.freebsd.org/changeset/base/355288 Log: mlx5: Do not try to enable fwdumps if scan space did not responded. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 2 14:21:40 2019 (r355287) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fwdump.c Mon Dec 2 14:22:55 2019 (r355288) @@ -111,6 +111,10 @@ mlx5_fwdump_prep(struct mlx5_core_dev *mdev) sz++; addr = next_addr; } + if (sz == 1) { + mlx5_core_warn(mdev, "no output from scan space\n"); + goto unlock_vsc; + } mdev->dump_rege = malloc(sz * sizeof(struct mlx5_crspace_regmap), M_MLX5_DUMP, M_WAITOK | M_ZERO); From owner-svn-src-all@freebsd.org Mon Dec 2 15:07:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E6AE1AC96A; Mon, 2 Dec 2019 15:07:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RT3w1LHMz3x5m; Mon, 2 Dec 2019 15:07:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CCF6BB5; Mon, 2 Dec 2019 15:07:08 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2F77kV071619; Mon, 2 Dec 2019 15:07:07 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2F76BO071612; Mon, 2 Dec 2019 15:07:06 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912021507.xB2F76BO071612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Mon, 2 Dec 2019 15:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355289 - in head/sys: arm64/arm64 arm64/conf arm64/include conf X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/conf arm64/include conf X-SVN-Commit-Revision: 355289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:07:08 -0000 Author: jhibbits Date: Mon Dec 2 15:07:06 2019 New Revision: 355289 URL: https://svnweb.freebsd.org/changeset/base/355289 Log: revert r354714 "Boot arm64 kernel using booti command from U-boot." After discussing with mmel@, it was clear this is insufficient to address all the needs. mmel@ will commit his original patch, from https://reviews.freebsd.org/D13861, and the additions needed from r354714 will be made afterward. Requested by: mmel Sponsored by: Juniper Networks, Inc. Deleted: head/sys/arm64/arm64/machdep_boot.c Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/machdep.c head/sys/arm64/conf/GENERIC head/sys/arm64/include/machdep.h head/sys/conf/Makefile.arm64 head/sys/conf/files.arm64 head/sys/conf/options.arm64 Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/arm64/arm64/locore.S Mon Dec 2 15:07:06 2019 (r355289) @@ -54,29 +54,6 @@ .text .globl _start _start: -#ifdef LINUX_BOOT_ABI - /* - * See Documentation/arm64/booting.txt in the Linux kernel. - * This is needed to boot using U-Boot's booti command. - */ - -#define BOOTI_MAGIC 0x644d5241 -#define UBOOT_IMAGE_OFFSET 0 -#define UBOOT_IMAGE_SIZE _end - _start -#define UBOOT_IMAGE_FLAGS 0 - - b 1f /* Executable code */ - .long 0 /* Executable code */ - .quad UBOOT_IMAGE_OFFSET /* Image load offset, little endian */ - .quad UBOOT_IMAGE_SIZE /* Effective Image size, little endian */ - .quad UBOOT_IMAGE_FLAGS /* kernel flags, little endian */ - .quad 0 /* reserved */ - .quad 0 /* reserved */ - .quad 0 /* reserved */ - .long BOOTI_MAGIC /* Magic number, little endian, "ARM\x64" */ - .long 0 /* reserved (used for PE COFF offset) */ -1: -#endif /* Drop to EL1 */ bl drop_to_el1 @@ -371,25 +348,15 @@ create_pagetables: * Build the TTBR1 maps. */ + /* Find the size of the kernel */ mov x6, #(KERNBASE) - and x7, x0, x6 - cmp x7, x6 - b.eq 1f - /* booted from U-Boot */ - ldr x7, .Lend - sub x8, x7, x6 /* kernel size = end - begin */ - b 2f -1: - /* booted from FreeBSD loader */ - sub x8, x0, x6 /* size = modulep - begin */ + /* Find modulep - begin */ + sub x8, x0, x6 /* Add two 2MiB pages for the module data and round up */ ldr x7, =(3 * L2_SIZE - 1) add x8, x8, x7 -2: /* Get the number of l2 pages to allocate, rounded down */ lsr x10, x8, #(L2_SHIFT) - /* Add 1 to get actual count */ - add x10, x10, #1 /* Create the kernel space L2 table */ mov x6, x26 Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/arm64/arm64/machdep.c Mon Dec 2 15:07:06 2019 (r355289) @@ -964,16 +964,6 @@ try_load_dtb(caddr_t kmdp) vm_offset_t dtbp; dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); - -#if defined(FDT_DTB_STATIC) - /* - * In case the device tree blob was not retrieved (from metadata) try - * to use the statically embedded one. - */ - if (dtbp == 0) - dtbp = (vm_offset_t)&fdt_static_dtb; -#endif - if (dtbp == (vm_offset_t)NULL) { printf("ERROR loading DTB\n"); return; @@ -1077,26 +1067,6 @@ cache_setup(void) } } -static vm_offset_t -freebsd_parse_boot_param(struct arm64_bootparams *abp) -{ - vm_offset_t lastaddr; - void *kmdp; - static char *loader_envp; - - preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); - kmdp = preload_search_by_type("elf kernel"); - if (kmdp == NULL) - return (0); - - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); - init_static_kenv(loader_envp, 0); - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); - - return (lastaddr); -} - void initarm(struct arm64_bootparams *abp) { @@ -1112,31 +1082,26 @@ initarm(struct arm64_bootparams *abp) caddr_t kmdp; bool valid; - if ((abp->modulep & VM_MIN_KERNEL_ADDRESS) == - VM_MIN_KERNEL_ADDRESS) - /* Booted from loader. */ - lastaddr = freebsd_parse_boot_param(abp); -#ifdef LINUX_BOOT_ABI - else - /* Booted from U-Boot. */ - lastaddr = linux_parse_boot_param(abp); -#endif + /* Set the module data location */ + preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); /* Find the kernel address */ kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); + boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); + init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0); link_elf_ireloc(kmdp); #ifdef FDT try_load_dtb(kmdp); -#ifdef LINUX_BOOT_ABI - parse_bootargs(&lastaddr, abp); #endif -#endif efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t); + + /* Find the address to start allocating from */ + lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); /* Load the physical memory ranges */ efihdr = (struct efi_map_header *)preload_search_info(kmdp, Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/arm64/conf/GENERIC Mon Dec 2 15:07:06 2019 (r355289) @@ -77,7 +77,6 @@ options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.en options RCTL # Resource limits options SMP options INTRNG -options LINUX_BOOT_ABI # Boot using booti command from U-Boot # Debugging support. Always need this: options KDB # Enable kernel debugger support. Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/arm64/include/machdep.h Mon Dec 2 15:07:06 2019 (r355289) @@ -48,9 +48,5 @@ extern enum arm64_bus arm64_bus_method; void dbg_init(void); void initarm(struct arm64_bootparams *); extern void (*pagezero)(void *); -vm_offset_t linux_parse_boot_param(struct arm64_bootparams *); -#ifdef LINUX_BOOT_ABI -void parse_bootargs(vm_offset_t *, struct arm64_bootparams *); -#endif #endif /* _MACHINE_MACHDEP_H_ */ Modified: head/sys/conf/Makefile.arm64 ============================================================================== --- head/sys/conf/Makefile.arm64 Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/conf/Makefile.arm64 Mon Dec 2 15:07:06 2019 (r355289) @@ -31,18 +31,6 @@ INCLUDES+= -I$S/contrib/libfdt CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .endif -SYSTEM_LD_ = ${LD} -Bdynamic -T ldscript.$M.noheader \ - ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \ - --dynamic-linker /red/herring \ - -o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o - -SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// $(LDSCRIPT)\ - >ldscript.$M.noheader;\ - ${SYSTEM_LD_}; \ - ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ - ${KERNEL_KO}.bin; \ - rm ${FULLKERNEL}.noheader - %BEFORE_DEPEND %OBJS Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/conf/files.arm64 Mon Dec 2 15:07:06 2019 (r355289) @@ -154,7 +154,6 @@ arm64/arm64/identcpu.c standard arm64/arm64/in_cksum.c optional inet | inet6 arm64/arm64/locore.S standard no-obj arm64/arm64/machdep.c standard -arm64/arm64/machdep_boot.c optional linux_boot_abi arm64/arm64/mem.c standard arm64/arm64/memcpy.S standard arm64/arm64/memmove.S standard Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Mon Dec 2 14:22:55 2019 (r355288) +++ head/sys/conf/options.arm64 Mon Dec 2 15:07:06 2019 (r355289) @@ -2,7 +2,6 @@ ARM64 opt_global.h INTRNG opt_global.h -LINUX_BOOT_ABI opt_global.h SOCDEV_PA opt_global.h SOCDEV_VA opt_global.h THUNDERX_PASS_1_1_ERRATA opt_global.h From owner-svn-src-all@freebsd.org Mon Dec 2 15:28:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7E241AD44F; Mon, 2 Dec 2019 15:28:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RTX65GDFz3y9J; Mon, 2 Dec 2019 15:28:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97C36F44; Mon, 2 Dec 2019 15:28:06 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2FS65M083355; Mon, 2 Dec 2019 15:28:06 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2FS6RW083354; Mon, 2 Dec 2019 15:28:06 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021528.xB2FS6RW083354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 15: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: r355290 - stable/12/cddl/lib/libzpool X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/cddl/lib/libzpool X-SVN-Commit-Revision: 355290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:28:06 -0000 Author: tsoome Date: Mon Dec 2 15:28:06 2019 New Revision: 355290 URL: https://svnweb.freebsd.org/changeset/base/355290 Log: libzpool: lz4.c build needs CFLAGS.lz4.c For some reason the setup from CURRENT did not work, probably I did mix something up. Modified: stable/12/cddl/lib/libzpool/Makefile Modified: stable/12/cddl/lib/libzpool/Makefile ============================================================================== --- stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 15:07:06 2019 (r355289) +++ stable/12/cddl/lib/libzpool/Makefile Mon Dec 2 15:28:06 2019 (r355290) @@ -65,8 +65,7 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${SRCTOP}/lib/libpthread/thread CFLAGS+= -I${SRCTOP}/lib/libpthread/sys CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include -CFLAGS.lz4.o+= -D_FAKE_KERNEL -CFLAGS.lz4.pico+= -D_FAKE_KERNEL +CFLAGS.lz4.c += -D_FAKE_KERNEL CFLAGS.gcc+= -fms-extensions LIBADD= md pthread z nvpair avl umem From owner-svn-src-all@freebsd.org Mon Dec 2 15:37:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C8431AD97C; Mon, 2 Dec 2019 15:37:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RTkW1MCkz3yyN; Mon, 2 Dec 2019 15:37:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 121EF1117; Mon, 2 Dec 2019 15:37:07 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Fb6F1089783; Mon, 2 Dec 2019 15:37:06 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Fb6rS089782; Mon, 2 Dec 2019 15:37:06 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021537.xB2Fb6rS089782@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 15:37:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355291 - head/cddl/lib/libzpool X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/cddl/lib/libzpool X-SVN-Commit-Revision: 355291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:37:07 -0000 Author: tsoome Date: Mon Dec 2 15:37:06 2019 New Revision: 355291 URL: https://svnweb.freebsd.org/changeset/base/355291 Log: libzpool: use CFLAGS.lz4.c to build lz4.o and lz4.pico Clean up this Makefile a bit. Modified: head/cddl/lib/libzpool/Makefile Modified: head/cddl/lib/libzpool/Makefile ============================================================================== --- head/cddl/lib/libzpool/Makefile Mon Dec 2 15:28:06 2019 (r355290) +++ head/cddl/lib/libzpool/Makefile Mon Dec 2 15:37:06 2019 (r355291) @@ -66,8 +66,7 @@ CFLAGS+= -DWANTS_MUTEX_OWNED CFLAGS+= -I${SRCTOP}/lib/libpthread/thread CFLAGS+= -I${SRCTOP}/lib/libpthread/sys CFLAGS+= -I${SRCTOP}/lib/libthr/arch/${MACHINE_CPUARCH}/include -CFLAGS.lz4.o+= -D_FAKE_KERNEL -CFLAGS.lz4.pico+= -D_FAKE_KERNEL +CFLAGS.lz4.c+= -D_FAKE_KERNEL CFLAGS.gcc+= -fms-extensions LIBADD= md pthread z nvpair avl umem From owner-svn-src-all@freebsd.org Mon Dec 2 15:44:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E313A1ADCC0; Mon, 2 Dec 2019 15:44:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RTv85gJnz40Z4; Mon, 2 Dec 2019 15:44:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8CABD1303; Mon, 2 Dec 2019 15:44:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Fiamx095517; Mon, 2 Dec 2019 15:44:36 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2FiagV095516; Mon, 2 Dec 2019 15:44:36 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912021544.xB2FiagV095516@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 15:44:36 +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: r355292 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 355292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:44:36 -0000 Author: tsoome Date: Mon Dec 2 15:44:36 2019 New Revision: 355292 URL: https://svnweb.freebsd.org/changeset/base/355292 Log: MFC r355291: Fix mergeinfo. Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Mon Dec 2 15:56:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BB3A1AE6BA; Mon, 2 Dec 2019 15:56:02 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RV8K6Y7dz41pq; Mon, 2 Dec 2019 15:56:01 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C40D914C2; Mon, 2 Dec 2019 15:56:01 +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 xB2Fu1RI001301; Mon, 2 Dec 2019 15:56:01 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Fu14t001300; Mon, 2 Dec 2019 15:56:01 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912021556.xB2Fu14t001300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Dec 2019 15:56:01 +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: r355293 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 355293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:56:02 -0000 Author: markj Date: Mon Dec 2 15:56:01 2019 New Revision: 355293 URL: https://svnweb.freebsd.org/changeset/base/355293 Log: MFC r354816: Implement vm.pmap.kernel_maps for arm64. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:44:36 2019 (r355292) +++ stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:56:01 2019 (r355293) @@ -120,6 +120,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -5972,3 +5973,212 @@ pmap_is_valid_memattr(pmap_t pmap __unused, vm_memattr return (mode >= VM_MEMATTR_DEVICE && mode <= VM_MEMATTR_WRITE_THROUGH); } + +/* + * Track a range of the kernel's virtual address space that is contiguous + * in various mapping attributes. + */ +struct pmap_kernel_map_range { + vm_offset_t sva; + pt_entry_t attrs; + int l3pages; + int l3contig; + int l2blocks; + int l1blocks; +}; + +static void +sysctl_kmaps_dump(struct sbuf *sb, struct pmap_kernel_map_range *range, + vm_offset_t eva) +{ + const char *mode; + int index; + + if (eva <= range->sva) + return; + + index = range->attrs & ATTR_IDX_MASK; + switch (index) { + case ATTR_IDX(VM_MEMATTR_DEVICE): + mode = "DEV"; + break; + case ATTR_IDX(VM_MEMATTR_UNCACHEABLE): + mode = "UC"; + break; + case ATTR_IDX(VM_MEMATTR_WRITE_BACK): + mode = "WB"; + break; + case ATTR_IDX(VM_MEMATTR_WRITE_THROUGH): + mode = "WT"; + break; + default: + printf( + "%s: unknown memory type %x for range 0x%016lx-0x%016lx\n", + __func__, index, range->sva, eva); + mode = "??"; + break; + } + + sbuf_printf(sb, "0x%016lx-0x%016lx r%c%c%c %3s %d %d %d %d\n", + range->sva, eva, + (range->attrs & ATTR_AP_RW_BIT) == ATTR_AP_RW ? 'w' : '-', + (range->attrs & ATTR_PXN) != 0 ? '-' : 'x', + (range->attrs & ATTR_AP_USER) != 0 ? 'u' : 's', + mode, range->l1blocks, range->l2blocks, range->l3contig, + range->l3pages); + + /* Reset to sentinel value. */ + range->sva = 0xfffffffffffffffful; +} + +/* + * Determine whether the attributes specified by a page table entry match those + * being tracked by the current range. + */ +static bool +sysctl_kmaps_match(struct pmap_kernel_map_range *range, pt_entry_t attrs) +{ + + return (range->attrs == attrs); +} + +static void +sysctl_kmaps_reinit(struct pmap_kernel_map_range *range, vm_offset_t va, + pt_entry_t attrs) +{ + + memset(range, 0, sizeof(*range)); + range->sva = va; + range->attrs = attrs; +} + +/* + * Given a leaf PTE, derive the mapping's attributes. If they do not match + * those of the current run, dump the address range and its attributes, and + * begin a new run. + */ +static void +sysctl_kmaps_check(struct sbuf *sb, struct pmap_kernel_map_range *range, + vm_offset_t va, pd_entry_t l0e, pd_entry_t l1e, pd_entry_t l2e, + pt_entry_t l3e) +{ + pt_entry_t attrs; + + attrs = l0e & (ATTR_AP_MASK | ATTR_XN); + attrs |= l1e & (ATTR_AP_MASK | ATTR_XN); + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) + attrs |= l1e & ATTR_IDX_MASK; + attrs |= l2e & (ATTR_AP_MASK | ATTR_XN); + if ((l2e & ATTR_DESCR_MASK) == L2_BLOCK) + attrs |= l2e & ATTR_IDX_MASK; + attrs |= l3e & (ATTR_AP_MASK | ATTR_XN | ATTR_IDX_MASK); + + if (range->sva > va || !sysctl_kmaps_match(range, attrs)) { + sysctl_kmaps_dump(sb, range, va); + sysctl_kmaps_reinit(range, va, attrs); + } +} + +static int +sysctl_kmaps(SYSCTL_HANDLER_ARGS) +{ + struct pmap_kernel_map_range range; + struct sbuf sbuf, *sb; + pd_entry_t l0e, *l1, l1e, *l2, l2e; + pt_entry_t *l3, l3e; + vm_offset_t sva; + vm_paddr_t pa; + int error, i, j, k, l; + + error = sysctl_wire_old_buffer(req, 0); + if (error != 0) + return (error); + sb = &sbuf; + sbuf_new_for_sysctl(sb, NULL, PAGE_SIZE, req); + + /* Sentinel value. */ + range.sva = 0xfffffffffffffffful; + + /* + * Iterate over the kernel page tables without holding the kernel pmap + * lock. Kernel page table pages are never freed, so at worst we will + * observe inconsistencies in the output. + */ + for (sva = 0xffff000000000000ul, i = pmap_l0_index(sva); i < Ln_ENTRIES; + i++) { + if (i == pmap_l0_index(DMAP_MIN_ADDRESS)) + sbuf_printf(sb, "\nDirect map:\n"); + else if (i == pmap_l0_index(VM_MIN_KERNEL_ADDRESS)) + sbuf_printf(sb, "\nKernel map:\n"); + + l0e = kernel_pmap->pm_l0[i]; + if ((l0e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L0_SIZE; + continue; + } + pa = l0e & ~ATTR_MASK; + l1 = (pd_entry_t *)PHYS_TO_DMAP(pa); + + for (j = pmap_l1_index(sva); j < Ln_ENTRIES; j++) { + l1e = l1[j]; + if ((l1e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L1_SIZE; + continue; + } + if ((l1e & ATTR_DESCR_MASK) == L1_BLOCK) { + sysctl_kmaps_check(sb, &range, sva, l0e, l1e, + 0, 0); + range.l1blocks++; + sva += L1_SIZE; + continue; + } + pa = l1e & ~ATTR_MASK; + l2 = (pd_entry_t *)PHYS_TO_DMAP(pa); + + for (k = pmap_l2_index(sva); k < Ln_ENTRIES; k++) { + l2e = l2[k]; + if ((l2e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, sva); + sva += L2_SIZE; + continue; + } + if ((l2e & ATTR_DESCR_MASK) == L2_BLOCK) { + sysctl_kmaps_check(sb, &range, sva, + l0e, l1e, l2e, 0); + range.l2blocks++; + sva += L2_SIZE; + continue; + } + pa = l2e & ~ATTR_MASK; + l3 = (pt_entry_t *)PHYS_TO_DMAP(pa); + + for (l = pmap_l3_index(sva); l < Ln_ENTRIES; + l++, sva += L3_SIZE) { + l3e = l3[l]; + if ((l3e & ATTR_DESCR_VALID) == 0) { + sysctl_kmaps_dump(sb, &range, + sva); + continue; + } + sysctl_kmaps_check(sb, &range, sva, + l0e, l1e, l2e, l3e); + if ((l3e & ATTR_CONTIGUOUS) != 0) + range.l3contig += l % 16 == 0 ? + 1 : 0; + else + range.l3pages++; + } + } + } + } + + error = sbuf_finish(sb); + sbuf_delete(sb); + return (error); +} +SYSCTL_OID(_vm_pmap, OID_AUTO, kernel_maps, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, + NULL, 0, sysctl_kmaps, "A", + "Dump kernel address layout"); From owner-svn-src-all@freebsd.org Mon Dec 2 15:57:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 364611AE7BF; Mon, 2 Dec 2019 15:57:26 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RV9y0fgQz41yM; Mon, 2 Dec 2019 15:57:26 +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 EE77714C3; Mon, 2 Dec 2019 15:57:25 +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 xB2FvPIm001403; Mon, 2 Dec 2019 15:57:25 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2FvPXn001402; Mon, 2 Dec 2019 15:57:25 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912021557.xB2FvPXn001402@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Dec 2019 15:57:25 +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: r355294 - stable/12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/arm64/arm64 X-SVN-Commit-Revision: 355294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 15:57:26 -0000 Author: markj Date: Mon Dec 2 15:57:25 2019 New Revision: 355294 URL: https://svnweb.freebsd.org/changeset/base/355294 Log: MFC r354815: Let arm64 pmap_qenter() and pmap_kenter() unconditionally set NX. Modified: stable/12/sys/arm64/arm64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm64/arm64/pmap.c ============================================================================== --- stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:56:01 2019 (r355293) +++ stable/12/sys/arm64/arm64/pmap.c Mon Dec 2 15:57:25 2019 (r355294) @@ -1179,10 +1179,8 @@ pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_ KASSERT((size & PAGE_MASK) == 0, ("pmap_kenter: Mapping is not page-sized")); - attr = ATTR_DEFAULT | ATTR_IDX(mode) | L3_PAGE; - if (mode == DEVICE_MEMORY) - attr |= ATTR_XN; - + attr = ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | ATTR_XN | ATTR_IDX(mode) | + L3_PAGE; va = sva; while (size != 0) { pde = pmap_pde(kernel_pmap, va, &lvl); @@ -1297,9 +1295,7 @@ pmap_qenter(vm_offset_t sva, vm_page_t *ma, int count) m = ma[i]; pa = VM_PAGE_TO_PHYS(m) | ATTR_DEFAULT | ATTR_AP(ATTR_AP_RW) | - ATTR_IDX(m->md.pv_memattr) | L3_PAGE; - if (m->md.pv_memattr == DEVICE_MEMORY) - pa |= ATTR_XN; + ATTR_XN | ATTR_IDX(m->md.pv_memattr) | L3_PAGE; pte = pmap_l2_to_l3(pde, va); pmap_load_store(pte, pa); From owner-svn-src-all@freebsd.org Mon Dec 2 16:15:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EC341AEFC5; Mon, 2 Dec 2019 16:15:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RVZb2GSCz42wq; Mon, 2 Dec 2019 16:15:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 310C31852; Mon, 2 Dec 2019 16:15:19 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2GFJoj013132; Mon, 2 Dec 2019 16:15:19 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2GFJ0Y013131; Mon, 2 Dec 2019 16:15:19 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912021615.xB2GFJ0Y013131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 2 Dec 2019 16:15:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355295 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 355295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 16:15:19 -0000 Author: ian Date: Mon Dec 2 16:15:18 2019 New Revision: 355295 URL: https://svnweb.freebsd.org/changeset/base/355295 Log: Remove "all rights reserved" from copyright after getting a response from Luiz that he also was not intentionally asserting that right, it was already there when he added his name. Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Mon Dec 2 15:57:25 2019 (r355294) +++ head/sys/dev/gpio/gpioiic.c Mon Dec 2 16:15:18 2019 (r355295) @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2009 Oleksandr Tymoshenko - * Copyright (c) 2010 Luiz Otavio O Souza All rights reserved. + * Copyright (c) 2010 Luiz Otavio O Souza * Copyright (c) 2019 Ian Lepore * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Mon Dec 2 17:28:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 817641B113E; Mon, 2 Dec 2019 17:28:21 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RXBs2wzTz46dl; Mon, 2 Dec 2019 17:28:21 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 47D732576; Mon, 2 Dec 2019 17:28:21 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2HSLAk053970; Mon, 2 Dec 2019 17:28:21 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2HSLRT053969; Mon, 2 Dec 2019 17:28:21 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912021728.xB2HSLRT053969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Mon, 2 Dec 2019 17:28:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355296 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 17:28:21 -0000 Author: dougm Date: Mon Dec 2 17:28:20 2019 New Revision: 355296 URL: https://svnweb.freebsd.org/changeset/base/355296 Log: MFC r348749 - Speed-up vm_reserv_reclaim_config. Requested by: markj Modified: stable/12/sys/vm/vm_reserv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_reserv.c ============================================================================== --- stable/12/sys/vm/vm_reserv.c Mon Dec 2 16:15:18 2019 (r355295) +++ stable/12/sys/vm/vm_reserv.c Mon Dec 2 17:28:20 2019 (r355296) @@ -1278,10 +1278,89 @@ vm_reserv_reclaim_inactive(int domain) } /* + * Determine whether this reservation has free pages that satisfy the given + * request for contiguous physical memory. Start searching from the lower + * bound, defined by low_index. + * + * The free page queue lock must be held. + */ +static bool +vm_reserv_test_contig(vm_reserv_t rv, u_long npages, vm_paddr_t low, + vm_paddr_t high, u_long alignment, vm_paddr_t boundary) +{ + vm_paddr_t pa, size; + u_long changes; + int bitpos, bits_left, i, hi, lo, n; + + vm_reserv_assert_locked(rv); + size = npages << PAGE_SHIFT; + pa = VM_PAGE_TO_PHYS(&rv->pages[0]); + lo = (pa < low) ? + ((low + PAGE_MASK - pa) >> PAGE_SHIFT) : 0; + i = lo / NBPOPMAP; + changes = rv->popmap[i] | ((1UL << (lo % NBPOPMAP)) - 1); + hi = (pa + VM_LEVEL_0_SIZE > high) ? + ((high + PAGE_MASK - pa) >> PAGE_SHIFT) : VM_LEVEL_0_NPAGES; + n = hi / NBPOPMAP; + bits_left = hi % NBPOPMAP; + hi = lo = -1; + for (;;) { + /* + * "changes" is a bitmask that marks where a new sequence of + * 0s or 1s begins in popmap[i], with last bit in popmap[i-1] + * considered to be 1 if and only if lo == hi. The bits of + * popmap[-1] and popmap[NPOPMAP] are considered all 1s. + */ + changes ^= (changes << 1) | (lo == hi); + while (changes != 0) { + /* + * If the next change marked begins a run of 0s, set + * lo to mark that position. Otherwise set hi and + * look for a satisfactory first page from lo up to hi. + */ + bitpos = ffsl(changes) - 1; + changes ^= 1UL << bitpos; + if (lo == hi) { + lo = NBPOPMAP * i + bitpos; + continue; + } + hi = NBPOPMAP * i + bitpos; + pa = VM_PAGE_TO_PHYS(&rv->pages[lo]); + if ((pa & (alignment - 1)) != 0) { + /* Skip to next aligned page. */ + lo += (((pa - 1) | (alignment - 1)) + 1) >> + PAGE_SHIFT; + if (lo >= VM_LEVEL_0_NPAGES) + return (false); + pa = VM_PAGE_TO_PHYS(&rv->pages[lo]); + } + if (((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { + /* Skip to next boundary-matching page. */ + lo += (((pa - 1) | (boundary - 1)) + 1) >> + PAGE_SHIFT; + if (lo >= VM_LEVEL_0_NPAGES) + return (false); + pa = VM_PAGE_TO_PHYS(&rv->pages[lo]); + } + if (lo * PAGE_SIZE + size <= hi * PAGE_SIZE) + return (true); + lo = hi; + } + if (++i < n) + changes = rv->popmap[i]; + else if (i == n) + changes = bits_left == 0 ? -1UL : + (rv->popmap[n] | (-1UL << bits_left)); + else + return (false); + } +} + +/* * Searches the partially populated reservation queue for the least recently * changed reservation with free pages that satisfy the given request for * contiguous physical memory. If a satisfactory reservation is found, it is - * broken. Returns TRUE if a reservation is broken and FALSE otherwise. + * broken. Returns true if a reservation is broken and false otherwise. * * The free page queue lock must be held. */ @@ -1291,21 +1370,19 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm { vm_paddr_t pa, size; vm_reserv_t rv, rvn; - int hi, i, lo, low_index, next_free; if (npages > VM_LEVEL_0_NPAGES - 1) - return (FALSE); + return (false); size = npages << PAGE_SHIFT; vm_reserv_domain_lock(domain); again: for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { rvn = TAILQ_NEXT(rv, partpopq); - pa = VM_PAGE_TO_PHYS(&rv->pages[VM_LEVEL_0_NPAGES - 1]); - if (pa + PAGE_SIZE - size < low) { + pa = VM_PAGE_TO_PHYS(&rv->pages[0]); + if (pa + VM_LEVEL_0_SIZE - size < low) { /* This entire reservation is too low; go to next. */ continue; } - pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + size > high) { /* This entire reservation is too high; go to next. */ continue; @@ -1321,73 +1398,19 @@ again: } } else vm_reserv_domain_unlock(domain); - if (pa < low) { - /* Start the search for free pages at "low". */ - low_index = (low + PAGE_MASK - pa) >> PAGE_SHIFT; - i = low_index / NBPOPMAP; - hi = low_index % NBPOPMAP; - } else - i = hi = 0; - do { - /* Find the next free page. */ - lo = ffsl(~(((1UL << hi) - 1) | rv->popmap[i])); - while (lo == 0 && ++i < NPOPMAP) - lo = ffsl(~rv->popmap[i]); - if (i == NPOPMAP) - break; - /* Convert from ffsl() to ordinary bit numbering. */ - lo--; - next_free = NBPOPMAP * i + lo; - pa = VM_PAGE_TO_PHYS(&rv->pages[next_free]); - KASSERT(pa >= low, - ("vm_reserv_reclaim_contig: pa is too low")); - if (pa + size > high) { - /* The rest of this reservation is too high. */ - break; - } else if ((pa & (alignment - 1)) != 0 || - ((pa ^ (pa + size - 1)) & ~(boundary - 1)) != 0) { - /* - * The current page doesn't meet the alignment - * and/or boundary requirements. Continue - * searching this reservation until the rest - * of its free pages are either excluded or - * exhausted. - */ - hi = lo + 1; - if (hi >= NBPOPMAP) { - hi = 0; - i++; - } - continue; - } - /* Find the next used page. */ - hi = ffsl(rv->popmap[i] & ~((1UL << lo) - 1)); - while (hi == 0 && ++i < NPOPMAP) { - if ((NBPOPMAP * i - next_free) * PAGE_SIZE >= - size) { - vm_reserv_reclaim(rv); - vm_reserv_unlock(rv); - return (TRUE); - } - hi = ffsl(rv->popmap[i]); - } - /* Convert from ffsl() to ordinary bit numbering. */ - if (i != NPOPMAP) - hi--; - if ((NBPOPMAP * i + hi - next_free) * PAGE_SIZE >= - size) { - vm_reserv_reclaim(rv); - vm_reserv_unlock(rv); - return (TRUE); - } - } while (i < NPOPMAP); + if (vm_reserv_test_contig(rv, npages, low, high, + alignment, boundary)) { + vm_reserv_reclaim(rv); + vm_reserv_unlock(rv); + return (true); + } vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); if (rvn != NULL && !rvn->inpartpopq) goto again; } vm_reserv_domain_unlock(domain); - return (FALSE); + return (false); } /* From owner-svn-src-all@freebsd.org Mon Dec 2 17:53:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C36541B1BA0; Mon, 2 Dec 2019 17:53:32 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RXlw4bJSz4897; Mon, 2 Dec 2019 17:53:32 +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 80DCE2B09; Mon, 2 Dec 2019 17:53:32 +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 xB2HrWZ2071607; Mon, 2 Dec 2019 17:53:32 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2HrWGW071606; Mon, 2 Dec 2019 17:53:32 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912021753.xB2HrWGW071606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 2 Dec 2019 17:53:32 +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: r355297 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 17:53:32 -0000 Author: markj Date: Mon Dec 2 17:53:32 2019 New Revision: 355297 URL: https://svnweb.freebsd.org/changeset/base/355297 Log: MFC r354821: Group per-domain reservation data in the same structure. Modified: stable/12/sys/vm/vm_reserv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_reserv.c ============================================================================== --- stable/12/sys/vm/vm_reserv.c Mon Dec 2 17:28:20 2019 (r355296) +++ stable/12/sys/vm/vm_reserv.c Mon Dec 2 17:53:32 2019 (r355297) @@ -188,15 +188,15 @@ popmap_is_set(popmap_t popmap[], int i) */ struct vm_reserv { struct mtx lock; /* reservation lock. */ - TAILQ_ENTRY(vm_reserv) partpopq; /* (d) per-domain queue. */ + TAILQ_ENTRY(vm_reserv) partpopq; /* (d, r) per-domain queue. */ LIST_ENTRY(vm_reserv) objq; /* (o, r) object queue */ vm_object_t object; /* (o, r) containing object */ vm_pindex_t pindex; /* (o, r) offset in object */ vm_page_t pages; /* (c) first page */ - uint16_t domain; /* (c) NUMA domain. */ uint16_t popcnt; /* (r) # of pages in use */ + uint8_t domain; /* (c) NUMA domain. */ + char inpartpopq; /* (d, r) */ int lasttick; /* (r) last pop update tick. */ - char inpartpopq; /* (d) */ popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; @@ -207,12 +207,6 @@ struct vm_reserv { #define vm_reserv_trylock(rv) mtx_trylock(vm_reserv_lockptr(rv)) #define vm_reserv_unlock(rv) mtx_unlock(vm_reserv_lockptr(rv)) -static struct mtx_padalign vm_reserv_domain_locks[MAXMEMDOM]; - -#define vm_reserv_domain_lockptr(d) &vm_reserv_domain_locks[(d)] -#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) -#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) - /* * The reservation array * @@ -237,16 +231,25 @@ static struct mtx_padalign vm_reserv_domain_locks[MAXM static vm_reserv_t vm_reserv_array; /* - * The partially populated reservation queue + * The per-domain partially populated reservation queues * - * This queue enables the fast recovery of an unused free small page from a - * partially populated reservation. The reservation at the head of this queue + * These queues enable the fast recovery of an unused free small page from a + * partially populated reservation. The reservation at the head of a queue * is the least recently changed, partially populated reservation. * - * Access to this queue is synchronized by the free page queue lock. + * Access to this queue is synchronized by the per-domain reservation lock. */ -static TAILQ_HEAD(, vm_reserv) vm_rvq_partpop[MAXMEMDOM]; +struct vm_reserv_domain { + struct mtx lock; + TAILQ_HEAD(, vm_reserv) partpop; +} __aligned(CACHE_LINE_SIZE); +static struct vm_reserv_domain vm_rvd[MAXMEMDOM]; + +#define vm_reserv_domain_lockptr(d) (&vm_rvd[(d)].lock) +#define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) + static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); static counter_u64_t vm_reserv_broken = EARLY_COUNTER; @@ -301,8 +304,8 @@ static void vm_reserv_reclaim(vm_reserv_t rv); /* * Returns the current number of full reservations. * - * Since the number of full reservations is computed without acquiring the - * free page queue lock, the returned value may be inexact. + * Since the number of full reservations is computed without acquiring any + * locks, the returned value is inexact. */ static int sysctl_vm_reserv_fullpop(SYSCTL_HANDLER_ARGS) @@ -346,7 +349,7 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) counter = 0; unused_pages = 0; vm_reserv_domain_lock(domain); - TAILQ_FOREACH(rv, &vm_rvq_partpop[domain], partpopq) { + TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } @@ -449,12 +452,13 @@ vm_reserv_depopulate(vm_reserv_t rv, int index) rv->popcnt == 0) { vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } if (rv->popcnt != 0) { rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, + partpopq); } vm_reserv_domain_unlock(rv->domain); rv->lasttick = ticks; @@ -531,8 +535,6 @@ vm_reserv_has_pindex(vm_reserv_t rv, vm_pindex_t pinde /* * Increases the given reservation's population count. Moves the reservation * to the tail of the partially populated reservation queue. - * - * The free page queue must be locked. */ static void vm_reserv_populate(vm_reserv_t rv, int index) @@ -561,12 +563,12 @@ vm_reserv_populate(vm_reserv_t rv, int index) rv->lasttick = ticks; vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } if (rv->popcnt < VM_LEVEL_0_NPAGES) { rv->inpartpopq = TRUE; - TAILQ_INSERT_TAIL(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_INSERT_TAIL(&vm_rvd[rv->domain].partpop, rv, partpopq); } else { KASSERT(rv->pages->psind == 0, ("vm_reserv_populate: reserv %p is already promoted", @@ -1026,7 +1028,7 @@ vm_reserv_alloc_page(int req, vm_object_t object, vm_p * population count and map are reset to their initial state. * * The given reservation must not be in the partially populated reservation - * queue. The free page queue lock must be held. + * queue. */ static void vm_reserv_break(vm_reserv_t rv) @@ -1108,7 +1110,7 @@ vm_reserv_break_all(vm_object_t object) } vm_reserv_domain_lock(rv->domain); if (rv->inpartpopq) { - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; } vm_reserv_domain_unlock(rv->domain); @@ -1120,8 +1122,6 @@ vm_reserv_break_all(vm_object_t object) /* * Frees the given page if it belongs to a reservation. Returns TRUE if the * page is freed and FALSE otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_free_page(vm_page_t m) @@ -1175,9 +1175,8 @@ vm_reserv_init(void) } } for (i = 0; i < MAXMEMDOM; i++) { - mtx_init(&vm_reserv_domain_locks[i], "VM reserv domain", NULL, - MTX_DEF); - TAILQ_INIT(&vm_rvq_partpop[i]); + mtx_init(&vm_rvd[i].lock, "VM reserv domain", NULL, MTX_DEF); + TAILQ_INIT(&vm_rvd[i].partpop); } for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) @@ -1229,8 +1228,6 @@ vm_reserv_level_iffullpop(vm_page_t m) /* * Breaks the given partially populated reservation, releasing its free pages * to the physical memory allocator. - * - * The free page queue lock must be held. */ static void vm_reserv_reclaim(vm_reserv_t rv) @@ -1245,7 +1242,7 @@ vm_reserv_reclaim(vm_reserv_t rv) KASSERT(rv->domain < vm_ndomains, ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", rv, rv->domain)); - TAILQ_REMOVE(&vm_rvq_partpop[rv->domain], rv, partpopq); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; vm_reserv_domain_unlock(rv->domain); vm_reserv_break(rv); @@ -1256,17 +1253,15 @@ vm_reserv_reclaim(vm_reserv_t rv) * Breaks the reservation at the head of the partially populated reservation * queue, releasing its free pages to the physical memory allocator. Returns * TRUE if a reservation is broken and FALSE otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - while ((rv = TAILQ_FIRST(&vm_rvq_partpop[domain])) != NULL) { + while ((rv = TAILQ_FIRST(&vm_rvd[domain].partpop)) != NULL) { vm_reserv_lock(rv); - if (rv != TAILQ_FIRST(&vm_rvq_partpop[domain])) { + if (rv != TAILQ_FIRST(&vm_rvd[domain].partpop)) { vm_reserv_unlock(rv); continue; } @@ -1281,8 +1276,6 @@ vm_reserv_reclaim_inactive(int domain) * Determine whether this reservation has free pages that satisfy the given * request for contiguous physical memory. Start searching from the lower * bound, defined by low_index. - * - * The free page queue lock must be held. */ static bool vm_reserv_test_contig(vm_reserv_t rv, u_long npages, vm_paddr_t low, @@ -1361,8 +1354,6 @@ vm_reserv_test_contig(vm_reserv_t rv, u_long npages, v * changed reservation with free pages that satisfy the given request for * contiguous physical memory. If a satisfactory reservation is found, it is * broken. Returns true if a reservation is broken and false otherwise. - * - * The free page queue lock must be held. */ boolean_t vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, @@ -1376,7 +1367,7 @@ vm_reserv_reclaim_contig(int domain, u_long npages, vm size = npages << PAGE_SHIFT; vm_reserv_domain_lock(domain); again: - for (rv = TAILQ_FIRST(&vm_rvq_partpop[domain]); rv != NULL; rv = rvn) { + for (rv = TAILQ_FIRST(&vm_rvd[domain].partpop); rv != NULL; rv = rvn) { rvn = TAILQ_NEXT(rv, partpopq); pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + VM_LEVEL_0_SIZE - size < low) { From owner-svn-src-all@freebsd.org Mon Dec 2 17:55:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4A2C1B1C4C; Mon, 2 Dec 2019 17:55:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RXpQ3wjZz48Hx; Mon, 2 Dec 2019 17:55:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id E205114DE8; Mon, 2 Dec 2019 17:55:41 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r355097 - in head: sys/kern tests/sys/kern To: Mariusz Zaborski , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911251833.xAPIXM9h040583@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <82757e82-e26c-f92f-66cf-a03f22cffe9b@FreeBSD.org> Date: Mon, 2 Dec 2019 09:55:37 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201911251833.xAPIXM9h040583@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 17:55:42 -0000 On 11/25/19 10:33 AM, Mariusz Zaborski wrote: > Author: oshogbo > Date: Mon Nov 25 18:33:21 2019 > New Revision: 355097 > URL: https://svnweb.freebsd.org/changeset/base/355097 > > Log: > procdesc: allow to collect status through wait(1) if process is traced > > The debugger like truss(1) depends on the wait(2) syscall. This syscall > waits for ALL children. When it is waiting for ALL child's the children > created by process descriptors are not returned. This behavior was > introduced because we want to implement libraries which may pdfork(1). > > The behavior of process descriptor brakes truss(1) because it will > not be able to collect the status of processes with process descriptors. > > To address this problem the status is returned to parent when the > child is traced. While the process is traced the debugger is the new parent. > In case the original parent and debugger are the same process it means the > debugger explicitly used pdfork() to create the child. In that case the debugger > should be using kqueue()/pdwait() instead of wait(). > > Add test case to verify that. The test case was implemented by markj@. Does this fix PR 201276? Also, what about PRs 220324 and 232679? -- John Baldwin From owner-svn-src-all@freebsd.org Mon Dec 2 18:27:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A86C1B3226; Mon, 2 Dec 2019 18:27:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RYVZ3gfpz4C6q; Mon, 2 Dec 2019 18:27:02 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id B27AA15157; Mon, 2 Dec 2019 18:27:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r355241 - head/sys/kern To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911301933.xAUJX2DB030548@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <6cd7168c-8212-3001-fb8f-09ecaca93e61@FreeBSD.org> Date: Mon, 2 Dec 2019 10:27:00 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201911301933.xAUJX2DB030548@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 18:27:02 -0000 On 11/30/19 11:33 AM, Mateusz Guzik wrote: > Author: mjg > Date: Sat Nov 30 19:33:02 2019 > New Revision: 355241 > URL: https://svnweb.freebsd.org/changeset/base/355241 > > Log: > smp: cast the read in quiesce_all_critical through void * > > Fixes compilation on some 32-bit arm platforms. > > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/kern/subr_smp.c > > Modified: head/sys/kern/subr_smp.c > ============================================================================== > --- head/sys/kern/subr_smp.c Sat Nov 30 19:21:29 2019 (r355240) > +++ head/sys/kern/subr_smp.c Sat Nov 30 19:33:02 2019 (r355241) > @@ -952,7 +952,7 @@ quiesce_all_critical(void) > break; > cpu_spinwait(); > newtd = (struct thread *) > - atomic_load_acq_ptr((u_long *)pcpu->pc_curthread); > + atomic_load_acq_ptr((void *)pcpu->pc_curthread); Why not uintptr_t *? I think that's the defined type for atomic_*_ptr anyway? -- John Baldwin From owner-svn-src-all@freebsd.org Mon Dec 2 19:27:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA6411B48C1; Mon, 2 Dec 2019 19:27:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RZr45v1Gz4Fb5; Mon, 2 Dec 2019 19:27:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id C70051581C; Mon, 2 Dec 2019 19:27:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354977 - in head: share/man/man3 sys/sys tests/sys/sys To: "Keller, Jacob E" , "kostikbel@gmail.com" Cc: "src-committers@freebsd.org" , "cem@freebsd.org" , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "erj@freebsd.org" References: <201911211957.xALJvuwi054399@repo.freebsd.org> <0435131fb462d6930409ce335af25dd5a33ec2b2.camel@intel.com> <20191122002233.GJ2707@kib.kiev.ua> <363f0fb5ec2924d2fb79d337030a7a3133467258.camel@intel.com> <20191122003451.GK2707@kib.kiev.ua> <8f81e1457580142d077b074124a355d70793f250.camel@intel.com> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Mon, 2 Dec 2019 10:17:04 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <8f81e1457580142d077b074124a355d70793f250.camel@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 19:27:17 -0000 On 11/21/19 4:50 PM, Keller, Jacob E wrote: > On Fri, 2019-11-22 at 02:34 +0200, Konstantin Belousov wrote: >> On Fri, Nov 22, 2019 at 12:25:00AM +0000, Keller, Jacob E wrote: >>> On Fri, 2019-11-22 at 02:22 +0200, Konstantin Belousov wrote: >>>> On Thu, Nov 21, 2019 at 09:52:54PM +0000, Keller, Jacob E wrote: >>>>> We use a bit string as a method of determining which index >>>>> numbers >>>>> have >>>>> been assigned. >>>> For unit numbers we have unr(9) as well. >>> >>> Does unr have support for allocating contiguous sequences of unit >>> numbers? >> >> No, it does not. Although the data structure is optimized to track >> contiguous runs, there is currently no API to allocate the chunk of >> desired >> length. > > Hmm. Might make more sense to extend the API to allow requesting chunks > of desired length, and then use that. Well, there is also the rman structure which does handle runs. However, I think vmem is probably what you should use. cxgbe(4) uses it to manage sub-allocations of on-card memory for TLS keys and other buffers. You can write simple wrapper functions for your use case around vmem_* that the rest of your driver can use. I don't think it really makes sense to extend bitstring or unr. I think we should leave those for more specific use cases and use vmem for cases that need a more general solution. -- John Baldwin From owner-svn-src-all@freebsd.org Mon Dec 2 19:57:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CD631B55A1; Mon, 2 Dec 2019 19:57:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RbVn0kRWz4Hb7; Mon, 2 Dec 2019 19:57:21 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D68824476; Mon, 2 Dec 2019 19:57:20 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2JvKY5044551; Mon, 2 Dec 2019 19:57:20 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2JvKAj044550; Mon, 2 Dec 2019 19:57:20 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912021957.xB2JvKAj044550@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Mon, 2 Dec 2019 19:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355298 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 355298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 19:57:21 -0000 Author: ian Date: Mon Dec 2 19:57:20 2019 New Revision: 355298 URL: https://svnweb.freebsd.org/changeset/base/355298 Log: Do not initialize the flags field in struct gpiobus_pin from the flags in struct gpio_pin. It turns out these two sets of flags are completely unrelated to each other. Also, update the comment for GPIO_ACTIVE_LOW to reflect the fact that it does get set, somewhat unobviously, by code that parses FDT data. The bits from the FDT cell containing flags are just copied to gpiobus_pin.flags, so there's never any obvious reference to the symbol GPIO_ACTIVE_LOW being stored into the flags field. Modified: head/sys/dev/gpio/gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Mon Dec 2 17:53:32 2019 (r355297) +++ head/sys/dev/gpio/gpiobus.c Mon Dec 2 19:57:20 2019 (r355298) @@ -77,7 +77,17 @@ static int gpiobus_pin_set(device_t, device_t, uint32_ static int gpiobus_pin_get(device_t, device_t, uint32_t, unsigned int*); static int gpiobus_pin_toggle(device_t, device_t, uint32_t); -#define GPIO_ACTIVE_LOW 1 /* XXX Note that nothing currently sets this flag */ +/* + * gpiobus_pin flags + * The flags in struct gpiobus_pin are not related to the flags used by the + * low-level controller driver in struct gpio_pin. Currently, only pins + * acquired via FDT data have gpiobus_pin.flags set, sourced from the flags in + * the FDT properties. In theory, these flags are defined per-platform. In + * practice they are always the flags from the dt-bindings/gpio/gpio.h file. + * The only one of those flags we currently support is for handling active-low + * pins, so we just define that flag here instead of including a GPL'd header. + */ +#define GPIO_ACTIVE_LOW 1 /* * XXX -> Move me to better place - gpio_subr.c? @@ -151,7 +161,7 @@ gpio_pin_get_by_bus_pinnum(device_t busdev, uint32_t p pin->dev = device_get_parent(busdev); pin->pin = pinnum; - GPIO_PIN_GETFLAGS(pin->dev, pin->pin, &pin->flags); + pin->flags = 0; *ppin = pin; return (0); From owner-svn-src-all@freebsd.org Mon Dec 2 19:57:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B98E1B5628; Mon, 2 Dec 2019 19:57:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RbW83C3tz4HjL; Mon, 2 Dec 2019 19:57:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 348084477; Mon, 2 Dec 2019 19:57:40 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2JvdKA044608; Mon, 2 Dec 2019 19:57:39 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2JvdUe044607; Mon, 2 Dec 2019 19:57:39 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201912021957.xB2JvdUe044607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 2 Dec 2019 19:57:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355299 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 355299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 19:57:40 -0000 Author: ken Date: Mon Dec 2 19:57:39 2019 New Revision: 355299 URL: https://svnweb.freebsd.org/changeset/base/355299 Log: Fix a hang introduced in r351599. My changes in 351599 (kindly committed by avg) made the cd(4) media check asynchronous to avoid a sleep while holding a mutex. There was a difficult to reproduce bug with those changes that caused a hang on boot on some single processor machines/VMs. Leandro Lupori managed to reproduce the bug, diagnose it, and supplied a patch! Here is his analysis, from the PR: ====== I was able to reproduce the problem described in comment#14. Actually, I wasn't trying to reproduce it, I just started seeing it a few weeks ago, in CURRENT. I can reproduce it consistently, by using QEMU to run a PowerPC64 VM with a single core/thread (-smp 1). It happens only when there is no media in the emulated CD-ROM, a device that QEMU adds by default, unless -nodefaults is specified in command line. I've debugged it and this is what I've found: 1- After the CD probe is successful, GEOM will try to open the device, which will end up calling cdcheckmedia(), that sets CD state to CD_STATE_MEDIA_PREVENT. 2- Next, scsi_prevent() is executed and succeeds, the CD_FLAG_DISC_LOCKED flag is set and CD state moves to CD_STATE_MEDIA_SIZE. 3- Next, scsi_read_capacity() is executed and fails, state is set to CD_STATE_MEDIA_ALLOW, cdmediaprobedone() is called and wakes up cdcheckmedia(). 4- Then, when cdstart() is invoked to process CD_STATE_MEDIA_ALLOW, it first checks if CD_FLAG_DISC_LOCKED is set, and if so skips directly to CD_STATE_MEDIA_SIZE state. This will repeat the steps of bullet 3, entering an infinite MEDIA_SIZE command loop. When there is a least another core/thread, the GEOM thread that performed the initial cdopen() will get scheduled again, closing the CD device, that will call cdprevent(PR_ALLOW) that clears the CD_FLAG_DISC_LOCKED flag and breaks the loop. So, apparently, the problem is CD_STATE_MEDIA_ALLOW being skipped when CD_FLAG_DISC_LOCKED is set. If I understand correctly, in this case, the state should be advanced to CD_STATE_MEDIA size only when the current state is CD_STATE_MEDIA_PREVENT. ===== PR: kern/219857 Submitted by: Leandro Lupori MFC after: 1 week Modified: head/sys/cam/scsi/scsi_cd.c Modified: head/sys/cam/scsi/scsi_cd.c ============================================================================== --- head/sys/cam/scsi/scsi_cd.c Mon Dec 2 19:57:20 2019 (r355298) +++ head/sys/cam/scsi/scsi_cd.c Mon Dec 2 19:57:39 2019 (r355299) @@ -1032,7 +1032,8 @@ cdstart(struct cam_periph *periph, union ccb *start_cc * If the CD is already locked, we don't need to do this. * Move on to the capacity check. */ - if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) { + if (softc->state == CD_STATE_MEDIA_PREVENT + && (softc->flags & CD_FLAG_DISC_LOCKED) != 0) { softc->state = CD_STATE_MEDIA_SIZE; xpt_release_ccb(start_ccb); xpt_schedule(periph, CAM_PRIORITY_NORMAL); From owner-svn-src-all@freebsd.org Mon Dec 2 20:39:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23C9D1B673F; Mon, 2 Dec 2019 20:39:41 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RcRc72KKz4KnX; Mon, 2 Dec 2019 20:39:40 +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 D073D4B99; Mon, 2 Dec 2019 20:39:40 +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 xB2KdeEx068440; Mon, 2 Dec 2019 20:39:40 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kdeu8068439; Mon, 2 Dec 2019 20:39:40 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022039.xB2Kdeu8068439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355300 - head/contrib/ipfilter/man X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/contrib/ipfilter/man X-SVN-Commit-Revision: 355300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:39:41 -0000 Author: cy Date: Mon Dec 2 20:39:40 2019 New Revision: 355300 URL: https://svnweb.freebsd.org/changeset/base/355300 Log: Fix a typo (upto --> up to) and reword to improve word flow. MFC after: 3 days Modified: head/contrib/ipfilter/man/ipf.5 Modified: head/contrib/ipfilter/man/ipf.5 ============================================================================== --- head/contrib/ipfilter/man/ipf.5 Mon Dec 2 19:57:39 2019 (r355299) +++ head/contrib/ipfilter/man/ipf.5 Mon Dec 2 20:39:40 2019 (r355300) @@ -1191,7 +1191,7 @@ pass in log or-block first quick proto tcp from any \\ .fi .PP By default, IPFilter will only log the header portion of a packet received -on the network. A portion of the body of a packet, upto 128 bytes, can also +on the network. Up to 128 bytes of a packet's body can also be logged with the body keyword. ipmon(8) will display the contents of the portion of the body logged in hex. .PP From owner-svn-src-all@freebsd.org Mon Dec 2 20:51:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D6EC1B6AFE; Mon, 2 Dec 2019 20:51:49 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcjd0h1cz4LQY; Mon, 2 Dec 2019 20:51:49 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D58844DCF; Mon, 2 Dec 2019 20:51:48 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2KpmTk078066; Mon, 2 Dec 2019 20:51:48 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kplot078056; Mon, 2 Dec 2019 20:51:47 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201912022051.xB2Kplot078056@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 2 Dec 2019 20:51:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355301 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 355301 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:51:49 -0000 Author: vmaffione Date: Mon Dec 2 20:51:46 2019 New Revision: 355301 URL: https://svnweb.freebsd.org/changeset/base/355301 Log: bhyve: uniform printf format string newlines Some of the printf statements only use LF to get a newline. However, a CR character is also required for the serial console to print debug logs in a nice way. Fix those code locations that only use LF, by adding a CR character. Reviewed by: markj, aleksandr.fedorov@itglobal.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22552 Modified: head/usr.sbin/bhyve/audio.c head/usr.sbin/bhyve/hda_codec.c head/usr.sbin/bhyve/net_backends.c head/usr.sbin/bhyve/pci_ahci.c head/usr.sbin/bhyve/pci_e82545.c head/usr.sbin/bhyve/pci_hda.c head/usr.sbin/bhyve/pci_nvme.c head/usr.sbin/bhyve/pci_virtio_block.c head/usr.sbin/bhyve/pci_virtio_console.c head/usr.sbin/bhyve/pci_virtio_net.c head/usr.sbin/bhyve/pci_virtio_rnd.c head/usr.sbin/bhyve/pci_virtio_scsi.c head/usr.sbin/bhyve/pci_xhci.c head/usr.sbin/bhyve/rfb.c Modified: head/usr.sbin/bhyve/audio.c ============================================================================== --- head/usr.sbin/bhyve/audio.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/audio.c Mon Dec 2 20:51:46 2019 (r355301) @@ -92,7 +92,7 @@ audio_init(const char *dev_name, uint8_t dir) if (strlen(dev_name) < sizeof(aud->dev_name)) memcpy(aud->dev_name, dev_name, strlen(dev_name) + 1); else { - DPRINTF("dev_name too big\n"); + DPRINTF("dev_name too big\n\r"); free(aud); return NULL; } @@ -101,7 +101,7 @@ audio_init(const char *dev_name, uint8_t dir) aud->fd = open(aud->dev_name, aud->dir ? O_WRONLY : O_RDONLY, 0); if (aud->fd == -1) { - DPRINTF("Failed to open dev: %s, errno: %d\n", + DPRINTF("Failed to open dev: %s, errno: %d\n\r", aud->dev_name, errno); free(aud); return (NULL); @@ -137,7 +137,7 @@ audio_set_params(struct audio *aud, struct audio_param assert(params); if ((audio_fd = aud->fd) < 0) { - DPRINTF("Incorrect audio device descriptor for %s\n", + DPRINTF("Incorrect audio device descriptor for %s\n\r", aud->dev_name); return (-1); } @@ -146,7 +146,7 @@ audio_set_params(struct audio *aud, struct audio_param if (aud->inited) { err = ioctl(audio_fd, SNDCTL_DSP_RESET, NULL); if (err == -1) { - DPRINTF("Failed to reset fd: %d, errno: %d\n", + DPRINTF("Failed to reset fd: %d, errno: %d\n\r", aud->fd, errno); return (-1); } @@ -157,14 +157,14 @@ audio_set_params(struct audio *aud, struct audio_param format = params->format; err = ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format); if (err == -1) { - DPRINTF("Fail to set fmt: 0x%x errno: %d\n", + DPRINTF("Fail to set fmt: 0x%x errno: %d\n\r", params->format, errno); return -1; } /* The device does not support the requested audio format */ if (format != params->format) { - DPRINTF("Mismatch format: 0x%x params->format: 0x%x\n", + DPRINTF("Mismatch format: 0x%x params->format: 0x%x\n\r", format, params->format); return -1; } @@ -173,14 +173,14 @@ audio_set_params(struct audio *aud, struct audio_param channels = params->channels; err = ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &channels); if (err == -1) { - DPRINTF("Fail to set channels: %d errno: %d\n", + DPRINTF("Fail to set channels: %d errno: %d\n\r", params->channels, errno); return -1; } /* The device does not support the requested no. of channels */ if (channels != params->channels) { - DPRINTF("Mismatch channels: %d params->channels: %d\n", + DPRINTF("Mismatch channels: %d params->channels: %d\n\r", channels, params->channels); return -1; } @@ -189,14 +189,14 @@ audio_set_params(struct audio *aud, struct audio_param rate = params->rate; err = ioctl(audio_fd, SNDCTL_DSP_SPEED, &rate); if (err == -1) { - DPRINTF("Fail to set speed: %d errno: %d\n", + DPRINTF("Fail to set speed: %d errno: %d\n\r", params->rate, errno); return -1; } /* The device does not support the requested rate / speed */ if (rate != params->rate) { - DPRINTF("Mismatch rate: %d params->rate: %d\n", + DPRINTF("Mismatch rate: %d params->rate: %d\n\r", rate, params->rate); return -1; } @@ -205,10 +205,10 @@ audio_set_params(struct audio *aud, struct audio_param err = ioctl(audio_fd, aud->dir ? SNDCTL_DSP_GETOSPACE : SNDCTL_DSP_GETISPACE, &info); if (err == -1) { - DPRINTF("Fail to get audio buf info errno: %d\n", errno); + DPRINTF("Fail to get audio buf info errno: %d\n\r", errno); return -1; } - DPRINTF("fragstotal: 0x%x fragsize: 0x%x\n", + DPRINTF("fragstotal: 0x%x fragsize: 0x%x\n\r", info.fragstotal, info.fragsize); #endif return 0; @@ -237,7 +237,7 @@ audio_playback(struct audio *aud, const void *buf, siz while (total < count) { len = write(audio_fd, buf + total, count - total); if (len == -1) { - DPRINTF("Fail to write to fd: %d, errno: %d\n", + DPRINTF("Fail to write to fd: %d, errno: %d\n\r", audio_fd, errno); return -1; } @@ -273,7 +273,7 @@ audio_record(struct audio *aud, void *buf, size_t coun while (total < count) { len = read(audio_fd, buf + total, count - total); if (len == -1) { - DPRINTF("Fail to write to fd: %d, errno: %d\n", + DPRINTF("Fail to write to fd: %d, errno: %d\n\r", audio_fd, errno); return -1; } Modified: head/usr.sbin/bhyve/hda_codec.c ============================================================================== --- head/usr.sbin/bhyve/hda_codec.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/hda_codec.c Mon Dec 2 20:51:46 2019 (r355301) @@ -400,7 +400,7 @@ hda_codec_init(struct hda_codec_inst *hci, const char if (!(play || rec)) return (-1); - DPRINTF("cad: 0x%x opts: %s\n", hci->cad, opts); + DPRINTF("cad: 0x%x opts: %s\n\r", hci->cad, opts); sc = calloc(1, sizeof(*sc)); if (!sc) @@ -420,7 +420,7 @@ hda_codec_init(struct hda_codec_inst *hci, const char sc->conf_default = hda_codec_conf_default; sc->pin_ctrl_default = hda_codec_pin_ctrl_default; sc->verb_handlers = hda_codec_verb_handlers; - DPRINTF("HDA Codec nodes: %d\n", sc->no_nodes); + DPRINTF("HDA Codec nodes: %d\n\r", sc->no_nodes); /* * Initialize the Audio Output stream @@ -435,7 +435,7 @@ hda_codec_init(struct hda_codec_inst *hci, const char st->aud = audio_init(play, 1); if (!st->aud) { - DPRINTF("Fail to init the output audio player\n"); + DPRINTF("Fail to init the output audio player\n\r"); return (-1); } } @@ -453,7 +453,7 @@ hda_codec_init(struct hda_codec_inst *hci, const char st->aud = audio_init(rec, 0); if (!st->aud) { - DPRINTF("Fail to init the input audio player\n"); + DPRINTF("Fail to init the input audio player\n\r"); return (-1); } } @@ -488,11 +488,11 @@ hda_codec_reset(struct hda_codec_inst *hci) st->right_mute = HDA_CODEC_SET_AMP_GAIN_MUTE_MUTE; } - DPRINTF("cad: 0x%x\n", hci->cad); + DPRINTF("cad: 0x%x\n\r", hci->cad); if (!hops->signal) { DPRINTF("The controller ops does not implement \ - the signal function\n"); + the signal function\n\r"); return (-1); } @@ -538,7 +538,7 @@ hda_codec_command(struct hda_codec_inst *hci, uint32_t if (!hops->response) { DPRINTF("The controller ops does not implement \ - the response function\n"); + the response function\n\r"); return (-1); } @@ -566,11 +566,11 @@ hda_codec_command(struct hda_codec_inst *hci, uint32_t if (sc->verb_handlers[nid]) res = sc->verb_handlers[nid](sc, verb, payload); else - DPRINTF("Unknown VERB: 0x%x\n", verb); + DPRINTF("Unknown VERB: 0x%x\n\r", verb); break; } - DPRINTF("cad: 0x%x nid: 0x%x verb: 0x%x payload: 0x%x response: 0x%x\n", + DPRINTF("cad: 0x%x nid: 0x%x verb: 0x%x payload: 0x%x response: 0x%x\n\r", cad, nid, verb, payload, res); return (hops->response(hci, res, HDA_CODEC_RESPONSE_EX_SOL)); @@ -595,11 +595,11 @@ hda_codec_notify(struct hda_codec_inst *hci, uint8_t r i = dir ? HDA_CODEC_STREAM_OUTPUT : HDA_CODEC_STREAM_INPUT; st = &sc->streams[i]; - DPRINTF("run: %d, stream: 0x%x, st->stream: 0x%x dir: %d\n", + DPRINTF("run: %d, stream: 0x%x, st->stream: 0x%x dir: %d\n\r", run, stream, st->stream, dir); if (stream != st->stream) { - DPRINTF("Stream not found\n"); + DPRINTF("Stream not found\n\r"); return (0); } @@ -653,7 +653,7 @@ hda_codec_parse_format(uint16_t fmt, struct audio_para params->format = AFMT_S32_LE; break; default: - DPRINTF("Unknown format bits: 0x%x\n", + DPRINTF("Unknown format bits: 0x%x\n\r", fmt & HDA_CODEC_FMT_BITS_MASK); return (-1); } @@ -719,7 +719,7 @@ hda_codec_audio_output_do_setup(void *arg) if (err) return (-1); - DPRINTF("rate: %d, channels: %d, format: 0x%x\n", + DPRINTF("rate: %d, channels: %d, format: 0x%x\n\r", params.rate, params.channels, params.format); return (audio_set_params(aud, ¶ms)); @@ -778,7 +778,7 @@ hda_codec_audio_input_do_setup(void *arg) if (err) return (-1); - DPRINTF("rate: %d, channels: %d, format: 0x%x\n", + DPRINTF("rate: %d, channels: %d, format: 0x%x\n\r", params.rate, params.channels, params.format); return (audio_set_params(aud, ¶ms)); @@ -792,7 +792,7 @@ hda_codec_audio_inout_nid(struct hda_codec_stream *st, uint8_t mute = 0; uint8_t gain = 0; - DPRINTF("%s verb: 0x%x, payload, 0x%x\n", st->actx.name, verb, payload); + DPRINTF("%s verb: 0x%x, payload, 0x%x\n\r", st->actx.name, verb, payload); switch (verb) { case HDA_CMD_VERB_GET_CONV_FMT: @@ -804,10 +804,10 @@ hda_codec_audio_inout_nid(struct hda_codec_stream *st, case HDA_CMD_VERB_GET_AMP_GAIN_MUTE: if (payload & HDA_CMD_GET_AMP_GAIN_MUTE_LEFT) { res = st->left_gain | st->left_mute; - DPRINTF("GET_AMP_GAIN_MUTE_LEFT: 0x%x\n", res); + DPRINTF("GET_AMP_GAIN_MUTE_LEFT: 0x%x\n\r", res); } else { res = st->right_gain | st->right_mute; - DPRINTF("GET_AMP_GAIN_MUTE_RIGHT: 0x%x\n", res); + DPRINTF("GET_AMP_GAIN_MUTE_RIGHT: 0x%x\n\r", res); } break; case HDA_CMD_VERB_SET_AMP_GAIN_MUTE: @@ -818,14 +818,14 @@ hda_codec_audio_inout_nid(struct hda_codec_stream *st, st->left_mute = mute; st->left_gain = gain; DPRINTF("SET_AMP_GAIN_MUTE_LEFT: \ - mute: 0x%x gain: 0x%x\n", mute, gain); + mute: 0x%x gain: 0x%x\n\r", mute, gain); } if (payload & HDA_CMD_SET_AMP_GAIN_MUTE_RIGHT) { st->right_mute = mute; st->right_gain = gain; DPRINTF("SET_AMP_GAIN_MUTE_RIGHT: \ - mute: 0x%x gain: 0x%x\n", mute, gain); + mute: 0x%x gain: 0x%x\n\r", mute, gain); } break; case HDA_CMD_VERB_GET_CONV_STREAM_CHAN: @@ -834,13 +834,13 @@ hda_codec_audio_inout_nid(struct hda_codec_stream *st, case HDA_CMD_VERB_SET_CONV_STREAM_CHAN: st->channel = payload & 0x0f; st->stream = (payload >> 4) & 0x0f; - DPRINTF("st->channel: 0x%x st->stream: 0x%x\n", + DPRINTF("st->channel: 0x%x st->stream: 0x%x\n\r", st->channel, st->stream); if (!st->stream) hda_audio_ctxt_stop(&st->actx); break; default: - DPRINTF("Unknown VERB: 0x%x\n", verb); + DPRINTF("Unknown VERB: 0x%x\n\r", verb); break; } @@ -867,7 +867,7 @@ hda_audio_ctxt_thr(void *arg) { struct hda_audio_ctxt *actx = arg; - DPRINTF("Start Thread: %s\n", actx->name); + DPRINTF("Start Thread: %s\n\r", actx->name); pthread_mutex_lock(&actx->mtx); while (1) { Modified: head/usr.sbin/bhyve/net_backends.c ============================================================================== --- head/usr.sbin/bhyve/net_backends.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/net_backends.c Mon Dec 2 20:51:46 2019 (r355301) @@ -192,7 +192,7 @@ tap_init(struct net_backend *be, const char *devname, #endif if (cb == NULL) { - WPRINTF(("TAP backend requires non-NULL callback\n")); + WPRINTF(("TAP backend requires non-NULL callback\n\r")); return (-1); } @@ -201,7 +201,7 @@ tap_init(struct net_backend *be, const char *devname, be->fd = open(tbuf, O_RDWR); if (be->fd == -1) { - WPRINTF(("open of tap device %s failed\n", tbuf)); + WPRINTF(("open of tap device %s failed\n\r", tbuf)); goto error; } @@ -210,7 +210,7 @@ tap_init(struct net_backend *be, const char *devname, * notifications with the event loop */ if (ioctl(be->fd, FIONBIO, &opt) < 0) { - WPRINTF(("tap device O_NONBLOCK failed\n")); + WPRINTF(("tap device O_NONBLOCK failed\n\r")); goto error; } @@ -222,7 +222,7 @@ tap_init(struct net_backend *be, const char *devname, priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { - WPRINTF(("Could not register event\n")); + WPRINTF(("Could not register event\n\r")); goto error; } @@ -363,7 +363,7 @@ netmap_set_vnet_hdr_len(struct net_backend *be, int vn req.nr_arg1 = vnet_hdr_len; err = ioctl(be->fd, NIOCREGIF, &req); if (err) { - WPRINTF(("Unable to set vnet header length %d\n", + WPRINTF(("Unable to set vnet header length %d\n\r", vnet_hdr_len)); return (err); } @@ -420,7 +420,7 @@ netmap_init(struct net_backend *be, const char *devnam priv->nmd = nm_open(priv->ifname, NULL, NETMAP_NO_TX_POLL, NULL); if (priv->nmd == NULL) { - WPRINTF(("Unable to nm_open(): interface '%s', errno (%s)\n", + WPRINTF(("Unable to nm_open(): interface '%s', errno (%s)\n\r", devname, strerror(errno))); free(priv); return (-1); @@ -435,7 +435,7 @@ netmap_init(struct net_backend *be, const char *devnam priv->mevp = mevent_add_disabled(be->fd, EVF_READ, cb, param); if (priv->mevp == NULL) { - WPRINTF(("Could not register event\n")); + WPRINTF(("Could not register event\n\r")); return (-1); } @@ -472,7 +472,7 @@ netmap_send(struct net_backend *be, struct iovec *iov, ring = priv->tx; head = ring->head; if (head == ring->tail) { - WPRINTF(("No space, drop %zu bytes\n", count_iov(iov, iovcnt))); + WPRINTF(("No space, drop %zu bytes\n\r", count_iov(iov, iovcnt))); goto txsync; } nm_buf = NETMAP_BUF(ring, ring->slot[head].buf_idx); @@ -513,7 +513,7 @@ netmap_send(struct net_backend *be, struct iovec *iov, * We ran out of netmap slots while * splitting the iovec fragments. */ - WPRINTF(("No space, drop %zu bytes\n", + WPRINTF(("No space, drop %zu bytes\n\r", count_iov(iov, iovcnt))); goto txsync; } @@ -585,7 +585,7 @@ netmap_recv(struct net_backend *be, struct iovec *iov, iovcnt--; if (iovcnt == 0) { /* No space to receive. */ - WPRINTF(("Short iov, drop %zd bytes\n", + WPRINTF(("Short iov, drop %zd bytes\n\r", totlen)); return (-ENOSPC); } Modified: head/usr.sbin/bhyve/pci_ahci.c ============================================================================== --- head/usr.sbin/bhyve/pci_ahci.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/pci_ahci.c Mon Dec 2 20:51:46 2019 (r355301) @@ -240,7 +240,7 @@ ahci_generate_intr(struct pci_ahci_softc *sc, uint32_t if (p->is & p->ie) sc->is |= (1 << i); } - DPRINTF("%s(%08x) %08x\n", __func__, mask, sc->is); + DPRINTF("%s(%08x) %08x\n\r", __func__, mask, sc->is); /* If there is nothing enabled -- clear legacy interrupt and exit. */ if (sc->is == 0 || (sc->ghc & AHCI_GHC_IE) == 0) { @@ -282,7 +282,7 @@ ahci_port_intr(struct ahci_port *p) struct pci_devinst *pi = sc->asc_pi; int nmsg; - DPRINTF("%s(%d) %08x/%08x %08x\n", __func__, + DPRINTF("%s(%d) %08x/%08x %08x\n\r", __func__, p->port, p->is, p->ie, sc->is); /* If there is nothing enabled -- we are done. */ @@ -341,7 +341,7 @@ ahci_write_fis(struct ahci_port *p, enum sata_fis_type irq = (fis[1] & (1 << 6)) ? AHCI_P_IX_PS : 0; break; default: - WPRINTF("unsupported fis type %d\n", ft); + WPRINTF("unsupported fis type %d\n\r", ft); return; } if (fis[2] & ATA_S_ERROR) { @@ -1601,7 +1601,7 @@ handle_packet_cmd(struct ahci_port *p, int slot, uint8 DPRINTF("ACMD:"); for (i = 0; i < 16; i++) DPRINTF("%02x ", acmd[i]); - DPRINTF("\n"); + DPRINTF("\n\r"); } #endif @@ -1788,7 +1788,7 @@ ahci_handle_cmd(struct ahci_port *p, int slot, uint8_t handle_packet_cmd(p, slot, cfis); break; default: - WPRINTF("Unsupported cmd:%02x\n", cfis[2]); + WPRINTF("Unsupported cmd:%02x\n\r", cfis[2]); ahci_write_fis_d2h(p, slot, cfis, (ATA_E_ABORT << 8) | ATA_S_READY | ATA_S_ERROR); break; @@ -1818,22 +1818,22 @@ ahci_handle_slot(struct ahci_port *p, int slot) #ifdef AHCI_DEBUG prdt = (struct ahci_prdt_entry *)(cfis + 0x80); - DPRINTF("\ncfis:"); + DPRINTF("\n\rcfis:"); for (i = 0; i < cfl; i++) { if (i % 10 == 0) - DPRINTF("\n"); + DPRINTF("\n\r"); DPRINTF("%02x ", cfis[i]); } - DPRINTF("\n"); + DPRINTF("\n\r"); for (i = 0; i < hdr->prdtl; i++) { - DPRINTF("%d@%08"PRIx64"\n", prdt->dbc & 0x3fffff, prdt->dba); + DPRINTF("%d@%08"PRIx64"\n\r", prdt->dbc & 0x3fffff, prdt->dba); prdt++; } #endif if (cfis[0] != FIS_TYPE_REGH2D) { - WPRINTF("Not a H2D FIS:%02x\n", cfis[0]); + WPRINTF("Not a H2D FIS:%02x\n\r", cfis[0]); return; } @@ -1889,7 +1889,7 @@ ata_ioreq_cb(struct blockif_req *br, int err) uint8_t *cfis; int slot, ncq, dsm; - DPRINTF("%s %d\n", __func__, err); + DPRINTF("%s %d\n\r", __func__, err); ncq = dsm = 0; aior = br->br_param; @@ -1949,7 +1949,7 @@ ata_ioreq_cb(struct blockif_req *br, int err) ahci_handle_port(p); out: pthread_mutex_unlock(&sc->mtx); - DPRINTF("%s exit\n", __func__); + DPRINTF("%s exit\n\r", __func__); } static void @@ -1963,7 +1963,7 @@ atapi_ioreq_cb(struct blockif_req *br, int err) uint32_t tfd; int slot; - DPRINTF("%s %d\n", __func__, err); + DPRINTF("%s %d\n\r", __func__, err); aior = br->br_param; p = aior->io_pr; @@ -2011,7 +2011,7 @@ atapi_ioreq_cb(struct blockif_req *br, int err) ahci_handle_port(p); out: pthread_mutex_unlock(&sc->mtx); - DPRINTF("%s exit\n", __func__); + DPRINTF("%s exit\n\r", __func__); } static void @@ -2048,7 +2048,7 @@ pci_ahci_port_write(struct pci_ahci_softc *sc, uint64_ offset = (offset - AHCI_OFFSET) % AHCI_STEP; struct ahci_port *p = &sc->port[port]; - DPRINTF("pci_ahci_port %d: write offset 0x%"PRIx64" value 0x%"PRIx64"\n", + DPRINTF("pci_ahci_port %d: write offset 0x%"PRIx64" value 0x%"PRIx64"\n\r", port, offset, value); switch (offset) { @@ -2120,7 +2120,7 @@ pci_ahci_port_write(struct pci_ahci_softc *sc, uint64_ case AHCI_P_TFD: case AHCI_P_SIG: case AHCI_P_SSTS: - WPRINTF("pci_ahci_port: read only registers 0x%"PRIx64"\n", offset); + WPRINTF("pci_ahci_port: read only registers 0x%"PRIx64"\n\r", offset); break; case AHCI_P_SCTL: p->sctl = value; @@ -2149,7 +2149,7 @@ pci_ahci_port_write(struct pci_ahci_softc *sc, uint64_ static void pci_ahci_host_write(struct pci_ahci_softc *sc, uint64_t offset, uint64_t value) { - DPRINTF("pci_ahci_host: write offset 0x%"PRIx64" value 0x%"PRIx64"\n", + DPRINTF("pci_ahci_host: write offset 0x%"PRIx64" value 0x%"PRIx64"\n\r", offset, value); switch (offset) { @@ -2157,7 +2157,7 @@ pci_ahci_host_write(struct pci_ahci_softc *sc, uint64_ case AHCI_PI: case AHCI_VS: case AHCI_CAP2: - DPRINTF("pci_ahci_host: read only registers 0x%"PRIx64"\n", offset); + DPRINTF("pci_ahci_host: read only registers 0x%"PRIx64"\n\r", offset); break; case AHCI_GHC: if (value & AHCI_GHC_HR) { @@ -2195,7 +2195,7 @@ pci_ahci_write(struct vmctx *ctx, int vcpu, struct pci else if (offset < AHCI_OFFSET + sc->ports * AHCI_STEP) pci_ahci_port_write(sc, offset, value); else - WPRINTF("pci_ahci: unknown i/o write offset 0x%"PRIx64"\n", offset); + WPRINTF("pci_ahci: unknown i/o write offset 0x%"PRIx64"\n\r", offset); pthread_mutex_unlock(&sc->mtx); } @@ -2226,7 +2226,7 @@ pci_ahci_host_read(struct pci_ahci_softc *sc, uint64_t value = 0; break; } - DPRINTF("pci_ahci_host: read offset 0x%"PRIx64" value 0x%x\n", + DPRINTF("pci_ahci_host: read offset 0x%"PRIx64" value 0x%x\n\r", offset, value); return (value); @@ -2267,7 +2267,7 @@ pci_ahci_port_read(struct pci_ahci_softc *sc, uint64_t break; } - DPRINTF("pci_ahci_port %d: read offset 0x%"PRIx64" value 0x%x\n", + DPRINTF("pci_ahci_port %d: read offset 0x%"PRIx64" value 0x%x\n\r", port, offset, value); return value; @@ -2294,7 +2294,7 @@ pci_ahci_read(struct vmctx *ctx, int vcpu, struct pci_ value = pci_ahci_port_read(sc, offset); else { value = 0; - WPRINTF("pci_ahci: unknown i/o read offset 0x%"PRIx64"\n", + WPRINTF("pci_ahci: unknown i/o read offset 0x%"PRIx64"\n\r", regoff); } value >>= 8 * (regoff & 0x3); Modified: head/usr.sbin/bhyve/pci_e82545.c ============================================================================== --- head/usr.sbin/bhyve/pci_e82545.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/pci_e82545.c Mon Dec 2 20:51:46 2019 (r355301) @@ -533,7 +533,7 @@ e82545_eecd_strobe(struct e82545_softc *sc) sc->nvm_data = 0; break; default: - DPRINTF("eeprom unknown op: 0x%x\r\r", + DPRINTF("eeprom unknown op: 0x%x\r\n", sc->nvm_opaddr); /* back to opcode mode */ sc->nvm_opaddr = 0; @@ -616,7 +616,7 @@ e82545_ims_change(struct e82545_softc *sc, uint32_t bi } else if (sc->esc_mevpitr != NULL) { DPRINTF("ims change: throttled %x, ims %x\r\n", new, sc->esc_IMS); } else if (!sc->esc_irq_asserted) { - DPRINTF("ims change: lintr assert %x\n\r", new); + DPRINTF("ims change: lintr assert %x\r\n", new); sc->esc_irq_asserted = 1; pci_lintr_assert(sc->esc_pi); if (sc->esc_ITR != 0) { @@ -649,7 +649,7 @@ static void e82545_intr_write(struct e82545_softc *sc, uint32_t offset, uint32_t value) { - DPRINTF("intr_write: off %x, val %x\n\r", offset, value); + DPRINTF("intr_write: off %x, val %x\r\n", offset, value); switch (offset) { case E1000_ICR: @@ -683,7 +683,7 @@ e82545_intr_read(struct e82545_softc *sc, uint32_t off retval = 0; - DPRINTF("intr_read: off %x\n\r", offset); + DPRINTF("intr_read: off %x\r\n", offset); switch (offset) { case E1000_ICR: @@ -717,7 +717,7 @@ e82545_devctl(struct e82545_softc *sc, uint32_t val) sc->esc_CTRL = val & ~E1000_CTRL_RST; if (val & E1000_CTRL_RST) { - DPRINTF("e1k: s/w reset, ctl %x\n", val); + DPRINTF("e1k: s/w reset, ctl %x\r\n", val); e82545_reset(sc, 1); } /* XXX check for phy reset ? */ @@ -746,7 +746,7 @@ e82545_rx_ctl(struct e82545_softc *sc, uint32_t val) /* Save RCTL after stripping reserved bits 31:27,24,21,14,11:10,0 */ sc->esc_RCTL = val & ~0xF9204c01; - DPRINTF("rx_ctl - %s RCTL %x, val %x\n", + DPRINTF("rx_ctl - %s RCTL %x, val %x\r\n", on ? "on" : "off", sc->esc_RCTL, val); /* state change requested */ @@ -873,7 +873,7 @@ e82545_rx_callback(int fd, enum ev_type type, void *pa } len = netbe_recv(sc->esc_be, vec, maxpktdesc); if (len <= 0) { - DPRINTF("netbe_recv() returned %d\n", len); + DPRINTF("netbe_recv() returned %d\r\n", len); goto done; } Modified: head/usr.sbin/bhyve/pci_hda.c ============================================================================== --- head/usr.sbin/bhyve/pci_hda.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/pci_hda.c Mon Dec 2 20:51:46 2019 (r355301) @@ -332,11 +332,11 @@ hda_parse_config(const char *opts, const char *key, ch len = strlen(opts); if (len >= sizeof(buf)) { - DPRINTF("Opts too big\n"); + DPRINTF("Opts too big\n\r"); return (0); } - DPRINTF("opts: %s\n", opts); + DPRINTF("opts: %s\n\r", opts); strcpy(buf, opts); @@ -377,7 +377,7 @@ hda_init(const char *opts) dbg = fopen("/tmp/bhyve_hda.log", "w+"); #endif - DPRINTF("opts: %s\n", opts); + DPRINTF("opts: %s\n\r", opts); sc = calloc(1, sizeof(*sc)); if (!sc) @@ -393,7 +393,7 @@ hda_init(const char *opts) if (codec) { p = hda_parse_config(opts, "play=", play); r = hda_parse_config(opts, "rec=", rec); - DPRINTF("play: %s rec: %s\n", play, rec); + DPRINTF("play: %s rec: %s\n\r", play, rec); if (p | r) { err = hda_codec_constructor(sc, codec, p ? \ play : NULL, r ? rec : NULL, NULL); @@ -489,7 +489,7 @@ hda_codec_constructor(struct hda_softc *sc, struct hda sc->codecs[sc->codecs_no++] = hci; if (!codec->init) { - DPRINTF("This codec does not implement the init function\n"); + DPRINTF("This codec does not implement the init function\n\r"); return (-1); } @@ -522,13 +522,13 @@ hda_send_command(struct hda_softc *sc, uint32_t verb) if (!hci) return (-1); - DPRINTF("cad: 0x%x verb: 0x%x\n", cad, verb); + DPRINTF("cad: 0x%x verb: 0x%x\n\r", cad, verb); codec = hci->codec; assert(codec); if (!codec->command) { - DPRINTF("This codec does not implement the command function\n"); + DPRINTF("This codec does not implement the command function\n\r"); return (-1); } @@ -592,7 +592,7 @@ hda_reset_regs(struct hda_softc *sc) uint32_t off = 0; uint8_t i; - DPRINTF("Reset the HDA controller registers ...\n"); + DPRINTF("Reset the HDA controller registers ...\n\r"); memset(sc->regs, 0, sizeof(sc->regs)); @@ -620,7 +620,7 @@ hda_stream_reset(struct hda_softc *sc, uint8_t stream_ struct hda_stream_desc *st = &sc->streams[stream_ind]; uint32_t off = hda_get_offset_stream(stream_ind); - DPRINTF("Reset the HDA stream: 0x%x\n", stream_ind); + DPRINTF("Reset the HDA stream: 0x%x\n\r", stream_ind); /* Reset the Stream Descriptor registers */ memset(sc->regs + HDA_STREAM_REGS_BASE + off, 0, HDA_STREAM_REGS_LEN); @@ -670,11 +670,11 @@ hda_stream_start(struct hda_softc *sc, uint8_t stream_ bdl_vaddr = hda_dma_get_vaddr(sc, bdl_paddr, HDA_BDL_ENTRY_LEN * bdl_cnt); if (!bdl_vaddr) { - DPRINTF("Fail to get the guest virtual address\n"); + DPRINTF("Fail to get the guest virtual address\n\r"); return (-1); } - DPRINTF("stream: 0x%x bdl_cnt: 0x%x bdl_paddr: 0x%lx\n", + DPRINTF("stream: 0x%x bdl_cnt: 0x%x bdl_paddr: 0x%lx\n\r", stream_ind, bdl_cnt, bdl_paddr); st->bdl_cnt = bdl_cnt; @@ -690,7 +690,7 @@ hda_stream_start(struct hda_softc *sc, uint8_t stream_ bdle_paddr = bdle_addrl | (bdle_addrh << 32); bdle_vaddr = hda_dma_get_vaddr(sc, bdle_paddr, bdle_sz); if (!bdle_vaddr) { - DPRINTF("Fail to get the guest virtual address\n"); + DPRINTF("Fail to get the guest virtual address\n\r"); return (-1); } @@ -699,14 +699,14 @@ hda_stream_start(struct hda_softc *sc, uint8_t stream_ bdle_desc->len = bdle_sz; bdle_desc->ioc = bdle->ioc; - DPRINTF("bdle: 0x%x bdle_sz: 0x%x\n", i, bdle_sz); + DPRINTF("bdle: 0x%x bdle_sz: 0x%x\n\r", i, bdle_sz); } sdctl = hda_get_reg_by_offset(sc, off + HDAC_SDCTL0); strm = (sdctl >> 20) & 0x0f; dir = stream_ind >= HDA_ISS_NO; - DPRINTF("strm: 0x%x, dir: 0x%x\n", strm, dir); + DPRINTF("strm: 0x%x, dir: 0x%x\n\r", strm, dir); sc->stream_map[dir][strm] = stream_ind; st->stream = strm; @@ -730,7 +730,7 @@ hda_stream_stop(struct hda_softc *sc, uint8_t stream_i uint8_t strm = st->stream; uint8_t dir = st->dir; - DPRINTF("stream: 0x%x, strm: 0x%x, dir: 0x%x\n", stream_ind, strm, dir); + DPRINTF("stream: 0x%x, strm: 0x%x, dir: 0x%x\n\r", stream_ind, strm, dir); st->run = 0; @@ -771,10 +771,10 @@ hda_print_cmd_ctl_data(struct hda_codec_cmd_ctl *p) #if DEBUG_HDA == 1 char *name = p->name; #endif - DPRINTF("%s size: %d\n", name, p->size); - DPRINTF("%s dma_vaddr: %p\n", name, p->dma_vaddr); - DPRINTF("%s wp: 0x%x\n", name, p->wp); - DPRINTF("%s rp: 0x%x\n", name, p->rp); + DPRINTF("%s size: %d\n\r", name, p->size); + DPRINTF("%s dma_vaddr: %p\n\r", name, p->dma_vaddr); + DPRINTF("%s wp: 0x%x\n\r", name, p->wp); + DPRINTF("%s rp: 0x%x\n\r", name, p->rp); } static int @@ -793,7 +793,7 @@ hda_corb_start(struct hda_softc *sc) corb->size = hda_corb_sizes[corbsize]; if (!corb->size) { - DPRINTF("Invalid corb size\n"); + DPRINTF("Invalid corb size\n\r"); return (-1); } @@ -801,12 +801,12 @@ hda_corb_start(struct hda_softc *sc) corbubase = hda_get_reg_by_offset(sc, HDAC_CORBUBASE); corbpaddr = corblbase | (corbubase << 32); - DPRINTF("CORB dma_paddr: %p\n", (void *)corbpaddr); + DPRINTF("CORB dma_paddr: %p\n\r", (void *)corbpaddr); corb->dma_vaddr = hda_dma_get_vaddr(sc, corbpaddr, HDA_CORB_ENTRY_LEN * corb->size); if (!corb->dma_vaddr) { - DPRINTF("Fail to get the guest virtual address\n"); + DPRINTF("Fail to get the guest virtual address\n\r"); return (-1); } @@ -864,7 +864,7 @@ hda_rirb_start(struct hda_softc *sc) rirb->size = hda_rirb_sizes[rirbsize]; if (!rirb->size) { - DPRINTF("Invalid rirb size\n"); + DPRINTF("Invalid rirb size\n\r"); return (-1); } @@ -872,12 +872,12 @@ hda_rirb_start(struct hda_softc *sc) rirbubase = hda_get_reg_by_offset(sc, HDAC_RIRBUBASE); rirbpaddr = rirblbase | (rirbubase << 32); - DPRINTF("RIRB dma_paddr: %p\n", (void *)rirbpaddr); + DPRINTF("RIRB dma_paddr: %p\n\r", (void *)rirbpaddr); rirb->dma_vaddr = hda_dma_get_vaddr(sc, rirbpaddr, HDA_RIRB_ENTRY_LEN * rirb->size); if (!rirb->dma_vaddr) { - DPRINTF("Fail to get the guest virtual address\n"); + DPRINTF("Fail to get the guest virtual address\n\r"); return (-1); } @@ -1022,18 +1022,18 @@ hda_set_dpiblbase(struct hda_softc *sc, uint32_t offse dpibubase = hda_get_reg_by_offset(sc, HDAC_DPIBUBASE); dpibpaddr = dpiblbase | (dpibubase << 32); - DPRINTF("DMA Position In Buffer dma_paddr: %p\n", + DPRINTF("DMA Position In Buffer dma_paddr: %p\n\r", (void *)dpibpaddr); sc->dma_pib_vaddr = hda_dma_get_vaddr(sc, dpibpaddr, HDA_DMA_PIB_ENTRY_LEN * HDA_IOSS_NO); if (!sc->dma_pib_vaddr) { DPRINTF("Fail to get the guest \ - virtual address\n"); + virtual address\n\r"); assert(0); } } else { - DPRINTF("DMA Position In Buffer Reset\n"); + DPRINTF("DMA Position In Buffer Reset\n\r"); sc->dma_pib_vaddr = NULL; } } @@ -1046,7 +1046,7 @@ hda_set_sdctl(struct hda_softc *sc, uint32_t offset, u uint32_t value = hda_get_reg_by_offset(sc, offset); int err; - DPRINTF("stream_ind: 0x%x old: 0x%x value: 0x%x\n", + DPRINTF("stream_ind: 0x%x old: 0x%x value: 0x%x\n\r", stream_ind, old, value); if (value & HDAC_SDCTL_SRST) { @@ -1094,7 +1094,7 @@ hda_signal_state_change(struct hda_codec_inst *hci) assert(hci); assert(hci->hda); - DPRINTF("cad: 0x%x\n", hci->cad); + DPRINTF("cad: 0x%x\n\r", hci->cad); sc = hci->hda; sdiwake = 1 << hci->cad; @@ -1164,7 +1164,7 @@ hda_transfer(struct hda_codec_inst *hci, uint8_t strea assert(!(count % HDA_DMA_ACCESS_LEN)); if (!stream) { - DPRINTF("Invalid stream\n"); + DPRINTF("Invalid stream\n\r"); return (-1); } @@ -1180,7 +1180,7 @@ hda_transfer(struct hda_codec_inst *hci, uint8_t strea st = &sc->streams[stream_ind]; if (!st->run) { - DPRINTF("Stream 0x%x stopped\n", stream); + DPRINTF("Stream 0x%x stopped\n\r", stream); return (-1); } @@ -1306,7 +1306,7 @@ pci_hda_write(struct vmctx *ctx, int vcpu, struct pci_ assert(baridx == 0); assert(size <= 4); - DPRINTF("offset: 0x%lx value: 0x%lx\n", offset, value); + DPRINTF("offset: 0x%lx value: 0x%lx\n\r", offset, value); err = hda_write(sc, offset, size, value); assert(!err); @@ -1325,7 +1325,7 @@ pci_hda_read(struct vmctx *ctx, int vcpu, struct pci_d value = hda_read(sc, offset); - DPRINTF("offset: 0x%lx value: 0x%lx\n", offset, value); + DPRINTF("offset: 0x%lx value: 0x%lx\n\r", offset, value); return (value); } Modified: head/usr.sbin/bhyve/pci_nvme.c ============================================================================== --- head/usr.sbin/bhyve/pci_nvme.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/pci_nvme.c Mon Dec 2 20:51:46 2019 (r355301) @@ -801,28 +801,28 @@ nvme_set_feature_queues(struct pci_nvme_softc* sc, str nqr = command->cdw11 & 0xFFFF; if (nqr == 0xffff) { - WPRINTF(("%s: Illegal NSQR value %#x\n", __func__, nqr)); + WPRINTF(("%s: Illegal NSQR value %#x\r\n", __func__, nqr)); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (-1); } sc->num_squeues = ONE_BASED(nqr); if (sc->num_squeues > sc->max_queues) { - DPRINTF(("NSQR=%u is greater than max %u\n", sc->num_squeues, + DPRINTF(("NSQR=%u is greater than max %u\r\n", sc->num_squeues, sc->max_queues)); sc->num_squeues = sc->max_queues; } nqr = (command->cdw11 >> 16) & 0xFFFF; if (nqr == 0xffff) { - WPRINTF(("%s: Illegal NCQR value %#x\n", __func__, nqr)); + WPRINTF(("%s: Illegal NCQR value %#x\r\n", __func__, nqr)); pci_nvme_status_genc(&compl->status, NVME_SC_INVALID_FIELD); return (-1); } sc->num_cqueues = ONE_BASED(nqr); if (sc->num_cqueues > sc->max_queues) { - DPRINTF(("NCQR=%u is greater than max %u\n", sc->num_cqueues, + DPRINTF(("NCQR=%u is greater than max %u\r\n", sc->num_cqueues, sc->max_queues)); sc->num_cqueues = sc->max_queues; } @@ -1907,7 +1907,7 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o sc->nvstore.type = NVME_STOR_BLOCKIF; sc->nvstore.size = blockif_size(sc->nvstore.ctx); } else { - fprintf(stderr, "Invalid option %s\n", xopts); + fprintf(stderr, "Invalid option %s\r\n", xopts); free(uopt); return (-1); } @@ -1917,7 +1917,7 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o free(uopt); if (sc->nvstore.ctx == NULL || sc->nvstore.size == 0) { - fprintf(stderr, "backing store not specified\n"); + fprintf(stderr, "backing store not specified\r\n"); return (-1); } if (sectsz == 512 || sectsz == 4096 || sectsz == 8192) @@ -1932,11 +1932,11 @@ pci_nvme_parse_opts(struct pci_nvme_softc *sc, char *o sc->max_queues = NVME_QUEUES; if (sc->max_qentries <= 0) { - fprintf(stderr, "Invalid qsz option\n"); + fprintf(stderr, "Invalid qsz option\r\n"); return (-1); } if (sc->ioslots <= 0) { - fprintf(stderr, "Invalid ioslots option\n"); + fprintf(stderr, "Invalid ioslots option\r\n"); return (-1); } Modified: head/usr.sbin/bhyve/pci_virtio_block.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_block.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/pci_virtio_block.c Mon Dec 2 20:51:46 2019 (r355301) @@ -168,7 +168,7 @@ pci_vtblk_reset(void *vsc) { struct pci_vtblk_softc *sc = vsc; - DPRINTF(("vtblk: device reset requested !\n")); + DPRINTF(("vtblk: device reset requested !\n\r")); vi_reset_dev(&sc->vbsc_vs); } @@ -303,7 +303,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst * int i, sectsz, sts, sto; if (opts == NULL) { - printf("virtio-block: backing device required\n"); + WPRINTF(("virtio-block: backing device required\n\r")); return (1); } Modified: head/usr.sbin/bhyve/pci_virtio_console.c ============================================================================== --- head/usr.sbin/bhyve/pci_virtio_console.c Mon Dec 2 20:39:40 2019 (r355300) +++ head/usr.sbin/bhyve/pci_virtio_console.c Mon Dec 2 20:51:46 2019 (r355301) @@ -187,7 +187,7 @@ pci_vtcon_reset(void *vsc) sc = vsc; - DPRINTF(("vtcon: device reset requested!\n")); + DPRINTF(("vtcon: device reset requested!\n\r")); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Dec 2 20:55:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2AEC81B6D88; Mon, 2 Dec 2019 20:55:09 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RcnT0NMyz4Ldt; Mon, 2 Dec 2019 20:55:09 +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 E47F04F3E; Mon, 2 Dec 2019 20:55:08 +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 xB2Kt8Uu080182; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kt8xb080181; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022055.xB2Kt8xb080181@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:55:08 +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: r355302 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:55:09 -0000 Author: cy Date: Mon Dec 2 20:55:08 2019 New Revision: 355302 URL: https://svnweb.freebsd.org/changeset/base/355302 Log: MFC r355140: Remove redundant #ifdef'd function definitions. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:51:46 2019 (r355301) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) @@ -10279,7 +10279,6 @@ ipf_inet6_mask_del(bits, mask, mtab) ASSERT(mtab->imt6_max >= 0); } -#ifdef _KERNEL static u_int ipf_pcksum6(fin, ip6, off, len) fr_info_t *fin; @@ -10287,6 +10286,7 @@ ipf_pcksum6(fin, ip6, off, len) u_int32_t off; u_int32_t len; { +#ifdef _KERNEL struct mbuf *m; int sum; @@ -10297,15 +10297,7 @@ ipf_pcksum6(fin, ip6, off, len) sum = in6_cksum(m, ip6->ip6_nxt, off, len); return(sum); -} #else -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ u_short *sp; u_int sum; @@ -10327,6 +10319,6 @@ ipf_pcksum6(fin, ip6, off, len) sum += *sp++; sum += *sp++; return(ipf_pcksum(fin, off, sum)); -} #endif +} #endif From owner-svn-src-all@freebsd.org Mon Dec 2 20:55:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CEC2E1B6D83; Mon, 2 Dec 2019 20:55:08 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RcnS57YMz4Ldr; Mon, 2 Dec 2019 20:55:08 +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 932F04F3D; Mon, 2 Dec 2019 20:55:08 +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 xB2Kt8Rx080176; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kt8uU080175; Mon, 2 Dec 2019 20:55:08 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022055.xB2Kt8uU080175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:55:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355302 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:55:08 -0000 Author: cy Date: Mon Dec 2 20:55:08 2019 New Revision: 355302 URL: https://svnweb.freebsd.org/changeset/base/355302 Log: MFC r355140: Remove redundant #ifdef'd function definitions. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:51:46 2019 (r355301) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) @@ -10279,7 +10279,6 @@ ipf_inet6_mask_del(bits, mask, mtab) ASSERT(mtab->imt6_max >= 0); } -#ifdef _KERNEL static u_int ipf_pcksum6(fin, ip6, off, len) fr_info_t *fin; @@ -10287,6 +10286,7 @@ ipf_pcksum6(fin, ip6, off, len) u_int32_t off; u_int32_t len; { +#ifdef _KERNEL struct mbuf *m; int sum; @@ -10297,15 +10297,7 @@ ipf_pcksum6(fin, ip6, off, len) sum = in6_cksum(m, ip6->ip6_nxt, off, len); return(sum); -} #else -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ u_short *sp; u_int sum; @@ -10327,6 +10319,6 @@ ipf_pcksum6(fin, ip6, off, len) sum += *sp++; sum += *sp++; return(ipf_pcksum(fin, off, sum)); -} #endif +} #endif From owner-svn-src-all@freebsd.org Mon Dec 2 20:57:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6ED6B1B6EE2; Mon, 2 Dec 2019 20:57:14 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcqt2Hrtz4Ltb; Mon, 2 Dec 2019 20:57:14 +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 2DE004F3F; Mon, 2 Dec 2019 20:57: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 xB2KvEXV080313; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2KvEsk080312; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022057.xB2KvEsk080312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:57:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355303 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:57:14 -0000 Author: cy Date: Mon Dec 2 20:57:13 2019 New Revision: 355303 URL: https://svnweb.freebsd.org/changeset/base/355303 Log: MFC r355141: Save a little stack by removing a used once intermediate variable. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:57:13 2019 (r355303) @@ -10288,15 +10288,13 @@ ipf_pcksum6(fin, ip6, off, len) { #ifdef _KERNEL struct mbuf *m; - int sum; m = fin->fin_m; if (m->m_len < sizeof(struct ip6_hdr)) { return 0xffff; } - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); + return(in6_cksum(m, ip6->ip6_nxt, off, len)); #else u_short *sp; u_int sum; From owner-svn-src-all@freebsd.org Mon Dec 2 20:57:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B16D71B6EE9; Mon, 2 Dec 2019 20:57:14 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcqt4JYjz4Ltc; Mon, 2 Dec 2019 20:57:14 +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 771B84F40; Mon, 2 Dec 2019 20:57: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 xB2KvEYt080319; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2KvETo080318; Mon, 2 Dec 2019 20:57:14 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022057.xB2KvETo080318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:57: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: r355303 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:57:14 -0000 Author: cy Date: Mon Dec 2 20:57:13 2019 New Revision: 355303 URL: https://svnweb.freebsd.org/changeset/base/355303 Log: MFC r355141: Save a little stack by removing a used once intermediate variable. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:55:08 2019 (r355302) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:57:13 2019 (r355303) @@ -10288,15 +10288,13 @@ ipf_pcksum6(fin, ip6, off, len) { #ifdef _KERNEL struct mbuf *m; - int sum; m = fin->fin_m; if (m->m_len < sizeof(struct ip6_hdr)) { return 0xffff; } - sum = in6_cksum(m, ip6->ip6_nxt, off, len); - return(sum); + return(in6_cksum(m, ip6->ip6_nxt, off, len)); #else u_short *sp; u_int sum; From owner-svn-src-all@freebsd.org Mon Dec 2 20:58:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48F381B7000; Mon, 2 Dec 2019 20:58:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcrv1yDMz4M7c; Mon, 2 Dec 2019 20:58:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BE394F42; Mon, 2 Dec 2019 20:58:07 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Kw7Nm080412; Mon, 2 Dec 2019 20:58:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kw4Nx080398; Mon, 2 Dec 2019 20:58:04 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912022058.xB2Kw4Nx080398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 2 Dec 2019 20:58:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355304 - in head: lib/libstats share/man/man4 sys/conf sys/netinet sys/netinet/cc sys/sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: in head: lib/libstats share/man/man4 sys/conf sys/netinet sys/netinet/cc sys/sys X-SVN-Commit-Revision: 355304 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:58:07 -0000 Author: trasz Date: Mon Dec 2 20:58:04 2019 New Revision: 355304 URL: https://svnweb.freebsd.org/changeset/base/355304 Log: Make use of the stats(3) framework in the TCP stack. This makes it possible to retrieve per-connection statistical information such as the receive window size, RTT, or goodput, using a newly added TCP_STATS getsockopt(3) option, and extract them using the stats_voistat_fetch(3) API. See the net/tcprtt port for an example consumer of this API. Compared to the existing TCP_INFO system, the main differences are that this mechanism is easy to extend without breaking ABI, and provides statistical information instead of raw "snapshots" of values at a given point in time. stats(3) is more generic and can be used in both userland and the kernel. Reviewed by: thj Tested by: thj Obtained from: Netflix Relnotes: yes Sponsored by: Klara Inc, Netflix Differential Revision: https://reviews.freebsd.org/D20655 Added: head/sys/netinet/tcp_stats.c (contents, props changed) Modified: head/lib/libstats/Makefile head/share/man/man4/tcp.4 head/sys/conf/files head/sys/netinet/cc/cc.h head/sys/netinet/tcp.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_log_buf.c head/sys/netinet/tcp_output.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/sys/stats.h Modified: head/lib/libstats/Makefile ============================================================================== --- head/lib/libstats/Makefile Mon Dec 2 20:57:13 2019 (r355303) +++ head/lib/libstats/Makefile Mon Dec 2 20:58:04 2019 (r355304) @@ -3,12 +3,12 @@ LIB= stats SHLIBDIR?= /lib SHLIB_MAJOR= 0 -SRCS= subr_stats.c +SRCS= subr_stats.c tcp_stats.c # To debug, comment WITHOUT_ASSERT_DEBUG= and uncomment CFLAGS:= WITHOUT_ASSERT_DEBUG= #CFLAGS:=${CFLAGS:C/-O[0-9]/-O0 -g3/} -DDIAGNOSTIC -.PATH: ${.CURDIR}/../../sys/kern +.PATH: ${.CURDIR}/../../sys/kern ${.CURDIR}/../../sys/netinet .include Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Mon Dec 2 20:57:13 2019 (r355303) +++ head/share/man/man4/tcp.4 Mon Dec 2 20:58:04 2019 (r355304) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd December 1, 2019 +.Dd December 2, 2019 .Dt TCP 4 .Os .Sh NAME @@ -291,6 +291,10 @@ This entry can only be specified on a per-host basis a .Pp If an SADB entry cannot be found for the destination, the system does not send any outgoing segments and drops any inbound segments. +.It Dv TCP_STATS +Manage collection of connection level statistics using the +.Xr stats 3 +framework. .Pp Each dropped segment is taken into account in the TCP protocol statistics. .It Dv TCP_TXTLS_ENABLE @@ -664,6 +668,17 @@ Default is false. When initializing the TCP timestamps, use a per connection offset instead of a per host pair offset. Default is to use per connection offsets as recommended in RFC 7323. +.It Va perconn_stats_enable +Controls the default collection of statistics for all connections using the +.Xr stats 3 +framework. +0 disables, 1 enables, 2 enables random sampling across log id connection +groups with all connections in a group receiving the same setting. +.It Va perconn_stats_sample_rates +A CSV list of template_spec=percent key-value pairs which controls the per +template sampling rates when +.Xr stats 3 +sampling is enabled. .El .Sh ERRORS A socket operation may fail with one of the following errors returned: @@ -703,6 +718,7 @@ when trying to use a TCP function block that is not av .Sh SEE ALSO .Xr getsockopt 2 , .Xr socket 2 , +.Xr stats 3 , .Xr sysctl 3 , .Xr blackhole 4 , .Xr inet 4 , Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/conf/files Mon Dec 2 20:58:04 2019 (r355304) @@ -4295,6 +4295,7 @@ netinet/tcp_pcap.c optional inet tcppcap | inet6 tcpp compile-with "${NORMAL_C} ${NO_WNONNULL}" netinet/tcp_reass.c optional inet | inet6 netinet/tcp_sack.c optional inet | inet6 +netinet/tcp_stats.c optional stats inet | stats inet6 netinet/tcp_subr.c optional inet | inet6 netinet/tcp_syncache.c optional inet | inet6 netinet/tcp_timer.c optional inet | inet6 Modified: head/sys/netinet/cc/cc.h ============================================================================== --- head/sys/netinet/cc/cc.h Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/cc/cc.h Mon Dec 2 20:58:04 2019 (r355304) @@ -51,9 +51,7 @@ #ifndef _NETINET_CC_CC_H_ #define _NETINET_CC_CC_H_ -#if !defined(_KERNEL) -#error "no user-serviceable parts inside" -#endif +#ifdef _KERNEL /* Global CC vars. */ extern STAILQ_HEAD(cc_head, cc_algo) cc_list; @@ -108,6 +106,7 @@ struct cc_var { #define CC_DUPACK 0x0002 /* Duplicate ACK. */ #define CC_PARTIALACK 0x0004 /* Not yet. */ #define CC_SACK 0x0008 /* Not yet. */ +#endif /* _KERNEL */ /* * Congestion signal types passed to the cong_signal() hook. The highest order 8 @@ -121,6 +120,7 @@ struct cc_var { #define CC_SIGPRIVMASK 0xFF000000 /* Mask to check if sig is private. */ +#ifdef _KERNEL /* * Structure to hold data and function pointers that together represent a * congestion control algorithm. @@ -184,4 +184,5 @@ extern struct rwlock cc_list_lock; #define CC_ALGOOPT_LIMIT 2048 +#endif /* _KERNEL */ #endif /* _NETINET_CC_CC_H_ */ Modified: head/sys/netinet/tcp.h ============================================================================== --- head/sys/netinet/tcp.h Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp.h Mon Dec 2 20:58:04 2019 (r355304) @@ -168,6 +168,7 @@ struct tcphdr { #define TCP_NOOPT 8 /* don't use TCP options */ #define TCP_MD5SIG 16 /* use MD5 digests (RFC2385) */ #define TCP_INFO 32 /* retrieve tcp_info structure */ +#define TCP_STATS 33 /* retrieve stats blob structure */ #define TCP_LOG 34 /* configure event logging for connection */ #define TCP_LOGBUF 35 /* retrieve event log for connection */ #define TCP_LOGID 36 /* configure log ID to correlate connections */ @@ -363,5 +364,19 @@ struct tcp_function_set { * TCP Control message types */ #define TLS_SET_RECORD_TYPE 1 + +/* + * TCP specific variables of interest for tp->t_stats stats(9) accounting. + */ +#define VOI_TCP_TXPB 0 /* Transmit payload bytes */ +#define VOI_TCP_RETXPB 1 /* Retransmit payload bytes */ +#define VOI_TCP_FRWIN 2 /* Foreign receive window */ +#define VOI_TCP_LCWIN 3 /* Local congesiton window */ +#define VOI_TCP_RTT 4 /* Round trip time */ +#define VOI_TCP_CSIG 5 /* Congestion signal */ +#define VOI_TCP_GPUT 6 /* Goodput */ +#define VOI_TCP_CALCFRWINDIFF 7 /* Congestion avoidance LCWIN - FRWIN */ +#define VOI_TCP_GPUT_ND 8 /* Goodput normalised delta */ +#define VOI_TCP_ACKLEN 9 /* Average ACKed bytes per ACK */ #endif /* !_NETINET_TCP_H_ */ Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp_input.c Mon Dec 2 20:58:04 2019 (r355304) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include "opt_tcpdebug.h" #include +#include #include #ifdef TCP_HHOOK #include @@ -66,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include /* for proc0 declaration */ #include +#include #include #include #include @@ -73,6 +75,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include /* before tcp_seq.h, for tcp_random18() */ @@ -298,6 +301,10 @@ void cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t nsegs, uint16_t type) { +#ifdef STATS + int32_t gput; +#endif + INP_WLOCK_ASSERT(tp->t_inpcb); tp->ccv->nsegs = nsegs; @@ -310,6 +317,35 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, u tp->ccv->flags &= ~CCF_CWND_LIMITED; if (type == CC_ACK) { +#ifdef STATS + stats_voi_update_abs_s32(tp->t_stats, VOI_TCP_CALCFRWINDIFF, + ((int32_t)tp->snd_cwnd) - tp->snd_wnd); + if (!IN_RECOVERY(tp->t_flags)) + stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_ACKLEN, + tp->ccv->bytes_this_ack / (tcp_maxseg(tp) * nsegs)); + if ((tp->t_flags & TF_GPUTINPROG) && + SEQ_GEQ(th->th_ack, tp->gput_ack)) { + /* + * Compute goodput in bits per millisecond. + */ + gput = (((int64_t)(th->th_ack - tp->gput_seq)) << 3) / + max(1, tcp_ts_getticks() - tp->gput_ts); + stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_GPUT, + gput); + /* + * XXXLAS: This is a temporary hack, and should be + * chained off VOI_TCP_GPUT when stats(9) grows an API + * to deal with chained VOIs. + */ + if (tp->t_stats_gput_prev > 0) + stats_voi_update_abs_s32(tp->t_stats, + VOI_TCP_GPUT_ND, + ((gput - tp->t_stats_gput_prev) * 100) / + tp->t_stats_gput_prev); + tp->t_flags &= ~TF_GPUTINPROG; + tp->t_stats_gput_prev = gput; + } +#endif /* STATS */ if (tp->snd_cwnd > tp->snd_ssthresh) { tp->t_bytes_acked += min(tp->ccv->bytes_this_ack, nsegs * V_tcp_abc_l_var * tcp_maxseg(tp)); @@ -328,6 +364,9 @@ cc_ack_received(struct tcpcb *tp, struct tcphdr *th, u tp->ccv->curack = th->th_ack; CC_ALGO(tp)->ack_received(tp->ccv, type); } +#ifdef STATS + stats_voi_update_abs_ulong(tp->t_stats, VOI_TCP_LCWIN, tp->snd_cwnd); +#endif } void @@ -393,6 +432,10 @@ cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, ui INP_WLOCK_ASSERT(tp->t_inpcb); +#ifdef STATS + stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_CSIG, type); +#endif + switch(type) { case CC_NDUPACK: if (!IN_FASTRECOVERY(tp->t_flags)) { @@ -1496,6 +1539,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru * For the SYN_SENT state the scale is zero. */ tiwin = th->th_win << tp->snd_scale; +#ifdef STATS + stats_voi_update_abs_ulong(tp->t_stats, VOI_TCP_FRWIN, tiwin); +#endif /* * TCP ECN processing. @@ -3359,6 +3405,10 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt) TCPSTAT_INC(tcps_rttupdated); tp->t_rttupdated++; +#ifdef STATS + stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT, + imax(0, rtt * 1000 / hz)); +#endif if ((tp->t_srtt != 0) && (tp->t_rxtshift <= TCP_RTT_INVALIDATE)) { /* * srtt is stored as fixed point with 5 bits after the Modified: head/sys/netinet/tcp_log_buf.c ============================================================================== --- head/sys/netinet/tcp_log_buf.c Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp_log_buf.c Mon Dec 2 20:58:04 2019 (r355304) @@ -30,10 +30,12 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include +#include #include #include #include @@ -41,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -475,7 +478,7 @@ tcp_log_grow_tlb(char *tlb_id, struct tcpcb *tp) INP_WLOCK_ASSERT(tp->t_inpcb); -#ifdef NETFLIX +#ifdef STATS if (V_tcp_perconn_stats_enable == 2 && tp->t_stats == NULL) (void)tcp_stats_sample_rollthedice(tp, tlb_id, strlen(tlb_id)); #endif Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp_output.c Mon Dec 2 20:58:04 2019 (r355304) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #ifdef TCP_HHOOK #include @@ -54,10 +55,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +#include #include #include @@ -991,15 +994,31 @@ send: struct sockbuf *msb; u_int moff; - if ((tp->t_flags & TF_FORCEDATA) && len == 1) + if ((tp->t_flags & TF_FORCEDATA) && len == 1) { TCPSTAT_INC(tcps_sndprobe); - else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) { +#ifdef STATS + if (SEQ_LT(tp->snd_nxt, tp->snd_max)) + stats_voi_update_abs_u32(tp->t_stats, + VOI_TCP_RETXPB, len); + else + stats_voi_update_abs_u64(tp->t_stats, + VOI_TCP_TXPB, len); +#endif /* STATS */ + } else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) { tp->t_sndrexmitpack++; TCPSTAT_INC(tcps_sndrexmitpack); TCPSTAT_ADD(tcps_sndrexmitbyte, len); +#ifdef STATS + stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RETXPB, + len); +#endif /* STATS */ } else { TCPSTAT_INC(tcps_sndpack); TCPSTAT_ADD(tcps_sndbyte, len); +#ifdef STATS + stats_voi_update_abs_u64(tp->t_stats, VOI_TCP_TXPB, + len); +#endif /* STATS */ } #ifdef INET6 if (MHLEN < hdrlen + max_linkhdr) @@ -1472,6 +1491,15 @@ out: tp->t_rtseq = startseq; TCPSTAT_INC(tcps_segstimed); } +#ifdef STATS + if (!(tp->t_flags & TF_GPUTINPROG) && len) { + tp->t_flags |= TF_GPUTINPROG; + tp->gput_seq = startseq; + tp->gput_ack = startseq + + ulmin(sbavail(&so->so_snd) - off, sendwin); + tp->gput_ts = tcp_ts_getticks(); + } +#endif /* STATS */ } /* Added: head/sys/netinet/tcp_stats.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netinet/tcp_stats.c Mon Dec 2 20:58:04 2019 (r355304) @@ -0,0 +1,274 @@ +/*- + * Copyright (c) 2016-2018 Netflix, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE 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. + */ + +/* + * Author: Lawrence Stewart + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _KERNEL +#include +#include +#include +#include +#endif +#include + +#include + +#include +#include +#include +#include + +#include + +VNET_DEFINE(int, tcp_perconn_stats_dflt_tpl) = -1; + +#ifndef _KERNEL +#define V_tcp_perconn_stats_enable VNET(tcp_perconn_stats_enable) +#define V_tcp_perconn_stats_dflt_tpl VNET(tcp_perconn_stats_dflt_tpl) +#else /* _KERNEL */ + +VNET_DEFINE(int, tcp_perconn_stats_enable) = 2; +VNET_DEFINE_STATIC(struct stats_tpl_sample_rate *, tcp_perconn_stats_sample_rates); +VNET_DEFINE_STATIC(int, tcp_stats_nrates) = 0; +#define V_tcp_perconn_stats_sample_rates VNET(tcp_perconn_stats_sample_rates) +#define V_tcp_stats_nrates VNET(tcp_stats_nrates) + +static struct rmlock tcp_stats_tpl_sampling_lock; +static int tcp_stats_tpl_sr_cb(enum stats_tpl_sr_cb_action action, + struct stats_tpl_sample_rate **rates, int *nrates, void *ctx); + +SYSCTL_INT(_net_inet_tcp, OID_AUTO, perconn_stats_enable, + CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_perconn_stats_enable), 0, + "Enable per-connection TCP stats gathering; 1 enables for all connections, " + "2 enables random sampling across log id connection groups"); +SYSCTL_PROC(_net_inet_tcp, OID_AUTO, perconn_stats_sample_rates, + CTLTYPE_STRING | CTLFLAG_RW, tcp_stats_tpl_sr_cb, + sizeof(struct rm_priotracker), stats_tpl_sample_rates, "A", + "TCP stats per template random sampling rates, in CSV tpl_spec=percent " + "key-value pairs (see stats(9) for template spec details)"); +#endif /* _KERNEL */ + +#ifdef _KERNEL +int +#else +static int +/* Ensure all templates are also added to the userland template list. */ +__attribute__ ((constructor)) +#endif +tcp_stats_init() +{ + int err, lasterr; + + err = lasterr = 0; + + V_tcp_perconn_stats_dflt_tpl = stats_tpl_alloc("TCP_DEFAULT", 0); + if (V_tcp_perconn_stats_dflt_tpl < 0) + return (-V_tcp_perconn_stats_dflt_tpl); + + struct voistatspec vss_sum[] = { + STATS_VSS_SUM(), + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_TXPB, "TCP_TXPB", VSD_DTYPE_INT_U64, + NVSS(vss_sum), vss_sum, 0); + lasterr = err ? err : lasterr; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_RETXPB, "TCP_RETXPB", VSD_DTYPE_INT_U32, + NVSS(vss_sum), vss_sum, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_max[] = { + STATS_VSS_MAX(), + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_FRWIN, "TCP_FRWIN", VSD_DTYPE_INT_ULONG, + NVSS(vss_max), vss_max, 0); + lasterr = err ? err : lasterr; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_LCWIN, "TCP_LCWIN", VSD_DTYPE_INT_ULONG, + NVSS(vss_max), vss_max, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_rtt[] = { + STATS_VSS_MAX(), + STATS_VSS_MIN(), + STATS_VSS_TDGSTCLUST32(20, 4), + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_RTT, "TCP_RTT", VSD_DTYPE_INT_U32, + NVSS(vss_rtt), vss_rtt, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_congsig[] = { + STATS_VSS_DVHIST32_USR(HBKTS(DVBKT(CC_ECN), DVBKT(CC_RTO), + DVBKT(CC_RTO_ERR), DVBKT(CC_NDUPACK)), 0) + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_CSIG, "TCP_CSIG", VSD_DTYPE_INT_U32, + NVSS(vss_congsig), vss_congsig, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_gput[] = { + STATS_VSS_MAX(), + STATS_VSS_TDGSTCLUST32(20, 4), + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_GPUT, "TCP_GPUT", VSD_DTYPE_INT_U32, + NVSS(vss_gput), vss_gput, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_gput_nd[] = { + STATS_VSS_TDGSTCLUST32(10, 4), + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_GPUT_ND, "TCP_GPUT_ND", VSD_DTYPE_INT_S32, + NVSS(vss_gput_nd), vss_gput_nd, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_windiff[] = { + STATS_VSS_CRHIST32_USR(HBKTS(CRBKT(0)), VSD_HIST_LBOUND_INF) + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_CALCFRWINDIFF, "TCP_CALCFRWINDIFF", VSD_DTYPE_INT_S32, + NVSS(vss_windiff), vss_windiff, 0); + lasterr = err ? err : lasterr; + + struct voistatspec vss_acklen[] = { + STATS_VSS_MAX(), + STATS_VSS_CRHIST32_LIN(0, 9, 1, VSD_HIST_UBOUND_INF) + }; + err |= stats_tpl_add_voistats(V_tcp_perconn_stats_dflt_tpl, + VOI_TCP_ACKLEN, "TCP_ACKLEN", VSD_DTYPE_INT_U32, + NVSS(vss_acklen), vss_acklen, 0); + lasterr = err ? err : lasterr; + + return (lasterr); +} + +#ifdef _KERNEL +int +tcp_stats_sample_rollthedice(struct tcpcb *tp, void *seed_bytes, + size_t seed_len) +{ + struct rm_priotracker tracker; + int tpl; + + tpl = -1; + + if (V_tcp_stats_nrates > 0) { + rm_rlock(&tcp_stats_tpl_sampling_lock, &tracker); + tpl = stats_tpl_sample_rollthedice(V_tcp_perconn_stats_sample_rates, + V_tcp_stats_nrates, seed_bytes, seed_len); + rm_runlock(&tcp_stats_tpl_sampling_lock, &tracker); + + if (tpl >= 0) { + INP_WLOCK_ASSERT(tp->t_inpcb); + if (tp->t_stats != NULL) + stats_blob_destroy(tp->t_stats); + tp->t_stats = stats_blob_alloc(tpl, 0); + if (tp->t_stats == NULL) + tpl = -ENOMEM; + } + } + + return (tpl); +} + +/* + * Callback function for stats_tpl_sample_rates() to interact with the TCP + * subsystem's stats template sample rates list. + */ +int +tcp_stats_tpl_sr_cb(enum stats_tpl_sr_cb_action action, + struct stats_tpl_sample_rate **rates, int *nrates, void *ctx) +{ + struct stats_tpl_sample_rate *old_rates; + int old_nrates; + + if (ctx == NULL) + return (ENOMEM); + + switch (action) { + case TPL_SR_RLOCKED_GET: + /* + * Return with rlock held i.e. this call must be paired with a + * "action == TPL_SR_RUNLOCK" call. + */ + rm_assert(&tcp_stats_tpl_sampling_lock, RA_UNLOCKED); + rm_rlock(&tcp_stats_tpl_sampling_lock, + (struct rm_priotracker *)ctx); + /* FALLTHROUGH */ + case TPL_SR_UNLOCKED_GET: + if (rates != NULL) + *rates = V_tcp_perconn_stats_sample_rates; + if (nrates != NULL) + *nrates = V_tcp_stats_nrates; + break; + case TPL_SR_RUNLOCK: + rm_assert(&tcp_stats_tpl_sampling_lock, RA_RLOCKED); + rm_runlock(&tcp_stats_tpl_sampling_lock, + (struct rm_priotracker *)ctx); + break; + case TPL_SR_PUT: + KASSERT(rates != NULL && nrates != NULL, + ("%s: PUT without new rates", __func__)); + rm_assert(&tcp_stats_tpl_sampling_lock, RA_UNLOCKED); + if (rates == NULL || nrates == NULL) + return (EINVAL); + rm_wlock(&tcp_stats_tpl_sampling_lock); + old_rates = V_tcp_perconn_stats_sample_rates; + old_nrates = V_tcp_stats_nrates; + V_tcp_perconn_stats_sample_rates = *rates; + V_tcp_stats_nrates = *nrates; + rm_wunlock(&tcp_stats_tpl_sampling_lock); + *rates = old_rates; + *nrates = old_nrates; + break; + default: + return (EINVAL); + break; + } + + return (0); +} + +RM_SYSINIT(tcp_stats_tpl_sampling_lock, &tcp_stats_tpl_sampling_lock, + "tcp_stats_tpl_sampling_lock"); +#endif /* _KERNEL */ Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp_subr.c Mon Dec 2 20:58:04 2019 (r355304) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #ifdef TCP_HHOOK @@ -54,6 +55,8 @@ __FBSDID("$FreeBSD$"); #ifdef KERN_TLS #include #endif +#include +#include #include #include #include @@ -1005,6 +1008,11 @@ tcp_init(void) &V_tcp_hhh[HHOOK_TCP_EST_OUT], HHOOK_NOWAIT|HHOOK_HEADISINVNET) != 0) printf("%s: WARNING: unable to register helper hook\n", __func__); #endif +#ifdef STATS + if (tcp_stats_init()) + printf("%s: WARNING: unable to initialise TCP stats\n", + __func__); +#endif hashsize = TCBHASHSIZE; TUNABLE_INT_FETCH(tcbhash_tuneable, &hashsize); if (hashsize == 0) { @@ -1694,6 +1702,10 @@ tcp_newtcpcb(struct inpcb *inp) if (tp->t_fb->tfb_tcp_fb_init) { (*tp->t_fb->tfb_tcp_fb_init)(tp); } +#ifdef STATS + if (V_tcp_perconn_stats_enable == 1) + tp->t_stats = stats_blob_alloc(V_tcp_perconn_stats_dflt_tpl, 0); +#endif return (tp); /* XXX */ } @@ -1911,6 +1923,9 @@ tcp_discardcb(struct tcpcb *tp) #ifdef TCP_HHOOK khelp_destroy_osd(tp->osd); +#endif +#ifdef STATS + stats_blob_destroy(tp->t_stats); #endif CC_ALGO(tp) = NULL; Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp_usrreq.c Mon Dec 2 20:58:04 2019 (r355304) @@ -49,11 +49,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include +#include #include #include #ifdef INET6 @@ -65,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef DDB #include @@ -108,6 +111,13 @@ __FBSDID("$FreeBSD$"); #endif #include +#include +#include +#include +#include +#include +#include + /* * TCP protocol interface to socket abstraction. */ @@ -1816,6 +1826,9 @@ tcp_default_ctloutput(struct socket *so, struct sockop #endif struct cc_algo *algo; char *pbuf, buf[TCP_LOG_ID_LEN]; +#ifdef STATS + struct statsblob *sbp; +#endif size_t len; /* @@ -1933,6 +1946,35 @@ unlock_and_done: error = EINVAL; break; + case TCP_STATS: + INP_WUNLOCK(inp); +#ifdef STATS + error = sooptcopyin(sopt, &optval, sizeof optval, + sizeof optval); + if (error) + return (error); + + if (optval > 0) + sbp = stats_blob_alloc( + V_tcp_perconn_stats_dflt_tpl, 0); + else + sbp = NULL; + + INP_WLOCK_RECHECK(inp); + if ((tp->t_stats != NULL && sbp == NULL) || + (tp->t_stats == NULL && sbp != NULL)) { + struct statsblob *t = tp->t_stats; + tp->t_stats = sbp; + sbp = t; + } + INP_WUNLOCK(inp); + + stats_blob_destroy(sbp); +#else + return (EOPNOTSUPP); +#endif /* !STATS */ + break; + case TCP_CONGESTION: INP_WUNLOCK(inp); error = sooptcopyin(sopt, buf, TCP_CA_NAME_MAX - 1, 1); @@ -2217,6 +2259,55 @@ unlock_and_done: INP_WUNLOCK(inp); error = sooptcopyout(sopt, &ti, sizeof ti); break; + case TCP_STATS: + { +#ifdef STATS + int nheld; + TYPEOF_MEMBER(struct statsblob, flags) sbflags = 0; + + error = 0; + socklen_t outsbsz = sopt->sopt_valsize; + if (tp->t_stats == NULL) + error = ENOENT; + else if (outsbsz >= tp->t_stats->cursz) + outsbsz = tp->t_stats->cursz; + else if (outsbsz >= sizeof(struct statsblob)) + outsbsz = sizeof(struct statsblob); + else + error = EINVAL; + INP_WUNLOCK(inp); + if (error) + break; + + sbp = sopt->sopt_val; + nheld = atop(round_page(((vm_offset_t)sbp) + + (vm_size_t)outsbsz) - trunc_page((vm_offset_t)sbp)); + vm_page_t ma[nheld]; + if (vm_fault_quick_hold_pages( + &curproc->p_vmspace->vm_map, (vm_offset_t)sbp, + outsbsz, VM_PROT_READ | VM_PROT_WRITE, ma, + nheld) < 0) { + error = EFAULT; + break; + } + + if ((error = copyin_nofault(&(sbp->flags), &sbflags, + SIZEOF_MEMBER(struct statsblob, flags)))) + goto unhold; + + INP_WLOCK_RECHECK(inp); + error = stats_blob_snapshot(&sbp, outsbsz, tp->t_stats, + sbflags | SB_CLONE_USRDSTNOFAULT); + INP_WUNLOCK(inp); + sopt->sopt_valsize = outsbsz; +unhold: + vm_page_unhold_pages(ma, nheld); +#else + INP_WUNLOCK(inp); + error = EOPNOTSUPP; +#endif /* !STATS */ + break; + } case TCP_CONGESTION: len = strlcpy(buf, CC_ALGO(tp)->name, TCP_CA_NAME_MAX); INP_WUNLOCK(inp); Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/netinet/tcp_var.h Mon Dec 2 20:58:04 2019 (r355304) @@ -210,7 +210,12 @@ struct tcpcb { struct tcp_log_id_node *t_lin; struct tcp_log_id_bucket *t_lib; const char *t_output_caller; /* Function that called tcp_output */ + struct statsblob *t_stats; /* Per-connection stats */ uint32_t t_logsn; /* Log "serial number" */ + uint32_t gput_ts; /* Time goodput measurement started */ + tcp_seq gput_seq; /* Outbound measurement seq */ + tcp_seq gput_ack; /* Inbound measurement ack */ + int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */ uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */ unsigned int *t_tfo_pending; /* TCP Fast Open server pending counter */ union { @@ -327,7 +332,7 @@ TAILQ_HEAD(tcp_funchead, tcp_function); #define TF_NOPUSH 0x00001000 /* don't push */ #define TF_PREVVALID 0x00002000 /* saved values for bad rxmit valid */ #define TF_UNUSED1 0x00004000 /* unused */ -#define TF_UNUSED2 0x00008000 /* unused */ +#define TF_GPUTINPROG 0x00008000 /* Goodput measurement in progress */ #define TF_MORETOCOME 0x00010000 /* More data to be appended to sock */ #define TF_LQ_OVERFLOW 0x00020000 /* listen queue overflow */ #define TF_LASTIDLE 0x00040000 /* connection was previously idle */ @@ -787,6 +792,10 @@ VNET_DECLARE(int, tcp_insecure_rst); VNET_DECLARE(int, tcp_insecure_syn); VNET_DECLARE(int, tcp_minmss); VNET_DECLARE(int, tcp_mssdflt); +#ifdef STATS +VNET_DECLARE(int, tcp_perconn_stats_dflt_tpl); +VNET_DECLARE(int, tcp_perconn_stats_enable); +#endif /* STATS */ VNET_DECLARE(int, tcp_recvspace); VNET_DECLARE(int, tcp_sack_globalholes); VNET_DECLARE(int, tcp_sack_globalmaxholes); @@ -823,6 +832,10 @@ VNET_DECLARE(struct inpcbinfo, tcbinfo); #define V_tcp_insecure_syn VNET(tcp_insecure_syn) #define V_tcp_minmss VNET(tcp_minmss) #define V_tcp_mssdflt VNET(tcp_mssdflt) +#ifdef STATS +#define V_tcp_perconn_stats_dflt_tpl VNET(tcp_perconn_stats_dflt_tpl) +#define V_tcp_perconn_stats_enable VNET(tcp_perconn_stats_enable) +#endif /* STATS */ #define V_tcp_recvspace VNET(tcp_recvspace) #define V_tcp_sack_globalholes VNET(tcp_sack_globalholes) #define V_tcp_sack_globalmaxholes VNET(tcp_sack_globalmaxholes) @@ -966,10 +979,13 @@ int tcp_newreno(struct tcpcb *, struct tcphdr *); int tcp_compute_pipe(struct tcpcb *); uint32_t tcp_compute_initwnd(uint32_t); void tcp_sndbuf_autoscale(struct tcpcb *, struct socket *, uint32_t); +int tcp_stats_sample_rollthedice(struct tcpcb *tp, void *seed_bytes, + size_t seed_len); struct mbuf * tcp_m_copym(struct mbuf *m, int32_t off0, int32_t *plen, int32_t seglimit, int32_t segsize, struct sockbuf *sb, bool hw_tls); +int tcp_stats_init(void); static inline void tcp_fields_to_host(struct tcphdr *th) Modified: head/sys/sys/stats.h ============================================================================== --- head/sys/sys/stats.h Mon Dec 2 20:57:13 2019 (r355303) +++ head/sys/sys/stats.h Mon Dec 2 20:58:04 2019 (r355304) @@ -58,6 +58,9 @@ #define _SYS_STATS_H_ #include +#ifdef DIAGNOSTIC +#include +#endif #ifndef _KERNEL /* From owner-svn-src-all@freebsd.org Mon Dec 2 20:58:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3943E1B7120; Mon, 2 Dec 2019 20:58:56 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcsr0rXTz4MPs; Mon, 2 Dec 2019 20:58:56 +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 012AB4F91; Mon, 2 Dec 2019 20:58:56 +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 xB2KwtiV080488; Mon, 2 Dec 2019 20:58:55 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kwtm6080485; Mon, 2 Dec 2019 20:58:55 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022058.xB2Kwtm6080485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355305 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:58:56 -0000 Author: cy Date: Mon Dec 2 20:58:55 2019 New Revision: 355305 URL: https://svnweb.freebsd.org/changeset/base/355305 Log: MFC r355142: Move ipf_pcksum6() to its rightful place, in ip_fil_freebsd.c. This FreeBSD-only function should live in the O/S specific source file. This essentially reverts r349929 Now that ipftest and ipfreplay are disabled in FreeBSD 11-stable. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) @@ -179,10 +179,6 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); -#ifdef USE_INET6 -static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10277,46 +10273,5 @@ ipf_inet6_mask_del(bits, mask, mtab) } mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); -} - -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ -#ifdef _KERNEL - struct mbuf *m; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - return(in6_cksum(m, ip6->ip6_nxt, off, len)); -#else - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -#endif } #endif Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:04 2019 (r355304) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:55 2019 (r355305) @@ -1839,6 +1839,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:55 2019 (r355305) @@ -1447,3 +1447,48 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ +#ifdef _KERNEL + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +#else + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +#endif +} +#endif From owner-svn-src-all@freebsd.org Mon Dec 2 20:58:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A8911B7136; Mon, 2 Dec 2019 20:58:57 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcsr6bc6z4MQ3; Mon, 2 Dec 2019 20:58:56 +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 C45A04F92; Mon, 2 Dec 2019 20:58:56 +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 xB2KwufI080496; Mon, 2 Dec 2019 20:58:56 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Kwuqr080493; Mon, 2 Dec 2019 20:58:56 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022058.xB2Kwuqr080493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 20:58:56 +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: r355305 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 20:58:57 -0000 Author: cy Date: Mon Dec 2 20:58:55 2019 New Revision: 355305 URL: https://svnweb.freebsd.org/changeset/base/355305 Log: MFC r355142: Move ipf_pcksum6() to its rightful place, in ip_fil_freebsd.c. This FreeBSD-only function should live in the O/S specific source file. This essentially reverts r349929 Now that ipftest and ipfreplay are disabled in FreeBSD 11-stable. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c stable/12/sys/contrib/ipfilter/netinet/ip_fil.h stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_fil.h stable/11/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) @@ -179,10 +179,6 @@ static int ipf_updateipid __P((fr_info_t *)); static int ipf_settimeout __P((struct ipf_main_softc_s *, struct ipftuneable *, ipftuneval_t *)); -#ifdef USE_INET6 -static u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, - u_int32_t, u_int32_t)); -#endif #if !defined(_KERNEL) || SOLARIS static int ppsratecheck(struct timeval *, int *, int); #endif @@ -10277,46 +10273,5 @@ ipf_inet6_mask_del(bits, mask, mtab) } mtab->imt6_max--; ASSERT(mtab->imt6_max >= 0); -} - -static u_int -ipf_pcksum6(fin, ip6, off, len) - fr_info_t *fin; - ip6_t *ip6; - u_int32_t off; - u_int32_t len; -{ -#ifdef _KERNEL - struct mbuf *m; - - m = fin->fin_m; - if (m->m_len < sizeof(struct ip6_hdr)) { - return 0xffff; - } - - return(in6_cksum(m, ip6->ip6_nxt, off, len)); -#else - u_short *sp; - u_int sum; - - sp = (u_short *)&ip6->ip6_src; - sum = *sp++; /* ip6_src */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; /* ip6_dst */ - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - sum += *sp++; - return(ipf_pcksum(fin, off, sum)); -#endif } #endif Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil.h ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:04 2019 (r355304) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil.h Mon Dec 2 20:58:55 2019 (r355305) @@ -1839,6 +1839,10 @@ extern int ipf_matchicmpqueryreply __P((int, icmpinfo struct icmp *, int)); extern u_32_t ipf_newisn __P((fr_info_t *)); extern u_int ipf_pcksum __P((fr_info_t *, int, u_int)); +#ifdef USE_INET6 +extern u_int ipf_pcksum6 __P((fr_info_t *, ip6_t *, + u_int32_t, u_int32_t)); +#endif extern void ipf_rule_expire __P((ipf_main_softc_t *)); extern int ipf_scanlist __P((fr_info_t *, u_32_t)); extern frentry_t *ipf_srcgrpmap __P((fr_info_t *, u_32_t *)); Modified: stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:04 2019 (r355304) +++ stable/12/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Mon Dec 2 20:58:55 2019 (r355305) @@ -1451,3 +1451,48 @@ ipf_pcksum(fin, hlen, sum) sum2 = ~sum & 0xffff; return sum2; } + +#ifdef USE_INET6 +u_int +ipf_pcksum6(fin, ip6, off, len) + fr_info_t *fin; + ip6_t *ip6; + u_int32_t off; + u_int32_t len; +{ +#ifdef _KERNEL + struct mbuf *m; + int sum; + + m = fin->fin_m; + if (m->m_len < sizeof(struct ip6_hdr)) { + return 0xffff; + } + + sum = in6_cksum(m, ip6->ip6_nxt, off, len); + return(sum); +#else + u_short *sp; + u_int sum; + + sp = (u_short *)&ip6->ip6_src; + sum = *sp++; /* ip6_src */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; /* ip6_dst */ + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + sum += *sp++; + return(ipf_pcksum(fin, off, sum)); +#endif +} +#endif From owner-svn-src-all@freebsd.org Mon Dec 2 21:00:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3748F1B73BA; Mon, 2 Dec 2019 21:00:30 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcvf0LsBz4MjL; Mon, 2 Dec 2019 21:00:30 +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 E42E04FA8; Mon, 2 Dec 2019 21:00:29 +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 xB2L0Tph080678; Mon, 2 Dec 2019 21:00:29 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L0T2p080677; Mon, 2 Dec 2019 21:00:29 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022100.xB2L0T2p080677@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 21:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355306 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:00:30 -0000 Author: cy Date: Mon Dec 2 21:00:29 2019 New Revision: 355306 URL: https://svnweb.freebsd.org/changeset/base/355306 Log: MFC r355156: Include fin, the packet information structure (fr_info_t), in the l4sums DTrace probe, making more information available for the diagnosis of IPv6 checksum errors. Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 21:00:29 2019 (r355306) @@ -6742,7 +6742,7 @@ ipf_checkl4sum(fin) FR_DEBUG(("checkl4sum: %hx != %hx\n", sum, hdrsum)); } #endif - DT2(l4sums, u_short, hdrsum, u_short, sum); + DT3(l4sums, u_short, hdrsum, u_short, sum, fr_info_t *, fin); #ifdef USE_INET6 if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { #else From owner-svn-src-all@freebsd.org Mon Dec 2 21:00:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84DED1B73CB; Mon, 2 Dec 2019 21:00:30 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcvf2nYdz4MjM; Mon, 2 Dec 2019 21:00:30 +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 432634FA9; Mon, 2 Dec 2019 21:00:30 +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 xB2L0U86080684; Mon, 2 Dec 2019 21:00:30 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L0UrE080683; Mon, 2 Dec 2019 21:00:30 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912022100.xB2L0UrE080683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Mon, 2 Dec 2019 21:00: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: r355306 - in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/sys/contrib/ipfilter/netinet 12/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 355306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:00:30 -0000 Author: cy Date: Mon Dec 2 21:00:29 2019 New Revision: 355306 URL: https://svnweb.freebsd.org/changeset/base/355306 Log: MFC r355156: Include fin, the packet information structure (fr_info_t), in the l4sums DTrace probe, making more information available for the diagnosis of IPv6 checksum errors. Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 20:58:55 2019 (r355305) +++ stable/12/sys/contrib/ipfilter/netinet/fil.c Mon Dec 2 21:00:29 2019 (r355306) @@ -6742,7 +6742,7 @@ ipf_checkl4sum(fin) FR_DEBUG(("checkl4sum: %hx != %hx\n", sum, hdrsum)); } #endif - DT2(l4sums, u_short, hdrsum, u_short, sum); + DT3(l4sums, u_short, hdrsum, u_short, sum, fr_info_t *, fin); #ifdef USE_INET6 if (hdrsum == sum || (sum == 0 && fin->fin_p == IPPROTO_ICMPV6)) { #else From owner-svn-src-all@freebsd.org Mon Dec 2 21:03:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B6651B77CC; Mon, 2 Dec 2019 21:03:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rcyk1N7Zz4NPP; Mon, 2 Dec 2019 21:03:10 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E08B35164; Mon, 2 Dec 2019 21:03:09 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2L39OU086164; Mon, 2 Dec 2019 21:03:09 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L39pZ086163; Mon, 2 Dec 2019 21:03:09 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912022103.xB2L39pZ086163@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 2 Dec 2019 21:03:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355307 - head/share/man/man3 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man3 X-SVN-Commit-Revision: 355307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:03:10 -0000 Author: trasz Date: Mon Dec 2 21:03:09 2019 New Revision: 355307 URL: https://svnweb.freebsd.org/changeset/base/355307 Log: Expand stats(3) man page to add a caveat regarding HZ. Suggested by: thj Sponsored by: Klara Inc, Netflix Modified: head/share/man/man3/stats.3 Modified: head/share/man/man3/stats.3 ============================================================================== --- head/share/man/man3/stats.3 Mon Dec 2 21:00:29 2019 (r355306) +++ head/share/man/man3/stats.3 Mon Dec 2 21:03:09 2019 (r355307) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2019 +.Dd December 2, 2019 .Dt STATS 3 .Os .Sh NAME @@ -960,3 +960,9 @@ The framework and this manual page were written by .An Lawrence Stewart Aq lstewart@FreeBSD.org and sponsored by Netflix, Inc. +.Sh CAVEATS +Granularity of timing-dependent network statistics, in particular TCP_RTT, +depends on the +.Dv HZ +timer. +To minimize the measurement error avoid using HZ lower than 1000. From owner-svn-src-all@freebsd.org Mon Dec 2 21:09:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 901E81B830B; Mon, 2 Dec 2019 21:09:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rd5S3GXnz4PJr; Mon, 2 Dec 2019 21:09:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5364F5195; Mon, 2 Dec 2019 21:09:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2L90Au086518; Mon, 2 Dec 2019 21:09:00 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L90Rb086517; Mon, 2 Dec 2019 21:09:00 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912022109.xB2L90Rb086517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 2 Dec 2019 21:09:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355308 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 355308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:09:00 -0000 Author: tsoome Date: Mon Dec 2 21:08:59 2019 New Revision: 355308 URL: https://svnweb.freebsd.org/changeset/base/355308 Log: loader.efi: fix cd boot for cisco C220M3 Reported by: Chris Ross MFC after: 1w Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Mon Dec 2 21:03:09 2019 (r355307) +++ head/stand/efi/libefi/efipart.c Mon Dec 2 21:08:59 2019 (r355308) @@ -283,6 +283,16 @@ efipart_ignore_device(EFI_HANDLE h, EFI_BLOCK_IO *blki * Therefore, if this node is USB, or this node is Unit (LUN) and * direct parent is USB and we have no media, we will ignore this * device. + * + * Variation of the same situation, but with SCSI devices: + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x1) + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x2) + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x3) + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x3)/CD.. + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x3)/CD.. + * PciRoot(0x0)/Pci(0x1a,0x0)/USB(0x1,0)/USB(0x3,0x0)/SCSI(0x0,0x4) + * + * Here above the SCSI luns 1,2 and 4 have no media. */ /* Do not ignore device with media. */ @@ -321,6 +331,13 @@ efipart_ignore_device(EFI_HANDLE h, EFI_BLOCK_IO *blki if (parent_is_usb && DevicePathType(node) == MESSAGING_DEVICE_PATH && DevicePathSubType(node) == MSG_DEVICE_LOGICAL_UNIT_DP) { + efi_close_devpath(h); + return (true); + } + /* no media, parent is USB and devicepath is SCSI. */ + if (parent_is_usb && + DevicePathType(node) == MESSAGING_DEVICE_PATH && + DevicePathSubType(node) == MSG_SCSI_DP) { efi_close_devpath(h); return (true); } From owner-svn-src-all@freebsd.org Mon Dec 2 21:09:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41D9F1B83C8; Mon, 2 Dec 2019 21:09:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rd6Z0z37z4PRS; Mon, 2 Dec 2019 21:09:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 049A45196; Mon, 2 Dec 2019 21:09:58 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2L9vnt086595; Mon, 2 Dec 2019 21:09:57 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2L9vRE086594; Mon, 2 Dec 2019 21:09:57 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201912022109.xB2L9vRE086594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 2 Dec 2019 21:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355309 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 355309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:09:58 -0000 Author: trasz Date: Mon Dec 2 21:09:57 2019 New Revision: 355309 URL: https://svnweb.freebsd.org/changeset/base/355309 Log: Bump __FreeBSD_version after r355304. The net/tcprtt port depends on this. Sponsored by: Klara, Inc, Netflix Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Dec 2 21:08:59 2019 (r355308) +++ head/sys/sys/param.h Mon Dec 2 21:09:57 2019 (r355309) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300061 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300062 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Mon Dec 2 21:14:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADE9D1B87E7 for ; Mon, 2 Dec 2019 21:14:23 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47RdCg2BZlz4Q15 for ; Mon, 2 Dec 2019 21:14:23 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575321261; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=OIRqu0vApbkf1XX8TWDZKw/FqKR28Tn64yWGyjQM36ZXPjQhAZpU94ah3uqUwQXUz2oeuVZt7twCC Q4S/2KdqKkTUbD0xM6i0rnFzqXvz40du3sT/FG/3wyVqHP7he2A7sHteegff55XbsLJf+nQPjyCZX6 HJjbjxbjLF37Wdss+2z0wxfHI8QVzsr8OZf5bZMlpc9J5+IxtTbUyKJUhDKm9bOZ5KVjo/XSFd6aY8 eO37QzkHGcRHiGQWn7WTtZTc5x0VrPWcnMLrk6oAl0CQy6ChO7ycy+eWkJkKjdL8uwgpXCNLn1KZ3x itjqV4FyQEMbtmd6nicZ1bNoBDNtnCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=1vH67dMsHX9Hm75oIBwgLPAl/iNgy0prF7na/zdnzWM=; b=bKyoY+f+ZICgwE8WfChBriA97cXCgULSJSLMJ9siG4+5kb5BB+PI4k5Rd7nBM2MmVcgFAtYV12y4o 3n9Sn57aPUw5+oRqw/PdYGo8rm+Yi8rHmEQI0OiiBr6xDsP3zpTmHJM2hXFQlqaAJCoyneK5IUDpwb 5yta7nfMm7MyzB8pek0F/VDu9Xe7z9r+4z0XPnpGSGJByqGMm32R/t6vjJ468J1YX9Yf4886ncyTFe rfbrh+UgkU0S6fdE6w9gtnyUdG/9H6Az88INPRC7WRTRbO2PejrdKXWxuwgQASZ2EY8VC4TKjyvo22 ZrUyanGwFCS/sokJ85X6fKinRU7xkbA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=1vH67dMsHX9Hm75oIBwgLPAl/iNgy0prF7na/zdnzWM=; b=v8BWWhCGaZn2v22z271M8mkks2xotNZyz5Hxd3/piL44J0SCmdGpwezTADzGiijbt9PmIef36Twbk rvTpynMKQTFLs5/6jiQcLywUzO5riSa5M3Jra5YidIyTUYcFReLuahE+G2hBrtKe+6lEG2rr4zrjYJ L55BRWpq+9Lp9bfugGNdH73QrmOoFfd5y3oZARYj0dZnED2R/KLaksCLs9VaX10PgGyovq4DzkqtM0 tbYJSJTWO2w6aXltJPjjyMzwo595uU2vDII8pLuWjEJjfEd8KmEGU8H1Y4F930qnh6cgYrfVDzMaSV 4DcAx8vQ7p162X3r927JeNEWFqOvKYQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: b4230f70-1548-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id b4230f70-1548-11ea-829e-79a40d15cccd; Mon, 02 Dec 2019 21:14:20 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB2LEJoo097183; Mon, 2 Dec 2019 14:14:19 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve From: Ian Lepore To: Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 02 Dec 2019 14:14:19 -0700 In-Reply-To: <201912022051.xB2Kplot078056@repo.freebsd.org> References: <201912022051.xB2Kplot078056@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47RdCg2BZlz4Q15 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.88 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.96)[-0.955,0]; NEURAL_HAM_LONG(-0.93)[-0.929,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:14:23 -0000 On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > Author: vmaffione > Date: Mon Dec 2 20:51:46 2019 > New Revision: 355301 > URL: https://svnweb.freebsd.org/changeset/base/355301 > > Log: > bhyve: uniform printf format string newlines > > Some of the printf statements only use LF to get a newline. > However, a CR character is also required for the serial console to > print debug logs in a nice way. > Fix those code locations that only use LF, by adding a CR > character. > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D22552 > > Modified: > head/usr.sbin/bhyve/audio.c > head/usr.sbin/bhyve/hda_codec.c > head/usr.sbin/bhyve/net_backends.c > head/usr.sbin/bhyve/pci_ahci.c > head/usr.sbin/bhyve/pci_e82545.c > head/usr.sbin/bhyve/pci_hda.c > head/usr.sbin/bhyve/pci_nvme.c > head/usr.sbin/bhyve/pci_virtio_block.c > head/usr.sbin/bhyve/pci_virtio_console.c > head/usr.sbin/bhyve/pci_virtio_net.c > head/usr.sbin/bhyve/pci_virtio_rnd.c > head/usr.sbin/bhyve/pci_virtio_scsi.c > head/usr.sbin/bhyve/pci_xhci.c > head/usr.sbin/bhyve/rfb.c > These changes seem wrong in a couple ways... - Lines are terminated by linefeeds in unix-like systems. If linefeeds need to be translated to include carriage returns, that's the responsibility of the terminal/line-discipline layer, not the source strings being printed. - The sequence \n\r is very strange. For systems that do prefer carriage returns, the \r always comes before the \n (or stands alone on Mac systems), not after. I have a feeling that the root of this is something like "lots of people use bhyve for Windows, so they use Windows apps to look at logs, so the logs should be formatted for Windows." If that's the reasoning, then why shouldn't we convert EVERY printf in the source base to include carriage returns, just in case a windows user wants to browse a log file? -- Ian From owner-svn-src-all@freebsd.org Mon Dec 2 21:27:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC75A1B8C20; Mon, 2 Dec 2019 21:27:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RdVK480gz4QSw; Mon, 2 Dec 2019 21:27:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f171.google.com (mail-qk1-f171.google.com [209.85.222.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 66917165B9; Mon, 2 Dec 2019 21:27:05 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f171.google.com with SMTP id d124so1183029qke.6; Mon, 02 Dec 2019 13:27:05 -0800 (PST) X-Gm-Message-State: APjAAAXOV/ah1irWfjCpCJ6/5AhWt8J4PeAcS3EFoFInw7nW0iw4DOu5 w1uYGkIUavhdCxKcnt93qrjt6rdryXRwLhDad7Y= X-Google-Smtp-Source: APXvYqyVHVhU9rJU62NH8srbd0NKmoBS9xvJMFD5TzQ0LMyE6udE+jDPaMo2gvkedsM7HJQHE41+OkKvbaozxbqhaIw= X-Received: by 2002:a37:4992:: with SMTP id w140mr1176631qka.493.1575322024987; Mon, 02 Dec 2019 13:27:04 -0800 (PST) MIME-Version: 1.0 References: <201912022051.xB2Kplot078056@repo.freebsd.org> <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> In-Reply-To: <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> From: Kyle Evans Date: Mon, 2 Dec 2019 15:26:53 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve To: Ian Lepore Cc: Vincenzo Maffione , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:27:05 -0000 On Mon, Dec 2, 2019 at 3:14 PM Ian Lepore wrote: > > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > Author: vmaffione > > Date: Mon Dec 2 20:51:46 2019 > > New Revision: 355301 > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > Log: > > bhyve: uniform printf format string newlines > > > > Some of the printf statements only use LF to get a newline. > > However, a CR character is also required for the serial console to > > print debug logs in a nice way. > > Fix those code locations that only use LF, by adding a CR > > character. > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > Modified: > > head/usr.sbin/bhyve/audio.c > > head/usr.sbin/bhyve/hda_codec.c > > head/usr.sbin/bhyve/net_backends.c > > head/usr.sbin/bhyve/pci_ahci.c > > head/usr.sbin/bhyve/pci_e82545.c > > head/usr.sbin/bhyve/pci_hda.c > > head/usr.sbin/bhyve/pci_nvme.c > > head/usr.sbin/bhyve/pci_virtio_block.c > > head/usr.sbin/bhyve/pci_virtio_console.c > > head/usr.sbin/bhyve/pci_virtio_net.c > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > head/usr.sbin/bhyve/pci_xhci.c > > head/usr.sbin/bhyve/rfb.c > > > > These changes seem wrong in a couple ways... > > - Lines are terminated by linefeeds in unix-like systems. If > linefeeds need to be translated to include carriage returns, that's the > responsibility of the terminal/line-discipline layer, not the source > strings being printed. > > - The sequence \n\r is very strange. For systems that do prefer > carriage returns, the \r always comes before the \n (or stands alone on > Mac systems), not after. > > I have a feeling that the root of this is something like "lots of > people use bhyve for Windows, so they use Windows apps to look at logs, > so the logs should be formatted for Windows." If that's the reasoning, > then why shouldn't we convert EVERY printf in the source base to > include carriage returns, just in case a windows user wants to browse a > log file? > Even Windows notepad is learning to cope with different EOL formats, for what it's worth. From owner-svn-src-all@freebsd.org Mon Dec 2 21:33:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BBA31B8F5D; Mon, 2 Dec 2019 21:33:31 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rddl0PW4z4Qtx; Mon, 2 Dec 2019 21:33:31 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id DBE04166EC; Mon, 2 Dec 2019 21:33:30 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-qv1-f48.google.com with SMTP id p2so537305qvo.10; Mon, 02 Dec 2019 13:33:30 -0800 (PST) X-Gm-Message-State: APjAAAXJLIMrjepavFF6GZlmEcKdSyl4nzt5jSzPGuBErVnK92KTLprH jodOBjtvnC+rAY+wezppKF+ZmautRZG0UZ/SSY4= X-Google-Smtp-Source: APXvYqygu0IsEtcsjnbzdhlzA3IhCHeCJw1RXhucFO4Qb+cnj9PqfSn82o1fAv4pZd98V9NiN3jPro9XZuLzJ1F7qOY= X-Received: by 2002:a0c:9a43:: with SMTP id q3mr1455100qvd.101.1575322410361; Mon, 02 Dec 2019 13:33:30 -0800 (PST) MIME-Version: 1.0 References: <201912022051.xB2Kplot078056@repo.freebsd.org> <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> In-Reply-To: <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> From: Vincenzo Maffione Date: Mon, 2 Dec 2019 22:35:41 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve To: Ian Lepore Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:33:31 -0000 Il giorno lun 2 dic 2019 alle ore 22:14 Ian Lepore ha scritto: > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > Author: vmaffione > > Date: Mon Dec 2 20:51:46 2019 > > New Revision: 355301 > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > Log: > > bhyve: uniform printf format string newlines > > > > Some of the printf statements only use LF to get a newline. > > However, a CR character is also required for the serial console to > > print debug logs in a nice way. > > Fix those code locations that only use LF, by adding a CR > > character. > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > Modified: > > head/usr.sbin/bhyve/audio.c > > head/usr.sbin/bhyve/hda_codec.c > > head/usr.sbin/bhyve/net_backends.c > > head/usr.sbin/bhyve/pci_ahci.c > > head/usr.sbin/bhyve/pci_e82545.c > > head/usr.sbin/bhyve/pci_hda.c > > head/usr.sbin/bhyve/pci_nvme.c > > head/usr.sbin/bhyve/pci_virtio_block.c > > head/usr.sbin/bhyve/pci_virtio_console.c > > head/usr.sbin/bhyve/pci_virtio_net.c > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > head/usr.sbin/bhyve/pci_xhci.c > > head/usr.sbin/bhyve/rfb.c > > > > These changes seem wrong in a couple ways... > > - Lines are terminated by linefeeds in unix-like systems. If > linefeeds need to be translated to include carriage returns, that's the > responsibility of the terminal/line-discipline layer, not the source > strings being printed. > That's a good point. The need for carriage returns shows up when using the vmrun.sh script on a FreeBSD host, which ends up calling /usr/bin/bhyve. I must admit I don't know enough about the terminals and ldisc to know how to change the current behaviour and fix this specific issue. Any suggestions and pointer would be very welcome. > > - The sequence \n\r is very strange. For systems that do prefer > carriage returns, the \r always comes before the \n (or stands alone on > Mac systems), not after. > Also true. I did not realize that, and just reused the same sequence that was used elsewhere. > > I have a feeling that the root of this is something like "lots of > people use bhyve for Windows, so they use Windows apps to look at logs, > so the logs should be formatted for Windows." If that's the reasoning, > then why shouldn't we convert EVERY printf in the source base to > include carriage returns, just in case a windows user wants to browse a > log file? > No, as I said above this happens with FreeBSD guests on FreeBSD hosts, using the /share/example/bhyve/vmrun.sh script. Thanks, Vincenzo > > -- Ian > > From owner-svn-src-all@freebsd.org Mon Dec 2 21:36:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27B551B9092; Mon, 2 Dec 2019 21:36:11 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rdhq0BqRz4R7y; Mon, 2 Dec 2019 21:36:11 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 1F05D166ED; Mon, 2 Dec 2019 21:36:10 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Mon, 02 Dec 2019 13:36:06 -0800 Subject: Re: svn commit: r355188 - in head/riscv: . sifive From: Ravi Pokala To: Emmanuel Vadot , , , Message-ID: <3C503BF7-6D49-4FD2-B2C4-55C890FA8458@panasas.com> Thread-Topic: svn commit: r355188 - in head/riscv: . sifive References: <201911281938.xASJcv3a034087@repo.freebsd.org> In-Reply-To: <201911281938.xASJcv3a034087@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 21:36:11 -0000 Hi Manu, This creates a top-level "riscv" directory, but there are no other top-leve= l ${TARGET} directories. It looks like other *.dts and *.dtsi files live in either sys/dts/${TARGET} or sys/gnu/dts/${TARGET}/(vendor/)? So perhaps these should be moved to one of those directories, as appropriat= e? Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Emmanuel Vadot Date: 2019-11-28, Thursday at 11:38 To: , , Subject: svn commit: r355188 - in head/riscv: . sifive Author: manu Date: Thu Nov 28 19:38:57 2019 New Revision: 355188 URL: https://svnweb.freebsd.org/changeset/base/355188 =20 Log: Import riscv DTS files =20 Requested by: mhorne =20 Added: head/riscv/ - copied from r355184, vendor/device-tree/dist/src/riscv/ Replaced: head/riscv/sifive/fu540-c000.dtsi - copied unchanged from r355185, vendor/device-tree/dist/src/riscv= /sifive/fu540-c000.dtsi head/riscv/sifive/hifive-unleashed-a00.dts - copied unchanged from r355185, vendor/device-tree/dist/src/riscv= /sifive/hifive-unleashed-a00.dts =20 Copied: head/riscv/sifive/fu540-c000.dtsi (from r355185, vendor/device-= tree/dist/src/riscv/sifive/fu540-c000.dtsi) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/riscv/sifive/fu540-c000.dtsi Thu Nov 28 19:38:57 2019 (r355188= , copy of r355185, vendor/device-tree/dist/src/riscv/sifive/fu540-c000.dtsi) @@ -0,0 +1,251 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* Copyright (c) 2018-2019 SiFive, Inc */ + +/dts-v1/; + +#include + +/ { + #address-cells =3D <2>; + #size-cells =3D <2>; + compatible =3D "sifive,fu540-c000", "sifive,fu540"; + + aliases { + serial0 =3D &uart0; + serial1 =3D &uart1; + ethernet0 =3D ð0; + }; + + chosen { + }; + + cpus { + #address-cells =3D <1>; + #size-cells =3D <0>; + cpu0: cpu@0 { + compatible =3D "sifive,e51", "sifive,rocket0", "riscv"; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <128>; + i-cache-size =3D <16384>; + reg =3D <0>; + riscv,isa =3D "rv64imac"; + status =3D "disabled"; + cpu0_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu1: cpu@1 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <1>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + cpu1_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu2: cpu@2 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <2>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + cpu2_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu3: cpu@3 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <3>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + cpu3_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + cpu4: cpu@4 { + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; + d-cache-block-size =3D <64>; + d-cache-sets =3D <64>; + d-cache-size =3D <32768>; + d-tlb-sets =3D <1>; + d-tlb-size =3D <32>; + device_type =3D "cpu"; + i-cache-block-size =3D <64>; + i-cache-sets =3D <64>; + i-cache-size =3D <32768>; + i-tlb-sets =3D <1>; + i-tlb-size =3D <32>; + mmu-type =3D "riscv,sv39"; + reg =3D <4>; + riscv,isa =3D "rv64imafdc"; + tlb-split; + cpu4_intc: interrupt-controller { + #interrupt-cells =3D <1>; + compatible =3D "riscv,cpu-intc"; + interrupt-controller; + }; + }; + }; + soc { + #address-cells =3D <2>; + #size-cells =3D <2>; + compatible =3D "sifive,fu540-c000", "sifive,fu540", "simple-bus"; + ranges; + plic0: interrupt-controller@c000000 { + #interrupt-cells =3D <1>; + compatible =3D "sifive,plic-1.0.0"; + reg =3D <0x0 0xc000000 0x0 0x4000000>; + riscv,ndev =3D <53>; + interrupt-controller; + interrupts-extended =3D < + &cpu0_intc 0xffffffff + &cpu1_intc 0xffffffff &cpu1_intc 9 + &cpu2_intc 0xffffffff &cpu2_intc 9 + &cpu3_intc 0xffffffff &cpu3_intc 9 + &cpu4_intc 0xffffffff &cpu4_intc 9>; + }; + prci: clock-controller@10000000 { + compatible =3D "sifive,fu540-c000-prci"; + reg =3D <0x0 0x10000000 0x0 0x1000>; + clocks =3D <&hfclk>, <&rtcclk>; + #clock-cells =3D <1>; + }; + uart0: serial@10010000 { + compatible =3D "sifive,fu540-c000-uart", "sifive,uart0"; + reg =3D <0x0 0x10010000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <4>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + status =3D "disabled"; + }; + uart1: serial@10011000 { + compatible =3D "sifive,fu540-c000-uart", "sifive,uart0"; + reg =3D <0x0 0x10011000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <5>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + status =3D "disabled"; + }; + i2c0: i2c@10030000 { + compatible =3D "sifive,fu540-c000-i2c", "sifive,i2c0"; + reg =3D <0x0 0x10030000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <50>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + reg-shift =3D <2>; + reg-io-width =3D <1>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + qspi0: spi@10040000 { + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; + reg =3D <0x0 0x10040000 0x0 0x1000 + 0x0 0x20000000 0x0 0x10000000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <51>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + qspi1: spi@10041000 { + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; + reg =3D <0x0 0x10041000 0x0 0x1000 + 0x0 0x30000000 0x0 0x10000000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <52>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + qspi2: spi@10050000 { + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; + reg =3D <0x0 0x10050000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <6>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + eth0: ethernet@10090000 { + compatible =3D "sifive,fu540-c000-gem"; + interrupt-parent =3D <&plic0>; + interrupts =3D <53>; + reg =3D <0x0 0x10090000 0x0 0x2000 + 0x0 0x100a0000 0x0 0x1000>; + local-mac-address =3D [00 00 00 00 00 00]; + clock-names =3D "pclk", "hclk"; + clocks =3D <&prci PRCI_CLK_GEMGXLPLL>, + <&prci PRCI_CLK_GEMGXLPLL>; + #address-cells =3D <1>; + #size-cells =3D <0>; + status =3D "disabled"; + }; + pwm0: pwm@10020000 { + compatible =3D "sifive,fu540-c000-pwm", "sifive,pwm0"; + reg =3D <0x0 0x10020000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <42 43 44 45>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #pwm-cells =3D <3>; + status =3D "disabled"; + }; + pwm1: pwm@10021000 { + compatible =3D "sifive,fu540-c000-pwm", "sifive,pwm0"; + reg =3D <0x0 0x10021000 0x0 0x1000>; + interrupt-parent =3D <&plic0>; + interrupts =3D <46 47 48 49>; + clocks =3D <&prci PRCI_CLK_TLCLK>; + #pwm-cells =3D <3>; + status =3D "disabled"; + }; + + }; +}; =20 Copied: head/riscv/sifive/hifive-unleashed-a00.dts (from r355185, vendo= r/device-tree/dist/src/riscv/sifive/hifive-unleashed-a00.dts) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/riscv/sifive/hifive-unleashed-a00.dts Thu Nov 28 19:38:57 2019= (r355188, copy of r355185, vendor/device-tree/dist/src/riscv/sifive/hifive-= unleashed-a00.dts) @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* Copyright (c) 2018-2019 SiFive, Inc */ + +#include "fu540-c000.dtsi" + +/* Clock frequency (in Hz) of the PCB crystal for rtcclk */ +#define RTCCLK_FREQ 1000000 + +/ { + #address-cells =3D <2>; + #size-cells =3D <2>; + model =3D "SiFive HiFive Unleashed A00"; + compatible =3D "sifive,hifive-unleashed-a00", "sifive,fu540-c000"; + + chosen { + stdout-path =3D "serial0"; + }; + + cpus { + timebase-frequency =3D ; + }; + + memory@80000000 { + device_type =3D "memory"; + reg =3D <0x0 0x80000000 0x2 0x00000000>; + }; + + soc { + }; + + hfclk: hfclk { + #clock-cells =3D <0>; + compatible =3D "fixed-clock"; + clock-frequency =3D <33333333>; + clock-output-names =3D "hfclk"; + }; + + rtcclk: rtcclk { + #clock-cells =3D <0>; + compatible =3D "fixed-clock"; + clock-frequency =3D ; + clock-output-names =3D "rtcclk"; + }; +}; + +&uart0 { + status =3D "okay"; +}; + +&uart1 { + status =3D "okay"; +}; + +&i2c0 { + status =3D "okay"; +}; + +&qspi0 { + status =3D "okay"; + flash@0 { + compatible =3D "issi,is25wp256", "jedec,spi-nor"; + reg =3D <0>; + spi-max-frequency =3D <50000000>; + m25p,fast-read; + spi-tx-bus-width =3D <4>; + spi-rx-bus-width =3D <4>; + }; +}; + +&qspi2 { + status =3D "okay"; + mmc@0 { + compatible =3D "mmc-spi-slot"; + reg =3D <0>; + spi-max-frequency =3D <20000000>; + voltage-ranges =3D <3300 3300>; + disable-wp; + }; +}; + +ð0 { + status =3D "okay"; + phy-mode =3D "gmii"; + phy-handle =3D <&phy0>; + phy0: ethernet-phy@0 { + reg =3D <0>; + }; +}; + +&pwm0 { + status =3D "okay"; +}; + +&pwm1 { + status =3D "okay"; +}; =20 From owner-svn-src-all@freebsd.org Mon Dec 2 22:15:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C1961BA3EB; Mon, 2 Dec 2019 22:15:27 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RfZ7224dz4TD9; Mon, 2 Dec 2019 22:15:27 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2960B5E17; Mon, 2 Dec 2019 22:15:27 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2MFRBg027987; Mon, 2 Dec 2019 22:15:27 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2MFR7h027986; Mon, 2 Dec 2019 22:15:27 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912022215.xB2MFR7h027986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Mon, 2 Dec 2019 22:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r355310 - svnadmin/conf X-SVN-Group: svnadmin X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: svnadmin/conf X-SVN-Commit-Revision: 355310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:15:27 -0000 Author: scottl Date: Mon Dec 2 22:15:26 2019 New Revision: 355310 URL: https://svnweb.freebsd.org/changeset/base/355310 Log: I took over mentorship of Scott Philips a while ago, update the mentors file appropriately. Modified: svnadmin/conf/mentors Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Mon Dec 2 21:09:57 2019 (r355309) +++ svnadmin/conf/mentors Mon Dec 2 22:15:26 2019 (r355310) @@ -23,7 +23,7 @@ mahrens mckusick miwi araujo mjoras rstone ram ken Co-mentor: mav -scottph jhb Co-mentor: emaste +scottph scottl Co-mentor: emaste, jhb thj jtl Co-mentor: bz tmunro mjg Co-mentor: allanjude wosch cem From owner-svn-src-all@freebsd.org Mon Dec 2 22:34:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADBA61BAA95; Mon, 2 Dec 2019 22:34:19 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rfzv49R2z4V26; Mon, 2 Dec 2019 22:34:19 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7270D618C; Mon, 2 Dec 2019 22:34:19 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2MYJ8q039439; Mon, 2 Dec 2019 22:34:19 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2MYJrQ039438; Mon, 2 Dec 2019 22:34:19 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912022234.xB2MYJrQ039438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 2 Dec 2019 22:34:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355311 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 355311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:34:19 -0000 Author: jeff Date: Mon Dec 2 22:34:19 2019 New Revision: 355311 URL: https://svnweb.freebsd.org/changeset/base/355311 Log: Don't run sched_preempt() inside of an extra critical section. This disables the sched_preempt() switch optimization and causes the sched lock to be dropped and immediately reacquired. Reviewed by: jhb, kib, mav, markj (with changes) Differential Revision: https://reviews.freebsd.org/D22623 Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Mon Dec 2 22:15:26 2019 (r355310) +++ head/sys/x86/x86/mp_x86.c Mon Dec 2 22:34:19 2019 (r355311) @@ -1261,18 +1261,11 @@ ipi_bitmap_handler(struct trapframe frame) int cpu = PCPU_GET(cpuid); u_int ipi_bitmap; - critical_enter(); td = curthread; td->td_intr_nesting_level++; oldframe = td->td_intr_frame; td->td_intr_frame = &frame; ipi_bitmap = atomic_readandclear_int(&cpuid_to_pcpu[cpu]->pc_ipi_bitmap); - if (ipi_bitmap & (1 << IPI_PREEMPT)) { -#ifdef COUNT_IPIS - (*ipi_preempt_counts[cpu])++; -#endif - sched_preempt(td); - } if (ipi_bitmap & (1 << IPI_AST)) { #ifdef COUNT_IPIS (*ipi_ast_counts[cpu])++; @@ -1280,14 +1273,23 @@ ipi_bitmap_handler(struct trapframe frame) /* Nothing to do for AST */ } if (ipi_bitmap & (1 << IPI_HARDCLOCK)) { + critical_enter(); #ifdef COUNT_IPIS (*ipi_hardclock_counts[cpu])++; #endif hardclockintr(); + critical_exit(); } + + /* Run preempt after clock handlers since it may switch. */ + if (ipi_bitmap & (1 << IPI_PREEMPT)) { +#ifdef COUNT_IPIS + (*ipi_preempt_counts[cpu])++; +#endif + sched_preempt(td); + } td->td_intr_frame = oldframe; td->td_intr_nesting_level--; - critical_exit(); } /* From owner-svn-src-all@freebsd.org Mon Dec 2 22:35:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 484111BAB6F; Mon, 2 Dec 2019 22:35:46 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rg1Z1FNjz4VBg; Mon, 2 Dec 2019 22:35:46 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D7856196; Mon, 2 Dec 2019 22:35:46 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2MZjF8039554; Mon, 2 Dec 2019 22:35:45 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2MZjAB039553; Mon, 2 Dec 2019 22:35:45 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912022235.xB2MZjAB039553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 2 Dec 2019 22:35:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355312 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:35:46 -0000 Author: jeff Date: Mon Dec 2 22:35:45 2019 New Revision: 355312 URL: https://svnweb.freebsd.org/changeset/base/355312 Log: Initialize the idle thread's lock sooner so it's not evaluated on every fork exit and we can rely on it elsewhere. Reviewed by: mav, kib, jhb, markj Differential Revision: https://reviews.freebsd.org/D22624 Modified: head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Mon Dec 2 22:34:19 2019 (r355311) +++ head/sys/kern/sched_ule.c Mon Dec 2 22:35:45 2019 (r355312) @@ -1463,7 +1463,7 @@ sched_setup(void *dummy) /* Add thread0's load since it's running. */ TDQ_LOCK(tdq); - thread0.td_lock = TDQ_LOCKPTR(TDQ_SELF()); + thread0.td_lock = TDQ_LOCKPTR(tdq); tdq_load_add(tdq, &thread0); tdq->tdq_lowpri = thread0.td_priority; TDQ_UNLOCK(tdq); @@ -2913,6 +2913,7 @@ sched_throw(struct thread *td) spinlock_exit(); PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); + PCPU_GET(idlethread)->td_lock = TDQ_LOCKPTR(tdq); } else { tdq = TDQ_SELF(); MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); @@ -2943,8 +2944,6 @@ sched_fork_exit(struct thread *td) */ cpuid = PCPU_GET(cpuid); tdq = TDQ_SELF(); - if (TD_IS_IDLETHREAD(td)) - td->td_lock = TDQ_LOCKPTR(tdq); MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); td->td_oncpu = cpuid; TDQ_LOCK_ASSERT(tdq, MA_OWNED | MA_NOTRECURSED); From owner-svn-src-all@freebsd.org Mon Dec 2 22:38:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 961821BACDE; Mon, 2 Dec 2019 22:38:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rg4f3Rybz4VLZ; Mon, 2 Dec 2019 22:38:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 559A1619E; Mon, 2 Dec 2019 22:38:26 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2McQsS039709; Mon, 2 Dec 2019 22:38:26 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2McPue039706; Mon, 2 Dec 2019 22:38:25 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912022238.xB2McPue039706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 2 Dec 2019 22:38:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355313 - in head/sys: compat/cloudabi compat/linux kern X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: compat/cloudabi compat/linux kern X-SVN-Commit-Revision: 355313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:38:26 -0000 Author: jeff Date: Mon Dec 2 22:38:25 2019 New Revision: 355313 URL: https://svnweb.freebsd.org/changeset/base/355313 Log: Fix the last few cases that grab without busy or valid. The grab functions must return the page in some held state for consistency elsewhere. Reviewed by: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D22610 Modified: head/sys/compat/cloudabi/cloudabi_vdso.c head/sys/compat/linux/linux_vdso.c head/sys/kern/kern_sharedpage.c Modified: head/sys/compat/cloudabi/cloudabi_vdso.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_vdso.c Mon Dec 2 22:35:45 2019 (r355312) +++ head/sys/compat/cloudabi/cloudabi_vdso.c Mon Dec 2 22:38:25 2019 (r355313) @@ -59,9 +59,10 @@ cloudabi_vdso_init(struct sysentvec *sv, char *begin, addr = kva_alloc(PAGE_SIZE); for (i = 0; i < pages; ++i) { VM_OBJECT_WLOCK(obj); - m = vm_page_grab(obj, i, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; + m = vm_page_grab(obj, i, VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(obj); + vm_page_valid(m); + vm_page_xunbusy(m); pmap_qenter(addr, &m, 1); memcpy((void *)addr, begin + i * PAGE_SIZE, Modified: head/sys/compat/linux/linux_vdso.c ============================================================================== --- head/sys/compat/linux/linux_vdso.c Mon Dec 2 22:35:45 2019 (r355312) +++ head/sys/compat/linux/linux_vdso.c Mon Dec 2 22:38:25 2019 (r355313) @@ -83,9 +83,10 @@ __elfN(linux_shared_page_init)(char **mapping) obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, VM_PROT_DEFAULT, 0, NULL); VM_OBJECT_WLOCK(obj); - m = vm_page_grab(obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; + m = vm_page_grab(obj, 0, VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(obj); + vm_page_valid(m); + vm_page_xunbusy(m); addr = kva_alloc(PAGE_SIZE); pmap_qenter(addr, &m, 1); *mapping = (char *)addr; Modified: head/sys/kern/kern_sharedpage.c ============================================================================== --- head/sys/kern/kern_sharedpage.c Mon Dec 2 22:35:45 2019 (r355312) +++ head/sys/kern/kern_sharedpage.c Mon Dec 2 22:38:25 2019 (r355313) @@ -114,9 +114,10 @@ shared_page_init(void *dummy __unused) shared_page_obj = vm_pager_allocate(OBJT_PHYS, 0, PAGE_SIZE, VM_PROT_DEFAULT, 0, NULL); VM_OBJECT_WLOCK(shared_page_obj); - m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_NOBUSY | VM_ALLOC_ZERO); - m->valid = VM_PAGE_BITS_ALL; + m = vm_page_grab(shared_page_obj, 0, VM_ALLOC_ZERO); VM_OBJECT_WUNLOCK(shared_page_obj); + vm_page_valid(m); + vm_page_xunbusy(m); addr = kva_alloc(PAGE_SIZE); pmap_qenter(addr, &m, 1); shared_page_mapping = (char *)addr; From owner-svn-src-all@freebsd.org Mon Dec 2 22:42:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13B3B1BB057; Mon, 2 Dec 2019 22:42:07 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rg8t6pv9z4Vnb; Mon, 2 Dec 2019 22:42:06 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B59F16357; Mon, 2 Dec 2019 22:42:06 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2Mg6YW044632; Mon, 2 Dec 2019 22:42:06 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2Mg5pU044627; Mon, 2 Dec 2019 22:42:05 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912022242.xB2Mg5pU044627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 2 Dec 2019 22:42:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355314 - in head/sys: amd64/sgx arm/nvidia/drm2 dev/md vm x86/iommu X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: amd64/sgx arm/nvidia/drm2 dev/md vm x86/iommu X-SVN-Commit-Revision: 355314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:42:07 -0000 Author: jeff Date: Mon Dec 2 22:42:05 2019 New Revision: 355314 URL: https://svnweb.freebsd.org/changeset/base/355314 Log: Fix a few places that free a page from an object without busy held. This is tightening constraints on busy as a precursor to lockless page lookup and should largely be a NOP for these cases. Reviewed by: alc, kib, markj Differential Revision: https://reviews.freebsd.org/D22611 Modified: head/sys/amd64/sgx/sgx.c head/sys/arm/nvidia/drm2/tegra_bo.c head/sys/dev/md/md.c head/sys/vm/vm_glue.c head/sys/x86/iommu/intel_utils.c Modified: head/sys/amd64/sgx/sgx.c ============================================================================== --- head/sys/amd64/sgx/sgx.c Mon Dec 2 22:38:25 2019 (r355313) +++ head/sys/amd64/sgx/sgx.c Mon Dec 2 22:42:05 2019 (r355314) @@ -389,14 +389,16 @@ sgx_enclave_remove(struct sgx_softc *sc, * First remove all the pages except SECS, * then remove SECS page. */ - p_secs = NULL; +restart: TAILQ_FOREACH_SAFE(p, &object->memq, listq, p_next) { - if (p->pindex == SGX_SECS_VM_OBJECT_INDEX) { - p_secs = p; + if (p->pindex == SGX_SECS_VM_OBJECT_INDEX) continue; - } + if (vm_page_busy_acquire(p, VM_ALLOC_WAITFAIL) == 0) + goto restart; sgx_page_remove(sc, p); } + p_secs = vm_page_grab(object, SGX_SECS_VM_OBJECT_INDEX, + VM_ALLOC_NOCREAT); /* Now remove SECS page */ if (p_secs != NULL) sgx_page_remove(sc, p_secs); @@ -723,8 +725,9 @@ sgx_ioctl_create(struct sgx_softc *sc, struct sgx_encl if ((sc->state & SGX_STATE_RUNNING) == 0) { mtx_unlock(&sc->mtx); /* Remove VA page that was just created for SECS page. */ - p = vm_page_lookup(enclave->object, - - SGX_VA_PAGES_OFFS - SGX_SECS_VM_OBJECT_INDEX); + p = vm_page_grab(enclave->object, + - SGX_VA_PAGES_OFFS - SGX_SECS_VM_OBJECT_INDEX, + VM_ALLOC_NOCREAT); sgx_page_remove(sc, p); VM_OBJECT_WUNLOCK(object); goto error; @@ -736,8 +739,9 @@ sgx_ioctl_create(struct sgx_softc *sc, struct sgx_encl dprintf("%s: gp fault\n", __func__); mtx_unlock(&sc->mtx); /* Remove VA page that was just created for SECS page. */ - p = vm_page_lookup(enclave->object, - - SGX_VA_PAGES_OFFS - SGX_SECS_VM_OBJECT_INDEX); + p = vm_page_grab(enclave->object, + - SGX_VA_PAGES_OFFS - SGX_SECS_VM_OBJECT_INDEX, + VM_ALLOC_NOCREAT); sgx_page_remove(sc, p); VM_OBJECT_WUNLOCK(object); goto error; Modified: head/sys/arm/nvidia/drm2/tegra_bo.c ============================================================================== --- head/sys/arm/nvidia/drm2/tegra_bo.c Mon Dec 2 22:38:25 2019 (r355313) +++ head/sys/arm/nvidia/drm2/tegra_bo.c Mon Dec 2 22:42:05 2019 (r355314) @@ -64,6 +64,7 @@ tegra_bo_destruct(struct tegra_bo *bo) VM_OBJECT_WLOCK(bo->cdev_pager); for (i = 0; i < bo->npages; i++) { m = bo->m[i]; + vm_page_busy_acquire(m, 0); cdev_pager_free_page(bo->cdev_pager, m); m->flags &= ~PG_FICTITIOUS; vm_page_unwire_noq(m); Modified: head/sys/dev/md/md.c ============================================================================== --- head/sys/dev/md/md.c Mon Dec 2 22:38:25 2019 (r355313) +++ head/sys/dev/md/md.c Mon Dec 2 22:42:05 2019 (r355314) @@ -1024,14 +1024,6 @@ unmapped_step: return (error); } -static void -md_swap_page_free(vm_page_t m) -{ - - vm_page_xunbusy(m); - vm_page_free(m); -} - static int mdstart_swap(struct md_s *sc, struct bio *bp) { @@ -1080,7 +1072,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) rv = vm_pager_get_pages(sc->object, &m, 1, NULL, NULL); if (rv == VM_PAGER_ERROR) { - md_swap_page_free(m); + vm_page_free(m); break; } else if (rv == VM_PAGER_FAIL) { /* @@ -1110,7 +1102,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) rv = vm_pager_get_pages(sc->object, &m, 1, NULL, NULL); if (rv == VM_PAGER_ERROR) { - md_swap_page_free(m); + vm_page_free(m); break; } else if (rv == VM_PAGER_FAIL) pmap_zero_page(m); @@ -1137,10 +1129,10 @@ mdstart_swap(struct md_s *sc, struct bio *bp) rv = vm_pager_get_pages(sc->object, &m, 1, NULL, NULL); if (rv == VM_PAGER_ERROR) { - md_swap_page_free(m); + vm_page_free(m); break; } else if (rv == VM_PAGER_FAIL) { - md_swap_page_free(m); + vm_page_free(m); m = NULL; } else { /* Page is valid. */ @@ -1152,7 +1144,7 @@ mdstart_swap(struct md_s *sc, struct bio *bp) } } else { vm_pager_page_unswapped(m); - md_swap_page_free(m); + vm_page_free(m); m = NULL; } } Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Mon Dec 2 22:38:25 2019 (r355313) +++ head/sys/vm/vm_glue.c Mon Dec 2 22:42:05 2019 (r355314) @@ -363,6 +363,7 @@ vm_thread_stack_dispose(vm_object_t ksobj, vm_offset_t m = vm_page_lookup(ksobj, i); if (m == NULL) panic("%s: kstack already missing?", __func__); + vm_page_busy_acquire(m, 0); vm_page_unwire_noq(m); vm_page_free(m); } Modified: head/sys/x86/iommu/intel_utils.c ============================================================================== --- head/sys/x86/iommu/intel_utils.c Mon Dec 2 22:38:25 2019 (r355313) +++ head/sys/x86/iommu/intel_utils.c Mon Dec 2 22:42:05 2019 (r355314) @@ -298,7 +298,7 @@ dmar_pgfree(vm_object_t obj, vm_pindex_t idx, int flag if ((flags & DMAR_PGF_OBJL) == 0) VM_OBJECT_WLOCK(obj); - m = vm_page_lookup(obj, idx); + m = vm_page_grab(obj, idx, VM_ALLOC_NOCREAT); if (m != NULL) { vm_page_free(m); atomic_subtract_int(&dmar_tbl_pagecnt, 1); From owner-svn-src-all@freebsd.org Mon Dec 2 22:44:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 363971BB148; Mon, 2 Dec 2019 22:44:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RgCm1QB3z4VyR; Mon, 2 Dec 2019 22:44:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 13ACA6387; Mon, 2 Dec 2019 22:44:36 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB2MiZTN045508; Mon, 2 Dec 2019 22:44:35 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB2MiYDH045503; Mon, 2 Dec 2019 22:44:34 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201912022244.xB2MiYDH045503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 2 Dec 2019 22:44:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355315 - in head/sys: kern sys vm X-SVN-Group: head X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: in head/sys: kern sys vm X-SVN-Commit-Revision: 355315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2019 22:44:36 -0000 Author: jeff Date: Mon Dec 2 22:44:34 2019 New Revision: 355315 URL: https://svnweb.freebsd.org/changeset/base/355315 Log: Use a precise bit count for the slab free items in UMA. This significantly shrinks embedded slab structures. Reviewed by: markj, rlibby (prior version) Differential Revision: https://reviews.freebsd.org/D22584 Modified: head/sys/kern/subr_vmem.c head/sys/sys/bitset.h head/sys/vm/uma_core.c head/sys/vm/uma_int.h head/sys/vm/vm_page.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Mon Dec 2 22:42:05 2019 (r355314) +++ head/sys/kern/subr_vmem.c Mon Dec 2 22:44:34 2019 (r355315) @@ -670,8 +670,8 @@ int vmem_startup_count(void) { - return (howmany(BT_MAXALLOC, - UMA_SLAB_SPACE / sizeof(struct vmem_btag))); + return (howmany(BT_MAXALLOC, slab_ipers(sizeof(struct vmem_btag), + UMA_ALIGN_PTR))); } #endif Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Mon Dec 2 22:42:05 2019 (r355314) +++ head/sys/sys/bitset.h Mon Dec 2 22:44:34 2019 (r355315) @@ -246,10 +246,11 @@ #define BITSET_FSET(n) \ [ 0 ... ((n) - 1) ] = (-1L) +#define BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long)) + /* * Dynamically allocate a bitset. */ -#define BITSET_ALLOC(_s, mt, mf) \ - malloc(__bitset_words(_s) * sizeof(long), mt, (mf)) +#define BITSET_ALLOC(_s, mt, mf) malloc(BITSET_SIZE((_s)), mt, (mf)) #endif /* !_SYS_BITSET_H_ */ Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon Dec 2 22:42:05 2019 (r355314) +++ head/sys/vm/uma_core.c Mon Dec 2 22:44:34 2019 (r355315) @@ -1200,9 +1200,9 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom slab->us_freecount = keg->uk_ipers; slab->us_flags = sflags; slab->us_domain = domain; - BIT_FILL(SLAB_SETSIZE, &slab->us_free); + BIT_FILL(keg->uk_ipers, &slab->us_free); #ifdef INVARIANTS - BIT_ZERO(SLAB_SETSIZE, &slab->us_debugfree); + BIT_ZERO(SLAB_MAX_SETSIZE, &slab->us_debugfree); #endif if (keg->uk_init != NULL) { @@ -1486,6 +1486,46 @@ zero_init(void *mem, int size, int flags) } /* + * Actual size of embedded struct slab (!OFFPAGE). + */ +size_t +slab_sizeof(int nitems) +{ + size_t s; + + s = sizeof(struct uma_slab) + BITSET_SIZE(nitems); + return (roundup(s, UMA_ALIGN_PTR + 1)); +} + +/* + * Size of memory for embedded slabs (!OFFPAGE). + */ +size_t +slab_space(int nitems) +{ + return (UMA_SLAB_SIZE - slab_sizeof(nitems)); +} + +/* + * Compute the number of items that will fit in an embedded (!OFFPAGE) slab + * with a given size and alignment. + */ +int +slab_ipers(size_t size, int align) +{ + int rsize; + int nitems; + + /* + * Compute the ideal number of items that will fit in a page and + * then compute the actual number based on a bitset nitems wide. + */ + rsize = roundup(size, align + 1); + nitems = UMA_SLAB_SIZE / rsize; + return (slab_space(nitems) / rsize); +} + +/* * Finish creating a small uma keg. This calculates ipers, and the keg size. * * Arguments @@ -1519,20 +1559,25 @@ keg_small_init(uma_keg_t keg) * allocation bits for we round it up. */ rsize = keg->uk_size; - if (rsize < slabsize / SLAB_SETSIZE) - rsize = slabsize / SLAB_SETSIZE; + if (rsize < slabsize / SLAB_MAX_SETSIZE) + rsize = slabsize / SLAB_MAX_SETSIZE; if (rsize & keg->uk_align) - rsize = (rsize & ~keg->uk_align) + (keg->uk_align + 1); + rsize = roundup(rsize, keg->uk_align + 1); keg->uk_rsize = rsize; KASSERT((keg->uk_flags & UMA_ZONE_PCPU) == 0 || keg->uk_rsize < UMA_PCPU_ALLOC_SIZE, ("%s: size %u too large", __func__, keg->uk_rsize)); + /* + * Use a pessimistic bit count for shsize. It may be possible to + * squeeze one more item in for very particular sizes if we were + * to loop and reduce the bitsize if there is waste. + */ if (keg->uk_flags & UMA_ZONE_OFFPAGE) shsize = 0; else - shsize = SIZEOF_UMA_SLAB; + shsize = slab_sizeof(slabsize / rsize); if (rsize <= slabsize - shsize) keg->uk_ipers = (slabsize - shsize) / rsize; @@ -1543,7 +1588,7 @@ keg_small_init(uma_keg_t keg) ("%s: size %u greater than slab", __func__, keg->uk_size)); keg->uk_ipers = 1; } - KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= SLAB_SETSIZE, + KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= SLAB_MAX_SETSIZE, ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers)); memused = keg->uk_ipers * rsize + shsize; @@ -1571,7 +1616,7 @@ keg_small_init(uma_keg_t keg) if ((wastedspace >= slabsize / UMA_MAX_WASTE) && (keg->uk_ipers < (slabsize / keg->uk_rsize))) { keg->uk_ipers = slabsize / keg->uk_rsize; - KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= SLAB_SETSIZE, + KASSERT(keg->uk_ipers > 0 && keg->uk_ipers <= SLAB_MAX_SETSIZE, ("%s: keg->uk_ipers %u", __func__, keg->uk_ipers)); CTR6(KTR_UMA, "UMA decided we need offpage slab headers for " "keg: %s(%p), calculated wastedspace = %d, " @@ -1620,7 +1665,8 @@ keg_large_init(uma_keg_t keg) /* Check whether we have enough space to not do OFFPAGE. */ if ((keg->uk_flags & UMA_ZONE_OFFPAGE) == 0 && - PAGE_SIZE * keg->uk_ppera - keg->uk_rsize < SIZEOF_UMA_SLAB) { + PAGE_SIZE * keg->uk_ppera - keg->uk_rsize < + slab_sizeof(SLAB_MIN_SETSIZE)) { /* * We can't do OFFPAGE if we're internal, in which case * we need an extra page per allocation to contain the @@ -1667,7 +1713,7 @@ keg_cachespread_init(uma_keg_t keg) keg->uk_ppera = pages; keg->uk_ipers = ((pages * PAGE_SIZE) + trailer) / rsize; keg->uk_flags |= UMA_ZONE_OFFPAGE | UMA_ZONE_VTOSLAB; - KASSERT(keg->uk_ipers <= SLAB_SETSIZE, + KASSERT(keg->uk_ipers <= SLAB_MAX_SETSIZE, ("%s: keg->uk_ipers too high(%d) increase max_ipers", __func__, keg->uk_ipers)); } @@ -1730,7 +1776,7 @@ keg_ctor(void *mem, int size, void *udata, int flags) if (keg->uk_flags & UMA_ZONE_CACHESPREAD) { keg_cachespread_init(keg); } else { - if (keg->uk_size > UMA_SLAB_SPACE) + if (keg->uk_size > slab_space(SLAB_MIN_SETSIZE)) keg_large_init(keg); else keg_small_init(keg); @@ -1770,11 +1816,14 @@ keg_ctor(void *mem, int size, void *udata, int flags) /* * If we're putting the slab header in the actual page we need to - * figure out where in each page it goes. See SIZEOF_UMA_SLAB - * macro definition. + * figure out where in each page it goes. See slab_sizeof + * definition. */ if (!(keg->uk_flags & UMA_ZONE_OFFPAGE)) { - keg->uk_pgoff = (PAGE_SIZE * keg->uk_ppera) - SIZEOF_UMA_SLAB; + size_t shsize; + + shsize = slab_sizeof(keg->uk_ipers); + keg->uk_pgoff = (PAGE_SIZE * keg->uk_ppera) - shsize; /* * The only way the following is possible is if with our * UMA_ALIGN_PTR adjustments we are now bigger than @@ -1782,8 +1831,7 @@ keg_ctor(void *mem, int size, void *udata, int flags) * mathematically possible for all cases, so we make * sure here anyway. */ - KASSERT(keg->uk_pgoff + sizeof(struct uma_slab) <= - PAGE_SIZE * keg->uk_ppera, + KASSERT(keg->uk_pgoff + shsize <= PAGE_SIZE * keg->uk_ppera, ("zone %s ipers %d rsize %d size %d slab won't fit", zone->uz_name, keg->uk_ipers, keg->uk_rsize, keg->uk_size)); } @@ -2245,6 +2293,7 @@ int uma_startup_count(int vm_zones) { int zones, pages; + size_t space, size; ksize = sizeof(struct uma_keg) + (sizeof(struct uma_domain) * vm_ndomains); @@ -2265,39 +2314,29 @@ uma_startup_count(int vm_zones) zones = UMA_BOOT_ZONES + vm_zones; vm_zones = 0; #endif + size = slab_sizeof(SLAB_MAX_SETSIZE); + space = slab_space(SLAB_MAX_SETSIZE); /* Memory for the rest of startup zones, UMA and VM, ... */ - if (zsize > UMA_SLAB_SPACE) { + if (zsize > space) { /* See keg_large_init(). */ u_int ppera; ppera = howmany(roundup2(zsize, UMA_BOOT_ALIGN), PAGE_SIZE); - if (PAGE_SIZE * ppera - roundup2(zsize, UMA_BOOT_ALIGN) < - SIZEOF_UMA_SLAB) + if (PAGE_SIZE * ppera - roundup2(zsize, UMA_BOOT_ALIGN) < size) ppera++; pages += (zones + vm_zones) * ppera; - } else if (roundup2(zsize, UMA_BOOT_ALIGN) > UMA_SLAB_SPACE) + } else if (roundup2(zsize, UMA_BOOT_ALIGN) > space) /* See keg_small_init() special case for uk_ppera = 1. */ pages += zones; else pages += howmany(zones, - UMA_SLAB_SPACE / roundup2(zsize, UMA_BOOT_ALIGN)); + space / roundup2(zsize, UMA_BOOT_ALIGN)); /* ... and their kegs. Note that zone of zones allocates a keg! */ pages += howmany(zones + 1, - UMA_SLAB_SPACE / roundup2(ksize, UMA_BOOT_ALIGN)); + space / roundup2(ksize, UMA_BOOT_ALIGN)); - /* - * Most of startup zones are not going to be offpages, that's - * why we use UMA_SLAB_SPACE instead of UMA_SLAB_SIZE in all - * calculations. Some large bucket zones will be offpage, and - * thus will allocate hashes. We take conservative approach - * and assume that all zones may allocate hash. This may give - * us some positive inaccuracy, usually an extra single page. - */ - pages += howmany(zones, UMA_SLAB_SPACE / - (sizeof(struct slabhead *) * UMA_HASH_SIZE_INIT)); - return (pages); } @@ -2355,7 +2394,7 @@ uma_startup(void *mem, int npages) /* Now make a zone for slab headers */ slabzone = uma_zcreate("UMA Slabs", - sizeof(struct uma_slab), + slab_sizeof(SLAB_MAX_SETSIZE), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZFLAG_INTERNAL); @@ -3056,8 +3095,8 @@ slab_alloc_item(uma_keg_t keg, uma_slab_t slab) KEG_LOCK_ASSERT(keg); - freei = BIT_FFS(SLAB_SETSIZE, &slab->us_free) - 1; - BIT_CLR(SLAB_SETSIZE, freei, &slab->us_free); + freei = BIT_FFS(keg->uk_ipers, &slab->us_free) - 1; + BIT_CLR(keg->uk_ipers, freei, &slab->us_free); item = slab->us_data + (keg->uk_rsize * freei); slab->us_freecount--; keg->uk_free--; @@ -3569,7 +3608,7 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void /* Slab management. */ freei = ((uintptr_t)item - (uintptr_t)slab->us_data) / keg->uk_rsize; - BIT_SET(SLAB_SETSIZE, freei, &slab->us_free); + BIT_SET(keg->uk_ipers, freei, &slab->us_free); slab->us_freecount++; /* Keg statistics. */ @@ -4450,10 +4489,10 @@ uma_dbg_alloc(uma_zone_t zone, uma_slab_t slab, void * keg = zone->uz_keg; freei = ((uintptr_t)item - (uintptr_t)slab->us_data) / keg->uk_rsize; - if (BIT_ISSET(SLAB_SETSIZE, freei, &slab->us_debugfree)) + if (BIT_ISSET(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree)) panic("Duplicate alloc of %p from zone %p(%s) slab %p(%d)\n", item, zone, zone->uz_name, slab, freei); - BIT_SET_ATOMIC(SLAB_SETSIZE, freei, &slab->us_debugfree); + BIT_SET_ATOMIC(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree); return; } @@ -4486,11 +4525,11 @@ uma_dbg_free(uma_zone_t zone, uma_slab_t slab, void *i panic("Unaligned free of %p from zone %p(%s) slab %p(%d)\n", item, zone, zone->uz_name, slab, freei); - if (!BIT_ISSET(SLAB_SETSIZE, freei, &slab->us_debugfree)) + if (!BIT_ISSET(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree)) panic("Duplicate free of %p from zone %p(%s) slab %p(%d)\n", item, zone, zone->uz_name, slab, freei); - BIT_CLR_ATOMIC(SLAB_SETSIZE, freei, &slab->us_debugfree); + BIT_CLR_ATOMIC(SLAB_MAX_SETSIZE, freei, &slab->us_debugfree); } #endif /* INVARIANTS */ Modified: head/sys/vm/uma_int.h ============================================================================== --- head/sys/vm/uma_int.h Mon Dec 2 22:42:05 2019 (r355314) +++ head/sys/vm/uma_int.h Mon Dec 2 22:44:34 2019 (r355315) @@ -140,19 +140,6 @@ #define UMA_MAX_WASTE 10 /* - * Actual size of uma_slab when it is placed at an end of a page - * with pointer sized alignment requirement. - */ -#define SIZEOF_UMA_SLAB ((sizeof(struct uma_slab) & UMA_ALIGN_PTR) ? \ - (sizeof(struct uma_slab) & ~UMA_ALIGN_PTR) + \ - (UMA_ALIGN_PTR + 1) : sizeof(struct uma_slab)) - -/* - * Size of memory in a not offpage single page slab available for actual items. - */ -#define UMA_SLAB_SPACE (PAGE_SIZE - SIZEOF_UMA_SLAB) - -/* * I doubt there will be many cases where this is exceeded. This is the initial * size of the hash table for uma_slabs that are managed off page. This hash * does expand by powers of two. Currently it doesn't get smaller. @@ -273,8 +260,10 @@ typedef struct uma_keg * uma_keg_t; /* * Free bits per-slab. */ -#define SLAB_SETSIZE (PAGE_SIZE / UMA_SMALLEST_UNIT) -BITSET_DEFINE(slabbits, SLAB_SETSIZE); +#define SLAB_MAX_SETSIZE (PAGE_SIZE / UMA_SMALLEST_UNIT) +#define SLAB_MIN_SETSIZE _BITSET_BITS +BITSET_DEFINE(slabbits, SLAB_MAX_SETSIZE); +BITSET_DEFINE(noslabbits, 0); /* * The slab structure manages a single contiguous allocation from backing @@ -284,13 +273,13 @@ struct uma_slab { LIST_ENTRY(uma_slab) us_link; /* slabs in zone */ SLIST_ENTRY(uma_slab) us_hlink; /* Link for hash table */ uint8_t *us_data; /* First item */ - struct slabbits us_free; /* Free bitmask. */ -#ifdef INVARIANTS - struct slabbits us_debugfree; /* Debug bitmask. */ -#endif uint16_t us_freecount; /* How many are free? */ uint8_t us_flags; /* Page flags see uma.h */ uint8_t us_domain; /* Backing NUMA domain. */ +#ifdef INVARIANTS + struct slabbits us_debugfree; /* Debug bitmask. */ +#endif + struct noslabbits us_free; /* Free bitmask. */ }; #if MAXMEMDOM >= 255 @@ -298,6 +287,11 @@ struct uma_slab { #endif typedef struct uma_slab * uma_slab_t; + +/* These three functions are for embedded (!OFFPAGE) use only. */ +size_t slab_sizeof(int nitems); +size_t slab_space(int nitems); +int slab_ipers(size_t size, int align); TAILQ_HEAD(uma_bucketlist, uma_bucket); Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Mon Dec 2 22:42:05 2019 (r355314) +++ head/sys/vm/vm_page.c Mon Dec 2 22:44:34 2019 (r355315) @@ -600,7 +600,7 @@ vm_page_startup(vm_offset_t vaddr) boot_pages += vmem_startup_count(); /* vm_map_startup() calls uma_prealloc(). */ boot_pages += howmany(MAX_KMAP, - UMA_SLAB_SPACE / sizeof(struct vm_map)); + slab_ipers(sizeof(struct vm_map), UMA_ALIGN_PTR)); /* * Before going fully functional kmem_init() does allocation From owner-svn-src-all@freebsd.org Tue Dec 3 00:49:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D2E31BDE58 for ; Tue, 3 Dec 2019 00:49:11 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47RjzV5rL3z4c07 for ; Tue, 3 Dec 2019 00:49:10 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575334149; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=dTJ1kUAQfbTcPzkRyfptJ5MCEI0zJSmCgfnrhHtKQrrpyZqeCFXTkKC77zVVSBDQlMxSNELHnpO6D P/D4Kv5gJ+zYWq47fkge8v8o7FKz6iuH7S33MN4zYnf2Xjif2lqy6FWdXwOc2RCjJuRXjHeryFDMwv ZeR3U5xAIPGXhbnY2JwGsGceZQFrC2a8SHVIgRm+lOsC29XXP/LeUejcXPIU2GGNbAzh6rHe2El8/4 i+FO1JzcWip1TQXf99H6o6g6N6N7BR7ENP9qcFPimjfQeHKjNKxwTmZTFtVtNlBUFDCyshckKhvRKf 9B5jHggXsnDngsCMglwqRDvAVh86qnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=DJJFzSO60gsDdB+Wb0xTyLgzHNPqAL/IEzS0R3qNKYU=; b=Q1rOQWKW0UUYetEypj0GWhDytvy+M9LyaUZXNQqi9T2nO/ZhYT8e+AHBF4ehAShMMEAuNNXrDGu5F Tt7dpeKvD5bKGuh2s4ilpWyAlxKGAN7BVllrpI+roy+vV7UAsRd4JFrVuzX8ZROdMcuvXR4OTg7wPC VhofQxXtw8+elFwk31ewg5rnXFWoHceNpcpug9pHZf0NQ+hOf1/+DMn+NX4jEVoWYBqWX+InyBypHa RAF5Xlj2QPLZ6OuWzzAZ9aXahGAfiyM9elimhgl162PW3tTEIIYXsRb1T77NzuH37oNOBqnD1HEk3E 7nsL7bzbjDYn1U5kw/AtLL1U9MBCQhQ== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=DJJFzSO60gsDdB+Wb0xTyLgzHNPqAL/IEzS0R3qNKYU=; b=PwfuEpKO1Mf9NQC1vv1quE4RObM020ZlSC9Is+Syf4olC2rBM+DtfHrhnx+gE6eotMPmbciAe11zP gVgOz75GItnRvnfhYEGkHXSRzT0FOR+xk0m8m4a7DBNVglTAJHhXR6r+NL9eROlDKKipR3zPE3Vam2 vbHfjj82KQJiRT1UeHfjP8saOQzWVhdPxZqRz8noMB0L9tUo/ENUuoC7kC+oOB7B9/Lu8E4TkQgBIh FmsYZR/IXSh3nSBaRwjQTX1kYVNNQ9CIk3TUYnOouoMkxFfX6vlN6g7I6pbL5do8WZ5/PJcBhV1t4M N3gmS9uxznpaqQpOza5jXsEre0MbDwA== X-MHO-RoutePath: aGlwcGll X-MHO-User: b5ceefa7-1566-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id b5ceefa7-1566-11ea-829e-79a40d15cccd; Tue, 03 Dec 2019 00:49:08 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB30n6DB097695; Mon, 2 Dec 2019 17:49:06 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <7783d9967146e4293c27b42f0b65882364e3c1da.camel@freebsd.org> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve From: Ian Lepore To: Vincenzo Maffione Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 02 Dec 2019 17:49:06 -0700 In-Reply-To: References: <201912022051.xB2Kplot078056@repo.freebsd.org> <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47RjzV5rL3z4c07 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.88 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-0.93)[-0.927,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 00:49:11 -0000 On Mon, 2019-12-02 at 22:35 +0100, Vincenzo Maffione wrote: > Il giorno lun 2 dic 2019 alle ore 22:14 Ian Lepore > ha > scritto: > > > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > > Author: vmaffione > > > Date: Mon Dec 2 20:51:46 2019 > > > New Revision: 355301 > > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > > > Log: > > > bhyve: uniform printf format string newlines > > > > > > Some of the printf statements only use LF to get a newline. > > > However, a CR character is also required for the serial console > > > to > > > print debug logs in a nice way. > > > Fix those code locations that only use LF, by adding a CR > > > character. > > > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > > MFC after: 1 week > > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > > > Modified: > > > head/usr.sbin/bhyve/audio.c > > > head/usr.sbin/bhyve/hda_codec.c > > > head/usr.sbin/bhyve/net_backends.c > > > head/usr.sbin/bhyve/pci_ahci.c > > > head/usr.sbin/bhyve/pci_e82545.c > > > head/usr.sbin/bhyve/pci_hda.c > > > head/usr.sbin/bhyve/pci_nvme.c > > > head/usr.sbin/bhyve/pci_virtio_block.c > > > head/usr.sbin/bhyve/pci_virtio_console.c > > > head/usr.sbin/bhyve/pci_virtio_net.c > > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > > head/usr.sbin/bhyve/pci_xhci.c > > > head/usr.sbin/bhyve/rfb.c > > > > > > > These changes seem wrong in a couple ways... > > > > - Lines are terminated by linefeeds in unix-like systems. If > > linefeeds need to be translated to include carriage returns, that's > > the > > responsibility of the terminal/line-discipline layer, not the > > source > > strings being printed. > > > > That's a good point. The need for carriage returns shows up when using the > vmrun.sh script on a FreeBSD host, which ends up calling /usr/bin/bhyve. > I must admit I don't know enough about the terminals and ldisc to know how > to change the current behaviour and fix this specific issue. > Any suggestions and pointer would be very welcome. > > > Thanks, > Vincenzo > In that case, I wonder if this is the right fix: Index: sys/dev/bvm/bvm_console.c =================================================================== --- sys/dev/bvm/bvm_console.c (revision 355274) +++ sys/dev/bvm/bvm_console.c (working copy) @@ -223,6 +223,10 @@ static void bvm_cnputc(struct consdev *cp, int c) { + if (c == '\n') { + bvm_wcons('\r'); + } bvm_wcons(c); } That's how other console drivers seem to handle it. -- Ian From owner-svn-src-all@freebsd.org Tue Dec 3 02:30:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 696F01C3D63; Tue, 3 Dec 2019 02:30:53 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RmDs1ZMmz3FRm; Tue, 3 Dec 2019 02:30:53 +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 18F968C66; Tue, 3 Dec 2019 02:30:53 +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 xB32UrEN077547; Tue, 3 Dec 2019 02:30:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB32Ur0l077546; Tue, 3 Dec 2019 02:30:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912030230.xB32Ur0l077546@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 02:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355316 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 355316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 02:30:53 -0000 Author: kevans Date: Tue Dec 3 02:30:52 2019 New Revision: 355316 URL: https://svnweb.freebsd.org/changeset/base/355316 Log: syscons.c: clang-format pass to reduce style inconsistencies This was purely automatically massaged... some parts are still imperfect, but this is close enough to make it more readable/easy to work on. Unfortunately the vt/syscons/kdb situation slightly complicates changes to tty locking, so some work will need to be done to remediate that. Modified: head/sys/dev/syscons/syscons.c Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Mon Dec 2 22:44:34 2019 (r355315) +++ head/sys/dev/syscons/syscons.c Tue Dec 3 02:30:52 2019 (r355316) @@ -65,13 +65,13 @@ __FBSDID("$FreeBSD$"); #include #include -#if defined(__arm__) || defined(__mips__) || \ - defined(__powerpc__) || defined(__sparc64__) +#if defined(__arm__) || defined(__mips__) || defined(__powerpc__) || \ + defined(__sparc64__) #include #else #include #endif -#if defined( __i386__) || defined(__amd64__) +#if defined(__i386__) || defined(__amd64__) #include #include #endif @@ -92,71 +92,74 @@ __FBSDID("$FreeBSD$"); #define COLD 0 #define WARM 1 -#define DEFAULT_BLANKTIME (5*60) /* 5 minutes */ -#define MAX_BLANKTIME (7*24*60*60) /* 7 days!? */ +#define DEFAULT_BLANKTIME (5 * 60) /* 5 minutes */ +#define MAX_BLANKTIME (7 * 24 * 60 * 60) /* 7 days!? */ -#define KEYCODE_BS 0x0e /* "<-- Backspace" key, XXX */ +#define KEYCODE_BS 0x0e /* "<-- Backspace" key, XXX */ /* NULL-safe version of "tty_opened()" */ -#define tty_opened_ns(tp) ((tp) != NULL && tty_opened(tp)) +#define tty_opened_ns(tp) ((tp) != NULL && tty_opened(tp)) -static u_char sc_kattrtab[MAXCPU]; +static u_char sc_kattrtab[MAXCPU]; -static int sc_console_unit = -1; -static int sc_saver_keyb_only = 1; -static scr_stat *sc_console; -static struct consdev *sc_consptr; -static void *sc_kts[MAXCPU]; -static struct sc_term_sw *sc_ktsw; -static scr_stat main_console; -static struct tty *main_devs[MAXCONS]; +static int sc_console_unit = -1; +static int sc_saver_keyb_only = 1; +static scr_stat *sc_console; +static struct consdev *sc_consptr; +static void *sc_kts[MAXCPU]; +static struct sc_term_sw *sc_ktsw; +static scr_stat main_console; +static struct tty *main_devs[MAXCONS]; -static char init_done = COLD; -static int shutdown_in_progress = FALSE; -static int suspend_in_progress = FALSE; -static char sc_malloc = FALSE; +static char init_done = COLD; +static int shutdown_in_progress = FALSE; +static int suspend_in_progress = FALSE; +static char sc_malloc = FALSE; -static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */ -static int run_scrn_saver = FALSE; /* should run the saver? */ -static int enable_bell = TRUE; /* enable beeper */ +static int saver_mode = CONS_NO_SAVER; /* LKM/user saver */ +static int run_scrn_saver = FALSE; /* should run the saver? */ +static int enable_bell = TRUE; /* enable beeper */ #ifndef SC_DISABLE_REBOOT -static int enable_reboot = TRUE; /* enable keyboard reboot */ +static int enable_reboot = TRUE; /* enable keyboard reboot */ #endif #ifndef SC_DISABLE_KDBKEY -static int enable_kdbkey = TRUE; /* enable keyboard debug */ +static int enable_kdbkey = TRUE; /* enable keyboard debug */ #endif -static long scrn_blank_time = 0; /* screen saver timeout value */ +static long scrn_blank_time = 0; /* screen saver timeout value */ #ifdef DEV_SPLASH -static int scrn_blanked; /* # of blanked screen */ -static int sticky_splash = FALSE; +static int scrn_blanked; /* # of blanked screen */ +static int sticky_splash = FALSE; -static void none_saver(sc_softc_t *sc, int blank) { } -static void (*current_saver)(sc_softc_t *, int) = none_saver; +static void +none_saver(sc_softc_t *sc, int blank) +{ +} +static void (*current_saver)(sc_softc_t *, int) = none_saver; #endif #ifdef SC_NO_SUSPEND_VTYSWITCH -static int sc_no_suspend_vtswitch = 1; +static int sc_no_suspend_vtswitch = 1; #else -static int sc_no_suspend_vtswitch = 0; +static int sc_no_suspend_vtswitch = 0; #endif -static int sc_susp_scr; +static int sc_susp_scr; static SYSCTL_NODE(_hw, OID_AUTO, syscons, CTLFLAG_RD, 0, "syscons"); static SYSCTL_NODE(_hw_syscons, OID_AUTO, saver, CTLFLAG_RD, 0, "saver"); SYSCTL_INT(_hw_syscons_saver, OID_AUTO, keybonly, CTLFLAG_RW, &sc_saver_keyb_only, 0, "screen saver interrupted by input only"); -SYSCTL_INT(_hw_syscons, OID_AUTO, bell, CTLFLAG_RW, &enable_bell, - 0, "enable bell"); +SYSCTL_INT( + _hw_syscons, OID_AUTO, bell, CTLFLAG_RW, &enable_bell, 0, "enable bell"); #ifndef SC_DISABLE_REBOOT -SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_reboot, CTLFLAG_RW|CTLFLAG_SECURE, &enable_reboot, - 0, "enable keyboard reboot"); +SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_reboot, CTLFLAG_RW | CTLFLAG_SECURE, + &enable_reboot, 0, "enable keyboard reboot"); #endif #ifndef SC_DISABLE_KDBKEY -SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW|CTLFLAG_SECURE, &enable_kdbkey, - 0, "enable keyboard debug"); +SYSCTL_INT(_hw_syscons, OID_AUTO, kbd_debug, CTLFLAG_RW | CTLFLAG_SECURE, + &enable_kdbkey, 0, "enable keyboard debug"); #endif SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswitch, CTLFLAG_RWTUN, &sc_no_suspend_vtswitch, 0, "Disable VT switch before suspend."); @@ -164,15 +167,15 @@ SYSCTL_INT(_hw_syscons, OID_AUTO, sc_no_suspend_vtswit #include "font.h" #endif - tsw_ioctl_t *sc_user_ioctl; +tsw_ioctl_t *sc_user_ioctl; -static bios_values_t bios_value; +static bios_values_t bios_value; -static int enable_panic_key; +static int enable_panic_key; SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key, - 0, "Enable panic via keypress specified in kbdmap(5)"); + 0, "Enable panic via keypress specified in kbdmap(5)"); -#define SC_CONSOLECTL 255 +#define SC_CONSOLECTL 255 #define VTY_WCHAN(sc, vty) (&SC_DEV(sc, vty)) @@ -191,8 +194,8 @@ static void scsuspend(void *); static void scresume(void *); static u_int scgetc(sc_softc_t *sc, u_int flags, struct sc_cnstate *sp); static void sc_puts(scr_stat *scp, u_char *buf, int len); -#define SCGETC_CN 1 -#define SCGETC_NONBLOCK 2 +#define SCGETC_CN 1 +#define SCGETC_NONBLOCK 2 static void sccnupdate(scr_stat *scp); static scr_stat *alloc_scp(sc_softc_t *sc, int vty); static void init_scp(sc_softc_t *sc, int vty, scr_stat *scp); @@ -205,11 +208,12 @@ static int scsplash_callback(int event, void *arg); static void scsplash_saver(sc_softc_t *sc, int show); static int add_scrn_saver(void (*this_saver)(sc_softc_t *, int)); static int remove_scrn_saver(void (*this_saver)(sc_softc_t *, int)); -static int set_scrn_saver_mode(scr_stat *scp, int mode, u_char *pal, int border); +static int set_scrn_saver_mode( + scr_stat *scp, int mode, u_char *pal, int border); static int restore_scrn_saver_mode(scr_stat *scp, int changemode); static void stop_scrn_saver(sc_softc_t *sc, void (*saver)(sc_softc_t *, int)); static int wait_scrn_saver_stop(sc_softc_t *sc); -#define scsplash_stick(stick) (sticky_splash = (stick)) +#define scsplash_stick(stick) (sticky_splash = (stick)) #else /* !DEV_SPLASH */ #define scsplash_stick(stick) #endif /* DEV_SPLASH */ @@ -231,44 +235,44 @@ static int sc_kattr(void); static timeout_t blink_screen; static struct tty *sc_alloc_tty(int, int); -static cn_probe_t sc_cnprobe; -static cn_init_t sc_cninit; -static cn_term_t sc_cnterm; -static cn_getc_t sc_cngetc; -static cn_putc_t sc_cnputc; -static cn_grab_t sc_cngrab; -static cn_ungrab_t sc_cnungrab; +static cn_probe_t sc_cnprobe; +static cn_init_t sc_cninit; +static cn_term_t sc_cnterm; +static cn_getc_t sc_cngetc; +static cn_putc_t sc_cnputc; +static cn_grab_t sc_cngrab; +static cn_ungrab_t sc_cnungrab; CONSOLE_DRIVER(sc); -static tsw_open_t sctty_open; -static tsw_close_t sctty_close; -static tsw_outwakeup_t sctty_outwakeup; -static tsw_ioctl_t sctty_ioctl; -static tsw_mmap_t sctty_mmap; +static tsw_open_t sctty_open; +static tsw_close_t sctty_close; +static tsw_outwakeup_t sctty_outwakeup; +static tsw_ioctl_t sctty_ioctl; +static tsw_mmap_t sctty_mmap; static struct ttydevsw sc_ttydevsw = { - .tsw_open = sctty_open, - .tsw_close = sctty_close, - .tsw_outwakeup = sctty_outwakeup, - .tsw_ioctl = sctty_ioctl, - .tsw_mmap = sctty_mmap, + .tsw_open = sctty_open, + .tsw_close = sctty_close, + .tsw_outwakeup = sctty_outwakeup, + .tsw_ioctl = sctty_ioctl, + .tsw_mmap = sctty_mmap, }; -static d_ioctl_t consolectl_ioctl; -static d_close_t consolectl_close; +static d_ioctl_t consolectl_ioctl; +static d_close_t consolectl_close; static struct cdevsw consolectl_devsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT | D_TRACKCLOSE, - .d_ioctl = consolectl_ioctl, - .d_close = consolectl_close, - .d_name = "consolectl", + .d_version = D_VERSION, + .d_flags = D_NEEDGIANT | D_TRACKCLOSE, + .d_ioctl = consolectl_ioctl, + .d_close = consolectl_close, + .d_name = "consolectl", }; /* ec -- emergency console. */ -static u_int ec_scroffset; +static u_int ec_scroffset; static void ec_putc(int c) @@ -309,15 +313,18 @@ ec_putc(int c) do { ind = ec_scroffset; column = ind % xsize; - width = (c == '\b' ? -1 : c == '\t' ? (column + 8) & ~7 : - c == '\r' ? -column : c == '\n' ? xsize - column : 1); + width = (c == '\b' ? + -1 : + c == '\t' ? + (column + 8) & ~7 : + c == '\r' ? -column : c == '\n' ? xsize - column : 1); if (width == 0 || (width < 0 && ind < -width)) return; } while (atomic_cmpset_rel_int(&ec_scroffset, ind, ind + width) == 0); if (c == '\b' || c == '\r') return; if (c == '\n') - ind += xsize; /* XXX clearing from new pos is not atomic */ + ind += xsize; /* XXX clearing from new pos is not atomic */ attr = sc_kattr(); if (c == '\t' || c == '\n') @@ -330,88 +337,89 @@ ec_putc(int c) int sc_probe_unit(int unit, int flags) { - if (!vty_enabled(VTY_SC)) - return ENXIO; - if (!scvidprobe(unit, flags, FALSE)) { - if (bootverbose) - printf("%s%d: no video adapter found.\n", SC_DRIVER_NAME, unit); - return ENXIO; - } + if (!vty_enabled(VTY_SC)) + return ENXIO; + if (!scvidprobe(unit, flags, FALSE)) { + if (bootverbose) + printf("%s%d: no video adapter found.\n", + SC_DRIVER_NAME, unit); + return ENXIO; + } - /* syscons will be attached even when there is no keyboard */ - sckbdprobe(unit, flags, FALSE); + /* syscons will be attached even when there is no keyboard */ + sckbdprobe(unit, flags, FALSE); - return 0; + return 0; } -/* probe video adapters, return TRUE if found */ +/* probe video adapters, return TRUE if found */ static int scvidprobe(int unit, int flags, int cons) { - /* - * Access the video adapter driver through the back door! - * Video adapter drivers need to be configured before syscons. - * However, when syscons is being probed as the low-level console, - * they have not been initialized yet. We force them to initialize - * themselves here. XXX - */ - vid_configure(cons ? VIO_PROBE_ONLY : 0); + /* + * Access the video adapter driver through the back door! + * Video adapter drivers need to be configured before syscons. + * However, when syscons is being probed as the low-level console, + * they have not been initialized yet. We force them to initialize + * themselves here. XXX + */ + vid_configure(cons ? VIO_PROBE_ONLY : 0); - return (vid_find_adapter("*", unit) >= 0); + return (vid_find_adapter("*", unit) >= 0); } /* probe the keyboard, return TRUE if found */ static int sckbdprobe(int unit, int flags, int cons) { - /* access the keyboard driver through the backdoor! */ - kbd_configure(cons ? KB_CONF_PROBE_ONLY : 0); + /* access the keyboard driver through the backdoor! */ + kbd_configure(cons ? KB_CONF_PROBE_ONLY : 0); - return (kbd_find_keyboard("*", unit) >= 0); + return (kbd_find_keyboard("*", unit) >= 0); } -static char -*adapter_name(video_adapter_t *adp) +static char * +adapter_name(video_adapter_t *adp) { - static struct { - int type; - char *name[2]; - } names[] = { - { KD_MONO, { "MDA", "MDA" } }, - { KD_HERCULES, { "Hercules", "Hercules" } }, - { KD_CGA, { "CGA", "CGA" } }, - { KD_EGA, { "EGA", "EGA (mono)" } }, - { KD_VGA, { "VGA", "VGA (mono)" } }, - { KD_TGA, { "TGA", "TGA" } }, - { -1, { "Unknown", "Unknown" } }, - }; - int i; + static struct { + int type; + char *name[2]; + } names[] = { + { KD_MONO, { "MDA", "MDA" } }, + { KD_HERCULES, { "Hercules", "Hercules" } }, + { KD_CGA, { "CGA", "CGA" } }, + { KD_EGA, { "EGA", "EGA (mono)" } }, + { KD_VGA, { "VGA", "VGA (mono)" } }, + { KD_TGA, { "TGA", "TGA" } }, + { -1, { "Unknown", "Unknown" } }, + }; + int i; - for (i = 0; names[i].type != -1; ++i) - if (names[i].type == adp->va_type) - break; - return names[i].name[(adp->va_flags & V_ADP_COLOR) ? 0 : 1]; + for (i = 0; names[i].type != -1; ++i) + if (names[i].type == adp->va_type) + break; + return names[i].name[(adp->va_flags & V_ADP_COLOR) ? 0 : 1]; } static void sctty_outwakeup(struct tty *tp) { - size_t len; - u_char buf[PCBURST]; - scr_stat *scp = sc_get_stat(tp); + size_t len; + u_char buf[PCBURST]; + scr_stat *scp = sc_get_stat(tp); - if (scp->status & SLKED || - (scp == scp->sc->cur_scp && scp->sc->blink_in_progress)) - return; + if (scp->status & SLKED || + (scp == scp->sc->cur_scp && scp->sc->blink_in_progress)) + return; - for (;;) { - len = ttydisc_getc(tp, buf, sizeof buf); - if (len == 0) - break; - SC_VIDEO_LOCK(scp->sc); - sc_puts(scp, buf, len); - SC_VIDEO_UNLOCK(scp->sc); - } + for (;;) { + len = ttydisc_getc(tp, buf, sizeof buf); + if (len == 0) + break; + SC_VIDEO_LOCK(scp->sc); + sc_puts(scp, buf, len); + SC_VIDEO_UNLOCK(scp->sc); + } } static struct tty * @@ -553,144 +561,145 @@ sc_set_vesa_mode(scr_stat *scp, sc_softc_t *sc, int un int sc_attach_unit(int unit, int flags) { - sc_softc_t *sc; - scr_stat *scp; - struct cdev *dev; - void *oldts, *ts; - int i, vc; + sc_softc_t *sc; + scr_stat *scp; + struct cdev *dev; + void *oldts, *ts; + int i, vc; - if (!vty_enabled(VTY_SC)) - return ENXIO; + if (!vty_enabled(VTY_SC)) + return ENXIO; - flags &= ~SC_KERNEL_CONSOLE; + flags &= ~SC_KERNEL_CONSOLE; - if (sc_console_unit == unit) { - /* - * If this unit is being used as the system console, we need to - * adjust some variables and buffers before and after scinit(). - */ - /* assert(sc_console != NULL) */ - flags |= SC_KERNEL_CONSOLE; - scmeminit(NULL); + if (sc_console_unit == unit) { + /* + * If this unit is being used as the system console, we need to + * adjust some variables and buffers before and after scinit(). + */ + /* assert(sc_console != NULL) */ + flags |= SC_KERNEL_CONSOLE; + scmeminit(NULL); - scinit(unit, flags); + scinit(unit, flags); - if (sc_console->tsw->te_size > 0) { - sc_ktsw = sc_console->tsw; - /* assert(sc_console->ts != NULL); */ - oldts = sc_console->ts; - for (i = 0; i <= mp_maxid; i++) { - ts = malloc(sc_console->tsw->te_size, M_DEVBUF, - M_WAITOK | M_ZERO); - (*sc_console->tsw->te_init)(sc_console, &ts, SC_TE_COLD_INIT); - sc_console->ts = ts; - (*sc_console->tsw->te_default_attr)(sc_console, sc_kattrtab[i], - SC_KERNEL_CONS_REV_ATTR); - sc_kts[i] = ts; - } - sc_console->ts = oldts; - (*sc_console->tsw->te_default_attr)(sc_console, SC_NORM_ATTR, - SC_NORM_REV_ATTR); + if (sc_console->tsw->te_size > 0) { + sc_ktsw = sc_console->tsw; + /* assert(sc_console->ts != NULL); */ + oldts = sc_console->ts; + for (i = 0; i <= mp_maxid; i++) { + ts = malloc(sc_console->tsw->te_size, M_DEVBUF, + M_WAITOK | M_ZERO); + (*sc_console->tsw->te_init)( + sc_console, &ts, SC_TE_COLD_INIT); + sc_console->ts = ts; + (*sc_console->tsw->te_default_attr)(sc_console, + sc_kattrtab[i], SC_KERNEL_CONS_REV_ATTR); + sc_kts[i] = ts; + } + sc_console->ts = oldts; + (*sc_console->tsw->te_default_attr)( + sc_console, SC_NORM_ATTR, SC_NORM_REV_ATTR); + } + } else { + scinit(unit, flags); } - } else { - scinit(unit, flags); - } - sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE); - sc->config = flags; - callout_init(&sc->ctimeout, 0); - callout_init(&sc->cblink, 0); - scp = sc_get_stat(sc->dev[0]); - if (sc_console == NULL) /* sc_console_unit < 0 */ - sc_console = scp; + sc = sc_get_softc(unit, flags & SC_KERNEL_CONSOLE); + sc->config = flags; + callout_init(&sc->ctimeout, 0); + callout_init(&sc->cblink, 0); + scp = sc_get_stat(sc->dev[0]); + if (sc_console == NULL) /* sc_console_unit < 0 */ + sc_console = scp; #ifdef SC_PIXEL_MODE - if ((sc->config & SC_VESAMODE) != 0) - sc_set_vesa_mode(scp, sc, unit); + if ((sc->config & SC_VESAMODE) != 0) + sc_set_vesa_mode(scp, sc, unit); #endif /* SC_PIXEL_MODE */ - /* initialize cursor */ - if (!ISGRAPHSC(scp)) - update_cursor_image(scp); + /* initialize cursor */ + if (!ISGRAPHSC(scp)) + update_cursor_image(scp); - /* get screen update going */ - scrn_timer(sc); + /* get screen update going */ + scrn_timer(sc); - /* set up the keyboard */ - (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); - update_kbd_state(scp, scp->status, LOCK_MASK); + /* set up the keyboard */ + (void)kbdd_ioctl(sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); + update_kbd_state(scp, scp->status, LOCK_MASK); - printf("%s%d: %s <%d virtual consoles, flags=0x%x>\n", - SC_DRIVER_NAME, unit, adapter_name(sc->adp), sc->vtys, sc->config); - if (bootverbose) { - printf("%s%d:", SC_DRIVER_NAME, unit); - if (sc->adapter >= 0) - printf(" fb%d", sc->adapter); - if (sc->keyboard >= 0) - printf(", kbd%d", sc->keyboard); - if (scp->tsw) - printf(", terminal emulator: %s (%s)", - scp->tsw->te_name, scp->tsw->te_desc); - printf("\n"); - } + printf("%s%d: %s <%d virtual consoles, flags=0x%x>\n", SC_DRIVER_NAME, + unit, adapter_name(sc->adp), sc->vtys, sc->config); + if (bootverbose) { + printf("%s%d:", SC_DRIVER_NAME, unit); + if (sc->adapter >= 0) + printf(" fb%d", sc->adapter); + if (sc->keyboard >= 0) + printf(", kbd%d", sc->keyboard); + if (scp->tsw) + printf(", terminal emulator: %s (%s)", + scp->tsw->te_name, scp->tsw->te_desc); + printf("\n"); + } - /* Register suspend/resume/shutdown callbacks for the kernel console. */ - if (sc_console_unit == unit) { - EVENTHANDLER_REGISTER(power_suspend_early, scsuspend, NULL, - EVENTHANDLER_PRI_ANY); - EVENTHANDLER_REGISTER(power_resume, scresume, NULL, - EVENTHANDLER_PRI_ANY); - EVENTHANDLER_REGISTER(shutdown_pre_sync, scshutdown, NULL, - SHUTDOWN_PRI_DEFAULT); - } + /* Register suspend/resume/shutdown callbacks for the kernel console. */ + if (sc_console_unit == unit) { + EVENTHANDLER_REGISTER( + power_suspend_early, scsuspend, NULL, EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER( + power_resume, scresume, NULL, EVENTHANDLER_PRI_ANY); + EVENTHANDLER_REGISTER( + shutdown_pre_sync, scshutdown, NULL, SHUTDOWN_PRI_DEFAULT); + } - for (vc = 0; vc < sc->vtys; vc++) { - if (sc->dev[vc] == NULL) { - sc->dev[vc] = sc_alloc_tty(vc, vc + unit * MAXCONS); - if (vc == 0 && sc->dev == main_devs) - SC_STAT(sc->dev[0]) = &main_console; + for (vc = 0; vc < sc->vtys; vc++) { + if (sc->dev[vc] == NULL) { + sc->dev[vc] = sc_alloc_tty(vc, vc + unit * MAXCONS); + if (vc == 0 && sc->dev == main_devs) + SC_STAT(sc->dev[0]) = &main_console; + } + /* + * The first vty already has struct tty and scr_stat initialized + * in scinit(). The other vtys will have these structs when + * first opened. + */ } - /* - * The first vty already has struct tty and scr_stat initialized - * in scinit(). The other vtys will have these structs when - * first opened. - */ - } - dev = make_dev(&consolectl_devsw, 0, UID_ROOT, GID_WHEEL, 0600, - "consolectl"); - dev->si_drv1 = sc->dev[0]; + dev = make_dev( + &consolectl_devsw, 0, UID_ROOT, GID_WHEEL, 0600, "consolectl"); + dev->si_drv1 = sc->dev[0]; - return 0; + return 0; } static void scmeminit(void *arg) { - if (!vty_enabled(VTY_SC)) - return; - if (sc_malloc) - return; - sc_malloc = TRUE; + if (!vty_enabled(VTY_SC)) + return; + if (sc_malloc) + return; + sc_malloc = TRUE; - /* - * As soon as malloc() becomes functional, we had better allocate - * various buffers for the kernel console. - */ + /* + * As soon as malloc() becomes functional, we had better allocate + * various buffers for the kernel console. + */ - if (sc_console_unit < 0) /* sc_console == NULL */ - return; + if (sc_console_unit < 0) /* sc_console == NULL */ + return; - /* copy the temporary buffer to the final buffer */ - sc_alloc_scr_buffer(sc_console, FALSE, FALSE); + /* copy the temporary buffer to the final buffer */ + sc_alloc_scr_buffer(sc_console, FALSE, FALSE); #ifndef SC_NO_CUTPASTE - sc_alloc_cut_buffer(sc_console, FALSE); + sc_alloc_cut_buffer(sc_console, FALSE); #endif #ifndef SC_NO_HISTORY - /* initialize history buffer & pointers */ - sc_alloc_history_buffer(sc_console, 0, 0, FALSE); + /* initialize history buffer & pointers */ + sc_alloc_history_buffer(sc_console, 0, 0, FALSE); #endif } @@ -700,101 +709,104 @@ SYSINIT(sc_mem, SI_SUB_KMEM, SI_ORDER_ANY, scmeminit, static int scdevtounit(struct tty *tp) { - int vty = SC_VTY(tp); + int vty = SC_VTY(tp); - if (vty == SC_CONSOLECTL) - return ((sc_console != NULL) ? sc_console->sc->unit : -1); - else if ((vty < 0) || (vty >= MAXCONS*sc_max_unit())) - return -1; - else - return vty/MAXCONS; + if (vty == SC_CONSOLECTL) + return ((sc_console != NULL) ? sc_console->sc->unit : -1); + else if ((vty < 0) || (vty >= MAXCONS * sc_max_unit())) + return -1; + else + return vty / MAXCONS; } static int sctty_open(struct tty *tp) { - int unit = scdevtounit(tp); - sc_softc_t *sc; - scr_stat *scp; + int unit = scdevtounit(tp); + sc_softc_t *sc; + scr_stat *scp; #ifndef __sparc64__ - keyarg_t key; + keyarg_t key; #endif - DPRINTF(5, ("scopen: dev:%s, unit:%d, vty:%d\n", - devtoname(tp->t_dev), unit, SC_VTY(tp))); + DPRINTF(5, + ("scopen: dev:%s, unit:%d, vty:%d\n", devtoname(tp->t_dev), unit, + SC_VTY(tp))); - sc = sc_get_softc(unit, (sc_console_unit == unit) ? SC_KERNEL_CONSOLE : 0); - if (sc == NULL) - return ENXIO; + sc = sc_get_softc( + unit, (sc_console_unit == unit) ? SC_KERNEL_CONSOLE : 0); + if (sc == NULL) + return ENXIO; - if (!tty_opened(tp)) { - /* Use the current setting of the <-- key as default VERASE. */ - /* If the Delete key is preferable, an stty is necessary */ + if (!tty_opened(tp)) { + /* Use the current setting of the <-- key as default VERASE. */ + /* If the Delete key is preferable, an stty is necessary */ #ifndef __sparc64__ - if (sc->kbd != NULL) { - key.keynum = KEYCODE_BS; - (void)kbdd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key); - tp->t_termios.c_cc[VERASE] = key.key.map[0]; - } + if (sc->kbd != NULL) { + key.keynum = KEYCODE_BS; + (void)kbdd_ioctl(sc->kbd, GIO_KEYMAPENT, (caddr_t)&key); + tp->t_termios.c_cc[VERASE] = key.key.map[0]; + } #endif - } + } - scp = sc_get_stat(tp); - if (scp == NULL) { - scp = SC_STAT(tp) = alloc_scp(sc, SC_VTY(tp)); - if (ISGRAPHSC(scp)) - sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8); - } - if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) { - tp->t_winsize.ws_col = scp->xsize; - tp->t_winsize.ws_row = scp->ysize; - } + scp = sc_get_stat(tp); + if (scp == NULL) { + scp = SC_STAT(tp) = alloc_scp(sc, SC_VTY(tp)); + if (ISGRAPHSC(scp)) + sc_set_pixel_mode(scp, NULL, 0, 0, 16, 8); + } + if (!tp->t_winsize.ws_col && !tp->t_winsize.ws_row) { + tp->t_winsize.ws_col = scp->xsize; + tp->t_winsize.ws_row = scp->ysize; + } - return (0); + return (0); } static void sctty_close(struct tty *tp) { - scr_stat *scp; - int s; + scr_stat *scp; + int s; - if (SC_VTY(tp) != SC_CONSOLECTL) { - scp = sc_get_stat(tp); - /* were we in the middle of the VT switching process? */ - DPRINTF(5, ("sc%d: scclose(), ", scp->sc->unit)); - s = spltty(); - if ((scp == scp->sc->cur_scp) && (scp->sc->unit == sc_console_unit)) - cnavailable(sc_consptr, TRUE); - if (finish_vt_rel(scp, TRUE, &s) == 0) /* force release */ - DPRINTF(5, ("reset WAIT_REL, ")); - if (finish_vt_acq(scp) == 0) /* force acknowledge */ - DPRINTF(5, ("reset WAIT_ACQ, ")); + if (SC_VTY(tp) != SC_CONSOLECTL) { + scp = sc_get_stat(tp); + /* were we in the middle of the VT switching process? */ + DPRINTF(5, ("sc%d: scclose(), ", scp->sc->unit)); + s = spltty(); + if ((scp == scp->sc->cur_scp) && + (scp->sc->unit == sc_console_unit)) + cnavailable(sc_consptr, TRUE); + if (finish_vt_rel(scp, TRUE, &s) == 0) /* force release */ + DPRINTF(5, ("reset WAIT_REL, ")); + if (finish_vt_acq(scp) == 0) /* force acknowledge */ + DPRINTF(5, ("reset WAIT_ACQ, ")); #ifdef not_yet_done - if (scp == &main_console) { - scp->pid = 0; - scp->proc = NULL; - scp->smode.mode = VT_AUTO; - } - else { - sc_vtb_destroy(&scp->vtb); + if (scp == &main_console) { + scp->pid = 0; + scp->proc = NULL; + scp->smode.mode = VT_AUTO; + } else { + sc_vtb_destroy(&scp->vtb); #ifndef __sparc64__ - sc_vtb_destroy(&scp->scr); + sc_vtb_destroy(&scp->scr); #endif - sc_free_history_buffer(scp, scp->ysize); - SC_STAT(tp) = NULL; - free(scp, M_DEVBUF); - } + sc_free_history_buffer(scp, scp->ysize); + SC_STAT(tp) = NULL; + free(scp, M_DEVBUF); + } #else - scp->pid = 0; - scp->proc = NULL; - scp->smode.mode = VT_AUTO; + scp->pid = 0; + scp->proc = NULL; + scp->smode.mode = VT_AUTO; #endif - scp->kbd_mode = K_XLATE; - if (scp == scp->sc->cur_scp) - (void)kbdd_ioctl(scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); - DPRINTF(5, ("done.\n")); - } + scp->kbd_mode = K_XLATE; + if (scp == scp->sc->cur_scp) + (void)kbdd_ioctl( + scp->sc->kbd, KDSKBMODE, (caddr_t)&scp->kbd_mode); + DPRINTF(5, ("done.\n")); + } } #if 0 /* XXX mpsafetty: fix screensaver. What about outwakeup? */ @@ -810,867 +822,886 @@ scread(struct cdev *dev, struct uio *uio, int flag) static int sckbdevent(keyboard_t *thiskbd, int event, void *arg) { - sc_softc_t *sc; - struct tty *cur_tty; - int c, error = 0; - size_t len; - const u_char *cp; + sc_softc_t *sc; + struct tty *cur_tty; + int c, error = 0; + size_t len; + const u_char *cp; - sc = (sc_softc_t *)arg; - /* assert(thiskbd == sc->kbd) */ + sc = (sc_softc_t *)arg; + /* assert(thiskbd == sc->kbd) */ - mtx_lock(&Giant); + mtx_lock(&Giant); - switch (event) { - case KBDIO_KEYINPUT: - break; - case KBDIO_UNLOADING: - sc->kbd = NULL; - sc->keyboard = -1; - kbd_release(thiskbd, (void *)&sc->keyboard); - goto done; - default: - error = EINVAL; - goto done; - } + switch (event) { + case KBDIO_KEYINPUT: + break; + case KBDIO_UNLOADING: + sc->kbd = NULL; + sc->keyboard = -1; + kbd_release(thiskbd, (void *)&sc->keyboard); + goto done; + default: + error = EINVAL; + goto done; + } - /* - * Loop while there is still input to get from the keyboard. - * I don't think this is nessesary, and it doesn't fix - * the Xaccel-2.1 keyboard hang, but it can't hurt. XXX - */ - while ((c = scgetc(sc, SCGETC_NONBLOCK, NULL)) != NOKEY) { + /* + * Loop while there is still input to get from the keyboard. + * I don't think this is nessesary, and it doesn't fix + * the Xaccel-2.1 keyboard hang, but it can't hurt. XXX + */ + while ((c = scgetc(sc, SCGETC_NONBLOCK, NULL)) != NOKEY) { - cur_tty = SC_DEV(sc, sc->cur_scp->index); - if (!tty_opened_ns(cur_tty)) - continue; + cur_tty = SC_DEV(sc, sc->cur_scp->index); + if (!tty_opened_ns(cur_tty)) + continue; - if ((*sc->cur_scp->tsw->te_input)(sc->cur_scp, c, cur_tty)) - continue; + if ((*sc->cur_scp->tsw->te_input)(sc->cur_scp, c, cur_tty)) + continue; - switch (KEYFLAGS(c)) { - case 0x0000: /* normal key */ - ttydisc_rint(cur_tty, KEYCHAR(c), 0); - break; - case FKEY: /* function key, return string */ - cp = (*sc->cur_scp->tsw->te_fkeystr)(sc->cur_scp, c); - if (cp != NULL) { - ttydisc_rint_simple(cur_tty, cp, strlen(cp)); - break; - } - cp = kbdd_get_fkeystr(thiskbd, KEYCHAR(c), &len); - if (cp != NULL) - ttydisc_rint_simple(cur_tty, cp, len); - break; - case MKEY: /* meta is active, prepend ESC */ - ttydisc_rint(cur_tty, 0x1b, 0); - ttydisc_rint(cur_tty, KEYCHAR(c), 0); - break; - case BKEY: /* backtab fixed sequence (esc [ Z) */ - ttydisc_rint_simple(cur_tty, "\x1B[Z", 3); - break; + switch (KEYFLAGS(c)) { + case 0x0000: /* normal key */ + ttydisc_rint(cur_tty, KEYCHAR(c), 0); + break; + case FKEY: /* function key, return string */ + cp = (*sc->cur_scp->tsw->te_fkeystr)(sc->cur_scp, c); + if (cp != NULL) { + ttydisc_rint_simple(cur_tty, cp, strlen(cp)); + break; + } + cp = kbdd_get_fkeystr(thiskbd, KEYCHAR(c), &len); + if (cp != NULL) + ttydisc_rint_simple(cur_tty, cp, len); + break; + case MKEY: /* meta is active, prepend ESC */ + ttydisc_rint(cur_tty, 0x1b, 0); + ttydisc_rint(cur_tty, KEYCHAR(c), 0); + break; + case BKEY: /* backtab fixed sequence (esc [ Z) */ + ttydisc_rint_simple(cur_tty, "\x1B[Z", 3); + break; + } + + ttydisc_rint_done(cur_tty); } - ttydisc_rint_done(cur_tty); - } + sc->cur_scp->status |= MOUSE_HIDDEN; - sc->cur_scp->status |= MOUSE_HIDDEN; - done: - mtx_unlock(&Giant); - return (error); + mtx_unlock(&Giant); + return (error); } static int sctty_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) { - int error; - int i; - struct cursor_attr *cap; - sc_softc_t *sc; - scr_stat *scp; - int s; + int error; + int i; + struct cursor_attr *cap; + sc_softc_t *sc; + scr_stat *scp; + int s; #if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - int ival; + int ival; #endif - /* If there is a user_ioctl function call that first */ - if (sc_user_ioctl) { - error = (*sc_user_ioctl)(tp, cmd, data, td); + /* If there is a user_ioctl function call that first */ + if (sc_user_ioctl) { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 3 07:01:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AC151CABC5; Tue, 3 Dec 2019 07:01:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RtF471fpz3yb4; Tue, 3 Dec 2019 07:01:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3F42BF76; Tue, 3 Dec 2019 07:01:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB371SIj040937; Tue, 3 Dec 2019 07:01:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB371SLR040936; Tue, 3 Dec 2019 07:01:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912030701.xB371SLR040936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 3 Dec 2019 07:01:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355317 - head/sbin/newfs_msdos X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/newfs_msdos X-SVN-Commit-Revision: 355317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:01:29 -0000 Author: delphij Date: Tue Dec 3 07:01:28 2019 New Revision: 355317 URL: https://svnweb.freebsd.org/changeset/base/355317 Log: newfs_msdos: -A is incompatible with -r, not -o. PR: 242314 Submitted by: Guy Yur MFC after: 2 weeks Modified: head/sbin/newfs_msdos/newfs_msdos.c Modified: head/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 02:30:52 2019 (r355316) +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 (r355317) @@ -179,7 +179,7 @@ main(int argc, char *argv[]) if (argc < 1 || argc > 2) usage(); if (o.align) { - if (o.hidden_sectors_set) + if (o.reserved_sectors) errx(1, "align (-A) is incompatible with -r"); } fname = *argv++; From owner-svn-src-all@freebsd.org Tue Dec 3 07:03:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 580E01CAC97; Tue, 3 Dec 2019 07:03:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RtHL1kWGz3yv7; Tue, 3 Dec 2019 07:03:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E678C0D3; Tue, 3 Dec 2019 07:03:26 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB373QcN043317; Tue, 3 Dec 2019 07:03:26 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB373P5N043316; Tue, 3 Dec 2019 07:03:25 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912030703.xB373P5N043316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 3 Dec 2019 07:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355318 - head/sbin/newfs_msdos X-SVN-Group: head X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: head/sbin/newfs_msdos X-SVN-Commit-Revision: 355318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:03:26 -0000 Author: delphij Date: Tue Dec 3 07:03:25 2019 New Revision: 355318 URL: https://svnweb.freebsd.org/changeset/base/355318 Log: Explicitly exit() instead of return in main(). MFC after: 2 weeks Modified: head/sbin/newfs_msdos/newfs_msdos.c Modified: head/sbin/newfs_msdos/newfs_msdos.c ============================================================================== --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 (r355317) +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:03:25 2019 (r355318) @@ -189,7 +189,7 @@ main(int argc, char *argv[]) err(1, NULL); } dtype = *argv; - return !!mkfs_msdos(fname, dtype, &o); + exit(!!mkfs_msdos(fname, dtype, &o)); } /* From owner-svn-src-all@freebsd.org Tue Dec 3 07:19:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB14D1CB064; Tue, 3 Dec 2019 07:19:28 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rtdr5ytWz40Tj; Tue, 3 Dec 2019 07:19:28 +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 B138BC2A4; Tue, 3 Dec 2019 07:19:28 +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 xB37JSS0049656; Tue, 3 Dec 2019 07:19:28 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB37JSjp049655; Tue, 3 Dec 2019 07:19:28 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030719.xB37JSjp049655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 07:19: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: r355319 - in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 i386/i386 X-SVN-Commit-Revision: 355319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:19:29 -0000 Author: avg Date: Tue Dec 3 07:19:28 2019 New Revision: 355319 URL: https://svnweb.freebsd.org/changeset/base/355319 Log: MFC r354638: teach db_nextframe/x86 about [X]xen_intr_upcall interrupt handler Modified: stable/12/sys/amd64/amd64/db_trace.c stable/12/sys/i386/i386/db_trace.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/db_trace.c ============================================================================== --- stable/12/sys/amd64/amd64/db_trace.c Tue Dec 3 07:03:25 2019 (r355318) +++ stable/12/sys/amd64/amd64/db_trace.c Tue Dec 3 07:19:28 2019 (r355319) @@ -203,6 +203,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, s frame_type = TRAP; else if (strncmp(name, "Xatpic_intr", 11) == 0 || strncmp(name, "Xapic_isr", 9) == 0 || + strcmp(name, "Xxen_intr_upcall") == 0 || strcmp(name, "Xtimerint") == 0 || strcmp(name, "Xipi_intr_bitmap_handler") == 0 || strcmp(name, "Xcpustop") == 0 || Modified: stable/12/sys/i386/i386/db_trace.c ============================================================================== --- stable/12/sys/i386/i386/db_trace.c Tue Dec 3 07:03:25 2019 (r355318) +++ stable/12/sys/i386/i386/db_trace.c Tue Dec 3 07:19:28 2019 (r355319) @@ -346,7 +346,8 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, st frame_type = SYSCALL; else if (strcmp(name, "dblfault_handler") == 0) frame_type = DOUBLE_FAULT; - else if (strcmp(name, "Xtimerint") == 0) + else if (strcmp(name, "Xtimerint") == 0 || + strcmp(name, "Xxen_intr_upcall") == 0) frame_type = INTERRUPT; else if (strcmp(name, "Xcpustop") == 0 || strcmp(name, "Xrendezvous") == 0 || From owner-svn-src-all@freebsd.org Tue Dec 3 07:20:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DFEA1CB100; Tue, 3 Dec 2019 07:20:48 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RtgN1P54z40cR; Tue, 3 Dec 2019 07:20:48 +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 13399C2BC; Tue, 3 Dec 2019 07:20:48 +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 xB37KlNF049809; Tue, 3 Dec 2019 07:20:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB37KlnQ049808; Tue, 3 Dec 2019 07:20:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030720.xB37KlnQ049808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 07:20: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: r355320 - stable/12/sys/dev/hyperv/storvsc X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 355320 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:20:48 -0000 Author: avg Date: Tue Dec 3 07:20:47 2019 New Revision: 355320 URL: https://svnweb.freebsd.org/changeset/base/355320 Log: MFC r354849: hyperv/storvsc: stash a pointer to hv_storvsc_request in ccb Modified: stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Dec 3 07:19:28 2019 (r355319) +++ stable/12/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Dec 3 07:20:47 2019 (r355320) @@ -1915,6 +1915,7 @@ create_storvsc_request(union ccb *ccb, struct hv_storv reqp->sense_info_len = csio->sense_len; reqp->ccb = ccb; + ccb->ccb_h.spriv_ptr0 = reqp; if (0 == csio->dxfer_len) { return (0); From owner-svn-src-all@freebsd.org Tue Dec 3 07:22:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A9511CB2A6; Tue, 3 Dec 2019 07:22:17 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rtj53CP1z40w7; Tue, 3 Dec 2019 07:22:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5237CC440; Tue, 3 Dec 2019 07:22:17 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB37MHo8055174; Tue, 3 Dec 2019 07:22:17 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB37MHbP055172; Tue, 3 Dec 2019 07:22:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030722.xB37MHbP055172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 07:22:17 +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: r355321 - stable/12/sys/dev/ixgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/ixgbe X-SVN-Commit-Revision: 355321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:22:17 -0000 Author: avg Date: Tue Dec 3 07:22:16 2019 New Revision: 355321 URL: https://svnweb.freebsd.org/changeset/base/355321 Log: MFC r354349: if_ixv: disable RSS configuration on 82599 and X540 VFs It is reported that those VFs share their RSS configuration with PF and, thus, they cannot be configured independently. Also: - add missing opt_rss.h to if_ixv.c, otherwise RSS kernel option could not be seen - do not enable IXGBE_FEATURE_RSS on the older VFs - set flowid / hash type to M_HASHTYPE_NONE or M_HASHTYPE_OPAQUE_HASH (based on what the hardware reports) if IXGBE_FEATURE_RSS is not set Modified: stable/12/sys/dev/ixgbe/if_ixv.c stable/12/sys/dev/ixgbe/ix_txrx.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ixgbe/if_ixv.c ============================================================================== --- stable/12/sys/dev/ixgbe/if_ixv.c Tue Dec 3 07:20:47 2019 (r355320) +++ stable/12/sys/dev/ixgbe/if_ixv.c Tue Dec 3 07:22:16 2019 (r355321) @@ -35,6 +35,7 @@ #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_rss.h" #include "ixgbe.h" #include "ifdi_if.h" @@ -1457,7 +1458,12 @@ ixv_initialize_receive_units(if_ctx_t ctx) scctx->isc_nrxd[0] - 1); } - ixv_initialize_rss_mapping(adapter); + /* + * Do not touch RSS and RETA settings for older hardware + * as those are shared among PF and all VF. + */ + if (adapter->hw.mac.type >= ixgbe_mac_X550_vf) + ixv_initialize_rss_mapping(adapter); } /* ixv_initialize_receive_units */ /************************************************************************ @@ -1892,7 +1898,6 @@ ixv_init_device_features(struct adapter *adapter) { adapter->feat_cap = IXGBE_FEATURE_NETMAP | IXGBE_FEATURE_VF - | IXGBE_FEATURE_RSS | IXGBE_FEATURE_LEGACY_TX; /* A tad short on feature flags for VFs, atm. */ @@ -1905,6 +1910,7 @@ ixv_init_device_features(struct adapter *adapter) case ixgbe_mac_X550EM_x_vf: case ixgbe_mac_X550EM_a_vf: adapter->feat_cap |= IXGBE_FEATURE_NEEDS_CTXD; + adapter->feat_cap |= IXGBE_FEATURE_RSS; break; default: break; Modified: stable/12/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- stable/12/sys/dev/ixgbe/ix_txrx.c Tue Dec 3 07:20:47 2019 (r355320) +++ stable/12/sys/dev/ixgbe/ix_txrx.c Tue Dec 3 07:22:16 2019 (r355321) @@ -464,6 +464,12 @@ ixgbe_isc_rxd_pkt_get(void *arg, if_rxd_info_t ri) ri->iri_flowid = le32toh(rxd->wb.lower.hi_dword.rss); ri->iri_rsstype = ixgbe_determine_rsstype(pkt_info); + if ((adapter->feat_en & IXGBE_FEATURE_RSS) == 0) { + if (ri->iri_rsstype == M_HASHTYPE_OPAQUE) + ri->iri_rsstype = M_HASHTYPE_NONE; + else + ri->iri_rsstype = M_HASHTYPE_OPAQUE_HASH; + } ri->iri_vtag = vtag; ri->iri_nfrags = i; if (vtag) From owner-svn-src-all@freebsd.org Tue Dec 3 07:22:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AAB191CB324; Tue, 3 Dec 2019 07:22:49 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rtjj2pKnz413k; Tue, 3 Dec 2019 07:22:48 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB37MdOl033596; Mon, 2 Dec 2019 23:22:39 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB37MdrZ033595; Mon, 2 Dec 2019 23:22:39 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve In-Reply-To: <00084efce3baaad166ec9594e56bf43cd31ece0e.camel@freebsd.org> To: Ian Lepore Date: Mon, 2 Dec 2019 23:22:39 -0800 (PST) CC: Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47Rtjj2pKnz413k X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-0.99)[-0.994,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 07:22:49 -0000 > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > Author: vmaffione > > Date: Mon Dec 2 20:51:46 2019 > > New Revision: 355301 > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > Log: > > bhyve: uniform printf format string newlines > > > > Some of the printf statements only use LF to get a newline. > > However, a CR character is also required for the serial console to > > print debug logs in a nice way. > > Fix those code locations that only use LF, by adding a CR > > character. > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > Modified: > > head/usr.sbin/bhyve/audio.c > > head/usr.sbin/bhyve/hda_codec.c > > head/usr.sbin/bhyve/net_backends.c > > head/usr.sbin/bhyve/pci_ahci.c > > head/usr.sbin/bhyve/pci_e82545.c > > head/usr.sbin/bhyve/pci_hda.c > > head/usr.sbin/bhyve/pci_nvme.c > > head/usr.sbin/bhyve/pci_virtio_block.c > > head/usr.sbin/bhyve/pci_virtio_console.c > > head/usr.sbin/bhyve/pci_virtio_net.c > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > head/usr.sbin/bhyve/pci_xhci.c > > head/usr.sbin/bhyve/rfb.c > > > > These changes seem wrong in a couple ways... > > - Lines are terminated by linefeeds in unix-like systems. If > linefeeds need to be translated to include carriage returns, that's the > responsibility of the terminal/line-discipline layer, not the source > strings being printed. Fully agree, this change seems wrong to me for Ian's stated reason here. > > - The sequence \n\r is very strange. For systems that do prefer > carriage returns, the \r always comes before the \n (or stands alone on > Mac systems), not after. > > I have a feeling that the root of this is something like "lots of > people use bhyve for Windows, so they use Windows apps to look at logs, > so the logs should be formatted for Windows." If that's the reasoning, > then why shouldn't we convert EVERY printf in the source base to > include carriage returns, just in case a windows user wants to browse a > log file? This is not that issue, it is something going on with the line discipline when using the bhyve console device. I believe the line displine being different from what bhyve itself is expecting so when console output is intermixed with output from bhyve itself things go wrong. The printf's in this patch are coming from the bhyve process that has a fd open to the launching tty, the line discipline on that tty is changed to something different after you open the console device from that same controlling tty, or that is my hypothosis on what is going wrong. > -- Ian -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Dec 3 08:47:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0C1C1CDC0F; Tue, 3 Dec 2019 08:47: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RwZr3mMJz45ZL; Tue, 3 Dec 2019 08:47: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 656A9D38E; Tue, 3 Dec 2019 08:47: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 xB38l0Dl002923; Tue, 3 Dec 2019 08:47:00 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB38kxEH002918; Tue, 3 Dec 2019 08:47:00 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912030847.xB38kxEH002918@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 3 Dec 2019 08:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355322 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 355322 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 08:47:00 -0000 Author: hselasky Date: Tue Dec 3 08:46:59 2019 New Revision: 355322 URL: https://svnweb.freebsd.org/changeset/base/355322 Log: Use refcount from "in_joingroup_locked()" when joining multicast groups. Do not acquire additional references. This makes the IPv4 IGMP code in line with the IPv6 MLD code. Background: The IPv4 multicast code puts an extra reference on the in_multi struct when joining groups. This becomes visible when using daemons like igmpproxy from ports, that multicast entries do not disappear from the output of ifmcstat(8) when multicast streams are disconnected. This fixes a regression issue after r349762. While at it factor the ip_mfilter_insert() and ip6_mfilter_insert() calls to avoid repeated "is_new" check. Differential Revision: https://reviews.freebsd.org/D22595 Tested by: Guido van Rooij Reviewed by: rgrimes (network) MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/netinet/in_mcast.c head/sys/netinet6/in6_mcast.c Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Tue Dec 3 07:22:16 2019 (r355321) +++ head/sys/netinet/in_mcast.c Tue Dec 3 08:46:59 2019 (r355322) @@ -2211,7 +2211,11 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt __func__); goto out_inp_locked; } - inm_acquire(imf->imf_inm); + /* + * NOTE: Refcount from in_joingroup_locked() + * is protecting membership. + */ + ip_mfilter_insert(&imo->imo_head, imf); } else { CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); IN_MULTI_LIST_LOCK(); @@ -2235,8 +2239,6 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt goto out_inp_locked; } } - if (is_new) - ip_mfilter_insert(&imo->imo_head, imf); imf_commit(imf); imf = NULL; Modified: head/sys/netinet6/in6_mcast.c ============================================================================== --- head/sys/netinet6/in6_mcast.c Tue Dec 3 07:22:16 2019 (r355321) +++ head/sys/netinet6/in6_mcast.c Tue Dec 3 08:46:59 2019 (r355322) @@ -2111,6 +2111,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop * NOTE: Refcount from in6_joingroup_locked() * is protecting membership. */ + ip6_mfilter_insert(&imo->im6o_head, imf); } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); IN6_MULTI_LIST_LOCK(); @@ -2135,9 +2136,6 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop goto out_in6p_locked; } } - - if (is_new) - ip6_mfilter_insert(&imo->im6o_head, imf); im6f_commit(imf); imf = NULL; From owner-svn-src-all@freebsd.org Tue Dec 3 09:06:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 048851CE957; Tue, 3 Dec 2019 09:06:38 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rx1T6CzZz47CP; Tue, 3 Dec 2019 09:06:37 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FCF2D742; Tue, 3 Dec 2019 09:06:37 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB396bRK014792; Tue, 3 Dec 2019 09:06:37 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB396bkH014791; Tue, 3 Dec 2019 09:06:37 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912030906.xB396bkH014791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 09:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355323 - head/riscv X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/riscv X-SVN-Commit-Revision: 355323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 09:06:38 -0000 Author: manu Date: Tue Dec 3 09:06:37 2019 New Revision: 355323 URL: https://svnweb.freebsd.org/changeset/base/355323 Log: Revert r355188 as it shouldn't have created the risc-v directory at the top level. Reported by: rpokala Deleted: head/riscv/ From owner-svn-src-all@freebsd.org Tue Dec 3 09:12:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29E921CEC0D; Tue, 3 Dec 2019 09:12:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rx8k02kNz47dk; Tue, 3 Dec 2019 09:12:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF4BDD8F5; Tue, 3 Dec 2019 09:12:53 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB39Crhp020476; Tue, 3 Dec 2019 09:12:53 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB39CrAh020475; Tue, 3 Dec 2019 09:12:53 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912030912.xB39CrAh020475@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 09:12:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355324 - head/sys/gnu/dts/riscv X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/gnu/dts/riscv X-SVN-Commit-Revision: 355324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 09:12:54 -0000 Author: manu Date: Tue Dec 3 09:12:53 2019 New Revision: 355324 URL: https://svnweb.freebsd.org/changeset/base/355324 Log: Import DTS files for riscv from Linux 5.4 Requested by: mhorne Added: head/sys/gnu/dts/riscv/ - copied from r355323, vendor/device-tree/dist/src/riscv/ From owner-svn-src-all@freebsd.org Tue Dec 3 09:13:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 015C91CED82; Tue, 3 Dec 2019 09:13:50 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.blih.net", Issuer "mail.blih.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rx9m2mCqz47sQ; Tue, 3 Dec 2019 09:13:48 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mail.blih.net (mail.blih.net [212.83.177.182]) by mail.blih.net (OpenSMTPD) with ESMTP id af8d9d93; Tue, 3 Dec 2019 10:13:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=mail; bh=BBupXlpW7AfxaoOJv7q+WQ7T7vI=; b=L5SeWrrHnWQCWt21bxUMbP4BTMOY Ai/aXaWlXGMYJ/3C7bh2y2xSSqD/93kyt5izEsuNN2bW0OhwNsDVk0PC4jC8m7kd AvL96Ycq7k9Kz0CiF1t1WVgBu8eMpTp8lHbdHOXTL1s2klDAdqw4avNujMvCYixY xPB2qBLmy6C7g2M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=bidouilliste.com; h=date :from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= mail; b=n5vKb21nyDyFyz/4uJ5ZnGqWnVrIzv0ixui8TBtrheFX1i1LJHYNLZJb 1Tkl8g7xoMmAsRsC4GByqGFah64U0zwz3ydcl3cIb4hVmIqIg8dDCg9AgB+5x16k pauwnFY50Tdq7HVrrOzQRjY9L3xTMctpW0wKfIRBXD9HQ5XPECY= Received: from skull.home.blih.net (lfbn-1-12172-130.w90-92.abo.wanadoo.fr [90.92.223.130]) by mail.blih.net (OpenSMTPD) with ESMTPSA id f211983c TLS version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO; Tue, 3 Dec 2019 10:13:45 +0100 (CET) Date: Tue, 3 Dec 2019 10:13:45 +0100 From: Emmanuel Vadot To: Ravi Pokala Cc: Emmanuel Vadot , , , Subject: Re: svn commit: r355188 - in head/riscv: . sifive Message-Id: <20191203101345.53896cce499ee685000e661a@bidouilliste.com> In-Reply-To: <3C503BF7-6D49-4FD2-B2C4-55C890FA8458@panasas.com> References: <201911281938.xASJcv3a034087@repo.freebsd.org> <3C503BF7-6D49-4FD2-B2C4-55C890FA8458@panasas.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 47Rx9m2mCqz47sQ X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bidouilliste.com header.s=mail header.b=L5SeWrrH; dmarc=none; spf=pass (mx1.freebsd.org: domain of manu@bidouilliste.com designates 212.83.177.182 as permitted sender) smtp.mailfrom=manu@bidouilliste.com X-Spamd-Result: default: False [-0.22 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[bidouilliste.com:s=mail]; NEURAL_HAM_MEDIUM(-0.59)[-0.588,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:212.83.177.182/32]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MV_CASE(0.50)[]; DMARC_NA(0.00)[bidouilliste.com]; SH_EMAIL_DBL_DONT_QUERY_IPS(0.00)[0.152.189.144,0.152.228.160,0.153.246.16,0.0.0.1,0.153.50.192,0.152.193.120,0.152.232.136,0.0.0.3,0.0.0.2,0.153.11.176,0.153.54.168,4.196.180.0,0.153.89.208,0.0.0.4,0.152.150.128,0.0.0.0]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-0.11)[-0.113,0]; DKIM_TRACE(0.00)[bidouilliste.com:+]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.38)[ip: (-0.58), ipnet: 212.83.160.0/19(2.41), asn: 12876(0.06), country: FR(-0.00)]; ASN(0.00)[asn:12876, ipnet:212.83.160.0/19, country:FR]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 09:13:50 -0000 On Mon, 02 Dec 2019 13:36:06 -0800 Ravi Pokala wrote: > Hi Manu, >=20 > This creates a top-level "riscv" directory, but there are no other top-le= vel ${TARGET} directories. >=20 > It looks like other *.dts and *.dtsi files live in either >=20 > sys/dts/${TARGET} >=20 > or >=20 > sys/gnu/dts/${TARGET}/(vendor/)? >=20 > So perhaps these should be moved to one of those directories, as appropri= ate? >=20 > Thanks, >=20 > Ravi (rpokala@) Thanks, I don't know how I didn't see that ... fixed with revert + r355324. > ?-----Original Message----- > From: on behalf of Emmanuel Vadot > Date: 2019-11-28, Thursday at 11:38 > To: , , > Subject: svn commit: r355188 - in head/riscv: . sifive >=20 > Author: manu > Date: Thu Nov 28 19:38:57 2019 > New Revision: 355188 > URL: https://svnweb.freebsd.org/changeset/base/355188 > =20 > Log: > Import riscv DTS files > =20 > Requested by: mhorne > =20 > Added: > head/riscv/ > - copied from r355184, vendor/device-tree/dist/src/riscv/ > Replaced: > head/riscv/sifive/fu540-c000.dtsi > - copied unchanged from r355185, vendor/device-tree/dist/src/ris= cv/sifive/fu540-c000.dtsi > head/riscv/sifive/hifive-unleashed-a00.dts > - copied unchanged from r355185, vendor/device-tree/dist/src/ris= cv/sifive/hifive-unleashed-a00.dts > =20 > Copied: head/riscv/sifive/fu540-c000.dtsi (from r355185, vendor/devic= e-tree/dist/src/riscv/sifive/fu540-c000.dtsi) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/riscv/sifive/fu540-c000.dtsi Thu Nov 28 19:38:57 2019 (r3551= 88, copy of r355185, vendor/device-tree/dist/src/riscv/sifive/fu540-c000.dt= si) > @@ -0,0 +1,251 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* Copyright (c) 2018-2019 SiFive, Inc */ > + > +/dts-v1/; > + > +#include > + > +/ { > + #address-cells =3D <2>; > + #size-cells =3D <2>; > + compatible =3D "sifive,fu540-c000", "sifive,fu540"; > + > + aliases { > + serial0 =3D &uart0; > + serial1 =3D &uart1; > + ethernet0 =3D ð0; > + }; > + > + chosen { > + }; > + > + cpus { > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + cpu0: cpu@0 { > + compatible =3D "sifive,e51", "sifive,rocket0", "riscv"; > + device_type =3D "cpu"; > + i-cache-block-size =3D <64>; > + i-cache-sets =3D <128>; > + i-cache-size =3D <16384>; > + reg =3D <0>; > + riscv,isa =3D "rv64imac"; > + status =3D "disabled"; > + cpu0_intc: interrupt-controller { > + #interrupt-cells =3D <1>; > + compatible =3D "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu1: cpu@1 { > + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size =3D <64>; > + d-cache-sets =3D <64>; > + d-cache-size =3D <32768>; > + d-tlb-sets =3D <1>; > + d-tlb-size =3D <32>; > + device_type =3D "cpu"; > + i-cache-block-size =3D <64>; > + i-cache-sets =3D <64>; > + i-cache-size =3D <32768>; > + i-tlb-sets =3D <1>; > + i-tlb-size =3D <32>; > + mmu-type =3D "riscv,sv39"; > + reg =3D <1>; > + riscv,isa =3D "rv64imafdc"; > + tlb-split; > + cpu1_intc: interrupt-controller { > + #interrupt-cells =3D <1>; > + compatible =3D "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu2: cpu@2 { > + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size =3D <64>; > + d-cache-sets =3D <64>; > + d-cache-size =3D <32768>; > + d-tlb-sets =3D <1>; > + d-tlb-size =3D <32>; > + device_type =3D "cpu"; > + i-cache-block-size =3D <64>; > + i-cache-sets =3D <64>; > + i-cache-size =3D <32768>; > + i-tlb-sets =3D <1>; > + i-tlb-size =3D <32>; > + mmu-type =3D "riscv,sv39"; > + reg =3D <2>; > + riscv,isa =3D "rv64imafdc"; > + tlb-split; > + cpu2_intc: interrupt-controller { > + #interrupt-cells =3D <1>; > + compatible =3D "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu3: cpu@3 { > + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size =3D <64>; > + d-cache-sets =3D <64>; > + d-cache-size =3D <32768>; > + d-tlb-sets =3D <1>; > + d-tlb-size =3D <32>; > + device_type =3D "cpu"; > + i-cache-block-size =3D <64>; > + i-cache-sets =3D <64>; > + i-cache-size =3D <32768>; > + i-tlb-sets =3D <1>; > + i-tlb-size =3D <32>; > + mmu-type =3D "riscv,sv39"; > + reg =3D <3>; > + riscv,isa =3D "rv64imafdc"; > + tlb-split; > + cpu3_intc: interrupt-controller { > + #interrupt-cells =3D <1>; > + compatible =3D "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu4: cpu@4 { > + compatible =3D "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size =3D <64>; > + d-cache-sets =3D <64>; > + d-cache-size =3D <32768>; > + d-tlb-sets =3D <1>; > + d-tlb-size =3D <32>; > + device_type =3D "cpu"; > + i-cache-block-size =3D <64>; > + i-cache-sets =3D <64>; > + i-cache-size =3D <32768>; > + i-tlb-sets =3D <1>; > + i-tlb-size =3D <32>; > + mmu-type =3D "riscv,sv39"; > + reg =3D <4>; > + riscv,isa =3D "rv64imafdc"; > + tlb-split; > + cpu4_intc: interrupt-controller { > + #interrupt-cells =3D <1>; > + compatible =3D "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + }; > + soc { > + #address-cells =3D <2>; > + #size-cells =3D <2>; > + compatible =3D "sifive,fu540-c000", "sifive,fu540", "simple-bus"; > + ranges; > + plic0: interrupt-controller@c000000 { > + #interrupt-cells =3D <1>; > + compatible =3D "sifive,plic-1.0.0"; > + reg =3D <0x0 0xc000000 0x0 0x4000000>; > + riscv,ndev =3D <53>; > + interrupt-controller; > + interrupts-extended =3D < > + &cpu0_intc 0xffffffff > + &cpu1_intc 0xffffffff &cpu1_intc 9 > + &cpu2_intc 0xffffffff &cpu2_intc 9 > + &cpu3_intc 0xffffffff &cpu3_intc 9 > + &cpu4_intc 0xffffffff &cpu4_intc 9>; > + }; > + prci: clock-controller@10000000 { > + compatible =3D "sifive,fu540-c000-prci"; > + reg =3D <0x0 0x10000000 0x0 0x1000>; > + clocks =3D <&hfclk>, <&rtcclk>; > + #clock-cells =3D <1>; > + }; > + uart0: serial@10010000 { > + compatible =3D "sifive,fu540-c000-uart", "sifive,uart0"; > + reg =3D <0x0 0x10010000 0x0 0x1000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <4>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + status =3D "disabled"; > + }; > + uart1: serial@10011000 { > + compatible =3D "sifive,fu540-c000-uart", "sifive,uart0"; > + reg =3D <0x0 0x10011000 0x0 0x1000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <5>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + status =3D "disabled"; > + }; > + i2c0: i2c@10030000 { > + compatible =3D "sifive,fu540-c000-i2c", "sifive,i2c0"; > + reg =3D <0x0 0x10030000 0x0 0x1000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <50>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + reg-shift =3D <2>; > + reg-io-width =3D <1>; > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + status =3D "disabled"; > + }; > + qspi0: spi@10040000 { > + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; > + reg =3D <0x0 0x10040000 0x0 0x1000 > + 0x0 0x20000000 0x0 0x10000000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <51>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + status =3D "disabled"; > + }; > + qspi1: spi@10041000 { > + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; > + reg =3D <0x0 0x10041000 0x0 0x1000 > + 0x0 0x30000000 0x0 0x10000000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <52>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + status =3D "disabled"; > + }; > + qspi2: spi@10050000 { > + compatible =3D "sifive,fu540-c000-spi", "sifive,spi0"; > + reg =3D <0x0 0x10050000 0x0 0x1000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <6>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + status =3D "disabled"; > + }; > + eth0: ethernet@10090000 { > + compatible =3D "sifive,fu540-c000-gem"; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <53>; > + reg =3D <0x0 0x10090000 0x0 0x2000 > + 0x0 0x100a0000 0x0 0x1000>; > + local-mac-address =3D [00 00 00 00 00 00]; > + clock-names =3D "pclk", "hclk"; > + clocks =3D <&prci PRCI_CLK_GEMGXLPLL>, > + <&prci PRCI_CLK_GEMGXLPLL>; > + #address-cells =3D <1>; > + #size-cells =3D <0>; > + status =3D "disabled"; > + }; > + pwm0: pwm@10020000 { > + compatible =3D "sifive,fu540-c000-pwm", "sifive,pwm0"; > + reg =3D <0x0 0x10020000 0x0 0x1000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <42 43 44 45>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + #pwm-cells =3D <3>; > + status =3D "disabled"; > + }; > + pwm1: pwm@10021000 { > + compatible =3D "sifive,fu540-c000-pwm", "sifive,pwm0"; > + reg =3D <0x0 0x10021000 0x0 0x1000>; > + interrupt-parent =3D <&plic0>; > + interrupts =3D <46 47 48 49>; > + clocks =3D <&prci PRCI_CLK_TLCLK>; > + #pwm-cells =3D <3>; > + status =3D "disabled"; > + }; > + > + }; > +}; > =20 > Copied: head/riscv/sifive/hifive-unleashed-a00.dts (from r355185, ven= dor/device-tree/dist/src/riscv/sifive/hifive-unleashed-a00.dts) > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/riscv/sifive/hifive-unleashed-a00.dts Thu Nov 28 19:38:57 20= 19 (r355188, copy of r355185, vendor/device-tree/dist/src/riscv/sifive/hifi= ve-unleashed-a00.dts) > @@ -0,0 +1,96 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* Copyright (c) 2018-2019 SiFive, Inc */ > + > +#include "fu540-c000.dtsi" > + > +/* Clock frequency (in Hz) of the PCB crystal for rtcclk */ > +#define RTCCLK_FREQ 1000000 > + > +/ { > + #address-cells =3D <2>; > + #size-cells =3D <2>; > + model =3D "SiFive HiFive Unleashed A00"; > + compatible =3D "sifive,hifive-unleashed-a00", "sifive,fu540-c000"; > + > + chosen { > + stdout-path =3D "serial0"; > + }; > + > + cpus { > + timebase-frequency =3D ; > + }; > + > + memory@80000000 { > + device_type =3D "memory"; > + reg =3D <0x0 0x80000000 0x2 0x00000000>; > + }; > + > + soc { > + }; > + > + hfclk: hfclk { > + #clock-cells =3D <0>; > + compatible =3D "fixed-clock"; > + clock-frequency =3D <33333333>; > + clock-output-names =3D "hfclk"; > + }; > + > + rtcclk: rtcclk { > + #clock-cells =3D <0>; > + compatible =3D "fixed-clock"; > + clock-frequency =3D ; > + clock-output-names =3D "rtcclk"; > + }; > +}; > + > +&uart0 { > + status =3D "okay"; > +}; > + > +&uart1 { > + status =3D "okay"; > +}; > + > +&i2c0 { > + status =3D "okay"; > +}; > + > +&qspi0 { > + status =3D "okay"; > + flash@0 { > + compatible =3D "issi,is25wp256", "jedec,spi-nor"; > + reg =3D <0>; > + spi-max-frequency =3D <50000000>; > + m25p,fast-read; > + spi-tx-bus-width =3D <4>; > + spi-rx-bus-width =3D <4>; > + }; > +}; > + > +&qspi2 { > + status =3D "okay"; > + mmc@0 { > + compatible =3D "mmc-spi-slot"; > + reg =3D <0>; > + spi-max-frequency =3D <20000000>; > + voltage-ranges =3D <3300 3300>; > + disable-wp; > + }; > +}; > + > +ð0 { > + status =3D "okay"; > + phy-mode =3D "gmii"; > + phy-handle =3D <&phy0>; > + phy0: ethernet-phy@0 { > + reg =3D <0>; > + }; > +}; > + > +&pwm0 { > + status =3D "okay"; > +}; > + > +&pwm1 { > + status =3D "okay"; > +}; > =20 --=20 Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Dec 3 09:15:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 688DE1CEEEE; Tue, 3 Dec 2019 09:15:26 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47RxCf2w6vz483c; Tue, 3 Dec 2019 09:15:26 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id D82631BC6C; Tue, 3 Dec 2019 09:15:24 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Tue, 03 Dec 2019 01:15:20 -0800 Subject: Re: svn commit: r355188 - in head/riscv: . sifive From: Ravi Pokala To: Emmanuel Vadot CC: Emmanuel Vadot , , , Message-ID: <1D30F428-F94A-4596-AA85-33926AF2B08E@panasas.com> Thread-Topic: svn commit: r355188 - in head/riscv: . sifive References: <201911281938.xASJcv3a034087@repo.freebsd.org> <3C503BF7-6D49-4FD2-B2C4-55C890FA8458@panasas.com> <20191203101345.53896cce499ee685000e661a@bidouilliste.com> In-Reply-To: <20191203101345.53896cce499ee685000e661a@bidouilliste.com> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 09:15:26 -0000 -----Original Message----- From: Emmanuel Vadot Date: 2019-12-03, Tuesday at 01:13 To: Ravi Pokala Cc: Emmanuel Vadot , , , Subject: Re: svn commit: r355188 - in head/riscv: . sifive On Mon, 02 Dec 2019 13:36:06 -0800 Ravi Pokala wrote: > Hi Manu, > > This creates a top-level "riscv" directory, but there are no other top-level ${TARGET} directories. > > It looks like other *.dts and *.dtsi files live in either > > sys/dts/${TARGET} > > or > > sys/gnu/dts/${TARGET}/(vendor/)? > > So perhaps these should be moved to one of those directories, as appropriate? > > Thanks, > > Ravi (rpokala@) Thanks, I don't know how I didn't see that ... fixed with revert + r355324. Thank you! -Ravi (rpokala@) > ?-----Original Message----- > From: on behalf of Emmanuel Vadot > Date: 2019-11-28, Thursday at 11:38 > To: , , > Subject: svn commit: r355188 - in head/riscv: . sifive > > Author: manu > Date: Thu Nov 28 19:38:57 2019 > New Revision: 355188 > URL: https://svnweb.freebsd.org/changeset/base/355188 > > Log: > Import riscv DTS files > > Requested by: mhorne > > Added: > head/riscv/ > - copied from r355184, vendor/device-tree/dist/src/riscv/ > Replaced: > head/riscv/sifive/fu540-c000.dtsi > - copied unchanged from r355185, vendor/device-tree/dist/src/riscv/sifive/fu540-c000.dtsi > head/riscv/sifive/hifive-unleashed-a00.dts > - copied unchanged from r355185, vendor/device-tree/dist/src/riscv/sifive/hifive-unleashed-a00.dts > > Copied: head/riscv/sifive/fu540-c000.dtsi (from r355185, vendor/device-tree/dist/src/riscv/sifive/fu540-c000.dtsi) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/riscv/sifive/fu540-c000.dtsi Thu Nov 28 19:38:57 2019 (r355188, copy of r355185, vendor/device-tree/dist/src/riscv/sifive/fu540-c000.dtsi) > @@ -0,0 +1,251 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* Copyright (c) 2018-2019 SiFive, Inc */ > + > +/dts-v1/; > + > +#include > + > +/ { > + #address-cells = <2>; > + #size-cells = <2>; > + compatible = "sifive,fu540-c000", "sifive,fu540"; > + > + aliases { > + serial0 = &uart0; > + serial1 = &uart1; > + ethernet0 = ð0; > + }; > + > + chosen { > + }; > + > + cpus { > + #address-cells = <1>; > + #size-cells = <0>; > + cpu0: cpu@0 { > + compatible = "sifive,e51", "sifive,rocket0", "riscv"; > + device_type = "cpu"; > + i-cache-block-size = <64>; > + i-cache-sets = <128>; > + i-cache-size = <16384>; > + reg = <0>; > + riscv,isa = "rv64imac"; > + status = "disabled"; > + cpu0_intc: interrupt-controller { > + #interrupt-cells = <1>; > + compatible = "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu1: cpu@1 { > + compatible = "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size = <64>; > + d-cache-sets = <64>; > + d-cache-size = <32768>; > + d-tlb-sets = <1>; > + d-tlb-size = <32>; > + device_type = "cpu"; > + i-cache-block-size = <64>; > + i-cache-sets = <64>; > + i-cache-size = <32768>; > + i-tlb-sets = <1>; > + i-tlb-size = <32>; > + mmu-type = "riscv,sv39"; > + reg = <1>; > + riscv,isa = "rv64imafdc"; > + tlb-split; > + cpu1_intc: interrupt-controller { > + #interrupt-cells = <1>; > + compatible = "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu2: cpu@2 { > + compatible = "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size = <64>; > + d-cache-sets = <64>; > + d-cache-size = <32768>; > + d-tlb-sets = <1>; > + d-tlb-size = <32>; > + device_type = "cpu"; > + i-cache-block-size = <64>; > + i-cache-sets = <64>; > + i-cache-size = <32768>; > + i-tlb-sets = <1>; > + i-tlb-size = <32>; > + mmu-type = "riscv,sv39"; > + reg = <2>; > + riscv,isa = "rv64imafdc"; > + tlb-split; > + cpu2_intc: interrupt-controller { > + #interrupt-cells = <1>; > + compatible = "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu3: cpu@3 { > + compatible = "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size = <64>; > + d-cache-sets = <64>; > + d-cache-size = <32768>; > + d-tlb-sets = <1>; > + d-tlb-size = <32>; > + device_type = "cpu"; > + i-cache-block-size = <64>; > + i-cache-sets = <64>; > + i-cache-size = <32768>; > + i-tlb-sets = <1>; > + i-tlb-size = <32>; > + mmu-type = "riscv,sv39"; > + reg = <3>; > + riscv,isa = "rv64imafdc"; > + tlb-split; > + cpu3_intc: interrupt-controller { > + #interrupt-cells = <1>; > + compatible = "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + cpu4: cpu@4 { > + compatible = "sifive,u54-mc", "sifive,rocket0", "riscv"; > + d-cache-block-size = <64>; > + d-cache-sets = <64>; > + d-cache-size = <32768>; > + d-tlb-sets = <1>; > + d-tlb-size = <32>; > + device_type = "cpu"; > + i-cache-block-size = <64>; > + i-cache-sets = <64>; > + i-cache-size = <32768>; > + i-tlb-sets = <1>; > + i-tlb-size = <32>; > + mmu-type = "riscv,sv39"; > + reg = <4>; > + riscv,isa = "rv64imafdc"; > + tlb-split; > + cpu4_intc: interrupt-controller { > + #interrupt-cells = <1>; > + compatible = "riscv,cpu-intc"; > + interrupt-controller; > + }; > + }; > + }; > + soc { > + #address-cells = <2>; > + #size-cells = <2>; > + compatible = "sifive,fu540-c000", "sifive,fu540", "simple-bus"; > + ranges; > + plic0: interrupt-controller@c000000 { > + #interrupt-cells = <1>; > + compatible = "sifive,plic-1.0.0"; > + reg = <0x0 0xc000000 0x0 0x4000000>; > + riscv,ndev = <53>; > + interrupt-controller; > + interrupts-extended = < > + &cpu0_intc 0xffffffff > + &cpu1_intc 0xffffffff &cpu1_intc 9 > + &cpu2_intc 0xffffffff &cpu2_intc 9 > + &cpu3_intc 0xffffffff &cpu3_intc 9 > + &cpu4_intc 0xffffffff &cpu4_intc 9>; > + }; > + prci: clock-controller@10000000 { > + compatible = "sifive,fu540-c000-prci"; > + reg = <0x0 0x10000000 0x0 0x1000>; > + clocks = <&hfclk>, <&rtcclk>; > + #clock-cells = <1>; > + }; > + uart0: serial@10010000 { > + compatible = "sifive,fu540-c000-uart", "sifive,uart0"; > + reg = <0x0 0x10010000 0x0 0x1000>; > + interrupt-parent = <&plic0>; > + interrupts = <4>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + status = "disabled"; > + }; > + uart1: serial@10011000 { > + compatible = "sifive,fu540-c000-uart", "sifive,uart0"; > + reg = <0x0 0x10011000 0x0 0x1000>; > + interrupt-parent = <&plic0>; > + interrupts = <5>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + status = "disabled"; > + }; > + i2c0: i2c@10030000 { > + compatible = "sifive,fu540-c000-i2c", "sifive,i2c0"; > + reg = <0x0 0x10030000 0x0 0x1000>; > + interrupt-parent = <&plic0>; > + interrupts = <50>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + reg-shift = <2>; > + reg-io-width = <1>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + }; > + qspi0: spi@10040000 { > + compatible = "sifive,fu540-c000-spi", "sifive,spi0"; > + reg = <0x0 0x10040000 0x0 0x1000 > + 0x0 0x20000000 0x0 0x10000000>; > + interrupt-parent = <&plic0>; > + interrupts = <51>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + }; > + qspi1: spi@10041000 { > + compatible = "sifive,fu540-c000-spi", "sifive,spi0"; > + reg = <0x0 0x10041000 0x0 0x1000 > + 0x0 0x30000000 0x0 0x10000000>; > + interrupt-parent = <&plic0>; > + interrupts = <52>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + }; > + qspi2: spi@10050000 { > + compatible = "sifive,fu540-c000-spi", "sifive,spi0"; > + reg = <0x0 0x10050000 0x0 0x1000>; > + interrupt-parent = <&plic0>; > + interrupts = <6>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + }; > + eth0: ethernet@10090000 { > + compatible = "sifive,fu540-c000-gem"; > + interrupt-parent = <&plic0>; > + interrupts = <53>; > + reg = <0x0 0x10090000 0x0 0x2000 > + 0x0 0x100a0000 0x0 0x1000>; > + local-mac-address = [00 00 00 00 00 00]; > + clock-names = "pclk", "hclk"; > + clocks = <&prci PRCI_CLK_GEMGXLPLL>, > + <&prci PRCI_CLK_GEMGXLPLL>; > + #address-cells = <1>; > + #size-cells = <0>; > + status = "disabled"; > + }; > + pwm0: pwm@10020000 { > + compatible = "sifive,fu540-c000-pwm", "sifive,pwm0"; > + reg = <0x0 0x10020000 0x0 0x1000>; > + interrupt-parent = <&plic0>; > + interrupts = <42 43 44 45>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + #pwm-cells = <3>; > + status = "disabled"; > + }; > + pwm1: pwm@10021000 { > + compatible = "sifive,fu540-c000-pwm", "sifive,pwm0"; > + reg = <0x0 0x10021000 0x0 0x1000>; > + interrupt-parent = <&plic0>; > + interrupts = <46 47 48 49>; > + clocks = <&prci PRCI_CLK_TLCLK>; > + #pwm-cells = <3>; > + status = "disabled"; > + }; > + > + }; > +}; > > Copied: head/riscv/sifive/hifive-unleashed-a00.dts (from r355185, vendor/device-tree/dist/src/riscv/sifive/hifive-unleashed-a00.dts) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/riscv/sifive/hifive-unleashed-a00.dts Thu Nov 28 19:38:57 2019 (r355188, copy of r355185, vendor/device-tree/dist/src/riscv/sifive/hifive-unleashed-a00.dts) > @@ -0,0 +1,96 @@ > +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > +/* Copyright (c) 2018-2019 SiFive, Inc */ > + > +#include "fu540-c000.dtsi" > + > +/* Clock frequency (in Hz) of the PCB crystal for rtcclk */ > +#define RTCCLK_FREQ 1000000 > + > +/ { > + #address-cells = <2>; > + #size-cells = <2>; > + model = "SiFive HiFive Unleashed A00"; > + compatible = "sifive,hifive-unleashed-a00", "sifive,fu540-c000"; > + > + chosen { > + stdout-path = "serial0"; > + }; > + > + cpus { > + timebase-frequency = ; > + }; > + > + memory@80000000 { > + device_type = "memory"; > + reg = <0x0 0x80000000 0x2 0x00000000>; > + }; > + > + soc { > + }; > + > + hfclk: hfclk { > + #clock-cells = <0>; > + compatible = "fixed-clock"; > + clock-frequency = <33333333>; > + clock-output-names = "hfclk"; > + }; > + > + rtcclk: rtcclk { > + #clock-cells = <0>; > + compatible = "fixed-clock"; > + clock-frequency = ; > + clock-output-names = "rtcclk"; > + }; > +}; > + > +&uart0 { > + status = "okay"; > +}; > + > +&uart1 { > + status = "okay"; > +}; > + > +&i2c0 { > + status = "okay"; > +}; > + > +&qspi0 { > + status = "okay"; > + flash@0 { > + compatible = "issi,is25wp256", "jedec,spi-nor"; > + reg = <0>; > + spi-max-frequency = <50000000>; > + m25p,fast-read; > + spi-tx-bus-width = <4>; > + spi-rx-bus-width = <4>; > + }; > +}; > + > +&qspi2 { > + status = "okay"; > + mmc@0 { > + compatible = "mmc-spi-slot"; > + reg = <0>; > + spi-max-frequency = <20000000>; > + voltage-ranges = <3300 3300>; > + disable-wp; > + }; > +}; > + > +ð0 { > + status = "okay"; > + phy-mode = "gmii"; > + phy-handle = <&phy0>; > + phy0: ethernet-phy@0 { > + reg = <0>; > + }; > +}; > + > +&pwm0 { > + status = "okay"; > +}; > + > +&pwm1 { > + status = "okay"; > +}; > -- Emmanuel Vadot From owner-svn-src-all@freebsd.org Tue Dec 3 09:48:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFD5B1CFA0B; Tue, 3 Dec 2019 09:48:43 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Rxy368YQz49T2; Tue, 3 Dec 2019 09:48:43 +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 B1ACCDE3F; Tue, 3 Dec 2019 09:48:43 +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 xB39mhie038263; Tue, 3 Dec 2019 09:48:43 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB39mhlw038262; Tue, 3 Dec 2019 09:48:43 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201912030948.xB39mhlw038262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 3 Dec 2019 09:48:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355325 - head/lib/libdevstat X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/lib/libdevstat X-SVN-Commit-Revision: 355325 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 09:48:44 -0000 Author: avg Date: Tue Dec 3 09:48:43 2019 New Revision: 355325 URL: https://svnweb.freebsd.org/changeset/base/355325 Log: devstat_selectdevs: resize dev_select only after copying data out of it The resizing could be a downsizing so some data would be lost and we could attempt to read past the end of the new memory allocation. MFC after: 2 weeks Sponsored by: Panzura Modified: head/lib/libdevstat/devstat.c Modified: head/lib/libdevstat/devstat.c ============================================================================== --- head/lib/libdevstat/devstat.c Tue Dec 3 09:12:53 2019 (r355324) +++ head/lib/libdevstat/devstat.c Tue Dec 3 09:48:43 2019 (r355325) @@ -584,10 +584,10 @@ devstat_selectdevs(struct device_selection **dev_selec * In this case, we have selected devices before, but the device * list has changed since we last selected devices, so we need to * either enlarge or reduce the size of the device selection list. + * But delay the resizing until after copying the data to old_dev_select + * as to not lose any data in the case of reducing the size. */ } else if (*num_selections != numdevs) { - *dev_select = (struct device_selection *)reallocf(*dev_select, - numdevs * sizeof(struct device_selection)); *select_generation = current_generation; init_selections = 1; /* @@ -643,6 +643,11 @@ devstat_selectdevs(struct device_selection **dev_selec old_num_selections = *num_selections; bcopy(*dev_select, old_dev_select, sizeof(struct device_selection) * *num_selections); + } + + if (!changed && *num_selections != numdevs) { + *dev_select = (struct device_selection *)reallocf(*dev_select, + numdevs * sizeof(struct device_selection)); } if (init_selections != 0) { From owner-svn-src-all@freebsd.org Tue Dec 3 13:48:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4504D1AF768; Tue, 3 Dec 2019 13:48:03 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S3GC1bk4z4PJZ; Tue, 3 Dec 2019 13:48:03 +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 15BB918943; Tue, 3 Dec 2019 13:48:03 +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 xB3Dm3DP081627; Tue, 3 Dec 2019 13:48:03 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3DllgD081603; Tue, 3 Dec 2019 13:47:47 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912031347.xB3DllgD081603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 3 Dec 2019 13:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355326 - in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Commit-Revision: 355326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 13:48:03 -0000 Author: cy Date: Tue Dec 3 13:47:46 2019 New Revision: 355326 URL: https://svnweb.freebsd.org/changeset/base/355326 Log: MFC r354269: MFV r354257: Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100) Modified: stable/11/contrib/sqlite3/Makefile.msc stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/sqlite3ext.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac stable/11/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/sqlite3/Makefile.msc stable/12/contrib/sqlite3/configure stable/12/contrib/sqlite3/configure.ac stable/12/contrib/sqlite3/shell.c stable/12/contrib/sqlite3/sqlite3.c stable/12/contrib/sqlite3/sqlite3.h stable/12/contrib/sqlite3/sqlite3ext.h stable/12/contrib/sqlite3/tea/configure stable/12/contrib/sqlite3/tea/configure.ac stable/12/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/sqlite3/Makefile.msc ============================================================================== --- stable/11/contrib/sqlite3/Makefile.msc Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/Makefile.msc Tue Dec 3 13:47:46 2019 (r355326) @@ -73,7 +73,7 @@ API_ARMOR = 0 !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206 -NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706 +NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 !ENDIF !ENDIF Modified: stable/11/contrib/sqlite3/configure ============================================================================== --- stable/11/contrib/sqlite3/configure Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/configure Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.30.1. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.29.0' -PACKAGE_STRING='sqlite 3.29.0' +PACKAGE_VERSION='3.30.1' +PACKAGE_STRING='sqlite 3.30.1' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.29.0:";; + short | recursive ) echo "Configuration of sqlite 3.30.1:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.29.0 +sqlite configure 3.30.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.29.0, which was +It was created by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.29.0' + VERSION='3.30.1' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.29.0, which was +This file was extended by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.29.0 +sqlite config.status 3.30.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/11/contrib/sqlite3/configure.ac ============================================================================== --- stable/11/contrib/sqlite3/configure.ac Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/configure.ac Tue Dec 3 13:47:46 2019 (r355326) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.30.1, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: stable/11/contrib/sqlite3/shell.c ============================================================================== --- stable/11/contrib/sqlite3/shell.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/shell.c Tue Dec 3 13:47:46 2019 (r355326) @@ -9801,12 +9801,12 @@ static void editFunc( } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ - x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_blob(argv[0]), 1, (size_t)sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; - x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f); } fclose(f); f = 0; @@ -9834,12 +9834,12 @@ static void editFunc( fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); - p = sqlite3_malloc64( sz+(bBin==0) ); + p = sqlite3_malloc64( sz+1 ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } - x = fread(p, 1, sz, f); + x = fread(p, 1, (size_t)sz, f); fclose(f); f = 0; if( x!=sz ){ @@ -10311,7 +10311,8 @@ static void eqp_render_level(ShellState *p, int iEqpId for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; - utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); + utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, + pNext ? "|--" : "`--", z); if( n<(int)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); @@ -10502,7 +10503,7 @@ static int shell_callback( while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ - for(i=j=0; (c = z[i])!=0; i++){ /* Copy changes from z[i] back to z[j] */ + for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */ if( c==cEnd ){ cEnd = 0; }else if( c=='"' || c=='\'' || c=='`' ){ @@ -11081,7 +11082,7 @@ static int display_stats( raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE, bReset); + iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); raw_printf(pArg->out, "Number of times run: %d\n", iCur); @@ -12004,20 +12005,20 @@ static const char *(azHelp[]) = { ".archive ... Manage SQL archives", " Each command must have exactly one of the following options:", " -c, --create Create a new archive", - " -u, --update Add files or update files with changed mtime", - " -i, --insert Like -u but always add even if mtime unchanged", + " -u, --update Add or update files with changed mtime", + " -i, --insert Like -u but always add even if unchanged", " -t, --list List contents of archive", " -x, --extract Extract files from archive", " Optional arguments:", " -v, --verbose Print each filename as it is processed", - " -f FILE, --file FILE Operate on archive FILE (default is current db)", - " -a FILE, --append FILE Operate on FILE opened using the apndvfs VFS", - " -C DIR, --directory DIR Change to directory DIR to read/extract files", + " -f FILE, --file FILE Use archive FILE (default is current db)", + " -a FILE, --append FILE Open FILE using the apndvfs VFS", + " -C DIR, --directory DIR Read/extract files from directory DIR", " -n, --dryrun Show the SQL that would have occurred", " Examples:", - " .ar -cf archive.sar foo bar # Create archive.sar from files foo and bar", - " .ar -tf archive.sar # List members of archive.sar", - " .ar -xvf archive.sar # Verbosely extract files from archive.sar", + " .ar -cf ARCHIVE foo bar # Create ARCHIVE from files foo and bar", + " .ar -tf ARCHIVE # List members of ARCHIVE", + " .ar -xvf ARCHIVE # Verbosely extract files from ARCHIVE", " See also:", " http://sqlite.org/cli.html#sqlar_archive_support", #endif @@ -12026,7 +12027,7 @@ static const char *(azHelp[]) = { #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", " --append Use the appendvfs", - " --async Write to FILE without a journal and without fsync()", + " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", ".binary on|off Turn binary output on or off. Default OFF", ".cd DIRECTORY Change the working directory to DIRECTORY", @@ -12046,15 +12047,15 @@ static const char *(azHelp[]) = { " Other Modes:", #ifdef SQLITE_DEBUG " test Show raw EXPLAIN QUERY PLAN output", - " trace Like \"full\" but also enable \"PRAGMA vdbe_trace\"", + " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"", #endif " trigger Like \"full\" but also show trigger bytecode", - ".excel Display the output of next command in a spreadsheet", + ".excel Display the output of next command in spreadsheet", ".exit ?CODE? Exit this program with return-code CODE", - ".expert EXPERIMENTAL. Suggest indexes for specified queries", + ".expert EXPERIMENTAL. Suggest indexes for queries", /* Because explain mode comes on automatically now, the ".explain" mode -** is removed from the help screen. It is still supported for legacy, however */ -/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic",*/ +** is removed from the help screen. It is still supported for legacy, however */ +/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off",*/ ".filectrl CMD ... Run various sqlite3_file_control() operations", " Run \".filectrl\" with no arguments for details", ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", @@ -12101,7 +12102,7 @@ static const char *(azHelp[]) = { " --append Use appendvfs to append database to the end of FILE", #ifdef SQLITE_ENABLE_DESERIALIZE " --deserialize Load into memory useing sqlite3_deserialize()", - " --hexdb Load the output of \"dbtotxt\" as an in-memory database", + " --hexdb Load the output of \"dbtotxt\" as an in-memory db", " --maxsize N Maximum size for --hexdb or --deserialized database", #endif " --new Initialize FILE to an empty database", @@ -12114,7 +12115,7 @@ static const char *(azHelp[]) = { " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", - " PARAMETER should start with '$', ':', '@', or '?'", + " PARAMETER should start with one of: $ : @ ?", " unset PARAMETER Remove PARAMETER from the binding table", ".print STRING... Print literal STRING", #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -12129,6 +12130,11 @@ static const char *(azHelp[]) = { ".read FILE Read input from FILE", #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ".recover Recover as much data as possible from corrupt db.", + " --freelist-corrupt Assume the freelist is corrupt", + " --recovery-db NAME Store recovery metadata in database file NAME", + " --lost-and-found TABLE Alternative name for the lost-and-found table", + " --no-rowids Do not attempt to recover rowid values", + " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", ".save FILE Write in-memory database into FILE", @@ -12160,7 +12166,7 @@ static const char *(azHelp[]) = { " Options:", " --schema Also hash the sqlite_master table", " --sha3-224 Use the sha3-224 algorithm", - " --sha3-256 Use the sha3-256 algorithm. This is the default.", + " --sha3-256 Use the sha3-256 algorithm (default)", " --sha3-384 Use the sha3-384 algorithm", " --sha3-512 Use the sha3-512 algorithm", " Any other argument is a LIKE pattern for tables to hash", @@ -12194,6 +12200,10 @@ static const char *(azHelp[]) = { " --row Trace each row (SQLITE_TRACE_ROW)", " --close Trace connection close (SQLITE_TRACE_CLOSE)", #endif /* SQLITE_OMIT_TRACE */ +#ifdef SQLITE_DEBUG + ".unmodule NAME ... Unregister virtual table modules", + " --allexcept Unregister everything except those named", +#endif ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", @@ -12436,6 +12446,8 @@ static unsigned char *readHexDb(ShellState *p, int *pn rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz); if( rc!=2 ) goto readHexDb_error; if( n<0 ) goto readHexDb_error; + if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error; + n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */ a = sqlite3_malloc( n ? n : 1 ); if( a==0 ){ utf8_printf(stderr, "Out of memory!\n"); @@ -12521,6 +12533,23 @@ static void shellInt32( } /* +** Scalar function "shell_idquote(X)" returns string X quoted as an identifier, +** using "..." with internal double-quote characters doubled. +*/ +static void shellIdQuote( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const char *zName = (const char*)sqlite3_value_text(argv[0]); + UNUSED_PARAMETER(argc); + if( zName ){ + char *z = sqlite3_mprintf("\"%w\"", zName); + sqlite3_result_text(context, z, -1, sqlite3_free); + } +} + +/* ** Scalar function "shell_escape_crnl" used by the .recover command. ** The argument passed to this function is the output of built-in ** function quote(). If the first character of the input is "'", @@ -12696,6 +12725,8 @@ static void open_db(ShellState *p, int openFlags){ shellEscapeCrnl, 0, 0); sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0, shellInt32, 0, 0); + sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); #ifndef SQLITE_NOHAVE_SYSTEM sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0, editFunc, 0, 0); @@ -14043,7 +14074,7 @@ void shellReset( #endif /* !defined SQLITE_OMIT_VIRTUALTABLE */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) -/********************************************************************************* +/****************************************************************************** ** The ".archive" or ".ar" command. */ /* @@ -14241,7 +14272,8 @@ static int arParseCommand( i = n; }else{ if( iArg>=(nArg-1) ){ - return arErrorMsg(pAr, "option requires an argument: %c",z[i]); + return arErrorMsg(pAr, "option requires an argument: %c", + z[i]); } zArg = azArg[++iArg]; } @@ -14629,10 +14661,10 @@ end_ar_transaction: ** Implementation of ".ar" dot command. */ static int arDotCommand( - ShellState *pState, /* Current shell tool state */ - int fromCmdLine, /* True if -A command-line option, not .ar cmd */ - char **azArg, /* Array of arguments passed to dot command */ - int nArg /* Number of entries in azArg[] */ + ShellState *pState, /* Current shell tool state */ + int fromCmdLine, /* True if -A command-line option, not .ar cmd */ + char **azArg, /* Array of arguments passed to dot command */ + int nArg /* Number of entries in azArg[] */ ){ ArCommand cmd; int rc; @@ -14732,7 +14764,7 @@ end_ar_command: return rc; } /* End of the ".archive" or ".ar" command logic -**********************************************************************************/ +*******************************************************************************/ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) @@ -14874,6 +14906,10 @@ static RecoverTable *recoverNewTable( rc = sqlite3_open("", &dbtmp); if( rc==SQLITE_OK ){ + sqlite3_create_function(dbtmp, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); + } + if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, "PRAGMA writable_schema = on", 0, 0, 0); } if( rc==SQLITE_OK ){ @@ -14929,18 +14965,18 @@ static RecoverTable *recoverNewTable( } } - pTab->zQuoted = shellMPrintf(&rc, "%Q", zName); + pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName); pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1)); pTab->nCol = nSqlCol; if( bIntkey ){ - pTab->azlCol[0] = shellMPrintf(&rc, "%Q", zPk); + pTab->azlCol[0] = shellMPrintf(&rc, "\"%w\"", zPk); }else{ pTab->azlCol[0] = shellMPrintf(&rc, ""); } i = 1; shellPreparePrintf(dbtmp, &rc, &pStmt, - "SELECT %Q || group_concat(name, ', ') " + "SELECT %Q || group_concat(shell_idquote(name), ', ') " " FILTER (WHERE cid!=%d) OVER (ORDER BY %s cid) " "FROM pragma_table_info(%Q)", bIntkey ? ", " : "", pTab->iPk, @@ -15054,7 +15090,7 @@ static RecoverTable *recoverOrphanTable( pTab = (RecoverTable*)shellMalloc(pRc, sizeof(RecoverTable)); if( pTab ){ - pTab->zQuoted = shellMPrintf(pRc, "%Q", zTab); + pTab->zQuoted = shellMPrintf(pRc, "\"%w\"", zTab); pTab->nCol = nCol; pTab->iPk = -2; if( nCol>0 ){ @@ -15103,6 +15139,7 @@ static int recoverDatabaseCmd(ShellState *pState, int RecoverTable *pOrphan = 0; int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ + int bRowids = 1; /* 0 if --no-rowids */ for(i=1; iout, azArg[0]); return 1; } } @@ -15132,6 +15169,7 @@ static int recoverDatabaseCmd(ShellState *pState, int shellExecPrintf(pState->db, &rc, /* Attach an in-memory database named 'recovery'. Create an indexed ** cache of the sqlite_dbptr virtual table. */ + "PRAGMA writable_schema = on;" "ATTACH %Q AS recovery;" "DROP TABLE IF EXISTS recovery.dbptr;" "DROP TABLE IF EXISTS recovery.freelist;" @@ -15162,7 +15200,22 @@ static int recoverDatabaseCmd(ShellState *pState, int ); } + /* If this is an auto-vacuum database, add all pointer-map pages to + ** the freelist table. Do this regardless of whether or not + ** --freelist-corrupt was specified. */ shellExec(pState->db, &rc, + "WITH ptrmap(pgno) AS (" + " SELECT 2 WHERE shell_int32(" + " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 13" + " )" + " UNION ALL " + " SELECT pgno+1+(SELECT page_size FROM pragma_page_size)/5 AS pp " + " FROM ptrmap WHERE pp<=(SELECT page_count FROM pragma_page_count)" + ")" + "REPLACE INTO recovery.freelist SELECT pgno FROM ptrmap" + ); + + shellExec(pState->db, &rc, "CREATE TABLE recovery.dbptr(" " pgno, child, PRIMARY KEY(child, pgno)" ") WITHOUT ROWID;" @@ -15210,7 +15263,7 @@ static int recoverDatabaseCmd(ShellState *pState, int " )" " SELECT pgno FROM p WHERE (parent IS NULL OR pgno = orig)" ") " - "FROM pages WHERE maxlen > 0 AND i NOT IN freelist;" + "FROM pages WHERE maxlen IS NOT NULL AND i NOT IN freelist;" "UPDATE recovery.map AS o SET intkey = (" " SELECT substr(data, 1, 1)==X'0D' FROM sqlite_dbpage WHERE pgno=o.pgno" ");" @@ -15235,6 +15288,11 @@ static int recoverDatabaseCmd(ShellState *pState, int ** CREATE TABLE statements that extracted from the existing schema. */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; + /* ".recover" might output content in an order which causes immediate + ** foreign key constraints to be violated. So disable foreign-key + ** constraint enforcement to prevent problems when running the output + ** script. */ + raw_printf(pState->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(pState->out, "BEGIN;\n"); raw_printf(pState->out, "PRAGMA writable_schema = on;\n"); shellPrepare(pState->db, &rc, @@ -15265,8 +15323,12 @@ static int recoverDatabaseCmd(ShellState *pState, int shellPrepare(pState->db, &rc, "SELECT pgno FROM recovery.map WHERE root=?", &pPages ); + shellPrepare(pState->db, &rc, - "SELECT max(field), group_concat(shell_escape_crnl(quote(value)), ', ')" + "SELECT max(field), group_concat(shell_escape_crnl(quote" + "(case when (? AND field<0) then NULL else value end)" + "), ', ')" + ", min(field) " "FROM sqlite_dbdata WHERE pgno = ? AND field != ?" "GROUP BY cell", &pCells ); @@ -15285,6 +15347,7 @@ static int recoverDatabaseCmd(ShellState *pState, int int bNoop = 0; RecoverTable *pTab; + assert( bIntkey==0 || bIntkey==1 ); pTab = recoverFindTable(pState, &rc, iRoot, bIntkey, nCol, &bNoop); if( bNoop || rc ) continue; if( pTab==0 ){ @@ -15295,29 +15358,44 @@ static int recoverDatabaseCmd(ShellState *pState, int if( pTab==0 ) break; } - if( 0==sqlite3_stricmp(pTab->zQuoted, "'sqlite_sequence'") ){ + if( 0==sqlite3_stricmp(pTab->zQuoted, "\"sqlite_sequence\"") ){ raw_printf(pState->out, "DELETE FROM sqlite_sequence;\n"); } sqlite3_bind_int(pPages, 1, iRoot); - sqlite3_bind_int(pCells, 2, pTab->iPk); + if( bRowids==0 && pTab->iPk<0 ){ + sqlite3_bind_int(pCells, 1, 1); + }else{ + sqlite3_bind_int(pCells, 1, 0); + } + sqlite3_bind_int(pCells, 3, pTab->iPk); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPages) ){ int iPgno = sqlite3_column_int(pPages, 0); - sqlite3_bind_int(pCells, 1, iPgno); + sqlite3_bind_int(pCells, 2, iPgno); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pCells) ){ int nField = sqlite3_column_int(pCells, 0); + int iMin = sqlite3_column_int(pCells, 2); const char *zVal = (const char*)sqlite3_column_text(pCells, 1); + RecoverTable *pTab2 = pTab; + if( pTab!=pOrphan && (iMin<0)!=bIntkey ){ + if( pOrphan==0 ){ + pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); + } + pTab2 = pOrphan; + if( pTab2==0 ) break; + } + nField = nField+1; - if( pTab==pOrphan ){ + if( pTab2==pOrphan ){ raw_printf(pState->out, "INSERT INTO %s VALUES(%d, %d, %d, %s%s%s);\n", - pTab->zQuoted, iRoot, iPgno, nField, - bIntkey ? "" : "NULL, ", zVal, pTab->azlCol[nField] + pTab2->zQuoted, iRoot, iPgno, nField, + iMin<0 ? "" : "NULL, ", zVal, pTab2->azlCol[nField] ); }else{ raw_printf(pState->out, "INSERT INTO %s(%s) VALUES( %s );\n", - pTab->zQuoted, pTab->azlCol[nField], zVal + pTab2->zQuoted, pTab2->azlCol[nField], zVal ); } } @@ -15376,7 +15454,7 @@ static int do_meta_command(char *zLine, ShellState *p) int nArg = 0; int n, c; int rc = 0; - char *azArg[50]; + char *azArg[52]; #ifndef SQLITE_OMIT_VIRTUALTABLE if( p->expert.pExpert ){ @@ -15386,7 +15464,7 @@ static int do_meta_command(char *zLine, ShellState *p) /* Parse the input line into tokens. */ - while( zLine[h] && nArgout, "ANALYZE sqlite_master;\n"); @@ -16615,12 +16693,8 @@ static int do_meta_command(char *zLine, ShellState *p) ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && strcmp(azArg[1],"clear")==0 ){ - int wrSchema = 0; - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", 0, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); }else /* .parameter list @@ -16933,7 +17007,7 @@ static int do_meta_command(char *zLine, ShellState *p) zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, '\''); }else{ appendText(&sSelect, "NULL", 0); } @@ -16942,15 +17016,16 @@ static int do_meta_command(char *zLine, ShellState *p) appendText(&sSelect, " AS snum, ", 0); appendText(&sSelect, zDb, '\''); appendText(&sSelect, " AS sname FROM ", 0); - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, quoteChar(zDb)); appendText(&sSelect, ".sqlite_master", 0); } sqlite3_finalize(pStmt); -#ifdef SQLITE_INTROSPECTION_PRAGMAS +#ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS if( zName ){ appendText(&sSelect, " UNION ALL SELECT shell_module_schema(name)," - " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", 0); + " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", + 0); } #endif appendText(&sSelect, ") WHERE ", 0); @@ -17049,7 +17124,8 @@ static int do_meta_command(char *zLine, ShellState *p) if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ - utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", azCmd[1]); + utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", + azCmd[1]); }else{ int szChng; void *pChng; @@ -17370,8 +17446,7 @@ static int do_meta_command(char *zLine, ShellState *p) { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); - raw_printf(stderr, "Should be one of: --schema" - " --sha3-224 --sha3-256 --sha3-384 --sha3-512\n"); + showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } @@ -17417,8 +17492,7 @@ static int do_meta_command(char *zLine, ShellState *p) }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); - }else if( strcmp(zTab, "sqlite_stat3")==0 - || strcmp(zTab, "sqlite_stat4")==0 ){ + }else if( strcmp(zTab, "sqlite_stat4")==0 ){ appendText(&sQuery, "SELECT * FROM ", 0); appendText(&sQuery, zTab, 0); appendText(&sQuery, " ORDER BY tbl, idx, rowid;\n", 0); @@ -17650,25 +17724,26 @@ static int do_meta_command(char *zLine, ShellState *p) int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { - { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, - { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, - /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ - /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ - { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, - /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */ - { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, - { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, - { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, - { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, + { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, + { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, + /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ + /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ + { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, + { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" }, + /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/ + { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, + { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, + { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, + { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, + { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, #ifdef YYCOVERAGE - { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, + { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, #endif - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET, "" }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, - { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE" }, + { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, + { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, + { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, + { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" }, + { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE"}, }; int testctrl = -1; int iCtrl = -1; @@ -17749,6 +17824,27 @@ static int do_meta_command(char *zLine, ShellState *p) } break; + /* sqlite3_test_control(int, int, sqlite3*) */ + case SQLITE_TESTCTRL_PRNG_SEED: + if( nArg==3 || nArg==4 ){ + int ii = (int)integerValue(azArg[2]); + sqlite3 *db; + if( ii==0 && strcmp(azArg[2],"random")==0 ){ + sqlite3_randomness(sizeof(ii),&ii); + printf("-- random seed: %d\n", ii); + } + if( nArg==3 ){ + db = 0; + }else{ + db = p->db; + /* Make sure the schema has been loaded */ + sqlite3_table_column_metadata(db, 0, "x", 0, 0, 0, 0, 0, 0); + } + rc2 = sqlite3_test_control(testctrl, ii, db); + isOk = 3; + } + break; + /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: @@ -17790,7 +17886,7 @@ static int do_meta_command(char *zLine, ShellState *p) } } if( isOk==0 && iCtrl>=0 ){ - utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd, aCtrl[iCtrl].zUsage); + utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ raw_printf(p->out, "%d\n", rc2); @@ -17868,6 +17964,31 @@ static int do_meta_command(char *zLine, ShellState *p) }else #endif /* !defined(SQLITE_OMIT_TRACE) */ +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE) + if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){ + int ii; + int lenOpt; + char *zOpt; + if( nArg<2 ){ + raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + zOpt = azArg[1]; + if( zOpt[0]=='-' && zOpt[1]=='-' && zOpt[2]!=0 ) zOpt++; + lenOpt = (int)strlen(zOpt); + if( lenOpt>=3 && strncmp(zOpt, "-allexcept",lenOpt)==0 ){ + assert( azArg[nArg]==0 ); + sqlite3_drop_modules(p->db, nArg>2 ? (const char**)(azArg+2) : 0); + }else{ + for(ii=1; iidb, azArg[ii], 0, 0); + } + } + }else +#endif + #if SQLITE_USER_AUTHENTICATION if( c=='u' && strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ @@ -17882,7 +18003,8 @@ static int do_meta_command(char *zLine, ShellState *p) rc = 1; goto meta_command_exit; } - rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); + rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], + strlen30(azArg[3])); if( rc ){ utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); rc = 1; Modified: stable/11/contrib/sqlite3/sqlite3.c ============================================================================== --- stable/11/contrib/sqlite3/sqlite3.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/11/contrib/sqlite3/sqlite3.c Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.29.0. By combining all the individual C code files into this +** version 3.30.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -331,8 +331,6 @@ static const char * const sqlite3azCompileOpt[] = { #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", -#elif defined(SQLITE_ENABLE_STAT3) - "ENABLE_STAT3", #endif #if SQLITE_ENABLE_STMTVTAB "ENABLE_STMTVTAB", @@ -1167,9 +1165,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.29.0" -#define SQLITE_VERSION_NUMBER 3029000 -#define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6" +#define SQLITE_VERSION "3.30.1" +#define SQLITE_VERSION_NUMBER 3030001 +#define SQLITE_SOURCE_ID "2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -3137,6 +3135,17 @@ struct sqlite3_mem_methods { ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back. ** +** [[SQLITE_DBCONFIG_ENABLE_VIEW]] +**
SQLITE_DBCONFIG_ENABLE_VIEW
+**
^This option is used to enable or disable [CREATE VIEW | views]. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable views, +** positive to enable views or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether views are disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the view setting is not reported back.
+** ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] **
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
**
^This option is used to enable or disable the @@ -3309,7 +3318,8 @@ struct sqlite3_mem_methods { #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ -#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ +#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ +#define SQLITE_DBCONFIG_MAX 1015 /* Largest DBCONFIG */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes @@ -4858,7 +4868,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int new ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. +** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. ** ** ** @@ -5893,6 +5903,12 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** +** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] +** flag, which if present prevents the function from being invoked from +** within VIEWs or TRIGGERs. For security reasons, the [SQLITE_DIRECTONLY] +** flag is recommended for any application-defined SQL function that has +** side-effects. +** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** @@ -6009,8 +6025,30 @@ SQLITE_API int sqlite3_create_window_function( ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. +** +** The SQLITE_DETERMINISTIC flag means that the new function will always +** maps the same inputs into the same output. The abs() function is +** deterministic, for example, but randomblob() is not. +** +** The SQLITE_DIRECTONLY flag means that the function may only be invoked +** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is +** a security feature which is recommended for all +** [application-defined SQL functions] that have side-effects. This flag +** prevents an attacker from adding triggers and views to a schema then +** tricking a high-privilege application into causing unintended side-effects +** while performing ordinary queries. +** +** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. +** Specifying this flag makes no difference for scalar or aggregate user +** functions. However, if it is not specified for a user-defined window +** function, then any sub-types belonging to arguments passed to the window +** function may be discarded before the window function is called (i.e. +** sqlite3_value_subtype() will always return 0). */ -#define SQLITE_DETERMINISTIC 0x800 +#define SQLITE_DETERMINISTIC 0x000000800 +#define SQLITE_DIRECTONLY 0x000080000 +#define SQLITE_SUBTYPE 0x000100000 /* ** CAPI3REF: Deprecated Functions @@ -7656,6 +7694,12 @@ struct sqlite3_index_info { ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. +** +** ^If the third parameter (the pointer to the sqlite3_module object) is +** NULL then no new module is create and any existing modules with the +** same name are dropped. +** +** See also: [sqlite3_drop_modules()] */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ @@ -7672,6 +7716,23 @@ SQLITE_API int sqlite3_create_module_v2( ); /* +** CAPI3REF: Remove Unnecessary Virtual Table Implementations +** METHOD: sqlite3 +** +** ^The sqlite3_drop_modules(D,L) interface removes all virtual +** table modules from database connection D except those named on list L. +** The L parameter must be either NULL or a pointer to an array of pointers +** to strings where the array is terminated by a single NULL pointer. +** ^If the L parameter is NULL, then all virtual table modules are removed. +** +** See also: [sqlite3_create_module()] +*/ +SQLITE_API int sqlite3_drop_modules( + sqlite3 *db, /* Remove modules from this connection */ + const char **azKeep /* Except, do not remove the ones named here */ +); + +/* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** @@ -8379,7 +8440,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8402,7 +8463,9 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 -#define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_PRNG_SEED 28 +#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 +#define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -13099,15 +13162,15 @@ struct fts5_api { ** So we have to define the macros in different ways depending on the ** compiler. */ -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ +#if defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ +# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) +#elif defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) #else /* Generates a warning - but it always works */ # define SQLITE_INT_TO_PTR(X) ((void*)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(X)) @@ -13597,100 +13660,103 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_VIEW 79 #define TK_VIRTUAL 80 #define TK_WITH 81 -#define TK_CURRENT 82 -#define TK_FOLLOWING 83 -#define TK_PARTITION 84 -#define TK_PRECEDING 85 -#define TK_RANGE 86 -#define TK_UNBOUNDED 87 -#define TK_EXCLUDE 88 -#define TK_GROUPS 89 -#define TK_OTHERS 90 -#define TK_TIES 91 -#define TK_REINDEX 92 -#define TK_RENAME 93 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 3 13:48:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10A3C1AF7FB; Tue, 3 Dec 2019 13:48:19 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S3GW0NSVz4PQ7; Tue, 3 Dec 2019 13:48:19 +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 E43DA18944; Tue, 3 Dec 2019 13:48:18 +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 xB3DmIG3081653; Tue, 3 Dec 2019 13:48:18 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Dm3cE081632; Tue, 3 Dec 2019 13:48:03 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912031348.xB3Dm3cE081632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Tue, 3 Dec 2019 13:48:03 +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: r355326 - in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/sqlite3 11/contrib/sqlite3/tea 11/contrib/sqlite3/tea/generic 12/contrib/sqlite3 12/contrib/sqlite3/tea 12/contrib/sqlite3/tea/generic X-SVN-Commit-Revision: 355326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 13:48:19 -0000 Author: cy Date: Tue Dec 3 13:47:46 2019 New Revision: 355326 URL: https://svnweb.freebsd.org/changeset/base/355326 Log: MFC r354269: MFV r354257: Update sqlite3-3.29.0 (3290000) --> sqlite3-3.30.1 (3300100) Modified: stable/12/contrib/sqlite3/Makefile.msc stable/12/contrib/sqlite3/configure stable/12/contrib/sqlite3/configure.ac stable/12/contrib/sqlite3/shell.c stable/12/contrib/sqlite3/sqlite3.c stable/12/contrib/sqlite3/sqlite3.h stable/12/contrib/sqlite3/sqlite3ext.h stable/12/contrib/sqlite3/tea/configure stable/12/contrib/sqlite3/tea/configure.ac stable/12/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/sqlite3/Makefile.msc stable/11/contrib/sqlite3/configure stable/11/contrib/sqlite3/configure.ac stable/11/contrib/sqlite3/shell.c stable/11/contrib/sqlite3/sqlite3.c stable/11/contrib/sqlite3/sqlite3.h stable/11/contrib/sqlite3/sqlite3ext.h stable/11/contrib/sqlite3/tea/configure stable/11/contrib/sqlite3/tea/configure.ac stable/11/contrib/sqlite3/tea/generic/tclsqlite3.c Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/sqlite3/Makefile.msc ============================================================================== --- stable/12/contrib/sqlite3/Makefile.msc Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/Makefile.msc Tue Dec 3 13:47:46 2019 (r355326) @@ -73,7 +73,7 @@ API_ARMOR = 0 !IFNDEF NO_WARN !IF $(USE_FULLWARN)!=0 NO_WARN = -wd4054 -wd4055 -wd4100 -wd4127 -wd4130 -wd4152 -wd4189 -wd4206 -NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4305 -wd4306 -wd4702 -wd4706 +NO_WARN = $(NO_WARN) -wd4210 -wd4232 -wd4244 -wd4305 -wd4306 -wd4702 -wd4706 !ENDIF !ENDIF Modified: stable/12/contrib/sqlite3/configure ============================================================================== --- stable/12/contrib/sqlite3/configure Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/configure Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for sqlite 3.29.0. +# Generated by GNU Autoconf 2.69 for sqlite 3.30.1. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='sqlite' PACKAGE_TARNAME='sqlite' -PACKAGE_VERSION='3.29.0' -PACKAGE_STRING='sqlite 3.29.0' +PACKAGE_VERSION='3.30.1' +PACKAGE_STRING='sqlite 3.30.1' PACKAGE_BUGREPORT='http://www.sqlite.org' PACKAGE_URL='' @@ -1341,7 +1341,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures sqlite 3.29.0 to adapt to many kinds of systems. +\`configure' configures sqlite 3.30.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1412,7 +1412,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of sqlite 3.29.0:";; + short | recursive ) echo "Configuration of sqlite 3.30.1:";; esac cat <<\_ACEOF @@ -1537,7 +1537,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -sqlite configure 3.29.0 +sqlite configure 3.30.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1952,7 +1952,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by sqlite $as_me 3.29.0, which was +It was created by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2818,7 +2818,7 @@ fi # Define the identity of the package. PACKAGE='sqlite' - VERSION='3.29.0' + VERSION='3.30.1' cat >>confdefs.h <<_ACEOF @@ -14438,7 +14438,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by sqlite $as_me 3.29.0, which was +This file was extended by sqlite $as_me 3.30.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14495,7 +14495,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -sqlite config.status 3.29.0 +sqlite config.status 3.30.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Modified: stable/12/contrib/sqlite3/configure.ac ============================================================================== --- stable/12/contrib/sqlite3/configure.ac Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/configure.ac Tue Dec 3 13:47:46 2019 (r355326) @@ -10,7 +10,7 @@ # AC_PREREQ(2.61) -AC_INIT(sqlite, 3.29.0, http://www.sqlite.org) +AC_INIT(sqlite, 3.30.1, http://www.sqlite.org) AC_CONFIG_SRCDIR([sqlite3.c]) AC_CONFIG_AUX_DIR([.]) Modified: stable/12/contrib/sqlite3/shell.c ============================================================================== --- stable/12/contrib/sqlite3/shell.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/shell.c Tue Dec 3 13:47:46 2019 (r355326) @@ -9801,12 +9801,12 @@ static void editFunc( } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ - x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_blob(argv[0]), 1, (size_t)sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; - x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); + x = fwrite(sqlite3_value_text(argv[0]), 1, (size_t)sz, f); } fclose(f); f = 0; @@ -9834,12 +9834,12 @@ static void editFunc( fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); - p = sqlite3_malloc64( sz+(bBin==0) ); + p = sqlite3_malloc64( sz+1 ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } - x = fread(p, 1, sz, f); + x = fread(p, 1, (size_t)sz, f); fclose(f); f = 0; if( x!=sz ){ @@ -10311,7 +10311,8 @@ static void eqp_render_level(ShellState *p, int iEqpId for(pRow = eqp_next_row(p, iEqpId, 0); pRow; pRow = pNext){ pNext = eqp_next_row(p, iEqpId, pRow); z = pRow->zText; - utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, pNext ? "|--" : "`--", z); + utf8_printf(p->out, "%s%s%s\n", p->sGraph.zPrefix, + pNext ? "|--" : "`--", z); if( n<(int)sizeof(p->sGraph.zPrefix)-7 ){ memcpy(&p->sGraph.zPrefix[n], pNext ? "| " : " ", 4); eqp_render_level(p, pRow->iEqpId); @@ -10502,7 +10503,7 @@ static int shell_callback( while( j>0 && IsSpace(z[j-1]) ){ j--; } z[j] = 0; if( strlen30(z)>=79 ){ - for(i=j=0; (c = z[i])!=0; i++){ /* Copy changes from z[i] back to z[j] */ + for(i=j=0; (c = z[i])!=0; i++){ /* Copy from z[i] back to z[j] */ if( c==cEnd ){ cEnd = 0; }else if( c=='"' || c=='\'' || c=='`' ){ @@ -11081,7 +11082,7 @@ static int display_stats( raw_printf(pArg->out, "Autoindex Inserts: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); raw_printf(pArg->out, "Virtual Machine Steps: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE, bReset); + iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_REPREPARE,bReset); raw_printf(pArg->out, "Reprepare operations: %d\n", iCur); iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_RUN, bReset); raw_printf(pArg->out, "Number of times run: %d\n", iCur); @@ -12004,20 +12005,20 @@ static const char *(azHelp[]) = { ".archive ... Manage SQL archives", " Each command must have exactly one of the following options:", " -c, --create Create a new archive", - " -u, --update Add files or update files with changed mtime", - " -i, --insert Like -u but always add even if mtime unchanged", + " -u, --update Add or update files with changed mtime", + " -i, --insert Like -u but always add even if unchanged", " -t, --list List contents of archive", " -x, --extract Extract files from archive", " Optional arguments:", " -v, --verbose Print each filename as it is processed", - " -f FILE, --file FILE Operate on archive FILE (default is current db)", - " -a FILE, --append FILE Operate on FILE opened using the apndvfs VFS", - " -C DIR, --directory DIR Change to directory DIR to read/extract files", + " -f FILE, --file FILE Use archive FILE (default is current db)", + " -a FILE, --append FILE Open FILE using the apndvfs VFS", + " -C DIR, --directory DIR Read/extract files from directory DIR", " -n, --dryrun Show the SQL that would have occurred", " Examples:", - " .ar -cf archive.sar foo bar # Create archive.sar from files foo and bar", - " .ar -tf archive.sar # List members of archive.sar", - " .ar -xvf archive.sar # Verbosely extract files from archive.sar", + " .ar -cf ARCHIVE foo bar # Create ARCHIVE from files foo and bar", + " .ar -tf ARCHIVE # List members of ARCHIVE", + " .ar -xvf ARCHIVE # Verbosely extract files from ARCHIVE", " See also:", " http://sqlite.org/cli.html#sqlar_archive_support", #endif @@ -12026,7 +12027,7 @@ static const char *(azHelp[]) = { #endif ".backup ?DB? FILE Backup DB (default \"main\") to FILE", " --append Use the appendvfs", - " --async Write to FILE without a journal and without fsync()", + " --async Write to FILE without journal and fsync()", ".bail on|off Stop after hitting an error. Default OFF", ".binary on|off Turn binary output on or off. Default OFF", ".cd DIRECTORY Change the working directory to DIRECTORY", @@ -12046,15 +12047,15 @@ static const char *(azHelp[]) = { " Other Modes:", #ifdef SQLITE_DEBUG " test Show raw EXPLAIN QUERY PLAN output", - " trace Like \"full\" but also enable \"PRAGMA vdbe_trace\"", + " trace Like \"full\" but enable \"PRAGMA vdbe_trace\"", #endif " trigger Like \"full\" but also show trigger bytecode", - ".excel Display the output of next command in a spreadsheet", + ".excel Display the output of next command in spreadsheet", ".exit ?CODE? Exit this program with return-code CODE", - ".expert EXPERIMENTAL. Suggest indexes for specified queries", + ".expert EXPERIMENTAL. Suggest indexes for queries", /* Because explain mode comes on automatically now, the ".explain" mode -** is removed from the help screen. It is still supported for legacy, however */ -/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic",*/ +** is removed from the help screen. It is still supported for legacy, however */ +/*".explain ?on|off|auto? Turn EXPLAIN output mode on or off",*/ ".filectrl CMD ... Run various sqlite3_file_control() operations", " Run \".filectrl\" with no arguments for details", ".fullschema ?--indent? Show schema and the content of sqlite_stat tables", @@ -12101,7 +12102,7 @@ static const char *(azHelp[]) = { " --append Use appendvfs to append database to the end of FILE", #ifdef SQLITE_ENABLE_DESERIALIZE " --deserialize Load into memory useing sqlite3_deserialize()", - " --hexdb Load the output of \"dbtotxt\" as an in-memory database", + " --hexdb Load the output of \"dbtotxt\" as an in-memory db", " --maxsize N Maximum size for --hexdb or --deserialized database", #endif " --new Initialize FILE to an empty database", @@ -12114,7 +12115,7 @@ static const char *(azHelp[]) = { " init Initialize the TEMP table that holds bindings", " list List the current parameter bindings", " set PARAMETER VALUE Given SQL parameter PARAMETER a value of VALUE", - " PARAMETER should start with '$', ':', '@', or '?'", + " PARAMETER should start with one of: $ : @ ?", " unset PARAMETER Remove PARAMETER from the binding table", ".print STRING... Print literal STRING", #ifndef SQLITE_OMIT_PROGRESS_CALLBACK @@ -12129,6 +12130,11 @@ static const char *(azHelp[]) = { ".read FILE Read input from FILE", #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) ".recover Recover as much data as possible from corrupt db.", + " --freelist-corrupt Assume the freelist is corrupt", + " --recovery-db NAME Store recovery metadata in database file NAME", + " --lost-and-found TABLE Alternative name for the lost-and-found table", + " --no-rowids Do not attempt to recover rowid values", + " that are not also INTEGER PRIMARY KEYs", #endif ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE", ".save FILE Write in-memory database into FILE", @@ -12160,7 +12166,7 @@ static const char *(azHelp[]) = { " Options:", " --schema Also hash the sqlite_master table", " --sha3-224 Use the sha3-224 algorithm", - " --sha3-256 Use the sha3-256 algorithm. This is the default.", + " --sha3-256 Use the sha3-256 algorithm (default)", " --sha3-384 Use the sha3-384 algorithm", " --sha3-512 Use the sha3-512 algorithm", " Any other argument is a LIKE pattern for tables to hash", @@ -12194,6 +12200,10 @@ static const char *(azHelp[]) = { " --row Trace each row (SQLITE_TRACE_ROW)", " --close Trace connection close (SQLITE_TRACE_CLOSE)", #endif /* SQLITE_OMIT_TRACE */ +#ifdef SQLITE_DEBUG + ".unmodule NAME ... Unregister virtual table modules", + " --allexcept Unregister everything except those named", +#endif ".vfsinfo ?AUX? Information about the top-level VFS", ".vfslist List all available VFSes", ".vfsname ?AUX? Print the name of the VFS stack", @@ -12436,6 +12446,8 @@ static unsigned char *readHexDb(ShellState *p, int *pn rc = sscanf(zLine, "| size %d pagesize %d", &n, &pgsz); if( rc!=2 ) goto readHexDb_error; if( n<0 ) goto readHexDb_error; + if( pgsz<512 || pgsz>65536 || (pgsz&(pgsz-1))!=0 ) goto readHexDb_error; + n = (n+pgsz-1)&~(pgsz-1); /* Round n up to the next multiple of pgsz */ a = sqlite3_malloc( n ? n : 1 ); if( a==0 ){ utf8_printf(stderr, "Out of memory!\n"); @@ -12521,6 +12533,23 @@ static void shellInt32( } /* +** Scalar function "shell_idquote(X)" returns string X quoted as an identifier, +** using "..." with internal double-quote characters doubled. +*/ +static void shellIdQuote( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + const char *zName = (const char*)sqlite3_value_text(argv[0]); + UNUSED_PARAMETER(argc); + if( zName ){ + char *z = sqlite3_mprintf("\"%w\"", zName); + sqlite3_result_text(context, z, -1, sqlite3_free); + } +} + +/* ** Scalar function "shell_escape_crnl" used by the .recover command. ** The argument passed to this function is the output of built-in ** function quote(). If the first character of the input is "'", @@ -12696,6 +12725,8 @@ static void open_db(ShellState *p, int openFlags){ shellEscapeCrnl, 0, 0); sqlite3_create_function(p->db, "shell_int32", 2, SQLITE_UTF8, 0, shellInt32, 0, 0); + sqlite3_create_function(p->db, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); #ifndef SQLITE_NOHAVE_SYSTEM sqlite3_create_function(p->db, "edit", 1, SQLITE_UTF8, 0, editFunc, 0, 0); @@ -14043,7 +14074,7 @@ void shellReset( #endif /* !defined SQLITE_OMIT_VIRTUALTABLE */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) -/********************************************************************************* +/****************************************************************************** ** The ".archive" or ".ar" command. */ /* @@ -14241,7 +14272,8 @@ static int arParseCommand( i = n; }else{ if( iArg>=(nArg-1) ){ - return arErrorMsg(pAr, "option requires an argument: %c",z[i]); + return arErrorMsg(pAr, "option requires an argument: %c", + z[i]); } zArg = azArg[++iArg]; } @@ -14629,10 +14661,10 @@ end_ar_transaction: ** Implementation of ".ar" dot command. */ static int arDotCommand( - ShellState *pState, /* Current shell tool state */ - int fromCmdLine, /* True if -A command-line option, not .ar cmd */ - char **azArg, /* Array of arguments passed to dot command */ - int nArg /* Number of entries in azArg[] */ + ShellState *pState, /* Current shell tool state */ + int fromCmdLine, /* True if -A command-line option, not .ar cmd */ + char **azArg, /* Array of arguments passed to dot command */ + int nArg /* Number of entries in azArg[] */ ){ ArCommand cmd; int rc; @@ -14732,7 +14764,7 @@ end_ar_command: return rc; } /* End of the ".archive" or ".ar" command logic -**********************************************************************************/ +*******************************************************************************/ #endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_HAVE_ZLIB) */ #if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(SQLITE_ENABLE_DBPAGE_VTAB) @@ -14874,6 +14906,10 @@ static RecoverTable *recoverNewTable( rc = sqlite3_open("", &dbtmp); if( rc==SQLITE_OK ){ + sqlite3_create_function(dbtmp, "shell_idquote", 1, SQLITE_UTF8, 0, + shellIdQuote, 0, 0); + } + if( rc==SQLITE_OK ){ rc = sqlite3_exec(dbtmp, "PRAGMA writable_schema = on", 0, 0, 0); } if( rc==SQLITE_OK ){ @@ -14929,18 +14965,18 @@ static RecoverTable *recoverNewTable( } } - pTab->zQuoted = shellMPrintf(&rc, "%Q", zName); + pTab->zQuoted = shellMPrintf(&rc, "\"%w\"", zName); pTab->azlCol = (char**)shellMalloc(&rc, sizeof(char*) * (nSqlCol+1)); pTab->nCol = nSqlCol; if( bIntkey ){ - pTab->azlCol[0] = shellMPrintf(&rc, "%Q", zPk); + pTab->azlCol[0] = shellMPrintf(&rc, "\"%w\"", zPk); }else{ pTab->azlCol[0] = shellMPrintf(&rc, ""); } i = 1; shellPreparePrintf(dbtmp, &rc, &pStmt, - "SELECT %Q || group_concat(name, ', ') " + "SELECT %Q || group_concat(shell_idquote(name), ', ') " " FILTER (WHERE cid!=%d) OVER (ORDER BY %s cid) " "FROM pragma_table_info(%Q)", bIntkey ? ", " : "", pTab->iPk, @@ -15054,7 +15090,7 @@ static RecoverTable *recoverOrphanTable( pTab = (RecoverTable*)shellMalloc(pRc, sizeof(RecoverTable)); if( pTab ){ - pTab->zQuoted = shellMPrintf(pRc, "%Q", zTab); + pTab->zQuoted = shellMPrintf(pRc, "\"%w\"", zTab); pTab->nCol = nCol; pTab->iPk = -2; if( nCol>0 ){ @@ -15103,6 +15139,7 @@ static int recoverDatabaseCmd(ShellState *pState, int RecoverTable *pOrphan = 0; int bFreelist = 1; /* 0 if --freelist-corrupt is specified */ + int bRowids = 1; /* 0 if --no-rowids */ for(i=1; iout, azArg[0]); return 1; } } @@ -15132,6 +15169,7 @@ static int recoverDatabaseCmd(ShellState *pState, int shellExecPrintf(pState->db, &rc, /* Attach an in-memory database named 'recovery'. Create an indexed ** cache of the sqlite_dbptr virtual table. */ + "PRAGMA writable_schema = on;" "ATTACH %Q AS recovery;" "DROP TABLE IF EXISTS recovery.dbptr;" "DROP TABLE IF EXISTS recovery.freelist;" @@ -15162,7 +15200,22 @@ static int recoverDatabaseCmd(ShellState *pState, int ); } + /* If this is an auto-vacuum database, add all pointer-map pages to + ** the freelist table. Do this regardless of whether or not + ** --freelist-corrupt was specified. */ shellExec(pState->db, &rc, + "WITH ptrmap(pgno) AS (" + " SELECT 2 WHERE shell_int32(" + " (SELECT data FROM sqlite_dbpage WHERE pgno=1), 13" + " )" + " UNION ALL " + " SELECT pgno+1+(SELECT page_size FROM pragma_page_size)/5 AS pp " + " FROM ptrmap WHERE pp<=(SELECT page_count FROM pragma_page_count)" + ")" + "REPLACE INTO recovery.freelist SELECT pgno FROM ptrmap" + ); + + shellExec(pState->db, &rc, "CREATE TABLE recovery.dbptr(" " pgno, child, PRIMARY KEY(child, pgno)" ") WITHOUT ROWID;" @@ -15210,7 +15263,7 @@ static int recoverDatabaseCmd(ShellState *pState, int " )" " SELECT pgno FROM p WHERE (parent IS NULL OR pgno = orig)" ") " - "FROM pages WHERE maxlen > 0 AND i NOT IN freelist;" + "FROM pages WHERE maxlen IS NOT NULL AND i NOT IN freelist;" "UPDATE recovery.map AS o SET intkey = (" " SELECT substr(data, 1, 1)==X'0D' FROM sqlite_dbpage WHERE pgno=o.pgno" ");" @@ -15235,6 +15288,11 @@ static int recoverDatabaseCmd(ShellState *pState, int ** CREATE TABLE statements that extracted from the existing schema. */ if( rc==SQLITE_OK ){ sqlite3_stmt *pStmt = 0; + /* ".recover" might output content in an order which causes immediate + ** foreign key constraints to be violated. So disable foreign-key + ** constraint enforcement to prevent problems when running the output + ** script. */ + raw_printf(pState->out, "PRAGMA foreign_keys=OFF;\n"); raw_printf(pState->out, "BEGIN;\n"); raw_printf(pState->out, "PRAGMA writable_schema = on;\n"); shellPrepare(pState->db, &rc, @@ -15265,8 +15323,12 @@ static int recoverDatabaseCmd(ShellState *pState, int shellPrepare(pState->db, &rc, "SELECT pgno FROM recovery.map WHERE root=?", &pPages ); + shellPrepare(pState->db, &rc, - "SELECT max(field), group_concat(shell_escape_crnl(quote(value)), ', ')" + "SELECT max(field), group_concat(shell_escape_crnl(quote" + "(case when (? AND field<0) then NULL else value end)" + "), ', ')" + ", min(field) " "FROM sqlite_dbdata WHERE pgno = ? AND field != ?" "GROUP BY cell", &pCells ); @@ -15285,6 +15347,7 @@ static int recoverDatabaseCmd(ShellState *pState, int int bNoop = 0; RecoverTable *pTab; + assert( bIntkey==0 || bIntkey==1 ); pTab = recoverFindTable(pState, &rc, iRoot, bIntkey, nCol, &bNoop); if( bNoop || rc ) continue; if( pTab==0 ){ @@ -15295,29 +15358,44 @@ static int recoverDatabaseCmd(ShellState *pState, int if( pTab==0 ) break; } - if( 0==sqlite3_stricmp(pTab->zQuoted, "'sqlite_sequence'") ){ + if( 0==sqlite3_stricmp(pTab->zQuoted, "\"sqlite_sequence\"") ){ raw_printf(pState->out, "DELETE FROM sqlite_sequence;\n"); } sqlite3_bind_int(pPages, 1, iRoot); - sqlite3_bind_int(pCells, 2, pTab->iPk); + if( bRowids==0 && pTab->iPk<0 ){ + sqlite3_bind_int(pCells, 1, 1); + }else{ + sqlite3_bind_int(pCells, 1, 0); + } + sqlite3_bind_int(pCells, 3, pTab->iPk); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pPages) ){ int iPgno = sqlite3_column_int(pPages, 0); - sqlite3_bind_int(pCells, 1, iPgno); + sqlite3_bind_int(pCells, 2, iPgno); while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pCells) ){ int nField = sqlite3_column_int(pCells, 0); + int iMin = sqlite3_column_int(pCells, 2); const char *zVal = (const char*)sqlite3_column_text(pCells, 1); + RecoverTable *pTab2 = pTab; + if( pTab!=pOrphan && (iMin<0)!=bIntkey ){ + if( pOrphan==0 ){ + pOrphan = recoverOrphanTable(pState, &rc, zLostAndFound, nOrphan); + } + pTab2 = pOrphan; + if( pTab2==0 ) break; + } + nField = nField+1; - if( pTab==pOrphan ){ + if( pTab2==pOrphan ){ raw_printf(pState->out, "INSERT INTO %s VALUES(%d, %d, %d, %s%s%s);\n", - pTab->zQuoted, iRoot, iPgno, nField, - bIntkey ? "" : "NULL, ", zVal, pTab->azlCol[nField] + pTab2->zQuoted, iRoot, iPgno, nField, + iMin<0 ? "" : "NULL, ", zVal, pTab2->azlCol[nField] ); }else{ raw_printf(pState->out, "INSERT INTO %s(%s) VALUES( %s );\n", - pTab->zQuoted, pTab->azlCol[nField], zVal + pTab2->zQuoted, pTab2->azlCol[nField], zVal ); } } @@ -15376,7 +15454,7 @@ static int do_meta_command(char *zLine, ShellState *p) int nArg = 0; int n, c; int rc = 0; - char *azArg[50]; + char *azArg[52]; #ifndef SQLITE_OMIT_VIRTUALTABLE if( p->expert.pExpert ){ @@ -15386,7 +15464,7 @@ static int do_meta_command(char *zLine, ShellState *p) /* Parse the input line into tokens. */ - while( zLine[h] && nArgout, "ANALYZE sqlite_master;\n"); @@ -16615,12 +16693,8 @@ static int do_meta_command(char *zLine, ShellState *p) ** Clear all bind parameters by dropping the TEMP table that holds them. */ if( nArg==2 && strcmp(azArg[1],"clear")==0 ){ - int wrSchema = 0; - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, -1, &wrSchema); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, 1, 0); sqlite3_exec(p->db, "DROP TABLE IF EXISTS temp.sqlite_parameters;", 0, 0, 0); - sqlite3_db_config(p->db, SQLITE_DBCONFIG_WRITABLE_SCHEMA, wrSchema, 0); }else /* .parameter list @@ -16933,7 +17007,7 @@ static int do_meta_command(char *zLine, ShellState *p) zDiv = " UNION ALL "; appendText(&sSelect, "SELECT shell_add_schema(sql,", 0); if( sqlite3_stricmp(zDb, "main")!=0 ){ - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, '\''); }else{ appendText(&sSelect, "NULL", 0); } @@ -16942,15 +17016,16 @@ static int do_meta_command(char *zLine, ShellState *p) appendText(&sSelect, " AS snum, ", 0); appendText(&sSelect, zDb, '\''); appendText(&sSelect, " AS sname FROM ", 0); - appendText(&sSelect, zDb, '"'); + appendText(&sSelect, zDb, quoteChar(zDb)); appendText(&sSelect, ".sqlite_master", 0); } sqlite3_finalize(pStmt); -#ifdef SQLITE_INTROSPECTION_PRAGMAS +#ifndef SQLITE_OMIT_INTROSPECTION_PRAGMAS if( zName ){ appendText(&sSelect, " UNION ALL SELECT shell_module_schema(name)," - " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", 0); + " 'table', name, name, name, 9e+99, 'main' FROM pragma_module_list", + 0); } #endif appendText(&sSelect, ") WHERE ", 0); @@ -17049,7 +17124,8 @@ static int do_meta_command(char *zLine, ShellState *p) if( pSession->p==0 ) goto session_not_open; out = fopen(azCmd[1], "wb"); if( out==0 ){ - utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", azCmd[1]); + utf8_printf(stderr, "ERROR: cannot open \"%s\" for writing\n", + azCmd[1]); }else{ int szChng; void *pChng; @@ -17370,8 +17446,7 @@ static int do_meta_command(char *zLine, ShellState *p) { utf8_printf(stderr, "Unknown option \"%s\" on \"%s\"\n", azArg[i], azArg[0]); - raw_printf(stderr, "Should be one of: --schema" - " --sha3-224 --sha3-256 --sha3-384 --sha3-512\n"); + showHelp(p->out, azArg[0]); rc = 1; goto meta_command_exit; } @@ -17417,8 +17492,7 @@ static int do_meta_command(char *zLine, ShellState *p) }else if( strcmp(zTab, "sqlite_stat1")==0 ){ appendText(&sQuery,"SELECT tbl,idx,stat FROM sqlite_stat1" " ORDER BY tbl,idx;", 0); - }else if( strcmp(zTab, "sqlite_stat3")==0 - || strcmp(zTab, "sqlite_stat4")==0 ){ + }else if( strcmp(zTab, "sqlite_stat4")==0 ){ appendText(&sQuery, "SELECT * FROM ", 0); appendText(&sQuery, zTab, 0); appendText(&sQuery, " ORDER BY tbl, idx, rowid;\n", 0); @@ -17650,25 +17724,26 @@ static int do_meta_command(char *zLine, ShellState *p) int ctrlCode; /* Integer code for that option */ const char *zUsage; /* Usage notes */ } aCtrl[] = { - { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, - { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, - /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ - /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ - { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, - /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" }, */ - { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, - { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, - { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, - { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, + { "always", SQLITE_TESTCTRL_ALWAYS, "BOOLEAN" }, + { "assert", SQLITE_TESTCTRL_ASSERT, "BOOLEAN" }, + /*{ "benign_malloc_hooks",SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS, "" },*/ + /*{ "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST, "" },*/ + { "byteorder", SQLITE_TESTCTRL_BYTEORDER, "" }, + { "extra_schema_checks",SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS,"BOOLEAN" }, + /*{ "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL, "" },*/ + { "imposter", SQLITE_TESTCTRL_IMPOSTER, "SCHEMA ON/OFF ROOTPAGE"}, + { "internal_functions", SQLITE_TESTCTRL_INTERNAL_FUNCTIONS, "BOOLEAN" }, + { "localtime_fault", SQLITE_TESTCTRL_LOCALTIME_FAULT,"BOOLEAN" }, + { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT, "BOOLEAN" }, + { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS, "DISABLE-MASK" }, #ifdef YYCOVERAGE - { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, + { "parser_coverage", SQLITE_TESTCTRL_PARSER_COVERAGE, "" }, #endif - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET, "" }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, - { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE" }, + { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE, "OFFSET " }, + { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE, "" }, + { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE, "" }, + { "prng_seed", SQLITE_TESTCTRL_PRNG_SEED, "SEED ?db?" }, + { "reserve", SQLITE_TESTCTRL_RESERVE, "BYTES-OF-RESERVE"}, }; int testctrl = -1; int iCtrl = -1; @@ -17749,6 +17824,27 @@ static int do_meta_command(char *zLine, ShellState *p) } break; + /* sqlite3_test_control(int, int, sqlite3*) */ + case SQLITE_TESTCTRL_PRNG_SEED: + if( nArg==3 || nArg==4 ){ + int ii = (int)integerValue(azArg[2]); + sqlite3 *db; + if( ii==0 && strcmp(azArg[2],"random")==0 ){ + sqlite3_randomness(sizeof(ii),&ii); + printf("-- random seed: %d\n", ii); + } + if( nArg==3 ){ + db = 0; + }else{ + db = p->db; + /* Make sure the schema has been loaded */ + sqlite3_table_column_metadata(db, 0, "x", 0, 0, 0, 0, 0, 0); + } + rc2 = sqlite3_test_control(testctrl, ii, db); + isOk = 3; + } + break; + /* sqlite3_test_control(int, int) */ case SQLITE_TESTCTRL_ASSERT: case SQLITE_TESTCTRL_ALWAYS: @@ -17790,7 +17886,7 @@ static int do_meta_command(char *zLine, ShellState *p) } } if( isOk==0 && iCtrl>=0 ){ - utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd, aCtrl[iCtrl].zUsage); + utf8_printf(p->out, "Usage: .testctrl %s %s\n", zCmd,aCtrl[iCtrl].zUsage); rc = 1; }else if( isOk==1 ){ raw_printf(p->out, "%d\n", rc2); @@ -17868,6 +17964,31 @@ static int do_meta_command(char *zLine, ShellState *p) }else #endif /* !defined(SQLITE_OMIT_TRACE) */ +#if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_VIRTUALTABLE) + if( c=='u' && strncmp(azArg[0], "unmodule", n)==0 ){ + int ii; + int lenOpt; + char *zOpt; + if( nArg<2 ){ + raw_printf(stderr, "Usage: .unmodule [--allexcept] NAME ...\n"); + rc = 1; + goto meta_command_exit; + } + open_db(p, 0); + zOpt = azArg[1]; + if( zOpt[0]=='-' && zOpt[1]=='-' && zOpt[2]!=0 ) zOpt++; + lenOpt = (int)strlen(zOpt); + if( lenOpt>=3 && strncmp(zOpt, "-allexcept",lenOpt)==0 ){ + assert( azArg[nArg]==0 ); + sqlite3_drop_modules(p->db, nArg>2 ? (const char**)(azArg+2) : 0); + }else{ + for(ii=1; iidb, azArg[ii], 0, 0); + } + } + }else +#endif + #if SQLITE_USER_AUTHENTICATION if( c=='u' && strncmp(azArg[0], "user", n)==0 ){ if( nArg<2 ){ @@ -17882,7 +18003,8 @@ static int do_meta_command(char *zLine, ShellState *p) rc = 1; goto meta_command_exit; } - rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], strlen30(azArg[3])); + rc = sqlite3_user_authenticate(p->db, azArg[2], azArg[3], + strlen30(azArg[3])); if( rc ){ utf8_printf(stderr, "Authentication failed for user %s\n", azArg[2]); rc = 1; Modified: stable/12/contrib/sqlite3/sqlite3.c ============================================================================== --- stable/12/contrib/sqlite3/sqlite3.c Tue Dec 3 09:48:43 2019 (r355325) +++ stable/12/contrib/sqlite3/sqlite3.c Tue Dec 3 13:47:46 2019 (r355326) @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.29.0. By combining all the individual C code files into this +** version 3.30.1. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -331,8 +331,6 @@ static const char * const sqlite3azCompileOpt[] = { #endif #if defined(SQLITE_ENABLE_STAT4) "ENABLE_STAT4", -#elif defined(SQLITE_ENABLE_STAT3) - "ENABLE_STAT3", #endif #if SQLITE_ENABLE_STMTVTAB "ENABLE_STMTVTAB", @@ -1167,9 +1165,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.29.0" -#define SQLITE_VERSION_NUMBER 3029000 -#define SQLITE_SOURCE_ID "2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6" +#define SQLITE_VERSION "3.30.1" +#define SQLITE_VERSION_NUMBER 3030001 +#define SQLITE_SOURCE_ID "2019-10-10 20:19:45 18db032d058f1436ce3dea84081f4ee5a0f2259ad97301d43c426bc7f3df1b0b" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -3137,6 +3135,17 @@ struct sqlite3_mem_methods { ** following this call. The second parameter may be a NULL pointer, in ** which case the trigger setting is not reported back.
** +** [[SQLITE_DBCONFIG_ENABLE_VIEW]] +**
SQLITE_DBCONFIG_ENABLE_VIEW
+**
^This option is used to enable or disable [CREATE VIEW | views]. +** There should be two additional arguments. +** The first argument is an integer which is 0 to disable views, +** positive to enable views or negative to leave the setting unchanged. +** The second parameter is a pointer to an integer into which +** is written 0 or 1 to indicate whether views are disabled or enabled +** following this call. The second parameter may be a NULL pointer, in +** which case the view setting is not reported back.
+** ** [[SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER]] **
SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
**
^This option is used to enable or disable the @@ -3309,7 +3318,8 @@ struct sqlite3_mem_methods { #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ -#define SQLITE_DBCONFIG_MAX 1014 /* Largest DBCONFIG */ +#define SQLITE_DBCONFIG_ENABLE_VIEW 1015 /* int int* */ +#define SQLITE_DBCONFIG_MAX 1015 /* Largest DBCONFIG */ /* ** CAPI3REF: Enable Or Disable Extended Result Codes @@ -4858,7 +4868,7 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int new ** ^The specific value of WHERE-clause [parameter] might influence the ** choice of query plan if the parameter is the left-hand side of a [LIKE] ** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. +** and the [SQLITE_ENABLE_STAT4] compile-time option is enabled. ** ** ** @@ -5893,6 +5903,12 @@ SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); ** perform additional optimizations on deterministic functions, so use ** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. ** +** ^The fourth parameter may also optionally include the [SQLITE_DIRECTONLY] +** flag, which if present prevents the function from being invoked from +** within VIEWs or TRIGGERs. For security reasons, the [SQLITE_DIRECTONLY] +** flag is recommended for any application-defined SQL function that has +** side-effects. +** ** ^(The fifth parameter is an arbitrary pointer. The implementation of the ** function can gain access to this pointer using [sqlite3_user_data()].)^ ** @@ -6009,8 +6025,30 @@ SQLITE_API int sqlite3_create_window_function( ** [SQLITE_UTF8 | preferred text encoding] as the fourth argument ** to [sqlite3_create_function()], [sqlite3_create_function16()], or ** [sqlite3_create_function_v2()]. +** +** The SQLITE_DETERMINISTIC flag means that the new function will always +** maps the same inputs into the same output. The abs() function is +** deterministic, for example, but randomblob() is not. +** +** The SQLITE_DIRECTONLY flag means that the function may only be invoked +** from top-level SQL, and cannot be used in VIEWs or TRIGGERs. This is +** a security feature which is recommended for all +** [application-defined SQL functions] that have side-effects. This flag +** prevents an attacker from adding triggers and views to a schema then +** tricking a high-privilege application into causing unintended side-effects +** while performing ordinary queries. +** +** The SQLITE_SUBTYPE flag indicates to SQLite that a function may call +** [sqlite3_value_subtype()] to inspect the sub-types of its arguments. +** Specifying this flag makes no difference for scalar or aggregate user +** functions. However, if it is not specified for a user-defined window +** function, then any sub-types belonging to arguments passed to the window +** function may be discarded before the window function is called (i.e. +** sqlite3_value_subtype() will always return 0). */ -#define SQLITE_DETERMINISTIC 0x800 +#define SQLITE_DETERMINISTIC 0x000000800 +#define SQLITE_DIRECTONLY 0x000080000 +#define SQLITE_SUBTYPE 0x000100000 /* ** CAPI3REF: Deprecated Functions @@ -7656,6 +7694,12 @@ struct sqlite3_index_info { ** ^The sqlite3_create_module() ** interface is equivalent to sqlite3_create_module_v2() with a NULL ** destructor. +** +** ^If the third parameter (the pointer to the sqlite3_module object) is +** NULL then no new module is create and any existing modules with the +** same name are dropped. +** +** See also: [sqlite3_drop_modules()] */ SQLITE_API int sqlite3_create_module( sqlite3 *db, /* SQLite connection to register module with */ @@ -7672,6 +7716,23 @@ SQLITE_API int sqlite3_create_module_v2( ); /* +** CAPI3REF: Remove Unnecessary Virtual Table Implementations +** METHOD: sqlite3 +** +** ^The sqlite3_drop_modules(D,L) interface removes all virtual +** table modules from database connection D except those named on list L. +** The L parameter must be either NULL or a pointer to an array of pointers +** to strings where the array is terminated by a single NULL pointer. +** ^If the L parameter is NULL, then all virtual table modules are removed. +** +** See also: [sqlite3_create_module()] +*/ +SQLITE_API int sqlite3_drop_modules( + sqlite3 *db, /* Remove modules from this connection */ + const char **azKeep /* Except, do not remove the ones named here */ +); + +/* ** CAPI3REF: Virtual Table Instance Object ** KEYWORDS: sqlite3_vtab ** @@ -8379,7 +8440,7 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_FIRST 5 #define SQLITE_TESTCTRL_PRNG_SAVE 5 #define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 +#define SQLITE_TESTCTRL_PRNG_RESET 7 /* NOT USED */ #define SQLITE_TESTCTRL_BITVEC_TEST 8 #define SQLITE_TESTCTRL_FAULT_INSTALL 9 #define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 @@ -8402,7 +8463,9 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 -#define SQLITE_TESTCTRL_LAST 27 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_PRNG_SEED 28 +#define SQLITE_TESTCTRL_EXTRA_SCHEMA_CHECKS 29 +#define SQLITE_TESTCTRL_LAST 29 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -13099,15 +13162,15 @@ struct fts5_api { ** So we have to define the macros in different ways depending on the ** compiler. */ -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ +#if defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ +# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) +# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) +#elif defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ # define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) #elif !defined(__GNUC__) /* Works for compilers other than LLVM */ # define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) # define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) #else /* Generates a warning - but it always works */ # define SQLITE_INT_TO_PTR(X) ((void*)(X)) # define SQLITE_PTR_TO_INT(X) ((int)(X)) @@ -13597,100 +13660,103 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_VIEW 79 #define TK_VIRTUAL 80 #define TK_WITH 81 -#define TK_CURRENT 82 -#define TK_FOLLOWING 83 -#define TK_PARTITION 84 -#define TK_PRECEDING 85 -#define TK_RANGE 86 -#define TK_UNBOUNDED 87 -#define TK_EXCLUDE 88 -#define TK_GROUPS 89 -#define TK_OTHERS 90 -#define TK_TIES 91 -#define TK_REINDEX 92 -#define TK_RENAME 93 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 3 14:46:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF13C1B1367; Tue, 3 Dec 2019 14:46:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S4Yq4Cl4z4SPZ; Tue, 3 Dec 2019 14:46:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74F271940D; Tue, 3 Dec 2019 14:46:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Ekdvh017656; Tue, 3 Dec 2019 14:46:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3EkdW2017654; Tue, 3 Dec 2019 14:46:39 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912031446.xB3EkdW2017654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 3 Dec 2019 14:46:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355327 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 355327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 14:46:39 -0000 Author: bz Date: Tue Dec 3 14:46:38 2019 New Revision: 355327 URL: https://svnweb.freebsd.org/changeset/base/355327 Log: Make icmp6_reflect() static. icmp6_reflect() is not used anywhere outside icmp6.c, no reason to export it. Sponsored by: Netflix Modified: head/sys/netinet/icmp6.h head/sys/netinet6/icmp6.c Modified: head/sys/netinet/icmp6.h ============================================================================== --- head/sys/netinet/icmp6.h Tue Dec 3 13:47:46 2019 (r355326) +++ head/sys/netinet/icmp6.h Tue Dec 3 14:46:38 2019 (r355327) @@ -701,7 +701,6 @@ void icmp6_error2(struct mbuf *, int, int, int, struct int icmp6_input(struct mbuf **, int *, int); void icmp6_fasttimo(void); void icmp6_slowtimo(void); -void icmp6_reflect(struct mbuf *, size_t); void icmp6_prepare(struct mbuf *); void icmp6_redirect_input(struct mbuf *, int); void icmp6_redirect_output(struct mbuf *, struct rtentry *); Modified: head/sys/netinet6/icmp6.c ============================================================================== --- head/sys/netinet6/icmp6.c Tue Dec 3 13:47:46 2019 (r355326) +++ head/sys/netinet6/icmp6.c Tue Dec 3 14:46:38 2019 (r355327) @@ -137,6 +137,7 @@ VNET_DECLARE(int, icmp6_nodeinfo); static void icmp6_errcount(int, int); static int icmp6_rip6_input(struct mbuf **, int); +static void icmp6_reflect(struct mbuf *, size_t); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); static const char *icmp6_redirect_diag(struct in6_addr *, struct in6_addr *, struct in6_addr *); @@ -2034,7 +2035,7 @@ icmp6_rip6_input(struct mbuf **mp, int off) * Reflect the ip6 packet back to the source. * OFF points to the icmp6 header, counted from the top of the mbuf. */ -void +static void icmp6_reflect(struct mbuf *m, size_t off) { struct in6_addr src6, *srcp; From owner-svn-src-all@freebsd.org Tue Dec 3 14:47:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F14061B14CA; Tue, 3 Dec 2019 14:47:50 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S4bB670Rz4SXy; Tue, 3 Dec 2019 14:47:50 +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 B57A91940F; Tue, 3 Dec 2019 14:47:50 +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 xB3Elo76017761; Tue, 3 Dec 2019 14:47:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3EloFR017759; Tue, 3 Dec 2019 14:47:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031447.xB3EloFR017759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 14:47: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: r355328 - in stable/12/sys/dev: ahci usb/controller X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 355328 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 14:47:51 -0000 Author: mav Date: Tue Dec 3 14:47:50 2019 New Revision: 355328 URL: https://svnweb.freebsd.org/changeset/base/355328 Log: MFC r355113: Add some IDs of Intel Wildcat Point-LP. Modified: stable/12/sys/dev/ahci/ahci_pci.c stable/12/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/12/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:46:38 2019 (r355327) +++ stable/12/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:47:50 2019 (r355328) @@ -212,6 +212,10 @@ static const struct { {0x9c078086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0e8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0f8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c838086, 0x00, "Intel Wildcat Point-LP", 0}, + {0x9c858086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c878086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c8f8086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, {0x9d038086, 0x00, "Intel Sunrise Point-LP", 0}, {0x9d058086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, {0x9d078086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, Modified: stable/12/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/12/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:46:38 2019 (r355327) +++ stable/12/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:47:50 2019 (r355328) @@ -182,6 +182,8 @@ ehci_pci_match(device_t self) return ("Intel Wellsburg USB 2.0 controller"); case 0x9c268086: return ("Intel Lynx Point-LP USB 2.0 controller"); + case 0x9ca68086: + return ("Intel Wildcat Point-LP USB 2.0 controller"); case 0x00e01033: return ("NEC uPD 72010x USB 2.0 controller"); From owner-svn-src-all@freebsd.org Tue Dec 3 14:48:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 314A61B156B; Tue, 3 Dec 2019 14:48:14 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S4bf0ZGZz4Sfw; Tue, 3 Dec 2019 14:48:14 +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 EB19A19410; Tue, 3 Dec 2019 14:48:13 +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 xB3EmDH6017837; Tue, 3 Dec 2019 14:48:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3EmD2S017835; Tue, 3 Dec 2019 14:48:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031448.xB3EmD2S017835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 14:48:13 +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: r355329 - in stable/11/sys/dev: ahci usb/controller X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys/dev: ahci usb/controller X-SVN-Commit-Revision: 355329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 14:48:14 -0000 Author: mav Date: Tue Dec 3 14:48:13 2019 New Revision: 355329 URL: https://svnweb.freebsd.org/changeset/base/355329 Log: MFC r355113: Add some IDs of Intel Wildcat Point-LP. Modified: stable/11/sys/dev/ahci/ahci_pci.c stable/11/sys/dev/usb/controller/ehci_pci.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/ahci/ahci_pci.c ============================================================================== --- stable/11/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:47:50 2019 (r355328) +++ stable/11/sys/dev/ahci/ahci_pci.c Tue Dec 3 14:48:13 2019 (r355329) @@ -212,6 +212,10 @@ static const struct { {0x9c078086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0e8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, {0x9c0f8086, 0x00, "Intel Lynx Point-LP (RAID)", 0}, + {0x9c838086, 0x00, "Intel Wildcat Point-LP", 0}, + {0x9c858086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c878086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, + {0x9c8f8086, 0x00, "Intel Wildcat Point-LP (RAID)", 0}, {0x9d038086, 0x00, "Intel Sunrise Point-LP", 0}, {0x9d058086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, {0x9d078086, 0x00, "Intel Sunrise Point-LP (RAID)", 0}, Modified: stable/11/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- stable/11/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:47:50 2019 (r355328) +++ stable/11/sys/dev/usb/controller/ehci_pci.c Tue Dec 3 14:48:13 2019 (r355329) @@ -180,6 +180,8 @@ ehci_pci_match(device_t self) return ("Intel Wellsburg USB 2.0 controller"); case 0x9c268086: return ("Intel Lynx Point-LP USB 2.0 controller"); + case 0x9ca68086: + return ("Intel Wildcat Point-LP USB 2.0 controller"); case 0x00e01033: return ("NEC uPD 72010x USB 2.0 controller"); From owner-svn-src-all@freebsd.org Tue Dec 3 15:14:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 712311B21FA for ; Tue, 3 Dec 2019 15:14:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47S5BW0MQnz4VBJ for ; Tue, 3 Dec 2019 15:14:58 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575386097; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=D1vZwWRJ2zqbQ2tR0ZVqHN8tjXselyMNEmr/lvFXiBqy1gLeQ7/7QbK5ZSz7s7R7YokI4k0DFKiUr um6aUvuwcGr1SaX7wSAGxvl8q497QFz9tOUSRmJ4bpWni11bolySqFqflXwyCUUv02ZPlABcoHUPlu wBHZNzmavmNsIfzeMQsAfyBhqZitVEg60Flrytu/lSVETmv2ycPW5NQwHmgps6CHXzHOZve8jfCig5 EXiKMsn3bE6ygfWv/gQAiXrdv8FwX4oV/Pve3TAvPdvjtoxYjxC8w87VX8Lnxz9M5sFUgXpmKdxMT+ iWkNemHIw/DYOhgGzighSJ4HpHFYUPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=wilq65cdtfA0ndTuNEHGHlj6daG7/wYlxbHaCpNXREg=; b=qHZNyPk4ILzOsCK78oaeJjUw+gWDYtoY4EgtYpnHWGRCTULuT2vR2Xu5D6qHbcvWZJUDVXUNzcSkk vSSYS6EbMe61rjcuT1o6sMEgo83cSaVwgQoA1nK8rSGvkGfD6gjxl6RofHOieeeF+OdTwEEFc0CHiT prVHZgyZKC8ifeIjaBKw7WBJC07EcfIHQj3ks840GvB3TyMJy+nGpaVgYOnoFjc8vom+tvwk7AGdWy cNyp+cDrlNaeQks4taodWEONFILCUAaIhCAywku11Ij1PDOGOIoaC9FjvH3o08JQXWxCV0WzaNsXU8 FA4Q/rApZpW/pcdNxLH2oIpC9HKwAVw== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=wilq65cdtfA0ndTuNEHGHlj6daG7/wYlxbHaCpNXREg=; b=QSJ2A2N9xOWi3RVr1hOYQNdeDs1V8zpZi4WG9WYAN0QHAGM3wrMAoWK8KDZqVwaTaKuozBXrY8xpq wO+A/V64iIJ8hNt4mso9usFSXsvd9u/FwnU3ej5Uh7cXQAMcwveTPY/Xz6hekVjuQGDTL+zubCZgUj C+Dl86qvGAh9TY7h8ojM8Kr1w/qbQPe5fQmskRP7MraoTUv448Ds45hO8opH31RzBWQUdnQJWIbi3J CEpf1SPN/P8N2LEJ5pAvaYrVnyl3T0iTuxN2pQi1SX140L+YwXSe0kITlZIgA8mtV1k8GPZ8d2Rqb9 73VgDyDE3OLzE9xCO9SEqZND9nqB0BA== X-MHO-RoutePath: aGlwcGll X-MHO-User: a90c9068-15df-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id a90c9068-15df-11ea-829e-79a40d15cccd; Tue, 03 Dec 2019 15:14:55 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3FEs8t099861; Tue, 3 Dec 2019 08:14:54 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <8044a2f1096df626368183dd1ae77f5ac2e43b70.camel@freebsd.org> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve From: Ian Lepore To: rgrimes@freebsd.org Cc: Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 03 Dec 2019 08:14:54 -0700 In-Reply-To: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> References: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S5BW0MQnz4VBJ X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.96)[-0.965,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-0.93)[-0.934,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 15:14:59 -0000 On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: > > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > > Author: vmaffione > > > Date: Mon Dec 2 20:51:46 2019 > > > New Revision: 355301 > > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > > > Log: > > > bhyve: uniform printf format string newlines > > > > > > Some of the printf statements only use LF to get a newline. > > > However, a CR character is also required for the serial console to > > > print debug logs in a nice way. > > > Fix those code locations that only use LF, by adding a CR > > > character. > > > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > > MFC after: 1 week > > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > > > Modified: > > > head/usr.sbin/bhyve/audio.c > > > head/usr.sbin/bhyve/hda_codec.c > > > head/usr.sbin/bhyve/net_backends.c > > > head/usr.sbin/bhyve/pci_ahci.c > > > head/usr.sbin/bhyve/pci_e82545.c > > > head/usr.sbin/bhyve/pci_hda.c > > > head/usr.sbin/bhyve/pci_nvme.c > > > head/usr.sbin/bhyve/pci_virtio_block.c > > > head/usr.sbin/bhyve/pci_virtio_console.c > > > head/usr.sbin/bhyve/pci_virtio_net.c > > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > > head/usr.sbin/bhyve/pci_xhci.c > > > head/usr.sbin/bhyve/rfb.c > > > > > > > These changes seem wrong in a couple ways... > > > > - Lines are terminated by linefeeds in unix-like systems. If > > linefeeds need to be translated to include carriage returns, that's the > > responsibility of the terminal/line-discipline layer, not the source > > strings being printed. > > Fully agree, this change seems wrong to me for Ian's stated reason here. > > > > > - The sequence \n\r is very strange. For systems that do prefer > > carriage returns, the \r always comes before the \n (or stands alone on > > Mac systems), not after. > > > > I have a feeling that the root of this is something like "lots of > > people use bhyve for Windows, so they use Windows apps to look at logs, > > so the logs should be formatted for Windows." If that's the reasoning, > > then why shouldn't we convert EVERY printf in the source base to > > include carriage returns, just in case a windows user wants to browse a > > log file? > > This is not that issue, it is something going on with the line > discipline when using the bhyve console device. I believe the > line displine being different from what bhyve itself is expecting > so when console output is intermixed with output from bhyve itself > things go wrong. > > The printf's in this patch are coming from the bhyve process that > has a fd open to the launching tty, the line discipline on that tty > is changed to something different after you open the > console device from that same controlling tty, or that is my hypothosis > on what is going wrong. There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would definitely turn off nl->crnl translations. I think that is the other end of the bhyve console that I posted a patch for yesterday, and I think the console driver is probably still the right place to do that translation (because other console drivers do it that way). But I'm not set up to run bhyve here, so I can't test my theory. -- Ian From owner-svn-src-all@freebsd.org Tue Dec 3 15:24:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4E781B27AF; Tue, 3 Dec 2019 15:24:10 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47S5P63K0Bz4VvX; Tue, 3 Dec 2019 15:24:09 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB3FO6on035565; Tue, 3 Dec 2019 07:24:06 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB3FO6Zc035564; Tue, 3 Dec 2019 07:24:06 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912031524.xB3FO6Zc035564@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve In-Reply-To: <8044a2f1096df626368183dd1ae77f5ac2e43b70.camel@freebsd.org> To: Ian Lepore Date: Tue, 3 Dec 2019 07:24:06 -0800 (PST) CC: rgrimes@freebsd.org, Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47S5P63K0Bz4VvX X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-0.99)[-0.993,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 15:24:10 -0000 > On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: > > > On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > > > Author: vmaffione > > > > Date: Mon Dec 2 20:51:46 2019 > > > > New Revision: 355301 > > > > URL: https://svnweb.freebsd.org/changeset/base/355301 > > > > > > > > Log: > > > > bhyve: uniform printf format string newlines > > > > > > > > Some of the printf statements only use LF to get a newline. > > > > However, a CR character is also required for the serial console to > > > > print debug logs in a nice way. > > > > Fix those code locations that only use LF, by adding a CR > > > > character. > > > > > > > > Reviewed by: markj, aleksandr.fedorov@itglobal.com > > > > MFC after: 1 week > > > > Differential Revision: https://reviews.freebsd.org/D22552 > > > > > > > > Modified: > > > > head/usr.sbin/bhyve/audio.c > > > > head/usr.sbin/bhyve/hda_codec.c > > > > head/usr.sbin/bhyve/net_backends.c > > > > head/usr.sbin/bhyve/pci_ahci.c > > > > head/usr.sbin/bhyve/pci_e82545.c > > > > head/usr.sbin/bhyve/pci_hda.c > > > > head/usr.sbin/bhyve/pci_nvme.c > > > > head/usr.sbin/bhyve/pci_virtio_block.c > > > > head/usr.sbin/bhyve/pci_virtio_console.c > > > > head/usr.sbin/bhyve/pci_virtio_net.c > > > > head/usr.sbin/bhyve/pci_virtio_rnd.c > > > > head/usr.sbin/bhyve/pci_virtio_scsi.c > > > > head/usr.sbin/bhyve/pci_xhci.c > > > > head/usr.sbin/bhyve/rfb.c > > > > > > > > > > These changes seem wrong in a couple ways... > > > > > > - Lines are terminated by linefeeds in unix-like systems. If > > > linefeeds need to be translated to include carriage returns, that's the > > > responsibility of the terminal/line-discipline layer, not the source > > > strings being printed. > > > > Fully agree, this change seems wrong to me for Ian's stated reason here. > > > > > > > > - The sequence \n\r is very strange. For systems that do prefer > > > carriage returns, the \r always comes before the \n (or stands alone on > > > Mac systems), not after. > > > > > > I have a feeling that the root of this is something like "lots of > > > people use bhyve for Windows, so they use Windows apps to look at logs, > > > so the logs should be formatted for Windows." If that's the reasoning, > > > then why shouldn't we convert EVERY printf in the source base to > > > include carriage returns, just in case a windows user wants to browse a > > > log file? > > > > This is not that issue, it is something going on with the line > > discipline when using the bhyve console device. I believe the > > line displine being different from what bhyve itself is expecting > > so when console output is intermixed with output from bhyve itself > > things go wrong. > > > > The printf's in this patch are coming from the bhyve process that > > has a fd open to the launching tty, the line discipline on that tty > > is changed to something different after you open the > > console device from that same controlling tty, or that is my hypothosis > > on what is going wrong. > > There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would > definitely turn off nl->crnl translations. I think that is the other > end of the bhyve console that I posted a patch for yesterday, and I > think the console driver is probably still the right place to do that > translation (because other console drivers do it that way). But I'm > not set up to run bhyve here, so I can't test my theory. If no body gets it done by the time I return to Portland I'll test your patch to see if it fixes the issues I have seen with use of the console and bhyve mixing output. > -- Ian -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Tue Dec 3 15:48:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D887C1B31A4; Tue, 3 Dec 2019 15:48:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S5xC5N59z4XKf; Tue, 3 Dec 2019 15:48:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9773719EE5; Tue, 3 Dec 2019 15:48:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3FmVTF054790; Tue, 3 Dec 2019 15:48:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3FmSDs054775; Tue, 3 Dec 2019 15:48:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201912031548.xB3FmSDs054775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 3 Dec 2019 15:48:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355330 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 355330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 15:48:31 -0000 Author: imp Date: Tue Dec 3 15:48:28 2019 New Revision: 355330 URL: https://svnweb.freebsd.org/changeset/base/355330 Log: Regularize copyright notices for me. Remove stray All Rights Reserved and other non-license stuff. Make sure all copyrights have year. Modified: head/share/man/man9/BUS_ADD_CHILD.9 head/share/man/man9/bus_activate_resource.9 head/share/man/man9/bus_child_present.9 head/share/man/man9/bus_set_resource.9 head/share/man/man9/bus_space.9 head/share/man/man9/config_intrhook.9 head/share/man/man9/device_get_name.9 head/share/man/man9/device_get_parent.9 head/share/man/man9/device_get_sysctl.9 head/share/man/man9/device_printf.9 head/share/man/man9/device_set_driver.9 head/share/man/man9/owll.9 head/share/man/man9/own.9 head/share/man/man9/resource_int_value.9 Modified: head/share/man/man9/BUS_ADD_CHILD.9 ============================================================================== --- head/share/man/man9/BUS_ADD_CHILD.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/BUS_ADD_CHILD.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2004 M. Warner Losh. -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2004 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/bus_activate_resource.9 ============================================================================== --- head/share/man/man9/bus_activate_resource.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/bus_activate_resource.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2004 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/bus_child_present.9 ============================================================================== --- head/share/man/man9/bus_child_present.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/bus_child_present.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/bus_set_resource.9 ============================================================================== --- head/share/man/man9/bus_set_resource.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/bus_set_resource.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/bus_space.9 ============================================================================== --- head/share/man/man9/bus_space.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/bus_space.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,6 +1,6 @@ .\" $NetBSD: bus_space.9,v 1.9 1999/03/06 22:09:29 mycroft Exp $ .\" -.\" Copyright (c) 2005 M. Warner Losh. +.\" Copyright (c) 2005 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/config_intrhook.9 ============================================================================== --- head/share/man/man9/config_intrhook.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/config_intrhook.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,5 +1,5 @@ .\" -.\" Copyright (C) 2006 M. Warner Losh . +.\" Copyright (C) 2006 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/device_get_name.9 ============================================================================== --- head/share/man/man9/device_get_name.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/device_get_name.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/device_get_parent.9 ============================================================================== --- head/share/man/man9/device_get_parent.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/device_get_parent.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/device_get_sysctl.9 ============================================================================== --- head/share/man/man9/device_get_sysctl.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/device_get_sysctl.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2006 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2006 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/device_printf.9 ============================================================================== --- head/share/man/man9/device_printf.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/device_printf.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/device_set_driver.9 ============================================================================== --- head/share/man/man9/device_set_driver.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/device_set_driver.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/owll.9 ============================================================================== --- head/share/man/man9/owll.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/owll.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2015 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2015 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/own.9 ============================================================================== --- head/share/man/man9/own.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/own.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2015 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2015 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man9/resource_int_value.9 ============================================================================== --- head/share/man/man9/resource_int_value.9 Tue Dec 3 14:48:13 2019 (r355329) +++ head/share/man/man9/resource_int_value.9 Tue Dec 3 15:48:28 2019 (r355330) @@ -1,10 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2001 M. Warner Losh -.\" -.\" All rights reserved. -.\" -.\" This program is free software. +.\" Copyright (c) 2001 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Tue Dec 3 16:32:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FAC61B4AA8; Tue, 3 Dec 2019 16:32:31 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S6vz2P4Zz4Zjr; Tue, 3 Dec 2019 16:32:31 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 358D11A806; Tue, 3 Dec 2019 16:32:31 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GWVb9083447; Tue, 3 Dec 2019 16:32:31 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GWVuU083446; Tue, 3 Dec 2019 16:32:31 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201912031632.xB3GWVuU083446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Tue, 3 Dec 2019 16:32: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: r355331 - stable/12/sys/compat/linprocfs X-SVN-Group: stable-12 X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: stable/12/sys/compat/linprocfs X-SVN-Commit-Revision: 355331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:32:31 -0000 Author: cognet Date: Tue Dec 3 16:32:30 2019 New Revision: 355331 URL: https://svnweb.freebsd.org/changeset/base/355331 Log: MFC r354602 linprocfs: Make sure to report -1 as tty when we have no controlling tty. When reporting a process' stats, we can't just provide the tty as an unsigned long, as if we have no controlling tty, the tty would be NODEV, or -1. Instaed, just special-case NODEV. Modified: stable/12/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/12/sys/compat/linprocfs/linprocfs.c Tue Dec 3 15:48:28 2019 (r355330) +++ stable/12/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:32:30 2019 (r355331) @@ -737,7 +737,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + if (kp.ki_tdev == NODEV) + PS_ADD("tty", "%s", "-1"); + else + PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); From owner-svn-src-all@freebsd.org Tue Dec 3 16:33:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D24011B4B36; Tue, 3 Dec 2019 16:33:35 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S6xC5BSZz4ZrJ; Tue, 3 Dec 2019 16:33:35 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 951A11A80A; Tue, 3 Dec 2019 16:33:35 +0000 (UTC) (envelope-from cognet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GXZXa083574; Tue, 3 Dec 2019 16:33:35 GMT (envelope-from cognet@FreeBSD.org) Received: (from cognet@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GXZ6q083573; Tue, 3 Dec 2019 16:33:35 GMT (envelope-from cognet@FreeBSD.org) Message-Id: <201912031633.xB3GXZ6q083573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cognet set sender to cognet@FreeBSD.org using -f From: Olivier Houchard Date: Tue, 3 Dec 2019 16:33:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355332 - stable/11/sys/compat/linprocfs X-SVN-Group: stable-11 X-SVN-Commit-Author: cognet X-SVN-Commit-Paths: stable/11/sys/compat/linprocfs X-SVN-Commit-Revision: 355332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:33:35 -0000 Author: cognet Date: Tue Dec 3 16:33:35 2019 New Revision: 355332 URL: https://svnweb.freebsd.org/changeset/base/355332 Log: MFC r354602 linprocfs: Make sure to report -1 as tty when we have no controlling tty. When reporting a process' stats, we can't just provide the tty as an unsigned long, as if we have no controlling tty, the tty would be NODEV, or -1. Instaed, just special-case NODEV. Modified: stable/11/sys/compat/linprocfs/linprocfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/11/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:32:30 2019 (r355331) +++ stable/11/sys/compat/linprocfs/linprocfs.c Tue Dec 3 16:33:35 2019 (r355332) @@ -618,7 +618,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS) PS_ADD("pgrp", "%d", p->p_pgid); PS_ADD("session", "%d", p->p_session->s_sid); PROC_UNLOCK(p); - PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); + if (kp.ki_tdev == NODEV) + PS_ADD("tty", "%s", "-1"); + else + PS_ADD("tty", "%ju", (uintmax_t)kp.ki_tdev); PS_ADD("tpgid", "%d", kp.ki_tpgid); PS_ADD("flags", "%u", 0); /* XXX */ PS_ADD("minflt", "%lu", kp.ki_rusage.ru_minflt); From owner-svn-src-all@freebsd.org Tue Dec 3 16:42:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 929861B4E5E; Tue, 3 Dec 2019 16:42:33 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S77Y3QJZz4bHg; Tue, 3 Dec 2019 16:42:33 +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 58AB11A9C3; Tue, 3 Dec 2019 16:42:33 +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 xB3GgXU7089747; Tue, 3 Dec 2019 16:42:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GgXRD089746; Tue, 3 Dec 2019 16:42:33 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031642.xB3GgXRD089746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:42: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: r355333 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 355333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:42:33 -0000 Author: mav Date: Tue Dec 3 16:42:32 2019 New Revision: 355333 URL: https://svnweb.freebsd.org/changeset/base/355333 Log: MFC r341756 (by scottl): Don't allocate the config_intrhook separately from the softc, it's small enough that it costs more code to handle the malloc/free than it saves. Modified: stable/12/sys/cam/cam_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:33:35 2019 (r355332) +++ stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:42:32 2019 (r355333) @@ -129,7 +129,7 @@ struct xpt_softc { TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook *xpt_config_hook; + struct intr_config_hook xpt_config_hook; int boot_delay; struct callout boot_callout; @@ -982,17 +982,8 @@ xpt_init(void *dummy) /* * Register a callback for when interrupts are enabled. */ - xsoftc.xpt_config_hook = - (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook), - M_CAMXPT, M_NOWAIT | M_ZERO); - if (xsoftc.xpt_config_hook == NULL) { - printf("xpt_init: Cannot malloc config hook " - "- failing attach\n"); - return (ENOMEM); - } - xsoftc.xpt_config_hook->ich_func = xpt_config; - if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) { - free (xsoftc.xpt_config_hook, M_CAMXPT); + xsoftc.xpt_config_hook.ich_func = xpt_config; + if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { printf("xpt_init: config_intrhook_establish failed " "- failing attach\n"); } @@ -5262,9 +5253,7 @@ xpt_finishconfig_task(void *context, int pending) xpt_for_all_devices(xptpassannouncefunc, NULL); /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(xsoftc.xpt_config_hook); - free(xsoftc.xpt_config_hook, M_CAMXPT); - xsoftc.xpt_config_hook = NULL; + config_intrhook_disestablish(&xsoftc.xpt_config_hook); free(context, M_CAMXPT); } From owner-svn-src-all@freebsd.org Tue Dec 3 16:45:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F9E31B4FD6; Tue, 3 Dec 2019 16:45:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7CQ3nwcz4bSW; Tue, 3 Dec 2019 16:45:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 659AF1A9E8; Tue, 3 Dec 2019 16:45:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Gjsog089959; Tue, 3 Dec 2019 16:45:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GjsHv089958; Tue, 3 Dec 2019 16:45:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912031645.xB3GjsHv089958@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 3 Dec 2019 16:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355334 - head/sys/dev/syscons X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/syscons X-SVN-Commit-Revision: 355334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:45:54 -0000 Author: emaste Date: Tue Dec 3 16:45:53 2019 New Revision: 355334 URL: https://svnweb.freebsd.org/changeset/base/355334 Log: scterm-sc.c: convert source file to UTF-8 encoding Most source files are already ASCII or UTF-8 but this one was not previously converted. Modified: head/sys/dev/syscons/scterm-sc.c Modified: head/sys/dev/syscons/scterm-sc.c ============================================================================== --- head/sys/dev/syscons/scterm-sc.c Tue Dec 3 16:42:32 2019 (r355333) +++ head/sys/dev/syscons/scterm-sc.c Tue Dec 3 16:45:53 2019 (r355334) @@ -1,6 +1,6 @@ /*- * Copyright (c) 1999 Kazutaka YOKOTA - * Copyright (c) 1992-1998 Søren Schmidt + * Copyright (c) 1992-1998 Søren Schmidt * All rights reserved. * * Redistribution and use in source and binary forms, with or without From owner-svn-src-all@freebsd.org Tue Dec 3 16:46:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DBBA1B5071; Tue, 3 Dec 2019 16:46:45 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7DP1PpZz4bbT; Tue, 3 Dec 2019 16:46:45 +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 14D861A9E9; Tue, 3 Dec 2019 16:46:45 +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 xB3Gki1i090049; Tue, 3 Dec 2019 16:46:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GkiB6090048; Tue, 3 Dec 2019 16:46:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031646.xB3GkiB6090048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:46:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355335 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 355335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:46:45 -0000 Author: mav Date: Tue Dec 3 16:46:44 2019 New Revision: 355335 URL: https://svnweb.freebsd.org/changeset/base/355335 Log: MFC r354914: Set handling for some "Logical unit not ready" errors. Modified: stable/12/sys/cam/scsi/scsi_all.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_all.c Tue Dec 3 16:45:53 2019 (r355334) +++ stable/12/sys/cam/scsi/scsi_all.c Tue Dec 3 16:46:44 2019 (r355335) @@ -1112,7 +1112,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x08, SS_FATAL | EBUSY, "Logical unit not ready, long write in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x09, SS_FATAL | EBUSY, "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0A, SS_WAIT | ENXIO, @@ -1130,37 +1130,37 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x0E, SS_RDEF, /* XXX TBD */ "Logical unit not ready, security session in progress") }, /* DT WROM B */ - { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x10, SS_FATAL | ENODEV, "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_WAIT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | ENXIO, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ - { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x12, SS_FATAL | ENXIO, "Logical unit not ready, offline") }, /* DT R MAEBKV */ - { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x13, SS_WAIT | EBUSY, "Logical unit not ready, SA creation in progress") }, /* D B */ - { SST(0x04, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x14, SS_WAIT | ENOSPC, "Logical unit not ready, space allocation in progress") }, /* M */ - { SST(0x04, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x15, SS_FATAL | ENXIO, "Logical unit not ready, robotics disabled") }, /* M */ - { SST(0x04, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x16, SS_FATAL | ENXIO, "Logical unit not ready, configuration required") }, /* M */ - { SST(0x04, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x17, SS_FATAL | ENXIO, "Logical unit not ready, calibration required") }, /* M */ - { SST(0x04, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x18, SS_FATAL | ENXIO, "Logical unit not ready, a door is open") }, /* M */ - { SST(0x04, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x19, SS_FATAL | ENODEV, "Logical unit not ready, operating in sequential mode") }, /* DT B */ - { SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1A, SS_WAIT | EBUSY, "Logical unit not ready, START/STOP UNIT command in progress") }, /* D B */ { SST(0x04, 0x1B, SS_WAIT | EBUSY, @@ -1169,7 +1169,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1C, SS_START | SSQ_DECREMENT_COUNT | ENXIO, "Logical unit not ready, additional power use not yet granted") }, /* D */ - { SST(0x04, 0x1D, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1D, SS_WAIT | EBUSY, "Logical unit not ready, configuration in progress") }, /* D */ { SST(0x04, 0x1E, SS_FATAL | ENXIO, @@ -1178,14 +1178,20 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1F, SS_FATAL | ENXIO, "Logical unit not ready, microcode download required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x20, SS_FATAL | ENXIO, "Logical unit not ready, logical unit reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x21, SS_FATAL | ENXIO, "Logical unit not ready, hard reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x22, SS_FATAL | ENXIO, "Logical unit not ready, power cycle required") }, + /* D */ + { SST(0x04, 0x23, SS_FATAL | ENXIO, + "Logical unit not ready, affiliation required") }, + /* D */ + { SST(0x04, 0x24, SS_FATAL | EBUSY, + "Depopulation in progress") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -3384,7 +3390,7 @@ scsi_error_action(struct ccb_scsiio *csio, struct scsi if (!scsi_extract_sense_ccb((union ccb *)csio, &error_code, &sense_key, &asc, &ascq)) { - action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + action = SS_RDEF; } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* From owner-svn-src-all@freebsd.org Tue Dec 3 16:47:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BEC91B50F4; Tue, 3 Dec 2019 16:47:05 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7Dn2GwXz4bjG; Tue, 3 Dec 2019 16:47:05 +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 329921A9EA; Tue, 3 Dec 2019 16:47:05 +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 xB3Gl4Zg090124; Tue, 3 Dec 2019 16:47:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Gl4mE090123; Tue, 3 Dec 2019 16:47:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031647.xB3Gl4mE090123@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355336 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 355336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:47:05 -0000 Author: mav Date: Tue Dec 3 16:47:04 2019 New Revision: 355336 URL: https://svnweb.freebsd.org/changeset/base/355336 Log: MFC r354914: Set handling for some "Logical unit not ready" errors. Modified: stable/11/sys/cam/scsi/scsi_all.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_all.c Tue Dec 3 16:46:44 2019 (r355335) +++ stable/11/sys/cam/scsi/scsi_all.c Tue Dec 3 16:47:04 2019 (r355336) @@ -1110,7 +1110,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x08, SS_FATAL | EBUSY, "Logical unit not ready, long write in progress") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x09, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x09, SS_FATAL | EBUSY, "Logical unit not ready, self-test in progress") }, /* DTLPWROMAEBKVF */ { SST(0x04, 0x0A, SS_WAIT | ENXIO, @@ -1128,37 +1128,37 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x0E, SS_RDEF, /* XXX TBD */ "Logical unit not ready, security session in progress") }, /* DT WROM B */ - { SST(0x04, 0x10, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x10, SS_FATAL | ENODEV, "Logical unit not ready, auxiliary memory not accessible") }, /* DT WRO AEB VF */ - { SST(0x04, 0x11, SS_WAIT | EBUSY, + { SST(0x04, 0x11, SS_WAIT | ENXIO, "Logical unit not ready, notify (enable spinup) required") }, /* M V */ - { SST(0x04, 0x12, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x12, SS_FATAL | ENXIO, "Logical unit not ready, offline") }, /* DT R MAEBKV */ - { SST(0x04, 0x13, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x13, SS_WAIT | EBUSY, "Logical unit not ready, SA creation in progress") }, /* D B */ - { SST(0x04, 0x14, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x14, SS_WAIT | ENOSPC, "Logical unit not ready, space allocation in progress") }, /* M */ - { SST(0x04, 0x15, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x15, SS_FATAL | ENXIO, "Logical unit not ready, robotics disabled") }, /* M */ - { SST(0x04, 0x16, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x16, SS_FATAL | ENXIO, "Logical unit not ready, configuration required") }, /* M */ - { SST(0x04, 0x17, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x17, SS_FATAL | ENXIO, "Logical unit not ready, calibration required") }, /* M */ - { SST(0x04, 0x18, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x18, SS_FATAL | ENXIO, "Logical unit not ready, a door is open") }, /* M */ - { SST(0x04, 0x19, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x19, SS_FATAL | ENODEV, "Logical unit not ready, operating in sequential mode") }, /* DT B */ - { SST(0x04, 0x1A, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1A, SS_WAIT | EBUSY, "Logical unit not ready, START/STOP UNIT command in progress") }, /* D B */ { SST(0x04, 0x1B, SS_WAIT | EBUSY, @@ -1167,7 +1167,7 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1C, SS_RDEF, /* XXX TBD */ "Logical unit not ready, additional power use not yet granted") }, /* D */ - { SST(0x04, 0x1D, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x1D, SS_WAIT | EBUSY, "Logical unit not ready, configuration in progress") }, /* D */ { SST(0x04, 0x1E, SS_FATAL | ENXIO, @@ -1176,14 +1176,20 @@ static struct asc_table_entry asc_table[] = { { SST(0x04, 0x1F, SS_FATAL | ENXIO, "Logical unit not ready, microcode download required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x20, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x20, SS_FATAL | ENXIO, "Logical unit not ready, logical unit reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x21, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x21, SS_FATAL | ENXIO, "Logical unit not ready, hard reset required") }, /* DTLPWROMAEBKVF */ - { SST(0x04, 0x22, SS_RDEF, /* XXX TBD */ + { SST(0x04, 0x22, SS_FATAL | ENXIO, "Logical unit not ready, power cycle required") }, + /* D */ + { SST(0x04, 0x23, SS_FATAL | ENXIO, + "Logical unit not ready, affiliation required") }, + /* D */ + { SST(0x04, 0x24, SS_FATAL | EBUSY, + "Depopulation in progress") }, /* DTL WROMAEBKVF */ { SST(0x05, 0x00, SS_RDEF, "Logical unit does not respond to selection") }, @@ -3382,7 +3388,7 @@ scsi_error_action(struct ccb_scsiio *csio, struct scsi if (!scsi_extract_sense_ccb((union ccb *)csio, &error_code, &sense_key, &asc, &ascq)) { - action = SS_RETRY | SSQ_DECREMENT_COUNT | SSQ_PRINT_SENSE | EIO; + action = SS_RDEF; } else if ((error_code == SSD_DEFERRED_ERROR) || (error_code == SSD_DESC_DEFERRED_ERROR)) { /* From owner-svn-src-all@freebsd.org Tue Dec 3 16:48:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 015461B5191 for ; Tue, 3 Dec 2019 16:48:04 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7Fv4GXZz4bqm for ; Tue, 3 Dec 2019 16:48:03 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575391682; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=PxPXEPjPTIT9kpT+ANYnOt2qk3bHbSFrvvj9q9cs8v4kzg31oiivjxD0MemBWJexQASEVWp+klpwW gGQibYBxr8NzkcUxpN14mmhf1hcdvgQiO/uilz/WjzkxNkLyyipSoB69/uTdnmYxi5QFNF4W378Gto BEGdBS3hH+EcZ6d+2TJe47znm+25MtleA5EVO+4KKjX41546/i4QrnvUFS9TGebJYrLtE2FIIniIK3 I5PhShH0fjtmBsjjIfJra6PFHNlT4uS64R3NkaGf3+ttnBww0Q+UmEjrl/R89UMxFXyJGEVRHXSkAc rgHW66aQk45DaC/MjG3jBq+c3kF0mjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=fVScYyi6OOvqH/jbzWTFs83auAKgqy/7ruZ2m0sxJ0I=; b=oGrYQt96a8eiSYroQhwt/lhqHBJ8ayh2q9i8YvsRh+TxMlVB10Vx45E0WzyivfO+WqajKvIOPtfoE GYP2oHxcAhaeGzQlYxOFI2TrNPhU/X6gBignTicYdWvoNfOApxQl5gmDb4jUKPzdW/zS2UpA2yyo3/ ttE/XwmE07n/lthpQDbLDQeUzn+AKwsvJ1IbGhFgSOixf1alWX74nYTMexhm9RDXBjq8qXIgfQVFN3 b1sSsYuGcCYeC8pGeY+ZocJBWPMQKyoUv8u6udH1Z3sA2aKua2hbchK/XNktcBbpRWVeCixyMlOhBP 3mBTneAzr+uttZpYKqE53HhJCyeTBfg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=fVScYyi6OOvqH/jbzWTFs83auAKgqy/7ruZ2m0sxJ0I=; b=cFJeuh5zJaJlGf7hjHv3PhE8braZPJHq7O8uhsMoL9B0ye5JlGXllLFLgVIxNUDfy9fjynxt0tndP p/iHR27k2PwmGzcmD8Ncslgx22YrN09RZRQknX/Qm0f/Y5ikt9iOVIwMT0f5xb25Bo9pRBIgXToMrh /Xbf8OALDDmfiw3QqMYEUlZ2phN7mwlDeBPr+2RN8O35bW/MF56ZZFgpPH4/X4vnjO6ect8+EgIURb MfxihCgDypS/33t5SdrbMP9fEpaO2skM8drgS1NSWtmZ/0kjSGKx+9XAP77VPFru0ty1oMgU9U18em KLmRqgrxj2b1beyo11stqKWK61enqgA== X-MHO-RoutePath: aGlwcGll X-MHO-User: aa0acccf-15ec-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id aa0acccf-15ec-11ea-b80c-052b4a66b6b2; Tue, 03 Dec 2019 16:48:00 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3GlxRH000203; Tue, 3 Dec 2019 09:47:59 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r355333 - stable/12/sys/cam From: Ian Lepore To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Date: Tue, 03 Dec 2019 09:47:59 -0700 In-Reply-To: <201912031642.xB3GgXRD089746@repo.freebsd.org> References: <201912031642.xB3GgXRD089746@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S7Fv4GXZz4bqm X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.968,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-0.94)[-0.943,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:48:04 -0000 On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: > Author: mav > Date: Tue Dec 3 16:42:32 2019 > New Revision: 355333 > URL: https://svnweb.freebsd.org/changeset/base/355333 > > Log: > MFC r341756 (by scottl): > Don't allocate the config_intrhook separately from the softc, it's > small > enough that it costs more code to handle the malloc/free than it > saves. > If it's a situation where the called hook routine always does a disestablish of the hook (and nothing else does so), just use config_intrhook_oneshot() and you don't need to manage the data struct yourself at all. -- Ian From owner-svn-src-all@freebsd.org Tue Dec 3 16:48:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED71C1B522C; Tue, 3 Dec 2019 16:48:22 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7GG5YB9z4bxg; Tue, 3 Dec 2019 16:48:22 +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 A1A5C1A9EC; Tue, 3 Dec 2019 16:48:22 +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 xB3GmMeo090239; Tue, 3 Dec 2019 16:48:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GmM3j090234; Tue, 3 Dec 2019 16:48:22 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031648.xB3GmM3j090234@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355337 - in stable/12/sys/cam: . scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/cam: . scsi X-SVN-Commit-Revision: 355337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:48:23 -0000 Author: mav Date: Tue Dec 3 16:48:21 2019 New Revision: 355337 URL: https://svnweb.freebsd.org/changeset/base/355337 Log: MFC r355010: Make CAM use root_mount_hold_token() to delay boot. Before this change CAM used config_intrhook_establish() for this purpose, but that approach does not allow to delay it again after releasing once. USB stack uses root_mount_hold() to delay boot until bus scan is complete. But once it is, CAM had no time to scan SCSI bus, registered by umass(4), if it already done other scans and called config_intrhook_disestablish(). The new approach makes it work smooth, assuming the USB device is found during the initial bus scan. Devices appearing on USB bus later may still require setting kern.cam.boot_delay, but hopefully those are minority. Modified: stable/12/sys/cam/cam_xpt.c stable/12/sys/cam/scsi/scsi_enc.c stable/12/sys/cam/scsi/scsi_enc_internal.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:47:04 2019 (r355336) +++ stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:48:21 2019 (r355337) @@ -99,13 +99,6 @@ MALLOC_DEFINE(M_CAMDEV, "CAM DEV", "CAM devices"); MALLOC_DEFINE(M_CAMCCB, "CAM CCB", "CAM CCBs"); MALLOC_DEFINE(M_CAMPATH, "CAM path", "CAM paths"); -/* Object for defering XPT actions to a taskqueue */ -struct xpt_task { - struct task task; - void *data1; - uintptr_t data2; -}; - struct xpt_softc { uint32_t xpt_generation; @@ -129,10 +122,10 @@ struct xpt_softc { TAILQ_HEAD(,cam_eb) xpt_busses; u_int bus_generation; - struct intr_config_hook xpt_config_hook; - int boot_delay; struct callout boot_callout; + struct task boot_task; + struct root_hold_token xpt_rootmount; struct mtx xpt_topo_lock; struct mtx xpt_lock; @@ -273,6 +266,7 @@ static struct cam_et* static struct cam_ed* xpt_find_device(struct cam_et *target, lun_id_t lun_id); static void xpt_config(void *arg); +static void xpt_hold_boot_locked(void); static int xpt_schedule_dev(struct camq *queue, cam_pinfo *dev_pinfo, u_int32_t new_priority); static xpt_devicefunc_t xptpassannouncefunc; @@ -881,7 +875,7 @@ xpt_rescan(union ccb *ccb) } } TAILQ_INSERT_TAIL(&xsoftc.ccb_scanq, &ccb->ccb_h, sim_links.tqe); - xsoftc.buses_to_config++; + xpt_hold_boot_locked(); wakeup(&xsoftc.ccb_scanq); xpt_unlock_buses(); } @@ -913,6 +907,7 @@ xpt_init(void *dummy) */ xsoftc.boot_delay = CAM_BOOT_DELAY; #endif + /* * The xpt layer is, itself, the equivalent of a SIM. * Allow 16 ccbs in the ccb pool for it. This should @@ -979,14 +974,11 @@ xpt_init(void *dummy) "- failing attach\n"); return (ENOMEM); } + /* * Register a callback for when interrupts are enabled. */ - xsoftc.xpt_config_hook.ich_func = xpt_config; - if (config_intrhook_establish(&xsoftc.xpt_config_hook) != 0) { - printf("xpt_init: config_intrhook_establish failed " - "- failing attach\n"); - } + config_intrhook_oneshot(xpt_config, NULL); return (0); } @@ -5148,6 +5140,10 @@ xpt_stop_tags(struct cam_path *path) xpt_action((union ccb *)&crs); } +/* + * Assume all possible buses are detected by this time, so allow boot + * as soon as they all are scanned. + */ static void xpt_boot_delay(void *arg) { @@ -5155,12 +5151,26 @@ xpt_boot_delay(void *arg) xpt_release_boot(); } +/* + * Now that all config hooks have completed, start boot_delay timer, + * waiting for possibly still undetected buses (USB) to appear. + */ static void +xpt_ch_done(void *arg) +{ + + callout_init(&xsoftc.boot_callout, 1); + callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, + xpt_boot_delay, NULL, 0); +} +SYSINIT(xpt_hw_delay, SI_SUB_INT_CONFIG_HOOKS, SI_ORDER_ANY, xpt_ch_done, NULL); + +/* + * Now that interrupts are enabled, go find our devices + */ +static void xpt_config(void *arg) { - /* - * Now that interrupts are enabled, go find our devices - */ if (taskqueue_start_threads(&xsoftc.xpt_taskq, 1, PRIBIO, "CAM taskq")) printf("xpt_config: failed to create taskqueue thread.\n"); @@ -5179,9 +5189,7 @@ xpt_config(void *arg) periphdriver_init(1); xpt_hold_boot(); - callout_init(&xsoftc.boot_callout, 1); - callout_reset_sbt(&xsoftc.boot_callout, SBT_1MS * xsoftc.boot_delay, 0, - xpt_boot_delay, NULL, 0); + /* Fire up rescan thread. */ if (kproc_kthread_add(xpt_scanner_thread, NULL, &cam_proc, NULL, 0, 0, "cam", "scanner")) { @@ -5190,31 +5198,38 @@ xpt_config(void *arg) } void +xpt_hold_boot_locked(void) +{ + + if (xsoftc.buses_to_config++ == 0) + root_mount_hold_token("CAM", &xsoftc.xpt_rootmount); +} + +void xpt_hold_boot(void) { + xpt_lock_buses(); - xsoftc.buses_to_config++; + xpt_hold_boot_locked(); xpt_unlock_buses(); } void xpt_release_boot(void) { - xpt_lock_buses(); - xsoftc.buses_to_config--; - if (xsoftc.buses_to_config == 0 && xsoftc.buses_config_done == 0) { - struct xpt_task *task; - xsoftc.buses_config_done = 1; - xpt_unlock_buses(); - /* Call manually because we don't have any buses */ - task = malloc(sizeof(struct xpt_task), M_CAMXPT, M_NOWAIT); - if (task != NULL) { - TASK_INIT(&task->task, 0, xpt_finishconfig_task, task); - taskqueue_enqueue(taskqueue_thread, &task->task); - } - } else - xpt_unlock_buses(); + xpt_lock_buses(); + if (--xsoftc.buses_to_config == 0) { + if (xsoftc.buses_config_done == 0) { + xsoftc.buses_config_done = 1; + xsoftc.buses_to_config++; + TASK_INIT(&xsoftc.boot_task, 0, xpt_finishconfig_task, + NULL); + taskqueue_enqueue(taskqueue_thread, &xsoftc.boot_task); + } else + root_mount_rel(&xsoftc.xpt_rootmount); + } + xpt_unlock_buses(); } /* @@ -5252,10 +5267,7 @@ xpt_finishconfig_task(void *context, int pending) if (!bootverbose) xpt_for_all_devices(xptpassannouncefunc, NULL); - /* Release our hook so that the boot can continue. */ - config_intrhook_disestablish(&xsoftc.xpt_config_hook); - - free(context, M_CAMXPT); + xpt_release_boot(); } cam_status Modified: stable/12/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc.c Tue Dec 3 16:47:04 2019 (r355336) +++ stable/12/sys/cam/scsi/scsi_enc.c Tue Dec 3 16:48:21 2019 (r355337) @@ -205,10 +205,7 @@ enc_dtor(struct cam_periph *periph) if (enc->enc_vec.softc_cleanup != NULL) enc->enc_vec.softc_cleanup(enc); - if (enc->enc_boot_hold_ch.ich_func != NULL) { - config_intrhook_disestablish(&enc->enc_boot_hold_ch); - enc->enc_boot_hold_ch.ich_func = NULL; - } + root_mount_rel(&enc->enc_rootmount); ENC_FREE(enc); } @@ -835,7 +832,6 @@ enc_daemon(void *arg) cam_periph_lock(enc->periph); while ((enc->enc_flags & ENC_FLAG_SHUTDOWN) == 0) { if (enc->pending_actions == 0) { - struct intr_config_hook *hook; /* * Reset callout and msleep, or @@ -848,11 +844,7 @@ enc_daemon(void *arg) * We've been through our state machine at least * once. Allow the transition to userland. */ - hook = &enc->enc_boot_hold_ch; - if (hook->ich_func != NULL) { - config_intrhook_disestablish(hook); - hook->ich_func = NULL; - } + root_mount_rel(&enc->enc_rootmount); callout_reset(&enc->status_updater, 60*hz, enc_status_updater, enc); @@ -891,22 +883,6 @@ enc_kproc_init(enc_softc_t *enc) cam_periph_release(enc->periph); return (result); } - -/** - * \brief Interrupt configuration hook callback associated with - * enc_boot_hold_ch. - * - * Since interrupts are always functional at the time of enclosure - * configuration, there is nothing to be done when the callback occurs. - * This hook is only registered to hold up boot processing while initial - * eclosure processing occurs. - * - * \param arg The enclosure softc, but currently unused in this callback. - */ -static void -enc_nop_confighook_cb(void *arg __unused) -{ -} static cam_status enc_ctor(struct cam_periph *periph, void *arg) @@ -964,9 +940,7 @@ enc_ctor(struct cam_periph *periph, void *arg) * present. */ if (enc->enc_vec.poll_status != NULL) { - enc->enc_boot_hold_ch.ich_func = enc_nop_confighook_cb; - enc->enc_boot_hold_ch.ich_arg = enc; - config_intrhook_establish(&enc->enc_boot_hold_ch); + root_mount_hold_token(periph->periph_name, &enc->enc_rootmount); } /* Modified: stable/12/sys/cam/scsi/scsi_enc_internal.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_enc_internal.h Tue Dec 3 16:47:04 2019 (r355336) +++ stable/12/sys/cam/scsi/scsi_enc_internal.h Tue Dec 3 16:48:21 2019 (r355337) @@ -163,7 +163,7 @@ struct enc_softc { struct enc_fsm_state *enc_fsm_states; - struct intr_config_hook enc_boot_hold_ch; + struct root_hold_token enc_rootmount; #define ENC_ANNOUNCE_SZ 400 char announce_buf[ENC_ANNOUNCE_SZ]; From owner-svn-src-all@freebsd.org Tue Dec 3 16:50:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BE2F1B5362; Tue, 3 Dec 2019 16:50:07 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7JH1dMwz4c7y; Tue, 3 Dec 2019 16:50:07 +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 1CA981AA07; Tue, 3 Dec 2019 16:50:07 +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 xB3Go66R090417; Tue, 3 Dec 2019 16:50:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Go6LG090416; Tue, 3 Dec 2019 16:50:06 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031650.xB3Go6LG090416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:50: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: r355338 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 355338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:50:07 -0000 Author: mav Date: Tue Dec 3 16:50:06 2019 New Revision: 355338 URL: https://svnweb.freebsd.org/changeset/base/355338 Log: MFC r355013: Remove xpt_lock mutex. CAM does not require SIM locks for years, and obviously does not require it for completely virtual XPT SIM. Modified: stable/12/sys/cam/cam_xpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_xpt.c ============================================================================== --- stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:48:21 2019 (r355337) +++ stable/12/sys/cam/cam_xpt.c Tue Dec 3 16:50:06 2019 (r355338) @@ -128,7 +128,6 @@ struct xpt_softc { struct root_hold_token xpt_rootmount; struct mtx xpt_topo_lock; - struct mtx xpt_lock; struct taskqueue *xpt_taskq; }; @@ -895,7 +894,6 @@ xpt_init(void *dummy) STAILQ_INIT(&xsoftc.highpowerq); xsoftc.num_highpower = CAM_MAX_HIGHPOWER; - mtx_init(&xsoftc.xpt_lock, "XPT lock", NULL, MTX_DEF); mtx_init(&xsoftc.xpt_highpower_lock, "XPT highpower lock", NULL, MTX_DEF); xsoftc.xpt_taskq = taskqueue_create("CAM XPT task", M_WAITOK, taskqueue_thread_enqueue, /*context*/&xsoftc.xpt_taskq); @@ -920,21 +918,18 @@ xpt_init(void *dummy) "xpt", /*softc*/NULL, /*unit*/0, - /*mtx*/&xsoftc.xpt_lock, + /*mtx*/NULL, /*max_dev_transactions*/0, /*max_tagged_dev_transactions*/0, devq); if (xpt_sim == NULL) return (ENOMEM); - mtx_lock(&xsoftc.xpt_lock); if ((status = xpt_bus_register(xpt_sim, NULL, 0)) != CAM_SUCCESS) { - mtx_unlock(&xsoftc.xpt_lock); printf("xpt_init: xpt_bus_register failed with status %#x," " failing attach\n", status); return (EINVAL); } - mtx_unlock(&xsoftc.xpt_lock); /* * Looking at the XPT from the SIM layer, the XPT is From owner-svn-src-all@freebsd.org Tue Dec 3 16:51:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 410701B5464; Tue, 3 Dec 2019 16:51:27 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7Kq11QLz4cKv; Tue, 3 Dec 2019 16:51:27 +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 069761AB56; Tue, 3 Dec 2019 16:51:27 +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 xB3GpQvW091237; Tue, 3 Dec 2019 16:51:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3GpQMI091235; Tue, 3 Dec 2019 16:51:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031651.xB3GpQMI091235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:51:26 +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: r355339 - stable/12/sys/cam X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam X-SVN-Commit-Revision: 355339 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:51:27 -0000 Author: mav Date: Tue Dec 3 16:51:26 2019 New Revision: 355339 URL: https://svnweb.freebsd.org/changeset/base/355339 Log: MFC r355023: Do not retry long ready waits if previous gave nothing. I have some disks reporting "Logical unit is in process of becoming ready" for about half an hour before finally reporting failure. During that time CAM waits for the readiness during ~2 minutes for each request, that makes system boot take very long time. This change reduces wait times for the following requests to ~1 second if previously long wait for that device has timed out. Modified: stable/12/sys/cam/cam_periph.c stable/12/sys/cam/cam_periph.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/cam_periph.c ============================================================================== --- stable/12/sys/cam/cam_periph.c Tue Dec 3 16:50:06 2019 (r355338) +++ stable/12/sys/cam/cam_periph.c Tue Dec 3 16:51:26 2019 (r355339) @@ -1428,6 +1428,14 @@ camperiphdone(struct cam_periph *periph, union ccb *do xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } + /* If we tried long wait and still failed, remember that. */ + if ((periph->flags & CAM_PERIPH_RECOVERY_WAIT) && + (done_ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY)) { + periph->flags &= ~CAM_PERIPH_RECOVERY_WAIT; + if (error != 0 && done_ccb->ccb_h.retry_count == 0) + periph->flags |= CAM_PERIPH_RECOVERY_WAIT_FAILED; + } + /* * After recovery action(s) completed, return to the original CCB. * If the recovery CCB has failed, considering its own possible @@ -1783,7 +1791,9 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **or */ int retries; - if ((err_action & SSQ_MANY) != 0) { + if ((err_action & SSQ_MANY) != 0 && (periph->flags & + CAM_PERIPH_RECOVERY_WAIT_FAILED) == 0) { + periph->flags |= CAM_PERIPH_RECOVERY_WAIT; *action_string = "Polling device for readiness"; retries = 120; } else { Modified: stable/12/sys/cam/cam_periph.h ============================================================================== --- stable/12/sys/cam/cam_periph.h Tue Dec 3 16:50:06 2019 (r355338) +++ stable/12/sys/cam/cam_periph.h Tue Dec 3 16:51:26 2019 (r355339) @@ -132,6 +132,8 @@ struct cam_periph { #define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 +#define CAM_PERIPH_RECOVERY_WAIT 0x200 +#define CAM_PERIPH_RECOVERY_WAIT_FAILED 0x400 uint32_t scheduled_priority; uint32_t immediate_priority; int periph_allocating; From owner-svn-src-all@freebsd.org Tue Dec 3 16:52:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFF431B5523; Tue, 3 Dec 2019 16:52:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7LW69N4z4cZB; Tue, 3 Dec 2019 16:52:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EF71AB9A; Tue, 3 Dec 2019 16:52:03 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Gq3Mj095440; Tue, 3 Dec 2019 16:52:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Gq3bt095439; Tue, 3 Dec 2019 16:52:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912031652.xB3Gq3bt095439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 3 Dec 2019 16:52:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355340 - head/sys/dev/ctau X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/ctau X-SVN-Commit-Revision: 355340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:52:04 -0000 Author: emaste Date: Tue Dec 3 16:52:03 2019 New Revision: 355340 URL: https://svnweb.freebsd.org/changeset/base/355340 Log: ctau.c: convert from KOI8-R to UTF-8 encoding AFAICT this is the last source file (excluding contrib) that was not ASCII or UTF-8. Modified: head/sys/dev/ctau/ctau.c Modified: head/sys/dev/ctau/ctau.c ============================================================================== --- head/sys/dev/ctau/ctau.c Tue Dec 3 16:51:26 2019 (r355339) +++ head/sys/dev/ctau/ctau.c Tue Dec 3 16:52:03 2019 (r355340) @@ -190,9 +190,9 @@ int ct_download2 (port_t port, const unsigned char *fw nconfig_set(port); /* - * ó ÁÄÒÅÓÁ `fwaddr' × ÐÁÍÑÔÉ ÄÏÌÖÎÙ ÌÅÖÁÔØ ÕÐÁËÏ×ÁÎÎÙÅ ÄÁÎÎÙÅ - * ÄÌÑ ÚÁÇÒÕÚËÉ firmware. úÎÁÞÅÎÉÅ ÄÏÌÖÎÏ ÂÙÔØ ÓÏÇÌÁÓÏ×ÁÎÏ Ó ÐÁÒÁÍÅÔÒÏÍ - * ×ÙÚÏ×Á ÕÔÉÌÉÔÙ `megaprog' × ÓËÒÉÐÔÅ ÚÁÇÒÕÚËÉ (É Makefile). + * С адреÑа `fwaddr' в памÑти должны лежать упакованные данные + * Ð´Ð»Ñ Ð·Ð°Ð³Ñ€ÑƒÐ·ÐºÐ¸ firmware. Значение должно быть ÑоглаÑовано Ñ Ð¿Ð°Ñ€Ð°Ð¼ÐµÑ‚Ñ€Ð¾Ð¼ + * вызова утилиты `megaprog' в Ñкрипте загрузки (и Makefile). */ bytes = unpack_init (&t, fwaddr); for (; bytes>0; --bytes) { From owner-svn-src-all@freebsd.org Tue Dec 3 16:52:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 224321B572B; Tue, 3 Dec 2019 16:52: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7MD0499z4cqF; Tue, 3 Dec 2019 16:52: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 D9FD51ABBA; Tue, 3 Dec 2019 16:52:39 +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 xB3GqdF4096220; Tue, 3 Dec 2019 16:52:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Gqd5d096219; Tue, 3 Dec 2019 16:52:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031652.xB3Gqd5d096219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355341 - stable/11/sys/cam X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam X-SVN-Commit-Revision: 355341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:52:40 -0000 Author: mav Date: Tue Dec 3 16:52:39 2019 New Revision: 355341 URL: https://svnweb.freebsd.org/changeset/base/355341 Log: MFC r355023: Do not retry long ready waits if previous gave nothing. I have some disks reporting "Logical unit is in process of becoming ready" for about half an hour before finally reporting failure. During that time CAM waits for the readiness during ~2 minutes for each request, that makes system boot take very long time. This change reduces wait times for the following requests to ~1 second if previously long wait for that device has timed out. Modified: stable/11/sys/cam/cam_periph.c stable/11/sys/cam/cam_periph.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Tue Dec 3 16:52:03 2019 (r355340) +++ stable/11/sys/cam/cam_periph.c Tue Dec 3 16:52:39 2019 (r355341) @@ -1345,6 +1345,14 @@ camperiphdone(struct cam_periph *periph, union ccb *do xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } + /* If we tried long wait and still failed, remember that. */ + if ((periph->flags & CAM_PERIPH_RECOVERY_WAIT) && + (done_ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY)) { + periph->flags &= ~CAM_PERIPH_RECOVERY_WAIT; + if (error != 0 && done_ccb->ccb_h.retry_count == 0) + periph->flags |= CAM_PERIPH_RECOVERY_WAIT_FAILED; + } + /* * After recovery action(s) completed, return to the original CCB. * If the recovery CCB has failed, considering its own possible @@ -1695,7 +1703,9 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **or */ int retries; - if ((err_action & SSQ_MANY) != 0) { + if ((err_action & SSQ_MANY) != 0 && (periph->flags & + CAM_PERIPH_RECOVERY_WAIT_FAILED) == 0) { + periph->flags |= CAM_PERIPH_RECOVERY_WAIT; *action_string = "Polling device for readiness"; retries = 120; } else { Modified: stable/11/sys/cam/cam_periph.h ============================================================================== --- stable/11/sys/cam/cam_periph.h Tue Dec 3 16:52:03 2019 (r355340) +++ stable/11/sys/cam/cam_periph.h Tue Dec 3 16:52:39 2019 (r355341) @@ -129,6 +129,8 @@ struct cam_periph { #define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 +#define CAM_PERIPH_RECOVERY_WAIT 0x200 +#define CAM_PERIPH_RECOVERY_WAIT_FAILED 0x400 uint32_t scheduled_priority; uint32_t immediate_priority; int periph_allocating; From owner-svn-src-all@freebsd.org Tue Dec 3 16:54:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C5361B584C; Tue, 3 Dec 2019 16:54:56 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47S7Pq1bBMz4cyj; Tue, 3 Dec 2019 16:54:54 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb32.google.com with SMTP id r201so1777543ybc.10; Tue, 03 Dec 2019 08:54:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=z8f2nuog4WbLaQ8N1AanFKFNKJc0cQRxjbwPa7+Dmew=; b=WCRtQCgFzgoNnSOd4xLby4Bu6uDyiCjWPyTpTg6X+fhYNEt2H5TU6uMhb7DZnQozQu lu70/WW/6Sq7gaFlfhwjZmwwwOIVqe8MJeRcOZM0yK3LYjv9YXgYvtcwMHcwFewByDsc kXIWY9MSzxKeQiOK2TKEaMSmFtTfumy42sUWupP6eqgiNjIANiyxb08MzH6zmoTmXQ+0 ZHVswb9Qwf6M+4KBQsEAiPdptpWVPTzbk2Nyp0vVH/ISJF6HtJv86PYGxkMvjEAp3plw xamZ0Pg5pbs8wMLRW+CT8GPnEupbo9NCzckYqt1MbHLGPaUeiyeijLIaXjTwh6r8ZgmF nNNQ== 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:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=z8f2nuog4WbLaQ8N1AanFKFNKJc0cQRxjbwPa7+Dmew=; b=AGHmhQvXdyFPPgRGV9+8nBlZG5cnpNTC8Zto7ctHkNpUtElMyQcjSTxrezFff7xN02 WALgcY6vY9heyo5QWwA+wuE3s6rnqfK6TB7tfZ7Yy9O6jX6MN1YWDkBnHGogK0fGcUhv zJpVSWwnpv41066g58UuoAVF/X3l8FgPA36IsOjL2VOB+Rn410ZNhN5Gd6wp2FIpNbAK 8s6CjgFtcUU1EdxDs86vqJ0fDfLHFNSzRv9ljckpCRIa40SMHWk0rf6H2jvgm52/++px GQcWrZtCKDyKX/L+5KMW+PY8hry27ZKAkta6s6GdIe/ChoIwrtWfnybEtJA08O6iGVHE j7Ww== X-Gm-Message-State: APjAAAWEH2mZQuwRHwOBzw0jDPsy79SnPqUd1cxgPuKomkB7bVbrofZg IapFAH3Sv5wxpOmsxUst3TfVFB8g X-Google-Smtp-Source: APXvYqzlAyw+s8xGRO4aNwenHfaKJXFP+DjWNgmF5ZYyF+3ey+IdrjwTVDJSlg3L79G6YwZYgFTrOQ== X-Received: by 2002:a25:c881:: with SMTP id y123mr4972768ybf.516.1575392093130; Tue, 03 Dec 2019 08:54:53 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id k144sm1642510ywe.14.2019.12.03.08.54.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 08:54:52 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r355333 - stable/12/sys/cam To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201912031642.xB3GgXRD089746@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: <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> Date: Tue, 3 Dec 2019 11:54:51 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 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: 47S7Pq1bBMz4cyj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=WCRtQCgF; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b32 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-4.98 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-2.78)[ip: (-9.67), ipnet: 2607:f8b0::/32(-2.24), asn: 15169(-1.94), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.3.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; 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]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:54:56 -0000 On 03.12.2019 11:47, Ian Lepore wrote: > On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: >> Author: mav >> Date: Tue Dec 3 16:42:32 2019 >> New Revision: 355333 >> URL: https://svnweb.freebsd.org/changeset/base/355333 >> >> Log: >> MFC r341756 (by scottl): >> Don't allocate the config_intrhook separately from the softc, it's >> small >> enough that it costs more code to handle the malloc/free than it >> saves. >> > > If it's a situation where the called hook routine always does a > disestablish of the hook (and nothing else does so), just use > config_intrhook_oneshot() and you don't need to manage the data struct > yourself at all. Right. That is what I have done in my later commit. The only downside of config_intrhook_oneshot() is that it require memory allocation unlike previous. -- Alexander Motin From owner-svn-src-all@freebsd.org Tue Dec 3 17:00:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D52F71B5C35 for ; Tue, 3 Dec 2019 17:00:35 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7XM3W03z4dLp for ; Tue, 3 Dec 2019 17:00:35 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575392434; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=wONFw9wBDoKYXDaZqllah+3qGvk6GWe82kF0D4E5vgacIccfO2G5YJhMqzrgSo1b8ZkG73FsxHTFb 3HSxrLNJrKgl+rutL9ae/P/hzJMikE1Wq0AiBjUedF5QgI3eV+Iq5kIs9usFtS5WtqG0mFuNbk3NV5 4Ykrl8nKdsLlewPw9yffo4AsMqVzqA3SqU2XPwAFrVh1XDw3MtZsI1rV6NCzAO9z6bGNTt7doftiu8 56x/nDPxlZucevTFU/wt5wb9nw+9XabZ3JK0yqncDMmMwiXCqtVEUgnO4WaV8wwtsfHhgDlDiSjP5p RTegGmekYxwRHWGRqKAEOSAB3KMBE/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=KafL3a0EFxRKXs7cUc2ZtU0uM4lUtociBjkQiqbPaGg=; b=MEAEal4eU4XtVp3p0eTD7yDZy8AC7GFDHo7vf9xtrh5mf/keX5cGdK4Us4thLD1/blDt0CFRPmS+e pEG3jwJUQE2Lnp6KscJg7zoJYLkXqfpGMoGXnyuZgWIcxbC+CB5mE3jn7f9mH3wpJTqd7H15CvpMoA Z422EETjCS4casanYDpvoIfZa9hNIlt7nA+gonVcuxSmV6B1rOnxoZByhta49F3Hys2GH0mo+UwxcK ak8ElAr2lgFDI3ZMRyAVGC695pw6nMUWdXEXzpSQqtHV+RjJrIjVy/3qscpjkmRZ0E4YQMgFEOgE7R 6PtYnYI4Qn3vREZ1ggdbjTmIPNCkFOw== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=KafL3a0EFxRKXs7cUc2ZtU0uM4lUtociBjkQiqbPaGg=; b=xG0ewZpueYg0mHO+U2lub5HtPNLX+BX1Wvkvyp5r/4gUw94F8txFseo3bW/9O67XTGU3F2jLnvfWl 7yoUSLuMIKfI5iG7kTuvL4mKdma+Q5O3mJJI5HickAhrmN6Szw/iGUy9kAzk3wTYLE8mv1Lo6M6u57 yojffL96cLK79ZZrWXxia/7lX/qs1SjvxYJ4sv1JkkGbNpUqC6Dd10XsczdxiEqTXI11/TsLHOMlIm xKba5VuDQafarPXfJdcbodHnbeaLVLtcMA2umgNjSrh0rG+SSs0wI9/eqkfsIfjGnBzjNL+Hm03gEO 5n6/qGmPLD2b4H3q573fiXvr9YD9rhA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 6a7cf7ee-15ee-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 6a7cf7ee-15ee-11ea-b80c-052b4a66b6b2; Tue, 03 Dec 2019 17:00:33 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3H0VIs000276; Tue, 3 Dec 2019 10:00:32 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1dbc23eac25b2c0cece884fc54734e02868d75c6.camel@freebsd.org> Subject: Re: svn commit: r355333 - stable/12/sys/cam From: Ian Lepore To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Date: Tue, 03 Dec 2019 10:00:31 -0700 In-Reply-To: <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> References: <201912031642.xB3GgXRD089746@repo.freebsd.org> <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S7XM3W03z4dLp X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.90 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.96)[-0.965,0]; NEURAL_HAM_LONG(-0.93)[-0.934,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:00:35 -0000 On Tue, 2019-12-03 at 11:54 -0500, Alexander Motin wrote: > On 03.12.2019 11:47, Ian Lepore wrote: > > On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: > > > Author: mav > > > Date: Tue Dec 3 16:42:32 2019 > > > New Revision: 355333 > > > URL: https://svnweb.freebsd.org/changeset/base/355333 > > > > > > Log: > > > MFC r341756 (by scottl): > > > Don't allocate the config_intrhook separately from the softc, > > > it's > > > small > > > enough that it costs more code to handle the malloc/free than > > > it > > > saves. > > > > > > > If it's a situation where the called hook routine always does a > > disestablish of the hook (and nothing else does so), just use > > config_intrhook_oneshot() and you don't need to manage the data > > struct > > yourself at all. > > Right. That is what I have done in my later commit. The only downside > of config_intrhook_oneshot() is that it require memory allocation unlike > previous. > Yeah, it's all about convenience rather than peformance. Usually when I need an intrhook it's a "one device instance once at bootup" kind of thing where performance doesn't matter much. -- Ian From owner-svn-src-all@freebsd.org Tue Dec 3 17:06:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1038E1B61BF; Tue, 3 Dec 2019 17:06:49 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7gX6gKjz4f3V; Tue, 3 Dec 2019 17:06:48 +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 AE77C1ADA6; Tue, 3 Dec 2019 17:06:48 +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 xB3H6mPo002361; Tue, 3 Dec 2019 17:06:48 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3H6mNP002359; Tue, 3 Dec 2019 17:06:48 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031706.xB3H6mNP002359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 17:06: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: r355342 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 355342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:06:49 -0000 Author: mav Date: Tue Dec 3 17:06:48 2019 New Revision: 355342 URL: https://svnweb.freebsd.org/changeset/base/355342 Log: MFC r354986: Add variant of root_mount_hold() without allocation. It allows to use this KPI in non-sleepable contexts. Modified: stable/12/sys/kern/vfs_mountroot.c stable/12/sys/sys/systm.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_mountroot.c ============================================================================== --- stable/12/sys/kern/vfs_mountroot.c Tue Dec 3 16:52:39 2019 (r355341) +++ stable/12/sys/kern/vfs_mountroot.c Tue Dec 3 17:06:48 2019 (r355342) @@ -110,14 +110,9 @@ char *rootdevnames[2] = {NULL, NULL}; struct mtx root_holds_mtx; MTX_SYSINIT(root_holds, &root_holds_mtx, "root_holds", MTX_DEF); -struct root_hold_token { - const char *who; - LIST_ENTRY(root_hold_token) list; -}; +static TAILQ_HEAD(, root_hold_token) root_holds = + TAILQ_HEAD_INITIALIZER(root_holds); -static LIST_HEAD(, root_hold_token) root_holds = - LIST_HEAD_INITIALIZER(root_holds); - enum action { A_CONTINUE, A_PANIC, @@ -125,6 +120,12 @@ enum action { A_RETRY }; +enum rh_flags { + RH_FREE, + RH_ALLOC, + RH_ARG, +}; + static enum action root_mount_onfail = A_CONTINUE; static int root_mount_mddev; @@ -154,8 +155,8 @@ sysctl_vfs_root_mount_hold(SYSCTL_HANDLER_ARGS) sbuf_new(&sb, NULL, 256, SBUF_AUTOEXTEND | SBUF_INCLUDENUL); mtx_lock(&root_holds_mtx); - LIST_FOREACH(h, &root_holds, list) { - if (h != LIST_FIRST(&root_holds)) + TAILQ_FOREACH(h, &root_holds, list) { + if (h != TAILQ_FIRST(&root_holds)) sbuf_putc(&sb, ' '); sbuf_printf(&sb, "%s", h->who); } @@ -174,27 +175,54 @@ root_mount_hold(const char *identifier) struct root_hold_token *h; h = malloc(sizeof *h, M_DEVBUF, M_ZERO | M_WAITOK); + h->flags = RH_ALLOC; h->who = identifier; mtx_lock(&root_holds_mtx); TSHOLD("root mount"); - LIST_INSERT_HEAD(&root_holds, h, list); + TAILQ_INSERT_TAIL(&root_holds, h, list); mtx_unlock(&root_holds_mtx); return (h); } void +root_mount_hold_token(const char *identifier, struct root_hold_token *h) +{ +#ifdef INVARIANTS + struct root_hold_token *t; +#endif + + h->flags = RH_ARG; + h->who = identifier; + mtx_lock(&root_holds_mtx); +#ifdef INVARIANTS + TAILQ_FOREACH(t, &root_holds, list) { + if (t == h) { + panic("Duplicate mount hold by '%s' on %p", + identifier, h); + } + } +#endif + TSHOLD("root mount"); + TAILQ_INSERT_TAIL(&root_holds, h, list); + mtx_unlock(&root_holds_mtx); +} + +void root_mount_rel(struct root_hold_token *h) { - if (h == NULL) + if (h == NULL || h->flags == RH_FREE) return; mtx_lock(&root_holds_mtx); - LIST_REMOVE(h, list); + TAILQ_REMOVE(&root_holds, h, list); TSRELEASE("root mount"); wakeup(&root_holds); mtx_unlock(&root_holds_mtx); - free(h, M_DEVBUF); + if (h->flags == RH_ALLOC) { + free(h, M_DEVBUF); + } else + h->flags = RH_FREE; } int @@ -961,13 +989,13 @@ vfs_mountroot_wait(void) while (1) { g_waitidle(); mtx_lock(&root_holds_mtx); - if (LIST_EMPTY(&root_holds)) { + if (TAILQ_EMPTY(&root_holds)) { mtx_unlock(&root_holds_mtx); break; } if (ppsratecheck(&lastfail, &curfail, 1)) { printf("Root mount waiting for:"); - LIST_FOREACH(h, &root_holds, list) + TAILQ_FOREACH(h, &root_holds, list) printf(" %s", h->who); printf("\n"); } Modified: stable/12/sys/sys/systm.h ============================================================================== --- stable/12/sys/sys/systm.h Tue Dec 3 16:52:39 2019 (r355341) +++ stable/12/sys/sys/systm.h Tue Dec 3 17:06:48 2019 (r355342) @@ -503,9 +503,14 @@ int poll_no_poll(int events); void DELAY(int usec); /* Root mount holdback API */ -struct root_hold_token; +struct root_hold_token { + int flags; + const char *who; + TAILQ_ENTRY(root_hold_token) list; +}; struct root_hold_token *root_mount_hold(const char *identifier); +void root_mount_hold_token(const char *identifier, struct root_hold_token *h); void root_mount_rel(struct root_hold_token *h); int root_mounted(void); From owner-svn-src-all@freebsd.org Tue Dec 3 17:34:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E26621B7002; Tue, 3 Dec 2019 17:34:58 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb41.google.com (mail-yb1-xb41.google.com [IPv6:2607:f8b0:4864:20::b41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47S8J15FLRz3C7c; Tue, 3 Dec 2019 17:34:57 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb41.google.com with SMTP id v15so1826222ybp.13; Tue, 03 Dec 2019 09:34:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=+JbBfahZMu12RKD+yWuHKyVRyVJzng6jEawyu9FpCUU=; b=POqr0jLxzfKrHayjxaDmzlyxgEIkj/RL5XNluVaznoQmcVlf94InXcs8s3kdAHrZYn 93UwRZA7dcYgd+zlurpbASG5tcx1KlNh5rywdX1R8IVtFKRRKafRQcebQrAc/7/I73LQ jT0l9NtCanzJ55FJVPMRaEmgx4CaQXVIXERVs9vQTWWZ9/ZN311uW4yBGQr7izp20JG+ +XQ9JzOQMQpl8KqUMBw0yRFnE2e+w5levHREIOXzxUTKulcSiKfU14agT1JV+bJL+zxV wjBVZxh7+ibgdQOs8pp+2QfEZl4YfvLnYU7XKxQpnB4XCCzlofg3vSwRh0wRZiHknBMh DK4A== 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:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=+JbBfahZMu12RKD+yWuHKyVRyVJzng6jEawyu9FpCUU=; b=StMUWize400e2TP2ZGFWKYwSciZqmdV1WXzEDEUhmsB8fevm3ypWACAgnik4bZZJew erh4A/Wp4n2L5OSCZzMvfXCchsQDojaW/v1SMb1iwpzhOxhkyKur2/Y7IofqMPVjQd6M bRVQoljJqlspMlxWNQltuVx33Dbryw2fP7zocJh/2Oy2EokXG5qCg+CwRZJpgvBVWjRk K7VA76IMN0QMdHY165yabJpII07xYv9uQJli13LZaUzgOXUMlDd5JvtiyaCDqO8Un2CP OLDyzPHcpHBRxcj47u6Q6zzRT4k+bNXnvr27/VOsBKECCGNdLcUXT8XWKMAalmS8Ln7u /Ibw== X-Gm-Message-State: APjAAAXgswiDy1h3VibU0V1Y6bciiW/YYXcHFpxir9Jm6Jarvlzei+ma alg+Kxoonwj8sKg7RZQ7G0iZUw/B X-Google-Smtp-Source: APXvYqwpG13Snsr/ZBfbTOPIAvB+sggSagaWQriHCCmAHiT2qt54GWqU/tw3m2bwV3602DwGWFdsfw== X-Received: by 2002:a25:d6cd:: with SMTP id n196mr5039293ybg.198.1575394496181; Tue, 03 Dec 2019 09:34:56 -0800 (PST) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id o69sm1723331ywd.38.2019.12.03.09.34.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 09:34:55 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r355333 - stable/12/sys/cam To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201912031642.xB3GgXRD089746@repo.freebsd.org> <1c18cdbb-2a6e-3cbb-048b-8f1f49a4cef5@FreeBSD.org> <1dbc23eac25b2c0cece884fc54734e02868d75c6.camel@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: <9f7bcc85-42a0-2a4c-2a78-1d65f64cca4a@FreeBSD.org> Date: Tue, 3 Dec 2019 12:34:55 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <1dbc23eac25b2c0cece884fc54734e02868d75c6.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47S8J15FLRz3C7c X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=POqr0jLx; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b41 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-2.65 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.45)[ip: (1.98), ipnet: 2607:f8b0::/32(-2.24), asn: 15169(-1.94), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[1.4.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; 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]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:34:58 -0000 On 03.12.2019 12:00, Ian Lepore wrote: > On Tue, 2019-12-03 at 11:54 -0500, Alexander Motin wrote: >> On 03.12.2019 11:47, Ian Lepore wrote: >>> On Tue, 2019-12-03 at 16:42 +0000, Alexander Motin wrote: >>>> Author: mav >>>> Date: Tue Dec 3 16:42:32 2019 >>>> New Revision: 355333 >>>> URL: https://svnweb.freebsd.org/changeset/base/355333 >>>> >>>> Log: >>>> MFC r341756 (by scottl): >>>> Don't allocate the config_intrhook separately from the softc, >>>> it's >>>> small >>>> enough that it costs more code to handle the malloc/free than >>>> it >>>> saves. >>>> >>> >>> If it's a situation where the called hook routine always does a >>> disestablish of the hook (and nothing else does so), just use >>> config_intrhook_oneshot() and you don't need to manage the data >>> struct >>> yourself at all. >> >> Right. That is what I have done in my later commit. The only downside >> of config_intrhook_oneshot() is that it require memory allocation unlike >> previous. > > Yeah, it's all about convenience rather than peformance. Usually when > I need an intrhook it's a "one device instance once at bootup" kind of > thing where performance doesn't matter much. I don't worry so much about performance as about need to have sleepable context. -- Alexander Motin From owner-svn-src-all@freebsd.org Tue Dec 3 17:38:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E8311B70F0; Tue, 3 Dec 2019 17:38:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S8NQ6hmrz3CHn; Tue, 3 Dec 2019 17:38:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0E9A51F59D; Tue, 3 Dec 2019 17:38:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve To: Ian Lepore , rgrimes@freebsd.org Cc: Vincenzo Maffione , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> <8044a2f1096df626368183dd1ae77f5ac2e43b70.camel@freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Tue, 3 Dec 2019 09:38:42 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <8044a2f1096df626368183dd1ae77f5ac2e43b70.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:38:47 -0000 On 12/3/19 7:14 AM, Ian Lepore wrote: > On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: >>> On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: >>>> Author: vmaffione >>>> Date: Mon Dec 2 20:51:46 2019 >>>> New Revision: 355301 >>>> URL: https://svnweb.freebsd.org/changeset/base/355301 >>>> >>>> Log: >>>> bhyve: uniform printf format string newlines >>>> >>>> Some of the printf statements only use LF to get a newline. >>>> However, a CR character is also required for the serial console to >>>> print debug logs in a nice way. >>>> Fix those code locations that only use LF, by adding a CR >>>> character. >>>> >>>> Reviewed by: markj, aleksandr.fedorov@itglobal.com >>>> MFC after: 1 week >>>> Differential Revision: https://reviews.freebsd.org/D22552 >>>> >>>> Modified: >>>> head/usr.sbin/bhyve/audio.c >>>> head/usr.sbin/bhyve/hda_codec.c >>>> head/usr.sbin/bhyve/net_backends.c >>>> head/usr.sbin/bhyve/pci_ahci.c >>>> head/usr.sbin/bhyve/pci_e82545.c >>>> head/usr.sbin/bhyve/pci_hda.c >>>> head/usr.sbin/bhyve/pci_nvme.c >>>> head/usr.sbin/bhyve/pci_virtio_block.c >>>> head/usr.sbin/bhyve/pci_virtio_console.c >>>> head/usr.sbin/bhyve/pci_virtio_net.c >>>> head/usr.sbin/bhyve/pci_virtio_rnd.c >>>> head/usr.sbin/bhyve/pci_virtio_scsi.c >>>> head/usr.sbin/bhyve/pci_xhci.c >>>> head/usr.sbin/bhyve/rfb.c >>>> >>> >>> These changes seem wrong in a couple ways... >>> >>> - Lines are terminated by linefeeds in unix-like systems. If >>> linefeeds need to be translated to include carriage returns, that's the >>> responsibility of the terminal/line-discipline layer, not the source >>> strings being printed. >> >> Fully agree, this change seems wrong to me for Ian's stated reason here. >> >>> >>> - The sequence \n\r is very strange. For systems that do prefer >>> carriage returns, the \r always comes before the \n (or stands alone on >>> Mac systems), not after. >>> >>> I have a feeling that the root of this is something like "lots of >>> people use bhyve for Windows, so they use Windows apps to look at logs, >>> so the logs should be formatted for Windows." If that's the reasoning, >>> then why shouldn't we convert EVERY printf in the source base to >>> include carriage returns, just in case a windows user wants to browse a >>> log file? >> >> This is not that issue, it is something going on with the line >> discipline when using the bhyve console device. I believe the >> line displine being different from what bhyve itself is expecting >> so when console output is intermixed with output from bhyve itself >> things go wrong. >> >> The printf's in this patch are coming from the bhyve process that >> has a fd open to the launching tty, the line discipline on that tty >> is changed to something different after you open the >> console device from that same controlling tty, or that is my hypothosis >> on what is going wrong. > > There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would > definitely turn off nl->crnl translations. I think that is the other > end of the bhyve console that I posted a patch for yesterday, and I > think the console driver is probably still the right place to do that > translation (because other console drivers do it that way). But I'm > not set up to run bhyve here, so I can't test my theory. That patch won't work alone. Most people don't use bvmcons, most people running bhyve use a standard uart as the console (bvmcons was an early console devices before bhyve had a ns8250 uart device model). When using the uart as the device model you still have raw output in the bhyve process itself. (See cfmakeraw() in uart_emul.c as well). We don't get to change how guest OS's use a uart, so any changes have to be in usr.sbin/bhyve, not in sys/. However, to do that you have to actually do something more complicated to turn \r\n and \n\r sequences from the guest into plain \n to stdout while still DTRT for "bare" \r and \n characters. You also have to make sure you do the right thing for input and not just output in the device models. I'm not quite a fan of this commit as-is since you will get spurious new lines now if you don't use a serial console. I would perhaps rather have a custom printf() wrapper in bhyve that outputs the \r as needed for debug and error printfs only when stdio has been changed to be raw. I was busy with family stuff and thanksgiving last week so didn't have time to review it before it was committed unfortunately. -- John Baldwin From owner-svn-src-all@freebsd.org Tue Dec 3 17:43:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F6981B73B8; Tue, 3 Dec 2019 17:43:53 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S8VK3cD7z3Cgp; Tue, 3 Dec 2019 17:43:53 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FCE81B515; Tue, 3 Dec 2019 17:43:53 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3HhrX2025340; Tue, 3 Dec 2019 17:43:53 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3HhrVN025339; Tue, 3 Dec 2019 17:43:53 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201912031743.xB3HhrVN025339@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 3 Dec 2019 17:43:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355343 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 355343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:43:53 -0000 Author: rlibby Date: Tue Dec 3 17:43:52 2019 New Revision: 355343 URL: https://svnweb.freebsd.org/changeset/base/355343 Log: mips busdma: bzero map on alloc Maps from the mips busdma dmamap_zone were not completely initialized. In particular, pagesneeded and pagesreserved were not initialized. This could cause a crash. Remove some dead fields from mips struct bus_dmamap while here. Reported by: brooks Reviewed by: ian Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22638 Modified: head/sys/mips/mips/busdma_machdep.c Modified: head/sys/mips/mips/busdma_machdep.c ============================================================================== --- head/sys/mips/mips/busdma_machdep.c Tue Dec 3 17:06:48 2019 (r355342) +++ head/sys/mips/mips/busdma_machdep.c Tue Dec 3 17:43:52 2019 (r355343) @@ -156,8 +156,6 @@ struct bus_dmamap { bus_dma_tag_t dmat; struct memdesc mem; int flags; - void *origbuffer; - void *allocbuffer; TAILQ_ENTRY(bus_dmamap) freelist; STAILQ_ENTRY(bus_dmamap) links; bus_dmamap_callback_t *callback; @@ -205,11 +203,8 @@ dmamap_ctor(void *mem, int size, void *arg, int flags) dmat->map_count++; + bzero(map, sizeof(*map)); map->dmat = dmat; - map->flags = 0; - map->slist = NULL; - map->allocbuffer = NULL; - map->sync_count = 0; STAILQ_INIT(&map->bpages); return (0); From owner-svn-src-all@freebsd.org Tue Dec 3 17:43:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 007A91B73E4; Tue, 3 Dec 2019 17:43:58 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S8VP6GJ6z3CkL; Tue, 3 Dec 2019 17:43:57 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BA6F61B516; Tue, 3 Dec 2019 17:43:57 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3HhveT025394; Tue, 3 Dec 2019 17:43:57 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3HhvUD025393; Tue, 3 Dec 2019 17:43:57 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201912031743.xB3HhvUD025393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Tue, 3 Dec 2019 17:43:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355344 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 355344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 17:43:58 -0000 Author: rlibby Date: Tue Dec 3 17:43:57 2019 New Revision: 355344 URL: https://svnweb.freebsd.org/changeset/base/355344 Log: bitset: avoid pessimized code when bitset size is not constant We have a couple optimizations for when the bitset is known to be just one word. But with dynamically sized bitsets, it was actually more work to determine the size than just to do the necessary computation. Now, only use the optimization when the size is known to be constant. Reviewed by: markj Discussed with: jeff Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22639 Modified: head/sys/sys/bitset.h Modified: head/sys/sys/bitset.h ============================================================================== --- head/sys/sys/bitset.h Tue Dec 3 17:43:52 2019 (r355343) +++ head/sys/sys/bitset.h Tue Dec 3 17:43:57 2019 (r355344) @@ -34,12 +34,19 @@ #ifndef _SYS_BITSET_H_ #define _SYS_BITSET_H_ +/* + * Whether expr is both constant and true. Result is itself constant. + * Used to enable optimizations for sets with a known small size. + */ +#define __constexpr_cond(expr) (__builtin_constant_p((expr)) && (expr)) + #define __bitset_mask(_s, n) \ - (1L << ((__bitset_words((_s)) == 1) ? \ + (1L << (__constexpr_cond(__bitset_words((_s)) == 1) ? \ (__size_t)(n) : ((n) % _BITSET_BITS))) #define __bitset_word(_s, n) \ - ((__bitset_words((_s)) == 1) ? 0 : ((n) / _BITSET_BITS)) + (__constexpr_cond(__bitset_words((_s)) == 1) ? \ + 0 : ((n) / _BITSET_BITS)) #define BIT_CLR(_s, n, p) \ ((p)->__bits[__bitset_word(_s, n)] &= ~__bitset_mask((_s), (n))) From owner-svn-src-all@freebsd.org Tue Dec 3 18:25:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FC091B873F; Tue, 3 Dec 2019 18:25:18 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9Q63g6bz3Fwd; Tue, 3 Dec 2019 18:25:18 +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 60D331BC7C; Tue, 3 Dec 2019 18:25:18 +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 xB3IPIud049209; Tue, 3 Dec 2019 18:25:18 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IPGSo049200; Tue, 3 Dec 2019 18:25:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031825.xB3IPGSo049200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:25: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: r355345 - in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stan... X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stand/liblua 12/stand/lua X-SVN-Commit-Revision: 355345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:25:18 -0000 Author: kevans Date: Tue Dec 3 18:25:16 2019 New Revision: 355345 URL: https://svnweb.freebsd.org/changeset/base/355345 Log: MFC r354245, r354833, r354837: add flua to the base system r354245: stand: consolidate knowledge of lua path Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. r354833: Add flua to the base system, install to /usr/libexec FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. r354837: flua: newer GCC complains about format-nonliteral at WARNS=2 Disable that one, too. Added: stable/11/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/11/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/11/stand/liblua/lfs.c stable/11/stand/liblua/lfs.h Modified: stable/11/libexec/Makefile stable/11/libexec/flua/Makefile stable/11/stand/common/interp_lua.c stable/11/stand/defs.mk stable/11/stand/liblua/Makefile stable/11/stand/liblua/luaconf.h stable/11/stand/loader.mk stable/11/stand/lua/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/12/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/12/stand/liblua/lfs.c stable/12/stand/liblua/lfs.h Modified: stable/12/libexec/Makefile stable/12/libexec/flua/Makefile stable/12/stand/common/interp_lua.c stable/12/stand/defs.mk stable/12/stand/liblua/Makefile stable/12/stand/liblua/luaconf.h stable/12/stand/loader.mk stable/12/stand/lua/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/libexec/Makefile ============================================================================== --- stable/11/libexec/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/libexec/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -8,6 +8,7 @@ SUBDIR= ${_atf} \ ${_blacklistd-helper} \ ${_comsat} \ ${_dma} \ + flua \ getty \ ${_mail.local} \ ${_makewhatis.local} \ Modified: stable/11/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Mon Nov 18 23:21:13 2019 (r354833) +++ stable/11/libexec/flua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -9,6 +9,8 @@ PROG= flua WARNS?= 2 MAN= # No manpage; this is internal. +CWARNFLAGS.gcc+= -Wno-format-nonliteral + LIBADD= m # Core functions Copied: stable/11/share/mk/src.lua.mk (from r354833, head/share/mk/src.lua.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/share/mk/src.lua.mk Tue Dec 3 18:25:16 2019 (r355345, copy of r354833, head/share/mk/src.lua.mk) @@ -0,0 +1,45 @@ +# $FreeBSD$ +# +# Lua helper file for FreeBSD /usr/src builds. +# +# This file provides any necessary assistance for consumers of Lua in the base +# system. + +.if !target(____) +____: + +.include + +# +# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been +# installed to, along with the name of the internal command. The default +# name is flua. +# +# LUA_CMD can be overwritten to point to a Lua that isn't flua. This is fine, +# but parts of the src build that use it may have certain expectations that +# may only be fulfilled by the in-tree Lua. The user overwriting it is expected +# to understand these and provide the expectations. +# +# flua is currently equivalent to Lua 5.3, with the following modules: +# - luafilesystem +# - lua-posix +# +LUA_INSTALL_PATH?= ${LIBEXECDIR} +LUA_CMD?= flua + +# +# Some standalone usage may want a variable that tries to find the lua command, +# and cannot necessarily embed the logic for trying to find it amongst bootstrap +# tools. For these, we provide the LUA variable. +# +# The LUA variable should point to LUA_CMD on the system, if it exists. +# Otherwise, consumers will have to settle for a PATH search and PATH being +# appropriately set. +# +.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD}) +LUA= ${LUA_INSTALL_PATH}/${LUA_CMD} +.else +LUA?= ${LUA_CMD} +.endif + +.endif # !target(____) Modified: stable/11/stand/common/interp_lua.c ============================================================================== --- stable/11/stand/common/interp_lua.c Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/common/interp_lua.c Tue Dec 3 18:25:16 2019 (r355345) @@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +#define LOADER_LUA LUA_PATH "/loader.lua" + INTERP_DEFINE("lua"); static void * @@ -120,7 +122,7 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } - filename = "/boot/lua/loader.lua"; + filename = LOADER_LUA; if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; Modified: stable/11/stand/defs.mk ============================================================================== --- stable/11/stand/defs.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/defs.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -40,6 +40,10 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot +# LUAPATH is where we search for and install lua scripts. +LUAPATH?= /boot/lua +FLUASRC?= ${SRCTOP}/libexec/flua + LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} Modified: stable/11/stand/liblua/Makefile ============================================================================== --- stable/11/stand/liblua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/liblua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -23,11 +23,14 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+= lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lerrno.c lfs.c lstd.c lutils.c +SRCS+= lerrno.c lstd.c lutils.c +.PATH: ${FLUASRC}/modules +SRCS+= lfs.c + WARNS= 3 -CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\" CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: stable/11/stand/liblua/luaconf.h ============================================================================== --- stable/11/stand/liblua/luaconf.h Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/liblua/luaconf.h Tue Dec 3 18:25:16 2019 (r355345) @@ -202,7 +202,7 @@ #else /* }{ */ -#define LUA_ROOT "/boot/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" #ifndef LUA_PATH_DEFAULT Modified: stable/11/stand/loader.mk ============================================================================== --- stable/11/stand/loader.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/loader.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -64,6 +64,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} +CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" Modified: stable/11/stand/lua/Makefile ============================================================================== --- stable/11/stand/lua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/11/stand/lua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -12,7 +12,7 @@ MAN= cli.lua.8 \ password.lua.8 \ screen.lua.8 -FILESDIR= /boot/lua +FILESDIR= ${LUAPATH} FILES= cli.lua \ color.lua \ config.lua \ From owner-svn-src-all@freebsd.org Tue Dec 3 18:25:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A3B61B8758; Tue, 3 Dec 2019 18:25: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9Q83Xwcz3Fwg; Tue, 3 Dec 2019 18:25: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 5D1DA1BC7D; Tue, 3 Dec 2019 18:25: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 xB3IPKKp049224; Tue, 3 Dec 2019 18:25:20 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IPIOZ049214; Tue, 3 Dec 2019 18:25:18 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031825.xB3IPIOZ049214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:25: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: r355345 - in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stan... X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/libexec 11/libexec/flua 11/share/mk 11/stand 11/stand/common 11/stand/liblua 11/stand/lua 12/libexec 12/libexec/flua 12/share/mk 12/stand 12/stand/common 12/stand/liblua 12/stand/lua X-SVN-Commit-Revision: 355345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:25:20 -0000 Author: kevans Date: Tue Dec 3 18:25:16 2019 New Revision: 355345 URL: https://svnweb.freebsd.org/changeset/base/355345 Log: MFC r354245, r354833, r354837: add flua to the base system r354245: stand: consolidate knowledge of lua path Multiple places coordinate to 'know' where lua scripts are installed. Knock this down to being formally defined (and overridable) in exactly one spot, defs.mk, and spread the knowledge to loaders and liblua alike. A future commit will expose this to lua as loader.lua_path, so it can build absolute paths to lua scripts as needed. r354833: Add flua to the base system, install to /usr/libexec FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. r354837: flua: newer GCC complains about format-nonliteral at WARNS=2 Disable that one, too. Added: stable/12/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/12/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/12/stand/liblua/lfs.c stable/12/stand/liblua/lfs.h Modified: stable/12/libexec/Makefile stable/12/libexec/flua/Makefile stable/12/stand/common/interp_lua.c stable/12/stand/defs.mk stable/12/stand/liblua/Makefile stable/12/stand/liblua/luaconf.h stable/12/stand/loader.mk stable/12/stand/lua/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/libexec/flua/ - copied from r354833, head/libexec/flua/ stable/11/share/mk/src.lua.mk - copied unchanged from r354833, head/share/mk/src.lua.mk Deleted: stable/11/stand/liblua/lfs.c stable/11/stand/liblua/lfs.h Modified: stable/11/libexec/Makefile stable/11/libexec/flua/Makefile stable/11/stand/common/interp_lua.c stable/11/stand/defs.mk stable/11/stand/liblua/Makefile stable/11/stand/liblua/luaconf.h stable/11/stand/loader.mk stable/11/stand/lua/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/libexec/Makefile ============================================================================== --- stable/12/libexec/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/libexec/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -8,6 +8,7 @@ SUBDIR= ${_atf} \ ${_blacklistd-helper} \ ${_comsat} \ ${_dma} \ + flua \ getty \ ${_mail.local} \ ${_makewhatis.local} \ Modified: stable/12/libexec/flua/Makefile ============================================================================== --- head/libexec/flua/Makefile Mon Nov 18 23:21:13 2019 (r354833) +++ stable/12/libexec/flua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -9,6 +9,8 @@ PROG= flua WARNS?= 2 MAN= # No manpage; this is internal. +CWARNFLAGS.gcc+= -Wno-format-nonliteral + LIBADD= m # Core functions Copied: stable/12/share/mk/src.lua.mk (from r354833, head/share/mk/src.lua.mk) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/share/mk/src.lua.mk Tue Dec 3 18:25:16 2019 (r355345, copy of r354833, head/share/mk/src.lua.mk) @@ -0,0 +1,45 @@ +# $FreeBSD$ +# +# Lua helper file for FreeBSD /usr/src builds. +# +# This file provides any necessary assistance for consumers of Lua in the base +# system. + +.if !target(____) +____: + +.include + +# +# LUA_INSTALL_PATH and LUA_CMD describe where the internal lua has been +# installed to, along with the name of the internal command. The default +# name is flua. +# +# LUA_CMD can be overwritten to point to a Lua that isn't flua. This is fine, +# but parts of the src build that use it may have certain expectations that +# may only be fulfilled by the in-tree Lua. The user overwriting it is expected +# to understand these and provide the expectations. +# +# flua is currently equivalent to Lua 5.3, with the following modules: +# - luafilesystem +# - lua-posix +# +LUA_INSTALL_PATH?= ${LIBEXECDIR} +LUA_CMD?= flua + +# +# Some standalone usage may want a variable that tries to find the lua command, +# and cannot necessarily embed the logic for trying to find it amongst bootstrap +# tools. For these, we provide the LUA variable. +# +# The LUA variable should point to LUA_CMD on the system, if it exists. +# Otherwise, consumers will have to settle for a PATH search and PATH being +# appropriately set. +# +.if !defined(LUA) && exists(${LUA_INSTALL_PATH}/${LUA_CMD}) +LUA= ${LUA_INSTALL_PATH}/${LUA_CMD} +.else +LUA?= ${LUA_CMD} +.endif + +.endif # !target(____) Modified: stable/12/stand/common/interp_lua.c ============================================================================== --- stable/12/stand/common/interp_lua.c Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/common/interp_lua.c Tue Dec 3 18:25:16 2019 (r355345) @@ -60,6 +60,8 @@ static struct interp_lua_softc lua_softc; #define LDBG(...) #endif +#define LOADER_LUA LUA_PATH "/loader.lua" + INTERP_DEFINE("lua"); static void * @@ -120,7 +122,7 @@ interp_init(void) lua_pop(luap, 1); /* remove lib */ } - filename = "/boot/lua/loader.lua"; + filename = LOADER_LUA; if (interp_include(filename) != 0) { const char *errstr = lua_tostring(luap, -1); errstr = errstr == NULL ? "unknown" : errstr; Modified: stable/12/stand/defs.mk ============================================================================== --- stable/12/stand/defs.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/defs.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -40,6 +40,10 @@ BOOTOBJ= ${OBJTOP}/stand # BINDIR is where we install BINDIR?= /boot +# LUAPATH is where we search for and install lua scripts. +LUAPATH?= /boot/lua +FLUASRC?= ${SRCTOP}/libexec/flua + LIBSA= ${BOOTOBJ}/libsa/libsa.a .if ${MACHINE} == "i386" LIBSA32= ${LIBSA} Modified: stable/12/stand/liblua/Makefile ============================================================================== --- stable/12/stand/liblua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/liblua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -23,11 +23,14 @@ SRCS+= lauxlib.c lbaselib.c lstrlib.c loadlib.c #SRCS+= lbitlib.c liolib.c lmathlib.c loslib.c ltablib.c # Our utilities. -SRCS+= lerrno.c lfs.c lstd.c lutils.c +SRCS+= lerrno.c lstd.c lutils.c +.PATH: ${FLUASRC}/modules +SRCS+= lfs.c + WARNS= 3 -CFLAGS+= -DLUA_PATH_DEFAULT=\"/boot/lua/\?.lua\" +CFLAGS+= -DLUA_PATH=\"${LUAPATH}\" -DLUA_PATH_DEFAULT=\"${LUAPATH}/\?.lua\" CFLAGS+= -ffreestanding -nostdlib -DLUA_USE_POSIX CFLAGS+= -fno-stack-protector -D__BSD_VISIBLE CFLAGS+= -I${BOOTSRC}/include -I${LIBLUASRC} -I${LUASRC} -I${LDRSRC} Modified: stable/12/stand/liblua/luaconf.h ============================================================================== --- stable/12/stand/liblua/luaconf.h Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/liblua/luaconf.h Tue Dec 3 18:25:16 2019 (r355345) @@ -202,7 +202,7 @@ #else /* }{ */ -#define LUA_ROOT "/boot/lua/" LUA_VDIR "/" +#define LUA_ROOT LUA_PATH "/" LUA_VDIR "/" #define LUA_LDIR LUA_ROOT "share/" #define LUA_CDIR LUA_ROOT "lib/" #ifndef LUA_PATH_DEFAULT Modified: stable/12/stand/loader.mk ============================================================================== --- stable/12/stand/loader.mk Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/loader.mk Tue Dec 3 18:25:16 2019 (r355345) @@ -62,6 +62,7 @@ SRCS+= interp_lua.c .include "${BOOTSRC}/lua.mk" LDR_INTERP= ${LIBLUA} LDR_INTERP32= ${LIBLUA32} +CFLAGS.interp_lua.c= -DLUA_PATH=\"${LUAPATH}\" -I${FLUASRC}/modules .elif ${LOADER_INTERP} == "4th" SRCS+= interp_forth.c .include "${BOOTSRC}/ficl.mk" Modified: stable/12/stand/lua/Makefile ============================================================================== --- stable/12/stand/lua/Makefile Tue Dec 3 17:43:57 2019 (r355344) +++ stable/12/stand/lua/Makefile Tue Dec 3 18:25:16 2019 (r355345) @@ -12,7 +12,7 @@ MAN= cli.lua.8 \ password.lua.8 \ screen.lua.8 -FILESDIR= /boot/lua +FILESDIR= ${LUAPATH} FILES= cli.lua \ color.lua \ config.lua \ From owner-svn-src-all@freebsd.org Tue Dec 3 18:28:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B21F51B88BD; Tue, 3 Dec 2019 18:28:39 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9Tz4GZ6z3GCt; Tue, 3 Dec 2019 18:28:39 +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 75FA91BC85; Tue, 3 Dec 2019 18:28:39 +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 xB3ISd1u049456; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3ISdhx049455; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031828.xB3ISdhx049455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355346 - in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Commit-Revision: 355346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:28:39 -0000 Author: kevans Date: Tue Dec 3 18:28:39 2019 New Revision: 355346 URL: https://svnweb.freebsd.org/changeset/base/355346 Log: MFC rarm: correct kernelstack allocation size This appears to be a copy-pasto from previous lines that propagated to v6 over the years. Indeed, nothing references kernelstack beyond USPACE_SVC_STACK_TOP and it would be odd if anything did. Modified: stable/11/sys/arm/arm/machdep.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/arm/arm/machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/arm/arm/machdep.c ============================================================================== --- stable/11/sys/arm/arm/machdep.c Tue Dec 3 18:25:16 2019 (r355345) +++ stable/11/sys/arm/arm/machdep.c Tue Dec 3 18:28:39 2019 (r355346) @@ -908,7 +908,7 @@ initarm(struct arm_boot_params *abp) valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages * MAXCPU); + valloc_pages(kernelstack, kstack_pages); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* @@ -1173,7 +1173,7 @@ initarm(struct arm_boot_params *abp) irqstack = pmap_preboot_get_vpages(IRQ_STACK_SIZE * MAXCPU); abtstack = pmap_preboot_get_vpages(ABT_STACK_SIZE * MAXCPU); undstack = pmap_preboot_get_vpages(UND_STACK_SIZE * MAXCPU ); - kernelstack = pmap_preboot_get_vpages(kstack_pages * MAXCPU); + kernelstack = pmap_preboot_get_vpages(kstack_pages); /* Allocate message buffer. */ msgbufp = (void *)pmap_preboot_get_vpages( From owner-svn-src-all@freebsd.org Tue Dec 3 18:28:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F4C11B88C3; Tue, 3 Dec 2019 18:28:40 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9Tz6hd2z3GCv; Tue, 3 Dec 2019 18:28:39 +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 C91951BC86; Tue, 3 Dec 2019 18:28:39 +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 xB3ISdwN049462; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3ISd82049461; Tue, 3 Dec 2019 18:28:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031828.xB3ISd82049461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:28: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: r355346 - in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm/arm 12/sys/arm/arm X-SVN-Commit-Revision: 355346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:28:40 -0000 Author: kevans Date: Tue Dec 3 18:28:39 2019 New Revision: 355346 URL: https://svnweb.freebsd.org/changeset/base/355346 Log: MFC rarm: correct kernelstack allocation size This appears to be a copy-pasto from previous lines that propagated to v6 over the years. Indeed, nothing references kernelstack beyond USPACE_SVC_STACK_TOP and it would be odd if anything did. Modified: stable/12/sys/arm/arm/machdep.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/arm/arm/machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/arm/arm/machdep.c ============================================================================== --- stable/12/sys/arm/arm/machdep.c Tue Dec 3 18:25:16 2019 (r355345) +++ stable/12/sys/arm/arm/machdep.c Tue Dec 3 18:28:39 2019 (r355346) @@ -942,7 +942,7 @@ initarm(struct arm_boot_params *abp) valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages * MAXCPU); + valloc_pages(kernelstack, kstack_pages); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* @@ -1207,7 +1207,7 @@ initarm(struct arm_boot_params *abp) irqstack = pmap_preboot_get_vpages(IRQ_STACK_SIZE * MAXCPU); abtstack = pmap_preboot_get_vpages(ABT_STACK_SIZE * MAXCPU); undstack = pmap_preboot_get_vpages(UND_STACK_SIZE * MAXCPU ); - kernelstack = pmap_preboot_get_vpages(kstack_pages * MAXCPU); + kernelstack = pmap_preboot_get_vpages(kstack_pages); /* Allocate message buffer. */ msgbufp = (void *)pmap_preboot_get_vpages( From owner-svn-src-all@freebsd.org Tue Dec 3 18:36:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 539901B8D0A for ; Tue, 3 Dec 2019 18:36:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9fl1P7gz3GsY for ; Tue, 3 Dec 2019 18:36:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 0923F1FDB0 for ; Tue, 3 Dec 2019 18:36:15 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f170.google.com with SMTP id j5so4779854qtq.9 for ; Tue, 03 Dec 2019 10:36:15 -0800 (PST) X-Gm-Message-State: APjAAAWRhv65rBe2YoJ4wlOlWPbBLnNwRXNKmWk6p2DeWWlybX+QdbOO VuLYibkS9etc5vofb0RI0s1PnRS2vGgsCv0D/HM= X-Received: by 2002:ac8:5319:: with SMTP id t25mt6861704qtn.242.1575398174636; Tue, 03 Dec 2019 10:36:14 -0800 (PST) MIME-Version: 1.0 References: <201912031828.xB3ISd82049461@repo.freebsd.org> In-Reply-To: <201912031828.xB3ISd82049461@repo.freebsd.org> From: Kyle Evans Date: Tue, 3 Dec 2019 12:36:02 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355346 - in stable: 11/sys/arm/arm 12/sys/arm/arm Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:36:15 -0000 On Tue, Dec 3, 2019 at 12:28 PM Kyle Evans wrote: > > Author: kevans > Date: Tue Dec 3 18:28:39 2019 > New Revision: 355346 > URL: https://svnweb.freebsd.org/changeset/base/355346 > > Log: > MFC rarm: correct kernelstack allocation size > > This appears to be a copy-pasto from previous lines that propagated to v6 > over the years. Indeed, nothing references kernelstack beyond > USPACE_SVC_STACK_TOP and it would be odd if anything did. > This should have read: "MFC r353902" From owner-svn-src-all@freebsd.org Tue Dec 3 18:36:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD1831B8D97; Tue, 3 Dec 2019 18:36:39 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9gC561dz3H0V; Tue, 3 Dec 2019 18:36:39 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ED881BE3F; Tue, 3 Dec 2019 18:36:39 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Iadog055485; Tue, 3 Dec 2019 18:36:39 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Iadwj055484; Tue, 3 Dec 2019 18:36:39 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912031836.xB3Iadwj055484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 3 Dec 2019 18:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355347 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 355347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:36:39 -0000 Author: tsoome Date: Tue Dec 3 18:36:39 2019 New Revision: 355347 URL: https://svnweb.freebsd.org/changeset/base/355347 Log: loader: ReadKeyStrokeEx may return partial keystrokes In some systems we can receive no scancode nor unicodechar values. PR: 240760 Reported by: Ariel Millennium Thornton MFC after: 1 week Modified: head/stand/efi/libefi/efi_console.c Modified: head/stand/efi/libefi/efi_console.c ============================================================================== --- head/stand/efi/libefi/efi_console.c Tue Dec 3 18:28:39 2019 (r355346) +++ head/stand/efi/libefi/efi_console.c Tue Dec 3 18:36:39 2019 (r355347) @@ -1126,10 +1126,11 @@ efi_readkey_ex(void) kp->UnicodeChar++; } } + if (kp->ScanCode == 0 && kp->UnicodeChar == 0) + return (false); + keybuf_inschar(kp); + return (true); } - - keybuf_inschar(kp); - return (true); } return (false); } From owner-svn-src-all@freebsd.org Tue Dec 3 18:38:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAC781B8F10; Tue, 3 Dec 2019 18:38:52 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9jm5xv2z3H9l; Tue, 3 Dec 2019 18:38:52 +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 AAD731BE49; Tue, 3 Dec 2019 18:38:52 +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 xB3IcqIo055628; Tue, 3 Dec 2019 18:38:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Icq3f055626; Tue, 3 Dec 2019 18:38:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031838.xB3Icq3f055626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:38:52 +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: r355348 - in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Commit-Revision: 355348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:38:53 -0000 Author: kevans Date: Tue Dec 3 18:38:51 2019 New Revision: 355348 URL: https://svnweb.freebsd.org/changeset/base/355348 Log: MFC r354236: mdmfs(8): add -k skel option to populate fs from a skeleton mdmfs(8) lacks the ability to populate throwaway memory filesystems from an existing directory. This features permits an interesting setup where /var for instance lives on a device where wear-leveling is something you want to avoid as much as possible and nonetheless you don't want to lose your logs, ports metadata, etc. Here are the steps: 1. Copy /var to /var.bak; 2. Mount an mfs into /var using -k /var.bak at startup; 3. Synchronize /var to /var.bak weekly and on shutdown. Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. PR: 146254 Modified: stable/11/sbin/mdmfs/mdmfs.8 stable/11/sbin/mdmfs/mdmfs.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sbin/mdmfs/mdmfs.8 stable/12/sbin/mdmfs/mdmfs.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sbin/mdmfs/mdmfs.8 ============================================================================== --- stable/11/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:36:39 2019 (r355347) +++ stable/11/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:38:51 2019 (r355348) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd October 31, 2019 .Dt MDMFS 8 .Os .Sh NAME @@ -48,6 +48,7 @@ filesystem .Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes +.Op Fl k Ar skel .Op Fl m Ar percent-free .Op Fl O Ar optimization .Op Fl o Ar mount-options @@ -192,6 +193,11 @@ memory disk backed by The fragment size of the file system in bytes. .It Fl i Ar bytes Number of bytes per inode. +.It Fl k Ar skel +Copy the content of directory +.Ar skel +into +.Ar mount-point . .It Fl l Enable multilabel MAC on the new file system. .It Fl L Modified: stable/11/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/11/sbin/mdmfs/mdmfs.c Tue Dec 3 18:36:39 2019 (r355347) +++ stable/11/sbin/mdmfs/mdmfs.c Tue Dec 3 18:38:51 2019 (r355348) @@ -88,6 +88,7 @@ static void do_mount_md(const char *, const char *); static void do_mount_tmpfs(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); +static void do_copy(const char *, const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); static void usage(void); @@ -102,7 +103,7 @@ main(int argc, char **argv) enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype, mlmac; bool detach, softdep, autounit, newfs; - const char *mtpoint, *size_arg, *unitstr; + const char *mtpoint, *size_arg, *skel, *unitstr; char *p; int ch, idx; void *set; @@ -116,6 +117,7 @@ main(int argc, char **argv) mlmac = false; newfs = true; have_mdtype = false; + skel = NULL; mdtype = MD_SWAP; mdname = MD_NAME; mdnamelen = strlen(mdname); @@ -140,7 +142,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -182,6 +184,9 @@ main(int argc, char **argv) case 'i': argappend(&newfs_arg, "-i %s", optarg); break; + case 'k': + skel = optarg; + break; case 'L': loudsubs = true; break; @@ -357,6 +362,8 @@ main(int argc, char **argv) } do_mtptsetup(mtpoint, &mi); + if (skel != NULL) + do_copy(mtpoint, skel); return (0); } @@ -608,7 +615,24 @@ do_newfs(const char *args) errx(1, "newfs exited with error code %d", rv); } + /* + * Copy skel into the mountpoint. + */ +static void +do_copy(const char *mtpoint, const char *skel) +{ + int rv; + + rv = chdir(skel); + if (rv != 0) + err(1, "chdir to %s", skel); + rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint); + if (rv != 0) + errx(1, "skel copy failed"); +} + +/* * 'str' should be a user and group name similar to the last argument * to chown(1); i.e., a user, followed by a colon, followed by a * group. The user and group in 'str' may be either a [ug]id or a @@ -783,8 +807,8 @@ usage(void) fprintf(stderr, "usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" -"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" -"\t[-O optimization] [-o mount-options]\n" +"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-k skel]\n" +"\t[-m percent-free] [-O optimization] [-o mount-options]\n" "\t[-p permissions] [-s size] [-v version] [-w user:group]\n" "\tmd-device mount-point\n", getprogname()); exit(1); From owner-svn-src-all@freebsd.org Tue Dec 3 18:38:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 740831B8F1C; Tue, 3 Dec 2019 18:38:53 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9jn2VCRz3H9m; Tue, 3 Dec 2019 18:38:53 +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 390BD1BE4A; Tue, 3 Dec 2019 18:38:53 +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 xB3Icrrn055637; Tue, 3 Dec 2019 18:38:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IcqAR055635; Tue, 3 Dec 2019 18:38:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031838.xB3IcqAR055635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:38: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: r355348 - in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sbin/mdmfs 12/sbin/mdmfs X-SVN-Commit-Revision: 355348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:38:53 -0000 Author: kevans Date: Tue Dec 3 18:38:51 2019 New Revision: 355348 URL: https://svnweb.freebsd.org/changeset/base/355348 Log: MFC r354236: mdmfs(8): add -k skel option to populate fs from a skeleton mdmfs(8) lacks the ability to populate throwaway memory filesystems from an existing directory. This features permits an interesting setup where /var for instance lives on a device where wear-leveling is something you want to avoid as much as possible and nonetheless you don't want to lose your logs, ports metadata, etc. Here are the steps: 1. Copy /var to /var.bak; 2. Mount an mfs into /var using -k /var.bak at startup; 3. Synchronize /var to /var.bak weekly and on shutdown. Note that this more or less mimics OpenBSD's mount_mfs(8) -P flag. PR: 146254 Modified: stable/12/sbin/mdmfs/mdmfs.8 stable/12/sbin/mdmfs/mdmfs.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sbin/mdmfs/mdmfs.8 stable/11/sbin/mdmfs/mdmfs.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sbin/mdmfs/mdmfs.8 ============================================================================== --- stable/12/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:36:39 2019 (r355347) +++ stable/12/sbin/mdmfs/mdmfs.8 Tue Dec 3 18:38:51 2019 (r355348) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 9, 2017 +.Dd October 31, 2019 .Dt MDMFS 8 .Os .Sh NAME @@ -48,6 +48,7 @@ filesystem .Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes +.Op Fl k Ar skel .Op Fl m Ar percent-free .Op Fl O Ar optimization .Op Fl o Ar mount-options @@ -193,6 +194,11 @@ memory disk backed by The fragment size of the file system in bytes. .It Fl i Ar bytes Number of bytes per inode. +.It Fl k Ar skel +Copy the content of directory +.Ar skel +into +.Ar mount-point . .It Fl l Enable multilabel MAC on the new file system. .It Fl L Modified: stable/12/sbin/mdmfs/mdmfs.c ============================================================================== --- stable/12/sbin/mdmfs/mdmfs.c Tue Dec 3 18:36:39 2019 (r355347) +++ stable/12/sbin/mdmfs/mdmfs.c Tue Dec 3 18:38:51 2019 (r355348) @@ -88,6 +88,7 @@ static void do_mount_md(const char *, const char *); static void do_mount_tmpfs(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); +static void do_copy(const char *, const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); static void usage(void); @@ -102,7 +103,7 @@ main(int argc, char **argv) enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype, mlmac; bool detach, softdep, autounit, newfs; - const char *mtpoint, *size_arg, *unitstr; + const char *mtpoint, *size_arg, *skel, *unitstr; char *p; int ch, idx; void *set; @@ -116,6 +117,7 @@ main(int argc, char **argv) mlmac = false; newfs = true; have_mdtype = false; + skel = NULL; mdtype = MD_SWAP; mdname = MD_NAME; mdnamelen = strlen(mdname); @@ -140,7 +142,7 @@ main(int argc, char **argv) } while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:E:e:F:f:hi:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) + "a:b:Cc:Dd:E:e:F:f:hi:k:LlMm:NnO:o:Pp:Ss:tT:Uv:w:X")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -182,6 +184,9 @@ main(int argc, char **argv) case 'i': argappend(&newfs_arg, "-i %s", optarg); break; + case 'k': + skel = optarg; + break; case 'L': loudsubs = true; break; @@ -357,6 +362,8 @@ main(int argc, char **argv) } do_mtptsetup(mtpoint, &mi); + if (skel != NULL) + do_copy(mtpoint, skel); return (0); } @@ -608,7 +615,24 @@ do_newfs(const char *args) errx(1, "newfs exited with error code %d", rv); } + /* + * Copy skel into the mountpoint. + */ +static void +do_copy(const char *mtpoint, const char *skel) +{ + int rv; + + rv = chdir(skel); + if (rv != 0) + err(1, "chdir to %s", skel); + rv = run(NULL, "/bin/pax -rw -pe . %s", mtpoint); + if (rv != 0) + errx(1, "skel copy failed"); +} + +/* * 'str' should be a user and group name similar to the last argument * to chown(1); i.e., a user, followed by a colon, followed by a * group. The user and group in 'str' may be either a [ug]id or a @@ -783,8 +807,8 @@ usage(void) fprintf(stderr, "usage: %s [-DLlMNnPStUX] [-a maxcontig] [-b block-size]\n" "\t[-c blocks-per-cylinder-group][-d max-extent-size] [-E path-mdconfig]\n" -"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-m percent-free]\n" -"\t[-O optimization] [-o mount-options]\n" +"\t[-e maxbpg] [-F file] [-f frag-size] [-i bytes] [-k skel]\n" +"\t[-m percent-free] [-O optimization] [-o mount-options]\n" "\t[-p permissions] [-s size] [-v version] [-w user:group]\n" "\tmd-device mount-point\n", getprogname()); exit(1); From owner-svn-src-all@freebsd.org Tue Dec 3 18:44:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2940C1B92E4; Tue, 3 Dec 2019 18:44: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9r40Khsz3Hn5; Tue, 3 Dec 2019 18:44: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 E2CA01C00E; Tue, 3 Dec 2019 18:44:19 +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 xB3IiJ2U061656; Tue, 3 Dec 2019 18:44:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IiJxr061655; Tue, 3 Dec 2019 18:44:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031844.xB3IiJxr061655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:44:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355349 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 355349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:44:20 -0000 Author: kevans Date: Tue Dec 3 18:44:19 2019 New Revision: 355349 URL: https://svnweb.freebsd.org/changeset/base/355349 Log: lualoader: correct a typo from r354247 r354247 converted try_include to lfs + dofile with the loader.lua_path added just before. Fortunately, there was a hardcoded /boot/lua fallback in case loader.lua_path wasn't being set yet- I typo'd it as loader.lua_paths. Fix the typo. X-MFC-With: r354247 MFC after: 3 days Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Tue Dec 3 18:38:51 2019 (r355348) +++ head/stand/lua/core.lua Tue Dec 3 18:44:19 2019 (r355349) @@ -70,7 +70,7 @@ end -- message on failure. function try_include(module) if module:sub(1, 1) ~= "/" then - local lua_path = loader.lua_paths + local lua_path = loader.lua_path -- XXX Temporary compat shim; this should be removed once the -- loader.lua_path export has sufficiently spread. if lua_path == nil then From owner-svn-src-all@freebsd.org Tue Dec 3 18:50:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EE531B959D; Tue, 3 Dec 2019 18:50:19 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9yz2HPHz3J8B; Tue, 3 Dec 2019 18:50:19 +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 3191E1C018; Tue, 3 Dec 2019 18:50:19 +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 xB3IoJPu061999; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IoJwT061998; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031850.xB3IoJwT061998@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355350 - in stable: 11/stand/liblua 12/stand/liblua X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/liblua 12/stand/liblua X-SVN-Commit-Revision: 355350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:50:19 -0000 Author: kevans Date: Tue Dec 3 18:50:18 2019 New Revision: 355350 URL: https://svnweb.freebsd.org/changeset/base/355350 Log: MFC r354246: liblua: add loader.lua_path As described previously, loader.lua_path is absolute path where scripts are installed. A future commit will use this to build paths for dofile in try_include, rather than the current pcall/require setup that makes it more difficult to coordinate loader aborts from local.lua -- we do not need the flexibility of require(), and local.lua is in-fact not a 'module-like' file as we will not be referencing anything from it. Modified: stable/11/stand/liblua/lutils.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/stand/liblua/lutils.c Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/liblua/lutils.c ============================================================================== --- stable/11/stand/liblua/lutils.c Tue Dec 3 18:44:19 2019 (r355349) +++ stable/11/stand/liblua/lutils.c Tue Dec 3 18:50:18 2019 (r355350) @@ -384,6 +384,8 @@ luaopen_loader(lua_State *L) lua_setfield(L, -2, "machine"); lua_pushstring(L, MACHINE_ARCH); lua_setfield(L, -2, "machine_arch"); + lua_pushstring(L, LUA_PATH); + lua_setfield(L, -2, "lua_path"); /* Set global printc to loader.printc */ lua_register(L, "printc", lua_printc); return 1; From owner-svn-src-all@freebsd.org Tue Dec 3 18:50:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEE861B95A5; Tue, 3 Dec 2019 18:50:19 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S9yz4hKsz3J8C; Tue, 3 Dec 2019 18:50:19 +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 846501C019; Tue, 3 Dec 2019 18:50:19 +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 xB3IoJRi062005; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IoJGk062004; Tue, 3 Dec 2019 18:50:19 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031850.xB3IoJGk062004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:50:19 +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: r355350 - in stable: 11/stand/liblua 12/stand/liblua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/liblua 12/stand/liblua X-SVN-Commit-Revision: 355350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:50:19 -0000 Author: kevans Date: Tue Dec 3 18:50:18 2019 New Revision: 355350 URL: https://svnweb.freebsd.org/changeset/base/355350 Log: MFC r354246: liblua: add loader.lua_path As described previously, loader.lua_path is absolute path where scripts are installed. A future commit will use this to build paths for dofile in try_include, rather than the current pcall/require setup that makes it more difficult to coordinate loader aborts from local.lua -- we do not need the flexibility of require(), and local.lua is in-fact not a 'module-like' file as we will not be referencing anything from it. Modified: stable/12/stand/liblua/lutils.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/liblua/lutils.c Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/liblua/lutils.c ============================================================================== --- stable/12/stand/liblua/lutils.c Tue Dec 3 18:44:19 2019 (r355349) +++ stable/12/stand/liblua/lutils.c Tue Dec 3 18:50:18 2019 (r355350) @@ -384,6 +384,8 @@ luaopen_loader(lua_State *L) lua_setfield(L, -2, "machine"); lua_pushstring(L, MACHINE_ARCH); lua_setfield(L, -2, "machine_arch"); + lua_pushstring(L, LUA_PATH); + lua_setfield(L, -2, "lua_path"); /* Set global printc to loader.printc */ lua_register(L, "printc", lua_printc); return 1; From owner-svn-src-all@freebsd.org Tue Dec 3 18:55:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 194BA1B9997; Tue, 3 Dec 2019 18:55:11 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SB4b0bHlz3JmM; Tue, 3 Dec 2019 18:55:11 +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 E871B1C1E1; Tue, 3 Dec 2019 18:55:10 +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 xB3ItAMS067488; Tue, 3 Dec 2019 18:55:10 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3It9Ca067480; Tue, 3 Dec 2019 18:55:09 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031855.xB3It9Ca067480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355351 - in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Commit-Revision: 355351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:55:11 -0000 Author: kevans Date: Tue Dec 3 18:55:09 2019 New Revision: 355351 URL: https://svnweb.freebsd.org/changeset/base/355351 Log: MFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement r351836: patch(1): add some basic tests Summary: - basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chunks being added - limited_ctx: stems from PR 74127 in which a rogue line was getting added when the patch should have been rejected. Similar behavior was reproducible with larger contexts near the beginning/end of a file. See r326084 for details - file_creation: patch sourced from /dev/null should create the file - file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents when re-applied (personal vendetta, WIP, see comment) - file_removal: this follows from nodupe; the reverse of a patch sourced from /dev/null is most naturally deleting the file, as is expected based on GNU patch behavior (WIP) r351866: patch(1): fix the file removal test, strengthen it a bit To remain compatible with GNU patch, we should ensure that once we're removing empty files after a reversed /dev/null patch we don't remove files that have been modified. GNU patch leaves these intact and just reverses the hunk that created the file, effectively implying --remove-empty-files for reversed /dev/null patches. r354328: patch(1): give /dev/null patches special treatment We have a bad habit of duplicating contents of files that are sourced from /dev/null and applied more than once... take the more sane (in most ways) GNU route and complain if the file exists and offer reversal options. This still falls short a little bit as selecting "don't reverse, apply anyway" will still give you duplicated file contents. There's probably other issues as well, but awareness is the first step to happiness. Added: stable/11/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/patch/Makefile stable/11/usr.bin/patch/patch.1 stable/11/usr.bin/patch/patch.c stable/11/usr.bin/patch/pch.c stable/11/usr.bin/patch/pch.h stable/11/usr.bin/patch/tests/unified_patch_test.sh stable/11/usr.bin/patch/util.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Added: stable/12/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/usr.bin/patch/Makefile stable/12/usr.bin/patch/patch.1 stable/12/usr.bin/patch/patch.c stable/12/usr.bin/patch/pch.c stable/12/usr.bin/patch/pch.h stable/12/usr.bin/patch/tests/unified_patch_test.sh stable/12/usr.bin/patch/util.c Directory Properties: stable/12/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/etc/mtree/BSD.tests.dist Tue Dec 3 18:55:09 2019 (r355351) @@ -692,6 +692,8 @@ .. opensm .. + patch + .. pr .. printf Modified: stable/11/usr.bin/patch/Makefile ============================================================================== --- stable/11/usr.bin/patch/Makefile Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/Makefile Tue Dec 3 18:55:09 2019 (r355351) @@ -1,8 +1,13 @@ # $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $ # $FreeBSD$ +.include + PROG= patch SRCS= backupfile.c inp.c mkpath.c patch.c pch.c util.c + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/11/usr.bin/patch/patch.1 ============================================================================== --- stable/11/usr.bin/patch/patch.1 Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/patch.1 Tue Dec 3 18:55:09 2019 (r355351) @@ -21,7 +21,7 @@ .\" .\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $ .\" $FreeBSD$ -.Dd August 15, 2015 +.Dd November 3, 2019 .Dt PATCH 1 .Os .Sh NAME @@ -559,8 +559,10 @@ option as needed. .Pp Third, you can create a file by sending out a diff that compares a null file to the file you want to create. -This will only work if the file you want to create does not exist already in -the target directory. +If the file you want to create already exists in the target directory when the +diff is applied, then +.Nm +will identify the patch as potentially reversed and offer to reverse the patch. .Pp Fourth, take care not to send out reversed patches, since it makes people wonder whether they already applied the patch. Modified: stable/11/usr.bin/patch/patch.c ============================================================================== --- stable/11/usr.bin/patch/patch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/patch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,7 @@ static void dump_line(LINENUM, bool); static bool patch_match(LINENUM, LINENUM, LINENUM); static bool similar(const char *, const char *, int); static void usage(void); +static bool handle_creation(bool, bool *); /* true if -E was specified on command line. */ static bool remove_empty_files = false; @@ -147,8 +149,10 @@ static char end_defined[128]; int main(int argc, char *argv[]) { + struct stat statbuf; int error = 0, hunk, failed, i, fd; - bool patch_seen, reverse_seen; + bool out_creating, out_existed, patch_seen, remove_file; + bool reverse_seen; LINENUM where = 0, newwhere, fuzz, mymaxfuzz; const char *tmpdir; char *v; @@ -219,6 +223,12 @@ main(int argc, char *argv[]) reinitialize_almost_everything()) { /* for each patch in patch file */ + if (source_file != NULL && (diff_type == CONTEXT_DIFF || + diff_type == NEW_CONTEXT_DIFF || + diff_type == UNI_DIFF)) + out_creating = strcmp(source_file, _PATH_DEVNULL) == 0; + else + out_creating = false; patch_seen = true; warn_on_invalid_line = true; @@ -226,6 +236,19 @@ main(int argc, char *argv[]) if (outname == NULL) outname = xstrdup(filearg[0]); + /* + * At this point, we know if we're supposed to be creating the + * file and we know if we should be trying to handle a conflict + * between the patch and the file already existing. We defer + * handling it until hunk processing because we want to swap + * the hunk if they opt to reverse it, but we want to make sure + * we *can* swap the hunk without running into memory issues + * before we offer it. We also want to be verbose if flags or + * user decision cause us to skip -- this is explained a little + * more later. + */ + out_existed = stat(outname, &statbuf) == 0; + /* for ed script just up and do it and exit */ if (diff_type == ED_DIFF) { do_ed_script(); @@ -252,9 +275,28 @@ main(int argc, char *argv[]) failed = 0; reverse_seen = false; out_of_mem = false; + remove_file = false; while (another_hunk()) { + assert(!out_creating || hunk == 0); hunk++; fuzz = 0; + + /* + * There are only three cases in handle_creation() that + * results in us skipping hunk location, in order: + * + * 1.) Potentially reversed but -f/--force'd, + * 2.) Potentially reversed but -N/--forward'd + * 3.) Reversed and the user's opted to not apply it. + * + * In all three cases, we still want to inform the user + * that we're ignoring it in the standard way, which is + * also tied to this hunk processing loop. + */ + if (out_creating) + reverse_seen = handle_creation(out_existed, + &remove_file); + mymaxfuzz = pch_context(); if (maxfuzz < mymaxfuzz) mymaxfuzz = maxfuzz; @@ -372,7 +414,6 @@ main(int argc, char *argv[]) /* and put the output where desired */ ignore_signals(); if (!skip_rest_of_patch) { - struct stat statbuf; char *realout = outname; if (!check_only) { @@ -383,7 +424,18 @@ main(int argc, char *argv[]) } else chmod(outname, filemode); - if (remove_empty_files && + /* + * remove_file is a per-patch flag indicating + * whether it's OK to remove the empty file. + * This is specifically set when we're reversing + * the creation of a file and it ends up empty. + * This is an exception to the global policy + * (remove_empty_files) because the user would + * likely not expect the reverse of file + * creation to leave an empty file laying + * around. + */ + if ((remove_empty_files || remove_file) && stat(realout, &statbuf) == 0 && statbuf.st_size == 0) { if (verbose) @@ -444,6 +496,9 @@ reinitialize_almost_everything(void) filearg[0] = NULL; } + free(source_file); + source_file = NULL; + free(outname); outname = NULL; @@ -1083,4 +1138,85 @@ similar(const char *a, const char *b, int len) } return true; /* actually, this is not reached */ /* since there is always a \n */ +} + +static bool +handle_creation(bool out_existed, bool *remove) +{ + bool reverse_seen; + + reverse_seen = false; + if (reverse && out_existed) { + /* + * If the patch creates the file and we're reversing the patch, + * then we need to indicate to the patch processor that it's OK + * to remove this file. + */ + *remove = true; + } else if (!reverse && out_existed) { + /* + * Otherwise, we need to blow the horn because the patch appears + * to be reversed/already applied. For non-batch jobs, we'll + * prompt to figure out what we should be trying to do to raise + * awareness of the issue. batch (-t) processing suppresses the + * questions and just assumes that we're reversed if it looks + * like we are, which is always the case if we've reached this + * branch. + */ + if (force) { + skip_rest_of_patch = true; + return (false); + } + if (noreverse) { + /* If -N is supplied, however, we bail out/ignore. */ + say("Ignoring previously applied (or reversed) patch.\n"); + skip_rest_of_patch = true; + return (false); + } + + /* Unreversed... suspicious if the file existed. */ + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + + reverse = !reverse; + + if (batch) { + if (verbose) + say("Patch creates file that already exists, %s %seversed", + reverse ? "Assuming" : "Ignoring", + reverse ? "R" : "Unr"); + } else { + ask("Patch creates file that already exists! %s -R? [y] ", + reverse ? "Assume" : "Ignore"); + + if (*buf == 'n') { + ask("Apply anyway? [n]"); + if (*buf != 'y') + /* Don't apply; error out. */ + skip_rest_of_patch = true; + else + /* Attempt to apply. */ + reverse_seen = true; + reverse = !reverse; + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + } else { + /* + * They've opted to assume -R; effectively the + * same as the first branch in this function, + * but the decision is here rather than in a + * prior patch/hunk as in that branch. + */ + *remove = true; + } + } + } + + /* + * The return value indicates if we offered a chance to reverse but the + * user declined. This keeps the main patch processor in the loop since + * we've taken this out of the normal flow of hunk processing to + * simplify logic a little bit. + */ + return (reverse_seen); } Modified: stable/11/usr.bin/patch/pch.c ============================================================================== --- stable/11/usr.bin/patch/pch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/pch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -70,6 +70,8 @@ static LINENUM p_bfake = -1; /* beg of faked up lines static FILE *pfp = NULL; /* patch file pointer */ static char *bestguess = NULL; /* guess at correct filename */ +char *source_file; + static void grow_hunkmax(void); static int intuit_diff_type(void); static void next_intuit_at(off_t, LINENUM); @@ -218,7 +220,12 @@ there_is_another_patch(void) bestguess = xstrdup(buf); filearg[0] = fetchname(buf, &exists, 0); } - if (!exists) { + /* + * fetchname can now return buf = NULL, exists = true, to + * indicate to the caller that /dev/null was specified. Retain + * previous behavior for now until this can be better evaluted. + */ + if (filearg[0] == NULL || !exists) { int def_skip = *bestguess == '\0'; ask("No file found--skip this patch? [%c] ", def_skip ? 'y' : 'n'); @@ -402,6 +409,24 @@ scan_exit: struct file_name tmp = names[OLD_FILE]; names[OLD_FILE] = names[NEW_FILE]; names[NEW_FILE] = tmp; + } + + /* Invalidated */ + free(source_file); + source_file = NULL; + + if (retval != 0) { + /* + * If we've successfully determined a diff type, stored in + * retval, path == NULL means _PATH_DEVNULL if exists is set. + * Explicitly specify it here to make it easier to detect later + * on that we're actually creating a file and not that we've + * just goofed something up. + */ + if (names[OLD_FILE].path != NULL) + source_file = xstrdup(names[OLD_FILE].path); + else if (names[OLD_FILE].exists) + source_file = xstrdup(_PATH_DEVNULL); } if (filearg[0] == NULL) { if (posix) Modified: stable/11/usr.bin/patch/pch.h ============================================================================== --- stable/11/usr.bin/patch/pch.h Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/pch.h Tue Dec 3 18:55:09 2019 (r355351) @@ -37,6 +37,8 @@ struct file_name { bool exists; }; +extern char *source_file; + void re_patch(void); void open_patch_file(const char *); void set_hunkmax(void); Modified: stable/11/usr.bin/patch/tests/unified_patch_test.sh ============================================================================== --- head/usr.bin/patch/tests/unified_patch_test.sh Thu Sep 5 03:16:14 2019 (r351836) +++ stable/11/usr.bin/patch/tests/unified_patch_test.sh Tue Dec 3 18:55:09 2019 (r355351) @@ -102,32 +102,44 @@ file_creation_body() # commits. If a file is created by a diff, patch(1) will happily duplicate the # contents as many times as you apply the diff. It should instead detect that # a source of /dev/null creates the file, so it shouldn't exist. Furthermore, -# the reverse of creation is deletion -- hence the next test. +# the reverse of creation is deletion -- hence the next test, which ensures that +# the file is removed if it's empty once the patch is reversed. The size checks +# are scattered throughout to make sure that we didn't get some kind of false +# error, and the first size check is merely a sanity check that should be +# trivially true as this is executed in a sandbox. atf_test_case file_nodupe file_nodupe_body() { - # WIP - atf_expect_fail "patch(1) erroneously duplicates created files" echo "x" > foo diff -u /dev/null foo > foo.diff - atf_check -x "patch -s < foo.diff" - atf_check -s not-exit:0 -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -Ns < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo } atf_test_case file_removal file_removal_body() { - # WIP - atf_expect_fail "patch(1) does not yet recognize /dev/null as creation" - echo "x" > foo diff -u /dev/null foo > foo.diff + # Check that the file is removed completely if it was sourced from + # /dev/null atf_check -x "patch -Rs < foo.diff" - atf_check -s not-exit:0 -o ignore stat foo + atf_check -s not-exit:0 -e ignore stat foo + + # But if it had been modified, we'll only remove the portion that the + # patch would have created. This makes us compatible with GNU patch's + # behavior, at least. Whether that is the sane action or not is a + # question for further study, and then this comment may be removed. + printf "x\ny\n" > foo + atf_check -x "patch -Rs < foo.diff" + atf_check -o inline:"y\n" cat foo } atf_init_test_cases() Modified: stable/11/usr.bin/patch/util.c ============================================================================== --- stable/11/usr.bin/patch/util.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/11/usr.bin/patch/util.c Tue Dec 3 18:55:09 2019 (r355351) @@ -366,8 +366,10 @@ fetchname(const char *at, bool *exists, int strip_lead say("fetchname %s %d\n", at, strip_leading); #endif /* So files can be created by diffing against /dev/null. */ - if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) + if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) { + *exists = true; return NULL; + } name = fullname = t = savestr(at); tab = strchr(t, '\t') != NULL; From owner-svn-src-all@freebsd.org Tue Dec 3 18:55:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEA7B1B99B2; Tue, 3 Dec 2019 18:55:12 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SB4c6F5Wz3Jn9; Tue, 3 Dec 2019 18:55:12 +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 A21341C1E2; Tue, 3 Dec 2019 18:55:12 +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 xB3ItCj0067503; Tue, 3 Dec 2019 18:55:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3ItBjk067495; Tue, 3 Dec 2019 18:55:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031855.xB3ItBjk067495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:55: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: r355351 - in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/etc/mtree 11/usr.bin/patch 11/usr.bin/patch/tests 12/etc/mtree 12/usr.bin/patch 12/usr.bin/patch/tests X-SVN-Commit-Revision: 355351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:55:13 -0000 Author: kevans Date: Tue Dec 3 18:55:09 2019 New Revision: 355351 URL: https://svnweb.freebsd.org/changeset/base/355351 Log: MFC r351836, r351866, r354328: patch(1) /dev/null testing+improvement r351836: patch(1): add some basic tests Summary: - basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chunks being added - limited_ctx: stems from PR 74127 in which a rogue line was getting added when the patch should have been rejected. Similar behavior was reproducible with larger contexts near the beginning/end of a file. See r326084 for details - file_creation: patch sourced from /dev/null should create the file - file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents when re-applied (personal vendetta, WIP, see comment) - file_removal: this follows from nodupe; the reverse of a patch sourced from /dev/null is most naturally deleting the file, as is expected based on GNU patch behavior (WIP) r351866: patch(1): fix the file removal test, strengthen it a bit To remain compatible with GNU patch, we should ensure that once we're removing empty files after a reversed /dev/null patch we don't remove files that have been modified. GNU patch leaves these intact and just reverses the hunk that created the file, effectively implying --remove-empty-files for reversed /dev/null patches. r354328: patch(1): give /dev/null patches special treatment We have a bad habit of duplicating contents of files that are sourced from /dev/null and applied more than once... take the more sane (in most ways) GNU route and complain if the file exists and offer reversal options. This still falls short a little bit as selecting "don't reverse, apply anyway" will still give you duplicated file contents. There's probably other issues as well, but awareness is the first step to happiness. Added: stable/12/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/12/etc/mtree/BSD.tests.dist stable/12/usr.bin/patch/Makefile stable/12/usr.bin/patch/patch.1 stable/12/usr.bin/patch/patch.c stable/12/usr.bin/patch/pch.c stable/12/usr.bin/patch/pch.h stable/12/usr.bin/patch/tests/unified_patch_test.sh stable/12/usr.bin/patch/util.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Added: stable/11/usr.bin/patch/tests/ - copied from r351836, head/usr.bin/patch/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/patch/Makefile stable/11/usr.bin/patch/patch.1 stable/11/usr.bin/patch/patch.c stable/11/usr.bin/patch/pch.c stable/11/usr.bin/patch/pch.h stable/11/usr.bin/patch/tests/unified_patch_test.sh stable/11/usr.bin/patch/util.c Directory Properties: stable/11/ (props changed) Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/etc/mtree/BSD.tests.dist Tue Dec 3 18:55:09 2019 (r355351) @@ -1010,6 +1010,8 @@ .. opensm .. + patch + .. pr .. printf Modified: stable/12/usr.bin/patch/Makefile ============================================================================== --- stable/12/usr.bin/patch/Makefile Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/Makefile Tue Dec 3 18:55:09 2019 (r355351) @@ -1,8 +1,13 @@ # $OpenBSD: Makefile,v 1.4 2005/05/16 15:22:46 espie Exp $ # $FreeBSD$ +.include + PROG= patch SRCS= backupfile.c inp.c mkpath.c patch.c pch.c util.c + +HAS_TESTS= +SUBDIR.${MK_TESTS}+= tests .include Modified: stable/12/usr.bin/patch/patch.1 ============================================================================== --- stable/12/usr.bin/patch/patch.1 Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/patch.1 Tue Dec 3 18:55:09 2019 (r355351) @@ -21,7 +21,7 @@ .\" .\" $OpenBSD: patch.1,v 1.27 2014/04/15 06:26:54 jmc Exp $ .\" $FreeBSD$ -.Dd August 15, 2015 +.Dd November 3, 2019 .Dt PATCH 1 .Os .Sh NAME @@ -559,8 +559,10 @@ option as needed. .Pp Third, you can create a file by sending out a diff that compares a null file to the file you want to create. -This will only work if the file you want to create does not exist already in -the target directory. +If the file you want to create already exists in the target directory when the +diff is applied, then +.Nm +will identify the patch as potentially reversed and offer to reverse the patch. .Pp Fourth, take care not to send out reversed patches, since it makes people wonder whether they already applied the patch. Modified: stable/12/usr.bin/patch/patch.c ============================================================================== --- stable/12/usr.bin/patch/patch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/patch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -103,6 +104,7 @@ static void dump_line(LINENUM, bool); static bool patch_match(LINENUM, LINENUM, LINENUM); static bool similar(const char *, const char *, int); static void usage(void); +static bool handle_creation(bool, bool *); /* true if -E was specified on command line. */ static bool remove_empty_files = false; @@ -147,8 +149,10 @@ static char end_defined[128]; int main(int argc, char *argv[]) { + struct stat statbuf; int error = 0, hunk, failed, i, fd; - bool patch_seen, reverse_seen; + bool out_creating, out_existed, patch_seen, remove_file; + bool reverse_seen; LINENUM where = 0, newwhere, fuzz, mymaxfuzz; const char *tmpdir; char *v; @@ -219,6 +223,12 @@ main(int argc, char *argv[]) reinitialize_almost_everything()) { /* for each patch in patch file */ + if (source_file != NULL && (diff_type == CONTEXT_DIFF || + diff_type == NEW_CONTEXT_DIFF || + diff_type == UNI_DIFF)) + out_creating = strcmp(source_file, _PATH_DEVNULL) == 0; + else + out_creating = false; patch_seen = true; warn_on_invalid_line = true; @@ -226,6 +236,19 @@ main(int argc, char *argv[]) if (outname == NULL) outname = xstrdup(filearg[0]); + /* + * At this point, we know if we're supposed to be creating the + * file and we know if we should be trying to handle a conflict + * between the patch and the file already existing. We defer + * handling it until hunk processing because we want to swap + * the hunk if they opt to reverse it, but we want to make sure + * we *can* swap the hunk without running into memory issues + * before we offer it. We also want to be verbose if flags or + * user decision cause us to skip -- this is explained a little + * more later. + */ + out_existed = stat(outname, &statbuf) == 0; + /* for ed script just up and do it and exit */ if (diff_type == ED_DIFF) { do_ed_script(); @@ -252,9 +275,28 @@ main(int argc, char *argv[]) failed = 0; reverse_seen = false; out_of_mem = false; + remove_file = false; while (another_hunk()) { + assert(!out_creating || hunk == 0); hunk++; fuzz = 0; + + /* + * There are only three cases in handle_creation() that + * results in us skipping hunk location, in order: + * + * 1.) Potentially reversed but -f/--force'd, + * 2.) Potentially reversed but -N/--forward'd + * 3.) Reversed and the user's opted to not apply it. + * + * In all three cases, we still want to inform the user + * that we're ignoring it in the standard way, which is + * also tied to this hunk processing loop. + */ + if (out_creating) + reverse_seen = handle_creation(out_existed, + &remove_file); + mymaxfuzz = pch_context(); if (maxfuzz < mymaxfuzz) mymaxfuzz = maxfuzz; @@ -372,7 +414,6 @@ main(int argc, char *argv[]) /* and put the output where desired */ ignore_signals(); if (!skip_rest_of_patch) { - struct stat statbuf; char *realout = outname; if (!check_only) { @@ -383,7 +424,18 @@ main(int argc, char *argv[]) } else chmod(outname, filemode); - if (remove_empty_files && + /* + * remove_file is a per-patch flag indicating + * whether it's OK to remove the empty file. + * This is specifically set when we're reversing + * the creation of a file and it ends up empty. + * This is an exception to the global policy + * (remove_empty_files) because the user would + * likely not expect the reverse of file + * creation to leave an empty file laying + * around. + */ + if ((remove_empty_files || remove_file) && stat(realout, &statbuf) == 0 && statbuf.st_size == 0) { if (verbose) @@ -444,6 +496,9 @@ reinitialize_almost_everything(void) filearg[0] = NULL; } + free(source_file); + source_file = NULL; + free(outname); outname = NULL; @@ -1083,4 +1138,85 @@ similar(const char *a, const char *b, int len) } return true; /* actually, this is not reached */ /* since there is always a \n */ +} + +static bool +handle_creation(bool out_existed, bool *remove) +{ + bool reverse_seen; + + reverse_seen = false; + if (reverse && out_existed) { + /* + * If the patch creates the file and we're reversing the patch, + * then we need to indicate to the patch processor that it's OK + * to remove this file. + */ + *remove = true; + } else if (!reverse && out_existed) { + /* + * Otherwise, we need to blow the horn because the patch appears + * to be reversed/already applied. For non-batch jobs, we'll + * prompt to figure out what we should be trying to do to raise + * awareness of the issue. batch (-t) processing suppresses the + * questions and just assumes that we're reversed if it looks + * like we are, which is always the case if we've reached this + * branch. + */ + if (force) { + skip_rest_of_patch = true; + return (false); + } + if (noreverse) { + /* If -N is supplied, however, we bail out/ignore. */ + say("Ignoring previously applied (or reversed) patch.\n"); + skip_rest_of_patch = true; + return (false); + } + + /* Unreversed... suspicious if the file existed. */ + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + + reverse = !reverse; + + if (batch) { + if (verbose) + say("Patch creates file that already exists, %s %seversed", + reverse ? "Assuming" : "Ignoring", + reverse ? "R" : "Unr"); + } else { + ask("Patch creates file that already exists! %s -R? [y] ", + reverse ? "Assume" : "Ignore"); + + if (*buf == 'n') { + ask("Apply anyway? [n]"); + if (*buf != 'y') + /* Don't apply; error out. */ + skip_rest_of_patch = true; + else + /* Attempt to apply. */ + reverse_seen = true; + reverse = !reverse; + if (!pch_swap()) + fatal("lost hunk on alloc error!\n"); + } else { + /* + * They've opted to assume -R; effectively the + * same as the first branch in this function, + * but the decision is here rather than in a + * prior patch/hunk as in that branch. + */ + *remove = true; + } + } + } + + /* + * The return value indicates if we offered a chance to reverse but the + * user declined. This keeps the main patch processor in the loop since + * we've taken this out of the normal flow of hunk processing to + * simplify logic a little bit. + */ + return (reverse_seen); } Modified: stable/12/usr.bin/patch/pch.c ============================================================================== --- stable/12/usr.bin/patch/pch.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/pch.c Tue Dec 3 18:55:09 2019 (r355351) @@ -70,6 +70,8 @@ static LINENUM p_bfake = -1; /* beg of faked up lines static FILE *pfp = NULL; /* patch file pointer */ static char *bestguess = NULL; /* guess at correct filename */ +char *source_file; + static void grow_hunkmax(void); static int intuit_diff_type(void); static void next_intuit_at(off_t, LINENUM); @@ -218,7 +220,12 @@ there_is_another_patch(void) bestguess = xstrdup(buf); filearg[0] = fetchname(buf, &exists, 0); } - if (!exists) { + /* + * fetchname can now return buf = NULL, exists = true, to + * indicate to the caller that /dev/null was specified. Retain + * previous behavior for now until this can be better evaluted. + */ + if (filearg[0] == NULL || !exists) { int def_skip = *bestguess == '\0'; ask("No file found--skip this patch? [%c] ", def_skip ? 'y' : 'n'); @@ -402,6 +409,24 @@ scan_exit: struct file_name tmp = names[OLD_FILE]; names[OLD_FILE] = names[NEW_FILE]; names[NEW_FILE] = tmp; + } + + /* Invalidated */ + free(source_file); + source_file = NULL; + + if (retval != 0) { + /* + * If we've successfully determined a diff type, stored in + * retval, path == NULL means _PATH_DEVNULL if exists is set. + * Explicitly specify it here to make it easier to detect later + * on that we're actually creating a file and not that we've + * just goofed something up. + */ + if (names[OLD_FILE].path != NULL) + source_file = xstrdup(names[OLD_FILE].path); + else if (names[OLD_FILE].exists) + source_file = xstrdup(_PATH_DEVNULL); } if (filearg[0] == NULL) { if (posix) Modified: stable/12/usr.bin/patch/pch.h ============================================================================== --- stable/12/usr.bin/patch/pch.h Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/pch.h Tue Dec 3 18:55:09 2019 (r355351) @@ -37,6 +37,8 @@ struct file_name { bool exists; }; +extern char *source_file; + void re_patch(void); void open_patch_file(const char *); void set_hunkmax(void); Modified: stable/12/usr.bin/patch/tests/unified_patch_test.sh ============================================================================== --- head/usr.bin/patch/tests/unified_patch_test.sh Thu Sep 5 03:16:14 2019 (r351836) +++ stable/12/usr.bin/patch/tests/unified_patch_test.sh Tue Dec 3 18:55:09 2019 (r355351) @@ -102,32 +102,44 @@ file_creation_body() # commits. If a file is created by a diff, patch(1) will happily duplicate the # contents as many times as you apply the diff. It should instead detect that # a source of /dev/null creates the file, so it shouldn't exist. Furthermore, -# the reverse of creation is deletion -- hence the next test. +# the reverse of creation is deletion -- hence the next test, which ensures that +# the file is removed if it's empty once the patch is reversed. The size checks +# are scattered throughout to make sure that we didn't get some kind of false +# error, and the first size check is merely a sanity check that should be +# trivially true as this is executed in a sandbox. atf_test_case file_nodupe file_nodupe_body() { - # WIP - atf_expect_fail "patch(1) erroneously duplicates created files" echo "x" > foo diff -u /dev/null foo > foo.diff - atf_check -x "patch -s < foo.diff" - atf_check -s not-exit:0 -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -Ns < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo + atf_check -s not-exit:0 -o ignore -x "patch -fs < foo.diff" + atf_check -o inline:"2\n" stat -f "%z" foo } atf_test_case file_removal file_removal_body() { - # WIP - atf_expect_fail "patch(1) does not yet recognize /dev/null as creation" - echo "x" > foo diff -u /dev/null foo > foo.diff + # Check that the file is removed completely if it was sourced from + # /dev/null atf_check -x "patch -Rs < foo.diff" - atf_check -s not-exit:0 -o ignore stat foo + atf_check -s not-exit:0 -e ignore stat foo + + # But if it had been modified, we'll only remove the portion that the + # patch would have created. This makes us compatible with GNU patch's + # behavior, at least. Whether that is the sane action or not is a + # question for further study, and then this comment may be removed. + printf "x\ny\n" > foo + atf_check -x "patch -Rs < foo.diff" + atf_check -o inline:"y\n" cat foo } atf_init_test_cases() Modified: stable/12/usr.bin/patch/util.c ============================================================================== --- stable/12/usr.bin/patch/util.c Tue Dec 3 18:50:18 2019 (r355350) +++ stable/12/usr.bin/patch/util.c Tue Dec 3 18:55:09 2019 (r355351) @@ -366,8 +366,10 @@ fetchname(const char *at, bool *exists, int strip_lead say("fetchname %s %d\n", at, strip_leading); #endif /* So files can be created by diffing against /dev/null. */ - if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) + if (strnEQ(at, _PATH_DEVNULL, sizeof(_PATH_DEVNULL) - 1)) { + *exists = true; return NULL; + } name = fullname = t = savestr(at); tab = strchr(t, '\t') != NULL; From owner-svn-src-all@freebsd.org Tue Dec 3 18:57:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4F031B9AE9; Tue, 3 Dec 2019 18:57:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SB7K4MgFz3K34; Tue, 3 Dec 2019 18:57:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7498B1C1E3; Tue, 3 Dec 2019 18:57:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3IvXHP067666; Tue, 3 Dec 2019 18:57:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IvXLv067665; Tue, 3 Dec 2019 18:57:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031857.xB3IvXLv067665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:57: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: r355352 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 355352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:57:33 -0000 Author: kevans Date: Tue Dec 3 18:57:32 2019 New Revision: 355352 URL: https://svnweb.freebsd.org/changeset/base/355352 Log: MFC r354464: sys/conf/files.arm64: remove unnecessary soc_* dependencies These files already have 'device' lines that they require; adding a dependency on SOC_* options is an extra restriction that adds extra verbosity when future supported Broadcom-based SOC will also feature the same compatible device. Users wishing to not compile these devices in should remove the 'device' lines from their config. Modified: stable/12/sys/conf/files.arm64 Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files.arm64 ============================================================================== --- stable/12/sys/conf/files.arm64 Tue Dec 3 18:55:09 2019 (r355351) +++ stable/12/sys/conf/files.arm64 Tue Dec 3 18:57:32 2019 (r355352) @@ -82,18 +82,18 @@ arm/arm/pmu.c standard arm/arm/physmem.c standard arm/broadcom/bcm2835/bcm2835_audio.c optional sound vchiq fdt \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" -arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc fdt arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_ft5406.c optional evdev bcm2835_ft5406 fdt arm/broadcom/bcm2835/bcm2835_gpio.c optional gpio soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_intr.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_mbox.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_rng.c optional random soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_sdhci.c optional sdhci soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_sdhost.c optional sdhci soc_brcm_bcm2837 fdt -arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi soc_brcm_bcm2837 fdt +arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt arm/broadcom/bcm2835/bcm2835_vcio.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm_bcm2837 fdt arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt From owner-svn-src-all@freebsd.org Tue Dec 3 18:58:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A82A1B9BAB; Tue, 3 Dec 2019 18:58: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SB8k0q6Hz3KB7; Tue, 3 Dec 2019 18:58: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 F3CB91C1E8; Tue, 3 Dec 2019 18:58:45 +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 xB3IwjfM067772; Tue, 3 Dec 2019 18:58:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3IwjOn067771; Tue, 3 Dec 2019 18:58:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031858.xB3IwjOn067771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 18:58: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: r355353 - stable/12/lib/csu/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/csu/common X-SVN-Commit-Revision: 355353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 18:58:46 -0000 Author: kevans Date: Tue Dec 3 18:58:45 2019 New Revision: 355353 URL: https://svnweb.freebsd.org/changeset/base/355353 Log: MFC r354541: csu: Fix dynamiclib/init_test:jcr_test on !HAVE_CTORS archs .jcr still needs a 0-entry added in crtend, even on !HAVE_CTORS archs, as we're still getting .jcr sections added -- presumably due to the reference in crtbegin. Without this terminal, the .jcr section (without data) overlaps with the next section and register_classes in crtbegin will be examining the wrong item. PR: 241439 Modified: stable/12/lib/csu/common/crtend.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/csu/common/crtend.c ============================================================================== --- stable/12/lib/csu/common/crtend.c Tue Dec 3 18:57:32 2019 (r355352) +++ stable/12/lib/csu/common/crtend.c Tue Dec 3 18:58:45 2019 (r355353) @@ -26,9 +26,14 @@ __FBSDID("$FreeBSD$"); #include "crt.h" -#ifdef HAVE_CTORS typedef void (*crt_func)(void); +static crt_func __JCR_LIST__[] __section(".jcr") __used = { + (crt_func)0 +}; + +#ifdef HAVE_CTORS + /* * On some architectures and toolchains we may need to call the .ctors. * These are called in the reverse order they are in the ELF file. @@ -39,9 +44,6 @@ static crt_func __CTOR_END__[] __section(".ctors") __u (crt_func)0 }; static crt_func __DTOR_END__[] __section(".dtors") __used = { - (crt_func)0 -}; -static crt_func __JCR_LIST__[] __section(".jcr") __used = { (crt_func)0 }; From owner-svn-src-all@freebsd.org Tue Dec 3 19:00:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E242D1B9CBF; Tue, 3 Dec 2019 19:00:12 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SBBN5ZyXz3KLV; Tue, 3 Dec 2019 19:00:12 +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 A2F2F1C1F7; Tue, 3 Dec 2019 19:00:12 +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 xB3J0CFX067981; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3J0CIF067980; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031900.xB3J0CIF067980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:00:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355354 - in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Commit-Revision: 355354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:00:13 -0000 Author: kevans Date: Tue Dec 3 19:00:12 2019 New Revision: 355354 URL: https://svnweb.freebsd.org/changeset/base/355354 Log: MFC r354712: arm64: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes For any size that isn't page-aligned, we end up not pre-allocating enough for a single mapping because we truncate the size instead of rounding up to make sure the last bit is accounted for, leaving us one page shy of what we need to fulfill a request. Modified: stable/11/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- stable/11/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 18:58:45 2019 (r355353) +++ stable/11/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 19:00:12 2019 (r355354) @@ -214,7 +214,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(maxsize) - bz->total_bpages; + pages = atop(round_page(maxsize)) - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) From owner-svn-src-all@freebsd.org Tue Dec 3 19:00:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3722D1B9CD1; Tue, 3 Dec 2019 19:00:13 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SBBP0kgRz3KLW; Tue, 3 Dec 2019 19:00:13 +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 F150C1C1F8; Tue, 3 Dec 2019 19:00:12 +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 xB3J0CTW067987; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3J0CKG067986; Tue, 3 Dec 2019 19:00:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031900.xB3J0CKG067986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:00: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: r355354 - in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/arm64/arm64 12/sys/arm64/arm64 X-SVN-Commit-Revision: 355354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:00:13 -0000 Author: kevans Date: Tue Dec 3 19:00:12 2019 New Revision: 355354 URL: https://svnweb.freebsd.org/changeset/base/355354 Log: MFC r354712: arm64: fix BUS_DMA_ALLOCNOW for non-paged aligned sizes For any size that isn't page-aligned, we end up not pre-allocating enough for a single mapping because we truncate the size instead of rounding up to make sure the last bit is accounted for, leaving us one page shy of what we need to fulfill a request. Modified: stable/12/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/arm64/arm64/busdma_bounce.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/arm64/arm64/busdma_bounce.c ============================================================================== --- stable/12/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 18:58:45 2019 (r355353) +++ stable/12/sys/arm64/arm64/busdma_bounce.c Tue Dec 3 19:00:12 2019 (r355354) @@ -214,7 +214,7 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si if (ptoa(bz->total_bpages) < maxsize) { int pages; - pages = atop(maxsize) - bz->total_bpages; + pages = atop(round_page(maxsize)) - bz->total_bpages; /* Add pages to our bounce pool */ if (alloc_bounce_pages(newtag, pages) < pages) From owner-svn-src-all@freebsd.org Tue Dec 3 19:14:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0FF41BA2ED; Tue, 3 Dec 2019 19:14: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SBVL62qdz3LSS; Tue, 3 Dec 2019 19:14: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 B229F1C565; Tue, 3 Dec 2019 19:14: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 xB3JE2h7079215; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3JE2o8079214; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031914.xB3JE2o8079214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:14: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: r355355 - in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Commit-Revision: 355355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:14:03 -0000 Author: kevans Date: Tue Dec 3 19:14:02 2019 New Revision: 355355 URL: https://svnweb.freebsd.org/changeset/base/355355 Log: MFC r355205: snp: don't reference tp->t_mtx directly This is the only part of snp(4) that pokes around in struct tty directly; replace it with the tty_getlock accessor to avoid struct tty internals. Modified: stable/11/sys/dev/snp/snp.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/snp/snp.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/snp/snp.c ============================================================================== --- stable/11/sys/dev/snp/snp.c Tue Dec 3 19:00:12 2019 (r355354) +++ stable/11/sys/dev/snp/snp.c Tue Dec 3 19:14:02 2019 (r355355) @@ -174,7 +174,7 @@ snp_read(struct cdev *dev, struct uio *uio, int flag) error = EWOULDBLOCK; break; } - error = cv_wait_sig(&ss->snp_outwait, tp->t_mtx); + error = cv_wait_sig(&ss->snp_outwait, tty_getlock(tp)); if (error != 0) break; if (tty_gone(tp)) { From owner-svn-src-all@freebsd.org Tue Dec 3 19:14:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C0C51BA2F2; Tue, 3 Dec 2019 19:14:03 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SBVM1P8pz3LST; Tue, 3 Dec 2019 19:14:03 +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 133AF1C566; Tue, 3 Dec 2019 19:14:03 +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 xB3JE2F1079221; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3JE2IS079220; Tue, 3 Dec 2019 19:14:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912031914.xB3JE2IS079220@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 3 Dec 2019 19:14:02 +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: r355355 - in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/dev/snp 12/sys/dev/snp X-SVN-Commit-Revision: 355355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:14:03 -0000 Author: kevans Date: Tue Dec 3 19:14:02 2019 New Revision: 355355 URL: https://svnweb.freebsd.org/changeset/base/355355 Log: MFC r355205: snp: don't reference tp->t_mtx directly This is the only part of snp(4) that pokes around in struct tty directly; replace it with the tty_getlock accessor to avoid struct tty internals. Modified: stable/12/sys/dev/snp/snp.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/snp/snp.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/snp/snp.c ============================================================================== --- stable/12/sys/dev/snp/snp.c Tue Dec 3 19:00:12 2019 (r355354) +++ stable/12/sys/dev/snp/snp.c Tue Dec 3 19:14:02 2019 (r355355) @@ -178,7 +178,7 @@ snp_read(struct cdev *dev, struct uio *uio, int flag) error = EWOULDBLOCK; break; } - error = cv_wait_sig(&ss->snp_outwait, tp->t_mtx); + error = cv_wait_sig(&ss->snp_outwait, tty_getlock(tp)); if (error != 0) break; if (tty_gone(tp)) { From owner-svn-src-all@freebsd.org Tue Dec 3 19:18:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 167391BA45B; Tue, 3 Dec 2019 19:18:34 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SBbY6rPLz3LkL; Tue, 3 Dec 2019 19:18:33 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8ECD1C567; Tue, 3 Dec 2019 19:18:33 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3JIXiX079462; Tue, 3 Dec 2019 19:18:33 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3JIXcJ079459; Tue, 3 Dec 2019 19:18:33 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912031918.xB3JIXcJ079459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 19:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355356 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 355356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 19:18:34 -0000 Author: manu Date: Tue Dec 3 19:18:32 2019 New Revision: 355356 URL: https://svnweb.freebsd.org/changeset/base/355356 Log: arm64: rockchip: rl3399: Remove the ability to put the PLL in normal mode at boot RK3399 PLLs have three modes : - Normal, where they behave normally and their freq is calculated based on the registers values. - Slow, where the PLL freq is 24Mhz (well, the external oscillator). - Deep Slow, used for suspend where the freq is 32Khz. We used to put every CPU related PLL in normal mode but it can cause problem if the firmware didn't setup the clocks register correctly. And even if it did but left the pll in slow or deep slow mode that might be because the PMIC suppling voltage for the CPU haven't been configured yet and we cannot do that at this point. So remove the ability to set PLLs to normal mode at boot to avoid any problems. Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c head/sys/arm64/rockchip/clk/rk_clk_pll.c head/sys/arm64/rockchip/clk/rk_clk_pll.h Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk3399_cru.c Tue Dec 3 19:14:02 2019 (r355355) +++ head/sys/arm64/rockchip/clk/rk3399_cru.c Tue Dec 3 19:18:32 2019 (r355356) @@ -692,7 +692,7 @@ static struct rk_clk_armclk_rates rk3399_cpu_b_rates[] /* Standard PLL. */ -#define PLL(_id, _name, _base, _nm) \ +#define PLL(_id, _name, _base) \ { \ .type = RK3399_CLK_PLL, \ .clk.pll = &(struct rk_clk_pll_def) { \ @@ -703,7 +703,6 @@ static struct rk_clk_armclk_rates rk3399_cpu_b_rates[] .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ .base_offset = _base, \ .rates = rk3399_pll_rates, \ - .normal_mode = _nm \ }, \ } @@ -796,13 +795,13 @@ static struct rk_clk rk3399_clks[] = { FFACT(0, "clk_ddrc_div2", "clk_ddrc", 1, 2), /* PLLs */ - PLL(PLL_APLLL, "lpll", 0x00, false), - PLL(PLL_APLLB, "bpll", 0x20, true), - PLL(PLL_DPLL, "dpll", 0x40, false), - PLL(PLL_CPLL, "cpll", 0x60, false), - PLL(PLL_GPLL, "gpll", 0x80, false), - PLL(PLL_NPLL, "npll", 0xA0, false), - PLL(PLL_VPLL, "vpll", 0xC0, false), + PLL(PLL_APLLL, "lpll", 0x00), + PLL(PLL_APLLB, "bpll", 0x20), + PLL(PLL_DPLL, "dpll", 0x40), + PLL(PLL_CPLL, "cpll", 0x60), + PLL(PLL_GPLL, "gpll", 0x80), + PLL(PLL_NPLL, "npll", 0xA0), + PLL(PLL_VPLL, "vpll", 0xC0), /* CRU_CLKSEL_CON0 */ CDIV(0, "aclkm_core_l_c", "armclkl", 0, Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_pll.c Tue Dec 3 19:14:02 2019 (r355355) +++ head/sys/arm64/rockchip/clk/rk_clk_pll.c Tue Dec 3 19:18:32 2019 (r355356) @@ -54,8 +54,6 @@ struct rk_clk_pll_sc { struct rk_clk_pll_rate *rates; struct rk_clk_pll_rate *frac_rates; - - bool normal_mode; }; #define WRITE4(_clk, off, val) \ @@ -346,18 +344,8 @@ static int rk3399_clk_pll_init(struct clknode *clk, device_t dev) { struct rk_clk_pll_sc *sc; - uint32_t reg; sc = clknode_get_softc(clk); - - if (sc->normal_mode) { - /* Setting to normal mode */ - reg = RK3399_CLK_PLL_MODE_NORMAL << RK3399_CLK_PLL_MODE_SHIFT; - reg |= RK3399_CLK_PLL_MODE_MASK << RK_CLK_PLL_MASK_SHIFT; - WRITE4(clk, sc->base_offset + RK3399_CLK_PLL_MODE_OFFSET, - reg | RK3399_CLK_PLL_WRITE_MASK); - } - clknode_init_parent_idx(clk, 0); return (0); @@ -549,7 +537,6 @@ rk3399_clk_pll_register(struct clkdom *clkdom, struct sc->flags = clkdef->flags; sc->rates = clkdef->rates; sc->frac_rates = clkdef->frac_rates; - sc->normal_mode = clkdef->normal_mode; clknode_register(clkdom, clk); Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_pll.h Tue Dec 3 19:14:02 2019 (r355355) +++ head/sys/arm64/rockchip/clk/rk_clk_pll.h Tue Dec 3 19:18:32 2019 (r355356) @@ -57,8 +57,6 @@ struct rk_clk_pll_def { struct rk_clk_pll_rate *rates; struct rk_clk_pll_rate *frac_rates; - - bool normal_mode; }; #define RK_CLK_PLL_HAVE_GATE 0x1 From owner-svn-src-all@freebsd.org Tue Dec 3 20:23:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A94741BC325; Tue, 3 Dec 2019 20:23:44 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SD2l47J8z3Q4X; Tue, 3 Dec 2019 20:23:43 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id xB3KNYKF025860 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 3 Dec 2019 12:23:34 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id xB3KNXBa025859; Tue, 3 Dec 2019 12:23:33 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 3 Dec 2019 12:23:33 -0800 From: Gleb Smirnoff To: Ryan Libby Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355102 - head/sys/netinet6 Message-ID: <20191203202333.GA2706@FreeBSD.org> References: <201911252225.xAPMPAKk077489@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911252225.xAPMPAKk077489@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47SD2l47J8z3Q4X X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.78 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.90)[-0.904,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; NEURAL_HAM_LONG(-0.87)[-0.871,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 20:23:44 -0000 Ryan, On Mon, Nov 25, 2019 at 10:25:10PM +0000, Ryan Libby wrote: R> Author: rlibby R> Date: Mon Nov 25 22:25:10 2019 R> New Revision: 355102 R> URL: https://svnweb.freebsd.org/changeset/base/355102 R> R> Log: R> in6_joingroup_locked: need if_addr_lock around in6m_disconnect_locked R> R> It looks like the call that requires the lock was introduced in r337866. R> R> Reviewed by: hselasky R> Sponsored by: Dell EMC Isilon R> Differential Revision: https://reviews.freebsd.org/D20739 R> R> Modified: R> head/sys/netinet6/in6_mcast.c R> R> Modified: head/sys/netinet6/in6_mcast.c R> ============================================================================== R> --- head/sys/netinet6/in6_mcast.c Mon Nov 25 21:21:37 2019 (r355101) R> +++ head/sys/netinet6/in6_mcast.c Mon Nov 25 22:25:10 2019 (r355102) R> @@ -1267,6 +1267,7 @@ out_in6m_release: R> struct epoch_tracker et; R> R> CTR2(KTR_MLD, "%s: dropping ref on %p", __func__, inm); R> + IF_ADDR_WLOCK(ifp); R> NET_EPOCH_ENTER(et); R> CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { R> if (ifma->ifma_protospec == inm) { R> @@ -1277,6 +1278,7 @@ out_in6m_release: R> in6m_disconnect_locked(&inmh, inm); R> in6m_rele_locked(&inmh, inm); R> NET_EPOCH_EXIT(et); R> + IF_ADDR_WUNLOCK(ifp); R> } else { R> *pinm = inm; R> } It looks like after this change the epoch entrance in this block is superfluous and can be removed. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Dec 3 20:43:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8480E1BCE04; Tue, 3 Dec 2019 20:43:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SDTH1t2lz3R50; Tue, 3 Dec 2019 20:43:14 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id xB3KhDF8025942 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 3 Dec 2019 12:43:13 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id xB3KhDq1025941; Tue, 3 Dec 2019 12:43:13 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 3 Dec 2019 12:43:13 -0800 From: Gleb Smirnoff To: Ryan Libby Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355137 - head/sys/vm Message-ID: <20191203204313.GB2706@FreeBSD.org> References: <201911271949.xARJnuFl084178@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201911271949.xARJnuFl084178@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47SDTH1t2lz3R50 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.78 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.90)[-0.904,0]; NEURAL_HAM_LONG(-0.87)[-0.871,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 20:43:15 -0000 Ryan, On Wed, Nov 27, 2019 at 07:49:56PM +0000, Ryan Libby wrote: R> Author: rlibby R> Date: Wed Nov 27 19:49:55 2019 R> New Revision: 355137 R> URL: https://svnweb.freebsd.org/changeset/base/355137 R> R> Log: R> uma: trash memory when ctor/dtor supplied too R> R> On INVARIANTS kernels, UMA has a use-after-free detection mechanism. R> This mechanism previously required that all of the ctor/dtor/uminit/fini R> arguments to uma_zcreate() be NULL in order to function. Now, it only R> requires that uminit and fini be NULL; now, the trash ctor and dtor will R> be called in addition to any supplied ctor or dtor. R> R> Also do a little refactoring for readability of the resulting logic. R> R> This enables use-after-free detection for more zones, and will allow for R> simplification of some callers that worked around the previous R> restriction (see kern_mbuf.c). R> R> Reviewed by: jeff, markj R> Sponsored by: Dell EMC Isilon R> Differential Revision: https://reviews.freebsd.org/D20722 If I understand the change correct, now items from UMA_ZONE_NOFREE zones will be trashed, too. That would undermine purpose of UMA_ZONE_NOFREE. Of course the flag is a hack, but some systems rely on it working. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Dec 3 20:59:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2AC31BD533; Tue, 3 Dec 2019 20:59:32 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47SDr43s2xz3wxf; Tue, 3 Dec 2019 20:59:32 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qk1-f178.google.com with SMTP id a137so4932633qkc.7; Tue, 03 Dec 2019 12:59:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HmHl32LjxnIt+q+UMBbE8v6NFKyjQ9Fg57csHXTHXko=; b=ZGnMEE9Sb+K2S8FW2Q5yFyr7VABZ/Y418B+XHCYJ2G7ys/rMzJpM2owfKjObPbnCNN qAjiLvARaMWqOGRyPwsOOsNnJBlSreH7EC6S9Ob86aip8UEWVaQ9Tf5xAsoJlj7icw7i JlNkFrjt4Zen0TwotWehRFjuz9ip7m5G005pXxrSdnFU7lUM02CMVvG0vfJytcTD4sD8 r3Ovtw1F8bEWjhqbMBgaz3IQjX5iKEiBwZ5BXPqgM4p9gJyzSsCmluvkaB0VRZXEHjsB Zw79HummsDBlz4Uj67q2KAbIInV9b7IeVtiSwd2si6EOGJwtsnFDV2RhnZyWXF+AA+88 cGtg== X-Gm-Message-State: APjAAAX0xybsqQ0C8QWo7DSpe3NP4OlD9D8eSptyuBNhKnkueXSh6/n9 nteVHVjRgPUSI3uH1nX3eQKGxkimIDQ= X-Google-Smtp-Source: APXvYqwx61+C+7Eukn07MpTzIAU/IAY25c23Tk6wVy6rNJLVpcKyrb/bBJ+9wFm4uF1YV5bLQ/B+5Q== X-Received: by 2002:a37:4288:: with SMTP id p130mr7194191qka.116.1575406770298; Tue, 03 Dec 2019 12:59:30 -0800 (PST) Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com. [209.85.219.54]) by smtp.gmail.com with ESMTPSA id i41sm2559627qti.42.2019.12.03.12.59.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 12:59:30 -0800 (PST) Received: by mail-qv1-f54.google.com with SMTP id n8so2146704qvg.11; Tue, 03 Dec 2019 12:59:29 -0800 (PST) X-Received: by 2002:a05:6214:3f3:: with SMTP id cf19mr7302450qvb.241.1575406769669; Tue, 03 Dec 2019 12:59:29 -0800 (PST) MIME-Version: 1.0 References: <201911271949.xARJnuFl084178@repo.freebsd.org> <20191203204313.GB2706@FreeBSD.org> In-Reply-To: <20191203204313.GB2706@FreeBSD.org> From: Ryan Libby Date: Tue, 3 Dec 2019 12:59:18 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355137 - head/sys/vm To: Gleb Smirnoff Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47SDr43s2xz3wxf X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 20:59:32 -0000 On Tue, Dec 3, 2019 at 12:43 PM Gleb Smirnoff wrote: > > Ryan, > > On Wed, Nov 27, 2019 at 07:49:56PM +0000, Ryan Libby wrote: > R> Author: rlibby > R> Date: Wed Nov 27 19:49:55 2019 > R> New Revision: 355137 > R> URL: https://svnweb.freebsd.org/changeset/base/355137 > R> > R> Log: > R> uma: trash memory when ctor/dtor supplied too > R> > R> On INVARIANTS kernels, UMA has a use-after-free detection mechanism. > R> This mechanism previously required that all of the ctor/dtor/uminit/fini > R> arguments to uma_zcreate() be NULL in order to function. Now, it only > R> requires that uminit and fini be NULL; now, the trash ctor and dtor will > R> be called in addition to any supplied ctor or dtor. > R> > R> Also do a little refactoring for readability of the resulting logic. > R> > R> This enables use-after-free detection for more zones, and will allow for > R> simplification of some callers that worked around the previous > R> restriction (see kern_mbuf.c). > R> > R> Reviewed by: jeff, markj > R> Sponsored by: Dell EMC Isilon > R> Differential Revision: https://reviews.freebsd.org/D20722 > > If I understand the change correct, now items from UMA_ZONE_NOFREE zones > will be trashed, too. That would undermine purpose of UMA_ZONE_NOFREE. > Of course the flag is a hack, but some systems rely on it working. > > -- > Gleb Smirnoff The intent is not to change anything for NOFREE zones (i.e. still don't trash them). I didn't put all the detail in the commit log, but I did reword the block comment in uma_zcreate: > @@ -2302,14 +2307,17 @@ uma_zcreate(const char *name, size_t size, uma_ctor ct > args.fini = fini; > #ifdef INVARIANTS > /* > - * If a zone is being created with an empty constructor and > - * destructor, pass UMA constructor/destructor which checks for > - * memory use after free. > + * Inject procedures which check for memory use after free if we are > + * allowed to scramble the memory while it is not allocated. This > + * requires that: UMA is actually able to access the memory, no init > + * or fini procedures, no dependency on the initial value of the > + * memory, and no (legitimate) use of the memory after free. Note, > + * the ctor and dtor do not need to be empty. > + * > + * XXX UMA_ZONE_OFFPAGE. > */ > if ((!(flags & (UMA_ZONE_ZINIT | UMA_ZONE_NOFREE))) && > - ctor == NULL && dtor == NULL && uminit == NULL && fini == NULL) { > - args.ctor = trash_ctor; > - args.dtor = trash_dtor; > + uminit == NULL && fini == NULL) { > args.uminit = trash_init; > args.fini = trash_fini; > } Ryan From owner-svn-src-all@freebsd.org Tue Dec 3 21:00:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B8371BD64A; Tue, 3 Dec 2019 21:00:58 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SDsk0bJCz3xDw; Tue, 3 Dec 2019 21:00:58 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC12D1D7B2; Tue, 3 Dec 2019 21:00:57 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3L0vp6042000; Tue, 3 Dec 2019 21:00:57 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3L0je1041117; Tue, 3 Dec 2019 21:00:45 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912032100.xB3L0je1041117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 21:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355357 - in head: share/man/man4/man4.aarch64 share/man/man4/man4.arm sys/arm/allwinner sys/arm/allwinner/a10 sys/arm/allwinner/a13 sys/arm/allwinner/a20 sys/arm/allwinner/a31 sys/arm/... X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head: share/man/man4/man4.aarch64 share/man/man4/man4.arm sys/arm/allwinner sys/arm/allwinner/a10 sys/arm/allwinner/a13 sys/arm/allwinner/a20 sys/arm/allwinner/a31 sys/arm/allwinner/a33 sys/arm/all... X-SVN-Commit-Revision: 355357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 21:00:58 -0000 Author: manu Date: Tue Dec 3 21:00:45 2019 New Revision: 355357 URL: https://svnweb.freebsd.org/changeset/base/355357 Log: Remove "all rights reserved" from copyright for the file I own. Some of the files have both me and Jared McNeill and he gave me permission to remove it from his files too. Modified: head/share/man/man4/man4.aarch64/rk_gpio.4 head/share/man/man4/man4.aarch64/rk_grf.4 head/share/man/man4/man4.aarch64/rk_pinctrl.4 head/share/man/man4/man4.arm/aw_gpio.4 head/share/man/man4/man4.arm/aw_mmc.4 head/share/man/man4/man4.arm/aw_rtc.4 head/share/man/man4/man4.arm/aw_spi.4 head/sys/arm/allwinner/a10/a10_padconf.c head/sys/arm/allwinner/a13/a13_padconf.c head/sys/arm/allwinner/a20/a20_padconf.c head/sys/arm/allwinner/a31/a31_padconf.c head/sys/arm/allwinner/a31/a31_r_padconf.c head/sys/arm/allwinner/a31/a31s_padconf.c head/sys/arm/allwinner/a33/a33_padconf.c head/sys/arm/allwinner/allwinner_pinctrl.h head/sys/arm/allwinner/aw_machdep.h head/sys/arm/allwinner/aw_mp.h head/sys/arm/allwinner/aw_nmi.c head/sys/arm/allwinner/aw_ts.c head/sys/arm/allwinner/axp209.c head/sys/arm/allwinner/axp209reg.h head/sys/arm/allwinner/axp81x.c head/sys/arm/allwinner/clkng/aw_clk.h head/sys/arm/allwinner/clkng/aw_clk_nkmp.c head/sys/arm/allwinner/clkng/aw_clk_nm.c head/sys/arm/allwinner/clkng/aw_clk_nm.h head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.h head/sys/arm/allwinner/h3/h3_padconf.c head/sys/arm/allwinner/h3/h3_r_padconf.c head/sys/arm/broadcom/bcm2835/bcm2836_mp.h head/sys/arm64/rockchip/clk/rk3328_cru.c head/sys/arm64/rockchip/clk/rk_clk_armclk.c head/sys/arm64/rockchip/clk/rk_clk_armclk.h head/sys/arm64/rockchip/clk/rk_clk_composite.c head/sys/arm64/rockchip/clk/rk_clk_composite.h head/sys/arm64/rockchip/clk/rk_clk_gate.h head/sys/arm64/rockchip/clk/rk_clk_pll.c head/sys/arm64/rockchip/clk/rk_clk_pll.h head/sys/arm64/rockchip/clk/rk_cru.c head/sys/arm64/rockchip/clk/rk_cru.h head/sys/arm64/rockchip/if_dwc_rk.c head/sys/arm64/rockchip/rk805.c head/sys/arm64/rockchip/rk805reg.h head/sys/arm64/rockchip/rk_gpio.c head/sys/arm64/rockchip/rk_grf.c head/sys/arm64/rockchip/rk_pinctrl.c head/sys/dev/cpufreq/cpufreq_dt.c head/sys/dev/mmc/host/dwmmc_altera.c head/sys/dev/mmc/host/dwmmc_rockchip.c head/sys/dev/mmc/host/dwmmc_samsung.c head/sys/dev/pwm/ofw_pwm.c head/sys/dev/pwm/ofw_pwm.h head/sys/dev/pwm/pwmbus.c head/sys/dev/pwm/pwmc.c head/sys/dev/pwm/pwmc.h head/sys/dev/usb/controller/generic_usb_if.m head/usr.sbin/pwm/pwm.c Modified: head/share/man/man4/man4.aarch64/rk_gpio.4 ============================================================================== --- head/share/man/man4/man4.aarch64/rk_gpio.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.aarch64/rk_gpio.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2018 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/man4.aarch64/rk_grf.4 ============================================================================== --- head/share/man/man4/man4.aarch64/rk_grf.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.aarch64/rk_grf.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2018 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/man4.aarch64/rk_pinctrl.4 ============================================================================== --- head/share/man/man4/man4.aarch64/rk_pinctrl.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.aarch64/rk_pinctrl.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2018 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/man4.arm/aw_gpio.4 ============================================================================== --- head/share/man/man4/man4.arm/aw_gpio.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.arm/aw_gpio.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2017 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/man4.arm/aw_mmc.4 ============================================================================== --- head/share/man/man4/man4.arm/aw_mmc.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.arm/aw_mmc.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2017 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/man4.arm/aw_rtc.4 ============================================================================== --- head/share/man/man4/man4.arm/aw_rtc.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.arm/aw_rtc.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2017 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/man4.arm/aw_spi.4 ============================================================================== --- head/share/man/man4/man4.arm/aw_spi.4 Tue Dec 3 19:18:32 2019 (r355356) +++ head/share/man/man4/man4.arm/aw_spi.4 Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ .\"- .\" Copyright (c) 2018 Emmanuel Vadot -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a10/a10_padconf.c ============================================================================== --- head/sys/arm/allwinner/a10/a10_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a10/a10_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a13/a13_padconf.c ============================================================================== --- head/sys/arm/allwinner/a13/a13_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a13/a13_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a20/a20_padconf.c ============================================================================== --- head/sys/arm/allwinner/a20/a20_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a20/a20_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a31/a31_padconf.c ============================================================================== --- head/sys/arm/allwinner/a31/a31_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a31/a31_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a31/a31_r_padconf.c ============================================================================== --- head/sys/arm/allwinner/a31/a31_r_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a31/a31_r_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a31/a31s_padconf.c ============================================================================== --- head/sys/arm/allwinner/a31/a31s_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a31/a31s_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a33/a33_padconf.c ============================================================================== --- head/sys/arm/allwinner/a33/a33_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/a33/a33_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/allwinner_pinctrl.h ============================================================================== --- head/sys/arm/allwinner/allwinner_pinctrl.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/allwinner_pinctrl.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_machdep.h ============================================================================== --- head/sys/arm/allwinner/aw_machdep.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/aw_machdep.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2015 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_mp.h ============================================================================== --- head/sys/arm/allwinner/aw_mp.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/aw_mp.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_nmi.c ============================================================================== --- head/sys/arm/allwinner/aw_nmi.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/aw_nmi.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_ts.c ============================================================================== --- head/sys/arm/allwinner/aw_ts.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/aw_ts.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/axp209.c ============================================================================== --- head/sys/arm/allwinner/axp209.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/axp209.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,7 +1,6 @@ /*- * Copyright (c) 2015-2016 Emmanuel Vadot * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/axp209reg.h ============================================================================== --- head/sys/arm/allwinner/axp209reg.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/axp209reg.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/axp81x.c ============================================================================== --- head/sys/arm/allwinner/axp81x.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/axp81x.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,7 +1,6 @@ /*- * Copyright (c) 2018 Emmanuel Vadot * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/clkng/aw_clk.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/clkng/aw_clk.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/clkng/aw_clk_nkmp.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_nkmp.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/clkng/aw_clk_nkmp.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_nm.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/clkng/aw_clk_nm.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_nm.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/clkng/aw_clk_nm.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.h ============================================================================== --- head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/h3/h3_padconf.c ============================================================================== --- head/sys/arm/allwinner/h3/h3_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/h3/h3_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016-2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/h3/h3_r_padconf.c ============================================================================== --- head/sys/arm/allwinner/h3/h3_r_padconf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/allwinner/h3/h3_r_padconf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016-2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/broadcom/bcm2835/bcm2836_mp.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836_mp.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm/broadcom/bcm2835/bcm2836_mp.h Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /*- * Copyright (C) 2016 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk3328_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk3328_cru.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk3328_cru.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_armclk.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_armclk.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_armclk.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_armclk.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_armclk.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_armclk.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_composite.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_composite.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_composite.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_composite.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_composite.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_gate.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_gate.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_gate.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_pll.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_pll.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_clk_pll.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_clk_pll.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk_cru.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_cru.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/clk/rk_cru.h ============================================================================== --- head/sys/arm64/rockchip/clk/rk_cru.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/clk/rk_cru.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/if_dwc_rk.c ============================================================================== --- head/sys/arm64/rockchip/if_dwc_rk.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/if_dwc_rk.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/rk805.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/rk805reg.h ============================================================================== --- head/sys/arm64/rockchip/rk805reg.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/rk805reg.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/rk_gpio.c ============================================================================== --- head/sys/arm64/rockchip/rk_gpio.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/rk_gpio.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/rk_grf.c ============================================================================== --- head/sys/arm64/rockchip/rk_grf.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/rk_grf.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/rockchip/rk_pinctrl.c ============================================================================== --- head/sys/arm64/rockchip/rk_pinctrl.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/arm64/rockchip/rk_pinctrl.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- head/sys/dev/cpufreq/cpufreq_dt.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/cpufreq/cpufreq_dt.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,7 +1,6 @@ /*- * Copyright (c) 2018 Emmanuel Vadot * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/host/dwmmc_altera.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_altera.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/mmc/host/dwmmc_altera.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /* * Copyright 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Modified: head/sys/dev/mmc/host/dwmmc_rockchip.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_rockchip.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/mmc/host/dwmmc_rockchip.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /* * Copyright 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Modified: head/sys/dev/mmc/host/dwmmc_samsung.c ============================================================================== --- head/sys/dev/mmc/host/dwmmc_samsung.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/mmc/host/dwmmc_samsung.c Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ /* * Copyright 2017 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are Modified: head/sys/dev/pwm/ofw_pwm.c ============================================================================== --- head/sys/dev/pwm/ofw_pwm.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/pwm/ofw_pwm.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pwm/ofw_pwm.h ============================================================================== --- head/sys/dev/pwm/ofw_pwm.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/pwm/ofw_pwm.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pwm/pwmbus.c ============================================================================== --- head/sys/dev/pwm/pwmbus.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/pwm/pwmbus.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pwm/pwmc.c ============================================================================== --- head/sys/dev/pwm/pwmc.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/pwm/pwmc.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pwm/pwmc.h ============================================================================== --- head/sys/dev/pwm/pwmc.h Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/pwm/pwmc.h Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/usb/controller/generic_usb_if.m ============================================================================== --- head/sys/dev/usb/controller/generic_usb_if.m Tue Dec 3 19:18:32 2019 (r355356) +++ head/sys/dev/usb/controller/generic_usb_if.m Tue Dec 3 21:00:45 2019 (r355357) @@ -1,6 +1,5 @@ #- # Copyright (c) 2016 Emmanuel Vadot -# All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/usr.sbin/pwm/pwm.c ============================================================================== --- head/usr.sbin/pwm/pwm.c Tue Dec 3 19:18:32 2019 (r355356) +++ head/usr.sbin/pwm/pwm.c Tue Dec 3 21:00:45 2019 (r355357) @@ -2,7 +2,6 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2018 Emmanuel Vadot - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Tue Dec 3 21:05:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BB361BD910; Tue, 3 Dec 2019 21:05:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SDz716Wzz3xW3; Tue, 3 Dec 2019 21:05:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 092671D956; Tue, 3 Dec 2019 21:05:39 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3L5cUO045406; Tue, 3 Dec 2019 21:05:38 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3L5XSY045378; Tue, 3 Dec 2019 21:05:33 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912032105.xB3L5XSY045378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 21:05:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355358 - in head/sys: arm/allwinner arm/allwinner/a64 arm/allwinner/a83t dev/gpio dev/hdmi dev/iicbus dev/uart mips/ingenic X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm/allwinner arm/allwinner/a64 arm/allwinner/a83t dev/gpio dev/hdmi dev/iicbus dev/uart mips/ingenic X-SVN-Commit-Revision: 355358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 21:05:39 -0000 Author: manu Date: Tue Dec 3 21:05:33 2019 New Revision: 355358 URL: https://svnweb.freebsd.org/changeset/base/355358 Log: Remove "all rights reserved" from copyright for the file that Jared McNeill own. He gave me permission to do this. Modified: head/sys/arm/allwinner/a10_fb.c head/sys/arm/allwinner/a10_hdmi.c head/sys/arm/allwinner/a10_hdmiaudio.c head/sys/arm/allwinner/a64/a64_padconf.c head/sys/arm/allwinner/a64/a64_r_padconf.c head/sys/arm/allwinner/a83t/a83t_padconf.c head/sys/arm/allwinner/a83t/a83t_r_padconf.c head/sys/arm/allwinner/aw_ccu.c head/sys/arm/allwinner/aw_gmacclk.c head/sys/arm/allwinner/aw_reset.c head/sys/arm/allwinner/aw_rsb.c head/sys/arm/allwinner/aw_sid.c head/sys/arm/allwinner/aw_sid.h head/sys/arm/allwinner/aw_thermal.c head/sys/arm/allwinner/aw_usbphy.c head/sys/arm/allwinner/if_awg.c head/sys/arm/allwinner/if_awgreg.h head/sys/dev/gpio/gpioregulator.c head/sys/dev/hdmi/dwc_hdmi.h head/sys/dev/iicbus/sy8106a.c head/sys/dev/uart/uart_dev_snps.c head/sys/mips/ingenic/jz4780_lcd.c head/sys/mips/ingenic/jz4780_lcd.h head/sys/mips/ingenic/jz4780_smb.c head/sys/mips/ingenic/jz4780_smb.h Modified: head/sys/arm/allwinner/a10_fb.c ============================================================================== --- head/sys/arm/allwinner/a10_fb.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a10_fb.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a10_hdmi.c ============================================================================== --- head/sys/arm/allwinner/a10_hdmi.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a10_hdmi.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a10_hdmiaudio.c ============================================================================== --- head/sys/arm/allwinner/a10_hdmiaudio.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a10_hdmiaudio.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a64/a64_padconf.c ============================================================================== --- head/sys/arm/allwinner/a64/a64_padconf.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a64/a64_padconf.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a64/a64_r_padconf.c ============================================================================== --- head/sys/arm/allwinner/a64/a64_r_padconf.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a64/a64_r_padconf.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a83t/a83t_padconf.c ============================================================================== --- head/sys/arm/allwinner/a83t/a83t_padconf.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a83t/a83t_padconf.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a83t/a83t_r_padconf.c ============================================================================== --- head/sys/arm/allwinner/a83t/a83t_r_padconf.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/a83t/a83t_r_padconf.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_ccu.c ============================================================================== --- head/sys/arm/allwinner/aw_ccu.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_ccu.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_gmacclk.c ============================================================================== --- head/sys/arm/allwinner/aw_gmacclk.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_gmacclk.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_reset.c ============================================================================== --- head/sys/arm/allwinner/aw_reset.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_reset.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_rsb.c ============================================================================== --- head/sys/arm/allwinner/aw_rsb.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_rsb.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_sid.c ============================================================================== --- head/sys/arm/allwinner/aw_sid.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_sid.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_sid.h ============================================================================== --- head/sys/arm/allwinner/aw_sid.h Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_sid.h Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_thermal.c ============================================================================== --- head/sys/arm/allwinner/aw_thermal.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_thermal.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/aw_usbphy.c ============================================================================== --- head/sys/arm/allwinner/aw_usbphy.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/aw_usbphy.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/if_awg.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/if_awgreg.h ============================================================================== --- head/sys/arm/allwinner/if_awgreg.h Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/arm/allwinner/if_awgreg.h Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/gpio/gpioregulator.c ============================================================================== --- head/sys/dev/gpio/gpioregulator.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/dev/gpio/gpioregulator.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/hdmi/dwc_hdmi.h ============================================================================== --- head/sys/dev/hdmi/dwc_hdmi.h Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/dev/hdmi/dwc_hdmi.h Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/iicbus/sy8106a.c ============================================================================== --- head/sys/dev/iicbus/sy8106a.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/dev/iicbus/sy8106a.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/uart/uart_dev_snps.c ============================================================================== --- head/sys/dev/uart/uart_dev_snps.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/dev/uart/uart_dev_snps.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/mips/ingenic/jz4780_lcd.c ============================================================================== --- head/sys/mips/ingenic/jz4780_lcd.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/mips/ingenic/jz4780_lcd.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/mips/ingenic/jz4780_lcd.h ============================================================================== --- head/sys/mips/ingenic/jz4780_lcd.h Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/mips/ingenic/jz4780_lcd.h Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/mips/ingenic/jz4780_smb.c ============================================================================== --- head/sys/mips/ingenic/jz4780_smb.c Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/mips/ingenic/jz4780_smb.c Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/mips/ingenic/jz4780_smb.h ============================================================================== --- head/sys/mips/ingenic/jz4780_smb.h Tue Dec 3 21:00:45 2019 (r355357) +++ head/sys/mips/ingenic/jz4780_smb.h Tue Dec 3 21:05:33 2019 (r355358) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2016 Jared McNeill - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Tue Dec 3 21:12:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C9B61BDBE8 for ; Tue, 3 Dec 2019 21:12:23 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47SF6v13q1z3xsk for ; Tue, 3 Dec 2019 21:12:22 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575407542; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=YbCpcVi/LsiCKXc6oiJk0DmRThnKlEmO8XcYNB6KGwTPSAivek1KCD9y66uUfMLBw55w056V0Iy66 i99Pgiou9CKVsC5Icl4hmdYzEVyZbJtSrh9gttG/TEiP/eqbGyVlr18FvquBM84ERM+4BZJtfwMVEg FoRomYiExIwNj9kCfE0W3kvC9hmsmKQlr2fNFYabkH65WMVFQ0TT0joYPw0BwrkT9CxIraetUUIIE3 b7pAF9MpzlizaFeam1LG8WvSDrR89K6XV94LffWu6doeVD48UmpCSOOPBbH9Ynhe4g/7Iuef+pi84X +l6G0dBsCHXuQlPs2d6aK+LunTl0rRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=C46ifX+KeabPdkLyODqhMlrlpFI8mRcLhe3zDdx4Yd0=; b=pz5q25zyatWllYxFAWZeJFlgU+Gtd14pEX6Kfo0y9kmSFnWnEurMOMCJyPaJ1LkRvrOJYROUYF693 MR+ZpP08RCJr9VoDgQn6COHOyCndaWSXnavVkSB68sgcobBhTroCKnnI4CTUT3iik0R09SWDRNIf+p gCNQDH+5fetcKKZiq91EIjyCHP8k3LlxSr6+X0+3ecM45HYxhHVMpiOYls/MeB9DGZG9g9wm3+LLww nS1CyUKHIqtsYffDWqa62ZKr9WmvtVnntuNeHdFyOcXit3eI1p4PIgxc7UyQQCnJU6KmQdWvx3w9Rk fgBU5XXvu7Od1i5eBWifq3xih8fBO4w== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=C46ifX+KeabPdkLyODqhMlrlpFI8mRcLhe3zDdx4Yd0=; b=kH2jwGsPrK5vK2vSuEXujhT30sCmm01QuE+xFltdMvSlTiLHibVvZJINR+81B7wErR4QtQxgknLfS sXCCFVErr9czTxJSWUEekGBmg85N7rHVXbBHYYjWxZnoxDCWAFCIgVbx0ZynQykjZXspGKcV7yzN3Q 3LuLht6X/Mnzej1t63yJ7RQG8uLXmOYBf8DMU5q7XUzC0i0uPx8Mbr3/ek5b+9YvAG2Nx3m8SgR+oq qE/qO0yC0/BQluFpycInA3iYl1gj6Ze9PH1KwtgNIz6ZYeYyXLV4XgO1px3fymEyjb9WP/w5z+v1dK QPZMj9nslM7m5yrhxu1iKpB+Dv8DiYg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 971b7fe9-1611-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 971b7fe9-1611-11ea-b80c-052b4a66b6b2; Tue, 03 Dec 2019 21:12:20 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB3LCJXQ000929; Tue, 3 Dec 2019 14:12:19 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r355137 - head/sys/vm From: Ian Lepore To: Ryan Libby , Gleb Smirnoff Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Tue, 03 Dec 2019 14:12:19 -0700 In-Reply-To: References: <201911271949.xARJnuFl084178@repo.freebsd.org> <20191203204313.GB2706@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47SF6v13q1z3xsk X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.91 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.97)[-0.968,0]; NEURAL_HAM_LONG(-0.94)[-0.943,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 21:12:23 -0000 On Tue, 2019-12-03 at 12:59 -0800, Ryan Libby wrote: > > + * XXX UMA_ZONE_OFFPAGE. All over freebsd we have cryptic XXX comments that have no meaning to anyone except whoever wrote them (and, I suspect, no meaning to those people either after a couple months have elapsed). To the degree that XXX represents "possible trouble here" and/or "more work to do here", I would argue that any placement of a new XXX requires at least a sentence (and probably more like a paragraph) to describe why it's there. -- Ian From owner-svn-src-all@freebsd.org Tue Dec 3 21:13:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BBFD1BDCA0; Tue, 3 Dec 2019 21:13:41 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SF8P0tRtz3y25; Tue, 3 Dec 2019 21:13:41 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id E81071283; Tue, 3 Dec 2019 21:13:40 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-qt1-f178.google.com with SMTP id d5so5387004qto.0; Tue, 03 Dec 2019 13:13:40 -0800 (PST) X-Gm-Message-State: APjAAAXVvgo6zFBXmE2a1J7ne2Rn1Oxmq2aMh6xEWgjTj5z5oHjXsOsQ RCpxrLpytUpTCRF9xL2+naJHKE0ng7kQO5QoEfI= X-Google-Smtp-Source: APXvYqwGFOMJafc6Qm7Kj1F3WELMEwkdzfs/iNUfjwyIo6YurX+gpSdnmM+L/XWhkrvD6X2HgQQjX8VCMlxweDuXANQ= X-Received: by 2002:ac8:2cda:: with SMTP id 26mr3822701qtx.291.1575407620369; Tue, 03 Dec 2019 13:13:40 -0800 (PST) MIME-Version: 1.0 References: <201912030722.xB37MdrZ033595@gndrsh.dnsmgr.net> <8044a2f1096df626368183dd1ae77f5ac2e43b70.camel@freebsd.org> In-Reply-To: From: Vincenzo Maffione Date: Tue, 3 Dec 2019 22:15:52 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve To: John Baldwin Cc: Ian Lepore , Rodney Grimes , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 21:13:41 -0000 I see, thanks for the pointers. It looks like cfmakeraw() and tcsetattr() were what I was looking for. A bhyve-specific printf wrapper looks the right solution to me. I can try to sketch a patch for you guys to review, if that's useful. Cheers, Vincenzo Il giorno mar 3 dic 2019 alle ore 18:38 John Baldwin ha scritto: > On 12/3/19 7:14 AM, Ian Lepore wrote: > > On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: > >>> On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > >>>> Author: vmaffione > >>>> Date: Mon Dec 2 20:51:46 2019 > >>>> New Revision: 355301 > >>>> URL: https://svnweb.freebsd.org/changeset/base/355301 > >>>> > >>>> Log: > >>>> bhyve: uniform printf format string newlines > >>>> > >>>> Some of the printf statements only use LF to get a newline. > >>>> However, a CR character is also required for the serial console to > >>>> print debug logs in a nice way. > >>>> Fix those code locations that only use LF, by adding a CR > >>>> character. > >>>> > >>>> Reviewed by: markj, aleksandr.fedorov@itglobal.com > >>>> MFC after: 1 week > >>>> Differential Revision: https://reviews.freebsd.org/D22552 > >>>> > >>>> Modified: > >>>> head/usr.sbin/bhyve/audio.c > >>>> head/usr.sbin/bhyve/hda_codec.c > >>>> head/usr.sbin/bhyve/net_backends.c > >>>> head/usr.sbin/bhyve/pci_ahci.c > >>>> head/usr.sbin/bhyve/pci_e82545.c > >>>> head/usr.sbin/bhyve/pci_hda.c > >>>> head/usr.sbin/bhyve/pci_nvme.c > >>>> head/usr.sbin/bhyve/pci_virtio_block.c > >>>> head/usr.sbin/bhyve/pci_virtio_console.c > >>>> head/usr.sbin/bhyve/pci_virtio_net.c > >>>> head/usr.sbin/bhyve/pci_virtio_rnd.c > >>>> head/usr.sbin/bhyve/pci_virtio_scsi.c > >>>> head/usr.sbin/bhyve/pci_xhci.c > >>>> head/usr.sbin/bhyve/rfb.c > >>>> > >>> > >>> These changes seem wrong in a couple ways... > >>> > >>> - Lines are terminated by linefeeds in unix-like systems. If > >>> linefeeds need to be translated to include carriage returns, that's the > >>> responsibility of the terminal/line-discipline layer, not the source > >>> strings being printed. > >> > >> Fully agree, this change seems wrong to me for Ian's stated reason here. > >> > >>> > >>> - The sequence \n\r is very strange. For systems that do prefer > >>> carriage returns, the \r always comes before the \n (or stands alone on > >>> Mac systems), not after. > >>> > >>> I have a feeling that the root of this is something like "lots of > >>> people use bhyve for Windows, so they use Windows apps to look at logs, > >>> so the logs should be formatted for Windows." If that's the reasoning, > >>> then why shouldn't we convert EVERY printf in the source base to > >>> include carriage returns, just in case a windows user wants to browse a > >>> log file? > >> > >> This is not that issue, it is something going on with the line > >> discipline when using the bhyve console device. I believe the > >> line displine being different from what bhyve itself is expecting > >> so when console output is intermixed with output from bhyve itself > >> things go wrong. > >> > >> The printf's in this patch are coming from the bhyve process that > >> has a fd open to the launching tty, the line discipline on that tty > >> is changed to something different after you open the > >> console device from that same controlling tty, or that is my hypothosis > >> on what is going wrong. > > > > There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would > > definitely turn off nl->crnl translations. I think that is the other > > end of the bhyve console that I posted a patch for yesterday, and I > > think the console driver is probably still the right place to do that > > translation (because other console drivers do it that way). But I'm > > not set up to run bhyve here, so I can't test my theory. > > That patch won't work alone. Most people don't use bvmcons, most people > running bhyve use a standard uart as the console (bvmcons was an early > console devices before bhyve had a ns8250 uart device model). When using > the uart as the device model you still have raw output in the bhyve > process itself. (See cfmakeraw() in uart_emul.c as well). We don't > get to change how guest OS's use a uart, so any changes have to be in > usr.sbin/bhyve, not in sys/. > > However, to do that you have to actually do something more complicated to > turn \r\n and \n\r sequences from the guest into plain \n to stdout while > still DTRT for "bare" \r and \n characters. You also have to make sure > you do the right thing for input and not just output in the device models. > > I'm not quite a fan of this commit as-is since you will get spurious new > lines now if you don't use a serial console. I would perhaps rather have > a custom printf() wrapper in bhyve that outputs the \r as needed for > debug and error printfs only when stdio has been changed to be raw. I > was busy with family stuff and thanksgiving last week so didn't have time > to review it before it was committed unfortunately. > > -- > John Baldwin > From owner-svn-src-all@freebsd.org Tue Dec 3 21:30:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBD961BE10D; Tue, 3 Dec 2019 21:30:34 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47SFWt547rz3yVV; Tue, 3 Dec 2019 21:30:34 +0000 (UTC) (envelope-from rlibby@gmail.com) Received: by mail-qk1-f178.google.com with SMTP id m188so5057197qkc.4; Tue, 03 Dec 2019 13:30:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Xo/TniFzb6ZHUGTe2ojsr0rguw5FWP1xkz339i44PmU=; b=pUNjJQPwBNiEDR3fQJUI5EVW6zIKO7Fn4W6v50qtehA4rAHFqFql+cm2CVeTtSCVsN f4KWG/QZFuY+PlXxgBbvvOHG6UOa8S9lkLJmYuy/AHpSVFh36ZnYD0M+XzbEG6CDAiIc 83o0FhTxN9sqxRYgdvOZzVRLTNcJnhz3voSMQaxcTQ8nBh5Fyk2W0cE0VZ/t5vDcH+F6 sgCQpT/Q6L4yJWlgXbUOcoTU6CutkDqOuQ5Ep0ox5IPe0SOUB2lIjVFDEz8h6r5Zy/95 e3mVO9xYzVK4njHt/JD9QofxC4b64s3u/FcIfOsmbKsWz4GJwQpZLSptVSVOInI1HP66 9Qmw== X-Gm-Message-State: APjAAAVZvqW6MDCSe/VWLdFMTij168Xa22qQl2CuFErC4dzq5F76Vzjf jq+dEvFlqmrPd/TocZ0olFsDwLcDWlM= X-Google-Smtp-Source: APXvYqyiq3NM0qHGvsrHWA5WHJDukSRTlvapHLWv4ROESoldDmM1Jl9oDIOBalc7RKMl1T//vJviQg== X-Received: by 2002:a37:444c:: with SMTP id r73mr7438274qka.418.1575408632808; Tue, 03 Dec 2019 13:30:32 -0800 (PST) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com. [209.85.222.173]) by smtp.gmail.com with ESMTPSA id j3sm2357292qkk.133.2019.12.03.13.30.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 13:30:32 -0800 (PST) Received: by mail-qk1-f173.google.com with SMTP id b8so5047937qkk.5; Tue, 03 Dec 2019 13:30:32 -0800 (PST) X-Received: by 2002:a05:620a:1fa:: with SMTP id x26mr7617642qkn.311.1575408632397; Tue, 03 Dec 2019 13:30:32 -0800 (PST) MIME-Version: 1.0 References: <201911271949.xARJnuFl084178@repo.freebsd.org> <20191203204313.GB2706@FreeBSD.org> In-Reply-To: From: Ryan Libby Date: Tue, 3 Dec 2019 13:30:20 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355137 - head/sys/vm To: Ian Lepore Cc: Gleb Smirnoff , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47SFWt547rz3yVV X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 21:30:34 -0000 On Tue, Dec 3, 2019 at 1:12 PM Ian Lepore wrote: > > On Tue, 2019-12-03 at 12:59 -0800, Ryan Libby wrote: > > > + * XXX UMA_ZONE_OFFPAGE. > > All over freebsd we have cryptic XXX comments that have no meaning to > anyone except whoever wrote them (and, I suspect, no meaning to those > people either after a couple months have elapsed). > > To the degree that XXX represents "possible trouble here" and/or "more > work to do here", I would argue that any placement of a new XXX > requires at least a sentence (and probably more like a paragraph) to > describe why it's there. > > -- Ian Yes, I agree it is cryptic. This specific XXX is discussed in the review and is a cookie crumb for planned future work: https://reviews.freebsd.org/D20722?id=64944#inline-140550 In this case the problem is pre-existing and the comment calls it out so that we don't miss it in a coming cleanup. I wrote the block comment directly above so that it would make sense when the correct flag check is eventually inserted. Ryan From owner-svn-src-all@freebsd.org Tue Dec 3 21:43:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 642AB1BE905; Tue, 3 Dec 2019 21:43:58 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SFqL17H7z40LW; Tue, 3 Dec 2019 21:43:57 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id xB3LhtUW026256 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 3 Dec 2019 13:43:55 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id xB3LhtiA026255; Tue, 3 Dec 2019 13:43:55 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 3 Dec 2019 13:43:55 -0800 From: Gleb Smirnoff To: Ryan Libby Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355137 - head/sys/vm Message-ID: <20191203214355.GC2706@FreeBSD.org> References: <201911271949.xARJnuFl084178@repo.freebsd.org> <20191203204313.GB2706@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47SFqL17H7z40LW X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 21:43:58 -0000 On Tue, Dec 03, 2019 at 12:59:18PM -0800, Ryan Libby wrote: R> > If I understand the change correct, now items from UMA_ZONE_NOFREE zones R> > will be trashed, too. That would undermine purpose of UMA_ZONE_NOFREE. R> > Of course the flag is a hack, but some systems rely on it working. R> > R> The intent is not to change anything for NOFREE zones (i.e. still don't R> trash them). I didn't put all the detail in the commit log, but I did R> reword the block comment in uma_zcreate: I'm sorry - misread the diff. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Dec 3 22:01:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB0421BF14C; Tue, 3 Dec 2019 22:01:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SGCs55RPz41Bp; Tue, 3 Dec 2019 22:01:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 923271E402; Tue, 3 Dec 2019 22:01:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3M1jw6080129; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3M1jSm080128; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912032201.xB3M1jSm080128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Dec 2019 22:01: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: r355359 - in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Commit-Revision: 355359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:01:45 -0000 Author: jhb Date: Tue Dec 3 22:01:45 2019 New Revision: 355359 URL: https://svnweb.freebsd.org/changeset/base/355359 Log: MFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10 PR: 221350 Modified: stable/12/sys/dev/pci/pci.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/pci/pci.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Tue Dec 3 21:05:33 2019 (r355358) +++ stable/12/sys/dev/pci/pci.c Tue Dec 3 22:01:45 2019 (r355359) @@ -234,6 +234,7 @@ struct pci_quirk { #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ #define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ +#define PCI_QUIRK_REALLOC_BAR 7 /* Can't allocate memory at the default address */ int arg1; int arg2; }; @@ -315,6 +316,12 @@ static const struct pci_quirk pci_quirks[] = { { 0x167814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715 */ { 0x167914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715S */ + /* + * HPE Gen 10 VGA has a memory range that can't be allocated in the + * expected place. + */ + { 0x98741002, PCI_QUIRK_REALLOC_BAR, 0, 0 }, + { 0 } }; @@ -3293,7 +3300,9 @@ pci_add_map(device_t bus, device_t dev, int reg, struc */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, flags); - if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) { + if ((pci_do_realloc_bars + || pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_REALLOC_BAR)) + && res == NULL && (start != 0 || end != ~0)) { /* * If the allocation fails, try to allocate a resource for * this BAR using any available range. The firmware felt From owner-svn-src-all@freebsd.org Tue Dec 3 22:01:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C0551BF151; Tue, 3 Dec 2019 22:01:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SGCt0Qjsz41Bq; Tue, 3 Dec 2019 22:01:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5E1D1E403; Tue, 3 Dec 2019 22:01:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3M1j20080135; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3M1jJ5080134; Tue, 3 Dec 2019 22:01:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912032201.xB3M1jJ5080134@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Dec 2019 22:01:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355359 - in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/pci 12/sys/dev/pci X-SVN-Commit-Revision: 355359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:01:46 -0000 Author: jhb Date: Tue Dec 3 22:01:45 2019 New Revision: 355359 URL: https://svnweb.freebsd.org/changeset/base/355359 Log: MFC 342160: Work around BIOS quirks on HPE Proliant MicroServer Gen10 PR: 221350 Modified: stable/11/sys/dev/pci/pci.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/pci/pci.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/pci/pci.c ============================================================================== --- stable/11/sys/dev/pci/pci.c Tue Dec 3 21:05:33 2019 (r355358) +++ stable/11/sys/dev/pci/pci.c Tue Dec 3 22:01:45 2019 (r355359) @@ -229,6 +229,7 @@ struct pci_quirk { #define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ #define PCI_QUIRK_DISABLE_MSIX 5 /* MSI-X doesn't work */ #define PCI_QUIRK_MSI_INTX_BUG 6 /* PCIM_CMD_INTxDIS disables MSI */ +#define PCI_QUIRK_REALLOC_BAR 7 /* Can't allocate memory at the default address */ int arg1; int arg2; }; @@ -310,6 +311,12 @@ static const struct pci_quirk pci_quirks[] = { { 0x167814e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715 */ { 0x167914e4, PCI_QUIRK_MSI_INTX_BUG, 0, 0 }, /* BCM5715S */ + /* + * HPE Gen 10 VGA has a memory range that can't be allocated in the + * expected place. + */ + { 0x98741002, PCI_QUIRK_REALLOC_BAR, 0, 0 }, + { 0 } }; @@ -3280,7 +3287,9 @@ pci_add_map(device_t bus, device_t dev, int reg, struc */ res = resource_list_reserve(rl, bus, dev, type, ®, start, end, count, flags); - if (pci_do_realloc_bars && res == NULL && (start != 0 || end != ~0)) { + if ((pci_do_realloc_bars + || pci_has_quirk(pci_get_devid(dev), PCI_QUIRK_REALLOC_BAR)) + && res == NULL && (start != 0 || end != ~0)) { /* * If the allocation fails, try to allocate a resource for * this BAR using any available range. The firmware felt From owner-svn-src-all@freebsd.org Tue Dec 3 22:02:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 623401BF299; Tue, 3 Dec 2019 22:02:49 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47SGF51yvdz41WX; Tue, 3 Dec 2019 22:02:48 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-oi1-f172.google.com with SMTP id k196so4912841oib.2; Tue, 03 Dec 2019 14:02:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=wRBsCK4FE4Gj1JGo5TzcBI3aVB7QWozihgqcFzAUvjE=; b=a6/b3dAZTUOIFe6bd9x9EkzqEBlu2HgoRPd2NfQpxN0hG9ROvvQEQnvgDKCfdmp1xL ATPGGr7ITtztEE+0DAbihgaF3Bs/jUtgQBZpxYM2wF8nsTMHh8RfLZbfOpuM3q5QupNi ryHjp4MebEoKkPNPdFXwK1TU0PETx9+A7VkifWlqaK0ecgJ21id8QMCk8n7IC6FP7u3M ldfGSv5VxsVsGH4q1IaUzl1lIP4LaFXNZQw3dQ65ay5njTSUUPh0TuBRHIr7c5rCFTDz IDzxq2bkkUSaIKwGv7Ycvk4xNq4xZ2bxLK2EtKDUXNoXfzMg8f4MX7+jZAGajg/vGGQ4 TWVg== X-Gm-Message-State: APjAAAWUw56gsjgeFSk3I28MtTUo0effekegduL1iJu8smo8unWHhLUf Iz8JQvU2Y4rJi1AUr5PKRrFZQ0Kv X-Google-Smtp-Source: APXvYqzSIzpYx/8LQoJ0HEizxHZKMlRe8Rl/Dh81DgFlLkPcwe4wvMlsswjnL0xi5RV1sgUIrPEVbg== X-Received: by 2002:aca:de88:: with SMTP id v130mr179538oig.108.1575410566822; Tue, 03 Dec 2019 14:02:46 -0800 (PST) Received: from mail-ot1-f45.google.com (mail-ot1-f45.google.com. [209.85.210.45]) by smtp.gmail.com with ESMTPSA id f1sm1530994otq.4.2019.12.03.14.02.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Dec 2019 14:02:46 -0800 (PST) Received: by mail-ot1-f45.google.com with SMTP id 59so4395572otp.12; Tue, 03 Dec 2019 14:02:46 -0800 (PST) X-Received: by 2002:a9d:549:: with SMTP id 67mr42899otw.175.1575410566345; Tue, 03 Dec 2019 14:02:46 -0800 (PST) MIME-Version: 1.0 References: <201912030703.xB373P5N043316@repo.freebsd.org> In-Reply-To: <201912030703.xB373P5N043316@repo.freebsd.org> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 3 Dec 2019 14:02:35 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355318 - head/sbin/newfs_msdos To: Xin LI Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47SGF51yvdz41WX X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.995,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:02:49 -0000 Hi Xin Li, Is there a reason to prefer exit() over returning from main? I have not surveyed the source tree, but I suspect most programs in base exit by returning from main rather than explicit exit(3). Thanks, Conrad On Mon, Dec 2, 2019 at 11:03 PM Xin LI wrote: > > Author: delphij > Date: Tue Dec 3 07:03:25 2019 > New Revision: 355318 > URL: https://svnweb.freebsd.org/changeset/base/355318 > > Log: > Explicitly exit() instead of return in main(). > > MFC after: 2 weeks > > Modified: > head/sbin/newfs_msdos/newfs_msdos.c > > Modified: head/sbin/newfs_msdos/newfs_msdos.c > ============================================================================== > --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 (r355317) > +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:03:25 2019 (r355318) > @@ -189,7 +189,7 @@ main(int argc, char *argv[]) > err(1, NULL); > } > dtype = *argv; > - return !!mkfs_msdos(fname, dtype, &o); > + exit(!!mkfs_msdos(fname, dtype, &o)); > } > > /* From owner-svn-src-all@freebsd.org Tue Dec 3 22:08:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20E851BF574; Tue, 3 Dec 2019 22:08:55 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SGN706ltz41s8; Tue, 3 Dec 2019 22:08:55 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC8081E4D5; Tue, 3 Dec 2019 22:08:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3M8sC9080529; Tue, 3 Dec 2019 22:08:54 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3M8sZf080528; Tue, 3 Dec 2019 22:08:54 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912032208.xB3M8sZf080528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 22:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355360 - head/sys/dev/cpufreq X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/cpufreq X-SVN-Commit-Revision: 355360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:08:55 -0000 Author: manu Date: Tue Dec 3 22:08:54 2019 New Revision: 355360 URL: https://svnweb.freebsd.org/changeset/base/355360 Log: cpufreq_dt: Do not attach the device if the cpu isn't present If we boot with hw.ncpu=X (available on arm and arm64 at least) we shouldn't attach the cpufreq driver as cf_set_method will try to get the cpuid and it doesn't exists. This solves cpufreq panicing on RockChip RK3399 when booting with hw.ncpu=4 MFC after: 1 week Modified: head/sys/dev/cpufreq/cpufreq_dt.c Modified: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- head/sys/dev/cpufreq/cpufreq_dt.c Tue Dec 3 22:01:45 2019 (r355359) +++ head/sys/dev/cpufreq/cpufreq_dt.c Tue Dec 3 22:08:54 2019 (r355360) @@ -446,7 +446,7 @@ cpufreq_dt_attach(device_t dev) struct cpufreq_dt_softc *sc; phandle_t node; phandle_t cnode, opp, copp; - int cpu; + int cpu, ncpu; uint64_t freq; int rv = 0; enum opp_version version; @@ -454,7 +454,15 @@ cpufreq_dt_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; node = ofw_bus_get_node(device_get_parent(dev)); + cpu = device_get_unit(device_get_parent(dev)); + if (TUNABLE_INT_FETCH("hw.ncpu", &ncpu)) { + if (cpu >= ncpu) { + device_printf(dev, "Not attaching as cpu is not present\n"); + return (ENXIO); + } + } + if (regulator_get_by_ofw_property(dev, node, "cpu-supply", &sc->reg) != 0) { if (regulator_get_by_ofw_property(dev, node, @@ -496,7 +504,6 @@ cpufreq_dt_attach(device_t dev) * Find all CPUs that share the same opp table */ CPU_ZERO(&sc->cpus); - cpu = device_get_unit(device_get_parent(dev)); for (cnode = node; cnode > 0; cnode = OF_peer(cnode), cpu++) { copp = -1; if (version == OPP_V1) From owner-svn-src-all@freebsd.org Tue Dec 3 22:26:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A7BC1BFBC2; Tue, 3 Dec 2019 22:26:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SGmw2T1Lz42hY; Tue, 3 Dec 2019 22:26:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37F5A1E892; Tue, 3 Dec 2019 22:26:56 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MQu90092523; Tue, 3 Dec 2019 22:26:56 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MQuNX092522; Tue, 3 Dec 2019 22:26:56 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201912032226.xB3MQuNX092522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Tue, 3 Dec 2019 22:26:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355361 - head/sys/dev/cpufreq X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/cpufreq X-SVN-Commit-Revision: 355361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:26:56 -0000 Author: manu Date: Tue Dec 3 22:26:55 2019 New Revision: 355361 URL: https://svnweb.freebsd.org/changeset/base/355361 Log: cpufreq_dt: Do not fetch again hw.ncpu MD code already set the global variable mp_ncpus according to the tunable hw.ncpu so use the global variable directly. Reported by: ian Modified: head/sys/dev/cpufreq/cpufreq_dt.c Modified: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- head/sys/dev/cpufreq/cpufreq_dt.c Tue Dec 3 22:08:54 2019 (r355360) +++ head/sys/dev/cpufreq/cpufreq_dt.c Tue Dec 3 22:26:55 2019 (r355361) @@ -446,7 +446,7 @@ cpufreq_dt_attach(device_t dev) struct cpufreq_dt_softc *sc; phandle_t node; phandle_t cnode, opp, copp; - int cpu, ncpu; + int cpu; uint64_t freq; int rv = 0; enum opp_version version; @@ -456,11 +456,9 @@ cpufreq_dt_attach(device_t dev) node = ofw_bus_get_node(device_get_parent(dev)); cpu = device_get_unit(device_get_parent(dev)); - if (TUNABLE_INT_FETCH("hw.ncpu", &ncpu)) { - if (cpu >= ncpu) { - device_printf(dev, "Not attaching as cpu is not present\n"); - return (ENXIO); - } + if (cpu >= mp_ncpus) { + device_printf(dev, "Not attaching as cpu is not present\n"); + return (ENXIO); } if (regulator_get_by_ofw_property(dev, node, From owner-svn-src-all@freebsd.org Tue Dec 3 22:49:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16D2F1C041A; Tue, 3 Dec 2019 22:49:26 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHGs6vG4z43xm; Tue, 3 Dec 2019 22:49:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D040D1EC7A; Tue, 3 Dec 2019 22:49:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MnP8w004449; Tue, 3 Dec 2019 22:49:25 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MnOWT004438; Tue, 3 Dec 2019 22:49:24 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032249.xB3MnOWT004438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:49:24 +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: r355362 - in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Commit-Revision: 355362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:49:26 -0000 Author: rpokala Date: Tue Dec 3 22:49:24 2019 New Revision: 355362 URL: https://svnweb.freebsd.org/changeset/base/355362 Log: MFC r343583: Remove unecessary "All rights reserved" from files under my or Panasas's copyright. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my or Panasas's copyright. The files related to jedec_dimm(4) also bear avg@'s copyright; he has approved this change. Modified: stable/12/share/man/man4/imcsmb.4 stable/12/share/man/man4/jedec_dimm.4 stable/12/sys/dev/imcsmb/imcsmb.c stable/12/sys/dev/imcsmb/imcsmb_pci.c stable/12/sys/dev/imcsmb/imcsmb_reg.h stable/12/sys/dev/imcsmb/imcsmb_var.h stable/12/sys/dev/jedec_dimm/jedec_dimm.c stable/12/sys/dev/jedec_dimm/jedec_dimm.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/imcsmb.4 ============================================================================== --- stable/12/share/man/man4/imcsmb.4 Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/share/man/man4/imcsmb.4 Tue Dec 3 22:49:24 2019 (r355362) @@ -2,7 +2,6 @@ .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" .\" Copyright (c) 2018 Panasas -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/12/share/man/man4/jedec_dimm.4 ============================================================================== --- stable/12/share/man/man4/jedec_dimm.4 Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/share/man/man4/jedec_dimm.4 Tue Dec 3 22:49:24 2019 (r355362) @@ -3,7 +3,6 @@ .\" .\" Copyright (c) 2016 Andriy Gapon .\" Copyright (c) 2018 Ravi Pokala -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb.c ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb_pci.c ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb_reg.h ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/imcsmb/imcsmb_var.h ============================================================================== --- stable/12/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- stable/12/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:49:24 2019 (r355362) @@ -5,7 +5,6 @@ * * Copyright (c) 2016 Andriy Gapon * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/12/sys/dev/jedec_dimm/jedec_dimm.h ============================================================================== --- stable/12/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:26:55 2019 (r355361) +++ stable/12/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:49:24 2019 (r355362) @@ -4,7 +4,6 @@ * Authors: Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Tue Dec 3 22:51:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC28C1C0827; Tue, 3 Dec 2019 22:51:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHK9601fz44DJ; Tue, 3 Dec 2019 22:51:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF16A1ECD2; Tue, 3 Dec 2019 22:51:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MpPFe008367; Tue, 3 Dec 2019 22:51:25 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MpP6X008366; Tue, 3 Dec 2019 22:51:25 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032251.xB3MpP6X008366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:51:25 +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: r355363 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 355363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:51:26 -0000 Author: rpokala Date: Tue Dec 3 22:51:25 2019 New Revision: 355363 URL: https://svnweb.freebsd.org/changeset/base/355363 Log: MFC r354102: Args for buf_track() might be unused If neither FULL_BUF_TRACKING nor BUF_TRACKING are defined, then the body of buf_track() becomes empty. Mark the arguments with "__unused" so the compiler doesn't complain about unused arguments in that case. Modified: stable/12/sys/sys/buf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/buf.h ============================================================================== --- stable/12/sys/sys/buf.h Tue Dec 3 22:49:24 2019 (r355362) +++ stable/12/sys/sys/buf.h Tue Dec 3 22:51:25 2019 (r355363) @@ -450,7 +450,7 @@ buf_countdeps(struct buf *bp, int i) } static __inline void -buf_track(struct buf *bp, const char *location) +buf_track(struct buf *bp __unused, const char *location __unused) { #if defined(FULL_BUF_TRACKING) From owner-svn-src-all@freebsd.org Tue Dec 3 22:53:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3F9D1C0950; Tue, 3 Dec 2019 22:53:07 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHM73vCZz44YP; Tue, 3 Dec 2019 22:53:07 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A50C1EE36; Tue, 3 Dec 2019 22:53:07 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Mr7YS010120; Tue, 3 Dec 2019 22:53:07 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Mr7XJ010119; Tue, 3 Dec 2019 22:53:07 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032253.xB3Mr7XJ010119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:53: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: r355364 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 355364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:53:07 -0000 Author: rpokala Date: Tue Dec 3 22:53:07 2019 New Revision: 355364 URL: https://svnweb.freebsd.org/changeset/base/355364 Log: MFC r354673: Logging improvements to loader::nfs Include the server IP address when logging nfs_open(), add a few missing "\n"s, and correct a typo. Modified: stable/12/stand/libsa/nfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/nfs.c ============================================================================== --- stable/12/stand/libsa/nfs.c Tue Dec 3 22:51:25 2019 (r355363) +++ stable/12/stand/libsa/nfs.c Tue Dec 3 22:53:07 2019 (r355364) @@ -486,7 +486,8 @@ nfs_open(const char *upath, struct open_file *f) #ifdef NFS_DEBUG if (debug) - printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); + printf("nfs_open: %s (rootip=%s rootpath=%s)\n", upath, + inet_ntoa(rootip), rootpath); #endif if (!rootpath[0]) { printf("no rootpath, no nfs\n"); @@ -691,14 +692,14 @@ nfs_read(struct open_file *f, void *buf, size_t size, if (cc == -1) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: read: %s", strerror(errno)); + printf("nfs_read: read: %s\n", strerror(errno)); #endif return (errno); /* XXX - from nfs_readdata */ } if (cc == 0) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: hit EOF unexpectantly"); + printf("nfs_read: hit EOF unexpectedly\n"); #endif goto ret; } From owner-svn-src-all@freebsd.org Tue Dec 3 22:53:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93DE61C09E5; Tue, 3 Dec 2019 22:53:23 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHMR3NCZz44gm; Tue, 3 Dec 2019 22:53:23 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 547FE1EE38; Tue, 3 Dec 2019 22:53:23 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MrNPN010344; Tue, 3 Dec 2019 22:53:23 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MrMw4010340; Tue, 3 Dec 2019 22:53:22 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032253.xB3MrMw4010340@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355365 - in stable/12/usr.sbin: rpc.lockd rpc.statd X-SVN-Group: stable-12 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/12/usr.sbin: rpc.lockd rpc.statd X-SVN-Commit-Revision: 355365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:53:23 -0000 Author: rpokala Date: Tue Dec 3 22:53:22 2019 New Revision: 355365 URL: https://svnweb.freebsd.org/changeset/base/355365 Log: MFC r355006: Add and document options to allow rpc.lockd and rpc.statd to run in the foreground. This allows a separate process to monitor when and how those programs exit. That process can then restart them if needed. Modified: stable/12/usr.sbin/rpc.lockd/lockd.c stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 stable/12/usr.sbin/rpc.statd/rpc.statd.8 stable/12/usr.sbin/rpc.statd/statd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- stable/12/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:53:22 2019 (r355365) @@ -120,6 +120,7 @@ main(int argc, char **argv) char *endptr, **hosts_bak; struct sigaction sigalarm; int grace_period = 30; + int foreground = 0; struct netconfig *nconf; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; @@ -127,7 +128,7 @@ main(int argc, char **argv) int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:Fg:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -136,6 +137,9 @@ main(int argc, char **argv) /* NOTREACHED */ } break; + case 'F': + foreground = 1; + break; case 'g': grace_period = atoi(optarg); if (!grace_period) { @@ -422,7 +426,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if (daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, debug_level > 0)) { err(1, "cannot fork"); /* NOTREACHED */ } @@ -844,7 +848,7 @@ void usage() { errx(1, "usage: rpc.lockd [-d ]" - " [-g ] [-h ] [-p ]"); + " [-F] [-g ] [-h ] [-p ]"); } /* Modified: stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 ============================================================================== --- stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:53:22 2019 (r355365) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2007 +.Dd November 21, 2019 .Dt RPC.LOCKD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar debug_level +.Op Fl F .Op Fl g Ar grace period .Op Fl h Ar bindip .Op Fl p Ar port @@ -70,6 +71,17 @@ in the generation of one log line per protocol operati Higher debug levels can be specified, causing display of operation arguments and internal operations of the daemon. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl g The .Fl g Modified: stable/12/usr.sbin/rpc.statd/rpc.statd.8 ============================================================================== --- stable/12/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:53:22 2019 (r355365) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2007 +.Dd November 21, 2019 .Dt RPC.STATD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl F .Op Fl h Ar bindip .Op Fl p Ar port .Sh DESCRIPTION @@ -71,6 +72,17 @@ These messages are logged with level LOG_DEBUG and facility LOG_DAEMON. Error conditions are logged irrespective of this option, using level LOG_ERR. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl h Ar bindip Specify specific IP addresses to bind to. This option may be specified multiple times. Modified: stable/12/usr.sbin/rpc.statd/statd.c ============================================================================== --- stable/12/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:53:07 2019 (r355364) +++ stable/12/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:53:22 2019 (r355365) @@ -88,15 +88,19 @@ main(int argc, char **argv) int ch, i, s; char *endptr, **hosts_bak; int have_v6 = 1; + int foreground = 0; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "dh:p:")) != -1) + while ((ch = getopt(argc, argv, "dFh:p:")) != -1) switch (ch) { case 'd': debug = 1; break; + case 'F': + foreground = 1; + break; case 'h': ++nhosts; hosts_bak = hosts; @@ -287,7 +291,11 @@ main(int argc, char **argv) /* Note that it is NOT sensible to run this program from inetd - the */ /* protocol assumes that it will run immediately at boot time. */ - daemon(0, 0); + if ((foreground == 0) && daemon(0, 0) < 0) { + err(1, "cannot fork"); + /* NOTREACHED */ + } + openlog("rpc.statd", 0, LOG_DAEMON); if (debug) syslog(LOG_INFO, "Starting - debug enabled"); else syslog(LOG_INFO, "Starting"); @@ -617,7 +625,7 @@ clearout_service(void) static void usage(void) { - fprintf(stderr, "usage: rpc.statd [-d] [-h ] [-p ]\n"); + fprintf(stderr, "usage: rpc.statd [-d] [-F] [-h ] [-p ]\n"); exit(1); } From owner-svn-src-all@freebsd.org Tue Dec 3 22:53:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBB521C0AA0; Tue, 3 Dec 2019 22:53:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHN0557jz44tC; Tue, 3 Dec 2019 22:53:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 930C51EE39; Tue, 3 Dec 2019 22:53:52 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MrqUo010415; Tue, 3 Dec 2019 22:53:52 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MroZ7010407; Tue, 3 Dec 2019 22:53:50 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032253.xB3MroZ7010407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:53:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355366 - in stable/11: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/11: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm X-SVN-Commit-Revision: 355366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:53:52 -0000 Author: rpokala Date: Tue Dec 3 22:53:50 2019 New Revision: 355366 URL: https://svnweb.freebsd.org/changeset/base/355366 Log: MFC r343583: Remove unecessary "All rights reserved" from files under my or Panasas's copyright. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my or Panasas's copyright. The files related to jedec_dimm(4) also bear avg@'s copyright; he has approved this change. Modified: stable/11/share/man/man4/imcsmb.4 stable/11/share/man/man4/jedec_dimm.4 stable/11/sys/dev/imcsmb/imcsmb.c stable/11/sys/dev/imcsmb/imcsmb_pci.c stable/11/sys/dev/imcsmb/imcsmb_reg.h stable/11/sys/dev/imcsmb/imcsmb_var.h stable/11/sys/dev/jedec_dimm/jedec_dimm.c stable/11/sys/dev/jedec_dimm/jedec_dimm.h Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man4/imcsmb.4 ============================================================================== --- stable/11/share/man/man4/imcsmb.4 Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/share/man/man4/imcsmb.4 Tue Dec 3 22:53:50 2019 (r355366) @@ -2,7 +2,6 @@ .\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD .\" .\" Copyright (c) 2018 Panasas -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/11/share/man/man4/jedec_dimm.4 ============================================================================== --- stable/11/share/man/man4/jedec_dimm.4 Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/share/man/man4/jedec_dimm.4 Tue Dec 3 22:53:50 2019 (r355366) @@ -3,7 +3,6 @@ .\" .\" Copyright (c) 2016 Andriy Gapon .\" Copyright (c) 2018 Ravi Pokala -.\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb.c ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb.c Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb_pci.c ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb_pci.c Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb_reg.h ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb_reg.h Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/imcsmb/imcsmb_var.h ============================================================================== --- stable/11/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/imcsmb/imcsmb_var.h Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Joe Kloss; Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2017-2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/jedec_dimm/jedec_dimm.c ============================================================================== --- stable/11/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/jedec_dimm/jedec_dimm.c Tue Dec 3 22:53:50 2019 (r355366) @@ -5,7 +5,6 @@ * * Copyright (c) 2016 Andriy Gapon * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: stable/11/sys/dev/jedec_dimm/jedec_dimm.h ============================================================================== --- stable/11/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:53:22 2019 (r355365) +++ stable/11/sys/dev/jedec_dimm/jedec_dimm.h Tue Dec 3 22:53:50 2019 (r355366) @@ -4,7 +4,6 @@ * Authors: Ravi Pokala (rpokala@freebsd.org) * * Copyright (c) 2018 Panasas - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Tue Dec 3 22:54:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD8F81C0B2E; Tue, 3 Dec 2019 22:54:08 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHNJ56f4z451G; Tue, 3 Dec 2019 22:54:08 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 933C31EE3A; Tue, 3 Dec 2019 22:54:08 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3Ms8qT010477; Tue, 3 Dec 2019 22:54:08 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Ms8b6010476; Tue, 3 Dec 2019 22:54:08 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032254.xB3Ms8b6010476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:54:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355367 - stable/11/stand/libsa X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: stable/11/stand/libsa X-SVN-Commit-Revision: 355367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:54:08 -0000 Author: rpokala Date: Tue Dec 3 22:54:08 2019 New Revision: 355367 URL: https://svnweb.freebsd.org/changeset/base/355367 Log: MFC r354673: Logging improvements to loader::nfs Include the server IP address when logging nfs_open(), add a few missing "\n"s, and correct a typo. Modified: stable/11/stand/libsa/nfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/stand/libsa/nfs.c ============================================================================== --- stable/11/stand/libsa/nfs.c Tue Dec 3 22:53:50 2019 (r355366) +++ stable/11/stand/libsa/nfs.c Tue Dec 3 22:54:08 2019 (r355367) @@ -486,7 +486,8 @@ nfs_open(const char *upath, struct open_file *f) #ifdef NFS_DEBUG if (debug) - printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath); + printf("nfs_open: %s (rootip=%s rootpath=%s)\n", upath, + inet_ntoa(rootip), rootpath); #endif if (!rootpath[0]) { printf("no rootpath, no nfs\n"); @@ -691,14 +692,14 @@ nfs_read(struct open_file *f, void *buf, size_t size, if (cc == -1) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: read: %s", strerror(errno)); + printf("nfs_read: read: %s\n", strerror(errno)); #endif return (errno); /* XXX - from nfs_readdata */ } if (cc == 0) { #ifdef NFS_DEBUG if (debug) - printf("nfs_read: hit EOF unexpectantly"); + printf("nfs_read: hit EOF unexpectedly\n"); #endif goto ret; } From owner-svn-src-all@freebsd.org Tue Dec 3 22:54:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D8CF1C0BE0; Tue, 3 Dec 2019 22:54:26 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHNd6hX2z457c; Tue, 3 Dec 2019 22:54:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C978C1EE3B; Tue, 3 Dec 2019 22:54:25 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MsPGT010536; Tue, 3 Dec 2019 22:54:25 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MsPts010533; Tue, 3 Dec 2019 22:54:25 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201912032254.xB3MsPts010533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Tue, 3 Dec 2019 22:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355368 - in stable/11/usr.sbin: rpc.lockd rpc.statd X-SVN-Group: stable-11 X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in stable/11/usr.sbin: rpc.lockd rpc.statd X-SVN-Commit-Revision: 355368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:54:26 -0000 Author: rpokala Date: Tue Dec 3 22:54:24 2019 New Revision: 355368 URL: https://svnweb.freebsd.org/changeset/base/355368 Log: MFC r355006: Add and document options to allow rpc.lockd and rpc.statd to run in the foreground. This allows a separate process to monitor when and how those programs exit. That process can then restart them if needed. Modified: stable/11/usr.sbin/rpc.lockd/lockd.c stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 stable/11/usr.sbin/rpc.statd/rpc.statd.8 stable/11/usr.sbin/rpc.statd/statd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/rpc.lockd/lockd.c ============================================================================== --- stable/11/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.lockd/lockd.c Tue Dec 3 22:54:24 2019 (r355368) @@ -118,6 +118,7 @@ main(int argc, char **argv) char *endptr, **hosts_bak; struct sigaction sigalarm; int grace_period = 30; + int foreground = 0; struct netconfig *nconf; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; @@ -125,7 +126,7 @@ main(int argc, char **argv) int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:Fg:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -134,6 +135,9 @@ main(int argc, char **argv) /* NOTREACHED */ } break; + case 'F': + foreground = 1; + break; case 'g': grace_period = atoi(optarg); if (!grace_period) { @@ -420,7 +424,7 @@ main(int argc, char **argv) * Note that it is NOT sensible to run this program from inetd - the * protocol assumes that it will run immediately at boot time. */ - if (daemon(0, debug_level > 0)) { + if ((foreground == 0) && daemon(0, debug_level > 0)) { err(1, "cannot fork"); /* NOTREACHED */ } @@ -842,7 +846,7 @@ void usage() { errx(1, "usage: rpc.lockd [-d ]" - " [-g ] [-h ] [-p ]"); + " [-F] [-g ] [-h ] [-p ]"); } /* Modified: stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 ============================================================================== --- stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.lockd/rpc.lockd.8 Tue Dec 3 22:54:24 2019 (r355368) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 2, 2007 +.Dd November 21, 2019 .Dt RPC.LOCKD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d Ar debug_level +.Op Fl F .Op Fl g Ar grace period .Op Fl h Ar bindip .Op Fl p Ar port @@ -70,6 +71,17 @@ in the generation of one log line per protocol operati Higher debug levels can be specified, causing display of operation arguments and internal operations of the daemon. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl g The .Fl g Modified: stable/11/usr.sbin/rpc.statd/rpc.statd.8 ============================================================================== --- stable/11/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.statd/rpc.statd.8 Tue Dec 3 22:54:24 2019 (r355368) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2007 +.Dd November 21, 2019 .Dt RPC.STATD 8 .Os .Sh NAME @@ -38,6 +38,7 @@ .Sh SYNOPSIS .Nm .Op Fl d +.Op Fl F .Op Fl h Ar bindip .Op Fl p Ar port .Sh DESCRIPTION @@ -71,6 +72,17 @@ These messages are logged with level LOG_DEBUG and facility LOG_DAEMON. Error conditions are logged irrespective of this option, using level LOG_ERR. +.It Fl F +Run +.Nm +in the foreground, rather than going into daemon mode. +This is useful if some other process uses +.Xr fork 2 +and +.Xr exec 3 +to run +.Nm , +and wants to monitor when and how it exits. .It Fl h Ar bindip Specify specific IP addresses to bind to. This option may be specified multiple times. Modified: stable/11/usr.sbin/rpc.statd/statd.c ============================================================================== --- stable/11/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:54:08 2019 (r355367) +++ stable/11/usr.sbin/rpc.statd/statd.c Tue Dec 3 22:54:24 2019 (r355368) @@ -86,15 +86,19 @@ main(int argc, char **argv) int ch, i, s; char *endptr, **hosts_bak; int have_v6 = 1; + int foreground = 0; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; char **port_list; - while ((ch = getopt(argc, argv, "dh:p:")) != -1) + while ((ch = getopt(argc, argv, "dFh:p:")) != -1) switch (ch) { case 'd': debug = 1; break; + case 'F': + foreground = 1; + break; case 'h': ++nhosts; hosts_bak = hosts; @@ -285,7 +289,11 @@ main(int argc, char **argv) /* Note that it is NOT sensible to run this program from inetd - the */ /* protocol assumes that it will run immediately at boot time. */ - daemon(0, 0); + if ((foreground == 0) && daemon(0, 0) < 0) { + err(1, "cannot fork"); + /* NOTREACHED */ + } + openlog("rpc.statd", 0, LOG_DAEMON); if (debug) syslog(LOG_INFO, "Starting - debug enabled"); else syslog(LOG_INFO, "Starting"); @@ -615,7 +623,7 @@ clearout_service(void) static void usage(void) { - fprintf(stderr, "usage: rpc.statd [-d] [-h ] [-p ]\n"); + fprintf(stderr, "usage: rpc.statd [-d] [-F] [-h ] [-p ]\n"); exit(1); } From owner-svn-src-all@freebsd.org Tue Dec 3 22:57:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8669C1C0D2F; Tue, 3 Dec 2019 22:57:11 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHRq31Kvz45Ph; Tue, 3 Dec 2019 22:57:11 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4763C1EE3D; Tue, 3 Dec 2019 22:57:11 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MvBMs010876; Tue, 3 Dec 2019 22:57:11 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3MvBTH010875; Tue, 3 Dec 2019 22:57:11 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201912032257.xB3MvBTH010875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 3 Dec 2019 22:57: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: r355369 - stable/12/usr.bin/tip/tip X-SVN-Group: stable-12 X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: stable/12/usr.bin/tip/tip X-SVN-Commit-Revision: 355369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:57:11 -0000 Author: vangyzen Date: Tue Dec 3 22:57:10 2019 New Revision: 355369 URL: https://svnweb.freebsd.org/changeset/base/355369 Log: MFC r354624 tip/cu: check for EOF on input on the local side If cu reads an EOF on the input side, it goes into a tight loop sending a garbage byte to the remote. With this change, it exits gracefully, along with its child. Sponsored by: Dell EMC Isilon Modified: stable/12/usr.bin/tip/tip/tip.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/tip/tip/tip.c ============================================================================== --- stable/12/usr.bin/tip/tip/tip.c Tue Dec 3 22:54:24 2019 (r355368) +++ stable/12/usr.bin/tip/tip/tip.c Tue Dec 3 22:57:10 2019 (r355369) @@ -252,7 +252,6 @@ cucommon: tipin(); else tipout(); - /*NOTREACHED*/ exit(0); } @@ -402,11 +401,16 @@ tipin(void) } while (1) { - gch = getchar()&STRIP_PAR; - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; if ((gch == character(value(ESCAPE))) && bol) { if (!noesc) { - if (!(gch = escape())) + gch = escape(); + if (gch == EOF) + return; + if (gch == 0) continue; } } else if (!cumode && gch == character(value(RAISECHAR))) { @@ -420,7 +424,10 @@ tipin(void) printf("\r\n"); continue; } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()&STRIP_PAR; + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -444,8 +451,10 @@ escape(void) esctable_t *p; char c = character(value(ESCAPE)); - gch = (getchar()&STRIP_PAR); - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return (EOF); + gch = gch & STRIP_PAR; for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) From owner-svn-src-all@freebsd.org Tue Dec 3 22:59:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0A091C0E0C; Tue, 3 Dec 2019 22:59:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHW03nYRz45ZV; Tue, 3 Dec 2019 22:59:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61F201EE3E; Tue, 3 Dec 2019 22:59:56 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3MxuMx011042; Tue, 3 Dec 2019 22:59:56 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Mxu2D011041; Tue, 3 Dec 2019 22:59:56 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201912032259.xB3Mxu2D011041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Tue, 3 Dec 2019 22:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355370 - stable/11/usr.bin/tip/tip X-SVN-Group: stable-11 X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: stable/11/usr.bin/tip/tip X-SVN-Commit-Revision: 355370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 22:59:56 -0000 Author: vangyzen Date: Tue Dec 3 22:59:55 2019 New Revision: 355370 URL: https://svnweb.freebsd.org/changeset/base/355370 Log: MFC r354624 tip/cu: check for EOF on input on the local side If cu reads an EOF on the input side, it goes into a tight loop sending a garbage byte to the remote. With this change, it exits gracefully, along with its child. Sponsored by: Dell EMC Isilon Modified: stable/11/usr.bin/tip/tip/tip.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/tip/tip/tip.c ============================================================================== --- stable/11/usr.bin/tip/tip/tip.c Tue Dec 3 22:57:10 2019 (r355369) +++ stable/11/usr.bin/tip/tip/tip.c Tue Dec 3 22:59:55 2019 (r355370) @@ -250,7 +250,6 @@ cucommon: tipin(); else tipout(); - /*NOTREACHED*/ exit(0); } @@ -400,11 +399,16 @@ tipin(void) } while (1) { - gch = getchar()&STRIP_PAR; - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; if ((gch == character(value(ESCAPE))) && bol) { if (!noesc) { - if (!(gch = escape())) + gch = escape(); + if (gch == EOF) + return; + if (gch == 0) continue; } } else if (!cumode && gch == character(value(RAISECHAR))) { @@ -418,7 +422,10 @@ tipin(void) printf("\r\n"); continue; } else if (!cumode && gch == character(value(FORCE))) - gch = getchar()&STRIP_PAR; + gch = getchar(); + if (gch == EOF) + return; + gch = gch & STRIP_PAR; bol = any(gch, value(EOL)); if (boolean(value(RAISE)) && islower(gch)) gch = toupper(gch); @@ -442,8 +449,10 @@ escape(void) esctable_t *p; char c = character(value(ESCAPE)); - gch = (getchar()&STRIP_PAR); - /* XXX does not check for EOF */ + gch = getchar(); + if (gch == EOF) + return (EOF); + gch = gch & STRIP_PAR; for (p = etable; p->e_char; p++) if (p->e_char == gch) { if ((p->e_flags&PRIV) && uid) From owner-svn-src-all@freebsd.org Tue Dec 3 23:07:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F7321C12CC; Tue, 3 Dec 2019 23:07:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHgM0TwWz46N7; Tue, 3 Dec 2019 23:07:11 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E93F81F012; Tue, 3 Dec 2019 23:07:10 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3N7Ax8016928; Tue, 3 Dec 2019 23:07:10 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3N79DG016921; Tue, 3 Dec 2019 23:07:09 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201912032307.xB3N79DG016921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 3 Dec 2019 23:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355371 - in head/sys: kern sys ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in head/sys: kern sys ufs/ffs X-SVN-Commit-Revision: 355371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 23:07:11 -0000 Author: mckusick Date: Tue Dec 3 23:07:09 2019 New Revision: 355371 URL: https://svnweb.freebsd.org/changeset/base/355371 Log: Currently the breadn_flags() and getblkx() interfaces are passed the vnode, logical block number, and size of data block that is being requested. They then use the VOP_BMAP function to calculate the mapping from logical block number to physical block number from which to access the data. This change expands the interface to also pass the physical block number in cases where the VOP_MAP function may no longer work, for example when a file is being truncated. No functional change. Reviewed by: kib Tested by: Peter Holm Sponsored by: Netflix Modified: head/sys/kern/vfs_bio.c head/sys/kern/vfs_cluster.c head/sys/sys/buf.h head/sys/ufs/ffs/ffs_alloc.c head/sys/ufs/ffs/ffs_inode.c head/sys/ufs/ffs/ffs_softdep.c head/sys/ufs/ffs/ffs_vnops.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/kern/vfs_bio.c Tue Dec 3 23:07:09 2019 (r355371) @@ -2126,10 +2126,17 @@ breada(struct vnode * vp, daddr_t * rablkno, int * rab * getblk(). Also starts asynchronous I/O on read-ahead blocks. * * Always return a NULL buffer pointer (in bpp) when returning an error. + * + * The blkno parameter is the logical block being requested. Normally + * the mapping of logical block number to disk block address is done + * by calling VOP_BMAP(). However, if the mapping is already known, the + * disk block address can be passed using the dblkno parameter. If the + * disk block address is not known, then the same value should be passed + * for blkno and dblkno. */ int -breadn_flags(struct vnode *vp, daddr_t blkno, int size, daddr_t *rablkno, - int *rabsize, int cnt, struct ucred *cred, int flags, +breadn_flags(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, + daddr_t *rablkno, int *rabsize, int cnt, struct ucred *cred, int flags, void (*ckhashfunc)(struct buf *), struct buf **bpp) { struct buf *bp; @@ -2142,11 +2149,14 @@ breadn_flags(struct vnode *vp, daddr_t blkno, int size * Can only return NULL if GB_LOCK_NOWAIT or GB_SPARSE flags * are specified. */ - error = getblkx(vp, blkno, size, 0, 0, flags, &bp); + error = getblkx(vp, blkno, dblkno, size, 0, 0, flags, &bp); if (error != 0) { *bpp = NULL; return (error); } + KASSERT(blkno == bp->b_lblkno, + ("getblkx returned buffer for blkno %jd instead of blkno %jd", + (intmax_t)bp->b_lblkno, (intmax_t)blkno)); flags &= ~GB_NOSPARSE; *bpp = bp; @@ -3791,7 +3801,7 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int struct buf *bp; int error; - error = getblkx(vp, blkno, size, slpflag, slptimeo, flags, &bp); + error = getblkx(vp, blkno, blkno, size, slpflag, slptimeo, flags, &bp); if (error != 0) return (NULL); return (bp); @@ -3819,7 +3829,7 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int * case it is returned with B_INVAL clear and B_CACHE set based on the * backing VM. * - * getblk() also forces a bwrite() for any B_DELWRI buffer whos + * getblk() also forces a bwrite() for any B_DELWRI buffer whose * B_CACHE bit is clear. * * What this means, basically, is that the caller should use B_CACHE to @@ -3832,10 +3842,17 @@ getblk(struct vnode *vp, daddr_t blkno, int size, int * a write attempt or if it was a successful read. If the caller * intends to issue a READ, the caller must clear B_INVAL and BIO_ERROR * prior to issuing the READ. biodone() will *not* clear B_INVAL. + * + * The blkno parameter is the logical block being requested. Normally + * the mapping of logical block number to disk block address is done + * by calling VOP_BMAP(). However, if the mapping is already known, the + * disk block address can be passed using the dblkno parameter. If the + * disk block address is not known, then the same value should be passed + * for blkno and dblkno. */ int -getblkx(struct vnode *vp, daddr_t blkno, int size, int slpflag, int slptimeo, - int flags, struct buf **bpp) +getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, int slpflag, + int slptimeo, int flags, struct buf **bpp) { struct buf *bp; struct bufobj *bo; @@ -3854,7 +3871,7 @@ getblkx(struct vnode *vp, daddr_t blkno, int size, int flags &= ~(GB_UNMAPPED | GB_KVAALLOC); bo = &vp->v_bufobj; - d_blkno = blkno; + d_blkno = dblkno; loop: BO_RLOCK(bo); bp = gbincore(bo, blkno); Modified: head/sys/kern/vfs_cluster.c ============================================================================== --- head/sys/kern/vfs_cluster.c Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/kern/vfs_cluster.c Tue Dec 3 23:07:09 2019 (r355371) @@ -131,7 +131,7 @@ cluster_read(struct vnode *vp, u_quad_t filesize, dadd /* * get the requested block */ - error = getblkx(vp, lblkno, size, 0, 0, gbflags, &bp); + error = getblkx(vp, lblkno, lblkno, size, 0, 0, gbflags, &bp); if (error != 0) { *bpp = NULL; return (error); Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/sys/buf.h Tue Dec 3 23:07:09 2019 (r355371) @@ -520,15 +520,16 @@ int buf_dirty_count_severe(void); void bremfree(struct buf *); void bremfreef(struct buf *); /* XXX Force bremfree, only for nfs. */ #define bread(vp, blkno, size, cred, bpp) \ - breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, 0, NULL, bpp) + breadn_flags(vp, blkno, blkno, size, NULL, NULL, 0, cred, 0, \ + NULL, bpp) #define bread_gb(vp, blkno, size, cred, gbflags, bpp) \ - breadn_flags(vp, blkno, size, NULL, NULL, 0, cred, \ + breadn_flags(vp, blkno, blkno, size, NULL, NULL, 0, cred, \ gbflags, NULL, bpp) #define breadn(vp, blkno, size, rablkno, rabsize, cnt, cred, bpp) \ - breadn_flags(vp, blkno, size, rablkno, rabsize, cnt, cred, \ + breadn_flags(vp, blkno, blkno, size, rablkno, rabsize, cnt, cred, \ 0, NULL, bpp) -int breadn_flags(struct vnode *, daddr_t, int, daddr_t *, int *, int, - struct ucred *, int, void (*)(struct buf *), struct buf **); +int breadn_flags(struct vnode *, daddr_t, daddr_t, int, daddr_t *, int *, + int, struct ucred *, int, void (*)(struct buf *), struct buf **); void bdwrite(struct buf *); void bawrite(struct buf *); void babarrierwrite(struct buf *); @@ -544,8 +545,8 @@ void vfs_busy_pages_release(struct buf *bp); struct buf *incore(struct bufobj *, daddr_t); struct buf *gbincore(struct bufobj *, daddr_t); struct buf *getblk(struct vnode *, daddr_t, int, int, int, int); -int getblkx(struct vnode *vp, daddr_t blkno, int size, int slpflag, - int slptimeo, int flags, struct buf **bpp); +int getblkx(struct vnode *vp, daddr_t blkno, daddr_t dblkno, int size, + int slpflag, int slptimeo, int flags, struct buf **bpp); struct buf *geteblk(int, int); int bufwait(struct buf *); int bufwrite(struct buf *); Modified: head/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_alloc.c Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/ufs/ffs/ffs_alloc.c Tue Dec 3 23:07:09 2019 (r355371) @@ -2955,16 +2955,19 @@ ffs_getcg(fs, devvp, cg, flags, bpp, cgpp) struct buf *bp; struct cg *cgp; const struct statfs *sfs; + daddr_t blkno; int error; *bpp = NULL; *cgpp = NULL; if ((fs->fs_metackhash & CK_CYLGRP) != 0) flags |= GB_CKHASH; - error = breadn_flags(devvp, devvp->v_type == VREG ? - fragstoblks(fs, cgtod(fs, cg)) : fsbtodb(fs, cgtod(fs, cg)), - (int)fs->fs_cgsize, NULL, NULL, 0, NOCRED, flags, - ffs_ckhash_cg, &bp); + if (devvp->v_type == VREG) + blkno = fragstoblks(fs, cgtod(fs, cg)); + else + blkno = fsbtodb(fs, cgtod(fs, cg)); + error = breadn_flags(devvp, blkno, blkno, (int)fs->fs_cgsize, NULL, + NULL, 0, NOCRED, flags, ffs_ckhash_cg, &bp); if (error != 0) return (error); cgp = (struct cg *)bp->b_data; Modified: head/sys/ufs/ffs/ffs_inode.c ============================================================================== --- head/sys/ufs/ffs/ffs_inode.c Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/ufs/ffs/ffs_inode.c Tue Dec 3 23:07:09 2019 (r355371) @@ -678,34 +678,14 @@ ffs_indirtrunc(ip, lbn, dbn, lastbn, level, countp) * Get buffer of block pointers, zero those entries corresponding * to blocks to be free'd, and update on disk copy first. Since * double(triple) indirect before single(double) indirect, calls - * to bmap on these blocks will fail. However, we already have - * the on disk address, so we have to set the b_blkno field - * explicitly instead of letting bread do everything for us. + * to VOP_BMAP() on these blocks will fail. However, we already + * have the on-disk address, so we just pass it to bread() instead + * of having bread() attempt to calculate it using VOP_BMAP(). */ vp = ITOV(ip); - bp = getblk(vp, lbn, (int)fs->fs_bsize, 0, 0, 0); - if ((bp->b_flags & B_CACHE) == 0) { -#ifdef RACCT - if (racct_enable) { - PROC_LOCK(curproc); - racct_add_buf(curproc, bp, 0); - PROC_UNLOCK(curproc); - } -#endif /* RACCT */ - curthread->td_ru.ru_inblock++; /* pay for read */ - bp->b_iocmd = BIO_READ; - bp->b_flags &= ~B_INVAL; - bp->b_ioflags &= ~BIO_ERROR; - if (bp->b_bcount > bp->b_bufsize) - panic("ffs_indirtrunc: bad buffer size"); - bp->b_blkno = dbn; - vfs_busy_pages(bp, 0); - bp->b_iooffset = dbtob(bp->b_blkno); - bstrategy(bp); - error = bufwait(bp); - } + error = breadn_flags(vp, lbn, dbn, (int)fs->fs_bsize, NULL, NULL, 0, + NOCRED, 0, NULL, &bp); if (error) { - brelse(bp); *countp = 0; return (error); } Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/ufs/ffs/ffs_softdep.c Tue Dec 3 23:07:09 2019 (r355371) @@ -6294,29 +6294,15 @@ setup_trunc_indir(freeblks, ip, lbn, lastlbn, blkno) return (0); mp = freeblks->fb_list.wk_mp; ump = VFSTOUFS(mp); - bp = getblk(ITOV(ip), lbn, mp->mnt_stat.f_iosize, 0, 0, 0); - if ((bp->b_flags & B_CACHE) == 0) { - bp->b_blkno = blkptrtodb(VFSTOUFS(mp), blkno); - bp->b_iocmd = BIO_READ; - bp->b_flags &= ~B_INVAL; - bp->b_ioflags &= ~BIO_ERROR; - vfs_busy_pages(bp, 0); - bp->b_iooffset = dbtob(bp->b_blkno); - bstrategy(bp); -#ifdef RACCT - if (racct_enable) { - PROC_LOCK(curproc); - racct_add_buf(curproc, bp, 0); - PROC_UNLOCK(curproc); - } -#endif /* RACCT */ - curthread->td_ru.ru_inblock++; - error = bufwait(bp); - if (error) { - brelse(bp); - return (error); - } - } + /* + * Here, calls to VOP_BMAP() will fail. However, we already have + * the on-disk address, so we just pass it to bread() instead of + * having bread() attempt to calculate it using VOP_BMAP(). + */ + error = breadn_flags(ITOV(ip), lbn, blkptrtodb(ump, blkno), + (int)mp->mnt_stat.f_iosize, NULL, NULL, 0, NOCRED, 0, NULL, &bp); + if (error) + return (error); level = lbn_level(lbn); lbnadd = lbn_offset(ump->um_fs, level); /* Modified: head/sys/ufs/ffs/ffs_vnops.c ============================================================================== --- head/sys/ufs/ffs/ffs_vnops.c Tue Dec 3 22:59:55 2019 (r355370) +++ head/sys/ufs/ffs/ffs_vnops.c Tue Dec 3 23:07:09 2019 (r355371) @@ -603,7 +603,7 @@ ffs_read(ap) * the 6th argument. */ u_int nextsize = blksize(fs, ip, nextlbn); - error = breadn_flags(vp, lbn, size, &nextlbn, + error = breadn_flags(vp, lbn, lbn, size, &nextlbn, &nextsize, 1, NOCRED, bflag, NULL, &bp); } else { /* From owner-svn-src-all@freebsd.org Tue Dec 3 23:11:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A57E91C1514; Tue, 3 Dec 2019 23:11:41 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHmY3rJ3z46kT; Tue, 3 Dec 2019 23:11:41 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 670DB1F073; Tue, 3 Dec 2019 23:11:41 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3NBfCa017928; Tue, 3 Dec 2019 23:11:41 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3NBfLB017927; Tue, 3 Dec 2019 23:11:41 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <201912032311.xB3NBfLB017927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Tue, 3 Dec 2019 23:11: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: r355372 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 355372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 23:11:41 -0000 Author: wulf Date: Tue Dec 3 23:11:40 2019 New Revision: 355372 URL: https://svnweb.freebsd.org/changeset/base/355372 Log: MFC r355065 - r355068: Linux epoll improvements. r355065: Linux epoll: Don't deregister file descriptor after EPOLLONESHOT is fired Linux epoll does not remove descriptor after one-shot event has been triggered. Set EV_DISPATCH kqueue flag rather then EV_ONESHOT to get the same behavior. Required by Linux Steam client. PR: 240590 Reported by: Alex S Reviewed by: emaste, imp Differential Revision: https://reviews.freebsd.org/D22513 r355066: Linux epoll: Check both read and write kqueue events existence in EPOLL_CTL_ADD Linux epoll EPOLL_CTL_ADD op handler should always check registration of both EVFILT_READ and EVFILT_WRITE kevents to deceide if supplied file descriptor fd is already registered with epoll instance. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22515 r355067: Linux epoll: Register events with zero event mask Such an events are legal and should be interpreted as EPOLLERR | EPOLLHUP. Register a disabled kqueue event in that case as we do not support EPOLLHUP yet. Required by Linux Steam client. PR: 240590 Reported by: Alex S Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22516 r355068: Linux epoll: Allow passing of any negative timeout value to epoll_wait Linux epoll allow passing of any negative timeout value to epoll_wait() to cause unbound blocking Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D22517 Modified: stable/12/sys/compat/linux/linux_event.c stable/12/sys/compat/linux/linux_event.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux_event.c ============================================================================== --- stable/12/sys/compat/linux/linux_event.c Tue Dec 3 23:07:09 2019 (r355371) +++ stable/12/sys/compat/linux/linux_event.c Tue Dec 3 23:11:40 2019 (r355372) @@ -98,14 +98,16 @@ __attribute__((packed)) #define LINUX_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event)) static void epoll_fd_install(struct thread *td, int fd, epoll_udata_t udata); -static int epoll_to_kevent(struct thread *td, struct file *epfp, - int fd, struct epoll_event *l_event, int *kev_flags, - struct kevent *kevent, int *nkevents); +static int epoll_to_kevent(struct thread *td, int fd, + struct epoll_event *l_event, struct kevent *kevent, + int *nkevents); static void kevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event); static int epoll_kev_copyout(void *arg, struct kevent *kevp, int count); static int epoll_kev_copyin(void *arg, struct kevent *kevp, int count); -static int epoll_delete_event(struct thread *td, struct file *epfp, - int fd, int filter); +static int epoll_register_kevent(struct thread *td, struct file *epfp, + int fd, int filter, unsigned int flags); +static int epoll_fd_registered(struct thread *td, struct file *epfp, + int fd); static int epoll_delete_all_events(struct thread *td, struct file *epfp, int fd); @@ -296,33 +298,38 @@ linux_epoll_create1(struct thread *td, struct linux_ep /* Structure converting function from epoll to kevent. */ static int -epoll_to_kevent(struct thread *td, struct file *epfp, - int fd, struct epoll_event *l_event, int *kev_flags, +epoll_to_kevent(struct thread *td, int fd, struct epoll_event *l_event, struct kevent *kevent, int *nkevents) { uint32_t levents = l_event->events; struct linux_pemuldata *pem; struct proc *p; + unsigned short kev_flags = EV_ADD | EV_ENABLE; /* flags related to how event is registered */ if ((levents & LINUX_EPOLLONESHOT) != 0) - *kev_flags |= EV_ONESHOT; + kev_flags |= EV_DISPATCH; if ((levents & LINUX_EPOLLET) != 0) - *kev_flags |= EV_CLEAR; + kev_flags |= EV_CLEAR; if ((levents & LINUX_EPOLLERR) != 0) - *kev_flags |= EV_ERROR; + kev_flags |= EV_ERROR; if ((levents & LINUX_EPOLLRDHUP) != 0) - *kev_flags |= EV_EOF; + kev_flags |= EV_EOF; /* flags related to what event is registered */ if ((levents & LINUX_EPOLL_EVRD) != 0) { - EV_SET(kevent++, fd, EVFILT_READ, *kev_flags, 0, 0, 0); + EV_SET(kevent++, fd, EVFILT_READ, kev_flags, 0, 0, 0); ++(*nkevents); } if ((levents & LINUX_EPOLL_EVWR) != 0) { - EV_SET(kevent++, fd, EVFILT_WRITE, *kev_flags, 0, 0, 0); + EV_SET(kevent++, fd, EVFILT_WRITE, kev_flags, 0, 0, 0); ++(*nkevents); } + /* zero event mask is legal */ + if ((levents & (LINUX_EPOLL_EVRD | LINUX_EPOLL_EVWR)) == 0) { + EV_SET(kevent++, fd, EVFILT_READ, EV_ADD|EV_DISABLE, 0, 0, 0); + ++(*nkevents); + } if ((levents & ~(LINUX_EPOLL_EVSUP)) != 0) { p = td->td_proc; @@ -451,7 +458,6 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ epoll_kev_copyin}; struct epoll_event le; cap_rights_t rights; - int kev_flags; int nchanges = 0; int error; @@ -484,9 +490,7 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ ciargs.changelist = kev; if (args->op != LINUX_EPOLL_CTL_DEL) { - kev_flags = EV_ADD | EV_ENABLE; - error = epoll_to_kevent(td, epfp, args->fd, &le, - &kev_flags, kev, &nchanges); + error = epoll_to_kevent(td, args->fd, &le, kev, &nchanges); if (error != 0) goto leave0; } @@ -499,18 +503,10 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ break; case LINUX_EPOLL_CTL_ADD: - /* - * kqueue_register() return ENOENT if event does not exists - * and the EV_ADD flag is not set. - */ - kev[0].flags &= ~EV_ADD; - error = kqfd_register(args->epfd, &kev[0], td, M_WAITOK); - if (error != ENOENT) { + if (epoll_fd_registered(td, epfp, args->fd)) { error = EEXIST; goto leave0; } - error = 0; - kev[0].flags |= EV_ADD; break; case LINUX_EPOLL_CTL_DEL: @@ -561,13 +557,13 @@ linux_epoll_wait_common(struct thread *td, int epfd, s return (error); if (epfp->f_type != DTYPE_KQUEUE) { error = EINVAL; - goto leave1; + goto leave; } if (uset != NULL) { error = kern_sigprocmask(td, SIG_SETMASK, uset, &omask, 0); if (error != 0) - goto leave1; + goto leave; td->td_pflags |= TDP_OLDMASK; /* * Make sure that ast() is called on return to @@ -585,11 +581,12 @@ linux_epoll_wait_common(struct thread *td, int epfd, s coargs.count = 0; coargs.error = 0; - if (timeout != -1) { - if (timeout < 0) { - error = EINVAL; - goto leave0; - } + /* + * Linux epoll_wait(2) man page states that timeout of -1 causes caller + * to block indefinitely. Real implementation does it if any negative + * timeout value is passed. + */ + if (timeout >= 0) { /* Convert from milliseconds to timespec. */ ts.tv_sec = timeout / 1000; ts.tv_nsec = (timeout % 1000) * 1000000; @@ -609,11 +606,10 @@ linux_epoll_wait_common(struct thread *td, int epfd, s if (error == 0) td->td_retval[0] = coargs.count; -leave0: if (uset != NULL) error = kern_sigprocmask(td, SIG_SETMASK, &omask, NULL, 0); -leave1: +leave: fdrop(epfp, td); return (error); } @@ -650,7 +646,8 @@ linux_epoll_pwait(struct thread *td, struct linux_epol } static int -epoll_delete_event(struct thread *td, struct file *epfp, int fd, int filter) +epoll_register_kevent(struct thread *td, struct file *epfp, int fd, int filter, + unsigned int flags) { struct epoll_copyin_args ciargs; struct kevent kev; @@ -659,18 +656,36 @@ epoll_delete_event(struct thread *td, struct file *epf epoll_kev_copyin}; ciargs.changelist = &kev; - EV_SET(&kev, fd, filter, EV_DELETE | EV_DISABLE, 0, 0, 0); + EV_SET(&kev, fd, filter, flags, 0, 0, 0); return (kern_kevent_fp(td, epfp, 1, 0, &k_ops, NULL)); } static int +epoll_fd_registered(struct thread *td, struct file *epfp, int fd) +{ + /* + * Set empty filter flags to avoid accidental modification of already + * registered events. In the case of event re-registration: + * 1. If event does not exists kevent() does nothing and returns ENOENT + * 2. If event does exists, it's enabled/disabled state is preserved + * but fflags, data and udata fields are overwritten. So we can not + * set socket lowats and store user's context pointer in udata. + */ + if (epoll_register_kevent(td, epfp, fd, EVFILT_READ, 0) != ENOENT || + epoll_register_kevent(td, epfp, fd, EVFILT_WRITE, 0) != ENOENT) + return (1); + + return (0); +} + +static int epoll_delete_all_events(struct thread *td, struct file *epfp, int fd) { int error1, error2; - error1 = epoll_delete_event(td, epfp, fd, EVFILT_READ); - error2 = epoll_delete_event(td, epfp, fd, EVFILT_WRITE); + error1 = epoll_register_kevent(td, epfp, fd, EVFILT_READ, EV_DELETE); + error2 = epoll_register_kevent(td, epfp, fd, EVFILT_WRITE, EV_DELETE); /* return 0 if at least one result positive */ return (error1 == 0 ? 0 : error2); Modified: stable/12/sys/compat/linux/linux_event.h ============================================================================== --- stable/12/sys/compat/linux/linux_event.h Tue Dec 3 23:07:09 2019 (r355371) +++ stable/12/sys/compat/linux/linux_event.h Tue Dec 3 23:11:40 2019 (r355372) @@ -45,10 +45,10 @@ #define LINUX_EPOLLONESHOT 1u<<30 #define LINUX_EPOLLET 1u<<31 -#define LINUX_EPOLL_EVRD (LINUX_EPOLLIN|LINUX_EPOLLRDNORM \ - |LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI) +#define LINUX_EPOLL_EVRD (LINUX_EPOLLIN|LINUX_EPOLLRDNORM) #define LINUX_EPOLL_EVWR (LINUX_EPOLLOUT|LINUX_EPOLLWRNORM) #define LINUX_EPOLL_EVSUP (LINUX_EPOLLET|LINUX_EPOLLONESHOT \ + |LINUX_EPOLLHUP|LINUX_EPOLLERR|LINUX_EPOLLPRI \ |LINUX_EPOLL_EVRD|LINUX_EPOLL_EVWR|LINUX_EPOLLRDHUP) #define LINUX_EPOLL_CTL_ADD 1 From owner-svn-src-all@freebsd.org Tue Dec 3 23:17:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E0A11C18B4; Tue, 3 Dec 2019 23:17:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHvq3Ywbz475D; Tue, 3 Dec 2019 23:17:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 594C01F1D9; Tue, 3 Dec 2019 23:17:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3NHxv4022882; Tue, 3 Dec 2019 23:17:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3NHsjB022858; Tue, 3 Dec 2019 23:17:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912032317.xB3NHsjB022858@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Dec 2019 23:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355373 - in head/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/ia32 amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm64/arm64 arm64/cloudabi32 arm64/cloudabi64 arm64/linu... X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/ia32 amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm64/arm64 arm64/cloudabi32 arm64/cloudabi64 arm64/linux compat/cloudabi32 compa... X-SVN-Commit-Revision: 355373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 23:17:59 -0000 Author: jhb Date: Tue Dec 3 23:17:54 2019 New Revision: 355373 URL: https://svnweb.freebsd.org/changeset/base/355373 Log: Use uintptr_t instead of register_t * for the stack base. - Use ustringp for the location of the argv and environment strings and allow destp to travel further down the stack for the stackgap and auxv regions. - Update the Linux copyout_strings variants to move destp down the stack as was done for the native ABIs in r263349. - Stop allocating a space for a stack gap in the Linux ABIs. This used to hold translated system call arguments, but hasn't been used since r159992. Reviewed by: kib Tested on: md64 (amd64, i386, linux64), i386 (i386, linux) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22501 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/cloudabi32/cloudabi32_sysvec.c head/sys/amd64/cloudabi64/cloudabi64_sysvec.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/arm/arm/machdep.c head/sys/arm/cloudabi32/cloudabi32_sysvec.c head/sys/arm64/arm64/elf32_machdep.c head/sys/arm64/arm64/machdep.c head/sys/arm64/cloudabi32/cloudabi32_sysvec.c head/sys/arm64/cloudabi64/cloudabi64_sysvec.c head/sys/arm64/linux/linux_sysvec.c head/sys/compat/cloudabi32/cloudabi32_module.c head/sys/compat/cloudabi32/cloudabi32_util.h head/sys/compat/cloudabi64/cloudabi64_module.c head/sys/compat/cloudabi64/cloudabi64_util.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/freebsd32_util.h head/sys/compat/ia32/ia32_signal.h head/sys/i386/cloudabi32/cloudabi32_sysvec.c head/sys/i386/i386/machdep.c head/sys/i386/linux/linux_sysvec.c head/sys/kern/imgact_aout.c head/sys/kern/imgact_elf.c head/sys/kern/kern_exec.c head/sys/mips/mips/freebsd32_machdep.c head/sys/mips/mips/pm_machdep.c head/sys/powerpc/include/reg.h head/sys/powerpc/powerpc/elf64_machdep.c head/sys/powerpc/powerpc/exec_machdep.c head/sys/riscv/riscv/machdep.c head/sys/sparc64/sparc64/machdep.c head/sys/sys/imgact.h head/sys/sys/imgact_elf.h head/sys/sys/sysent.h Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/amd64/amd64/machdep.c Tue Dec 3 23:17:54 2019 (r355373) @@ -577,7 +577,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_ * Reset registers to default values on exec. */ void -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *regs; struct pcb *pcb; Modified: head/sys/amd64/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -53,7 +53,7 @@ extern struct sysent cloudabi32_sysent[]; extern unsigned long ia32_maxssiz; static int -cloudabi32_fixup_tcb(register_t **stack_base, struct image_params *imgp) +cloudabi32_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) { int error; uint32_t args[2]; @@ -73,16 +73,16 @@ cloudabi32_fixup_tcb(register_t **stack_base, struct i * refer to the auxiliary vector, which is stored right after * the TCB. */ - args[0] = (uintptr_t)*stack_base; - args[1] = (uintptr_t)*stack_base + + args[0] = *stack_base; + args[1] = *stack_base + roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); - *stack_base -= howmany(sizeof(args), sizeof(register_t)); - return (copyout(args, *stack_base, sizeof(args))); + *stack_base -= roundup2(sizeof(args), sizeof(register_t)); + return (copyout(args, (void *)*stack_base, sizeof(args))); } static void cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, - unsigned long stack) + uintptr_t stack) { ia32_setregs(td, imgp, stack); Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -48,7 +48,7 @@ extern const char *cloudabi64_syscallnames[]; extern struct sysent cloudabi64_sysent[]; static int -cloudabi64_fixup_tcb(register_t **stack_base, struct image_params *imgp) +cloudabi64_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) { int error; register_t tcbptr; @@ -64,12 +64,13 @@ cloudabi64_fixup_tcb(register_t **stack_base, struct i * containing a pointer to the TCB. %fs base will point to this. */ tcbptr = (register_t)*stack_base; - return (copyout(&tcbptr, --*stack_base, sizeof(tcbptr))); + *stack_base -= sizeof(tcbptr); + return (copyout(&tcbptr, (void *)*stack_base, sizeof(tcbptr))); } static void cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, - unsigned long stack) + uintptr_t stack) { struct trapframe *regs; Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/amd64/ia32/ia32_signal.c Tue Dec 3 23:17:54 2019 (r355373) @@ -936,7 +936,7 @@ freebsd32_sigreturn(td, uap) * Clear registers on exec */ void -ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack) +ia32_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *regs; struct pcb *pcb; Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/amd64/linux/linux_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -97,8 +97,8 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static int linux_copyout_strings(struct image_params *imgp, - register_t **stack_base); -static int linux_fixup_elf(register_t **stack_base, + uintptr_t *stack_base); +static int linux_fixup_elf(uintptr_t *stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); @@ -106,7 +106,7 @@ static void linux_vdso_deinstall(void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, - u_long stack); + uintptr_t stack); static int linux_vsyscall(struct thread *td); #define LINUX_T_UNKNOWN 255 @@ -224,7 +224,7 @@ linux_set_syscall_retval(struct thread *td, int error) } static int -linux_copyout_auxargs(struct image_params *imgp, u_long *base) +linux_copyout_auxargs(struct image_params *imgp, uintptr_t *base) { Elf_Auxargs *args; Elf_Auxinfo *argarray, *pos; @@ -274,7 +274,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon } static int -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp) { Elf_Addr *base; @@ -283,7 +283,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ if (suword(base, (uint64_t)imgp->args->argc) == -1) return (EFAULT); - *stack_base = (register_t *)base; + *stack_base = (uintptr_t)base; return (0); } @@ -293,11 +293,12 @@ linux_fixup_elf(register_t **stack_base, struct image_ * as the initial stack pointer. */ static int -linux_copyout_strings(struct image_params *imgp, register_t **stack_base) +linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) { int argc, envc, error; char **vectp; - char *stringp, *destp; + char *stringp; + uintptr_t destp, ustringp; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; @@ -311,43 +312,45 @@ linux_copyout_strings(struct image_params *imgp, regis p = imgp->proc; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; - destp = (caddr_t)arginfo - SPARE_USRSPACE - - roundup(sizeof(canary), sizeof(char *)) - - roundup(execpath_len, sizeof(char *)) - - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); + destp = (uintptr_t)arginfo; if (execpath_len != 0) { - imgp->execpathp = (uintptr_t)arginfo - execpath_len; - error = copyout(imgp->execpath, (void *)imgp->execpathp, - execpath_len); + destp -= execpath_len; + destp = rounddown2(destp, sizeof(void *)); + imgp->execpathp = destp; + error = copyout(imgp->execpath, (void *)destp, execpath_len); if (error != 0) return (error); } /* Prepare the canary for SSP. */ arc4rand(canary, sizeof(canary), 0); - imgp->canary = (uintptr_t)arginfo - - roundup(execpath_len, sizeof(char *)) - - roundup(sizeof(canary), sizeof(char *)); - error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + destp -= roundup(sizeof(canary), sizeof(void *)); + imgp->canary = destp; + error = copyout(canary, (void *)destp, sizeof(canary)); if (error != 0) return (error); - vectp = (char **)destp; + /* Allocate room for the argument and environment strings. */ + destp -= ARG_MAX - imgp->args->stringspace; + destp = rounddown2(destp, sizeof(void *)); + ustringp = destp; /* * Starting with 2.24, glibc depends on a 16-byte stack alignment. * One "long argc" will be prepended later. */ - vectp = (char **)((((uintptr_t)vectp + 8) & ~0xF) - 8); + if (destp % 16 == 0) + destp -= 8; if (imgp->auxargs) { - error = imgp->sysent->sv_copyout_auxargs(imgp, - (u_long *)&vectp); + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); if (error != 0) return (error); } + vectp = (char **)destp; + /* * Allocate room for the argv[] and env vectors including the * terminating NULL pointers. @@ -355,14 +358,15 @@ linux_copyout_strings(struct image_params *imgp, regis vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ - *stack_base = (register_t *)vectp; + *stack_base = (uintptr_t)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; /* Copy out strings - arguments and environment. */ - error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, (void *)ustringp, + ARG_MAX - imgp->args->stringspace); if (error != 0) return (error); @@ -373,11 +377,11 @@ linux_copyout_strings(struct image_params *imgp, regis /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - if (suword(vectp++, (long)(intptr_t)destp) != 0) + if (suword(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* A null vector table pointer separates the argp's from the envp's. */ @@ -390,11 +394,11 @@ linux_copyout_strings(struct image_params *imgp, regis /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - if (suword(vectp++, (long)(intptr_t)destp) != 0) + if (suword(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* The end of the vector table is a null pointer. */ @@ -408,7 +412,8 @@ linux_copyout_strings(struct image_params *imgp, regis * Reset registers to default values on exec. */ static void -linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, + uintptr_t stack) { struct trapframe *regs; struct pcb *pcb; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -101,13 +101,13 @@ extern struct sysent linux32_sysent[LINUX32_SYS_MAXSYS SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static int linux_fixup_elf(register_t **stack_base, +static int linux_fixup_elf(uintptr_t *stack_base, struct image_params *iparams); static int linux_copyout_strings(struct image_params *imgp, - register_t **stack_base); + uintptr_t *stack_base); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void linux_exec_setregs(struct thread *td, - struct image_params *imgp, u_long stack); + struct image_params *imgp, uintptr_t stack); static void linux32_fixlimit(struct rlimit *rl, int which); static bool linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(void *param); @@ -246,7 +246,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon } static int -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) +linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp) { Elf32_Addr *base; @@ -254,7 +254,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ base--; if (suword32(base, (uint32_t)imgp->args->argc) == -1) return (EFAULT); - *stack_base = (register_t *)base; + *stack_base = (uintptr_t)base; return (0); } @@ -677,7 +677,8 @@ linux32_fetch_syscall_args(struct thread *td) * XXX copied from ia32_signal.c. */ static void -linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, + uintptr_t stack) { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; @@ -721,11 +722,12 @@ linux_exec_setregs(struct thread *td, struct image_par * XXX copied from ia32_sysvec.c. */ static int -linux_copyout_strings(struct image_params *imgp, register_t **stack_base) +linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) { int argc, envc, error; u_int32_t *vectp; - char *stringp, *destp; + char *stringp; + uintptr_t destp, ustringp; struct linux32_ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; @@ -737,36 +739,38 @@ linux_copyout_strings(struct image_params *imgp, regis execpath_len = 0; arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; - destp = (caddr_t)arginfo - SPARE_USRSPACE - - roundup(sizeof(canary), sizeof(char *)) - - roundup(execpath_len, sizeof(char *)) - - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); + destp = (uintptr_t)arginfo; if (execpath_len != 0) { - imgp->execpathp = (uintptr_t)arginfo - execpath_len; - error = copyout(imgp->execpath, (void *)imgp->execpathp, - execpath_len); + destp -= execpath_len; + destp = rounddown2(destp, sizeof(void *)); + imgp->execpathp = destp; + error = copyout(imgp->execpath, (void *)destp, execpath_len); if (error != 0) return (error); } /* Prepare the canary for SSP. */ arc4rand(canary, sizeof(canary), 0); - imgp->canary = (uintptr_t)arginfo - - roundup(execpath_len, sizeof(char *)) - - roundup(sizeof(canary), sizeof(char *)); - error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + destp -= roundup(sizeof(canary), sizeof(void *)); + imgp->canary = destp; + error = copyout(canary, (void *)destp, sizeof(canary)); if (error != 0) return (error); - vectp = (uint32_t *)destp; + /* Allocate room for the argument and environment strings. */ + destp -= ARG_MAX - imgp->args->stringspace; + destp = rounddown2(destp, sizeof(void *)); + ustringp = destp; + if (imgp->auxargs) { - error = imgp->sysent->sv_copyout_auxargs(imgp, - (u_long *)&vectp); + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); if (error != 0) return (error); } + vectp = (uint32_t *)destp; + /* * Allocate room for the argv[] and env vectors including the * terminating NULL pointers. @@ -774,13 +778,15 @@ linux_copyout_strings(struct image_params *imgp, regis vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; /* vectp also becomes our initial stack base. */ - *stack_base = (register_t *)vectp; + *stack_base = (uintptr_t)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; + /* Copy out strings - arguments and environment. */ - error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, (void *)ustringp, + ARG_MAX - imgp->args->stringspace); if (error != 0) return (error); @@ -791,11 +797,11 @@ linux_copyout_strings(struct image_params *imgp, regis /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - if (suword32(vectp++, (uint32_t)(intptr_t)destp) != 0) + if (suword32(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* A null vector table pointer separates the argp's from the envp's. */ @@ -808,11 +814,11 @@ linux_copyout_strings(struct image_params *imgp, regis /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - if (suword32(vectp++, (uint32_t)(intptr_t)destp) != 0) + if (suword32(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* The end of the vector table is a null pointer. */ Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm/arm/machdep.c Tue Dec 3 23:17:54 2019 (r355373) @@ -412,7 +412,7 @@ spinlock_exit(void) * Clear registers on exec */ void -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *tf = td->td_frame; Modified: head/sys/arm/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- head/sys/arm/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -49,7 +49,7 @@ extern struct sysent cloudabi32_sysent[]; static void cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, - unsigned long stack) + uintptr_t stack) { struct trapframe *regs; Modified: head/sys/arm64/arm64/elf32_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf32_machdep.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm64/arm64/elf32_machdep.c Tue Dec 3 23:17:54 2019 (r355373) @@ -232,7 +232,7 @@ freebsd32_set_syscall_retval(struct thread *td, int er static void freebsd32_setregs(struct thread *td, struct image_params *imgp, - u_long stack) + uintptr_t stack) { struct trapframe *tf = td->td_frame; Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm64/arm64/machdep.c Tue Dec 3 23:17:54 2019 (r355373) @@ -436,7 +436,7 @@ ptrace_clear_single_step(struct thread *td) } void -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *tf = td->td_frame; Modified: head/sys/arm64/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- head/sys/arm64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -49,7 +49,7 @@ extern struct sysent cloudabi32_sysent[]; static void cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, - unsigned long stack) + uintptr_t stack) { struct trapframe *regs; Modified: head/sys/arm64/cloudabi64/cloudabi64_sysvec.c ============================================================================== --- head/sys/arm64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -49,7 +49,7 @@ extern struct sysent cloudabi64_sysent[]; static void cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, - unsigned long stack) + uintptr_t stack) { struct trapframe *regs; Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/arm64/linux/linux_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -70,8 +70,8 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static int linux_copyout_strings(struct image_params *imgp, - register_t **stack_base); -static int linux_elf_fixup(register_t **stack_base, + uintptr_t *stack_base); +static int linux_elf_fixup(uintptr_t *stack_base, struct image_params *iparams); static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); static void linux_vdso_install(const void *param); @@ -79,7 +79,7 @@ static void linux_vdso_deinstall(const void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, - u_long stack); + uintptr_t stack); static int linux_vsyscall(struct thread *td); /* DTrace init */ @@ -143,7 +143,7 @@ linux_set_syscall_retval(struct thread *td, int error) } static int -linux_copyout_auxargs(struct image_params *imgp, u_long *base) +linux_copyout_auxargs(struct image_params *imgp, uintptr_t *base) { Elf_Auxargs *args; Elf_Auxinfo *argarray, *pos; @@ -198,7 +198,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon } static int -linux_elf_fixup(register_t **stack_base, struct image_params *imgp) +linux_elf_fixup(uintptr_t *stack_base, struct image_params *imgp) { LIN_SDT_PROBE0(sysvec, linux_elf_fixup, todo); @@ -213,10 +213,11 @@ linux_elf_fixup(register_t **stack_base, struct image_ * LINUXTODO: deduplicate against other linuxulator archs */ static int -linux_copyout_strings(struct image_params *imgp, register_t **stack_base) +linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) { char **vectp; - char *stringp, *destp; + char *stringp; + uintptr_t *destp, *ustringp; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; @@ -231,36 +232,38 @@ linux_copyout_strings(struct image_params *imgp, regis p = imgp->proc; arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; - destp = (caddr_t)arginfo - SPARE_USRSPACE - - roundup(sizeof(canary), sizeof(char *)) - - roundup(execpath_len, sizeof(char *)) - - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); + destp = (uintptr_t)arginfo; if (execpath_len != 0) { - imgp->execpathp = (uintptr_t)arginfo - execpath_len; - error = copyout(imgp->execpath, (void *)imgp->execpathp, - execpath_len); + destp -= execpath_len; + destp = rounddown2(destp, sizeof(void *)); + imgp->execpathp = destp; + error = copyout(imgp->execpath, (void *)destp, execpath_len); if (error != 0) return (error); } /* Prepare the canary for SSP. */ arc4rand(canary, sizeof(canary), 0); - imgp->canary = (uintptr_t)arginfo - - roundup(execpath_len, sizeof(char *)) - - roundup(sizeof(canary), sizeof(char *)); - error = copyout(canary, (void *)imgp->canary, sizeof(canary)); + destp -= roundup(sizeof(canary), sizeof(void *)); + imgp->canary = destp; + error = copyout(canary, (void *)destp, sizeof(canary)); if (error != 0) return (error); - vectp = (char **)destp; + /* Allocate room for the argument and environment strings. */ + destp -= ARG_MAX - imgp->args->stringspace; + destp = rounddown2(destp, sizeof(void *)); + ustringp = destp; + if (imgp->auxargs) { - error = imgp->sysent->sv_copyout_auxargs(imgp, - (u_long *)&vectp); + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); if (error != 0) return (error); } + vectp = (char **)destp; + /* * Allocate room for argc and the argv[] and env vectors including the * terminating NULL pointers. @@ -269,14 +272,15 @@ linux_copyout_strings(struct image_params *imgp, regis vectp = (char **)STACKALIGN(vectp); /* vectp also becomes our initial stack base. */ - *stack_base = (register_t *)vectp; + *stack_base = (uintptr_t)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; envc = imgp->args->envc; /* Copy out strings - arguments and environment. */ - error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); + error = copyout(stringp, (void *)ustringp, + ARG_MAX - imgp->args->stringspace); if (error != 0) return (error); @@ -290,11 +294,11 @@ linux_copyout_strings(struct image_params *imgp, regis /* Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - if (suword(vectp++, (long)(intptr_t)destp) != 0) + if (suword(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* A null vector table pointer separates the argp's from the envp's. */ @@ -307,11 +311,11 @@ linux_copyout_strings(struct image_params *imgp, regis /* Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - if (suword(vectp++, (long)(intptr_t)destp) != 0) + if (suword(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* The end of the vector table is a null pointer. */ @@ -325,7 +329,8 @@ linux_copyout_strings(struct image_params *imgp, regis * Reset registers to default values on exec. */ static void -linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +linux_exec_setregs(struct thread *td, struct image_params *imgp, + uintptr_t stack) { struct trapframe *regs = td->td_frame; Modified: head/sys/compat/cloudabi32/cloudabi32_module.c ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_module.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/cloudabi32/cloudabi32_module.c Tue Dec 3 23:17:54 2019 (r355373) @@ -46,7 +46,7 @@ extern char _binary_cloudabi32_vdso_o_start[]; extern char _binary_cloudabi32_vdso_o_end[]; int -cloudabi32_copyout_strings(struct image_params *imgp, register_t **stack_base) +cloudabi32_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) { struct image_args *args; uintptr_t begin; @@ -56,12 +56,12 @@ cloudabi32_copyout_strings(struct image_params *imgp, args = imgp->args; len = exec_args_get_begin_envv(args) - args->begin_argv; begin = rounddown2(imgp->sysent->sv_usrstack - len, sizeof(register_t)); - *stack_base = (register_t *)begin; + *stack_base = begin; return (copyout(args->begin_argv, (void *)begin, len)); } int -cloudabi32_fixup(register_t **stack_base, struct image_params *imgp) +cloudabi32_fixup(uintptr_t *stack_base, struct image_params *imgp) { char canarybuf[64], pidbuf[16]; Elf32_Auxargs *args; @@ -79,12 +79,12 @@ cloudabi32_fixup(register_t **stack_base, struct image td = curthread; td->td_proc->p_osrel = __FreeBSD_version; - argdata = *stack_base; + argdata = (void *)*stack_base; /* Store canary for stack smashing protection. */ arc4rand(canarybuf, sizeof(canarybuf), 0); - *stack_base -= howmany(sizeof(canarybuf), sizeof(register_t)); - canary = *stack_base; + *stack_base -= roundup(sizeof(canarybuf), sizeof(register_t)); + canary = (void *)*stack_base; error = copyout(canarybuf, canary, sizeof(canarybuf)); if (error != 0) return (error); @@ -97,8 +97,8 @@ cloudabi32_fixup(register_t **stack_base, struct image arc4rand(pidbuf, sizeof(pidbuf), 0); pidbuf[6] = (pidbuf[6] & 0x0f) | 0x40; pidbuf[8] = (pidbuf[8] & 0x3f) | 0x80; - *stack_base -= howmany(sizeof(pidbuf), sizeof(register_t)); - pid = *stack_base; + *stack_base -= roundup(sizeof(pidbuf), sizeof(register_t)); + pid = (void *)*stack_base; error = copyout(pidbuf, pid, sizeof(pidbuf)); if (error != 0) return (error); @@ -135,13 +135,13 @@ cloudabi32_fixup(register_t **stack_base, struct image #undef PTR { .a_type = CLOUDABI_AT_NULL }, }; - *stack_base -= howmany(sizeof(auxv), sizeof(register_t)); - error = copyout(auxv, *stack_base, sizeof(auxv)); + *stack_base -= roundup(sizeof(auxv), sizeof(register_t)); + error = copyout(auxv, (void *)*stack_base, sizeof(auxv)); if (error != 0) return (error); /* Reserve space for storing the TCB. */ - *stack_base -= howmany(sizeof(cloudabi32_tcb_t), sizeof(register_t)); + *stack_base -= roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); return (0); } Modified: head/sys/compat/cloudabi32/cloudabi32_util.h ============================================================================== --- head/sys/compat/cloudabi32/cloudabi32_util.h Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/cloudabi32/cloudabi32_util.h Tue Dec 3 23:17:54 2019 (r355373) @@ -42,8 +42,8 @@ extern Elf32_Brandinfo cloudabi32_brand; #define TO_PTR(x) ((void *)(uintptr_t)(x)) /* Stack initialization during process execution. */ -int cloudabi32_copyout_strings(struct image_params *, register_t **); -int cloudabi32_fixup(register_t **, struct image_params *); +int cloudabi32_copyout_strings(struct image_params *, uintptr_t *); +int cloudabi32_fixup(uintptr_t *, struct image_params *); int cloudabi32_thread_setregs(struct thread *, const cloudabi32_threadattr_t *, uint32_t); Modified: head/sys/compat/cloudabi64/cloudabi64_module.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_module.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/cloudabi64/cloudabi64_module.c Tue Dec 3 23:17:54 2019 (r355373) @@ -46,7 +46,7 @@ extern char _binary_cloudabi64_vdso_o_start[]; extern char _binary_cloudabi64_vdso_o_end[]; int -cloudabi64_copyout_strings(struct image_params *imgp, register_t **stack_base) +cloudabi64_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) { struct image_args *args; uintptr_t begin; @@ -56,12 +56,12 @@ cloudabi64_copyout_strings(struct image_params *imgp, args = imgp->args; len = exec_args_get_begin_envv(args) - args->begin_argv; begin = rounddown2(imgp->sysent->sv_usrstack - len, sizeof(register_t)); - *stack_base = (register_t *)begin; + *stack_base = begin; return (copyout(args->begin_argv, (void *)begin, len)); } int -cloudabi64_fixup(register_t **stack_base, struct image_params *imgp) +cloudabi64_fixup(uintptr_t *stack_base, struct image_params *imgp) { char canarybuf[64], pidbuf[16]; Elf64_Auxargs *args; @@ -79,12 +79,12 @@ cloudabi64_fixup(register_t **stack_base, struct image td = curthread; td->td_proc->p_osrel = __FreeBSD_version; - argdata = *stack_base; + argdata = (void *)*stack_base; /* Store canary for stack smashing protection. */ arc4rand(canarybuf, sizeof(canarybuf), 0); - *stack_base -= howmany(sizeof(canarybuf), sizeof(register_t)); - canary = *stack_base; + *stack_base -= roundup(sizeof(canarybuf), sizeof(register_t)); + canary = (void *)*stack_base; error = copyout(canarybuf, canary, sizeof(canarybuf)); if (error != 0) return (error); @@ -97,8 +97,8 @@ cloudabi64_fixup(register_t **stack_base, struct image arc4rand(pidbuf, sizeof(pidbuf), 0); pidbuf[6] = (pidbuf[6] & 0x0f) | 0x40; pidbuf[8] = (pidbuf[8] & 0x3f) | 0x80; - *stack_base -= howmany(sizeof(pidbuf), sizeof(register_t)); - pid = *stack_base; + *stack_base -= roundup(sizeof(pidbuf), sizeof(register_t)); + pid = (void *)*stack_base; error = copyout(pidbuf, pid, sizeof(pidbuf)); if (error != 0) return (error); @@ -135,13 +135,13 @@ cloudabi64_fixup(register_t **stack_base, struct image #undef PTR { .a_type = CLOUDABI_AT_NULL }, }; - *stack_base -= howmany(sizeof(auxv), sizeof(register_t)); - error = copyout(auxv, *stack_base, sizeof(auxv)); + *stack_base -= roundup(sizeof(auxv), sizeof(register_t)); + error = copyout(auxv, (void *)*stack_base, sizeof(auxv)); if (error != 0) return (error); /* Reserve space for storing the TCB. */ - *stack_base -= howmany(sizeof(cloudabi64_tcb_t), sizeof(register_t)); + *stack_base -= roundup(sizeof(cloudabi64_tcb_t), sizeof(register_t)); return (0); } Modified: head/sys/compat/cloudabi64/cloudabi64_util.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_util.h Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/cloudabi64/cloudabi64_util.h Tue Dec 3 23:17:54 2019 (r355373) @@ -42,8 +42,8 @@ extern Elf64_Brandinfo cloudabi64_brand; #define TO_PTR(x) ((void *)(uintptr_t)(x)) /* Stack initialization during process execution. */ -int cloudabi64_copyout_strings(struct image_params *, register_t **); -int cloudabi64_fixup(register_t **, struct image_params *); +int cloudabi64_copyout_strings(struct image_params *, uintptr_t *); +int cloudabi64_fixup(uintptr_t *, struct image_params *); int cloudabi64_thread_setregs(struct thread *, const cloudabi64_threadattr_t *, uint64_t); Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Dec 3 23:17:54 2019 (r355373) @@ -3120,12 +3120,12 @@ syscall32_helper_unregister(struct syscall_helper_data } int -freebsd32_copyout_strings(struct image_params *imgp, register_t **stack_base) +freebsd32_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) { int argc, envc, i; u_int32_t *vectp; char *stringp; - uintptr_t destp; + uintptr_t destp, ustringp; struct freebsd32_ps_strings *arginfo; char canary[sizeof(long) * 8]; int32_t pagesizes32[MAXPAGESIZES]; @@ -3195,20 +3195,24 @@ freebsd32_copyout_strings(struct image_params *imgp, r return (error); imgp->pagesizeslen = sizeof(pagesizes32); + /* + * Allocate room for the argument and environment strings. + */ destp -= ARG_MAX - imgp->args->stringspace; destp = rounddown2(destp, sizeof(uint32_t)); + ustringp = destp; - vectp = (uint32_t *)destp; if (imgp->sysent->sv_stackgap != NULL) - imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); + imgp->sysent->sv_stackgap(imgp, &destp); if (imgp->auxargs) { - error = imgp->sysent->sv_copyout_auxargs(imgp, - (u_long *)&vectp); + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); if (error != 0) return (error); } + vectp = (uint32_t *)destp; + /* * Allocate room for the argv[] and env vectors including the * terminating NULL pointers. @@ -3218,7 +3222,7 @@ freebsd32_copyout_strings(struct image_params *imgp, r /* * vectp also becomes our initial stack base */ - *stack_base = (register_t *)vectp; + *stack_base = (uintptr_t)vectp; stringp = imgp->args->begin_argv; argc = imgp->args->argc; @@ -3226,7 +3230,7 @@ freebsd32_copyout_strings(struct image_params *imgp, r /* * Copy out strings - arguments and environment. */ - error = copyout(stringp, (void *)destp, + error = copyout(stringp, (void *)ustringp, ARG_MAX - imgp->args->stringspace); if (error != 0) return (error); @@ -3242,11 +3246,11 @@ freebsd32_copyout_strings(struct image_params *imgp, r * Fill in argument portion of vector table. */ for (; argc > 0; --argc) { - if (suword32(vectp++, (u_int32_t)(intptr_t)destp) != 0) + if (suword32(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* a null vector table pointer separates the argp's from the envp's */ @@ -3261,11 +3265,11 @@ freebsd32_copyout_strings(struct image_params *imgp, r * Fill in environment portion of vector table. */ for (; envc > 0; --envc) { - if (suword32(vectp++, (u_int32_t)(intptr_t)destp) != 0) + if (suword32(vectp++, ustringp) != 0) return (EFAULT); while (*stringp++ != 0) - destp++; - destp++; + ustringp++; + ustringp++; } /* end of vector table is a null pointer */ Modified: head/sys/compat/freebsd32/freebsd32_util.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_util.h Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/freebsd32/freebsd32_util.h Tue Dec 3 23:17:54 2019 (r355373) @@ -113,7 +113,7 @@ int syscall32_helper_unregister(struct syscall_help struct iovec32; struct rusage32; int freebsd32_copyout_strings(struct image_params *imgp, - register_t **stack_base); + uintptr_t *stack_base); int freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt, struct iovec **iov, int error); void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32); Modified: head/sys/compat/ia32/ia32_signal.h ============================================================================== --- head/sys/compat/ia32/ia32_signal.h Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/compat/ia32/ia32_signal.h Tue Dec 3 23:17:54 2019 (r355373) @@ -206,7 +206,7 @@ extern int sz_ia32_osigcode; extern int sz_lcall_tramp; void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *); void ia32_setregs(struct thread *td, struct image_params *imgp, - u_long stack); + uintptr_t stack); int setup_lcall_gate(void); #endif Modified: head/sys/i386/cloudabi32/cloudabi32_sysvec.c ============================================================================== --- head/sys/i386/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/i386/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -48,7 +48,7 @@ extern const char *cloudabi32_syscallnames[]; extern struct sysent cloudabi32_sysent[]; static int -cloudabi32_fixup_tcb(register_t **stack_base, struct image_params *imgp) +cloudabi32_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) { int error; uint32_t args[2]; @@ -68,16 +68,16 @@ cloudabi32_fixup_tcb(register_t **stack_base, struct i * refer to the auxiliary vector, which is stored right after * the TCB. */ - args[0] = (uintptr_t)*stack_base; - args[1] = (uintptr_t)*stack_base + + args[0] = *stack_base; + args[1] = *stack_base + roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); - *stack_base -= howmany(sizeof(args), sizeof(register_t)); - return (copyout(args, *stack_base, sizeof(args))); + *stack_base -= roundup(sizeof(args), sizeof(register_t)); + return (copyout(args, (void *)*stack_base, sizeof(args))); } static void cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, - unsigned long stack) + uintptr_t stack) { exec_setregs(td, imgp, stack); Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/i386/i386/machdep.c Tue Dec 3 23:17:54 2019 (r355373) @@ -1124,7 +1124,7 @@ setup_priv_lcall_gate(struct proc *p) * Reset registers to default values on exec. */ void -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *regs; struct pcb *pcb; Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Tue Dec 3 23:11:40 2019 (r355372) +++ head/sys/i386/linux/linux_sysvec.c Tue Dec 3 23:17:54 2019 (r355373) @@ -88,15 +88,15 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); -static int linux_fixup(register_t **stack_base, +static int linux_fixup(uintptr_t *stack_base, struct image_params *iparams); -static int linux_fixup_elf(register_t **stack_base, +static int linux_fixup_elf(uintptr_t *stack_base, struct image_params *iparams); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); static void linux_exec_setregs(struct thread *td, - struct image_params *imgp, u_long stack); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Dec 3 23:20:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CF561C19BF; Tue, 3 Dec 2019 23:20:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SHyX1Lnkz47F3; Tue, 3 Dec 2019 23:20:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D6D31F1E7; Tue, 3 Dec 2019 23:20:20 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3NKJ7l023055; Tue, 3 Dec 2019 23:20:19 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3NKJNB023054; Tue, 3 Dec 2019 23:20:19 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912032320.xB3NKJNB023054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 3 Dec 2019 23:20:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355374 - head/sys/sparc64/sparc64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/sparc64/sparc64 X-SVN-Commit-Revision: 355374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 23:20:20 -0000 Author: jhb Date: Tue Dec 3 23:20:19 2019 New Revision: 355374 URL: https://svnweb.freebsd.org/changeset/base/355374 Log: Pass 0 to __builtin_frame_address() to appease modern GCC. Modern versions of GCC warn about passing non-zero values to __builtin_frame_address(). Passing 1 is a cosmetic change to remove the db_trace_self() frame from the printed stack trace. Reported by: marius, imp Differential Revision: https://reviews.freebsd.org/D22600 Modified: head/sys/sparc64/sparc64/db_trace.c Modified: head/sys/sparc64/sparc64/db_trace.c ============================================================================== --- head/sys/sparc64/sparc64/db_trace.c Tue Dec 3 23:17:54 2019 (r355373) +++ head/sys/sparc64/sparc64/db_trace.c Tue Dec 3 23:20:19 2019 (r355374) @@ -279,7 +279,7 @@ db_trace_self(void) { db_backtrace(curthread, - (struct frame *)__builtin_frame_address(1), -1); + (struct frame *)__builtin_frame_address(0), -1); } int From owner-svn-src-all@freebsd.org Wed Dec 4 00:21:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3DBB1C326C; Wed, 4 Dec 2019 00:21:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SKJX4s7Lz49mL; Wed, 4 Dec 2019 00:21:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 272EB2702; Wed, 4 Dec 2019 00:21:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r355374 - head/sys/sparc64/sparc64 From: John Baldwin To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912032320.xB3NKJNB023054@repo.freebsd.org> Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <0e178d26-1fc0-0fbd-a914-2997e40d90e4@FreeBSD.org> Date: Tue, 3 Dec 2019 16:20:55 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201912032320.xB3NKJNB023054@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 00:21:00 -0000 On 12/3/19 3:20 PM, John Baldwin wrote: > Author: jhb > Date: Tue Dec 3 23:20:19 2019 > New Revision: 355374 > URL: https://svnweb.freebsd.org/changeset/base/355374 > > Log: > Pass 0 to __builtin_frame_address() to appease modern GCC. > > Modern versions of GCC warn about passing non-zero values to > __builtin_frame_address(). Passing 1 is a cosmetic change to remove > the db_trace_self() frame from the printed stack trace. > > Reported by: marius, imp Should be 'Reviewed by' > Differential Revision: https://reviews.freebsd.org/D22600 -- John Baldwin From owner-svn-src-all@freebsd.org Wed Dec 4 02:42:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F02841C6B02; Wed, 4 Dec 2019 02:42:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SNRf66kyz4HFK; Wed, 4 Dec 2019 02:42:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B5DDB216E7; Wed, 4 Dec 2019 02:42:22 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB42gMXY046113; Wed, 4 Dec 2019 02:42:22 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB42gMcJ046112; Wed, 4 Dec 2019 02:42:22 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201912040242.xB42gMcJ046112@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 4 Dec 2019 02:42:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355375 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 355375 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 02:42:23 -0000 Author: cem Date: Wed Dec 4 02:42:22 2019 New Revision: 355375 URL: https://svnweb.freebsd.org/changeset/base/355375 Log: x86: Add missed break to TAA status sysctl Just a typo that Coverity identified. Coverity also identified an unused store in the same functional area (x86 TAA stuff), but this commit does not address that issue (CID 1408334). Reported by: Coverity CID: 1408328, 1408332 Modified: head/sys/x86/x86/cpu_machdep.c Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Tue Dec 3 23:20:19 2019 (r355374) +++ head/sys/x86/x86/cpu_machdep.c Wed Dec 4 02:42:22 2019 (r355375) @@ -1332,6 +1332,7 @@ sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) break; case TAA_NOT_PRESENT: state = "TSX not present"; + break; default: state = "unknown"; } From owner-svn-src-all@freebsd.org Wed Dec 4 02:59:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CE5A1C6E28; Wed, 4 Dec 2019 02:59:51 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SNqq0L7Nz4Hg2; Wed, 4 Dec 2019 02:59:51 +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 DE081218B4; Wed, 4 Dec 2019 02:59:50 +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 xB42xo6N052398; Wed, 4 Dec 2019 02:59:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB42xoah052397; Wed, 4 Dec 2019 02:59:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912040259.xB42xoah052397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 4 Dec 2019 02:59:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355376 - head/secure/caroot/trusted X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/secure/caroot/trusted X-SVN-Commit-Revision: 355376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 02:59:51 -0000 Author: kevans Date: Wed Dec 4 02:59:50 2019 New Revision: 355376 URL: https://svnweb.freebsd.org/changeset/base/355376 Log: caroot update to latest tip: one (1) addition, none (0) removed Added: - Entrust Root Certification Authority - G4 Added: head/secure/caroot/trusted/Entrust_Root_Certification_Authority_-_G4.pem (contents, props changed) Added: head/secure/caroot/trusted/Entrust_Root_Certification_Authority_-_G4.pem ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/secure/caroot/trusted/Entrust_Root_Certification_Authority_-_G4.pem Wed Dec 4 02:59:50 2019 (r355376) @@ -0,0 +1,137 @@ +## +## Entrust Root Certification Authority - G4 +## +## This is a single X.509 certificate for a public Certificate +## Authority (CA). It was automatically extracted from Mozilla's +## root CA list (the file `certdata.txt' in security/nss). +## +## Extracted from nss +## with $FreeBSD: head/secure/caroot/MAca-bundle.pl 352951 2019-10-02 01:27:50Z kevans $ +## +## @generated +## +Certificate: + Data: + Version: 3 (0x2) + Serial Number: + d9:b5:43:7f:af:a9:39:0f:00:00:00:00:55:65:ad:58 + Signature Algorithm: sha256WithRSAEncryption + Issuer: C = US, O = "Entrust, Inc.", OU = See www.entrust.net/legal-terms, OU = "(c) 2015 Entrust, Inc. - for authorized use only", CN = Entrust Root Certification Authority - G4 + Validity + Not Before: May 27 11:11:16 2015 GMT + Not After : Dec 27 11:41:16 2037 GMT + Subject: C = US, O = "Entrust, Inc.", OU = See www.entrust.net/legal-terms, OU = "(c) 2015 Entrust, Inc. - for authorized use only", CN = Entrust Root Certification Authority - G4 + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (4096 bit) + Modulus: + 00:b1:ec:2c:42:ee:e2:d1:30:ff:a5:92:47:e2:2d: + c3:ba:64:97:6d:ca:f7:0d:b5:59:c1:b3:cb:a8:68: + 19:d8:af:84:6d:30:70:5d:7e:f3:2e:d2:53:99:e1: + fe:1f:5e:d9:48:af:5d:13:8d:db:ff:63:33:4d:d3: + 00:02:bc:c4:f8:d1:06:08:94:79:58:8a:15:de:29: + b3:fd:fd:c4:4f:e8:aa:e2:a0:3b:79:cd:bf:6b:43: + 32:dd:d9:74:10:b9:f7:f4:68:d4:bb:d0:87:d5:aa: + 4b:8a:2a:6f:2a:04:b5:b2:a6:c7:a0:7a:e6:48:ab: + d2:d1:59:cc:d6:7e:23:e6:97:6c:f0:42:e5:dc:51: + 4b:15:41:ed:49:4a:c9:de:10:97:d6:76:c1:ef:a5: + b5:36:14:97:35:d8:78:22:35:52:ef:43:bd:db:27: + db:61:56:82:34:dc:cb:88:60:0c:0b:5a:e5:2c:01: + c6:54:af:d7:aa:c1:10:7b:d2:05:5a:b8:40:9e:86: + a7:c3:90:86:02:56:52:09:7a:9c:d2:27:82:53:4a: + 65:52:6a:f5:3c:e7:a8:f2:9c:af:8b:bd:d3:0e:d4: + d4:5e:6e:87:9e:6a:3d:45:1d:d1:5d:1b:f4:e9:0a: + ac:60:99:fb:89:b4:ff:98:2c:cf:7c:1d:e9:02:aa: + 04:9a:1e:b8:dc:88:6e:25:b3:6c:66:f7:3c:90:f3: + 57:c1:b3:2f:f5:6d:f2:fb:ca:a1:f8:29:9d:46:8b: + b3:6a:f6:e6:67:07:be:2c:67:0a:2a:1f:5a:b2:3e: + 57:c4:d3:21:21:63:65:52:91:1b:b1:99:8e:79:7e: + e6:eb:8d:00:d9:5a:aa:ea:73:e8:a4:82:02:47:96: + fe:5b:8e:54:61:a3:eb:2f:4b:30:b0:8b:23:75:72: + 7c:21:3c:c8:f6:f1:74:d4:1c:7b:a3:05:55:ee:bb: + 4d:3b:32:be:9a:77:66:9e:ac:69:90:22:07:1f:61: + 3a:96:be:e5:9a:4f:cc:05:3c:28:59:d3:c1:0c:54: + a8:59:61:bd:c8:72:4c:e8:dc:9f:87:7f:bd:9c:48: + 36:5e:95:a3:0e:b9:38:24:55:fc:75:66:eb:02:e3: + 08:34:29:4a:c6:e3:2b:2f:33:a0:da:a3:86:a5:12: + 97:fd:80:2b:da:14:42:e3:92:bd:3e:f2:5d:5e:67: + 74:2e:1c:88:47:29:34:5f:e2:32:a8:9c:25:37:8c: + ba:98:00:97:8b:49:96:1e:fd:25:8a:ac:dc:da:d8: + 5d:74:6e:66:b0:ff:44:df:a1:18:c6:be:48:2f:37: + 94:78:f8:95:4a:3f:7f:13:5e:5d:59:fd:74:86:43: + 63:73:49 + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + 9F:38:C4:56:23:C3:39:E8:A0:71:6C:E8:54:4C:E4:E8:3A:B1:BF:67 + Signature Algorithm: sha256WithRSAEncryption + 12:e5:42:a6:7b:8b:0f:0c:e4:46:a5:b6:60:40:87:8c:25:7e: + ad:b8:68:2e:5b:c6:40:76:3c:03:f8:c9:59:f4:f3:ab:62:ce: + 10:8d:b4:5a:64:8c:68:c0:b0:72:43:34:d2:1b:0b:f6:2c:53: + d2:ca:90:4b:86:66:fc:aa:83:22:f4:8b:1a:6f:26:48:ac:76: + 77:08:bf:c5:98:5c:f4:26:89:9e:7b:c3:b9:64:32:01:7f:d3: + c3:dd:58:6d:ec:b1:ab:84:55:74:77:84:04:27:52:6b:86:4c: + ce:dd:b9:65:ff:d6:c6:5e:9f:9a:10:99:4b:75:6a:fe:6a:e9: + 97:20:e4:e4:76:7a:c6:d0:24:aa:90:cd:20:90:ba:47:64:fb: + 7f:07:b3:53:78:b5:0a:62:f2:73:43:ce:41:2b:81:6a:2e:85: + 16:94:53:d4:6b:5f:72:22:ab:51:2d:42:d5:00:9c:99:bf:de: + bb:94:3b:57:fd:9a:f5:86:cb:56:3b:5b:88:01:e5:7c:28:4b: + 03:f9:49:83:7c:b2:7f:7c:e3:ed:8e:a1:7f:60:53:8e:55:9d: + 50:34:12:0f:b7:97:7b:6c:87:4a:44:e7:f5:6d:ec:80:37:f0: + 58:19:6e:4a:68:76:f0:1f:92:e4:ea:b5:92:d3:61:51:10:0b: + ad:a7:d9:5f:c7:5f:dc:1f:a3:5c:8c:a1:7e:9b:b7:9e:d3:56: + 6f:66:5e:07:96:20:ed:0b:74:fb:66:4e:8b:11:15:e9:81:49: + 7e:6f:b0:d4:50:7f:22:d7:5f:65:02:0d:a6:f4:85:1e:d8:ae: + 06:4b:4a:a7:d2:31:66:c2:f8:ce:e5:08:a6:a4:02:96:44:68: + 57:c4:d5:33:cf:19:2f:14:c4:94:1c:7b:a4:d9:f0:9f:0e:b1: + 80:e2:d1:9e:11:64:a9:88:11:3a:76:82:e5:62:c2:80:d8:a4: + 83:ed:93:ef:7c:2f:90:b0:32:4c:96:15:68:48:52:d4:99:08: + c0:24:e8:1c:e3:b3:a5:21:0e:92:c0:90:1f:cf:20:5f:ca:3b: + 38:c7:b7:6d:3a:f3:e6:44:b8:0e:31:6b:88:8e:70:eb:9c:17: + 52:a8:41:94:2e:87:b6:e7:a6:12:c5:75:df:5b:c0:0a:6e:7b: + a4:e4:5e:86:f9:36:94:df:77:c3:e9:0d:c0:39:f1:79:bb:46: + 8e:ab:43:59:27:b7:20:bb:23:e9:56:40:21:ec:31:3d:65:aa: + 43:f2:3d:df:70:44:e1:ba:4d:26:10:3b:98:9f:f3:c8:8e:1b: + 38:56:21:6a:51:93:d3:91:ca:46:da:89:b7:3d:53:83:2c:08: + 1f:8b:8f:53:dd:ff:ac:1f +SHA1 Fingerprint=14:88:4E:86:26:37:B0:26:AF:59:62:5C:40:77:EC:35:29:BA:96:01 +-----BEGIN CERTIFICATE----- +MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAw +gb4xCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQL +Ex9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykg +MjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAw +BgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0 +MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1 +c3QubmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJ +bmMuIC0gZm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3Qg +Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEc0MIICIjANBgkqhkiG9w0B +AQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3DumSXbcr3DbVZwbPLqGgZ +2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV3imz/f3E +T+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j +5pds8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAM +C1rlLAHGVK/XqsEQe9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73T +DtTUXm6Hnmo9RR3RXRv06QqsYJn7ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNX +wbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5XxNMhIWNlUpEbsZmOeX7m640A +2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV7rtNOzK+mndm +nqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8 +dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwl +N4y6mACXi0mWHv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNj +c0kCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYD +VR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9nMA0GCSqGSIb3DQEBCwUAA4ICAQAS +5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4QjbRaZIxowLByQzTS +Gwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht7LGr +hFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/ +B7NTeLUKYvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uI +AeV8KEsD+UmDfLJ/fOPtjqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbw +H5Lk6rWS02FREAutp9lfx1/cH6NcjKF+m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+ +b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKWRGhXxNUzzxkvFMSUHHuk +2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjAJOgc47Ol +IQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk +5F6G+TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuY +n/PIjhs4ViFqUZPTkcpG2om3PVODLAgfi49T3f+sHw== +-----END CERTIFICATE----- From owner-svn-src-all@freebsd.org Wed Dec 4 03:23:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0EB11C7656; Wed, 4 Dec 2019 03:23:27 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47SPM344npz4K4w; Wed, 4 Dec 2019 03:23:27 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: by mail-qv1-xf41.google.com with SMTP id i3so2509168qvv.7; Tue, 03 Dec 2019 19:23:27 -0800 (PST) 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=hsTvW2+QmvM1/H9ibgae7Xjsyckt8ekJ/N3bpX02rrA=; b=LnpT2dJqAPwG+866F2V8ZgPD4l1loNgjQp6hDYitlNG3EaxH6/pvHxGXq/P8Oho3Za B+vQihoFJpyCcfi5/m8VbaheJoJnlhB3RwKfqcQ+dLHjnnrlu7IvGlaBGfYLeWnSvuSm 2UqaXxjboBJdUr4yPx2uryD3lhYcbzVXkYw3I/qlpiDtRtZpRzSFA0C8kijW9iZ90iI5 GiVzjR+B5W6VxFZsbnbUzxyCu1xki06qJB+IvLx3I00uPswLZKqC9zNEWX4Qz6s3S5cP gzM4udThYsVuJSrRMU4OilPpj6o6aVJvfGLWCNio6fOJ5qNwwKfUtKM0OyqRSkIYxlim 8W3Q== 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=hsTvW2+QmvM1/H9ibgae7Xjsyckt8ekJ/N3bpX02rrA=; b=rAPJ9auau0FOwq9xkyqTn3nhKzOlvN1zqRD6pFfr+cow0G2k4/dulI/j7gmeeanYAX Uiw8JIH4mh3YndPtFGlzbsmrGqW3MkwkyYL2hP9stpL1u+gTxNSiEZs8cM1XcIz9ZOS6 w7amhH9JltSj/SOqcYtjKnE5lJfakDEDaiIwsKOMPyZjMlEZoLzI+BD7L6Tf4SaOh9fF cDxK8IK6/hK6jhvflUflpbM/teY28Aa3H/jU4YyxVMAVV0uzC+3T4tZY0McCfio/hswr 2RUkiowM2x08HjbKSpjnMeuM6EyyH5YZFAWP+folNx+D3D+JqeaeVd5rXpfxY+xHvZlS 3SWQ== X-Gm-Message-State: APjAAAUDc+H3QIg3Lt/uJnyEGUSGxS08zbRhyhJry2WXayz9ug8geI+r X9hvHzGjOWRqn2hPwDABMBEhpKkbe5zKW+tWcHtOkC1609s= X-Google-Smtp-Source: APXvYqwSc+10SlcmiDoEEFFHa0dYqQM7Q5kCtEhP2oPvY1KiFw6jdvFRtEFyB3XDZln+NkzQj76ysjaBEKQPIns29qg= X-Received: by 2002:a05:6214:c3:: with SMTP id f3mr876629qvs.226.1575429804958; Tue, 03 Dec 2019 19:23:24 -0800 (PST) MIME-Version: 1.0 References: <201912032317.xB3NHsjB022858@repo.freebsd.org> In-Reply-To: <201912032317.xB3NHsjB022858@repo.freebsd.org> From: Ganbold Tsagaankhuu Date: Wed, 4 Dec 2019 11:23:13 +0800 Message-ID: Subject: Re: svn commit: r355373 - in head/sys: amd64/amd64 amd64/cloudabi32 amd64/cloudabi64 amd64/ia32 amd64/linux amd64/linux32 arm/arm arm/cloudabi32 arm64/arm64 arm64/cloudabi32 arm64/cloudabi64 arm64/linu... To: John Baldwin Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47SPM344npz4K4w X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.992,0]; NEURAL_HAM_LONG(-1.00)[-0.997,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:23:27 -0000 On Wed, Dec 4, 2019 at 7:18 AM John Baldwin wrote: > Author: jhb > Date: Tue Dec 3 23:17:54 2019 > New Revision: 355373 > URL: https://svnweb.freebsd.org/changeset/base/355373 > > Log: > Use uintptr_t instead of register_t * for the stack base. > > - Use ustringp for the location of the argv and environment strings > and allow destp to travel further down the stack for the stackgap > and auxv regions. > - Update the Linux copyout_strings variants to move destp down the > stack as was done for the native ABIs in r263349. > - Stop allocating a space for a stack gap in the Linux ABIs. This > used to hold translated system call arguments, but hasn't been used > since r159992. > > Reviewed by: kib > Tested on: md64 (amd64, i386, linux64), i386 (i386, linux) > Sponsored by: DARPA > Differential Revision: https://reviews.freebsd.org/D22501 > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/amd64/cloudabi32/cloudabi32_sysvec.c > head/sys/amd64/cloudabi64/cloudabi64_sysvec.c > head/sys/amd64/ia32/ia32_signal.c > head/sys/amd64/linux/linux_sysvec.c > head/sys/amd64/linux32/linux32_sysvec.c > head/sys/arm/arm/machdep.c > head/sys/arm/cloudabi32/cloudabi32_sysvec.c > head/sys/arm64/arm64/elf32_machdep.c > head/sys/arm64/arm64/machdep.c > head/sys/arm64/cloudabi32/cloudabi32_sysvec.c > head/sys/arm64/cloudabi64/cloudabi64_sysvec.c > head/sys/arm64/linux/linux_sysvec.c > This maybe breaks buildkernel on arm64: --- all_subdir_linux64 --- /usr/src/sys/arm64/linux/linux_sysvec.c:235:8: error: incompatible integer to pointer conversion assigning to 'uintptr_t *' (aka 'unsigned long *') from 'uintptr_t' (aka 'unsigned long') [-Werror,-Wint-conversion] destp = (uintptr_t)arginfo; ^ ~~~~~~~~~~~~~~~~~~ /usr/src/sys/arm64/linux/linux_sysvec.c:239:11: error: invalid operands to binary expression ('uintptr_t *' (aka 'unsigned long *') and 'unsigned long') destp = rounddown2(destp, sizeof(void *)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/sys/param.h:301:30: note: expanded from macro 'rounddown2' --- all_subdir_mac_test --- --- mac_test.o --- --- all_subdir_linux64 --- #define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ ~~~^~~~~~~~~~~ /usr/src/sys/arm64/linux/linux_sysvec.c:240:19: error: incompatible pointer to integer conversion assigning to 'unsigned long' from 'uintptr_t *' (aka 'unsigned long *'); dereference with * [-Werror,-Wint-conversion] imgp->execpathp = destp; ^ ~~~~~ * /usr/src/sys/arm64/linux/linux_sysvec.c:249:15: error: incompatible pointer to integer conversion assigning to 'unsigned long' from 'uintptr_t *' (aka 'unsigned long *'); dereference with * [-Werror,-Wint-conversion] imgp->canary = destp; ^ ~~~~~ * /usr/src/sys/arm64/linux/linux_sysvec.c:256:10: error: invalid operands to binary expression ('uintptr_t *' (aka 'unsigned long *') and 'unsigned long') destp = rounddown2(destp, sizeof(void *)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/src/sys/sys/param.h:301:30: note: expanded from macro 'rounddown2' #define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ ~~~^~~~~~~~~~~ --- all_subdir_mac_test --- cc -target aarch64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/arm64.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/arm64.aarch64/sys/GENERIC/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -g -fPIC -fdebug-prefix-map=./machine=/usr/src/sys/arm64/include -I/usr/obj/usr/src/arm64.aarch64/sys/GENERIC -MD -MF.depend.mac_test.o -MTmac_test.o -mgeneral-regs-only -ffixed-x18 -ffreestanding -fwrapv -fstack-protector -gdwarf-2 -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length -std=iso9899:1999 -c /usr/src/sys/security/mac_test/mac_test.c -o mac_test.o --- all_subdir_linux64 --- /usr/src/sys/arm64/linux/linux_sysvec.c:260:50: error: incompatible pointer types passing 'uintptr_t **' (aka 'unsigned long **') to parameter of type 'uintptr_t *' (aka 'unsigned long *'); remove & [-Werror,-Wincompatible-pointer-types] error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); ^~~~~~ /usr/src/sys/arm64/linux/linux_sysvec.c:297:23: error: incompatible pointer to integer conversion passing 'uintptr_t *' (aka 'unsigned long *') to parameter of type 'long' [-Werror,-Wint-conversion] if (suword(vectp++, ustringp) != 0) ^~~~~~~~ /usr/src/sys/sys/systm.h:390:38: note: passing argument to parameter 'word' here int suword(volatile void *base, long word); ^ /usr/src/sys/arm64/linux/linux_sysvec.c:314:23: error: incompatible pointer to integer conversion passing 'uintptr_t *' (aka 'unsigned long *') to parameter of type 'long' [-Werror,-Wint-conversion] if (suword(vectp++, ustringp) != 0) ^~~~~~~~ /usr/src/sys/sys/systm.h:390:38: note: passing argument to parameter 'word' here int suword(volatile void *base, long word); ^ 8 errors generated. *** [linux_sysvec.o] Error code 1 Ganbold > head/sys/compat/cloudabi32/cloudabi32_module.c > head/sys/compat/cloudabi32/cloudabi32_util.h > head/sys/compat/cloudabi64/cloudabi64_module.c > head/sys/compat/cloudabi64/cloudabi64_util.h > head/sys/compat/freebsd32/freebsd32_misc.c > head/sys/compat/freebsd32/freebsd32_util.h > head/sys/compat/ia32/ia32_signal.h > head/sys/i386/cloudabi32/cloudabi32_sysvec.c > head/sys/i386/i386/machdep.c > head/sys/i386/linux/linux_sysvec.c > head/sys/kern/imgact_aout.c > head/sys/kern/imgact_elf.c > head/sys/kern/kern_exec.c > head/sys/mips/mips/freebsd32_machdep.c > head/sys/mips/mips/pm_machdep.c > head/sys/powerpc/include/reg.h > head/sys/powerpc/powerpc/elf64_machdep.c > head/sys/powerpc/powerpc/exec_machdep.c > head/sys/riscv/riscv/machdep.c > head/sys/sparc64/sparc64/machdep.c > head/sys/sys/imgact.h > head/sys/sys/imgact_elf.h > head/sys/sys/sysent.h > > Modified: head/sys/amd64/amd64/machdep.c > > ============================================================================== > --- head/sys/amd64/amd64/machdep.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/amd64/amd64/machdep.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -577,7 +577,7 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_ > * Reset registers to default values on exec. > */ > void > -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) > +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t > stack) > { > struct trapframe *regs; > struct pcb *pcb; > > Modified: head/sys/amd64/cloudabi32/cloudabi32_sysvec.c > > ============================================================================== > --- head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/amd64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -53,7 +53,7 @@ extern struct sysent cloudabi32_sysent[]; > extern unsigned long ia32_maxssiz; > > static int > -cloudabi32_fixup_tcb(register_t **stack_base, struct image_params *imgp) > +cloudabi32_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) > { > int error; > uint32_t args[2]; > @@ -73,16 +73,16 @@ cloudabi32_fixup_tcb(register_t **stack_base, struct i > * refer to the auxiliary vector, which is stored right after > * the TCB. > */ > - args[0] = (uintptr_t)*stack_base; > - args[1] = (uintptr_t)*stack_base + > + args[0] = *stack_base; > + args[1] = *stack_base + > roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); > - *stack_base -= howmany(sizeof(args), sizeof(register_t)); > - return (copyout(args, *stack_base, sizeof(args))); > + *stack_base -= roundup2(sizeof(args), sizeof(register_t)); > + return (copyout(args, (void *)*stack_base, sizeof(args))); > } > > static void > cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, > - unsigned long stack) > + uintptr_t stack) > { > > ia32_setregs(td, imgp, stack); > > Modified: head/sys/amd64/cloudabi64/cloudabi64_sysvec.c > > ============================================================================== > --- head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/amd64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -48,7 +48,7 @@ extern const char *cloudabi64_syscallnames[]; > extern struct sysent cloudabi64_sysent[]; > > static int > -cloudabi64_fixup_tcb(register_t **stack_base, struct image_params *imgp) > +cloudabi64_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) > { > int error; > register_t tcbptr; > @@ -64,12 +64,13 @@ cloudabi64_fixup_tcb(register_t **stack_base, struct i > * containing a pointer to the TCB. %fs base will point to this. > */ > tcbptr = (register_t)*stack_base; > - return (copyout(&tcbptr, --*stack_base, sizeof(tcbptr))); > + *stack_base -= sizeof(tcbptr); > + return (copyout(&tcbptr, (void *)*stack_base, sizeof(tcbptr))); > } > > static void > cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, > - unsigned long stack) > + uintptr_t stack) > { > struct trapframe *regs; > > > Modified: head/sys/amd64/ia32/ia32_signal.c > > ============================================================================== > --- head/sys/amd64/ia32/ia32_signal.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/amd64/ia32/ia32_signal.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -936,7 +936,7 @@ freebsd32_sigreturn(td, uap) > * Clear registers on exec > */ > void > -ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack) > +ia32_setregs(struct thread *td, struct image_params *imgp, uintptr_t > stack) > { > struct trapframe *regs; > struct pcb *pcb; > > Modified: head/sys/amd64/linux/linux_sysvec.c > > ============================================================================== > --- head/sys/amd64/linux/linux_sysvec.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/amd64/linux/linux_sysvec.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -97,8 +97,8 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL > SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); > > static int linux_copyout_strings(struct image_params *imgp, > - register_t **stack_base); > -static int linux_fixup_elf(register_t **stack_base, > + uintptr_t *stack_base); > +static int linux_fixup_elf(uintptr_t *stack_base, > struct image_params *iparams); > static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); > static void linux_vdso_install(void *param); > @@ -106,7 +106,7 @@ static void linux_vdso_deinstall(void *param); > static void linux_set_syscall_retval(struct thread *td, int error); > static int linux_fetch_syscall_args(struct thread *td); > static void linux_exec_setregs(struct thread *td, struct image_params > *imgp, > - u_long stack); > + uintptr_t stack); > static int linux_vsyscall(struct thread *td); > > #define LINUX_T_UNKNOWN 255 > @@ -224,7 +224,7 @@ linux_set_syscall_retval(struct thread *td, int error) > } > > static int > -linux_copyout_auxargs(struct image_params *imgp, u_long *base) > +linux_copyout_auxargs(struct image_params *imgp, uintptr_t *base) > { > Elf_Auxargs *args; > Elf_Auxinfo *argarray, *pos; > @@ -274,7 +274,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon > } > > static int > -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) > +linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp) > { > Elf_Addr *base; > > @@ -283,7 +283,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ > if (suword(base, (uint64_t)imgp->args->argc) == -1) > return (EFAULT); > > - *stack_base = (register_t *)base; > + *stack_base = (uintptr_t)base; > return (0); > } > > @@ -293,11 +293,12 @@ linux_fixup_elf(register_t **stack_base, struct > image_ > * as the initial stack pointer. > */ > static int > -linux_copyout_strings(struct image_params *imgp, register_t **stack_base) > +linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) > { > int argc, envc, error; > char **vectp; > - char *stringp, *destp; > + char *stringp; > + uintptr_t destp, ustringp; > struct ps_strings *arginfo; > char canary[LINUX_AT_RANDOM_LEN]; > size_t execpath_len; > @@ -311,43 +312,45 @@ linux_copyout_strings(struct image_params *imgp, > regis > > p = imgp->proc; > arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; > - destp = (caddr_t)arginfo - SPARE_USRSPACE - > - roundup(sizeof(canary), sizeof(char *)) - > - roundup(execpath_len, sizeof(char *)) - > - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); > + destp = (uintptr_t)arginfo; > > if (execpath_len != 0) { > - imgp->execpathp = (uintptr_t)arginfo - execpath_len; > - error = copyout(imgp->execpath, (void *)imgp->execpathp, > - execpath_len); > + destp -= execpath_len; > + destp = rounddown2(destp, sizeof(void *)); > + imgp->execpathp = destp; > + error = copyout(imgp->execpath, (void *)destp, > execpath_len); > if (error != 0) > return (error); > } > > /* Prepare the canary for SSP. */ > arc4rand(canary, sizeof(canary), 0); > - imgp->canary = (uintptr_t)arginfo - > - roundup(execpath_len, sizeof(char *)) - > - roundup(sizeof(canary), sizeof(char *)); > - error = copyout(canary, (void *)imgp->canary, sizeof(canary)); > + destp -= roundup(sizeof(canary), sizeof(void *)); > + imgp->canary = destp; > + error = copyout(canary, (void *)destp, sizeof(canary)); > if (error != 0) > return (error); > > - vectp = (char **)destp; > + /* Allocate room for the argument and environment strings. */ > + destp -= ARG_MAX - imgp->args->stringspace; > + destp = rounddown2(destp, sizeof(void *)); > + ustringp = destp; > > /* > * Starting with 2.24, glibc depends on a 16-byte stack alignment. > * One "long argc" will be prepended later. > */ > - vectp = (char **)((((uintptr_t)vectp + 8) & ~0xF) - 8); > + if (destp % 16 == 0) > + destp -= 8; > > if (imgp->auxargs) { > - error = imgp->sysent->sv_copyout_auxargs(imgp, > - (u_long *)&vectp); > + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); > if (error != 0) > return (error); > } > > + vectp = (char **)destp; > + > /* > * Allocate room for the argv[] and env vectors including the > * terminating NULL pointers. > @@ -355,14 +358,15 @@ linux_copyout_strings(struct image_params *imgp, > regis > vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; > > /* vectp also becomes our initial stack base. */ > - *stack_base = (register_t *)vectp; > + *stack_base = (uintptr_t)vectp; > > stringp = imgp->args->begin_argv; > argc = imgp->args->argc; > envc = imgp->args->envc; > > /* Copy out strings - arguments and environment. */ > - error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); > + error = copyout(stringp, (void *)ustringp, > + ARG_MAX - imgp->args->stringspace); > if (error != 0) > return (error); > > @@ -373,11 +377,11 @@ linux_copyout_strings(struct image_params *imgp, > regis > > /* Fill in argument portion of vector table. */ > for (; argc > 0; --argc) { > - if (suword(vectp++, (long)(intptr_t)destp) != 0) > + if (suword(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* A null vector table pointer separates the argp's from the > envp's. */ > @@ -390,11 +394,11 @@ linux_copyout_strings(struct image_params *imgp, > regis > > /* Fill in environment portion of vector table. */ > for (; envc > 0; --envc) { > - if (suword(vectp++, (long)(intptr_t)destp) != 0) > + if (suword(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* The end of the vector table is a null pointer. */ > @@ -408,7 +412,8 @@ linux_copyout_strings(struct image_params *imgp, regis > * Reset registers to default values on exec. > */ > static void > -linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long > stack) > +linux_exec_setregs(struct thread *td, struct image_params *imgp, > + uintptr_t stack) > { > struct trapframe *regs; > struct pcb *pcb; > > Modified: head/sys/amd64/linux32/linux32_sysvec.c > > ============================================================================== > --- head/sys/amd64/linux32/linux32_sysvec.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/amd64/linux32/linux32_sysvec.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -101,13 +101,13 @@ extern struct sysent > linux32_sysent[LINUX32_SYS_MAXSYS > > SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); > > -static int linux_fixup_elf(register_t **stack_base, > +static int linux_fixup_elf(uintptr_t *stack_base, > struct image_params *iparams); > static int linux_copyout_strings(struct image_params *imgp, > - register_t **stack_base); > + uintptr_t *stack_base); > static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t > *mask); > static void linux_exec_setregs(struct thread *td, > - struct image_params *imgp, u_long > stack); > + struct image_params *imgp, uintptr_t > stack); > static void linux32_fixlimit(struct rlimit *rl, int which); > static bool linux32_trans_osrel(const Elf_Note *note, int32_t *osrel); > static void linux_vdso_install(void *param); > @@ -246,7 +246,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon > } > > static int > -linux_fixup_elf(register_t **stack_base, struct image_params *imgp) > +linux_fixup_elf(uintptr_t *stack_base, struct image_params *imgp) > { > Elf32_Addr *base; > > @@ -254,7 +254,7 @@ linux_fixup_elf(register_t **stack_base, struct image_ > base--; > if (suword32(base, (uint32_t)imgp->args->argc) == -1) > return (EFAULT); > - *stack_base = (register_t *)base; > + *stack_base = (uintptr_t)base; > return (0); > } > > @@ -677,7 +677,8 @@ linux32_fetch_syscall_args(struct thread *td) > * XXX copied from ia32_signal.c. > */ > static void > -linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long > stack) > +linux_exec_setregs(struct thread *td, struct image_params *imgp, > + uintptr_t stack) > { > struct trapframe *regs = td->td_frame; > struct pcb *pcb = td->td_pcb; > @@ -721,11 +722,12 @@ linux_exec_setregs(struct thread *td, struct > image_par > * XXX copied from ia32_sysvec.c. > */ > static int > -linux_copyout_strings(struct image_params *imgp, register_t **stack_base) > +linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) > { > int argc, envc, error; > u_int32_t *vectp; > - char *stringp, *destp; > + char *stringp; > + uintptr_t destp, ustringp; > struct linux32_ps_strings *arginfo; > char canary[LINUX_AT_RANDOM_LEN]; > size_t execpath_len; > @@ -737,36 +739,38 @@ linux_copyout_strings(struct image_params *imgp, > regis > execpath_len = 0; > > arginfo = (struct linux32_ps_strings *)LINUX32_PS_STRINGS; > - destp = (caddr_t)arginfo - SPARE_USRSPACE - > - roundup(sizeof(canary), sizeof(char *)) - > - roundup(execpath_len, sizeof(char *)) - > - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); > + destp = (uintptr_t)arginfo; > > if (execpath_len != 0) { > - imgp->execpathp = (uintptr_t)arginfo - execpath_len; > - error = copyout(imgp->execpath, (void *)imgp->execpathp, > - execpath_len); > + destp -= execpath_len; > + destp = rounddown2(destp, sizeof(void *)); > + imgp->execpathp = destp; > + error = copyout(imgp->execpath, (void *)destp, > execpath_len); > if (error != 0) > return (error); > } > > /* Prepare the canary for SSP. */ > arc4rand(canary, sizeof(canary), 0); > - imgp->canary = (uintptr_t)arginfo - > - roundup(execpath_len, sizeof(char *)) - > - roundup(sizeof(canary), sizeof(char *)); > - error = copyout(canary, (void *)imgp->canary, sizeof(canary)); > + destp -= roundup(sizeof(canary), sizeof(void *)); > + imgp->canary = destp; > + error = copyout(canary, (void *)destp, sizeof(canary)); > if (error != 0) > return (error); > > - vectp = (uint32_t *)destp; > + /* Allocate room for the argument and environment strings. */ > + destp -= ARG_MAX - imgp->args->stringspace; > + destp = rounddown2(destp, sizeof(void *)); > + ustringp = destp; > + > if (imgp->auxargs) { > - error = imgp->sysent->sv_copyout_auxargs(imgp, > - (u_long *)&vectp); > + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); > if (error != 0) > return (error); > } > > + vectp = (uint32_t *)destp; > + > /* > * Allocate room for the argv[] and env vectors including the > * terminating NULL pointers. > @@ -774,13 +778,15 @@ linux_copyout_strings(struct image_params *imgp, > regis > vectp -= imgp->args->argc + 1 + imgp->args->envc + 1; > > /* vectp also becomes our initial stack base. */ > - *stack_base = (register_t *)vectp; > + *stack_base = (uintptr_t)vectp; > > stringp = imgp->args->begin_argv; > argc = imgp->args->argc; > envc = imgp->args->envc; > + > /* Copy out strings - arguments and environment. */ > - error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); > + error = copyout(stringp, (void *)ustringp, > + ARG_MAX - imgp->args->stringspace); > if (error != 0) > return (error); > > @@ -791,11 +797,11 @@ linux_copyout_strings(struct image_params *imgp, > regis > > /* Fill in argument portion of vector table. */ > for (; argc > 0; --argc) { > - if (suword32(vectp++, (uint32_t)(intptr_t)destp) != 0) > + if (suword32(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* A null vector table pointer separates the argp's from the > envp's. */ > @@ -808,11 +814,11 @@ linux_copyout_strings(struct image_params *imgp, > regis > > /* Fill in environment portion of vector table. */ > for (; envc > 0; --envc) { > - if (suword32(vectp++, (uint32_t)(intptr_t)destp) != 0) > + if (suword32(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* The end of the vector table is a null pointer. */ > > Modified: head/sys/arm/arm/machdep.c > > ============================================================================== > --- head/sys/arm/arm/machdep.c Tue Dec 3 23:11:40 2019 (r355372) > +++ head/sys/arm/arm/machdep.c Tue Dec 3 23:17:54 2019 (r355373) > @@ -412,7 +412,7 @@ spinlock_exit(void) > * Clear registers on exec > */ > void > -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) > +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t > stack) > { > struct trapframe *tf = td->td_frame; > > > Modified: head/sys/arm/cloudabi32/cloudabi32_sysvec.c > > ============================================================================== > --- head/sys/arm/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/arm/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -49,7 +49,7 @@ extern struct sysent cloudabi32_sysent[]; > > static void > cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, > - unsigned long stack) > + uintptr_t stack) > { > struct trapframe *regs; > > > Modified: head/sys/arm64/arm64/elf32_machdep.c > > ============================================================================== > --- head/sys/arm64/arm64/elf32_machdep.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/arm64/arm64/elf32_machdep.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -232,7 +232,7 @@ freebsd32_set_syscall_retval(struct thread *td, int er > > static void > freebsd32_setregs(struct thread *td, struct image_params *imgp, > - u_long stack) > + uintptr_t stack) > { > struct trapframe *tf = td->td_frame; > > > Modified: head/sys/arm64/arm64/machdep.c > > ============================================================================== > --- head/sys/arm64/arm64/machdep.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/arm64/arm64/machdep.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -436,7 +436,7 @@ ptrace_clear_single_step(struct thread *td) > } > > void > -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) > +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t > stack) > { > struct trapframe *tf = td->td_frame; > > > Modified: head/sys/arm64/cloudabi32/cloudabi32_sysvec.c > > ============================================================================== > --- head/sys/arm64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/arm64/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -49,7 +49,7 @@ extern struct sysent cloudabi32_sysent[]; > > static void > cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, > - unsigned long stack) > + uintptr_t stack) > { > struct trapframe *regs; > > > Modified: head/sys/arm64/cloudabi64/cloudabi64_sysvec.c > > ============================================================================== > --- head/sys/arm64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/arm64/cloudabi64/cloudabi64_sysvec.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -49,7 +49,7 @@ extern struct sysent cloudabi64_sysent[]; > > static void > cloudabi64_proc_setregs(struct thread *td, struct image_params *imgp, > - unsigned long stack) > + uintptr_t stack) > { > struct trapframe *regs; > > > Modified: head/sys/arm64/linux/linux_sysvec.c > > ============================================================================== > --- head/sys/arm64/linux/linux_sysvec.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/arm64/linux/linux_sysvec.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -70,8 +70,8 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL > SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); > > static int linux_copyout_strings(struct image_params *imgp, > - register_t **stack_base); > -static int linux_elf_fixup(register_t **stack_base, > + uintptr_t *stack_base); > +static int linux_elf_fixup(uintptr_t *stack_base, > struct image_params *iparams); > static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); > static void linux_vdso_install(const void *param); > @@ -79,7 +79,7 @@ static void linux_vdso_deinstall(const void *param); > static void linux_set_syscall_retval(struct thread *td, int error); > static int linux_fetch_syscall_args(struct thread *td); > static void linux_exec_setregs(struct thread *td, struct image_params > *imgp, > - u_long stack); > + uintptr_t stack); > static int linux_vsyscall(struct thread *td); > > /* DTrace init */ > @@ -143,7 +143,7 @@ linux_set_syscall_retval(struct thread *td, int error) > } > > static int > -linux_copyout_auxargs(struct image_params *imgp, u_long *base) > +linux_copyout_auxargs(struct image_params *imgp, uintptr_t *base) > { > Elf_Auxargs *args; > Elf_Auxinfo *argarray, *pos; > @@ -198,7 +198,7 @@ linux_copyout_auxargs(struct image_params *imgp, u_lon > } > > static int > -linux_elf_fixup(register_t **stack_base, struct image_params *imgp) > +linux_elf_fixup(uintptr_t *stack_base, struct image_params *imgp) > { > > LIN_SDT_PROBE0(sysvec, linux_elf_fixup, todo); > @@ -213,10 +213,11 @@ linux_elf_fixup(register_t **stack_base, struct > image_ > * LINUXTODO: deduplicate against other linuxulator archs > */ > static int > -linux_copyout_strings(struct image_params *imgp, register_t **stack_base) > +linux_copyout_strings(struct image_params *imgp, uintptr_t *stack_base) > { > char **vectp; > - char *stringp, *destp; > + char *stringp; > + uintptr_t *destp, *ustringp; > struct ps_strings *arginfo; > char canary[LINUX_AT_RANDOM_LEN]; > size_t execpath_len; > @@ -231,36 +232,38 @@ linux_copyout_strings(struct image_params *imgp, > regis > > p = imgp->proc; > arginfo = (struct ps_strings *)p->p_sysent->sv_psstrings; > - destp = (caddr_t)arginfo - SPARE_USRSPACE - > - roundup(sizeof(canary), sizeof(char *)) - > - roundup(execpath_len, sizeof(char *)) - > - roundup(ARG_MAX - imgp->args->stringspace, sizeof(char *)); > + destp = (uintptr_t)arginfo; > > if (execpath_len != 0) { > - imgp->execpathp = (uintptr_t)arginfo - execpath_len; > - error = copyout(imgp->execpath, (void *)imgp->execpathp, > - execpath_len); > + destp -= execpath_len; > + destp = rounddown2(destp, sizeof(void *)); > + imgp->execpathp = destp; > + error = copyout(imgp->execpath, (void *)destp, > execpath_len); > if (error != 0) > return (error); > } > > /* Prepare the canary for SSP. */ > arc4rand(canary, sizeof(canary), 0); > - imgp->canary = (uintptr_t)arginfo - > - roundup(execpath_len, sizeof(char *)) - > - roundup(sizeof(canary), sizeof(char *)); > - error = copyout(canary, (void *)imgp->canary, sizeof(canary)); > + destp -= roundup(sizeof(canary), sizeof(void *)); > + imgp->canary = destp; > + error = copyout(canary, (void *)destp, sizeof(canary)); > if (error != 0) > return (error); > > - vectp = (char **)destp; > + /* Allocate room for the argument and environment strings. */ > + destp -= ARG_MAX - imgp->args->stringspace; > + destp = rounddown2(destp, sizeof(void *)); > + ustringp = destp; > + > if (imgp->auxargs) { > - error = imgp->sysent->sv_copyout_auxargs(imgp, > - (u_long *)&vectp); > + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); > if (error != 0) > return (error); > } > > + vectp = (char **)destp; > + > /* > * Allocate room for argc and the argv[] and env vectors including > the > * terminating NULL pointers. > @@ -269,14 +272,15 @@ linux_copyout_strings(struct image_params *imgp, > regis > vectp = (char **)STACKALIGN(vectp); > > /* vectp also becomes our initial stack base. */ > - *stack_base = (register_t *)vectp; > + *stack_base = (uintptr_t)vectp; > > stringp = imgp->args->begin_argv; > argc = imgp->args->argc; > envc = imgp->args->envc; > > /* Copy out strings - arguments and environment. */ > - error = copyout(stringp, destp, ARG_MAX - imgp->args->stringspace); > + error = copyout(stringp, (void *)ustringp, > + ARG_MAX - imgp->args->stringspace); > if (error != 0) > return (error); > > @@ -290,11 +294,11 @@ linux_copyout_strings(struct image_params *imgp, > regis > > /* Fill in argument portion of vector table. */ > for (; argc > 0; --argc) { > - if (suword(vectp++, (long)(intptr_t)destp) != 0) > + if (suword(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* A null vector table pointer separates the argp's from the > envp's. */ > @@ -307,11 +311,11 @@ linux_copyout_strings(struct image_params *imgp, > regis > > /* Fill in environment portion of vector table. */ > for (; envc > 0; --envc) { > - if (suword(vectp++, (long)(intptr_t)destp) != 0) > + if (suword(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* The end of the vector table is a null pointer. */ > @@ -325,7 +329,8 @@ linux_copyout_strings(struct image_params *imgp, regis > * Reset registers to default values on exec. > */ > static void > -linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long > stack) > +linux_exec_setregs(struct thread *td, struct image_params *imgp, > + uintptr_t stack) > { > struct trapframe *regs = td->td_frame; > > > Modified: head/sys/compat/cloudabi32/cloudabi32_module.c > > ============================================================================== > --- head/sys/compat/cloudabi32/cloudabi32_module.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/compat/cloudabi32/cloudabi32_module.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -46,7 +46,7 @@ extern char _binary_cloudabi32_vdso_o_start[]; > extern char _binary_cloudabi32_vdso_o_end[]; > > int > -cloudabi32_copyout_strings(struct image_params *imgp, register_t > **stack_base) > +cloudabi32_copyout_strings(struct image_params *imgp, uintptr_t > *stack_base) > { > struct image_args *args; > uintptr_t begin; > @@ -56,12 +56,12 @@ cloudabi32_copyout_strings(struct image_params *imgp, > args = imgp->args; > len = exec_args_get_begin_envv(args) - args->begin_argv; > begin = rounddown2(imgp->sysent->sv_usrstack - len, > sizeof(register_t)); > - *stack_base = (register_t *)begin; > + *stack_base = begin; > return (copyout(args->begin_argv, (void *)begin, len)); > } > > int > -cloudabi32_fixup(register_t **stack_base, struct image_params *imgp) > +cloudabi32_fixup(uintptr_t *stack_base, struct image_params *imgp) > { > char canarybuf[64], pidbuf[16]; > Elf32_Auxargs *args; > @@ -79,12 +79,12 @@ cloudabi32_fixup(register_t **stack_base, struct image > td = curthread; > td->td_proc->p_osrel = __FreeBSD_version; > > - argdata = *stack_base; > + argdata = (void *)*stack_base; > > /* Store canary for stack smashing protection. */ > arc4rand(canarybuf, sizeof(canarybuf), 0); > - *stack_base -= howmany(sizeof(canarybuf), sizeof(register_t)); > - canary = *stack_base; > + *stack_base -= roundup(sizeof(canarybuf), sizeof(register_t)); > + canary = (void *)*stack_base; > error = copyout(canarybuf, canary, sizeof(canarybuf)); > if (error != 0) > return (error); > @@ -97,8 +97,8 @@ cloudabi32_fixup(register_t **stack_base, struct image > arc4rand(pidbuf, sizeof(pidbuf), 0); > pidbuf[6] = (pidbuf[6] & 0x0f) | 0x40; > pidbuf[8] = (pidbuf[8] & 0x3f) | 0x80; > - *stack_base -= howmany(sizeof(pidbuf), sizeof(register_t)); > - pid = *stack_base; > + *stack_base -= roundup(sizeof(pidbuf), sizeof(register_t)); > + pid = (void *)*stack_base; > error = copyout(pidbuf, pid, sizeof(pidbuf)); > if (error != 0) > return (error); > @@ -135,13 +135,13 @@ cloudabi32_fixup(register_t **stack_base, struct > image > #undef PTR > { .a_type = CLOUDABI_AT_NULL }, > }; > - *stack_base -= howmany(sizeof(auxv), sizeof(register_t)); > - error = copyout(auxv, *stack_base, sizeof(auxv)); > + *stack_base -= roundup(sizeof(auxv), sizeof(register_t)); > + error = copyout(auxv, (void *)*stack_base, sizeof(auxv)); > if (error != 0) > return (error); > > /* Reserve space for storing the TCB. */ > - *stack_base -= howmany(sizeof(cloudabi32_tcb_t), > sizeof(register_t)); > + *stack_base -= roundup(sizeof(cloudabi32_tcb_t), > sizeof(register_t)); > return (0); > } > > > Modified: head/sys/compat/cloudabi32/cloudabi32_util.h > > ============================================================================== > --- head/sys/compat/cloudabi32/cloudabi32_util.h Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/compat/cloudabi32/cloudabi32_util.h Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -42,8 +42,8 @@ extern Elf32_Brandinfo cloudabi32_brand; > #define TO_PTR(x) ((void *)(uintptr_t)(x)) > > /* Stack initialization during process execution. */ > -int cloudabi32_copyout_strings(struct image_params *, register_t **); > -int cloudabi32_fixup(register_t **, struct image_params *); > +int cloudabi32_copyout_strings(struct image_params *, uintptr_t *); > +int cloudabi32_fixup(uintptr_t *, struct image_params *); > > int cloudabi32_thread_setregs(struct thread *, > const cloudabi32_threadattr_t *, uint32_t); > > Modified: head/sys/compat/cloudabi64/cloudabi64_module.c > > ============================================================================== > --- head/sys/compat/cloudabi64/cloudabi64_module.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/compat/cloudabi64/cloudabi64_module.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -46,7 +46,7 @@ extern char _binary_cloudabi64_vdso_o_start[]; > extern char _binary_cloudabi64_vdso_o_end[]; > > int > -cloudabi64_copyout_strings(struct image_params *imgp, register_t > **stack_base) > +cloudabi64_copyout_strings(struct image_params *imgp, uintptr_t > *stack_base) > { > struct image_args *args; > uintptr_t begin; > @@ -56,12 +56,12 @@ cloudabi64_copyout_strings(struct image_params *imgp, > args = imgp->args; > len = exec_args_get_begin_envv(args) - args->begin_argv; > begin = rounddown2(imgp->sysent->sv_usrstack - len, > sizeof(register_t)); > - *stack_base = (register_t *)begin; > + *stack_base = begin; > return (copyout(args->begin_argv, (void *)begin, len)); > } > > int > -cloudabi64_fixup(register_t **stack_base, struct image_params *imgp) > +cloudabi64_fixup(uintptr_t *stack_base, struct image_params *imgp) > { > char canarybuf[64], pidbuf[16]; > Elf64_Auxargs *args; > @@ -79,12 +79,12 @@ cloudabi64_fixup(register_t **stack_base, struct image > td = curthread; > td->td_proc->p_osrel = __FreeBSD_version; > > - argdata = *stack_base; > + argdata = (void *)*stack_base; > > /* Store canary for stack smashing protection. */ > arc4rand(canarybuf, sizeof(canarybuf), 0); > - *stack_base -= howmany(sizeof(canarybuf), sizeof(register_t)); > - canary = *stack_base; > + *stack_base -= roundup(sizeof(canarybuf), sizeof(register_t)); > + canary = (void *)*stack_base; > error = copyout(canarybuf, canary, sizeof(canarybuf)); > if (error != 0) > return (error); > @@ -97,8 +97,8 @@ cloudabi64_fixup(register_t **stack_base, struct image > arc4rand(pidbuf, sizeof(pidbuf), 0); > pidbuf[6] = (pidbuf[6] & 0x0f) | 0x40; > pidbuf[8] = (pidbuf[8] & 0x3f) | 0x80; > - *stack_base -= howmany(sizeof(pidbuf), sizeof(register_t)); > - pid = *stack_base; > + *stack_base -= roundup(sizeof(pidbuf), sizeof(register_t)); > + pid = (void *)*stack_base; > error = copyout(pidbuf, pid, sizeof(pidbuf)); > if (error != 0) > return (error); > @@ -135,13 +135,13 @@ cloudabi64_fixup(register_t **stack_base, struct > image > #undef PTR > { .a_type = CLOUDABI_AT_NULL }, > }; > - *stack_base -= howmany(sizeof(auxv), sizeof(register_t)); > - error = copyout(auxv, *stack_base, sizeof(auxv)); > + *stack_base -= roundup(sizeof(auxv), sizeof(register_t)); > + error = copyout(auxv, (void *)*stack_base, sizeof(auxv)); > if (error != 0) > return (error); > > /* Reserve space for storing the TCB. */ > - *stack_base -= howmany(sizeof(cloudabi64_tcb_t), > sizeof(register_t)); > + *stack_base -= roundup(sizeof(cloudabi64_tcb_t), > sizeof(register_t)); > return (0); > } > > > Modified: head/sys/compat/cloudabi64/cloudabi64_util.h > > ============================================================================== > --- head/sys/compat/cloudabi64/cloudabi64_util.h Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/compat/cloudabi64/cloudabi64_util.h Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -42,8 +42,8 @@ extern Elf64_Brandinfo cloudabi64_brand; > #define TO_PTR(x) ((void *)(uintptr_t)(x)) > > /* Stack initialization during process execution. */ > -int cloudabi64_copyout_strings(struct image_params *, register_t **); > -int cloudabi64_fixup(register_t **, struct image_params *); > +int cloudabi64_copyout_strings(struct image_params *, uintptr_t *); > +int cloudabi64_fixup(uintptr_t *, struct image_params *); > > int cloudabi64_thread_setregs(struct thread *, > const cloudabi64_threadattr_t *, uint64_t); > > Modified: head/sys/compat/freebsd32/freebsd32_misc.c > > ============================================================================== > --- head/sys/compat/freebsd32/freebsd32_misc.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/compat/freebsd32/freebsd32_misc.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -3120,12 +3120,12 @@ syscall32_helper_unregister(struct > syscall_helper_data > } > > int > -freebsd32_copyout_strings(struct image_params *imgp, register_t > **stack_base) > +freebsd32_copyout_strings(struct image_params *imgp, uintptr_t > *stack_base) > { > int argc, envc, i; > u_int32_t *vectp; > char *stringp; > - uintptr_t destp; > + uintptr_t destp, ustringp; > struct freebsd32_ps_strings *arginfo; > char canary[sizeof(long) * 8]; > int32_t pagesizes32[MAXPAGESIZES]; > @@ -3195,20 +3195,24 @@ freebsd32_copyout_strings(struct image_params > *imgp, r > return (error); > imgp->pagesizeslen = sizeof(pagesizes32); > > + /* > + * Allocate room for the argument and environment strings. > + */ > destp -= ARG_MAX - imgp->args->stringspace; > destp = rounddown2(destp, sizeof(uint32_t)); > + ustringp = destp; > > - vectp = (uint32_t *)destp; > if (imgp->sysent->sv_stackgap != NULL) > - imgp->sysent->sv_stackgap(imgp, (u_long *)&vectp); > + imgp->sysent->sv_stackgap(imgp, &destp); > > if (imgp->auxargs) { > - error = imgp->sysent->sv_copyout_auxargs(imgp, > - (u_long *)&vectp); > + error = imgp->sysent->sv_copyout_auxargs(imgp, &destp); > if (error != 0) > return (error); > } > > + vectp = (uint32_t *)destp; > + > /* > * Allocate room for the argv[] and env vectors including the > * terminating NULL pointers. > @@ -3218,7 +3222,7 @@ freebsd32_copyout_strings(struct image_params *imgp, > r > /* > * vectp also becomes our initial stack base > */ > - *stack_base = (register_t *)vectp; > + *stack_base = (uintptr_t)vectp; > > stringp = imgp->args->begin_argv; > argc = imgp->args->argc; > @@ -3226,7 +3230,7 @@ freebsd32_copyout_strings(struct image_params *imgp, > r > /* > * Copy out strings - arguments and environment. > */ > - error = copyout(stringp, (void *)destp, > + error = copyout(stringp, (void *)ustringp, > ARG_MAX - imgp->args->stringspace); > if (error != 0) > return (error); > @@ -3242,11 +3246,11 @@ freebsd32_copyout_strings(struct image_params > *imgp, r > * Fill in argument portion of vector table. > */ > for (; argc > 0; --argc) { > - if (suword32(vectp++, (u_int32_t)(intptr_t)destp) != 0) > + if (suword32(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* a null vector table pointer separates the argp's from the > envp's */ > @@ -3261,11 +3265,11 @@ freebsd32_copyout_strings(struct image_params > *imgp, r > * Fill in environment portion of vector table. > */ > for (; envc > 0; --envc) { > - if (suword32(vectp++, (u_int32_t)(intptr_t)destp) != 0) > + if (suword32(vectp++, ustringp) != 0) > return (EFAULT); > while (*stringp++ != 0) > - destp++; > - destp++; > + ustringp++; > + ustringp++; > } > > /* end of vector table is a null pointer */ > > Modified: head/sys/compat/freebsd32/freebsd32_util.h > > ============================================================================== > --- head/sys/compat/freebsd32/freebsd32_util.h Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/compat/freebsd32/freebsd32_util.h Tue Dec 3 23:17:54 2019 > (r355373) > @@ -113,7 +113,7 @@ int syscall32_helper_unregister(struct syscall_help > struct iovec32; > struct rusage32; > int freebsd32_copyout_strings(struct image_params *imgp, > - register_t **stack_base); > + uintptr_t *stack_base); > int freebsd32_copyiniov(struct iovec32 *iovp, u_int iovcnt, > struct iovec **iov, int error); > void freebsd32_rusage_out(const struct rusage *s, struct rusage32 *s32); > > Modified: head/sys/compat/ia32/ia32_signal.h > > ============================================================================== > --- head/sys/compat/ia32/ia32_signal.h Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/compat/ia32/ia32_signal.h Tue Dec 3 23:17:54 2019 > (r355373) > @@ -206,7 +206,7 @@ extern int sz_ia32_osigcode; > extern int sz_lcall_tramp; > void ia32_sendsig(sig_t, struct ksiginfo *, sigset_t *); > void ia32_setregs(struct thread *td, struct image_params *imgp, > - u_long stack); > + uintptr_t stack); > int setup_lcall_gate(void); > > #endif > > Modified: head/sys/i386/cloudabi32/cloudabi32_sysvec.c > > ============================================================================== > --- head/sys/i386/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 > 23:11:40 2019 (r355372) > +++ head/sys/i386/cloudabi32/cloudabi32_sysvec.c Tue Dec 3 > 23:17:54 2019 (r355373) > @@ -48,7 +48,7 @@ extern const char *cloudabi32_syscallnames[]; > extern struct sysent cloudabi32_sysent[]; > > static int > -cloudabi32_fixup_tcb(register_t **stack_base, struct image_params *imgp) > +cloudabi32_fixup_tcb(uintptr_t *stack_base, struct image_params *imgp) > { > int error; > uint32_t args[2]; > @@ -68,16 +68,16 @@ cloudabi32_fixup_tcb(register_t **stack_base, struct i > * refer to the auxiliary vector, which is stored right after > * the TCB. > */ > - args[0] = (uintptr_t)*stack_base; > - args[1] = (uintptr_t)*stack_base + > + args[0] = *stack_base; > + args[1] = *stack_base + > roundup(sizeof(cloudabi32_tcb_t), sizeof(register_t)); > - *stack_base -= howmany(sizeof(args), sizeof(register_t)); > - return (copyout(args, *stack_base, sizeof(args))); > + *stack_base -= roundup(sizeof(args), sizeof(register_t)); > + return (copyout(args, (void *)*stack_base, sizeof(args))); > } > > static void > cloudabi32_proc_setregs(struct thread *td, struct image_params *imgp, > - unsigned long stack) > + uintptr_t stack) > { > > exec_setregs(td, imgp, stack); > > Modified: head/sys/i386/i386/machdep.c > > ============================================================================== > --- head/sys/i386/i386/machdep.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/i386/i386/machdep.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -1124,7 +1124,7 @@ setup_priv_lcall_gate(struct proc *p) > * Reset registers to default values on exec. > */ > void > -exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) > +exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t > stack) > { > struct trapframe *regs; > struct pcb *pcb; > > Modified: head/sys/i386/linux/linux_sysvec.c > > ============================================================================== > --- head/sys/i386/linux/linux_sysvec.c Tue Dec 3 23:11:40 2019 > (r355372) > +++ head/sys/i386/linux/linux_sysvec.c Tue Dec 3 23:17:54 2019 > (r355373) > @@ -88,15 +88,15 @@ extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL > > SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); > > -static int linux_fixup(register_t **stack_base, > +static int linux_fixup(uintptr_t *stack_base, > struct image_params *iparams); > -static int linux_fixup_elf(register_t **stack_base, > +static int linux_fixup_elf(uintptr_t *stack_base, > struct image_params *iparams); > static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t > *mask); > static void linux_exec_setregs(struct thread *td, > - struct image_params *imgp, u_long stack); > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-all@freebsd.org Wed Dec 4 03:36:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E93801C7AB1; Wed, 4 Dec 2019 03:36:54 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SPfZ5tLyz4KZ2; Wed, 4 Dec 2019 03:36:54 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD5E32206B; Wed, 4 Dec 2019 03:36:54 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB43asvq077058; Wed, 4 Dec 2019 03:36:54 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB43asGj077057; Wed, 4 Dec 2019 03:36:54 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912040336.xB43asGj077057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Wed, 4 Dec 2019 03:36:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355377 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 355377 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:36:55 -0000 Author: dougm Date: Wed Dec 4 03:36:54 2019 New Revision: 355377 URL: https://svnweb.freebsd.org/changeset/base/355377 Log: Change the implementation of bit_ffc_area_at so that, in the worst case, the number of operations spent on each b-bit word is proportional to lg b rather than b. For one word, shrink all regions of 0-bits by size-1 bit positions in no more than O(lg(min(b,size))) operations. In what remains, the first 0-bit is either the start of an area of sufficient size contained within the original word, or the start of an area that could spill over into the next word, and prove to be of sufficient size once the start of that word is examined. Change bit_ffs_area_at similarly. Reviewed by: erj, jacob.e.keller_intel.com MFC with: r354977 Differential Revision: https://reviews.freebsd.org/D22523 Modified: head/sys/sys/bitstring.h Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Wed Dec 4 02:59:50 2019 (r355376) +++ head/sys/sys/bitstring.h Wed Dec 4 03:36:54 2019 (r355377) @@ -277,66 +277,96 @@ bit_ffc(bitstr_t *_bitstr, int _nbits, int *_result) /* Find contiguous sequence of at least size set bits at or after start */ static inline void -bit_ffs_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size, int *_result) +bit_ffs_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size, + int *_result) { - int _index, _end, _i; -again: - /* Find the first set bit */ - bit_ffs_at(_bitstr, _start, _nbits, &_index); - if (_index < 0) { - *_result = -1; - return; - } + bitstr_t *_curbitstr; + bitstr_t _test; + int _value, _offset, _logsize, _b; - /* Make sure there is enough room left in the bitstr */ - _end = _index + _size; - if (_end > _nbits) { + if (_start + _size > _nbits || _nbits <= 0) { *_result = -1; return; } - /* Find the next cleared bit starting at _index, stopping at _end */ - bit_ffc_at(_bitstr, _index, _end, &_i); - if (_i >= 0) { - /* we found a clear bit between _index and _end, so skip ahead - * to the next bit and try again - */ - _start = _i + 1; - goto again; + _logsize = fls(_size - 1); + _value = _start; + _curbitstr = _bitstr + _bit_idx(_start); + _test = ~*_curbitstr; + if (_bit_offset(_start) != 0) + _test |= _bit_make_mask(0, _start - 1); + for (_offset = 0;; _offset -= _BITSTR_BITS, _test = ~*++_curbitstr) { + if (_test != 0) { + /* If leading 0s in _test can finish 0-area, stop. */ + if (_offset + _size < (int)_BITSTR_BITS && + (_test & _bit_make_mask(0, _offset + _size)) == 0) + break; + /* Shrink-left every 0-area in _test by size-1 bits. */ + _b = _logsize; + while ((_test & (_test + 1)) != 0 && _b-- > 0) + _test |= _test >> (((_size - 1) >> _b) + 1) / 2; + /* Find the start of the first 0-area in _test. */ + _offset = (~_test == 0) ? _BITSTR_BITS : + ffsl(~_test) - 1; + _value = (_curbitstr - _bitstr) * _BITSTR_BITS + + _offset; + /* If there's insufficient space left, give up. */ + if (_value + _size > _nbits) { + _value = -1; + break; + } + } + if (_offset + _size <= (int)_BITSTR_BITS) + break; } - *_result = _index; + *_result = _value; } /* Find contiguous sequence of at least size cleared bits at or after start */ static inline void -bit_ffc_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size, int *_result) +bit_ffc_area_at(bitstr_t *_bitstr, int _start, int _nbits, int _size, + int *_result) { - int _index, _end, _i; -again: - /* Find the first zero bit */ - bit_ffc_at(_bitstr, _start, _nbits, &_index); - if (_index < 0) { - *_result = -1; - return; - } + bitstr_t *_curbitstr; + bitstr_t _test; + int _value, _offset, _logsize, _b; - /* Make sure there is enough room left in the bitstr */ - _end = _index + _size; - if (_end > _nbits) { + if (_start + _size > _nbits || _nbits <= 0) { *_result = -1; return; } - /* Find the next set bit starting at _index, stopping at _end */ - bit_ffs_at(_bitstr, _index, _end, &_i); - if (_i >= 0) { - /* we found a set bit between _index and _end, so skip ahead - * to the next bit and try again - */ - _start = _i + 1; - goto again; + _logsize = fls(_size - 1); + _value = _start; + _curbitstr = _bitstr + _bit_idx(_start); + _test = *_curbitstr; + if (_bit_offset(_start) != 0) + _test |= _bit_make_mask(0, _start - 1); + for (_offset = 0;; _offset -= _BITSTR_BITS, _test = *++_curbitstr) { + if (_test != 0) { + /* If leading 0s in _test can finish 0-area, stop. */ + if (_offset + _size < (int)_BITSTR_BITS && + (_test & _bit_make_mask(0, _offset + _size)) == 0) + break; + /* Shrink-left every 0-area in _test by size-1 bits. */ + _b = _logsize; + while ((_test & (_test + 1)) != 0 && _b-- > 0) + _test |= _test >> (((_size - 1) >> _b) + 1) / 2; + /* Find the start of the first 0-area in _test. */ + _offset = (~_test == 0) ? _BITSTR_BITS : + ffsl(~_test) - 1; + _value = (_curbitstr - _bitstr) * _BITSTR_BITS + + _offset; + /* If there's insufficient space left, give up. */ + if (_value + _size > _nbits) { + _value = -1; + break; + } + } + if (_offset + _size <= (int)_BITSTR_BITS) + break; } - *_result = _index; + *_result = _value; } /* Find contiguous sequence of at least size set bits in bit string */ From owner-svn-src-all@freebsd.org Wed Dec 4 03:41:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B4A81C7D5C; Wed, 4 Dec 2019 03:41:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SPmN1Kc7z4KxL; Wed, 4 Dec 2019 03:41:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1272F221F6; Wed, 4 Dec 2019 03:41:56 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB43ftYX081725; Wed, 4 Dec 2019 03:41:55 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB43ftw6081724; Wed, 4 Dec 2019 03:41:55 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912040341.xB43ftw6081724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 4 Dec 2019 03:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355378 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 355378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:41:56 -0000 Author: jhibbits Date: Wed Dec 4 03:41:55 2019 New Revision: 355378 URL: https://svnweb.freebsd.org/changeset/base/355378 Log: powerpc/booke: Fix 32-bit Book-E SMP AP bringup r354266 changed the type of bp_kernload to vm_paddr_t in platform_mpc85xx.c, but not the variable itself in locore.S. This caused the AP to not come up, due to overwriting the following variable (bp_virtaddr). Also, properly load bp_kernload into MAS3 and MAS7. Prior to r354266, we required loading into the low 4GB, but now we can load from anywhere in memory that ubldr can access. Modified: head/sys/powerpc/booke/locore.S Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Wed Dec 4 03:36:54 2019 (r355377) +++ head/sys/powerpc/booke/locore.S Wed Dec 4 03:41:55 2019 (r355378) @@ -443,7 +443,7 @@ bp_trace: .globl bp_kernload bp_kernload: - ADDR(0) /* Kern phys. load address. */ + .llong 0 /* Kern phys. load address. */ .globl bp_virtaddr bp_virtaddr: @@ -548,14 +548,15 @@ bp_virtaddr: #else clrrwi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */ #endif - LOAD %r4, (bp_kernload - __boot_page)(%r3) + /* Load lower half of the kernel loadaddr. */ + lwz %r4, (bp_kernload - __boot_page + 4)(%r3) LOAD %r5, (bp_virtaddr - __boot_page)(%r3) /* Set RPN and protection */ ori %r4, %r4, (MAS3_SX | MAS3_SW | MAS3_SR)@l mtspr SPR_MAS3, %r4 isync - li %r4, 0 + lwz %r4, (bp_kernload - __boot_page)(%r3) mtspr SPR_MAS7, %r4 isync tlbwe From owner-svn-src-all@freebsd.org Wed Dec 4 03:44:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 00D6C1C7E51; Wed, 4 Dec 2019 03:44:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SPqk6Cx6z4L8T; Wed, 4 Dec 2019 03:44:50 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B96B722241; Wed, 4 Dec 2019 03:44:50 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB43io0j082851; Wed, 4 Dec 2019 03:44:50 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB43ioAQ082850; Wed, 4 Dec 2019 03:44:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201912040344.xB43ioAQ082850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 4 Dec 2019 03:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355379 - head/usr.sbin/mergemaster X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/usr.sbin/mergemaster X-SVN-Commit-Revision: 355379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:44:51 -0000 Author: bdrewery Date: Wed Dec 4 03:44:50 2019 New Revision: 355379 URL: https://svnweb.freebsd.org/changeset/base/355379 Log: Run make in parallel. This is mostly targetting the 'installconfig' phase of 'distribution' which does a full tree walk. MFC after: 2 weeks Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Wed Dec 4 03:41:55 2019 (r355378) +++ head/usr.sbin/mergemaster/mergemaster.sh Wed Dec 4 03:44:50 2019 (r355379) @@ -508,6 +508,7 @@ SOURCEDIR=$(realpath "$SOURCEDIR") # Setup make to use system files from SOURCEDIR MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk -DNO_FILEMON" +MM_MAKE="${MM_MAKE} -j$(sysctl -n hw.ncpu)" # Check DESTDIR against the mergemaster mtree database to see what # files the user changed from the reference files. From owner-svn-src-all@freebsd.org Wed Dec 4 03:47:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 21A1A1C7F3F; Wed, 4 Dec 2019 03:47:31 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47SPtp2GxDz4LHn; Wed, 4 Dec 2019 03:47:30 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x343.google.com with SMTP id s14so6252343wmh.4; Tue, 03 Dec 2019 19:47:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=7hf0LcIgjZXclHUI512QfeKQ7YRrTp611H7xgct+S6A=; b=uX2rh/np1LXu1tgp0xD9VnFWxipWMzoz3zzUERZMd83o363p8ncjj/b1dsOA1PNncv lhxVSyxOcOMtYX7pfMNd5DbEM9pzvsg3MZkoBbi//c9qI7A/z8iecpMgmVg2bakC51Pr GW0t2kAUno1cvRDZK23HvWfRQJVz44BW9Ktv0gc0yqjDPlV7FXEEbdVBdqgaC+4jhCe9 mYv6FwJEElHi77pTwaeCQLpf8YOa9+KSuzfwPxuh7nmDZf9uu+a1iN9ytNIRLJUAoVVk gyeJp7puaaDI8A4/gsLPi/AM0QOcKgTSY7c01WGrKhqNOFa8wEzZktTTkxn4T0ZgZcEJ bd5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=7hf0LcIgjZXclHUI512QfeKQ7YRrTp611H7xgct+S6A=; b=CEO04RB4nCGdU7lHsWPIzV96xf3HWBMIVXddcbo9iShqgTBLDVc2ECuEKYeOJtXskd BPiXYp/GbddrPAioTD7C4PfmToWljWM3bOVZT+OzcjfqFdSACw3wdS4nMteY1GfougIn 2uXFXi/ErYJcAiHIMaIaU3HYNnLfJuzMqXEZ4QY0f9rNEceSoYV2FEddDkH1e/+qwCBs eByjR41fMHtuFZXw9iCRjDD4AqJKmZuJFY0pNW7aEdeMQZuGXRMFpUTgy9VfEUfSkLgB J5Pna0w+4gaBiXlQZNWmUN9jHR9513GObnSgf3Alef7iM3ZrSs/bSDVBlWBIIRE3GEut tsSw== X-Gm-Message-State: APjAAAX4Hcqe0vWqgOk1j/62tNEco1AENGzyfxfVenBs7xJjV6IrGZkS DJQ2C2eCGdfkRXvZriD0jFgVYHJ/FmQvC2togJUyLA== X-Google-Smtp-Source: APXvYqyqcGWqOIAZUEBV17IvdrFwmhgeDojggcsDS7k2OiRYVAh3i46+1OgzlzcTvFtlJnQyUHdx9zh/d+jo+pqupA8= X-Received: by 2002:a1c:2e91:: with SMTP id u139mr32995357wmu.154.1575431247695; Tue, 03 Dec 2019 19:47:27 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:9ed0:0:0:0:0:0 with HTTP; Tue, 3 Dec 2019 19:47:27 -0800 (PST) In-Reply-To: <6cd7168c-8212-3001-fb8f-09ecaca93e61@FreeBSD.org> References: <201911301933.xAUJX2DB030548@repo.freebsd.org> <6cd7168c-8212-3001-fb8f-09ecaca93e61@FreeBSD.org> From: Mateusz Guzik Date: Wed, 4 Dec 2019 04:47:27 +0100 Message-ID: Subject: Re: svn commit: r355241 - head/sys/kern To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47SPtp2GxDz4LHn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=uX2rh/np; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::343 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; IP_SCORE(0.00)[ip: (3.07), ipnet: 2a00:1450::/32(-2.69), asn: 15169(-1.93), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[3.4.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:47:31 -0000 On 12/2/19, John Baldwin wrote: > On 11/30/19 11:33 AM, Mateusz Guzik wrote: >> Author: mjg >> Date: Sat Nov 30 19:33:02 2019 >> New Revision: 355241 >> URL: https://svnweb.freebsd.org/changeset/base/355241 >> >> Log: >> smp: cast the read in quiesce_all_critical through void * >> >> Fixes compilation on some 32-bit arm platforms. >> >> Sponsored by: The FreeBSD Foundation >> >> Modified: >> head/sys/kern/subr_smp.c >> >> Modified: head/sys/kern/subr_smp.c >> ============================================================================== >> --- head/sys/kern/subr_smp.c Sat Nov 30 19:21:29 2019 (r355240) >> +++ head/sys/kern/subr_smp.c Sat Nov 30 19:33:02 2019 (r355241) >> @@ -952,7 +952,7 @@ quiesce_all_critical(void) >> break; >> cpu_spinwait(); >> newtd = (struct thread *) >> - atomic_load_acq_ptr((u_long *)pcpu->pc_curthread); >> + atomic_load_acq_ptr((void *)pcpu->pc_curthread); > > Why not uintptr_t *? I think that's the defined type for atomic_*_ptr > anyway? > I have no strong opinion one way or the other. However, the real fix would make these routines work without casting for cases like the above. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Wed Dec 4 03:51:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 629801C8037; Wed, 4 Dec 2019 03:51:31 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SPzR1vCJz4LVQ; Wed, 4 Dec 2019 03:51:31 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24F3C223A5; Wed, 4 Dec 2019 03:51:31 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB43pUN8083915; Wed, 4 Dec 2019 03:51:30 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB43pU31083914; Wed, 4 Dec 2019 03:51:30 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912040351.xB43pU31083914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 4 Dec 2019 03:51:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355380 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 355380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:51:31 -0000 Author: jhibbits Date: Wed Dec 4 03:51:30 2019 New Revision: 355380 URL: https://svnweb.freebsd.org/changeset/base/355380 Log: powerpc/booke: Fix some formatting errors in debug printfs Use the right formats for the types given (vm_offset_t and vm_size_t are both uint32_t on 32-bit platforms, and uint64_t on 64-bit platforms, and match size_t in size, so we can use the size_t format as we do in other similar code). These were found by clang. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Dec 4 03:44:50 2019 (r355379) +++ head/sys/powerpc/booke/pmap.c Wed Dec 4 03:51:30 2019 (r355380) @@ -1622,8 +1622,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o /* Pre-round up to 1MB. This wastes some space, but saves TLB entries */ data_end = roundup2(data_end, 1 << 20); debugf(" data_end: 0x%"PRI0ptrX"\n", data_end); - debugf(" kernstart: %p\n", kernstart); - debugf(" kernsize: %lx\n", kernsize); + debugf(" kernstart: %#zx\n", kernstart); + debugf(" kernsize: %#zx\n", kernsize); if (data_end - kernstart > kernsize) { kernsize += tlb1_mapin_region(kernstart + kernsize, From owner-svn-src-all@freebsd.org Wed Dec 4 03:55:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D688C1C8246; Wed, 4 Dec 2019 03:55:51 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SQ4Q68PRz4Lr9; Wed, 4 Dec 2019 03:55:50 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1575431740; bh=bR2lwmmDZBjN4eqeIR7pCPZ6VlYK5rsrPJmIxdLeQFA=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=jyQiznifIqC3eOM9FNqwBh/tdOCGpses+FMouQwtze0MkLawHRGw/5LIAQQUJoBV9 SAkhU/SPtVOSJ/vPUcCEWMwjU6wT8DbYpiNyjlQ41vyfHf9yt9+sKD50UYTkCZsMlJ iXGyfNKO3KTHJ3DaWuZ9I5u7pBbwRESYO5CvO1oY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from thor.intern.walstatt.dynvpn.de ([77.13.156.199]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M4b1o-1iah4P41Cw-001jHq; Wed, 04 Dec 2019 04:55:40 +0100 Date: Wed, 4 Dec 2019 04:55:04 +0100 From: "O. Hartmann" To: Bryan Drewery Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355379 - head/usr.sbin/mergemaster Message-ID: <20191204045531.10ce17d2@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201912040344.xB43ioAQ082850@repo.freebsd.org> References: <201912040344.xB43ioAQ082850@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:BMLioKCr7CiyHjcSeKHxKebAjnDMo5Orq2tN6sPH2KahHvbH6G9 NMpeBP4RqdlHfforg5k4mQ1oZHzpDGp1yIvLohACABl6w0Vok78jSC+QRMfnrBND9CLp8qa vaGizCzgAnrEwwVx60f+/9MG8XXqH3GJwoLDCWm/hy751gdEmimaX4565gqTgH0zb1pJyIN NIc0H/96EMo5fpt1uCMoA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:tzqUmEXDb9w=:tBH27HruLvp9NfQ7QeQEXb /e4F478U10HiKGAvf5eAGq9S0yKhfgD0U5bI4LB5uZJsH/fAaCfTcnJiArqcRRm6bgNAXT94Y eez1sAwGHPGePOPC/CFYdIYGfGu4+BCh3iSphiRH6zy4OfiacRZD84Av/OwOvCeAHPS7b89qI OoqK2tSsGoErJAfbwEN97PTTZsyoRvfUxucCONL4FDsxyjbyRlJ7zbay7Q4viBONfi3GjyW2G HCl0iDJl14SdQNONyuBrZqK6Lp7rgFKvzRyEWLDVwrJ0GUVjGTv3FJmoh0u8T1aRWeKKQEWAD VSId0u0QFabjTrDChPReuwVv/qg1LDfKo3EjmWpcKT4yk12oEyjDpJm+mgm6pKFgex6jHJ84P Y/FVeAwUp8AIQC+CGcW3Mboxh7BP3SV/ktb+k9azdYGiKZhFdtxYEvVF0SsGeGFf39WDpKMbV DhixjhTIQZn96ePFgpqP19V5uA77ZNc1Y5I+8vGL7lyY9OrupjmjM69R8nRTadhhM8jAdDB7U q00kg0TpFBgm3pAkN/UJVxzXDuCxPaC3lmiVu7oFcPoH8aJvn2JDp4pHA6GPSALX+n59IrcIo +dAtcYvy7wuAW9plqX2NUlJtJG+OK80+22z8wrfgX59NoRACq3T2/tbHkuYewbomfXfO29nUV oq0CBLeyjRNujfbIKS5KqKshpQXPFMFKeK3i8VM2XLER/peZMA71W6qXCqIEFNDzjWWHDnCL1 VX/dOksjz7JYM/fx4uc5ZRd5rNy8bok9sgY+hUohigpv6t6C3WPHoDFwDTqOZgxGCUkOSczMO cvb9HHyESLADPGnU+mhyAx+0ZnzgMaT9Ojw1veZoh9A+9WW3XANxXutSd46VcJK2k6ZqusGHN Spt13Pt9XsEYdkzWbd8Dx8HKdkt4vkv6ZHFhFJfJjDjN4b3aiwqbDIiF7Gc5INAexFeDP32ir fb38atxJayK1tksigkmXZ6L9KRCgCCCQ2SC4R6TZZdOELYHemctxcbrNy38L/0H4q+jXkZu6X xZjU4TAHKi8fUFwJfjGjT4QGzdQdXDnKIMjUi+RFp1iQIfox0hK/xbKQyDKuPY/M17bhzpJ1l a5bJy9LAwH2lK0izurwfLeCnhcY5mwKnEXdzG8UNcUY1QachtnLvn4vWAV+UKoSkHWt3jeer5 g1JcqR0EWRZnZN2p/S7JApaiPdyA4XIIFlznzuJkAsSC4gol0WFpY8vjKzrtgSMcFjU2FrtRk DeHzP1GKeyjNbhAf7oJXzlVZQYb/q2YqhRBGlp47M0wvVJ/rE4nwBsR3KXOU= X-Rspamd-Queue-Id: 47SQ4Q68PRz4Lr9 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=jyQiznif; dmarc=none; spf=none (mx1.freebsd.org: domain of o.hartmann@walstatt.org has no SPF policy when checking 212.227.15.15) smtp.mailfrom=o.hartmann@walstatt.org X-Spamd-Result: default: False [-3.34 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; RECEIVED_SPAMHAUS_PBL(0.00)[199.156.13.77.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; HAS_ORG_HEADER(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; DKIM_TRACE(0.00)[gmx.net:+]; MIME_BASE64_TEXT(0.10)[]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-1.14)[ip: (-6.82), ipnet: 212.227.0.0/16(-1.16), asn: 8560(2.29), country: DE(-0.01)]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[15.15.227.212.rep.mailspike.net : 127.0.0.17] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 03:55:51 -0000 LS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NBR0UtLS0tLQ0KSGFzaDogU0hBMjU2DQoNCkFtIFdl ZCwgNCBEZWMgMjAxOSAwMzo0NDo1MCArMDAwMCAoVVRDKQ0KQnJ5YW4gRHJld2VyeSA8YmRyZXdl cnlARnJlZUJTRC5vcmc+IHNjaHJpZWI6DQoNCj4gQXV0aG9yOiBiZHJld2VyeQ0KPiBEYXRlOiBX ZWQgRGVjICA0IDAzOjQ0OjUwIDIwMTkNCj4gTmV3IFJldmlzaW9uOiAzNTUzNzkNCj4gVVJMOiBo dHRwczovL3N2bndlYi5mcmVlYnNkLm9yZy9jaGFuZ2VzZXQvYmFzZS8zNTUzNzkNCj4gDQo+IExv ZzoNCj4gICBSdW4gbWFrZSBpbiBwYXJhbGxlbC4NCj4gICANCj4gICBUaGlzIGlzIG1vc3RseSB0 YXJnZXR0aW5nIHRoZSAnaW5zdGFsbGNvbmZpZycgcGhhc2Ugb2YgJ2Rpc3RyaWJ1dGlvbicNCj4g ICB3aGljaCBkb2VzIGEgZnVsbCB0cmVlIHdhbGsuDQo+ICAgDQo+ICAgTUZDIGFmdGVyOgkgMiB3 ZWVrcw0KPiANCj4gTW9kaWZpZWQ6DQo+ICAgaGVhZC91c3Iuc2Jpbi9tZXJnZW1hc3Rlci9tZXJn ZW1hc3Rlci5zaA0KPiANCj4gTW9kaWZpZWQ6IGhlYWQvdXNyLnNiaW4vbWVyZ2VtYXN0ZXIvbWVy Z2VtYXN0ZXIuc2gNCj4gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09DQo+IC0tLSBoZWFkL3Vzci5zYmlu L21lcmdlbWFzdGVyL21lcmdlbWFzdGVyLnNoCVdlZCBEZWMgIDQgMDM6NDE6NTUgMjAxOQkocjM1 NTM3OCkNCj4gKysrIGhlYWQvdXNyLnNiaW4vbWVyZ2VtYXN0ZXIvbWVyZ2VtYXN0ZXIuc2gJV2Vk IERlYyAgNCAwMzo0NDo1MCAyMDE5CShyMzU1Mzc5KQ0KPiBAQCAtNTA4LDYgKzUwOCw3IEBAIFNP VVJDRURJUj0kKHJlYWxwYXRoICIkU09VUkNFRElSIikNCj4gIA0KPiAgIyBTZXR1cCBtYWtlIHRv IHVzZSBzeXN0ZW0gZmlsZXMgZnJvbSBTT1VSQ0VESVINCj4gIE1NX01BS0U9Im1ha2UgJHtBUkNI U1RSSU5HfSAtbSAke1NPVVJDRURJUn0vc2hhcmUvbWsgLUROT19GSUxFTU9OIg0KPiArTU1fTUFL RT0iJHtNTV9NQUtFfSAtaiQoc3lzY3RsIC1uIGh3Lm5jcHUpIg0KPiAgDQo+ICAjIENoZWNrIERF U1RESVIgYWdhaW5zdCB0aGUgbWVyZ2VtYXN0ZXIgbXRyZWUgZGF0YWJhc2UgdG8gc2VlIHdoYXQN Cj4gICMgZmlsZXMgdGhlIHVzZXIgY2hhbmdlZCBmcm9tIHRoZSByZWZlcmVuY2UgZmlsZXMuDQo+ IF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fDQo+IHN2bi1z cmMtaGVhZEBmcmVlYnNkLm9yZyBtYWlsaW5nIGxpc3QNCj4gaHR0cHM6Ly9saXN0cy5mcmVlYnNk Lm9yZy9tYWlsbWFuL2xpc3RpbmZvL3N2bi1zcmMtaGVhZA0KPiBUbyB1bnN1YnNjcmliZSwgc2Vu ZCBhbnkgbWFpbCB0byAic3ZuLXNyYy1oZWFkLXVuc3Vic2NyaWJlQGZyZWVic2Qub3JnIg0KDQpX aGF0ZXZlciBJIGRvLCBtZXJnZW1hc3RlciBkb2VzIG5vdCB3b3JrIGFueW1vcmUgYWZ0ZXIgdGhp cyBjb21taXQ6DQoNClsuLi5dDQojIG1lcmdlbWFzdGVyDQoNCi91c3Ivc2Jpbi9tZXJnZW1hc3Rl cjogc3lzY3RsOiBub3QgZm91bmQNCioqKiBUaGUgZGlyZWN0b3J5IHNwZWNpZmllZCBmb3IgdGhl IHRlbXBvcmFyeSByb290IGVudmlyb25tZW50LA0KICAgIC92YXIvdG1wL3RlbXByb290LCBleGlz dHMuICBUaGlzIGNhbiBiZSBhIHNlY3VyaXR5IHJpc2sgaWYgdW50cnVzdGVkDQogICAgdXNlcnMg aGF2ZSBhY2Nlc3MgdG8gdGhlIHN5c3RlbS4NCg0KICBVc2UgJ2QnIHRvIGRlbGV0ZSB0aGUgb2xk IC92YXIvdG1wL3RlbXByb290IGFuZCBjb250aW51ZQ0KICBVc2UgJ3QnIHRvIHNlbGVjdCBhIG5l dyB0ZW1wb3Jhcnkgcm9vdCBkaXJlY3RvcnkNCiAgVXNlICdlJyB0byBleGl0IG1lcmdlbWFzdGVy DQoNCiAgRGVmYXVsdCBpcyB0byB1c2UgL3Zhci90bXAvdGVtcHJvb3QgYXMgaXMNCg0KSG93IHNo b3VsZCBJIGRlYWwgd2l0aCB0aGlzPyBbVXNlIHRoZSBleGlzdGluZyAvdmFyL3RtcC90ZW1wcm9v dF0gZA0KDQogICAqKiogRGVsZXRpbmcgdGhlIG9sZCAvdmFyL3RtcC90ZW1wcm9vdA0KDQoqKiog Q3JlYXRpbmcgdGhlIHRlbXBvcmFyeSByb290IGVudmlyb25tZW50IGluIC92YXIvdG1wL3RlbXBy b290DQogKioqIC92YXIvdG1wL3RlbXByb290IHJlYWR5IGZvciB1c2UNCiAqKiogQ3JlYXRpbmcg YW5kIHBvcHVsYXRpbmcgZGlyZWN0b3J5IHN0cnVjdHVyZSBpbiAvdmFyL3RtcC90ZW1wcm9vdA0K DQptYWtlOiBpbGxlZ2FsIGFyZ3VtZW50IHRvIC1qIC0tIG11c3QgYmUgcG9zaXRpdmUgaW50ZWdl ciENCg0KICAqKiogRkFUQUwgRVJST1I6IENhbm5vdCAnY2QnIHRvIC91c3Ivc3JjIGFuZCBpbnN0 YWxsIGZpbGVzIHRvDQogICAgICB0aGUgdGVtcHJvb3QgZW52aXJvbm1lbnQNCg0KDQotIC0tIA0K Ty4gSGFydG1hbm4NCg0KSWNoIHdpZGVyc3ByZWNoZSBkZXIgTnV0enVuZyBvZGVyIMOcYmVybWl0 dGx1bmcgbWVpbmVyIERhdGVuIGbDvHINCldlcmJlendlY2tlIG9kZXIgZsO8ciBkaWUgTWFya3Qt IG9kZXIgTWVpbnVuZ3Nmb3JzY2h1bmcgKMKnIDI4IEFicy4gNCBCRFNHKS4NCi0tLS0tQkVHSU4g UEdQIFNJR05BVFVSRS0tLS0tDQoNCmlIVUVBUllJQUIwV0lRU3k4SUJ4QVBEa3FWQmFUSjQ0TjFa WlBiYTVSd1VDWGVjdU5BQUtDUkE0TjFaWlBiYTUNClJ5V2dBUURldlhWMWJ3eDg2Q2d3VTd0T1VZ RTNHKzFQS3o1ZmdudFZuWFQ2ODRaSlhBRC9TNFZYd0JpUXg3ekMNCklvYzBlSjFyM3h5ZWpZdERK QVFvamNBSFNkbUh5Z1k9DQo9Nk5tRw0KLS0tLS1FTkQgUEdQIFNJR05BVFVSRS0tLS0tDQo= From owner-svn-src-all@freebsd.org Wed Dec 4 04:01:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECD7D1C839F; Wed, 4 Dec 2019 04:01:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SQCP61p4z4MJD; Wed, 4 Dec 2019 04:01:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2D722259F; Wed, 4 Dec 2019 04:01:53 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB441rxx092535; Wed, 4 Dec 2019 04:01:53 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB441rn2092534; Wed, 4 Dec 2019 04:01:53 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201912040401.xB441rn2092534@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 4 Dec 2019 04:01:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355381 - head/usr.sbin/mergemaster X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/usr.sbin/mergemaster X-SVN-Commit-Revision: 355381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 04:01:54 -0000 Author: bdrewery Date: Wed Dec 4 04:01:53 2019 New Revision: 355381 URL: https://svnweb.freebsd.org/changeset/base/355381 Log: Use full path to sysctl(8) since /sbin is not in PATH. X-MFC-With: r355379 MFC after: 2 weeks Modified: head/usr.sbin/mergemaster/mergemaster.sh Modified: head/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- head/usr.sbin/mergemaster/mergemaster.sh Wed Dec 4 03:51:30 2019 (r355380) +++ head/usr.sbin/mergemaster/mergemaster.sh Wed Dec 4 04:01:53 2019 (r355381) @@ -508,7 +508,7 @@ SOURCEDIR=$(realpath "$SOURCEDIR") # Setup make to use system files from SOURCEDIR MM_MAKE="make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk -DNO_FILEMON" -MM_MAKE="${MM_MAKE} -j$(sysctl -n hw.ncpu)" +MM_MAKE="${MM_MAKE} -j$(/sbin/sysctl -n hw.ncpu)" # Check DESTDIR against the mergemaster mtree database to see what # files the user changed from the reference files. From owner-svn-src-all@freebsd.org Wed Dec 4 04:03:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7C401C8598; Wed, 4 Dec 2019 04:03:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SQDr5PzPz4MVL; Wed, 4 Dec 2019 04:03:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (unknown [127.0.1.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 7E60518AF6; Wed, 4 Dec 2019 04:03:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 4608E1B8FC; Wed, 4 Dec 2019 04:03:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id iOWigdpydZEz; Wed, 4 Dec 2019 04:03:03 +0000 (UTC) Subject: Re: svn commit: r355379 - head/usr.sbin/mergemaster DKIM-Filter: OpenDKIM Filter v2.10.3 mail.xzibition.com 1E4C61B8F4 To: "O. Hartmann" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912040344.xB43ioAQ082850@repo.freebsd.org> <20191204045531.10ce17d2@thor.intern.walstatt.dynvpn.de> From: Bryan Drewery Autocrypt: addr=bdrewery@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFJphmsBCADiFgmS4bIzwZijrS31SjEMzg+n5zNellgM+HkShwehpqCiyhXdWrvH6dTZ a6u50pbUIX7doTR7W7PQHCjCTqtpwvcj0eulZva+iHFp+XrbgSFHn+VVXgkYP2MFySyZRFab D2qqzJBEJofhpv4HvY6uQI5K99pMqKr1Z/lHqsijYYu4RH2OfwB5PinId7xeldzWEonVoCr+ rfxzO/UrgA6v/3layGZcKNHFjmc3NqoN1DXtdaEHqtjIozzbndVkH6lkFvIpIrI6i5ox8pwp VxsxLCr/4Musd5CWgHiet5kSw2SzNeA8FbxdLYCpXNVu+uBACEbCUP+CSNy3NVfEUxsBABEB AAG0JEJyeWFuIERyZXdlcnkgPGJkcmV3ZXJ5QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwUL CQgHAwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hLu BQkNPvODAAoJEDXXcbtuRpfP9rMH/3f7cfX5rzyEV5QNfV/wS4jFukLoPZ4+nCM/TKxH3pEX 2bLbeQbkk6La8cueQ5Lpoht5XFZ18Y5TbMittngltrlNzoDD0h9are24OkDFGim3afJU7tkj IGQa1if+re+vI5BhzYwRhj0oKXzBi39M5oePd3L1dXfx83rg2FPyZBdIejsz6fR74T3JVkbd 6k2l5/3Zk2uiNMy+eBfDRgYE1E6CP28kV0nCeGKZgSVso0kGUUHud7voKqGVpMvbd0mE4pp4 PE5YJaFPjrll9miaDAvdU8LGIq5n6+aXPLKoQ/QNl6mg6ifgI6FfKILOkTizLW8E5PBSNnCm NapQ55yjm125AQ0EUmmGawEIAKJUU9+Q19oW1RK5jTf3m56j+szIc8Y9DaLC8REUKl4UZJBK BqCl6c0cukVApOD92XoU6hJPm2rLEyp/IcYcPPNTnVu8D8h9oag2L8EiFN7+2hk0xG+lwjc8 uOIZycme7AIJsBU4AZ1v63lxm2k104hwpiatgbe71GIGl7p1MX6ousP/wGzXCOF25Dx9w02C eRe7zEMfhnFjSUhzdCC9han2+KaVB7qIqNR3b8NfbwRNlwPmHqlhXffUow9OsQjSnTK8WKNR lx7xzVccXIvWP2wECFrmqmzMmXpSrmIuiWEpFwZ9x2a0Pva8dCNRiCVTK51IlRXKjaAxiN1u IUrMm6UAEQEAAYkBPAQYAQoAJgIbDBYhBPkXPLLDqup6XIofCTXXcbtuRpfPBQJb5hL4BQkN PvONAAoJEDXXcbtuRpfPCjcH/ivBsOpdpebpgLizSNU5/X4yWN5Aixsc9VBnQhGKAKnMINJQ VMpA55sD2JSPwloXYM/B3qyPJRS/9cwIuX5LDNKKOZU3Qp+TzleynM15/xea14orWYRGRict YHBM3Cnqp7OD8K6Q1uhs0fTxyJP7PZ/G0+7Corlf1DlHhDt6C2HldRPFvAvAgl6sR9Wzgcb7 rzub2HVtbJgl6YHbgyAG7x9NpXFqzx1JLAMdpt2DIYwoi+oMdRQlBIwNuKjQjCGzuXHandd3 kGvBAsyJpQ+coEep9UzwANaV28cXrFr2R4FSOcR50rBA2Nh/vqUYfpsvBvJlwuKAoV1djVHa ihNeL5E= Organization: FreeBSD Message-ID: <46fe135c-5ade-67b4-e237-3ce268c9b0b8@FreeBSD.org> Date: Tue, 3 Dec 2019 20:02:56 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191204045531.10ce17d2@thor.intern.walstatt.dynvpn.de> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="tYTfNrQGplhAm0znMgMh9jqiEyqFbXLvA" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 04:03:08 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tYTfNrQGplhAm0znMgMh9jqiEyqFbXLvA Content-Type: multipart/mixed; boundary="Rxv04t2PmHUDIKf6BjIgAoUaB5Cfp28qe"; protected-headers="v1" From: Bryan Drewery To: "O. Hartmann" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <46fe135c-5ade-67b4-e237-3ce268c9b0b8@FreeBSD.org> Subject: Re: svn commit: r355379 - head/usr.sbin/mergemaster References: <201912040344.xB43ioAQ082850@repo.freebsd.org> <20191204045531.10ce17d2@thor.intern.walstatt.dynvpn.de> In-Reply-To: <20191204045531.10ce17d2@thor.intern.walstatt.dynvpn.de> --Rxv04t2PmHUDIKf6BjIgAoUaB5Cfp28qe Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 12/3/2019 7:55 PM, O. Hartmann wrote: > Am Wed, 4 Dec 2019 03:44:50 +0000 (UTC) > Bryan Drewery schrieb: >=20 >> Author: bdrewery >> Date: Wed Dec 4 03:44:50 2019 >> New Revision: 355379 >> URL: https://svnweb.freebsd.org/changeset/base/355379 >=20 >> Log: >> Run make in parallel. >=20 >> This is mostly targetting the 'installconfig' phase of 'distribution= ' >> which does a full tree walk. >=20 >> MFC after: 2 weeks >=20 >> Modified: >> head/usr.sbin/mergemaster/mergemaster.sh >=20 >> Modified: head/usr.sbin/mergemaster/mergemaster.sh >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/usr.sbin/mergemaster/mergemaster.sh Wed Dec 4 03:41:55 2019 = (r355378) >> +++ head/usr.sbin/mergemaster/mergemaster.sh Wed Dec 4 03:44:50 2019 = (r355379) >> @@ -508,6 +508,7 @@ SOURCEDIR=3D$(realpath "$SOURCEDIR") >=20 >> # Setup make to use system files from SOURCEDIR >> MM_MAKE=3D"make ${ARCHSTRING} -m ${SOURCEDIR}/share/mk -DNO_FILEMON" >> +MM_MAKE=3D"${MM_MAKE} -j$(sysctl -n hw.ncpu)" >=20 >> # Check DESTDIR against the mergemaster mtree database to see what >> # files the user changed from the reference files. >> _______________________________________________ >> svn-src-head@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-head >> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org= " >=20 > Whatever I do, mergemaster does not work anymore after this commit: >=20 > [...] > # mergemaster >=20 > /usr/sbin/mergemaster: sysctl: not found > *** The directory specified for the temporary root environment, > /var/tmp/temproot, exists. This can be a security risk if untruste= d > users have access to the system. >=20 > Use 'd' to delete the old /var/tmp/temproot and continue > Use 't' to select a new temporary root directory > Use 'e' to exit mergemaster >=20 > Default is to use /var/tmp/temproot as is >=20 > How should I deal with this? [Use the existing /var/tmp/temproot] d >=20 > *** Deleting the old /var/tmp/temproot >=20 > *** Creating the temporary root environment in /var/tmp/temproot > *** /var/tmp/temproot ready for use > *** Creating and populating directory structure in /var/tmp/temproot >=20 > make: illegal argument to -j -- must be positive integer! >=20 > *** FATAL ERROR: Cannot 'cd' to /usr/src and install files to > the temproot environment >=20 >=20 > Should be fixed in r355381. Sorry about that and forgetting to mention your report credit. I admit I didn't test this as I was annoyed with my upgrade being stuck in mergemaster and know that each of these invocations is -j safe. What a silly script to not include /sbin in PATH. --=20 Regards, Bryan Drewery --Rxv04t2PmHUDIKf6BjIgAoUaB5Cfp28qe-- --tYTfNrQGplhAm0znMgMh9jqiEyqFbXLvA Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQGTBAEBCgB9FiEE+Rc8ssOq6npcih8JNddxu25Gl88FAl3nL/ZfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEY5 MTczQ0IyQzNBQUVBN0E1QzhBMUYwOTM1RDc3MUJCNkU0Njk3Q0YACgkQNddxu25G l88PHAgAzR4xFLy6ia+weowC2C/P7tb1131wzA+bQ8cSoURfcn7SKOU2CZ/1FQE7 W/W/BHRrAK7Td8VRHSw59F5IY2dW3RAmKXJ7Lw3JRIYY4OJbpF11v+nj2n7ekSM8 ZE66pFYmYKyZ4SvxIOGCrE5xzRhmGBMjTYEojCzODjo/tq4ic6T4Tx2jnh2qGBoi CFzURpbGa8zubngLN0Nz4x6E9kjbXK0Ae/OxlJNzzHQ4dbcEXd/yRLIv0QECuMTm U/ehWEJhFKxEskjZsXbmvEpAJvb+R5kVGykMj+eYpIsWyyw1WROSvWmgu3wPhX/X jkqjSDZ+j0FBqqYDNbzEP2mE0mecVA== =VTjy -----END PGP SIGNATURE----- --tYTfNrQGplhAm0znMgMh9jqiEyqFbXLvA-- From owner-svn-src-all@freebsd.org Wed Dec 4 08:03:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B9E01CCF93; Wed, 4 Dec 2019 08:03:34 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SWZG1nMFz4XkY; Wed, 4 Dec 2019 08:03:34 +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 2082625095; Wed, 4 Dec 2019 08:03:34 +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 xB483Y9Q035517; Wed, 4 Dec 2019 08:03:34 GMT (envelope-from se@FreeBSD.org) Received: (from se@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB483XH3035514; Wed, 4 Dec 2019 08:03:33 GMT (envelope-from se@FreeBSD.org) Message-Id: <201912040803.xB483XH3035514@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: se set sender to se@FreeBSD.org using -f From: Stefan Esser Date: Wed, 4 Dec 2019 08:03:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355382 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: se X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 355382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 08:03:34 -0000 Author: se Date: Wed Dec 4 08:03:33 2019 New Revision: 355382 URL: https://svnweb.freebsd.org/changeset/base/355382 Log: Remove "All rights reserved" phrase from copyright notes. With the ratification of the Berne Convention in 2000, it became obsolete. I have removed that phrase and the "(c)" only from files without copyright claims by other parties. There are 2 files (pci.c, pci_private.h) that are also claimed by Michael Smith and by BSDi, which have therefore not been included in this commit. When all member nations of the Buenos Aires Convention adopted the Berne Convention, the phrase "All rights reserved" became unnecessary to assert copyright. Remove it from files under my copyright. There are 2 files (pci.c, pci_private.h) that) that do also bear msmith's and BSDi's copyright. I have left them unchanged for now, since I do not know whether they (or the legal successor in case of BSDi) would agree. Modified: head/sys/dev/pci/hostb_pci.c head/sys/dev/pci/pci_user.c head/sys/dev/pci/pcireg.h head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/hostb_pci.c ============================================================================== --- head/sys/dev/pci/hostb_pci.c Wed Dec 4 04:01:53 2019 (r355381) +++ head/sys/dev/pci/hostb_pci.c Wed Dec 4 08:03:33 2019 (r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Wed Dec 4 04:01:53 2019 (r355381) +++ head/sys/dev/pci/pci_user.c Wed Dec 4 08:03:33 2019 (r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pci/pcireg.h ============================================================================== --- head/sys/dev/pci/pcireg.h Wed Dec 4 04:01:53 2019 (r355381) +++ head/sys/dev/pci/pcireg.h Wed Dec 4 08:03:33 2019 (r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Wed Dec 4 04:01:53 2019 (r355381) +++ head/sys/dev/pci/pcivar.h Wed Dec 4 08:03:33 2019 (r355382) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1997, Stefan Esser - * All rights reserved. + * Copyright 1997, Stefan Esser * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Wed Dec 4 08:21:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3ED11CD653; Wed, 4 Dec 2019 08:21:55 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SWzR3tDKz4Yjq; Wed, 4 Dec 2019 08:21:55 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6446A253F0; Wed, 4 Dec 2019 08:21:55 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB48LtPi045030; Wed, 4 Dec 2019 08:21:55 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB48Lt32045029; Wed, 4 Dec 2019 08:21:55 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201912040821.xB48Lt32045029@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Wed, 4 Dec 2019 08:21:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355383 - head/sys/arm64/linux X-SVN-Group: head X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: head/sys/arm64/linux X-SVN-Commit-Revision: 355383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 08:21:55 -0000 Author: lwhsu Date: Wed Dec 4 08:21:54 2019 New Revision: 355383 URL: https://svnweb.freebsd.org/changeset/base/355383 Log: Fix arm64 build after r355373 Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/linux/linux_sysvec.c Modified: head/sys/arm64/linux/linux_sysvec.c ============================================================================== --- head/sys/arm64/linux/linux_sysvec.c Wed Dec 4 08:03:33 2019 (r355382) +++ head/sys/arm64/linux/linux_sysvec.c Wed Dec 4 08:21:54 2019 (r355383) @@ -217,7 +217,7 @@ linux_copyout_strings(struct image_params *imgp, uintp { char **vectp; char *stringp; - uintptr_t *destp, *ustringp; + uintptr_t destp, ustringp; struct ps_strings *arginfo; char canary[LINUX_AT_RANDOM_LEN]; size_t execpath_len; From owner-svn-src-all@freebsd.org Wed Dec 4 08:52:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 582BF1CDF7B; Wed, 4 Dec 2019 08:52:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SXf91h1Kz4bFG; Wed, 4 Dec 2019 08:52:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from odin.corp.delphij.net (unknown [IPv6:2601:646:8600:d04a:8df0:d770:7dbf:5d0b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: delphij/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 8CF966497; Wed, 4 Dec 2019 08:52:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) To: cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head References: <201912030703.xB373P5N043316@repo.freebsd.org> From: Xin Li Autocrypt: addr=delphij@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFuSR4oBEACvvEgwRIHs6IcSP/yaDtySF78Ji3rP29qdiQsxhMsOtvtffdbS56VApIWO UFb3/iN2gA8HwLvrmjijN0HEoLVX7na1WARmxRYzQMtApsZIUTtx7hnUYlsi2F5odZa6CDW9 a954DLRzYxiUwYDcu5Zjl9bglK1H8e/N9uC0Vuigr4teWfh86brzOyf819QzwFVYfMIK4ihw QGwMvTzbyVuCFy+LENkmcVYni70oQy6rZ5ktSuYbuOFvu7inRRfhSWPHziV7k+bW88sJ7xhv lBlegcnhkSudWX2M8tZ3MO1PJOcyys0CJlsBY5Weiog2lIPi05h/E9pZ9mc1Vud17iqDaL6w RaggOUhuPfDGCdO5ro82W4BZGeQMRnRF5Ntk+t2ShIH4nn3xRLV0E5nziCiKlgiMqOrz/ZTL QTVbHrCuiwD+fSK14y0oHbkOLYTYLlgh1JbwfY2Ty7elOYiWzyeJ7sJh2dF91NSEneWIOys3 mBpuvtU3nSzzTvAB48VV+Nbg1CpIOgNlPjj7uhIum/Z/VjUaJEyaLpTIRh0MVJVcbP7hXSqZ NA35EEZZVnWEOYdycm4CmEdeNPWkrAf2Ya77iR5VLGypwMlsUMQPh+sKVWDD38M8stFGBBNm d01Hi74Bsq5hKan654dOqMt5eYklrVj0ucMzFQtus7oE502UswARAQABtBxYaW4gTEkgPGRl bHBoaWpARnJlZUJTRC5vcmc+iQJXBBMBCgBBAhsDBQkJroQABQsJCAcDBRUKCQgLBRYCAwEA Ah4BAheAFiEEceNg5NEMZIki80nQQHl/fJX0g08FAluSUkoCGQEACgkQQHl/fJX0g08OIxAA pcCm2QCi6IM0o5N5ro5rTodh2rlMuf31TTYBjdf9laZvpnA8a80XBLgx7bxASxH0EOaxcJZk Hl6D0Ex8jcrwOoe9kmbzJ1ZrqBBJBup+mTrf4SwRceSqo6OGHrun8C6kOnq4X62RsvJ9j9nU PqowhXJ4zZHNk9ZXLDzWbrNvYNXxhb+GgK5SniIKMM5Jw/qlMYvxaiIwnS5So+UzIbNsycnk CLbzZxE0d9pe97G3zDvCCwUYoo6LmSx7R20yRnGgO0BlvTPHeWn5WtK1ku3aiarHJW7mRMbD 617GLdc2vuT3bDSd3XwQztgZdiOZkYCdNZVQvuOqMdTtg+phCoQyvEB0+OWoIc/9Cam826nG lazUzURU/FNKJMcxP+1eFI+D/Kl8lpLTtmcjZNbmxeYR2OG6gz7fkyX2D3Is7GEcxuAi6j8f 3OpyFxb9IX4ZsP54/C41bzbcZtQgsU30Ptp/AhJpThHzYHrskfIcLNdmu2ngD5GvrBNX/x4W dO0SgI8tsdY7UQqU9IMWYdkVP8smIUDypMS5x/VZe47afq+VxACOhL0hSixWJDt6Rbl/4iyM EE6Cgu3/YAWQhAK7B97wJj5vPxqdAtPQjkUZGtlTOJWm/NIf4MCYjoHlfan07zatzJ2XF6y6 XcRiCQXULUYpshhY7mXOTSHXZ8n6HB+Z1ri5Ag0EW5JHigEQANiBmIFAfRNH3nzYNWC0yC+t fx3zsUwAsH1VaBM/cTib+yKtbBOSIlXWjJZWX3MHwoI/1LeGghB2mxkkX1L0pJ/vj1eXNR+s FZ320pYcl61Fxg/5fioG4QDTM4i3i7NR5PxDnc6UVaynSlII93DedRhZ1ROtdn4vyMgzsDiq hbL7BthDOt5KxjqdRk4qRPSw7BovEqZLOcG5IJtf/zZUzRbM7SBljEbOAfekDGx1Br+RrYSD 7/EfPwwzou9T8315IpBpIHyQF/dZNk3iFiB9Ed5CA71ZRYV5YoLWE9lL0j9kxOLQ5vHnX3mV q7QZBc7nzwZ6UhQgYmrG5+RWvuiPpGwvDRIsugJUGXucYkAQh5kuNblmkwpv6u9rNMjCNbzA ylOaqdogra5EW+RUSbRz0b4iIr8nnZeAlh7BihCe7JjOwbDjoBEEEtSfVc4hD/LENqpcYVrC hphfaOLB9YIXhnVDTVvMc9OklWT/81HzAaDQqOQCzEfY92199Ct9/CwRoQ2OpO8TO5+8A7b9 Nb33nmxMn09mb48ruRacMrfHxCWbgU4w9SEfbip4GcS5wGG6yTC+hw55Iwnnwus40NrJ0GEr 8a4rcdsLbkvlyoNHB8ZGgyJ4aFCQ1V4qE1BnlTk7Z8BYBUkJM1odPSkVvHpCnMUjVpJ3hEOC +73ZYH1dh7lZABEBAAGJAjwEGAEKACYWIQRx42Dk0QxkiSLzSdBAeX98lfSDTwUCW5JHigIb DAUJCa6EAAAKCRBAeX98lfSDTz8DEACMh3poeUb+gWNF4RWFZuLteZVo0+E1JLYXQkmtrRBL XviP+Qy0pXyFAVxLM4hNIBoIDYfK9BcwrBYf7AwSKrH0GiNwFpgHCkbZd6qoZy2gB+adTnCp VCTJKJetsH/8awkrChJWMK0ckGf3EeWMPvawG7kW7FBz70NYEZ0pOMiaEZNVtzD3wwbYWUiD FYth83XGglOExg+1ShTW5XjQPRrdyJAO+aUW4o3lVjfyUJXMgI4rmhMiLVm06GuNrbpKIF0s +4VdjQAjhrDQjfoXi9CkfsA/cONseuHNv1JGj3RqHiqHJq1dbrpodXp925zGDAnUGxCOBPoF opAHgVzR89GTut059GpwqsddZmU6y7rqifuam/ekJ+QRwc16vgt7pHqCrTY8WPxRZr2UpFU1 wlToCOdeiFep1gq1F9jzFjJnoMaAdmC6k7bgAA+RQusOgIhJL0jIej7DoAHxmxFFCfRy+lDt pXwFgQ8HMvzHI65QWmQnMo7s6SQH/ZH5s1yR6SJq8+3lDz+dCuT42qJVqIPVvxd10LW0FNN+ t7HFeLadU6ekSgD13/EYMYXlvNHkw7dAItSDxIzgRyykLz0bCU9xwNWoS4Z43+ifF9anJ+uR 0ltWEl1j++h6ZrD3LLuCgJIt1so0m49GzdcSpOI7LCwMlacyvafiEyjUn+tSNDsnfw== Organization: The FreeBSD Project Subject: Re: svn commit: r355318 - head/sbin/newfs_msdos Message-ID: <8d49e0b1-fdf1-6c75-b726-7b8f08a61c3a@FreeBSD.org> Date: Wed, 4 Dec 2019 00:51:44 -0800 User-Agent: Thunderbird MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qwmBSWxsECtDu5gif3uuMlPzpNjTHBDvH" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 08:52:01 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qwmBSWxsECtDu5gif3uuMlPzpNjTHBDvH Content-Type: multipart/mixed; boundary="fdW2Och1d0YA2mLYR8q5QYqIIuMBz0PBg"; protected-headers="v1" From: Xin Li To: cem@freebsd.org Cc: src-committers , svn-src-all , svn-src-head Message-ID: <8d49e0b1-fdf1-6c75-b726-7b8f08a61c3a@FreeBSD.org> Subject: Re: svn commit: r355318 - head/sbin/newfs_msdos References: <201912030703.xB373P5N043316@repo.freebsd.org> In-Reply-To: --fdW2Och1d0YA2mLYR8q5QYqIIuMBz0PBg Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 12/3/19 14:02, Conrad Meyer wrote: > Hi Xin Li, >=20 > Is there a reason to prefer exit() over returning from main? I have No, this should be case-by-case (and also assumes you are using C and not C++). The two are actually subtly different (return means teardown main's stack first, then implicitly call exit from C runtime, while exit() would terminate immediately). If the command is meant to be used as a built-in module of something else, like the case of kill(1) builtin of sh(1), then one must not use exit() and also need to pay special attention to not exit() implicitly, because the caller will not fork() prior to calling the aliased main() function for performance reasons. For other cases, using exit() might be a good idea, because it's easier to find the exit points especially if one is following sysexits(3) values. Another reason is that if one allocates memory in main but not free them (these shouldn't be free'ed because the kernel would unmap all pages upon exit), return would mean these memory would be leaked: these are legitimate issues when main() would be called by someone else. With an explicit exit(), these memory are never leaked because stack frame of main() remains valid before the final _exit(2) call. > not surveyed the source tree, but I suspect most programs in base exit > by returning from main rather than explicit exit(3).> Thanks, > Conrad >=20 > On Mon, Dec 2, 2019 at 11:03 PM Xin LI wrote: >> >> Author: delphij >> Date: Tue Dec 3 07:03:25 2019 >> New Revision: 355318 >> URL: https://svnweb.freebsd.org/changeset/base/355318 >> >> Log: >> Explicitly exit() instead of return in main(). >> >> MFC after: 2 weeks >> >> Modified: >> head/sbin/newfs_msdos/newfs_msdos.c >> >> Modified: head/sbin/newfs_msdos/newfs_msdos.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 = (r355317) >> +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:03:25 2019 = (r355318) >> @@ -189,7 +189,7 @@ main(int argc, char *argv[]) >> err(1, NULL); >> } >> dtype =3D *argv; >> - return !!mkfs_msdos(fname, dtype, &o); >> + exit(!!mkfs_msdos(fname, dtype, &o)); >> } >> >> /* --fdW2Och1d0YA2mLYR8q5QYqIIuMBz0PBg-- --qwmBSWxsECtDu5gif3uuMlPzpNjTHBDvH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEceNg5NEMZIki80nQQHl/fJX0g08FAl3nc64ACgkQQHl/fJX0 g0/W4A/8DQ6KacOn9C2vF6YDUegcsgVRdq3rtLzEr7eMvTh/tsBcUqdSyqJWwIXK 4p9BrG3rFS9YlnuzrW900a5LMAIh9dX9gNqsbrjMP5D7I/QNm702xReLQqDyCrCR M+H1/agpl5UNWTZMJtDJ+BW2K1RJfvOdzeXIDmo1g2t1UysplZeI0n4lE4gZADow CYBMlL02STUfx8QsaH3TAHqAU5cIecl3aTm4uv4lhYBDHIrngJMtQ+R5eCJbZu4g KLySw9GWqnyL+kZNc+sJH/8rec/cSBclbisodgB0fgW5xAguI+DDbvCQj9HbudJ4 1WjoMMfqsaue/kHyZaME9Ysz5SGfRxY+M0RlhNWkGqyQDuwlET5A1vFMdGfolXWf RixWG2UnkDfx8mg7ft4Nz3nfth8jiptBL6pLDJ/mySInT+YLR/PjeB+9WuE+q+A2 JuuLzaHHbIh8R6CZN1CX2t3pxWKr2+mzabFL2/j/pTg0x/yljQYJ7IVyyTtj821P xLyhzrLxa4QdKKwaR0RFZ2/HGTL7JsuV1CEcA3KkN0gDEXPf8wOfDSeMf2Cql8bQ dGeFmFo0rAaACLas4e4HkVe/1mzQF6kio0KcEMpT8TBZ92FXoMvZfvf6I+atKT32 8s2D+KQ8BDMnA2Wg/mqU0SJaAC6LJL4ezJNLKMZavlXiYZ3sEWM= =/7bI -----END PGP SIGNATURE----- --qwmBSWxsECtDu5gif3uuMlPzpNjTHBDvH-- From owner-svn-src-all@freebsd.org Wed Dec 4 09:18:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F47F1CE870; Wed, 4 Dec 2019 09:18:34 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SYDp0kGHz4cCw; Wed, 4 Dec 2019 09:18:34 +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 EBBC925D10; Wed, 4 Dec 2019 09:18:33 +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 xB49IXqF076901; Wed, 4 Dec 2019 09:18:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB49IWql076895; Wed, 4 Dec 2019 09:18:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912040918.xB49IWql076895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 4 Dec 2019 09:18:32 +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: r355384 - in stable/12/sys/x86: include iommu x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/x86: include iommu x86 X-SVN-Commit-Revision: 355384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 09:18:34 -0000 Author: kib Date: Wed Dec 4 09:18:32 2019 New Revision: 355384 URL: https://svnweb.freebsd.org/changeset/base/355384 Log: MFC r355138: bus_dma_dmar_load_ident(9): load identity mapping into the map. Modified: stable/12/sys/x86/include/bus_dma.h stable/12/sys/x86/iommu/busdma_dmar.c stable/12/sys/x86/iommu/intel_ctx.c stable/12/sys/x86/iommu/intel_dmar.h stable/12/sys/x86/iommu/intel_gas.c stable/12/sys/x86/x86/busdma_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/include/bus_dma.h ============================================================================== --- stable/12/sys/x86/include/bus_dma.h Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/include/bus_dma.h Wed Dec 4 09:18:32 2019 (r355384) @@ -181,6 +181,8 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t #ifdef _KERNEL bool bus_dma_dmar_set_buswide(device_t dev); +int bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t start, vm_size_t length, int flags); #endif #endif /* !_X86_BUS_DMA_H_ */ Modified: stable/12/sys/x86/iommu/busdma_dmar.c ============================================================================== --- stable/12/sys/x86/iommu/busdma_dmar.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/busdma_dmar.c Wed Dec 4 09:18:32 2019 (r355384) @@ -950,3 +950,66 @@ dmar_fini_busdma(struct dmar_unit *unit) taskqueue_free(unit->delayed_taskqueue); unit->delayed_taskqueue = NULL; } + +int +bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map1, + vm_paddr_t start, vm_size_t length, int flags) +{ + struct bus_dma_tag_common *tc; + struct bus_dma_tag_dmar *tag; + struct bus_dmamap_dmar *map; + struct dmar_ctx *ctx; + struct dmar_domain *domain; + struct dmar_map_entry *entry; + vm_page_t *ma; + vm_size_t i; + int error; + bool waitok; + + MPASS((start & PAGE_MASK) == 0); + MPASS((length & PAGE_MASK) == 0); + MPASS(length > 0); + MPASS(start + length >= start); + MPASS((flags & ~(BUS_DMA_NOWAIT | BUS_DMA_NOWRITE)) == 0); + + tc = (struct bus_dma_tag_common *)dmat; + if (tc->impl != &bus_dma_dmar_impl) + return (0); + + tag = (struct bus_dma_tag_dmar *)dmat; + ctx = tag->ctx; + domain = ctx->domain; + map = (struct bus_dmamap_dmar *)map1; + waitok = (flags & BUS_DMA_NOWAIT) != 0; + + entry = dmar_gas_alloc_entry(domain, waitok ? 0 : DMAR_PGF_WAITOK); + if (entry == NULL) + return (ENOMEM); + entry->start = start; + entry->end = start + length; + ma = malloc(sizeof(vm_page_t) * atop(length), M_TEMP, waitok ? + M_WAITOK : M_NOWAIT); + if (ma == NULL) { + dmar_gas_free_entry(domain, entry); + return (ENOMEM); + } + for (i = 0; i < atop(length); i++) { + ma[i] = vm_page_getfake(entry->start + PAGE_SIZE * i, + VM_MEMATTR_DEFAULT); + } + error = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | + ((flags & BUS_DMA_NOWRITE) ? 0 : DMAR_MAP_ENTRY_WRITE), + waitok ? DMAR_GM_CANWAIT : 0, ma); + if (error == 0) { + DMAR_DOMAIN_LOCK(domain); + TAILQ_INSERT_TAIL(&map->map_entries, entry, dmamap_link); + entry->flags |= DMAR_MAP_ENTRY_MAP; + DMAR_DOMAIN_UNLOCK(domain); + } else { + dmar_domain_unload_entry(entry, true); + } + for (i = 0; i < atop(length); i++) + vm_page_putfake(ma[i]); + free(ma, M_TEMP); + return (error); +} Modified: stable/12/sys/x86/iommu/intel_ctx.c ============================================================================== --- stable/12/sys/x86/iommu/intel_ctx.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_ctx.c Wed Dec 4 09:18:32 2019 (r355384) @@ -279,7 +279,7 @@ domain_init_rmrr(struct dmar_domain *domain, device_t } error1 = dmar_gas_map_region(domain, entry, DMAR_MAP_ENTRY_READ | DMAR_MAP_ENTRY_WRITE, - DMAR_GM_CANWAIT, ma); + DMAR_GM_CANWAIT | DMAR_GM_RMRR, ma); /* * Non-failed RMRR entries are owned by context rb * tree. Get rid of the failed entry, but do not stop Modified: stable/12/sys/x86/iommu/intel_dmar.h ============================================================================== --- stable/12/sys/x86/iommu/intel_dmar.h Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_dmar.h Wed Dec 4 09:18:32 2019 (r355384) @@ -391,6 +391,7 @@ bool dmar_is_buswide_ctx(struct dmar_unit *unit, u_int #define DMAR_GM_CANWAIT 0x0001 #define DMAR_GM_CANSPLIT 0x0002 +#define DMAR_GM_RMRR 0x0004 #define DMAR_PGF_WAITOK 0x0001 #define DMAR_PGF_ZERO 0x0002 Modified: stable/12/sys/x86/iommu/intel_gas.c ============================================================================== --- stable/12/sys/x86/iommu/intel_gas.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/iommu/intel_gas.c Wed Dec 4 09:18:32 2019 (r355384) @@ -543,13 +543,15 @@ dmar_gas_alloc_region(struct dmar_domain *domain, stru */ if (prev != NULL && prev->end > entry->start && (prev->flags & DMAR_MAP_ENTRY_PLACE) == 0) { - if ((prev->flags & DMAR_MAP_ENTRY_RMRR) == 0) + if ((flags & DMAR_GM_RMRR) == 0 || + (prev->flags & DMAR_MAP_ENTRY_RMRR) == 0) return (EBUSY); entry->start = prev->end; } if (next != NULL && next->start < entry->end && (next->flags & DMAR_MAP_ENTRY_PLACE) == 0) { - if ((next->flags & DMAR_MAP_ENTRY_RMRR) == 0) + if ((flags & DMAR_GM_RMRR) == 0 || + (next->flags & DMAR_MAP_ENTRY_RMRR) == 0) return (EBUSY); entry->end = next->start; } @@ -569,7 +571,8 @@ dmar_gas_alloc_region(struct dmar_domain *domain, stru found = dmar_gas_rb_insert(domain, entry); KASSERT(found, ("found RMRR dup %p start %jx end %jx", domain, (uintmax_t)entry->start, (uintmax_t)entry->end)); - entry->flags = DMAR_MAP_ENTRY_RMRR; + if ((flags & DMAR_GM_RMRR) != 0) + entry->flags = DMAR_MAP_ENTRY_RMRR; #ifdef INVARIANTS struct dmar_map_entry *ip, *in; @@ -689,7 +692,7 @@ dmar_gas_map_region(struct dmar_domain *domain, struct KASSERT(entry->flags == 0, ("used RMRR entry %p %p %x", domain, entry, entry->flags)); - KASSERT((flags & ~(DMAR_GM_CANWAIT)) == 0, + KASSERT((flags & ~(DMAR_GM_CANWAIT | DMAR_GM_RMRR)) == 0, ("invalid flags 0x%x", flags)); start = entry->start; Modified: stable/12/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/12/sys/x86/x86/busdma_machdep.c Wed Dec 4 08:21:54 2019 (r355383) +++ stable/12/sys/x86/x86/busdma_machdep.c Wed Dec 4 09:18:32 2019 (r355384) @@ -253,4 +253,11 @@ bus_dma_dmar_set_buswide(device_t dev) { return (false); } + +int +bus_dma_dmar_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, + vm_paddr_t start, vm_size_t length, int flags) +{ + return (0); +} #endif From owner-svn-src-all@freebsd.org Wed Dec 4 09:21:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF4F51CEAD7; Wed, 4 Dec 2019 09:21:00 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SYHc4k7gz4cTM; Wed, 4 Dec 2019 09:21:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 86B5125D37; Wed, 4 Dec 2019 09:21:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB49L001079339; Wed, 4 Dec 2019 09:21:00 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB49L0Mx079338; Wed, 4 Dec 2019 09:21:00 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912040921.xB49L0Mx079338@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 4 Dec 2019 09:21: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: r355385 - 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: 355385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 09:21:00 -0000 Author: kib Date: Wed Dec 4 09:21:00 2019 New Revision: 355385 URL: https://svnweb.freebsd.org/changeset/base/355385 Log: MFC r355146: Ease the life of PT_TO_SCE/PT_TO_SCX users when debuggee sleeps in sigsuspend(2)/sig{timed,}wait(2). Modified: stable/12/sys/kern/kern_sig.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_sig.c ============================================================================== --- stable/12/sys/kern/kern_sig.c Wed Dec 4 09:18:32 2019 (r355384) +++ stable/12/sys/kern/kern_sig.c Wed Dec 4 09:21:00 2019 (r355385) @@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1252,11 +1253,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { @@ -1309,6 +1312,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1320,6 +1328,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR after wait was done. Only do this as last + * resort after rechecking for possible queued signals + * and expired timeouts. + */ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1532,6 +1550,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR. + */ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; From owner-svn-src-all@freebsd.org Wed Dec 4 09:24:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BB671CEC67; Wed, 4 Dec 2019 09:24:37 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SYMn3GWFz4cts; Wed, 4 Dec 2019 09:24:37 +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 536E125EC9; Wed, 4 Dec 2019 09:24:37 +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 xB49ObHf083027; Wed, 4 Dec 2019 09:24:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB49ObiB083026; Wed, 4 Dec 2019 09:24:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912040924.xB49ObiB083026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 4 Dec 2019 09:24:37 +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: r355386 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 355386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 09:24:37 -0000 Author: kib Date: Wed Dec 4 09:24:36 2019 New Revision: 355386 URL: https://svnweb.freebsd.org/changeset/base/355386 Log: MFC r355146: Ease the life of PT_TO_SCE/PT_TO_SCX users when debuggee sleeps in sigsuspend(2)/sig{timed,}wait(2). Modified: stable/11/sys/kern/kern_sig.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Wed Dec 4 09:21:00 2019 (r355385) +++ stable/11/sys/kern/kern_sig.c Wed Dec 4 09:24:36 2019 (r355386) @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -1253,11 +1254,13 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, int error, sig, timo, timevalid = 0; struct timespec rts, ets, ts; struct timeval tv; + bool traced; p = td->td_proc; error = 0; ets.tv_sec = 0; ets.tv_nsec = 0; + traced = false; if (timeout != NULL) { if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { @@ -1312,6 +1315,11 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, timo = 0; } + if (traced) { + error = EINTR; + break; + } + error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); if (timeout != NULL) { @@ -1323,6 +1331,16 @@ kern_sigtimedwait(struct thread *td, sigset_t waitset, error = 0; } } + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR after wait was done. Only do this as last + * resort after rechecking for possible queued signals + * and expired timeouts. + */ + if (error == 0 && (p->p_ptevents & PTRACE_SYSCALL) != 0) + traced = true; } new_block = saved_mask; @@ -1535,6 +1553,14 @@ kern_sigsuspend(struct thread *td, sigset_t mask) has_sig += postsig(sig); } mtx_unlock(&p->p_sigacts->ps_mtx); + + /* + * If PTRACE_SCE or PTRACE_SCX were set after + * userspace entered the syscall, return spurious + * EINTR. + */ + if ((p->p_ptevents & PTRACE_SYSCALL) != 0) + has_sig += 1; } PROC_UNLOCK(p); td->td_errno = EINTR; From owner-svn-src-all@freebsd.org Wed Dec 4 13:02:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2247F1B829E; Wed, 4 Dec 2019 13:02:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47SfCR6J6Nz3KYL; Wed, 4 Dec 2019 13:02:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xB4D2YtU022246 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 4 Dec 2019 15:02:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xB4D2YtU022246 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xB4D2YlO022245; Wed, 4 Dec 2019 15:02:34 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 4 Dec 2019 15:02:34 +0200 From: Konstantin Belousov To: Xin Li Cc: cem@freebsd.org, src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r355318 - head/sbin/newfs_msdos Message-ID: <20191204130234.GO10580@kib.kiev.ua> References: <201912030703.xB373P5N043316@repo.freebsd.org> <8d49e0b1-fdf1-6c75-b726-7b8f08a61c3a@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8d49e0b1-fdf1-6c75-b726-7b8f08a61c3a@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47SfCR6J6Nz3KYL X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 13:02:44 -0000 On Wed, Dec 04, 2019 at 12:51:44AM -0800, Xin Li wrote: > On 12/3/19 14:02, Conrad Meyer wrote: > > Hi Xin Li, > > > > Is there a reason to prefer exit() over returning from main? I have > > No, this should be case-by-case (and also assumes you are using C and > not C++). > > The two are actually subtly different (return means teardown main's > stack first, then implicitly call exit from C runtime, while exit() > would terminate immediately). This is even more subtle. If libthr is loaded into the process, then exit() also causes stack unwinding. > > If the command is meant to be used as a built-in module of something > else, like the case of kill(1) builtin of sh(1), then one must not use > exit() and also need to pay special attention to not exit() implicitly, > because the caller will not fork() prior to calling the aliased main() > function for performance reasons. > > For other cases, using exit() might be a good idea, because it's easier > to find the exit points especially if one is following sysexits(3) > values. Another reason is that if one allocates memory in main but not > free them (these shouldn't be free'ed because the kernel would unmap all > pages upon exit), return would mean these memory would be leaked: these > are legitimate issues when main() would be called by someone else. With > an explicit exit(), these memory are never leaked because stack frame of > main() remains valid before the final _exit(2) call. > > > not surveyed the source tree, but I suspect most programs in base exit > > by returning from main rather than explicit exit(3).> Thanks, > > Conrad > > > > On Mon, Dec 2, 2019 at 11:03 PM Xin LI wrote: > >> > >> Author: delphij > >> Date: Tue Dec 3 07:03:25 2019 > >> New Revision: 355318 > >> URL: https://svnweb.freebsd.org/changeset/base/355318 > >> > >> Log: > >> Explicitly exit() instead of return in main(). > >> > >> MFC after: 2 weeks > >> > >> Modified: > >> head/sbin/newfs_msdos/newfs_msdos.c > >> > >> Modified: head/sbin/newfs_msdos/newfs_msdos.c > >> ============================================================================== > >> --- head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:01:28 2019 (r355317) > >> +++ head/sbin/newfs_msdos/newfs_msdos.c Tue Dec 3 07:03:25 2019 (r355318) > >> @@ -189,7 +189,7 @@ main(int argc, char *argv[]) > >> err(1, NULL); > >> } > >> dtype = *argv; > >> - return !!mkfs_msdos(fname, dtype, &o); > >> + exit(!!mkfs_msdos(fname, dtype, &o)); > >> } > >> > >> /* > > From owner-svn-src-all@freebsd.org Wed Dec 4 13:28:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2977D1BAB71; Wed, 4 Dec 2019 13:28:18 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sfmy0P4Mz3LTX; Wed, 4 Dec 2019 13:28:18 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E50D2AFE; Wed, 4 Dec 2019 13:28:17 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4DSHLB025408; Wed, 4 Dec 2019 13:28:17 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4DSH7l025407; Wed, 4 Dec 2019 13:28:17 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912041328.xB4DSH7l025407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Wed, 4 Dec 2019 13:28:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355387 - stable/11/sys/dev/iicbus/twsi X-SVN-Group: stable-11 X-SVN-Commit-Author: loos X-SVN-Commit-Paths: stable/11/sys/dev/iicbus/twsi X-SVN-Commit-Revision: 355387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 13:28:18 -0000 Author: loos Date: Wed Dec 4 13:28:17 2019 New Revision: 355387 URL: https://svnweb.freebsd.org/changeset/base/355387 Log: MFC r320159: Add the ofw_bus_get_node() callback in mv_twsi, it is mandatory for the ofw_iicbus usage. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/dev/iicbus/twsi/mv_twsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/iicbus/twsi/mv_twsi.c ============================================================================== --- stable/11/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 4 09:24:36 2019 (r355386) +++ stable/11/sys/dev/iicbus/twsi/mv_twsi.c Wed Dec 4 13:28:17 2019 (r355387) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #define debugf(fmt, args...) #endif +static phandle_t mv_twsi_get_node(device_t, device_t); static int mv_twsi_probe(device_t); static int mv_twsi_attach(device_t); @@ -105,7 +106,10 @@ static device_method_t mv_twsi_methods[] = { DEVMETHOD(device_probe, mv_twsi_probe), DEVMETHOD(device_attach, mv_twsi_attach), - { 0, 0 } + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, mv_twsi_get_node), + + DEVMETHOD_END }; DEFINE_CLASS_1(twsi, mv_twsi_driver, mv_twsi_methods, @@ -116,6 +120,14 @@ static devclass_t mv_twsi_devclass; DRIVER_MODULE(twsi, simplebus, mv_twsi_driver, mv_twsi_devclass, 0, 0); DRIVER_MODULE(iicbus, twsi, iicbus_driver, iicbus_devclass, 0, 0); MODULE_DEPEND(twsi, iicbus, 1, 1, 1); + +static phandle_t +mv_twsi_get_node(device_t bus, device_t dev) +{ + + /* Used by ofw_iicbus. */ + return (ofw_bus_get_node(bus)); +} static int mv_twsi_probe(device_t dev) From owner-svn-src-all@freebsd.org Wed Dec 4 15:04:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45EA31C545D; Wed, 4 Dec 2019 15:04:07 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47ShvW0dt6z3RH7; Wed, 4 Dec 2019 15:04:07 +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 ED7AB1DB5; Wed, 4 Dec 2019 15:04:06 +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 xB4F46ru084140; Wed, 4 Dec 2019 15:04:06 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4F46Mk084139; Wed, 4 Dec 2019 15:04:06 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912041504.xB4F46Mk084139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 4 Dec 2019 15:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355388 - head/usr.sbin/ntp/doc X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/usr.sbin/ntp/doc X-SVN-Commit-Revision: 355388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:04:07 -0000 Author: cy Date: Wed Dec 4 15:04:06 2019 New Revision: 355388 URL: https://svnweb.freebsd.org/changeset/base/355388 Log: Chase r352304. The default rlimit memlock is no memory locking. Reported by: egypcio@ MFC after: 3 days Modified: head/usr.sbin/ntp/doc/ntp.conf.5 Modified: head/usr.sbin/ntp/doc/ntp.conf.5 ============================================================================== --- head/usr.sbin/ntp/doc/ntp.conf.5 Wed Dec 4 13:28:17 2019 (r355387) +++ head/usr.sbin/ntp/doc/ntp.conf.5 Wed Dec 4 15:04:06 2019 (r355388) @@ -2965,7 +2965,7 @@ Probably only available under Linux, this option may b when dropping root (the .Fl i option). -The default is 32 megabytes on non\-Linux machines, and \-1 under Linux. +The default is \-1. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory". .It Cm stacksize Ar N4kPages From owner-svn-src-all@freebsd.org Wed Dec 4 15:11:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C27EE1C619A; Wed, 4 Dec 2019 15:11: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sj4G4pzQz3wsC; Wed, 4 Dec 2019 15:11: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 888261F3D; Wed, 4 Dec 2019 15:11: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 xB4FBggu087486; Wed, 4 Dec 2019 15:11:42 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4FBgS8087485; Wed, 4 Dec 2019 15:11:42 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912041511.xB4FBgS8087485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 15:11: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: r355389 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 355389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:11:42 -0000 Author: mav Date: Wed Dec 4 15:11:42 2019 New Revision: 355389 URL: https://svnweb.freebsd.org/changeset/base/355389 Log: MFC r355074: Report XLAT0 register for completeness. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:04:06 2019 (r355388) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:11:42 2019 (r355389) @@ -2408,6 +2408,14 @@ intel_ntb_sysctl_init(struct ntb_softc *ntb) if (ntb->conn_type != NTB_CONN_B2B) return; + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01l", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETL, + sysctl_handle_register, "IU", "Outgoing XLAT0L register"); + SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat01u", + CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, + NTB_REG_32 | XEON_B2B_XLAT_OFFSETU, + sysctl_handle_register, "IU", "Outgoing XLAT0U register"); SYSCTL_ADD_PROC(ctx, regpar, OID_AUTO, "outgoing_xlat23", CTLFLAG_RD | CTLTYPE_OPAQUE, ntb, NTB_REG_64 | ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off, From owner-svn-src-all@freebsd.org Wed Dec 4 15:12:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C8B61C621D; Wed, 4 Dec 2019 15:12:10 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sj4p1qbjz3x1p; Wed, 4 Dec 2019 15:12:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 224611F69; Wed, 4 Dec 2019 15:12:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4FCAvn088499; Wed, 4 Dec 2019 15:12:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4FC9QF088498; Wed, 4 Dec 2019 15:12:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912041512.xB4FC9QF088498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 15:12: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: r355390 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 355390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:12:10 -0000 Author: mav Date: Wed Dec 4 15:12:09 2019 New Revision: 355390 URL: https://svnweb.freebsd.org/changeset/base/355390 Log: MFC r355163: Make the code slightly more compact. There should be no functional change. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:11:42 2019 (r355389) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:12:09 2019 (r355390) @@ -781,37 +781,42 @@ bar_get_xlat_params(struct ntb_softc *ntb, enum ntb_ba static int intel_ntb_map_pci_bars(struct ntb_softc *ntb) { + struct ntb_pci_bar_info *bar; int rc; - ntb->bar_info[NTB_CONFIG_BAR].pci_resource_id = PCIR_BAR(0); - rc = map_mmr_bar(ntb, &ntb->bar_info[NTB_CONFIG_BAR]); + bar = &ntb->bar_info[NTB_CONFIG_BAR]; + bar->pci_resource_id = PCIR_BAR(0); + rc = map_mmr_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].pci_resource_id = PCIR_BAR(2); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_1]); + bar = &ntb->bar_info[NTB_B2B_BAR_1]; + bar->pci_resource_id = PCIR_BAR(2); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_1].psz_off = XEON_PBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].ssz_off = XEON_SBAR23SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_1].pbarxlat_off = XEON_PBAR2XLAT_OFFSET; + bar->psz_off = XEON_PBAR23SZ_OFFSET; + bar->ssz_off = XEON_SBAR23SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR2XLAT_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pci_resource_id = PCIR_BAR(4); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_2]); + bar = &ntb->bar_info[NTB_B2B_BAR_2]; + bar->pci_resource_id = PCIR_BAR(4); + rc = map_memory_window_bar(ntb, bar); if (rc != 0) goto out; - ntb->bar_info[NTB_B2B_BAR_2].psz_off = XEON_PBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].ssz_off = XEON_SBAR4SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_2].pbarxlat_off = XEON_PBAR4XLAT_OFFSET; + bar->psz_off = XEON_PBAR4SZ_OFFSET; + bar->ssz_off = XEON_SBAR4SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR4XLAT_OFFSET; if (!HAS_FEATURE(ntb, NTB_SPLIT_BAR)) goto out; - ntb->bar_info[NTB_B2B_BAR_3].pci_resource_id = PCIR_BAR(5); - rc = map_memory_window_bar(ntb, &ntb->bar_info[NTB_B2B_BAR_3]); - ntb->bar_info[NTB_B2B_BAR_3].psz_off = XEON_PBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].ssz_off = XEON_SBAR5SZ_OFFSET; - ntb->bar_info[NTB_B2B_BAR_3].pbarxlat_off = XEON_PBAR5XLAT_OFFSET; + bar = &ntb->bar_info[NTB_B2B_BAR_3]; + bar->pci_resource_id = PCIR_BAR(5); + rc = map_memory_window_bar(ntb, bar); + bar->psz_off = XEON_PBAR5SZ_OFFSET; + bar->ssz_off = XEON_SBAR5SZ_OFFSET; + bar->pbarxlat_off = XEON_PBAR5XLAT_OFFSET; out: if (rc != 0) @@ -934,15 +939,14 @@ map_memory_window_bar(struct ntb_softc *ntb, struct nt static void intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) { - struct ntb_pci_bar_info *current_bar; + struct ntb_pci_bar_info *bar; int i; for (i = 0; i < NTB_MAX_BARS; i++) { - current_bar = &ntb->bar_info[i]; - if (current_bar->pci_resource != NULL) + bar = &ntb->bar_info[i]; + if (bar->pci_resource != NULL) bus_release_resource(ntb->device, SYS_RES_MEMORY, - current_bar->pci_resource_id, - current_bar->pci_resource); + bar->pci_resource_id, bar->pci_resource); } } From owner-svn-src-all@freebsd.org Wed Dec 4 15:14:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC3FB1C65C9; Wed, 4 Dec 2019 15:14:14 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sj7B5WbPz3xHT; Wed, 4 Dec 2019 15:14:14 +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 A0CFE1F8A; Wed, 4 Dec 2019 15:14:14 +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 xB4FEEkv090272; Wed, 4 Dec 2019 15:14:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4FEEmu090271; Wed, 4 Dec 2019 15:14:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912041514.xB4FEEmu090271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 15:14: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: r355391 - stable/12/sys/dev/ntb/ntb_hw X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ntb/ntb_hw X-SVN-Commit-Revision: 355391 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 15:14:14 -0000 Author: mav Date: Wed Dec 4 15:14:14 2019 New Revision: 355391 URL: https://svnweb.freebsd.org/changeset/base/355391 Log: MFC r355165: Make DMAR allow Intel NTB device to access its own BAR0. I have no good explanation why it happens, but I found that in B2B mode at least Xeon v4 NTB leaks accesses to its configuration memory at BAR0 originated from the link side to its host side. DMAR predictably blocks those, making access to remote scratchpad registers in B2B mode impossible. This change creates identity mapping in DMAR covering the BAR0 addresses, making the NTB work fine with DMAR enabled. It seems like allowing single 4KB range at 32KB offset may be enough, but I don't see a reason to be so specific. Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:12:09 2019 (r355390) +++ stable/12/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Wed Dec 4 15:14:14 2019 (r355391) @@ -218,6 +218,9 @@ struct ntb_softc { struct ntb_pci_bar_info *peer_lapic_bar; struct callout peer_msix_work; + bus_dma_tag_t bar0_dma_tag; + bus_dmamap_t bar0_dma_map; + struct callout heartbeat_timer; struct callout lr_timer; @@ -790,6 +793,29 @@ intel_ntb_map_pci_bars(struct ntb_softc *ntb) if (rc != 0) goto out; + /* + * At least on Xeon v4 NTB device leaks to host some remote side + * BAR0 writes supposed to update scratchpad registers. I am not + * sure why it happens, but it may be related to the fact that + * on a link side BAR0 is 32KB, while on a host side it is 64KB. + * Without this hack DMAR blocks those accesses as not allowed. + */ + if (bus_dma_tag_create(bus_get_dma_tag(ntb->device), 1, 0, + BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, NULL, + bar->size, 1, bar->size, 0, NULL, NULL, &ntb->bar0_dma_tag)) { + device_printf(ntb->device, "Unable to create BAR0 tag\n"); + return (ENOMEM); + } + if (bus_dmamap_create(ntb->bar0_dma_tag, 0, &ntb->bar0_dma_map)) { + device_printf(ntb->device, "Unable to create BAR0 map\n"); + return (ENOMEM); + } + if (bus_dma_dmar_load_ident(ntb->bar0_dma_tag, ntb->bar0_dma_map, + bar->pbase, bar->size, 0)) { + device_printf(ntb->device, "Unable to load BAR0 map\n"); + return (ENOMEM); + } + bar = &ntb->bar_info[NTB_B2B_BAR_1]; bar->pci_resource_id = PCIR_BAR(2); rc = map_memory_window_bar(ntb, bar); @@ -942,6 +968,12 @@ intel_ntb_unmap_pci_bar(struct ntb_softc *ntb) struct ntb_pci_bar_info *bar; int i; + if (ntb->bar0_dma_map != NULL) { + bus_dmamap_unload(ntb->bar0_dma_tag, ntb->bar0_dma_map); + bus_dmamap_destroy(ntb->bar0_dma_tag, ntb->bar0_dma_map); + } + if (ntb->bar0_dma_tag != NULL) + bus_dma_tag_destroy(ntb->bar0_dma_tag); for (i = 0; i < NTB_MAX_BARS; i++) { bar = &ntb->bar_info[i]; if (bar->pci_resource != NULL) From owner-svn-src-all@freebsd.org Wed Dec 4 16:41:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF22E1CE988; Wed, 4 Dec 2019 16:41:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sl3J4HVgz431V; Wed, 4 Dec 2019 16:41:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 776102E9A; Wed, 4 Dec 2019 16:41:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4Gf0eO041480; Wed, 4 Dec 2019 16:41:00 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4Gf0kw041479; Wed, 4 Dec 2019 16:41:00 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912041641.xB4Gf0kw041479@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Wed, 4 Dec 2019 16:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355392 - head/stand/efi/libefi X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/libefi X-SVN-Commit-Revision: 355392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 16:41:00 -0000 Author: tsoome Date: Wed Dec 4 16:41:00 2019 New Revision: 355392 URL: https://svnweb.freebsd.org/changeset/base/355392 Log: loader: clean up efipart filter expressions Small cleanup based on illumos review. Modified: head/stand/efi/libefi/efipart.c Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Wed Dec 4 15:14:14 2019 (r355391) +++ head/stand/efi/libefi/efipart.c Wed Dec 4 16:41:00 2019 (r355392) @@ -324,22 +324,21 @@ efipart_ignore_device(EFI_HANDLE h, EFI_BLOCK_IO *blki parent_is_usb = true; free(parent); - /* no media, parent is USB and devicepath is lun. */ node = efi_devpath_last_node(devpath); if (node == NULL) return (false); if (parent_is_usb && - DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_DEVICE_LOGICAL_UNIT_DP) { - efi_close_devpath(h); - return (true); - } - /* no media, parent is USB and devicepath is SCSI. */ - if (parent_is_usb && - DevicePathType(node) == MESSAGING_DEVICE_PATH && - DevicePathSubType(node) == MSG_SCSI_DP) { - efi_close_devpath(h); - return (true); + DevicePathType(node) == MESSAGING_DEVICE_PATH) { + /* + * no media, parent is USB and devicepath is + * LUN or SCSI. + */ + if (DevicePathSubType(node) == + MSG_DEVICE_LOGICAL_UNIT_DP || + DevicePathSubType(node) == MSG_SCSI_DP) { + efi_close_devpath(h); + return (true); + } } } return (false); From owner-svn-src-all@freebsd.org Wed Dec 4 16:55:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 36ED11CFF92; Wed, 4 Dec 2019 16:55:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SlNX0Tsvz43mv; Wed, 4 Dec 2019 16:55:56 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E826F3205; Wed, 4 Dec 2019 16:55:55 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4Gttng049554; Wed, 4 Dec 2019 16:55:55 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4GttZE049553; Wed, 4 Dec 2019 16:55:55 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201912041655.xB4GttZE049553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 4 Dec 2019 16:55:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355393 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 355393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 16:55:56 -0000 Author: imp Date: Wed Dec 4 16:55:55 2019 New Revision: 355393 URL: https://svnweb.freebsd.org/changeset/base/355393 Log: Fix accidentally changed copyright year. Noticed by: bapt@ Modified: head/share/man/man9/bus_activate_resource.9 Modified: head/share/man/man9/bus_activate_resource.9 ============================================================================== --- head/share/man/man9/bus_activate_resource.9 Wed Dec 4 16:41:00 2019 (r355392) +++ head/share/man/man9/bus_activate_resource.9 Wed Dec 4 16:55:55 2019 (r355393) @@ -1,6 +1,6 @@ .\" -*- nroff -*- .\" -.\" Copyright (c) 2004 M. Warner Losh +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions From owner-svn-src-all@freebsd.org Wed Dec 4 16:56:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D08331A803C; Wed, 4 Dec 2019 16:56:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SlPF5vNZz43vg; Wed, 4 Dec 2019 16:56:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD8853207; Wed, 4 Dec 2019 16:56:33 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4GuXDu049729; Wed, 4 Dec 2019 16:56:33 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4GuCIp049623; Wed, 4 Dec 2019 16:56:12 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201912041656.xB4GuCIp049623@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 4 Dec 2019 16:56:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355394 - in head: . lib/libc/stdlib lib/libc/sys libexec/rc/rc.d libexec/talkd sbin/devd share/man/man4 share/man/man5 stand/common stand/liblua stand/libsa sys/amd64/include sys/arm/a... X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head: . lib/libc/stdlib lib/libc/sys libexec/rc/rc.d libexec/talkd sbin/devd share/man/man4 share/man/man5 stand/common stand/liblua stand/libsa sys/amd64/include sys/arm/allwinner sys/arm/conf sys... X-SVN-Commit-Revision: 355394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 16:56:33 -0000 Author: imp Date: Wed Dec 4 16:56:11 2019 New Revision: 355394 URL: https://svnweb.freebsd.org/changeset/base/355394 Log: Regularize my copyright notice o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Modified: head/UPDATING head/lib/libc/stdlib/reallocf.c head/lib/libc/sys/compat-ino64.h head/lib/libc/sys/fstat.c head/lib/libc/sys/fstatat.c head/lib/libc/sys/fstatfs.c head/lib/libc/sys/getdirentries.c head/lib/libc/sys/getfsstat.c head/lib/libc/sys/lstat.c head/lib/libc/sys/stat.c head/lib/libc/sys/statfs.c head/libexec/rc/rc.d/devmatch head/libexec/talkd/extern.h head/sbin/devd/devd.8 head/sbin/devd/devd.cc head/sbin/devd/devd.conf.5 head/sbin/devd/devd.h head/sbin/devd/devd.hh head/sbin/devd/parse.y head/sbin/devd/token.l head/share/man/man4/cardbus.4 head/share/man/man4/devctl.4 head/share/man/man4/exca.4 head/share/man/man4/iic.4 head/share/man/man4/mmc.4 head/share/man/man4/mmcsd.4 head/share/man/man4/ow.4 head/share/man/man4/ow_temp.4 head/share/man/man4/owc.4 head/share/man/man4/pccard.4 head/share/man/man4/pccbb.4 head/share/man/man4/pcib.4 head/share/man/man4/pcic.4 head/share/man/man4/ufm.4 head/share/man/man5/os-release.5 head/stand/common/paths.h head/stand/common/zfs_cmd.c head/stand/liblua/float.h head/stand/liblua/locale.h head/stand/liblua/math.h head/stand/libsa/uuid_from_string.c head/stand/libsa/uuid_to_string.c head/sys/amd64/include/_bus.h head/sys/arm/allwinner/a10_ahci.c head/sys/arm/conf/genboardid.awk head/sys/arm/include/_bus.h head/sys/arm/include/atags.h head/sys/arm/include/board.h head/sys/arm/xilinx/uart_dev_cdnc.c head/sys/arm64/include/_bus.h head/sys/cam/mmc/mmc_da.c head/sys/dev/cardbus/cardbus.c head/sys/dev/cardbus/cardbus_cis.c head/sys/dev/cardbus/cardbus_device.c head/sys/dev/cardbus/cardbusvar.h head/sys/dev/exca/exca.c head/sys/dev/exca/excareg.h head/sys/dev/exca/excavar.h head/sys/dev/fdc/fdc_isa.c head/sys/dev/fdc/fdc_pccard.c head/sys/dev/fdc/fdcvar.h head/sys/dev/flash/at45d.c head/sys/dev/flash/mx25l.c head/sys/dev/flash/n25q.c head/sys/dev/iicbus/icee.c head/sys/dev/mii/axphy.c head/sys/dev/mmc/bridge.h head/sys/dev/mmc/mmc.c head/sys/dev/mmc/mmc_private.h head/sys/dev/mmc/mmc_subr.c head/sys/dev/mmc/mmc_subr.h head/sys/dev/mmc/mmcbr_if.m head/sys/dev/mmc/mmcbrvar.h head/sys/dev/mmc/mmcbus_if.m head/sys/dev/mmc/mmcreg.h head/sys/dev/mmc/mmcsd.c head/sys/dev/mmc/mmcvar.h head/sys/dev/ow/ow.c head/sys/dev/ow/ow.h head/sys/dev/ow/ow_temp.c head/sys/dev/ow/owc_gpiobus.c head/sys/dev/ow/owll.h head/sys/dev/ow/owll_if.m head/sys/dev/ow/own.h head/sys/dev/ow/own_if.m head/sys/dev/pccard/card_if.m head/sys/dev/pccard/pccard_device.c head/sys/dev/pccard/pccardvarp.h head/sys/dev/pccard/power_if.m head/sys/dev/pccbb/pccbb.c head/sys/dev/pccbb/pccbb_isa.c head/sys/dev/pccbb/pccbb_pci.c head/sys/dev/pccbb/pccbbdevid.h head/sys/dev/pccbb/pccbbvar.h head/sys/dev/puc/puc_pci.c head/sys/dev/sdhci/sdhci_if.m head/sys/dev/spibus/spi.h head/sys/dev/spibus/spibus.c head/sys/dev/spibus/spibus_if.m head/sys/dev/spibus/spibusvar.h head/sys/dev/uart/uart_bus_acpi.c head/sys/dev/uart/uart_bus_isa.c head/sys/dev/uart/uart_bus_pccard.c head/sys/dev/uart/uart_bus_pci.c head/sys/dev/uart/uart_bus_puc.c head/sys/dev/usb/controller/generic_ohci.c head/sys/dev/usb/misc/ufm.c head/sys/dev/usb/serial/ufoma.c head/sys/dev/usb/serial/umodem.c head/sys/dev/usb/ufm_ioctl.h head/sys/dev/wi/if_wivar.h head/sys/i386/include/_bus.h head/sys/mips/cavium/uart_cpu_octeonusart.c head/sys/mips/include/_bus.h head/sys/mips/include/elf.h head/sys/mips/mips/ptrace_machdep.c head/sys/powerpc/include/_bus.h head/sys/riscv/include/_bus.h head/sys/sparc64/include/_bus.h head/tools/tools/git/git-svn-rebase head/tools/tools/nanobsd/dhcpd/common head/tools/tools/nanobsd/dhcpd/os-base head/tools/tools/nanobsd/embedded/beaglebone.cfg head/tools/tools/nanobsd/embedded/common head/tools/tools/nanobsd/embedded/i386.cfg head/tools/tools/nanobsd/embedded/pandaboard.cfg head/tools/tools/nanobsd/embedded/qemu-amd64-uefi-bios.cfg head/tools/tools/nanobsd/embedded/qemu-amd64-uefi.cfg head/tools/tools/nanobsd/embedded/qemu-amd64.cfg head/tools/tools/nanobsd/embedded/qemu-armv7.cfg head/tools/tools/nanobsd/embedded/qemu-i386.cfg head/tools/tools/nanobsd/embedded/qemu-mips.cfg head/tools/tools/nanobsd/embedded/qemu-mips64.cfg head/tools/tools/nanobsd/embedded/qemu-powerpc.cfg head/tools/tools/nanobsd/embedded/qemu-powerpc64.cfg head/tools/tools/nanobsd/embedded/qemu-sparc64.cfg head/tools/tools/nanobsd/embedded/rpi.cfg head/tools/tools/nanobsd/embedded/rpi2.cfg head/tools/tools/nanobsd/embedded/rpi3.cfg head/tools/tools/nanobsd/legacy.sh head/tools/tools/nanobsd/mtree-dedup.awk head/usr.sbin/dumpcis/dumpcis.8 head/usr.sbin/dumpcis/main.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Dec 4 16:55:55 2019 (r355393) +++ head/UPDATING Wed Dec 4 16:56:11 2019 (r355394) @@ -2120,7 +2120,7 @@ to fetch an UPDATING file from an older FreeBSD releas Copyright information: -Copyright 1998-2009 M. Warner Losh. +Copyright 1998-2009 M. Warner Losh Redistribution, publication, translation and use, with or without modification, in full or in part, in any form or format of this Modified: head/lib/libc/stdlib/reallocf.c ============================================================================== --- head/lib/libc/stdlib/reallocf.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/stdlib/reallocf.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 1998, M. Warner Losh - * All rights reserved. + * Copyright (c) 1998 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/compat-ino64.h ============================================================================== --- head/lib/libc/sys/compat-ino64.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/compat-ino64.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/fstat.c ============================================================================== --- head/lib/libc/sys/fstat.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/fstat.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/fstatat.c ============================================================================== --- head/lib/libc/sys/fstatat.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/fstatat.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/fstatfs.c ============================================================================== --- head/lib/libc/sys/fstatfs.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/fstatfs.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/getdirentries.c ============================================================================== --- head/lib/libc/sys/getdirentries.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/getdirentries.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/getfsstat.c ============================================================================== --- head/lib/libc/sys/getfsstat.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/getfsstat.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/lstat.c ============================================================================== --- head/lib/libc/sys/lstat.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/lstat.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,6 @@ /*- + * Copyright (c) 2012 Gleb Kurtsou All rights reserved. * Copyright (c) 2017 M. Warner Losh - * Copyright (c) 2012 Gleb Kurtsou - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/stat.c ============================================================================== --- head/lib/libc/sys/stat.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/stat.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,6 @@ /*- + * Copyright (c) 2012 Gleb Kurtsou All rights reserved. * Copyright (c) 2017 M. Warner Losh - * Copyright (c) 2012 Gleb Kurtsou - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/lib/libc/sys/statfs.c ============================================================================== --- head/lib/libc/sys/statfs.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/lib/libc/sys/statfs.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- * Copyright (c) 2017 M. Warner Losh - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/libexec/rc/rc.d/devmatch ============================================================================== --- head/libexec/rc/rc.d/devmatch Wed Dec 4 16:55:55 2019 (r355393) +++ head/libexec/rc/rc.d/devmatch Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright (c) 2018 M. Warner Losh +# Copyright (c) 2018 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/libexec/talkd/extern.h ============================================================================== --- head/libexec/talkd/extern.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/libexec/talkd/extern.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002 M. Warner Losh. + * Copyright (c) 2002 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sbin/devd/devd.8 ============================================================================== --- head/sbin/devd/devd.8 Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/devd.8 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2002 M. Warner Losh. -.\" All rights reserved. +.\" Copyright (c) 2002 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/devd.cc Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2010 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2002-2010 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sbin/devd/devd.conf.5 ============================================================================== --- head/sbin/devd/devd.conf.5 Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/devd.conf.5 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2002 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2002 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/sbin/devd/devd.h ============================================================================== --- head/sbin/devd/devd.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/devd.h Wed Dec 4 16:56:11 2019 (r355394) @@ -3,8 +3,7 @@ * * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002 M. Warner Losh . - * All rights reserved. + * Copyright (c) 2002 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sbin/devd/devd.hh ============================================================================== --- head/sbin/devd/devd.hh Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/devd.hh Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2003 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2002-2003 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sbin/devd/parse.y ============================================================================== --- head/sbin/devd/parse.y Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/parse.y Wed Dec 4 16:56:11 2019 (r355394) @@ -4,8 +4,7 @@ * * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002 M. Warner Losh . - * All rights reserved. + * Copyright (c) 2002 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sbin/devd/token.l ============================================================================== --- head/sbin/devd/token.l Wed Dec 4 16:55:55 2019 (r355393) +++ head/sbin/devd/token.l Wed Dec 4 16:56:11 2019 (r355394) @@ -4,8 +4,7 @@ * * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002 M. Warner Losh . - * All rights reserved. + * Copyright (c) 2002 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/share/man/man4/cardbus.4 ============================================================================== --- head/share/man/man4/cardbus.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/cardbus.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2002 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2002 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/devctl.4 ============================================================================== --- head/share/man/man4/devctl.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/devctl.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2002 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2002 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/exca.4 ============================================================================== --- head/share/man/man4/exca.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/exca.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2003 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/iic.4 ============================================================================== --- head/share/man/man4/iic.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/iic.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ -.\" Copyright (c) 2006, M. Warner Losh -.\" Copyright (c) 1998, Nicolas Souchu -.\" All rights reserved. +.\" Copyright (c) 1998, Nicolas Souchu All rights reserved. +.\" Copyright (c) 2006 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/mmc.4 ============================================================================== --- head/share/man/man4/mmc.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/mmc.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2007 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2007 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/mmcsd.4 ============================================================================== --- head/share/man/man4/mmcsd.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/mmcsd.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2007 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2007 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/ow.4 ============================================================================== --- head/share/man/man4/ow.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/ow.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2015 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2015 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/ow_temp.4 ============================================================================== --- head/share/man/man4/ow_temp.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/ow_temp.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2015 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2015 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/owc.4 ============================================================================== --- head/share/man/man4/owc.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/owc.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2015 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2015 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/pccard.4 ============================================================================== --- head/share/man/man4/pccard.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/pccard.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2002 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2002 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/pccbb.4 ============================================================================== --- head/share/man/man4/pccbb.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/pccbb.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2002-2003 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2002-2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/pcib.4 ============================================================================== --- head/share/man/man4/pcib.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/pcib.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2008 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2008 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/pcic.4 ============================================================================== --- head/share/man/man4/pcic.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/pcic.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ .\" -.\" Copyright (c) 2001, 2002 M. Warner Losh -.\" All rights reserved. +.\" Copyright (c) 2001-2002 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man4/ufm.4 ============================================================================== --- head/share/man/man4/ufm.4 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man4/ufm.4 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,5 +1,4 @@ -.\" Copyright (c) 2003 M. Warner Losh -.\" . All rights reserved. +.\" Copyright (c) 2003 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/share/man/man5/os-release.5 ============================================================================== --- head/share/man/man5/os-release.5 Wed Dec 4 16:55:55 2019 (r355393) +++ head/share/man/man5/os-release.5 Wed Dec 4 16:56:11 2019 (r355394) @@ -1,4 +1,5 @@ -.\" Copyright (c) 2019 M. Warner Losh. +.\" +.\" Copyright (c) 2019 M. Warner Losh .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions Modified: head/stand/common/paths.h ============================================================================== --- head/stand/common/paths.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/common/paths.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2016 M. Warner Losh - * All rights reserved. + * Copyright (c) 2016 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/stand/common/zfs_cmd.c ============================================================================== --- head/stand/common/zfs_cmd.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/common/zfs_cmd.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 M. Warner Losh + * Copyright (c) 2018 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/stand/liblua/float.h ============================================================================== --- head/stand/liblua/float.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/liblua/float.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 M. Warner Losh + * Copyright (c) 2018 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/stand/liblua/locale.h ============================================================================== --- head/stand/liblua/locale.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/liblua/locale.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 M. Warner Losh + * Copyright (c) 2018 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/stand/liblua/math.h ============================================================================== --- head/stand/liblua/math.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/liblua/math.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 M. Warner Losh + * Copyright (c) 2018 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/stand/libsa/uuid_from_string.c ============================================================================== --- head/stand/libsa/uuid_from_string.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/libsa/uuid_from_string.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/stand/libsa/uuid_to_string.c ============================================================================== --- head/stand/libsa/uuid_to_string.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/stand/libsa/uuid_to_string.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/amd64/include/_bus.h ============================================================================== --- head/sys/amd64/include/_bus.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/amd64/include/_bus.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/allwinner/a10_ahci.c ============================================================================== --- head/sys/arm/allwinner/a10_ahci.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm/allwinner/a10_ahci.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,6 @@ /*- - * Copyright (c) 2014-2015 M. Warner Losh - * Copyright (c) 2015 Luiz Otavio O Souza - * All rights reserved. + * Copyright (c) 2015 Luiz Otavio O Souza All rights reserved. + * Copyright (c) 2014-2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/conf/genboardid.awk ============================================================================== --- head/sys/arm/conf/genboardid.awk Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm/conf/genboardid.awk Wed Dec 4 16:56:11 2019 (r355394) @@ -4,7 +4,7 @@ #- # SPDX-License-Identifier: BSD-2-Clause-FreeBSD # -# Copyright (c) 2012 M. Warner Losh. +# Copyright (c) 2012 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/arm/include/_bus.h ============================================================================== --- head/sys/arm/include/_bus.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm/include/_bus.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005 M. Warner Losh. + * Copyright (c) 2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/include/atags.h ============================================================================== --- head/sys/arm/include/atags.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm/include/atags.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 M. Warner Losh. + * Copyright (c) 2012 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/include/board.h ============================================================================== --- head/sys/arm/include/board.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm/include/board.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2012 M. Warner Losh. + * Copyright (c) 2012 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm/xilinx/uart_dev_cdnc.c ============================================================================== --- head/sys/arm/xilinx/uart_dev_cdnc.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm/xilinx/uart_dev_cdnc.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,10 +1,9 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005 M. Warner Losh - * Copyright (c) 2005 Olivier Houchard - * Copyright (c) 2012 Thomas Skibo - * All rights reserved. + * Copyright (c) 2005 Olivier Houchard All rights reserved. + * Copyright (c) 2012 Thomas Skibo All rights reserved. + * Copyright (c) 2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/arm64/include/_bus.h ============================================================================== --- head/sys/arm64/include/_bus.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/arm64/include/_bus.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2005 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/cam/mmc/mmc_da.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,11 +1,10 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2006 Bernd Walter + * Copyright (c) 2006 Bernd Walter All rights reserved. + * Copyright (c) 2009 Alexander Motin All rights reserved. + * Copyright (c) 2015-2017 Ilya Bakulin All rights reserved. * Copyright (c) 2006 M. Warner Losh - * Copyright (c) 2009 Alexander Motin - * Copyright (c) 2015-2017 Ilya Bakulin - * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/cardbus/cardbus.c ============================================================================== --- head/sys/dev/cardbus/cardbus.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/cardbus/cardbus.c Wed Dec 4 16:56:11 2019 (r355394) @@ -2,8 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved. - * - * Copyright (c) 2003-2008 M. Warner Losh. + * Copyright (c) 2003-2008 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/cardbus/cardbus_cis.c ============================================================================== --- head/sys/dev/cardbus/cardbus_cis.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/cardbus/cardbus_cis.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,9 +1,9 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005-2008, M. Warner Losh - * Copyright (c) 2000,2001 Jonathan Chen. - * All rights reserved. + * Copyright (c) 2000,2001 Jonathan Chen All rights reserved. + * Copyright (c) 2005-2008 M. Warner Losh + * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/cardbus/cardbus_device.c ============================================================================== --- head/sys/dev/cardbus/cardbus_device.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/cardbus/cardbus_device.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005-2008, M. Warner Losh - * All rights reserved. + * Copyright (c) 2005-2008 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/cardbus/cardbusvar.h ============================================================================== --- head/sys/dev/cardbus/cardbusvar.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/cardbus/cardbusvar.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,9 +1,8 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2008, M. Warner Losh - * Copyright (c) 2000,2001 Jonathan Chen. - * All rights reserved. + * Copyright (c) 2000,2001 Jonathan Chen. All rights reserved. + * Copyright (c) 2008 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/exca/exca.c ============================================================================== --- head/sys/dev/exca/exca.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/exca/exca.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-4-Clause AND BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2005 M. Warner Losh. + * Copyright (c) 2002-2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/exca/excareg.h ============================================================================== --- head/sys/dev/exca/excareg.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/exca/excareg.h Wed Dec 4 16:56:11 2019 (r355394) @@ -4,7 +4,7 @@ /*- * SPDX-License-Identifier: BSD-4-Clause AND BSD-2-Clause-FreeBSD * - * Copyright (c) 2002 M. Warner Losh. + * Copyright (c) 2002 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/exca/excavar.h ============================================================================== --- head/sys/dev/exca/excavar.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/exca/excavar.h Wed Dec 4 16:56:11 2019 (r355394) @@ -3,7 +3,7 @@ /*- * SPDX-License-Identifier: BSD-4-Clause AND BSD-2-Clause-FreeBSD * - * Copyright (c) 2002 M. Warner Losh. + * Copyright (c) 2002 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/fdc/fdc_isa.c ============================================================================== --- head/sys/dev/fdc/fdc_isa.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/fdc/fdc_isa.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2004-2005 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2004-2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/fdc/fdc_pccard.c ============================================================================== --- head/sys/dev/fdc/fdc_pccard.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/fdc/fdc_pccard.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2004-2005 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2004-2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/fdc/fdcvar.h ============================================================================== --- head/sys/dev/fdc/fdcvar.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/fdc/fdcvar.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2004-2005 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2004-2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/flash/at45d.c ============================================================================== --- head/sys/dev/flash/at45d.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/flash/at45d.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,11 +1,10 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2006 M. Warner Losh - * Copyright (c) 2011-2012 Ian Lepore - * Copyright (c) 2012 Marius Strobl - * All rights reserved. - * + * Copyright (c) 2011-2012 Ian Lepore All rights reserved. + * Copyright (c) 2012 Marius Strobl All rights reserved. + * Copyright (c) 2006 M. Warner Losh + * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/flash/mx25l.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,9 +1,9 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2006 M. Warner Losh. * Copyright (c) 2009 Oleksandr Tymoshenko. All rights reserved. * Copyright (c) 2018 Ian Lepore. All rights reserved. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/flash/n25q.c ============================================================================== --- head/sys/dev/flash/n25q.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/flash/n25q.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,9 +1,8 @@ /*- - * Copyright (c) 2006 M. Warner Losh. * Copyright (c) 2009 Oleksandr Tymoshenko. All rights reserved. * Copyright (c) 2017 Ruslan Bukin * Copyright (c) 2018 Ian Lepore. All rights reserved. - * All rights reserved. + * Copyright (c) 2006 M. Warner Losh * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 Modified: head/sys/dev/iicbus/icee.c ============================================================================== --- head/sys/dev/iicbus/icee.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/iicbus/icee.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mii/axphy.c ============================================================================== --- head/sys/dev/mii/axphy.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mii/axphy.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2009, M. Warner Losh - * All rights reserved. + * Copyright (c) 2009 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/bridge.h ============================================================================== --- head/sys/dev/mmc/bridge.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/bridge.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmc.c ============================================================================== --- head/sys/dev/mmc/mmc.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmc.c Wed Dec 4 16:56:11 2019 (r355394) @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * Copyright (c) 2017 Marius Strobl * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/mmc/mmc_private.h ============================================================================== --- head/sys/dev/mmc/mmc_private.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmc_private.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmc_subr.c ============================================================================== --- head/sys/dev/mmc/mmc_subr.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmc_subr.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmc_subr.h ============================================================================== --- head/sys/dev/mmc/mmc_subr.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmc_subr.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmcbr_if.m ============================================================================== --- head/sys/dev/mmc/mmcbr_if.m Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmcbr_if.m Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ #- -# Copyright (c) 2006 M. Warner Losh -# All rights reserved. +# Copyright (c) 2006 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmcbrvar.h ============================================================================== --- head/sys/dev/mmc/mmcbrvar.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmcbrvar.h Wed Dec 4 16:56:11 2019 (r355394) @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmcbus_if.m ============================================================================== --- head/sys/dev/mmc/mmcbus_if.m Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmcbus_if.m Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ #- -# Copyright (c) 2006 M. Warner Losh -# All rights reserved. +# Copyright (c) 2006 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/dev/mmc/mmcreg.h ============================================================================== --- head/sys/dev/mmc/mmcreg.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmcreg.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,7 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * Copyright (c) 2017 Marius Strobl * Copyright (c) 2015-2016 Ilya Bakulin * Modified: head/sys/dev/mmc/mmcsd.c ============================================================================== --- head/sys/dev/mmc/mmcsd.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmcsd.c Wed Dec 4 16:56:11 2019 (r355394) @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * Copyright (c) 2017 Marius Strobl * * Redistribution and use in source and binary forms, with or without Modified: head/sys/dev/mmc/mmcvar.h ============================================================================== --- head/sys/dev/mmc/mmcvar.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/mmc/mmcvar.h Wed Dec 4 16:56:11 2019 (r355394) @@ -2,7 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2006 Bernd Walter. All rights reserved. - * Copyright (c) 2006 M. Warner Losh. + * Copyright (c) 2006 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/ow.c ============================================================================== --- head/sys/dev/ow/ow.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/ow.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/ow.h ============================================================================== --- head/sys/dev/ow/ow.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/ow.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/ow_temp.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/owc_gpiobus.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/owll.h ============================================================================== --- head/sys/dev/ow/owll.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/owll.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/owll_if.m ============================================================================== --- head/sys/dev/ow/owll_if.m Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/owll_if.m Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ #- -# Copyright (c) 2015 M. Warner Losh -# All rights reserved. +# Copyright (c) 2015 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/own.h ============================================================================== --- head/sys/dev/ow/own.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/own.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2015 M. Warner Losh - * All rights reserved. + * Copyright (c) 2015 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/ow/own_if.m ============================================================================== --- head/sys/dev/ow/own_if.m Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/ow/own_if.m Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ #- -# Copyright (c) 2015 M. Warner Losh -# All rights reserved. +# Copyright (c) 2015 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/dev/pccard/card_if.m ============================================================================== --- head/sys/dev/pccard/card_if.m Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccard/card_if.m Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ #- -# Copyright (c) 1999 M. Warner Losh. -# All rights reserved. +# Copyright (c) 1999 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/dev/pccard/pccard_device.c ============================================================================== --- head/sys/dev/pccard/pccard_device.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccard/pccard_device.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. + * Copyright (c) 2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pccard/pccardvarp.h ============================================================================== --- head/sys/dev/pccard/pccardvarp.h Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccard/pccardvarp.h Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2005, M. Warner Losh - * All rights reserved. + * Copyright (c) 2005 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pccard/power_if.m ============================================================================== --- head/sys/dev/pccard/power_if.m Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccard/power_if.m Wed Dec 4 16:56:11 2019 (r355394) @@ -1,6 +1,5 @@ #- -# Copyright (c) 1999 M. Warner Losh. -# All rights reserved. +# Copyright (c) 1999 M. Warner Losh # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions Modified: head/sys/dev/pccbb/pccbb.c ============================================================================== --- head/sys/dev/pccbb/pccbb.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccbb/pccbb.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,9 +1,8 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2004 M. Warner Losh. - * Copyright (c) 2000-2001 Jonathan Chen. - * All rights reserved. + * Copyright (c) 2000-2001 Jonathan Chen All rights reserved. + * Copyright (c) 2002-2004 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pccbb/pccbb_isa.c ============================================================================== --- head/sys/dev/pccbb/pccbb_isa.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccbb/pccbb_isa.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,8 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2004 M. Warner Losh. - * All rights reserved. + * Copyright (c) 2002-2004 M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- head/sys/dev/pccbb/pccbb_pci.c Wed Dec 4 16:55:55 2019 (r355393) +++ head/sys/dev/pccbb/pccbb_pci.c Wed Dec 4 16:56:11 2019 (r355394) @@ -1,9 +1,8 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2002-2004 M. Warner Losh. - * Copyright (c) 2000-2001 Jonathan Chen. - * All rights reserved. + * Copyright (c) 2000-2001 Jonathan Chen All rights reserved. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Dec 4 17:03:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B56A1A86A5 for ; Wed, 4 Dec 2019 17:03:32 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47SlYG72yvz44Xm for ; Wed, 4 Dec 2019 17:03:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72f.google.com with SMTP id a137so579792qkc.7 for ; Wed, 04 Dec 2019 09:03:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=id43FZUN+z013OMQTwZGwuMkgOzKz11VQ/cIA+Sbu/0=; b=sUyh3NQOltVXdTgpk87z706UPp3P83XJBQTuhCrF/ZuM/NzAFLwRWpwFwFmFSBuXdg OlXyoWpK+MIZgeiFHuSGVvLzneTO/CmCXBY4Df/SKOBkdbo4QyUoGQNhmcH/LexPates 1d+sKcqyDJDX8khptvWiCK9OFJPaNY2wJ/NhjRP6Zc4GXaKEzO4Yw8/Mq9txXeoExtZx M2anvvaqOzNMA1pdvjWMAKyr9BUZJaf1AzB8DmJClh+UKF/8ngkxkU2ebR9xei/d8XsU I9UQGB15grwp4PtCuVIkIUx4g3143GsGVr+akdby0rHQm4VnIpDOkjPLpdXy8qODlqbP pXWg== 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=id43FZUN+z013OMQTwZGwuMkgOzKz11VQ/cIA+Sbu/0=; b=AEUKo4NL21eFD/1jHNGyo4iNngCX3LA1TMWc2oQVrYbWoiFn/3DY1FtFCGxpUBeJiG bmRPQBi2aPCrbNTjDUVZ4FsOd23Ei/QXPlOUiv/3FXczdplrfM2it1TD82pzJEVOtJ2m 5P+FADhc6epIp377kOCpIs659CjDz3/H63uIU/yKQ75IfDhn4TkOcA7iigW4Leky8ZV2 4pw7CiFcb82FPZQeqsbAGxHrP+90NmgKq0z3o/d1Z2oNDZg4ICUKebIiYjW645REt4u1 A/7heoef/1ybkcyx1eMf9+nXegW90dHhIu4r+baQXTZGL+5zHtvAWFOp8H1rFJxjD1Js KcaA== X-Gm-Message-State: APjAAAUu4BQ9NfaX4NM2W5Jmx9PiiwiWTGCFskXrlokUp/WlH4GMeyRe vt+EqtWMp+6Nfwh6s1LW7sZ34UlUpcKIiKKEtGNvqw== X-Google-Smtp-Source: APXvYqzYQndrhqqD+nsKWrFT+j7fnb8nJJHnDWW8udXLckOi86P0ljY9yX9BLXV0DtCwPZb4vaYXTrwVbb+huYgYpDs= X-Received: by 2002:a37:4a97:: with SMTP id x145mr3998046qka.380.1575479009440; Wed, 04 Dec 2019 09:03:29 -0800 (PST) MIME-Version: 1.0 References: <201912041656.xB4GuCIp049623@repo.freebsd.org> In-Reply-To: <201912041656.xB4GuCIp049623@repo.freebsd.org> From: Warner Losh Date: Wed, 4 Dec 2019 10:03:18 -0700 Message-ID: Subject: Re: svn commit: r355394 - in head: . lib/libc/stdlib lib/libc/sys libexec/rc/rc.d libexec/talkd sbin/devd share/man/man4 share/man/man5 stand/common stand/liblua stand/libsa sys/amd64/include sys/arm/a... To: Warner Losh Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47SlYG72yvz44Xm X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=sUyh3NQO; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.72 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[f.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.72)[ip: (-9.39), ipnet: 2607:f8b0::/32(-2.24), asn: 15169(-1.93), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:03:32 -0000 On Wed, Dec 4, 2019 at 9:56 AM Warner Losh wrote: > Author: imp > Date: Wed Dec 4 16:56:11 2019 > New Revision: 355394 > URL: https://svnweb.freebsd.org/changeset/base/355394 > > Log: > Regularize my copyright notice > > o Remove All Rights Reserved from my notices > o imp@FreeBSD.org everywhere > o regularize punctiation, eliminate date ranges > That last bit is backwards... 'prefer date ranges' is what I should have said. Warner > o Make sure that it's clear that I don't claim All Rights reserved by > listing > All Rights Reserved on same line as other copyright holders (but not > me). Other such holders are also listed last where it's clear. > From owner-svn-src-all@freebsd.org Wed Dec 4 17:09:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49AFB1A894A; Wed, 4 Dec 2019 17:09:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Slgs16slz44vp; Wed, 4 Dec 2019 17:09:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 824E49CC2; Wed, 4 Dec 2019 17:09:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r355383 - head/sys/arm64/linux To: Li-Wen Hsu , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912040821.xB48Lt32045029@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Wed, 4 Dec 2019 09:09:10 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201912040821.xB48Lt32045029@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:09:13 -0000 On 12/4/19 12:21 AM, Li-Wen Hsu wrote: > Author: lwhsu > Date: Wed Dec 4 08:21:54 2019 > New Revision: 355383 > URL: https://svnweb.freebsd.org/changeset/base/355383 > > Log: > Fix arm64 build after r355373 > > Sponsored by: The FreeBSD Foundation Thanks. Not sure how that slipped through as I do keep cross-building the relevant kernels for all of these changes. :( -- John Baldwin From owner-svn-src-all@freebsd.org Wed Dec 4 17:45:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90F8D1A9BB4; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SmTq3GkKz48MG; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5376D3DA4; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4HjZAW081491; Wed, 4 Dec 2019 17:45:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4HjYb9081489; Wed, 4 Dec 2019 17:45:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041745.xB4HjYb9081489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 17:45:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Commit-Revision: 355395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:45:35 -0000 Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) Modified: stable/11/lib/msun/src/e_hypot.c ============================================================================== --- stable/11/lib/msun/src/e_hypot.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/11/lib/msun/src/e_hypot.c Wed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/11/lib/msun/src/e_hypotf.c ============================================================================== --- stable/11/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/11/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } From owner-svn-src-all@freebsd.org Wed Dec 4 17:45:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27B7E1A9BC0; Wed, 4 Dec 2019 17:45:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SmTr0HD6z48MN; Wed, 4 Dec 2019 17:45:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD9B53DA5; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4HjZqx081498; Wed, 4 Dec 2019 17:45:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4HjZ9O081496; Wed, 4 Dec 2019 17:45:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041745.xB4HjZ9O081496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 17:45:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Commit-Revision: 355395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:45:36 -0000 Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) Modified: stable/10/lib/msun/src/e_hypot.c ============================================================================== --- stable/10/lib/msun/src/e_hypot.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/10/lib/msun/src/e_hypot.c Wed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/10/lib/msun/src/e_hypotf.c ============================================================================== --- stable/10/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/10/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } From owner-svn-src-all@freebsd.org Wed Dec 4 17:45:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 063BE1A9BB0; Wed, 4 Dec 2019 17:45:35 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SmTp6J5qz48MF; Wed, 4 Dec 2019 17:45:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB72A3DA3; Wed, 4 Dec 2019 17:45:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4HjYXq081484; Wed, 4 Dec 2019 17:45:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4HjYba081482; Wed, 4 Dec 2019 17:45:34 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041745.xB4HjYba081482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 17:45:34 +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: r355395 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src X-SVN-Commit-Revision: 355395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 17:45:35 -0000 Author: dim Date: Wed Dec 4 17:45:34 2019 New Revision: 355395 URL: https://svnweb.freebsd.org/changeset/base/355395 Log: r355120 | dim | 2019-11-26 23:01:09 +0100 (Tue, 26 Nov 2019) | 32 lines The fdlibm hypot() implementations shouldn't potentially left-shift negative numbers (invoking undefined behavior) Summary: Various paths through hypot(x, y) will multiply x and y by a power of two, perform the calculation in a range where IEEE-754 provides greater precision, then undo the multiplication to determine the true result. Undoing that multiplication is implemented as t1*w, where t1=2**k. 2**k is often computed by taking the high word of 1.0, then adding k<<20 (for doubles or long doubles) or k<<23 (for floats) to it, then overwriting that high word. But when k is negative this left-shifts a negative value -- and that's undefined behavior in many editions of C and C++. This patch should fix all hypot implementations to compute 2**k without triggering this particular bit of undefined behavior. Test Plan: I've only very lightly tested out the hypot(double, double) change, in SpiderMonkey's JavaScript engine, for consistency with prior behavior. The other functions' changes have more or less only been eyeballed. Careful examination appreciated! Do note, however, that an error in any of these changes would most likely produce a value that is incorrect by a factor of two, so any mistake would most likely be glaring if invoked. Submitted by: Jeff Walden Obtained from: https://github.com/freebsd/freebsd/pull/414 Reviewed by: dim, lwhsu Differential Revision: https://reviews.freebsd.org/D22354 Modified: stable/12/lib/msun/src/e_hypot.c stable/12/lib/msun/src/e_hypotf.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_hypot.c stable/10/lib/msun/src/e_hypotf.c stable/11/lib/msun/src/e_hypot.c stable/11/lib/msun/src/e_hypotf.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/lib/msun/src/e_hypot.c ============================================================================== --- stable/12/lib/msun/src/e_hypot.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/12/lib/msun/src/e_hypot.c Wed Dec 4 17:45:34 2019 (r355395) @@ -118,10 +118,8 @@ __ieee754_hypot(double x, double y) w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - u_int32_t high; - t1 = 1.0; - GET_HIGH_WORD(high,t1); - SET_HIGH_WORD(t1,high+(k<<20)); + t1 = 0.0; + SET_HIGH_WORD(t1,(1023+k)<<20); return t1*w; } else return w; } Modified: stable/12/lib/msun/src/e_hypotf.c ============================================================================== --- stable/12/lib/msun/src/e_hypotf.c Wed Dec 4 16:56:11 2019 (r355394) +++ stable/12/lib/msun/src/e_hypotf.c Wed Dec 4 17:45:34 2019 (r355395) @@ -77,7 +77,7 @@ __ieee754_hypotf(float x, float y) w = __ieee754_sqrtf(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { - SET_FLOAT_WORD(t1,0x3f800000+(k<<23)); + SET_FLOAT_WORD(t1,(127+k)<<23); return t1*w; } else return w; } From owner-svn-src-all@freebsd.org Wed Dec 4 18:21:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8E371AB04B; Wed, 4 Dec 2019 18:21:29 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SnHF4WT2z4CFt; Wed, 4 Dec 2019 18:21:29 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FC7A43C3; Wed, 4 Dec 2019 18:21:29 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4ILT0o001697; Wed, 4 Dec 2019 18:21:29 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4ILTv2001696; Wed, 4 Dec 2019 18:21:29 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201912041821.xB4ILTv2001696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 4 Dec 2019 18:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355396 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 18:21:29 -0000 Author: rlibby Date: Wed Dec 4 18:21:29 2019 New Revision: 355396 URL: https://svnweb.freebsd.org/changeset/base/355396 Log: mbuf zones: take out the trash The mbuf zones were explicitly specifying the uma trash procedures on zcreate, conditionally on INVARIANTS, because that used to be necessary in order to get use-after-free checking for uma zones with non-empty constructors or destructors. After r355137 uma automatically invokes the trash constructor and destructor as long as no init and fini are specified. This now allows the mbuf zones to pass their constructors and destructors without needing to add on the uma trash procedures conditionally. Reviewed by: cem, jhb, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D22583 Modified: head/sys/kern/kern_mbuf.c Modified: head/sys/kern/kern_mbuf.c ============================================================================== --- head/sys/kern/kern_mbuf.c Wed Dec 4 17:45:34 2019 (r355395) +++ head/sys/kern/kern_mbuf.c Wed Dec 4 18:21:29 2019 (r355396) @@ -322,12 +322,7 @@ mbuf_init(void *dummy) * Configure UMA zones for Mbufs, Clusters, and Packets. */ zone_mbuf = uma_zcreate(MBUF_MEM_NAME, MSIZE, - mb_ctor_mbuf, mb_dtor_mbuf, -#ifdef INVARIANTS - trash_init, trash_fini, -#else - NULL, NULL, -#endif + mb_ctor_mbuf, mb_dtor_mbuf, NULL, NULL, MSIZE - 1, UMA_ZONE_MAXBUCKET); if (nmbufs > 0) nmbufs = uma_zone_set_max(zone_mbuf, nmbufs); @@ -335,12 +330,7 @@ mbuf_init(void *dummy) uma_zone_set_maxaction(zone_mbuf, mb_reclaim); zone_clust = uma_zcreate(MBUF_CLUSTER_MEM_NAME, MCLBYTES, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); if (nmbclusters > 0) nmbclusters = uma_zone_set_max(zone_clust, nmbclusters); @@ -352,12 +342,7 @@ mbuf_init(void *dummy) /* Make jumbo frame zone too. Page size, 9k and 16k. */ zone_jumbop = uma_zcreate(MBUF_JUMBOP_MEM_NAME, MJUMPAGESIZE, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); if (nmbjumbop > 0) nmbjumbop = uma_zone_set_max(zone_jumbop, nmbjumbop); @@ -365,12 +350,7 @@ mbuf_init(void *dummy) uma_zone_set_maxaction(zone_jumbop, mb_reclaim); zone_jumbo9 = uma_zcreate(MBUF_JUMBO9_MEM_NAME, MJUM9BYTES, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); uma_zone_set_allocf(zone_jumbo9, mbuf_jumbo_alloc); if (nmbjumbo9 > 0) @@ -379,12 +359,7 @@ mbuf_init(void *dummy) uma_zone_set_maxaction(zone_jumbo9, mb_reclaim); zone_jumbo16 = uma_zcreate(MBUF_JUMBO16_MEM_NAME, MJUM16BYTES, - mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + mb_ctor_clust, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); uma_zone_set_allocf(zone_jumbo16, mbuf_jumbo_alloc); if (nmbjumbo16 > 0) @@ -394,11 +369,7 @@ mbuf_init(void *dummy) zone_extpgs = uma_zcreate(MBUF_EXTPGS_MEM_NAME, sizeof(struct mbuf_ext_pgs), -#ifdef INVARIANTS - trash_ctor, trash_dtor, trash_init, trash_fini, -#else NULL, NULL, NULL, NULL, -#endif UMA_ALIGN_CACHE, 0); /* @@ -618,22 +589,12 @@ debugnet_mbuf_reinit(int nmbuf, int nclust, int clsize dn_clsize = clsize; dn_zone_mbuf = uma_zcache_create("debugnet_" MBUF_MEM_NAME, - MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, -#ifdef INVARIANTS - trash_init, trash_fini, -#else - NULL, NULL, -#endif + MSIZE, mb_ctor_mbuf, mb_dtor_mbuf, NULL, NULL, dn_buf_import, dn_buf_release, &dn_mbufq, UMA_ZONE_NOBUCKET); dn_zone_clust = uma_zcache_create("debugnet_" MBUF_CLUSTER_MEM_NAME, - clsize, mb_ctor_clust, -#ifdef INVARIANTS - trash_dtor, trash_init, trash_fini, -#else - NULL, NULL, NULL, -#endif + clsize, mb_ctor_clust, NULL, NULL, NULL, dn_buf_import, dn_buf_release, &dn_clustq, UMA_ZONE_NOBUCKET); @@ -687,9 +648,6 @@ mb_ctor_mbuf(void *mem, int size, void *arg, int how) int flags; short type; -#ifdef INVARIANTS - trash_ctor(mem, size, arg, how); -#endif args = (struct mb_args *)arg; type = args->type; @@ -724,9 +682,6 @@ mb_dtor_mbuf(void *mem, int size, void *arg) KASSERT((m->m_flags & M_NOFREE) == 0, ("%s: M_NOFREE set", __func__)); if (!(flags & MB_DTOR_SKIP) && (m->m_flags & M_PKTHDR) && !SLIST_EMPTY(&m->m_pkthdr.tags)) m_tag_delete_chain(m, NULL); -#ifdef INVARIANTS - trash_dtor(mem, size, arg); -#endif } /* @@ -777,9 +732,6 @@ mb_ctor_clust(void *mem, int size, void *arg, int how) { struct mbuf *m; -#ifdef INVARIANTS - trash_ctor(mem, size, arg, how); -#endif m = (struct mbuf *)arg; if (m != NULL) { m->m_ext.ext_buf = (char *)mem; From owner-svn-src-all@freebsd.org Wed Dec 4 18:38:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBD921AB61A; Wed, 4 Dec 2019 18:38:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SngG5ZHBz4DBt; Wed, 4 Dec 2019 18:38:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A273D4724; Wed, 4 Dec 2019 18:38:50 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4IcoX4011953; Wed, 4 Dec 2019 18:38:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4IcoEN011952; Wed, 4 Dec 2019 18:38:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201912041838.xB4IcoEN011952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 4 Dec 2019 18:38:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355397 - head/contrib/llvm/lib/Target/PowerPC X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Target/PowerPC X-SVN-Commit-Revision: 355397 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 18:38:51 -0000 Author: dim Date: Wed Dec 4 18:38:50 2019 New Revision: 355397 URL: https://svnweb.freebsd.org/changeset/base/355397 Log: Merge commit 241cbf201 from llvm git (by Nemanja Ivanovic): [PowerPC] Fix crash in peephole optimization When converting reg+reg shifts to reg+imm rotates, we neglect to consider the CodeGenOnly versions of the 32-bit shift mnemonics. This means we produce a rotate with missing operands which causes a crash. Committing this fix without review since it is non-controversial that the list of mnemonics to consider should include the 64-bit aliases for the exact mnemonics. Fixes PR44183. This should fix "Assertion failed: (idx < size()), function operator[], file /usr/src/contrib/llvm/include/llvm/ADT/SmallVector.h, line 153" when building the graphics/mesa-dri port for the PowerPC64 ELFv2 ABI. Reported by: Alfredo Dal'Ava Júnior MFC after: 1 month X-MFC-With: r353358 Modified: head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Modified: head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Wed Dec 4 18:21:29 2019 (r355396) +++ head/contrib/llvm/lib/Target/PowerPC/PPCInstrInfo.cpp Wed Dec 4 18:38:50 2019 (r355397) @@ -3529,8 +3529,10 @@ bool PPCInstrInfo::transformToImmFormFedByLI(MachineIn ForwardKilledOperandReg = MI.getOperand(ConstantOpNo).getReg(); unsigned Opc = MI.getOpcode(); - bool SpecialShift32 = - Opc == PPC::SLW || Opc == PPC::SLWo || Opc == PPC::SRW || Opc == PPC::SRWo; + bool SpecialShift32 = Opc == PPC::SLW || Opc == PPC::SLWo || + Opc == PPC::SRW || Opc == PPC::SRWo || + Opc == PPC::SLW8 || Opc == PPC::SLW8o || + Opc == PPC::SRW8 || Opc == PPC::SRW8o; bool SpecialShift64 = Opc == PPC::SLD || Opc == PPC::SLDo || Opc == PPC::SRD || Opc == PPC::SRDo; bool SetCR = Opc == PPC::SLWo || Opc == PPC::SRWo || From owner-svn-src-all@freebsd.org Wed Dec 4 18:40:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D0D61AB6FC; Wed, 4 Dec 2019 18:40:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Snhk3l9Lz4DLD; Wed, 4 Dec 2019 18:40:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 63BBF472A; Wed, 4 Dec 2019 18:40:06 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4Ie6Bf012114; Wed, 4 Dec 2019 18:40:06 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4Ie6c4012113; Wed, 4 Dec 2019 18:40:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201912041840.xB4Ie6c4012113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 4 Dec 2019 18:40:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355398 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 18:40:06 -0000 Author: andrew Date: Wed Dec 4 18:40:05 2019 New Revision: 355398 URL: https://svnweb.freebsd.org/changeset/base/355398 Log: Fix the signature for zone_import and zone_release These are cast to uma_import and uma_release functions. Use the signature for these in the zone functions. This was found with an experimental Kernel CFI. It will complain if the signature is different than what a function pointer expects. The simplest way to fix these is to correct the signature. Reviewed by: rlibby Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22671 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Wed Dec 4 18:38:50 2019 (r355397) +++ head/sys/vm/uma_core.c Wed Dec 4 18:40:05 2019 (r355398) @@ -279,8 +279,8 @@ static void *slab_alloc_item(uma_keg_t keg, uma_slab_t static void slab_free_item(uma_zone_t zone, uma_slab_t slab, void *item); static uma_keg_t uma_kcreate(uma_zone_t zone, size_t size, uma_init uminit, uma_fini fini, int align, uint32_t flags); -static int zone_import(uma_zone_t, void **, int, int, int); -static void zone_release(uma_zone_t, void **, int); +static int zone_import(void *, void **, int, int, int); +static void zone_release(void *, void **, int); static void uma_zero_item(void *, uma_zone_t); static bool cache_alloc(uma_zone_t, uma_cache_t, void *, int); static bool cache_free(uma_zone_t, uma_cache_t, void *, void *, int); @@ -2094,8 +2094,8 @@ zone_ctor(void *mem, int size, void *udata, int flags) /* * Use the regular zone/keg/slab allocator. */ - zone->uz_import = (uma_import)zone_import; - zone->uz_release = (uma_release)zone_release; + zone->uz_import = zone_import; + zone->uz_release = zone_release; zone->uz_arg = zone; keg = arg->keg; @@ -3112,8 +3112,9 @@ slab_alloc_item(uma_keg_t keg, uma_slab_t slab) } static int -zone_import(uma_zone_t zone, void **bucket, int max, int domain, int flags) +zone_import(void *arg, void **bucket, int max, int domain, int flags) { + uma_zone_t zone; uma_slab_t slab; uma_keg_t keg; #ifdef NUMA @@ -3121,6 +3122,7 @@ zone_import(uma_zone_t zone, void **bucket, int max, i #endif int i; + zone = arg; slab = NULL; keg = zone->uz_keg; KEG_LOCK(keg); @@ -3616,14 +3618,16 @@ slab_free_item(uma_zone_t zone, uma_slab_t slab, void } static void -zone_release(uma_zone_t zone, void **bucket, int cnt) +zone_release(void *arg, void **bucket, int cnt) { + uma_zone_t zone; void *item; uma_slab_t slab; uma_keg_t keg; uint8_t *mem; int i; + zone = arg; keg = zone->uz_keg; KEG_LOCK(keg); for (i = 0; i < cnt; i++) { From owner-svn-src-all@freebsd.org Wed Dec 4 19:46:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28D851AD158; Wed, 4 Dec 2019 19:46: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sq9j0G2Rz4HYW; Wed, 4 Dec 2019 19:46:49 +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 DBE7A54AC; Wed, 4 Dec 2019 19:46: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 xB4Jkmg1053009; Wed, 4 Dec 2019 19:46:48 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4Jkmxm053008; Wed, 4 Dec 2019 19:46:48 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912041946.xB4Jkmxm053008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 4 Dec 2019 19:46:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355399 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 19:46:49 -0000 Author: markj Date: Wed Dec 4 19:46:48 2019 New Revision: 355399 URL: https://svnweb.freebsd.org/changeset/base/355399 Log: Fix an off-by-one error in vm_map_pmap_enter(). If the starting pindex is equal to object->size, there is nothing to do. This was harmless since the rest of vm_map_pmap_enter() has no effect when psize == 0. Submitted by: Wuyang Chung Reviewed by: alc, dougm, kib MFC after: 1 week Github PR: https://github.com/freebsd/freebsd/pull/417 Differential Revision: https://reviews.freebsd.org/D22678 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Wed Dec 4 18:40:05 2019 (r355398) +++ head/sys/vm/vm_map.c Wed Dec 4 19:46:48 2019 (r355399) @@ -2467,7 +2467,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_p psize = atop(size); if (psize + pindex > object->size) { - if (object->size < pindex) { + if (pindex >= object->size) { VM_OBJECT_RUNLOCK(object); return; } From owner-svn-src-all@freebsd.org Wed Dec 4 20:15:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10A651ADD0C; Wed, 4 Dec 2019 20:15:18 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SqpY6dCBz4K0Y; Wed, 4 Dec 2019 20:15:17 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7E595A71; Wed, 4 Dec 2019 20:15:17 +0000 (UTC) (envelope-from rlibby@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4KFHB7070821; Wed, 4 Dec 2019 20:15:17 GMT (envelope-from rlibby@FreeBSD.org) Received: (from rlibby@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4KFHWX070820; Wed, 4 Dec 2019 20:15:17 GMT (envelope-from rlibby@FreeBSD.org) Message-Id: <201912042015.xB4KFHWX070820@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rlibby set sender to rlibby@FreeBSD.org using -f From: Ryan Libby Date: Wed, 4 Dec 2019 20:15:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355400 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: rlibby X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 355400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 20:15:18 -0000 Author: rlibby Date: Wed Dec 4 20:15:17 2019 New Revision: 355400 URL: https://svnweb.freebsd.org/changeset/base/355400 Log: bistring: avoid gcc -Wsign-compare Appease gcc after after r355377, which broke gcc builds. Reviewed by: dougm MFC with: r355377 Differential Revision: https://reviews.freebsd.org/D22682 Modified: head/sys/sys/bitstring.h Modified: head/sys/sys/bitstring.h ============================================================================== --- head/sys/sys/bitstring.h Wed Dec 4 19:46:48 2019 (r355399) +++ head/sys/sys/bitstring.h Wed Dec 4 20:15:17 2019 (r355400) @@ -306,7 +306,7 @@ bit_ffs_area_at(bitstr_t *_bitstr, int _start, int _nb while ((_test & (_test + 1)) != 0 && _b-- > 0) _test |= _test >> (((_size - 1) >> _b) + 1) / 2; /* Find the start of the first 0-area in _test. */ - _offset = (~_test == 0) ? _BITSTR_BITS : + _offset = (~_test == 0) ? (int)_BITSTR_BITS : ffsl(~_test) - 1; _value = (_curbitstr - _bitstr) * _BITSTR_BITS + _offset; @@ -353,7 +353,7 @@ bit_ffc_area_at(bitstr_t *_bitstr, int _start, int _nb while ((_test & (_test + 1)) != 0 && _b-- > 0) _test |= _test >> (((_size - 1) >> _b) + 1) / 2; /* Find the start of the first 0-area in _test. */ - _offset = (~_test == 0) ? _BITSTR_BITS : + _offset = (~_test == 0) ? (int)_BITSTR_BITS : ffsl(~_test) - 1; _value = (_curbitstr - _bitstr) * _BITSTR_BITS + _offset; From owner-svn-src-all@freebsd.org Wed Dec 4 20:18:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BE691ADDE2; Wed, 4 Dec 2019 20:18:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sqsx3686z4K8D; Wed, 4 Dec 2019 20:18:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DED25A81; Wed, 4 Dec 2019 20:18:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4KID4n070991; Wed, 4 Dec 2019 20:18:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4KIDb9070990; Wed, 4 Dec 2019 20:18:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912042018.xB4KIDb9070990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 4 Dec 2019 20:18:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355401 - head/lib/libcompiler_rt X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libcompiler_rt X-SVN-Commit-Revision: 355401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 20:18:13 -0000 Author: jhb Date: Wed Dec 4 20:18:12 2019 New Revision: 355401 URL: https://svnweb.freebsd.org/changeset/base/355401 Log: Define __SOFT_FP__ for riscv64sf to avoid infinite recursion. Submitted by: James Clarke Reviewed by: imp Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22660 Modified: head/lib/libcompiler_rt/Makefile.inc Modified: head/lib/libcompiler_rt/Makefile.inc ============================================================================== --- head/lib/libcompiler_rt/Makefile.inc Wed Dec 4 20:15:17 2019 (r355400) +++ head/lib/libcompiler_rt/Makefile.inc Wed Dec 4 20:18:12 2019 (r355401) @@ -241,3 +241,7 @@ SRCS+= sync_synchronize.S SRCS+= bswapdi2.c SRCS+= bswapsi2.c .endif + +.if ${MACHINE_ARCH:Mriscv*sf} +CFLAGS+= -D__SOFT_FP__ +.endif From owner-svn-src-all@freebsd.org Wed Dec 4 20:50:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 455F01AEA6C; Wed, 4 Dec 2019 20:50:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SrbZ18mYz4Lsr; Wed, 4 Dec 2019 20:50:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0BE0861E9; Wed, 4 Dec 2019 20:50:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4KonqD088818; Wed, 4 Dec 2019 20:50:49 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4KonCp088817; Wed, 4 Dec 2019 20:50:49 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912042050.xB4KonCp088817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 4 Dec 2019 20:50:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355402 - head/lib/libc/riscv/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libc/riscv/gen X-SVN-Commit-Revision: 355402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 20:50:50 -0000 Author: jhb Date: Wed Dec 4 20:50:49 2019 New Revision: 355402 URL: https://svnweb.freebsd.org/changeset/base/355402 Log: Use a single 'ld' to read the jmpbuf magic values instead of 'la; ld'. This saves an instruction in each case as well as an extra memory indirection via the GOT for PIC code. Reviewed by: br, James Clarke Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22656 Modified: head/lib/libc/riscv/gen/_setjmp.S head/lib/libc/riscv/gen/setjmp.S Modified: head/lib/libc/riscv/gen/_setjmp.S ============================================================================== --- head/lib/libc/riscv/gen/_setjmp.S Wed Dec 4 20:18:12 2019 (r355401) +++ head/lib/libc/riscv/gen/_setjmp.S Wed Dec 4 20:50:49 2019 (r355402) @@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$"); ENTRY(_setjmp) /* Store the magic value and stack pointer */ - la t0, .Lmagic - ld t0, 0(t0) + ld t0, .Lmagic sd t0, (0 * 8)(a0) sd sp, (1 * 8)(a0) addi a0, a0, (2 * 8) @@ -89,8 +88,7 @@ END(_setjmp) ENTRY(_longjmp) /* Check the magic value */ ld t0, 0(a0) - la t1, .Lmagic - ld t1, 0(t1) + ld t1, .Lmagic bne t0, t1, botch /* Restore the stack pointer */ Modified: head/lib/libc/riscv/gen/setjmp.S ============================================================================== --- head/lib/libc/riscv/gen/setjmp.S Wed Dec 4 20:18:12 2019 (r355401) +++ head/lib/libc/riscv/gen/setjmp.S Wed Dec 4 20:50:49 2019 (r355402) @@ -53,8 +53,7 @@ ENTRY(setjmp) addi sp, sp, (2 * 8) /* Store the magic value and stack pointer */ - la t0, .Lmagic - ld t0, 0(t0) + ld t0, .Lmagic sd t0, (0 * 8)(a0) sd sp, (1 * 8)(a0) addi a0, a0, (2 * 8) @@ -119,8 +118,7 @@ ENTRY(longjmp) /* Check the magic value */ ld t0, 0(a0) - la t1, .Lmagic - ld t1, 0(t1) + ld t1, .Lmagic bne t0, t1, botch /* Restore the stack pointer */ From owner-svn-src-all@freebsd.org Wed Dec 4 21:01:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D7B241AEF36; Wed, 4 Dec 2019 21:01:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SrqY5R5vz4MXy; Wed, 4 Dec 2019 21:01:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E4E46318; Wed, 4 Dec 2019 21:01:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4L1Djf094907; Wed, 4 Dec 2019 21:01:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4L1DaV094906; Wed, 4 Dec 2019 21:01:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912042101.xB4L1DaV094906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 4 Dec 2019 21:01:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355403 - head/lib/libc/riscv/gen X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/lib/libc/riscv/gen X-SVN-Commit-Revision: 355403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 21:01:13 -0000 Author: jhb Date: Wed Dec 4 21:01:13 2019 New Revision: 355403 URL: https://svnweb.freebsd.org/changeset/base/355403 Log: Use "far" calls and branches so that lld uses valid relocations. Conditional branch and jump instructions do not always call via PLT stubs and thus will not honor LD_PRELOAD, etc. lld warns about using non-preemptible relocations for preemptible or unknown symbols whereas bfd does not (at least for RISC-V). Reviewed by: br, James Clarke Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22658 Modified: head/lib/libc/riscv/gen/setjmp.S head/lib/libc/riscv/gen/sigsetjmp.S Modified: head/lib/libc/riscv/gen/setjmp.S ============================================================================== --- head/lib/libc/riscv/gen/setjmp.S Wed Dec 4 20:50:49 2019 (r355402) +++ head/lib/libc/riscv/gen/setjmp.S Wed Dec 4 21:01:13 2019 (r355403) @@ -46,7 +46,7 @@ ENTRY(setjmp) addi a2, a0, (_JB_SIGMASK * 8) /* oset */ li a1, 0 /* set */ li a0, 1 /* SIG_BLOCK */ - jal sigprocmask + call _C_LABEL(sigprocmask) ld a0, 0(sp) ld ra, 8(sp) @@ -109,7 +109,7 @@ ENTRY(longjmp) li a2, 0 /* oset */ addi a1, a0, (_JB_SIGMASK * 8) /* set */ li a0, 3 /* SIG_BLOCK */ - jal sigprocmask + call _C_LABEL(sigprocmask) ld a1, (2 * 8)(sp) ld ra, (1 * 8)(sp) Modified: head/lib/libc/riscv/gen/sigsetjmp.S ============================================================================== --- head/lib/libc/riscv/gen/sigsetjmp.S Wed Dec 4 20:50:49 2019 (r355402) +++ head/lib/libc/riscv/gen/sigsetjmp.S Wed Dec 4 21:01:13 2019 (r355403) @@ -38,8 +38,10 @@ __FBSDID("$FreeBSD$"); #include ENTRY(sigsetjmp) - beqz a1, _C_LABEL(_setjmp) - j _C_LABEL(setjmp) + beqz a1, 1f + tail _C_LABEL(setjmp) +1: + tail _C_LABEL(_setjmp) END(sigsetjmp) ENTRY(siglongjmp) @@ -48,8 +50,10 @@ ENTRY(siglongjmp) ld a3, 0(a0) /* Check the magic */ - beq a2, a3, _C_LABEL(_longjmp) - j _C_LABEL(longjmp) + beq a2, a3, 1f + tail _C_LABEL(longjmp) +1: + tail _C_LABEL(_longjmp) .align 3 .Lmagic: From owner-svn-src-all@freebsd.org Wed Dec 4 21:26:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A47421AF945; Wed, 4 Dec 2019 21:26:05 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SsNF3v7rz4Nx3; Wed, 4 Dec 2019 21:26:05 +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 64706688D; Wed, 4 Dec 2019 21:26:05 +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 xB4LQ5TE012267; Wed, 4 Dec 2019 21:26:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4LQ3VS012258; Wed, 4 Dec 2019 21:26:03 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912042126.xB4LQ3VS012258@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 4 Dec 2019 21:26:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355404 - in head/sys: cam geom kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys: cam geom kern X-SVN-Commit-Revision: 355404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 21:26:05 -0000 Author: mav Date: Wed Dec 4 21:26:03 2019 New Revision: 355404 URL: https://svnweb.freebsd.org/changeset/base/355404 Log: Mark some more hot global variables with __read_mostly. MFC after: 1 week Modified: head/sys/cam/cam_xpt.c head/sys/geom/geom_io.c head/sys/geom/geom_kern.c head/sys/kern/kern_mtxpool.c head/sys/kern/kern_shutdown.c head/sys/kern/kern_timeout.c head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c head/sys/kern/vfs_bio.c Modified: head/sys/cam/cam_xpt.c ============================================================================== --- head/sys/cam/cam_xpt.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/cam/cam_xpt.c Wed Dec 4 21:26:03 2019 (r355404) @@ -214,7 +214,7 @@ static struct cdevsw xpt_cdevsw = { /* Storage for debugging datastructures */ struct cam_path *cam_dpath; -u_int32_t cam_dflags = CAM_DEBUG_FLAGS; +u_int32_t __read_mostly cam_dflags = CAM_DEBUG_FLAGS; SYSCTL_UINT(_kern_cam, OID_AUTO, dflags, CTLFLAG_RWTUN, &cam_dflags, 0, "Enabled debug flags"); u_int32_t cam_debug_delay = CAM_DEBUG_DELAY; Modified: head/sys/geom/geom_io.c ============================================================================== --- head/sys/geom/geom_io.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/geom/geom_io.c Wed Dec 4 21:26:03 2019 (r355404) @@ -83,9 +83,9 @@ static struct g_bioq g_bio_run_up; * pressures exist. See g_io_schedule_down() for more details * and limitations. */ -static volatile u_int pace; +static volatile u_int __read_mostly pace; -static uma_zone_t biozone; +static uma_zone_t __read_mostly biozone; /* * The head of the list of classifiers used in g_io_request. @@ -93,8 +93,8 @@ static uma_zone_t biozone; * to add/remove entries to the list. * Classifiers are invoked in registration order. */ -static TAILQ_HEAD(g_classifier_tailq, g_classifier_hook) - g_classifier_tailq = TAILQ_HEAD_INITIALIZER(g_classifier_tailq); +static TAILQ_HEAD(, g_classifier_hook) g_classifier_tailq __read_mostly = + TAILQ_HEAD_INITIALIZER(g_classifier_tailq); #include Modified: head/sys/geom/geom_kern.c ============================================================================== --- head/sys/geom/geom_kern.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/geom/geom_kern.c Wed Dec 4 21:26:03 2019 (r355404) @@ -61,12 +61,12 @@ MALLOC_DEFINE(M_GEOM, "GEOM", "Geom data structures"); struct sx topology_lock; static struct proc *g_proc; -static struct thread *g_up_td; -static struct thread *g_down_td; -static struct thread *g_event_td; +static struct thread __read_mostly *g_up_td; +static struct thread __read_mostly *g_down_td; +static struct thread __read_mostly *g_event_td; -int g_debugflags; -int g_collectstats = 1; +int __read_mostly g_debugflags; +int __read_mostly g_collectstats = G_STATS_PROVIDERS; int g_shutdown; int g_notaste; Modified: head/sys/kern/kern_mtxpool.c ============================================================================== --- head/sys/kern/kern_mtxpool.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/kern_mtxpool.c Wed Dec 4 21:26:03 2019 (r355404) @@ -82,7 +82,7 @@ struct mtx_pool { #define mtx_pool_shift mtx_pool_header.mtxpool_shift #define mtx_pool_next mtx_pool_header.mtxpool_next -struct mtx_pool *mtxpool_sleep; +struct mtx_pool __read_frequently *mtxpool_sleep; #if UINTPTR_MAX == UINT64_MAX /* 64 bits */ # define POINTER_BITS 64 Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/kern_shutdown.c Wed Dec 4 21:26:03 2019 (r355404) @@ -217,9 +217,9 @@ SYSCTL_INT(_kern, OID_AUTO, kerneldump_gzlevel, CTLFLA * Variable panicstr contains argument to first call to panic; used as flag * to indicate that the kernel has already called panic. */ -const char *panicstr; +const char __read_mostly *panicstr; -int dumping; /* system is dumping */ +int __read_mostly dumping; /* system is dumping */ int rebooting; /* system is rebooting */ /* * Used to serialize between sysctl kern.shutdown.dumpdevname and list Modified: head/sys/kern/kern_timeout.c ============================================================================== --- head/sys/kern/kern_timeout.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/kern_timeout.c Wed Dec 4 21:26:03 2019 (r355404) @@ -130,7 +130,8 @@ SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTU * TODO: * allocate more timeout table slots when table overflows. */ -u_int callwheelsize, callwheelmask; +static u_int __read_mostly callwheelsize; +static u_int __read_mostly callwheelmask; /* * The callout cpu exec entities represent informations necessary for @@ -209,7 +210,7 @@ struct callout_cpu cc_cpu; #define CC_UNLOCK(cc) mtx_unlock_spin(&(cc)->cc_lock) #define CC_LOCK_ASSERT(cc) mtx_assert(&(cc)->cc_lock, MA_OWNED) -static int timeout_cpu; +static int __read_mostly timeout_cpu; static void callout_cpu_init(struct callout_cpu *cc, int cpu); static void softclock_call_cc(struct callout *c, struct callout_cpu *cc, Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/sched_4bsd.c Wed Dec 4 21:26:03 2019 (r355404) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -int dtrace_vtime_active; +int __read_mostly dtrace_vtime_active; dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/sched_ule.c Wed Dec 4 21:26:03 2019 (r355404) @@ -72,7 +72,7 @@ __FBSDID("$FreeBSD$"); #ifdef KDTRACE_HOOKS #include -int dtrace_vtime_active; +int __read_mostly dtrace_vtime_active; dtrace_vtime_switch_func_t dtrace_vtime_switch_func; #endif @@ -206,23 +206,23 @@ _Static_assert(sizeof(struct thread) + sizeof(struct t * sched_slice: Runtime of each thread before rescheduling. * preempt_thresh: Priority threshold for preemption and remote IPIs. */ -static int sched_interact = SCHED_INTERACT_THRESH; -static int tickincr = 8 << SCHED_TICK_SHIFT; -static int realstathz = 127; /* reset during boot. */ -static int sched_slice = 10; /* reset during boot. */ -static int sched_slice_min = 1; /* reset during boot. */ +static int __read_mostly sched_interact = SCHED_INTERACT_THRESH; +static int __read_mostly tickincr = 8 << SCHED_TICK_SHIFT; +static int __read_mostly realstathz = 127; /* reset during boot. */ +static int __read_mostly sched_slice = 10; /* reset during boot. */ +static int __read_mostly sched_slice_min = 1; /* reset during boot. */ #ifdef PREEMPTION #ifdef FULL_PREEMPTION -static int preempt_thresh = PRI_MAX_IDLE; +static int __read_mostly preempt_thresh = PRI_MAX_IDLE; #else -static int preempt_thresh = PRI_MIN_KERN; +static int __read_mostly preempt_thresh = PRI_MIN_KERN; #endif #else -static int preempt_thresh = 0; +static int __read_mostly preempt_thresh = 0; #endif -static int static_boost = PRI_MIN_BATCH; -static int sched_idlespins = 10000; -static int sched_idlespinthresh = -1; +static int __read_mostly static_boost = PRI_MIN_BATCH; +static int __read_mostly sched_idlespins = 10000; +static int __read_mostly sched_idlespinthresh = -1; /* * tdq - per processor runqs and statistics. All fields are protected by the @@ -262,7 +262,7 @@ struct tdq { #define TDQ_IDLE 2 #ifdef SMP -struct cpu_group *cpu_top; /* CPU topology */ +struct cpu_group __read_mostly *cpu_top; /* CPU topology */ #define SCHED_AFFINITY_DEFAULT (max(1, hz / 1000)) #define SCHED_AFFINITY(ts, t) ((ts)->ts_rltick > ticks - ((t) * affinity)) @@ -272,16 +272,16 @@ struct cpu_group *cpu_top; /* CPU topology */ */ static int rebalance = 1; static int balance_interval = 128; /* Default set in sched_initticks(). */ -static int affinity; -static int steal_idle = 1; -static int steal_thresh = 2; -static int always_steal = 0; -static int trysteal_limit = 2; +static int __read_mostly affinity; +static int __read_mostly steal_idle = 1; +static int __read_mostly steal_thresh = 2; +static int __read_mostly always_steal = 0; +static int __read_mostly trysteal_limit = 2; /* * One thread queue per processor. */ -static struct tdq *balance_tdq; +static struct tdq __read_mostly *balance_tdq; static int balance_ticks; DPCPU_DEFINE_STATIC(struct tdq, tdq); DPCPU_DEFINE_STATIC(uint32_t, randomval); Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Dec 4 21:01:13 2019 (r355403) +++ head/sys/kern/vfs_bio.c Wed Dec 4 21:26:03 2019 (r355404) @@ -149,7 +149,7 @@ struct bufdomain { static struct buf *buf; /* buffer header pool */ extern struct buf *swbuf; /* Swap buffer header pool. */ -caddr_t unmapped_buf; +caddr_t __read_mostly unmapped_buf; /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */ struct proc *bufdaemonproc; From owner-svn-src-all@freebsd.org Wed Dec 4 22:41:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DC0E1B0F11; Wed, 4 Dec 2019 22:41:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sv3j2Fv1z4RqH; Wed, 4 Dec 2019 22:41:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30BD87670; Wed, 4 Dec 2019 22:41:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4Mfrnf059747; Wed, 4 Dec 2019 22:41:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4MfrFY059723; Wed, 4 Dec 2019 22:41:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201912042241.xB4MfrFY059723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 4 Dec 2019 22:41:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355405 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 355405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 22:41:53 -0000 Author: glebius Date: Wed Dec 4 22:41:52 2019 New Revision: 355405 URL: https://svnweb.freebsd.org/changeset/base/355405 Log: Fix regression from r354484. Don't leak pcb lock if cr_canseeinpcb() returns non-zero. PR: 242415 Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Dec 4 21:26:03 2019 (r355404) +++ head/sys/netinet/tcp_subr.c Wed Dec 4 22:41:52 2019 (r355405) @@ -2204,9 +2204,11 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, &xt, sizeof xt); if (error) break; + else + continue; } - } else - INP_RUNLOCK(inp); + } + INP_RUNLOCK(inp); } NET_EPOCH_EXIT(et); From owner-svn-src-all@freebsd.org Wed Dec 4 23:24:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE2FC1B1A87; Wed, 4 Dec 2019 23:24:40 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sw144mj4z4TKw; Wed, 4 Dec 2019 23:24:40 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6E76C7DFC; Wed, 4 Dec 2019 23:24:40 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB4NOeVp084851; Wed, 4 Dec 2019 23:24:40 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB4NOeXV084849; Wed, 4 Dec 2019 23:24:40 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912042324.xB4NOeXV084849@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 4 Dec 2019 23:24:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355406 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 355406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Dec 2019 23:24:40 -0000 Author: rmacklem Date: Wed Dec 4 23:24:40 2019 New Revision: 355406 URL: https://svnweb.freebsd.org/changeset/base/355406 Log: Add some definitions for NFSv4.2 which will be used by subsequent commits. This is a preliminary commit of NFSv4.2 definitions that will be used by subsequent commits which adds NFSv4.2 support to the NFS client and server. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Modified: head/sys/fs/nfs/nfsproto.h Modified: head/sys/fs/nfs/nfsproto.h ============================================================================== --- head/sys/fs/nfs/nfsproto.h Wed Dec 4 22:41:52 2019 (r355405) +++ head/sys/fs/nfs/nfsproto.h Wed Dec 4 23:24:40 2019 (r355406) @@ -78,6 +78,7 @@ #define NFS_FABLKSIZE 512 /* Size in bytes of a block wrt fa_blocks */ #define NFSV4_MINORVERSION 0 /* V4 Minor version */ #define NFSV41_MINORVERSION 1 /* V4 Minor version */ +#define NFSV42_MINORVERSION 2 /* V4 Minor version */ #define NFSV4_CBVERS 1 /* V4 CB Version */ #define NFSV41_CBVERS 4 /* V4.1 CB Version */ #define NFSV4_SMALLSTR 50 /* Strings small enough for stack */ @@ -214,6 +215,22 @@ #define NFSERR_RETURNCONFLICT 10086 #define NFSERR_DELEGREVOKED 10087 +/* NFSv4.2 specific errors. */ +#define NFSERR_PARTNERNOTSUPP 10088 +#define NFSERR_PARTNERNOAUTH 10089 +#define NFSERR_UNIONNOTSUPP 10090 +#define NFSERR_OFFLOADDENIED 10091 +#define NFSERR_WRONGLFS 10092 +#define NFSERR_BADLABEL 10093 +#define NFSERR_OFFLOADNOREQS 10094 + +/* NFSv4.2 Extended Attribute errors. */ +#define NFSERR_NOXATTR 10095 +#define NFSERR_XATTR2BIG 10096 + +/* Maximum value of all the NFS error values. */ +#define NFSERR_MAXERRVAL NFSERR_XATTR2BIG + #define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */ #define NFSERR_DONTREPLY 30003 /* Don't process request */ #define NFSERR_RETVOID 30004 /* Return void, not error */ @@ -364,6 +381,24 @@ */ #define NFSV41_NPROCS 56 +/* Additional procedures for NFSv4.2. */ +#define NFSPROC_IOADVISE 56 +#define NFSPROC_ALLOCATE 57 +#define NFSPROC_COPY 58 +#define NFSPROC_SEEK 59 +#define NFSPROC_SEEKDS 60 + +/* and the ones for the optional Extended attribute support (RFC-8276). */ +#define NFSPROC_GETEXTATTR 61 +#define NFSPROC_SETEXTATTR 62 +#define NFSPROC_RMEXTATTR 63 +#define NFSPROC_LISTEXTATTR 64 + +/* + * Must be defined as one higher than the last NFSv4.2 Proc# above. + */ +#define NFSV42_NPROCS 65 + #endif /* NFS_V3NPROCS */ /* @@ -593,6 +628,11 @@ #define NFSACCESS_EXTEND 0x08 #define NFSACCESS_DELETE 0x10 #define NFSACCESS_EXECUTE 0x20 + +/* Additional Extended Attribute access bits RFC-8276. */ +#define NFSACCESS_XAREAD 0x40 +#define NFSACCESS_XAWRITE 0x80 +#define NFSACCESS_XALIST 0x100 #define NFSWRITE_UNSTABLE 0 #define NFSWRITE_DATASYNC 1 From owner-svn-src-all@freebsd.org Thu Dec 5 00:03:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C66E1B26BF; Thu, 5 Dec 2019 00:03:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Swsf2zcnz4Vjn; Thu, 5 Dec 2019 00:03:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 497D284FF; Thu, 5 Dec 2019 00:03:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB503ID4008637; Thu, 5 Dec 2019 00:03:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB503HtP008634; Thu, 5 Dec 2019 00:03:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912050003.xB503HtP008634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 5 Dec 2019 00:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355407 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 355407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 00:03:18 -0000 Author: kib Date: Thu Dec 5 00:03:17 2019 New Revision: 355407 URL: https://svnweb.freebsd.org/changeset/base/355407 Log: Stop using per-mount tmpfs zones. Requested and reviewed by: jeff Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22643 Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_subr.c head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Wed Dec 4 23:24:40 2019 (r355406) +++ head/sys/fs/tmpfs/tmpfs.h Thu Dec 5 00:03:17 2019 (r355407) @@ -378,10 +378,6 @@ struct tmpfs_mount { /* All node lock to protect the node list and tmp_pages_used. */ struct mtx tm_allnode_lock; - /* Zones used to store file system meta data, per tmpfs mount. */ - uma_zone_t tm_dirent_pool; - uma_zone_t tm_node_pool; - /* Read-only status. */ bool tm_ronly; /* Do not use namecache. */ @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node #endif size_t tmpfs_mem_avail(void); - size_t tmpfs_pages_used(struct tmpfs_mount *tmp); +void tmpfs_subr_init(void); +void tmpfs_subr_uninit(void); #endif Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Dec 4 23:24:40 2019 (r355406) +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 5 00:03:17 2019 (r355407) @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; +static uma_zone_t tmpfs_dirent_pool; +static uma_zone_t tmpfs_node_pool; + static int +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_gen++; + node->tn_size = 0; + node->tn_status = 0; + node->tn_flags = 0; + node->tn_links = 0; + node->tn_vnode = NULL; + node->tn_vpstate = 0; + return (0); +} + +static void +tmpfs_node_dtor(void *mem, int size, void *arg) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_type = VNON; +} + +static int +tmpfs_node_init(void *mem, int size, int flags) +{ + struct tmpfs_node *node; + + node = mem; + node->tn_id = 0; + mtx_init(&node->tn_interlock, "tmpfsni", NULL, MTX_DEF); + node->tn_gen = arc4random(); + return (0); +} + +static void +tmpfs_node_fini(void *mem, int size) +{ + struct tmpfs_node *node; + + node = mem; + mtx_destroy(&node->tn_interlock); +} + +void +tmpfs_subr_init(void) +{ + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + tmpfs_node_pool = uma_zcreate("TMPFS node", + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); +} + +void +tmpfs_subr_uninit(void) +{ + uma_zdestroy(tmpfs_node_pool); + uma_zdestroy(tmpfs_dirent_pool); +} + +static int sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) { int error; @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) return (EROFS); - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, - M_WAITOK); + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); /* Generic initialization. */ nnode->tn_type = type; @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); } - uma_zfree(tmp->tm_node_pool, node); + uma_zfree(tmpfs_node_pool, node); TMPFS_LOCK(tmp); tmpfs_free_tmp(tmp); return (true); @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp { struct tmpfs_dirent *nde; - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); nde->td_node = node; if (name != NULL) { nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); @@ -470,7 +536,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf } if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) free(de->ud.td_name, M_TMPFSNAME); - uma_zfree(tmp->tm_dirent_pool, de); + uma_zfree(tmpfs_dirent_pool, de); } void Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Wed Dec 4 23:24:40 2019 (r355406) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Thu Dec 5 00:03:17 2019 (r355407) @@ -99,49 +99,6 @@ static const char *tmpfs_updateopts[] = { "from", "export", "size", NULL }; -static int -tmpfs_node_ctor(void *mem, int size, void *arg, int flags) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - - node->tn_gen++; - node->tn_size = 0; - node->tn_status = 0; - node->tn_flags = 0; - node->tn_links = 0; - node->tn_vnode = NULL; - node->tn_vpstate = 0; - - return (0); -} - -static void -tmpfs_node_dtor(void *mem, int size, void *arg) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - node->tn_type = VNON; -} - -static int -tmpfs_node_init(void *mem, int size, int flags) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - node->tn_id = 0; - - mtx_init(&node->tn_interlock, "tmpfs node interlock", NULL, MTX_DEF); - node->tn_gen = arc4random(); - - return (0); -} - -static void -tmpfs_node_fini(void *mem, int size) -{ - struct tmpfs_node *node = (struct tmpfs_node *)mem; - - mtx_destroy(&node->tn_interlock); -} - /* * Handle updates of time from writes to mmaped regions. Use * MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_ACTIVE, since @@ -481,12 +438,6 @@ tmpfs_mount(struct mount *mp) tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; new_unrhdr64(&tmp->tm_ino_unr, 2); - tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", - sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, 0); - tmp->tm_node_pool = uma_zcreate("TMPFS node", - sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, - tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; tmp->tm_nonc = nonc; @@ -495,8 +446,6 @@ tmpfs_mount(struct mount *mp) root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); if (error != 0 || root == NULL) { - uma_zdestroy(tmp->tm_node_pool); - uma_zdestroy(tmp->tm_dirent_pool); free(tmp, M_TMPFSMNT); return (error); } @@ -590,9 +539,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp) } TMPFS_UNLOCK(tmp); - uma_zdestroy(tmp->tm_dirent_pool); - uma_zdestroy(tmp->tm_node_pool); - mtx_destroy(&tmp->tm_allnode_lock); MPASS(tmp->tm_pages_used == 0); MPASS(tmp->tm_nodes_inuse == 0); @@ -702,10 +648,23 @@ tmpfs_susp_clean(struct mount *mp __unused) { } +static int +tmpfs_init(struct vfsconf *conf) +{ + tmpfs_subr_init(); + return (0); +} + +static int +tmpfs_uninit(struct vfsconf *conf) +{ + tmpfs_subr_uninit(); + return (0); +} + /* * tmpfs vfs operations. */ - struct vfsops tmpfs_vfsops = { .vfs_mount = tmpfs_mount, .vfs_unmount = tmpfs_unmount, @@ -715,5 +674,7 @@ struct vfsops tmpfs_vfsops = { .vfs_fhtovp = tmpfs_fhtovp, .vfs_sync = tmpfs_sync, .vfs_susp_clean = tmpfs_susp_clean, + .vfs_init = tmpfs_init, + .vfs_uninit = tmpfs_uninit, }; VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); From owner-svn-src-all@freebsd.org Thu Dec 5 00:56:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB2E61B3828; Thu, 5 Dec 2019 00:56:04 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Sy2X4rKWz4Y5j; Thu, 5 Dec 2019 00:56:04 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8907F8DD8; Thu, 5 Dec 2019 00:56:04 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB50u4nd039160; Thu, 5 Dec 2019 00:56:04 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB50u3f9039157; Thu, 5 Dec 2019 00:56:03 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912050056.xB50u3f9039157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 5 Dec 2019 00:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355408 - in head/sys: arm/mv arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: in head/sys: arm/mv arm64/conf conf X-SVN-Commit-Revision: 355408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 00:56:04 -0000 Author: loos Date: Thu Dec 5 00:56:03 2019 New Revision: 355408 URL: https://svnweb.freebsd.org/changeset/base/355408 Log: Add the I2C driver for the Armada 37x0. This controller is a bit tricky as the STOP condition must be indicated in the last tranferred byte, some devices will not like the repeated start behavior of this controller. A proper fix to this issue is in the works. This driver works in polling mode, can be used early in the boot (required in some cases). Tested on espressobin/SG-1100 and the SG-3200. Obtained from: pfSense Sponsored by: Rubicon Communications, LLC (Netgate) Added: head/sys/arm/mv/a37x0_iic.c (contents, props changed) head/sys/arm/mv/a37x0_iicreg.h (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/mv/a37x0_iic.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/a37x0_iic.c Thu Dec 5 00:56:03 2019 (r355408) @@ -0,0 +1,484 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018, 2019 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for Armada 37x0 i2c controller. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#include "iicbus_if.h" + +struct a37x0_iic_softc { + boolean_t sc_fast_mode; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + device_t sc_dev; + device_t sc_iicbus; + struct mtx sc_mtx; + struct resource *sc_mem_res; + struct resource *sc_irq_res; + void *sc_intrhand; +}; + +#define A37X0_IIC_WRITE(_sc, _off, _val) \ + bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, _off, _val) +#define A37X0_IIC_READ(_sc, _off) \ + bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, _off) +#define A37X0_IIC_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define A37X0_IIC_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) + +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-i2c", 1 }, + { NULL, 0 } +}; + +#undef A37x0_IIC_DEBUG + +static void a37x0_iic_intr(void *); +static int a37x0_iic_detach(device_t); + +static void +a37x0_iic_rmw(struct a37x0_iic_softc *sc, uint32_t off, uint32_t mask, + uint32_t value) +{ + uint32_t reg; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + reg = A37X0_IIC_READ(sc, off); + reg &= ~mask; + reg |= value; + A37X0_IIC_WRITE(sc, off, reg); +} + +static int +a37x0_iic_wait_clear(struct a37x0_iic_softc *sc, uint32_t mask) +{ + int timeout; + uint32_t status; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + timeout = 1000; + do { + DELAY(10); + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + if (--timeout == 0) + return (0); + } while ((status & mask) != 0); + + return (1); +} + +static int +a37x0_iic_wait_set(struct a37x0_iic_softc *sc, uint32_t mask) +{ + int timeout; + uint32_t status; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + timeout = 1000; + do { + DELAY(10); + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + if (--timeout == 0) + return (0); + } while ((status & mask) != mask); + + return (1); +} + +#ifdef A37x0_IIC_DEBUG +static void +a37x0_iic_regdump(struct a37x0_iic_softc *sc) +{ + + mtx_assert(&sc->sc_mtx, MA_OWNED); + printf("%s: IBMR: %#x\n", __func__, A37X0_IIC_READ(sc, A37X0_IIC_IBMR)); + printf("%s: ICR: %#x\n", __func__, A37X0_IIC_READ(sc, A37X0_IIC_ICR)); + printf("%s: ISR: %#x\n", __func__, A37X0_IIC_READ(sc, A37X0_IIC_ISR)); +} +#endif + +static void +a37x0_iic_reset(struct a37x0_iic_softc *sc) +{ + uint32_t mode, reg; + + mtx_assert(&sc->sc_mtx, MA_OWNED); + + /* Disable the controller. */ + reg = A37X0_IIC_READ(sc, A37X0_IIC_ICR); + mode = reg & ICR_MODE_MASK; + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg & ~ICR_IUE); + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg | ICR_UR); + DELAY(100); + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg & ~ICR_IUE); + + /* Enable the controller. */ + reg = A37X0_IIC_READ(sc, A37X0_IIC_ICR); + reg |= mode | ICR_IUE | ICR_GCD | ICR_SCLE; + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg); +#ifdef A37x0_IIC_DEBUG + a37x0_iic_regdump(sc); +#endif +} + +static int +a37x0_iic_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell Armada 37x0 IIC controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +a37x0_iic_attach(device_t dev) +{ + int rid; + phandle_t node; + struct a37x0_iic_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->sc_mem_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (!sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot allocate interrupt\n"); + return (ENXIO); + } + + /* Hook up our interrupt handler. */ + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, a37x0_iic_intr, sc, &sc->sc_intrhand)) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot setup the interrupt handler\n"); + return (ENXIO); + } + + mtx_init(&sc->sc_mtx, "a37x0_iic", NULL, MTX_DEF); + + node = ofw_bus_get_node(dev); + if (OF_hasprop(node, "mrvl,i2c-fast-mode")) + sc->sc_fast_mode = true; + + /* Enable the controller. */ + A37X0_IIC_LOCK(sc); + a37x0_iic_reset(sc); + A37X0_IIC_UNLOCK(sc); + + sc->sc_iicbus = device_add_child(dev, "iicbus", -1); + if (sc->sc_iicbus == NULL) { + a37x0_iic_detach(dev); + return (ENXIO); + } + + /* Probe and attach the iicbus. */ + return (bus_generic_attach(dev)); +} + +static int +a37x0_iic_detach(device_t dev) +{ + struct a37x0_iic_softc *sc; + + bus_generic_detach(dev); + + sc = device_get_softc(dev); + if (sc->sc_iicbus != NULL) + device_delete_child(dev, sc->sc_iicbus); + mtx_destroy(&sc->sc_mtx); + if (sc->sc_intrhand) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static void +a37x0_iic_intr(void *arg) +{ + struct a37x0_iic_softc *sc; + uint32_t status; + + /* Not used, the interrupts are not enabled. */ + sc = (struct a37x0_iic_softc *)arg; + A37X0_IIC_LOCK(sc); + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); +#ifdef A37x0_IIC_DEBUG + a37x0_iic_regdump(sc); +#endif + + /* Clear pending interrrupts. */ + A37X0_IIC_WRITE(sc, A37X0_IIC_ISR, status); + A37X0_IIC_UNLOCK(sc); +} + +static int +a37x0_iic_stop(device_t dev) +{ + struct a37x0_iic_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + A37X0_IIC_LOCK(sc); + /* Clear the STOP condition. */ + reg = A37X0_IIC_READ(sc, A37X0_IIC_ICR); + if (reg & (ICR_ACKNAK | ICR_STOP)) { + reg &= ~(ICR_START | ICR_ACKNAK | ICR_STOP); + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg); + } + /* Clear interrupts. */ + reg = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + A37X0_IIC_WRITE(sc, A37X0_IIC_ISR, reg); + A37X0_IIC_UNLOCK(sc); + + return (IIC_NOERR); +} + +static int +a37x0_iic_start(device_t dev, u_char slave, int timeout) +{ + int rv; + struct a37x0_iic_softc *sc; + uint32_t reg, status; + + sc = device_get_softc(dev); + A37X0_IIC_LOCK(sc); + + /* Wait for the bus to be free before start a transaction. */ + if (a37x0_iic_wait_clear(sc, ISR_IBB) == 0) { + A37X0_IIC_UNLOCK(sc); + return (IIC_ETIMEOUT); + } + + /* Write the slave address. */ + A37X0_IIC_WRITE(sc, A37X0_IIC_IDBR, slave); + + /* Send Start condition (with slave address). */ + reg = A37X0_IIC_READ(sc, A37X0_IIC_ICR); + reg &= ~(ICR_STOP | ICR_ACKNAK); + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg | ICR_START | ICR_TB); + + rv = IIC_NOERR; + if (a37x0_iic_wait_set(sc, ISR_ITE) == 0) + rv = IIC_ETIMEOUT; + if (rv == IIC_NOERR) { + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + A37X0_IIC_WRITE(sc, A37X0_IIC_ISR, status | ISR_ITE); + if (a37x0_iic_wait_clear(sc, ISR_ACKNAK) == 0) + rv = IIC_ENOACK; + } + + A37X0_IIC_UNLOCK(sc); + if (rv != IIC_NOERR) + a37x0_iic_stop(dev); + + return (rv); +} + +static int +a37x0_iic_bus_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +{ + struct a37x0_iic_softc *sc; + uint32_t busfreq; + + sc = device_get_softc(dev); + A37X0_IIC_LOCK(sc); + a37x0_iic_reset(sc); + if (sc->sc_iicbus == NULL) + busfreq = 100000; + else + busfreq = IICBUS_GET_FREQUENCY(sc->sc_iicbus, speed); + a37x0_iic_rmw(sc, A37X0_IIC_ICR, ICR_MODE_MASK, + (busfreq > 100000) ? ICR_FAST_MODE : 0); + A37X0_IIC_UNLOCK(sc); + + return (IIC_ENOADDR); +} + +static int +a37x0_iic_read(device_t dev, char *buf, int len, int *read, int last, int delay) +{ + int rv; + struct a37x0_iic_softc *sc; + uint32_t reg, status; + + sc = device_get_softc(dev); + A37X0_IIC_LOCK(sc); + reg = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + if ((reg & (ISR_UB | ISR_IBB)) != ISR_UB) { + A37X0_IIC_UNLOCK(sc); + return (IIC_EBUSERR); + } + + *read = 0; + rv = IIC_NOERR; + while (*read < len) { + reg = A37X0_IIC_READ(sc, A37X0_IIC_ICR); + reg &= ~(ICR_START | ICR_STOP | ICR_ACKNAK); + if (*read == len - 1) + reg |= ICR_ACKNAK | ICR_STOP; + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg | ICR_TB); + if (a37x0_iic_wait_set(sc, ISR_IRF) == 0) { + rv = IIC_ETIMEOUT; + break; + } + *buf++ = A37X0_IIC_READ(sc, A37X0_IIC_IDBR); + (*read)++; + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + A37X0_IIC_WRITE(sc, A37X0_IIC_ISR, status | ISR_IRF); + } + A37X0_IIC_UNLOCK(sc); + + return (rv); +} + +static int +a37x0_iic_write(device_t dev, const char *buf, int len, int *sent, int timeout) +{ + int rv; + struct a37x0_iic_softc *sc; + uint32_t reg, status; + + sc = device_get_softc(dev); + A37X0_IIC_LOCK(sc); + reg = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + if ((reg & (ISR_UB | ISR_IBB)) != ISR_UB) { + A37X0_IIC_UNLOCK(sc); + return (IIC_EBUSERR); + } + + rv = IIC_NOERR; + *sent = 0; + while (*sent < len) { + A37X0_IIC_WRITE(sc, A37X0_IIC_IDBR, *buf++); + reg = A37X0_IIC_READ(sc, A37X0_IIC_ICR); + reg &= ~(ICR_START | ICR_STOP | ICR_ACKNAK); + if (*sent == len - 1) + reg |= ICR_STOP; + A37X0_IIC_WRITE(sc, A37X0_IIC_ICR, reg | ICR_TB); + if (a37x0_iic_wait_set(sc, ISR_ITE) == 0) { + rv = IIC_ETIMEOUT; + break; + } + (*sent)++; + status = A37X0_IIC_READ(sc, A37X0_IIC_ISR); + A37X0_IIC_WRITE(sc, A37X0_IIC_ISR, status | ISR_ITE); + if (a37x0_iic_wait_clear(sc, ISR_ACKNAK) == 0) { + rv = IIC_ENOACK; + break; + } + } + A37X0_IIC_UNLOCK(sc); + + return (rv); +} + +static phandle_t +a37x0_iic_get_node(device_t bus, device_t dev) +{ + + return (ofw_bus_get_node(bus)); +} + +static device_method_t a37x0_iic_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, a37x0_iic_probe), + DEVMETHOD(device_attach, a37x0_iic_attach), + DEVMETHOD(device_detach, a37x0_iic_detach), + + /* iicbus interface */ + DEVMETHOD(iicbus_reset, a37x0_iic_bus_reset), + DEVMETHOD(iicbus_callback, iicbus_null_callback), + DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), + DEVMETHOD(iicbus_repeated_start, a37x0_iic_start), + DEVMETHOD(iicbus_start, a37x0_iic_start), + DEVMETHOD(iicbus_stop, a37x0_iic_stop), + DEVMETHOD(iicbus_read, a37x0_iic_read), + DEVMETHOD(iicbus_write, a37x0_iic_write), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, a37x0_iic_get_node), + + DEVMETHOD_END +}; + +static devclass_t a37x0_iic_devclass; + +static driver_t a37x0_iic_driver = { + "iichb", + a37x0_iic_methods, + sizeof(struct a37x0_iic_softc), +}; + +DRIVER_MODULE(iicbus, a37x0_iic, iicbus_driver, iicbus_devclass, 0, 0); +DRIVER_MODULE(a37x0_iic, simplebus, a37x0_iic_driver, a37x0_iic_devclass, 0, 0); Added: head/sys/arm/mv/a37x0_iicreg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/a37x0_iicreg.h Thu Dec 5 00:56:03 2019 (r355408) @@ -0,0 +1,69 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018, 2019 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _A37X0_IICREG_H_ +#define _A37X0_IICREG_H_ + +#define A37X0_IIC_IBMR 0x00 +#define A37X0_IIC_IDBR 0x04 +#define A37X0_IIC_ICR 0x08 +#define ICR_START (1 << 0) +#define ICR_STOP (1 << 1) +#define ICR_ACKNAK (1 << 2) +#define ICR_TB (1 << 3) +#define ICR_MA (1 << 4) +#define ICR_SCLE (1 << 5) +#define ICR_IUE (1 << 6) +#define ICR_GCD (1 << 7) +#define ICR_ITEIE (1 << 8) +#define ICR_IRFIE (1 << 9) +#define ICR_BEIE (1 << 10) +#define ICR_SSDIE (1 << 11) +#define ICR_ALDIE (1 << 12) +#define ICR_SADIE (1 << 13) +#define ICR_UR (1 << 14) +#define ICR_FAST_MODE (1 << 16) +#define ICR_HIGH_SPEED (1 << 17) +#define ICR_MODE_MASK (ICR_FAST_MODE | ICR_HIGH_SPEED) +#define ICR_INIT \ + (ICR_BEIE | ICR_IRFIE | ICR_ITEIE | ICR_GCD | ICR_SCLE) +#define A37X0_IIC_ISR 0x0c +#define ISR_RWM (1 << 0) +#define ISR_ACKNAK (1 << 1) +#define ISR_UB (1 << 2) +#define ISR_IBB (1 << 3) +#define ISR_SSD (1 << 4) +#define ISR_ALD (1 << 5) +#define ISR_ITE (1 << 6) +#define ISR_IRF (1 << 7) +#define ISR_GCAD (1 << 8) +#define ISR_SAD (1 << 9) +#define ISR_BED (1 << 10) + +#endif /* _A37X0_IICREG_H_ */ Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Thu Dec 5 00:03:17 2019 (r355407) +++ head/sys/arm64/conf/GENERIC Thu Dec 5 00:56:03 2019 (r355408) @@ -249,6 +249,7 @@ device rk_gpio # RockChip GPIO Controller device rk_pinctrl # RockChip Pinmux Controller # I2C +device a37x0_iic # Armada 37x0 I2C controller device aw_rsb # Allwinner Reduced Serial Bus device bcm2835_bsc # Broadcom BCM283x I2C bus device iicbus Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Thu Dec 5 00:03:17 2019 (r355407) +++ head/sys/conf/files.arm64 Thu Dec 5 00:56:03 2019 (r355408) @@ -107,6 +107,7 @@ arm/broadcom/bcm2835/bcm2835_wdog.c optional soc_brcm arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt | soc_brcm_bcm2838 fdt arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt soc_brcm_bcm2837 | dwcotg fdt soc_brcm_bcm2838 arm/mv/a37x0_gpio.c optional a37x0_gpio gpio fdt +arm/mv/a37x0_iic.c optional a37x0_iic iicbus fdt arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt arm/mv/gpio.c optional mv_gpio fdt arm/mv/mvebu_pinctrl.c optional mvebu_pinctrl fdt From owner-svn-src-all@freebsd.org Thu Dec 5 02:01:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3586B1B5A57; Thu, 5 Dec 2019 02:01:48 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47SzVN0gRCz4cCb; Thu, 5 Dec 2019 02:01:48 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE8C59A99; Thu, 5 Dec 2019 02:01:47 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB521lg2078280; Thu, 5 Dec 2019 02:01:47 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB521lLW078279; Thu, 5 Dec 2019 02:01:47 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912050201.xB521lLW078279@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 5 Dec 2019 02:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355409 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 355409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 02:01:48 -0000 Author: loos Date: Thu Dec 5 02:01:47 2019 New Revision: 355409 URL: https://svnweb.freebsd.org/changeset/base/355409 Log: Fix the build, use the correct include path. Pointy hat to: loos Modified: head/sys/arm/mv/a37x0_iic.c Modified: head/sys/arm/mv/a37x0_iic.c ============================================================================== --- head/sys/arm/mv/a37x0_iic.c Thu Dec 5 00:56:03 2019 (r355408) +++ head/sys/arm/mv/a37x0_iic.c Thu Dec 5 02:01:47 2019 (r355409) @@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "iicbus_if.h" From owner-svn-src-all@freebsd.org Thu Dec 5 03:38:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05D251B8940; Thu, 5 Dec 2019 03:38:15 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47T1dd5Nlpz3CdQ; Thu, 5 Dec 2019 03:38:13 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pg1-x541.google.com with SMTP id b137so904592pga.6; Wed, 04 Dec 2019 19:38:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:reply-to:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dxii9tXW6AQrSxEOigx+Jjx8Z6ta9s2etl3GC4DCEIQ=; b=hEjaQbXQiITDLqaJEbFm1Ki937pS16haZiLB9z4b9ikEiXUJU5i/AqMvtiZrizEC9L yV4aLYxEjBSENIEHoP9ZH6/8si+WPchavraiRWXssWkUG1pwLZzwEZ78xx/ylUZDv/FK aA9n3Ov3dk7QiMmg8qDGcaYQHTQ2cCyLNI9bfx3Y5hCwwEDdK9D9YHWW/3GMViCYAPqY FsmXoIxLbW3CYp2q60FlFpn2Ksujgf0Kyd2MKFdpiHAyhzuMFDy3cnDpe2SIotxUORCk Bq2bo9fopckSdR7teySRPv1oL9w53pXDH5lxUD5za9gMx4l3JPb1UUuObvDdjkEtaUuG k5Tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:subject:to:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=dxii9tXW6AQrSxEOigx+Jjx8Z6ta9s2etl3GC4DCEIQ=; b=RF89zIDmaUrIx+4IJYA5KWLCjNxLmIuhCMSlec1CJ3gcMitSVIo/43WJYI7/0nvuzq iIC02yshDo/owSWH4yglEiIu4W+FbrO5DdoaYzyaz8cUQos+nKpbI3Vol3SJj9Hr2I8h PoR66exd75n+TUg4kPRkQeUy8u7btEVV6WAqjUPD33DbFxsNkxKhPzOafk/IMhu3NvLR KU3h6QkXOzGDved/u4i0sWxt3Mx948suoYI3L3mwUDzaQyPmjdZVtFfYPKx5nN+oqMCt o/abqteJFvge9i5VfXbu9RllkbVG+cOJ+27eUus4qy5gt7X0cf+wfshoommQqifRCkSh OJtg== X-Gm-Message-State: APjAAAUhQ+ruGexT97fF7siqeELSb0HOhKC9Tm+aUF6ZLLeD3D3w63LT czd3eFEN2FI2ak1ipjVxbdvKh/8q X-Google-Smtp-Source: APXvYqy1POYLQ4JlBBXSadh9UNAtfqQdrS1u3lEn92Z4CnWYj8HfC7sXIkBCQmqWAJwtEIaiXewB9w== X-Received: by 2002:a63:1402:: with SMTP id u2mr7062134pgl.224.1575517091456; Wed, 04 Dec 2019 19:38:11 -0800 (PST) Received: from [192.168.1.110] (180-150-68-130.b49644.syd.nbn.aussiebb.net. [180.150.68.130]) by smtp.gmail.com with ESMTPSA id d38sm8759818pgd.59.2019.12.04.19.38.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2019 19:38:10 -0800 (PST) Sender: Kubilay Kocak Reply-To: koobs@FreeBSD.org Subject: Re: svn commit: r355407 - head/sys/fs/tmpfs To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912050003.xB503HtP008634@repo.freebsd.org> From: Kubilay Kocak Message-ID: Date: Thu, 5 Dec 2019 14:38:07 +1100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Thunderbird/71.0 MIME-Version: 1.0 In-Reply-To: <201912050003.xB503HtP008634@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47T1dd5Nlpz3CdQ X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=hEjaQbXQ; dmarc=none; spf=pass (mx1.freebsd.org: domain of koobsfreebsd@gmail.com designates 2607:f8b0:4864:20::541 as permitted sender) smtp.mailfrom=koobsfreebsd@gmail.com X-Spamd-Result: default: False [-3.20 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; IP_SCORE(-1.00)[ip: (-0.76), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_IN_DNSWL_NONE(0.00)[1.4.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 03:38:15 -0000 On 5/12/2019 11:03 am, Konstantin Belousov wrote: > Author: kib > Date: Thu Dec 5 00:03:17 2019 > New Revision: 355407 > URL: https://svnweb.freebsd.org/changeset/base/355407 Could you elaborate on the why/rationale? Is there memory wastage/duplication, bug(s), performance or development/maintenance benefit? The review summary doesnt appear to include this information either > Log: > Stop using per-mount tmpfs zones. > > Requested and reviewed by: jeff > Sponsored by: The FreeBSD Foundation > MFC after: 1 week > Differential revision: https://reviews.freebsd.org/D22643 > > Modified: > head/sys/fs/tmpfs/tmpfs.h > head/sys/fs/tmpfs/tmpfs_subr.c > head/sys/fs/tmpfs/tmpfs_vfsops.c > > Modified: head/sys/fs/tmpfs/tmpfs.h > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs.h Wed Dec 4 23:24:40 2019 (r355406) > +++ head/sys/fs/tmpfs/tmpfs.h Thu Dec 5 00:03:17 2019 (r355407) > @@ -378,10 +378,6 @@ struct tmpfs_mount { > /* All node lock to protect the node list and tmp_pages_used. */ > struct mtx tm_allnode_lock; > > - /* Zones used to store file system meta data, per tmpfs mount. */ > - uma_zone_t tm_dirent_pool; > - uma_zone_t tm_node_pool; > - > /* Read-only status. */ > bool tm_ronly; > /* Do not use namecache. */ > @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node > #endif > > size_t tmpfs_mem_avail(void); > - > size_t tmpfs_pages_used(struct tmpfs_mount *tmp); > +void tmpfs_subr_init(void); > +void tmpfs_subr_uninit(void); > > #endif > > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Dec 4 23:24:40 2019 (r355406) > +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 5 00:03:17 2019 (r355407) > @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp > > static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; > > +static uma_zone_t tmpfs_dirent_pool; > +static uma_zone_t tmpfs_node_pool; > + > static int > +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + node->tn_gen++; > + node->tn_size = 0; > + node->tn_status = 0; > + node->tn_flags = 0; > + node->tn_links = 0; > + node->tn_vnode = NULL; > + node->tn_vpstate = 0; > + return (0); > +} > + > +static void > +tmpfs_node_dtor(void *mem, int size, void *arg) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + node->tn_type = VNON; > +} > + > +static int > +tmpfs_node_init(void *mem, int size, int flags) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + node->tn_id = 0; > + mtx_init(&node->tn_interlock, "tmpfsni", NULL, MTX_DEF); > + node->tn_gen = arc4random(); > + return (0); > +} > + > +static void > +tmpfs_node_fini(void *mem, int size) > +{ > + struct tmpfs_node *node; > + > + node = mem; > + mtx_destroy(&node->tn_interlock); > +} > + > +void > +tmpfs_subr_init(void) > +{ > + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", > + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, > + UMA_ALIGN_PTR, 0); > + tmpfs_node_pool = uma_zcreate("TMPFS node", > + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, > + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); > +} > + > +void > +tmpfs_subr_uninit(void) > +{ > + uma_zdestroy(tmpfs_node_pool); > + uma_zdestroy(tmpfs_dirent_pool); > +} > + > +static int > sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) > { > int error; > @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount > if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) > return (EROFS); > > - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, > - M_WAITOK); > + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); > > /* Generic initialization. */ > nnode->tn_type = type; > @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct > panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); > } > > - uma_zfree(tmp->tm_node_pool, node); > + uma_zfree(tmpfs_node_pool, node); > TMPFS_LOCK(tmp); > tmpfs_free_tmp(tmp); > return (true); > @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp > { > struct tmpfs_dirent *nde; > > - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); > + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); > nde->td_node = node; > if (name != NULL) { > nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); > @@ -470,7 +536,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf > } > if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) > free(de->ud.td_name, M_TMPFSNAME); > - uma_zfree(tmp->tm_dirent_pool, de); > + uma_zfree(tmpfs_dirent_pool, de); > } > > void > > Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_vfsops.c Wed Dec 4 23:24:40 2019 (r355406) > +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Thu Dec 5 00:03:17 2019 (r355407) > @@ -99,49 +99,6 @@ static const char *tmpfs_updateopts[] = { > "from", "export", "size", NULL > }; > > -static int > -tmpfs_node_ctor(void *mem, int size, void *arg, int flags) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - > - node->tn_gen++; > - node->tn_size = 0; > - node->tn_status = 0; > - node->tn_flags = 0; > - node->tn_links = 0; > - node->tn_vnode = NULL; > - node->tn_vpstate = 0; > - > - return (0); > -} > - > -static void > -tmpfs_node_dtor(void *mem, int size, void *arg) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - node->tn_type = VNON; > -} > - > -static int > -tmpfs_node_init(void *mem, int size, int flags) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - node->tn_id = 0; > - > - mtx_init(&node->tn_interlock, "tmpfs node interlock", NULL, MTX_DEF); > - node->tn_gen = arc4random(); > - > - return (0); > -} > - > -static void > -tmpfs_node_fini(void *mem, int size) > -{ > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > - > - mtx_destroy(&node->tn_interlock); > -} > - > /* > * Handle updates of time from writes to mmaped regions. Use > * MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_ACTIVE, since > @@ -481,12 +438,6 @@ tmpfs_mount(struct mount *mp) > tmp->tm_pages_max = pages; > tmp->tm_pages_used = 0; > new_unrhdr64(&tmp->tm_ino_unr, 2); > - tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", > - sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, > - UMA_ALIGN_PTR, 0); > - tmp->tm_node_pool = uma_zcreate("TMPFS node", > - sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, > - tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); > tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; > tmp->tm_nonc = nonc; > > @@ -495,8 +446,6 @@ tmpfs_mount(struct mount *mp) > root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); > > if (error != 0 || root == NULL) { > - uma_zdestroy(tmp->tm_node_pool); > - uma_zdestroy(tmp->tm_dirent_pool); > free(tmp, M_TMPFSMNT); > return (error); > } > @@ -590,9 +539,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp) > } > TMPFS_UNLOCK(tmp); > > - uma_zdestroy(tmp->tm_dirent_pool); > - uma_zdestroy(tmp->tm_node_pool); > - > mtx_destroy(&tmp->tm_allnode_lock); > MPASS(tmp->tm_pages_used == 0); > MPASS(tmp->tm_nodes_inuse == 0); > @@ -702,10 +648,23 @@ tmpfs_susp_clean(struct mount *mp __unused) > { > } > > +static int > +tmpfs_init(struct vfsconf *conf) > +{ > + tmpfs_subr_init(); > + return (0); > +} > + > +static int > +tmpfs_uninit(struct vfsconf *conf) > +{ > + tmpfs_subr_uninit(); > + return (0); > +} > + > /* > * tmpfs vfs operations. > */ > - > struct vfsops tmpfs_vfsops = { > .vfs_mount = tmpfs_mount, > .vfs_unmount = tmpfs_unmount, > @@ -715,5 +674,7 @@ struct vfsops tmpfs_vfsops = { > .vfs_fhtovp = tmpfs_fhtovp, > .vfs_sync = tmpfs_sync, > .vfs_susp_clean = tmpfs_susp_clean, > + .vfs_init = tmpfs_init, > + .vfs_uninit = tmpfs_uninit, > }; > VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Thu Dec 5 04:03:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 441AE1B95DD; Thu, 5 Dec 2019 04:03:09 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47T2BN6kMfz3Dqc; Thu, 5 Dec 2019 04:03:08 +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 CA26AB0E7; Thu, 5 Dec 2019 04:03:08 +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 xB5438HF051554; Thu, 5 Dec 2019 04:03:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5438Ka051553; Thu, 5 Dec 2019 04:03:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912050403.xB5438Ka051553@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 5 Dec 2019 04:03:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355410 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 04:03:09 -0000 Author: mav Date: Thu Dec 5 04:03:08 2019 New Revision: 355410 URL: https://svnweb.freebsd.org/changeset/base/355410 Log: Switch GEOM_DEV from make_dev_p() to make_dev_s(). It closes the race condition and so allows to remove few NULL checks. Also while there, use dev->si_drv1 in addition to cp->private to store softc pointer. For calls coming from the dev side it gives reliable cache hit instead of often miss before. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Thu Dec 5 02:01:47 2019 (r355409) +++ head/sys/geom/geom_dev.c Thu Dec 5 04:03:08 2019 (r355410) @@ -334,6 +334,7 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, int error; struct cdev *dev, *adev; char buf[SPECNAMELEN + 6]; + struct make_dev_args args; g_trace(G_T_TOPOLOGY, "dev_taste(%s,%s)", mp->name, pp->name); g_topology_assert(); @@ -346,8 +347,17 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, error = g_attach(cp, pp); KASSERT(error == 0, ("g_dev_taste(%s) failed to g_attach, err=%d", pp->name, error)); - error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev, - &g_dev_cdevsw, NULL, UID_ROOT, GID_OPERATOR, 0640, "%s", gp->name); + + make_dev_args_init(&args); + args.mda_flags = MAKEDEV_CHECKNAME | MAKEDEV_WAITOK; + args.mda_devsw = &g_dev_cdevsw; + args.mda_cr = NULL; + args.mda_uid = UID_ROOT; + args.mda_gid = GID_OPERATOR; + args.mda_mode = 0640; + args.mda_si_drv1 = sc; + args.mda_si_drv2 = cp; + error = make_dev_s(&args, &sc->sc_dev, "%s", gp->name); if (error != 0) { printf("%s: make_dev_p() failed (gp->name=%s, error=%d)\n", __func__, gp->name, error); @@ -358,11 +368,9 @@ g_dev_taste(struct g_class *mp, struct g_provider *pp, g_free(sc); return (NULL); } + dev = sc->sc_dev; dev->si_flags |= SI_UNMAPPED; - sc->sc_dev = dev; - dev->si_iosize_max = MAXPHYS; - dev->si_drv2 = cp; error = init_dumpdev(dev); if (error != 0) printf("%s: init_dumpdev() failed (gp->name=%s, error=%d)\n", @@ -397,8 +405,6 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struc int error, r, w, e; cp = dev->si_drv2; - if (cp == NULL) - return (ENXIO); /* g_dev_taste() not done yet */ g_trace(G_T_ACCESS, "g_dev_open(%s, %d, %d, %p)", cp->geom->name, flags, fmt, td); @@ -429,7 +435,7 @@ g_dev_open(struct cdev *dev, int flags, int fmt, struc error = g_access(cp, r, w, e); g_topology_unlock(); if (error == 0) { - sc = cp->private; + sc = dev->si_drv1; mtx_lock(&sc->sc_mtx); if (sc->sc_open == 0 && (sc->sc_active & SC_A_ACTIVE) != 0) wakeup(&sc->sc_active); @@ -451,8 +457,6 @@ g_dev_close(struct cdev *dev, int flags, int fmt, stru int error, r, w, e; cp = dev->si_drv2; - if (cp == NULL) - return (ENXIO); g_trace(G_T_ACCESS, "g_dev_close(%s, %d, %d, %p)", cp->geom->name, flags, fmt, td); @@ -477,7 +481,7 @@ g_dev_close(struct cdev *dev, int flags, int fmt, stru if (r + w + e == 0) return (EINVAL); - sc = cp->private; + sc = dev->si_drv1; mtx_lock(&sc->sc_mtx); sc->sc_open += r + w + e; if (sc->sc_open == 0) @@ -797,7 +801,6 @@ g_dev_strategy(struct bio *bp) ("Wrong bio_cmd bio=%p cmd=%d", bp, bp->bio_cmd)); dev = bp->bio_dev; cp = dev->si_drv2; - sc = cp->private; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_strategy")); biotrack(bp, __func__); @@ -809,6 +812,7 @@ g_dev_strategy(struct bio *bp) return; } #endif + sc = dev->si_drv1; KASSERT(sc->sc_open > 0, ("Closed device in g_dev_strategy")); atomic_add_int(&sc->sc_active, 1); From owner-svn-src-all@freebsd.org Thu Dec 5 04:18:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B0D41B9D78; Thu, 5 Dec 2019 04:18:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47T2Wz1pmKz3FXD; Thu, 5 Dec 2019 04:18:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 217A1B2BD; Thu, 5 Dec 2019 04:18:23 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB54INeX057626; Thu, 5 Dec 2019 04:18:23 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB54INio057625; Thu, 5 Dec 2019 04:18:23 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912050418.xB54INio057625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 5 Dec 2019 04:18:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355411 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 355411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 04:18:23 -0000 Author: ian Date: Thu Dec 5 04:18:22 2019 New Revision: 355411 URL: https://svnweb.freebsd.org/changeset/base/355411 Log: Fix a trivial typo and add a missing word. Modified: head/share/man/man7/arch.7 Modified: head/share/man/man7/arch.7 ============================================================================== --- head/share/man/man7/arch.7 Thu Dec 5 04:03:08 2019 (r355410) +++ head/share/man/man7/arch.7 Thu Dec 5 04:18:22 2019 (r355411) @@ -145,7 +145,7 @@ symbol when compiling for an .Dv LP64 ABI. .Pp -Some machines support more that one +Some machines support more than one .Fx ABI. Typically these are 64-bit machines, where the @@ -154,7 +154,7 @@ Typically these are 64-bit machines, where the execution environment is accompanied by the .Dq legacy .Dv ILP32 -environment, which was historical 32-bit predecessor for 64-bit evolution. +environment, which was the historical 32-bit predecessor for 64-bit evolution. Examples are: .Bl -column -offset indent "Dv powerpc64" "Sy ILP32 counterpart" .It Sy LP64 Ta Sy ILP32 counterpart From owner-svn-src-all@freebsd.org Thu Dec 5 04:52:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC7631BAB1A; Thu, 5 Dec 2019 04:52:20 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47T3H84Dsdz3Gx4; Thu, 5 Dec 2019 04:52:20 +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 74D7BB9B6; Thu, 5 Dec 2019 04:52:20 +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 xB54qKw5080127; Thu, 5 Dec 2019 04:52:20 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB54qKV0080126; Thu, 5 Dec 2019 04:52:20 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912050452.xB54qKV0080126@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 5 Dec 2019 04:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355412 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 04:52:20 -0000 Author: mav Date: Thu Dec 5 04:52:19 2019 New Revision: 355412 URL: https://svnweb.freebsd.org/changeset/base/355412 Log: Wrap g_trace() into a macro to avoid unneeded calls. In most cases with debug disabled this function does nothing, but argument passing and the call still cost measurable time due to cache misses, etc. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom.h head/sys/geom/geom_dump.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom.h Thu Dec 5 04:52:19 2019 (r355412) @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ -void g_trace(int level, const char *, ...); +void (g_trace)(int level, const char *, ...) __printflike(2, 3); # define G_T_TOPOLOGY 1 # define G_T_BIO 2 # define G_T_ACCESS 4 - +extern int g_debugflags; +#define g_trace(level, fmt, ...) do { \ + if (__predict_false(g_debugflags & (level))) \ + (g_trace)(level, fmt, ## __VA_ARGS__); \ +} while (0) /* geom_event.c */ typedef void g_event_t(void *, int flag); Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 (r355412) @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) } void -g_trace(int level, const char *fmt, ...) +(g_trace)(int level, const char *fmt, ...) { va_list ap; From owner-svn-src-all@freebsd.org Thu Dec 5 05:01:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55D181BAD3B; Thu, 5 Dec 2019 05:01:09 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47T3TK1YKlz3HB5; Thu, 5 Dec 2019 05:01:09 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [172.17.133.228] (unknown [12.202.168.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 9B998EEF3; Thu, 5 Dec 2019 05:01:08 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/10.1f.0.191110 Date: Wed, 04 Dec 2019 21:00:59 -0800 Subject: Re: svn commit: r355412 - head/sys/geom From: Ravi Pokala To: Alexander Motin , , , Message-ID: <516874DA-E57F-4EAA-852B-1129A95BB998@panasas.com> Thread-Topic: svn commit: r355412 - head/sys/geom References: <201912050452.xB54qKV0080126@repo.freebsd.org> In-Reply-To: <201912050452.xB54qKV0080126@repo.freebsd.org> Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:01:09 -0000 -----Original Message----- From: on behalf of Alexander Motin Date: 2019-12-04, Wednesday at 20:52 To: , , Subject: svn commit: r355412 - head/sys/geom Author: mav Date: Thu Dec 5 04:52:19 2019 New Revision: 355412 URL: https://svnweb.freebsd.org/changeset/base/355412 Log: Wrap g_trace() into a macro to avoid unneeded calls. In most cases with debug disabled this function does nothing, but argument passing and the call still cost measurable time due to cache misses, etc. Hi Alexander, I'm having trouble understanding this change, on a few levels. - Why did you add parentheses around the function declaration and definition? - How can that function with that name co-exist with a macro of the same name? - Isn't the "g_debugflags" test in geom_dump.c:g_trace() now redundant? - Why not simply convert geom_dump.c:g_trace() into a 'static inline' in geom.h, and not have to bother with the macro at all? What am I missing? Thanks, Ravi (rpokala@) MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/geom/geom.h head/sys/geom/geom_dump.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom.h Thu Dec 5 04:52:19 2019 (r355412) @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); struct g_provider *g_dev_getprovider(struct cdev *dev); /* geom_dump.c */ -void g_trace(int level, const char *, ...); +void (g_trace)(int level, const char *, ...) __printflike(2, 3); # define G_T_TOPOLOGY 1 # define G_T_BIO 2 # define G_T_ACCESS 4 - +extern int g_debugflags; +#define g_trace(level, fmt, ...) do { \ + if (__predict_false(g_debugflags & (level))) \ + (g_trace)(level, fmt, ## __VA_ARGS__); \ +} while (0) /* geom_event.c */ typedef void g_event_t(void *, int flag); Modified: head/sys/geom/geom_dump.c ============================================================================== --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 (r355411) +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 (r355412) @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) } void -g_trace(int level, const char *fmt, ...) +(g_trace)(int level, const char *fmt, ...) { va_list ap; From owner-svn-src-all@freebsd.org Thu Dec 5 05:12:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9F8B1BB25B for ; Thu, 5 Dec 2019 05:12:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x729.google.com (mail-qk1-x729.google.com [IPv6:2607:f8b0:4864:20::729]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47T3kG5fG2z3Hm2 for ; Thu, 5 Dec 2019 05:12:22 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x729.google.com with SMTP id g15so2273339qka.8 for ; Wed, 04 Dec 2019 21:12:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FYE6jgn220PgnWFqFCDDol6fLcuWOSslpaEJMS3pmhE=; b=jnj6PGx1Ukym/tCVHzzKCxFSRcby8anXZpuE+jTfZdm4vk3gzp/JQUCMST2+Y8KBaF 8v6G3K3wW0K1DnfZj0AdYwDK6WkipZZfMgEoR8G+z9i242I//c1SsXcI9OsQ0Ruy38kj ymC4Y80dyflTC8AjDqMZXmzf7g8gYmVfkNUafvBR7cK5vcI8QmA/0NSP+zgsJ823bUu3 LaFD74K49nTIi7mlp22zcmZxyn8A0HF5C6w6wUEBdPdannOMjp/qBwFCzsp34EZPlS6f uWDuN43Zc0lyGTrICzdGDNwopfUx/ooYDIchdpHEcieRk0Bu305HZ8iSfkvGRde1CSUM remw== 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=FYE6jgn220PgnWFqFCDDol6fLcuWOSslpaEJMS3pmhE=; b=mrLuBkjhBIK6ff+zre/tbJwd2Ggs+UztElmSRsv8SQ0DGVlKLkEVfI4ZXWrjiMTaei AkGFillmNe//UXfGAgOhHYLIOsUsrHoGWDDRZF8jDkhflhyDz0WsOTt9fIpsS9CjDlN6 AwpEyd7HeX/F3sA274ripAsKqMx0IJAbzY+YMMwoDWvGrnL0xE5lqAFFkFUzgEDudKdc 0SAoyMU7C5gItQ5mKB2iAPeyixF7zxMsE7/tUjCVZsN/W9GDi+KmPYoe547L+bDYRrTX l57FPLtfHJ6OxmIHY38mqpEr/7zWUs1SRYM8ALt4KL5RRPDY9fF3xx/3jkftjgl/xcpv ETKA== X-Gm-Message-State: APjAAAUen+k/3PIew+8RSi7B5aVo/PvBhx+9ooqP/igjvIuG/874Yn3F 24gDp4wkOKCft9KPq08WvF4Ts9BiFsOlzR20vCwNog== X-Google-Smtp-Source: APXvYqyuVRw/BC49GpMcgSJB+ajSny4oZFUtJ+rL8u8Mx2rsmt38Xob1zeT88xgZoWLFY73v4ZVRstgNp+RXh5oN6ws= X-Received: by 2002:a37:b0c5:: with SMTP id z188mr119802qke.215.1575522740851; Wed, 04 Dec 2019 21:12:20 -0800 (PST) MIME-Version: 1.0 References: <201912050452.xB54qKV0080126@repo.freebsd.org> <516874DA-E57F-4EAA-852B-1129A95BB998@panasas.com> In-Reply-To: <516874DA-E57F-4EAA-852B-1129A95BB998@panasas.com> From: Warner Losh Date: Wed, 4 Dec 2019 22:12:09 -0700 Message-ID: Subject: Re: svn commit: r355412 - head/sys/geom To: Ravi Pokala Cc: Alexander Motin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 47T3kG5fG2z3Hm2 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=jnj6PGx1; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::729) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.68 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[9.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.68)[ip: (-9.20), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:12:23 -0000 On Wed, Dec 4, 2019, 10:01 PM Ravi Pokala wrote: > -----Original Message----- > From: on behalf of Alexander Motin > > Date: 2019-12-04, Wednesday at 20:52 > To: , , < > svn-src-head@freebsd.org> > Subject: svn commit: r355412 - head/sys/geom > > Author: mav > Date: Thu Dec 5 04:52:19 2019 > New Revision: 355412 > URL: https://svnweb.freebsd.org/changeset/base/355412 > > Log: > Wrap g_trace() into a macro to avoid unneeded calls. > > In most cases with debug disabled this function does nothing, but > argument > passing and the call still cost measurable time due to cache misses, > etc. > > Hi Alexander, > > I'm having trouble understanding this change, on a few levels. > > - Why did you add parentheses around the function declaration and > definition? > To prevent macro expansion. - How can that function with that name co-exist with a macro of the same > name? > See above. - Isn't the "g_debugflags" test in geom_dump.c:g_trace() now redundant? > I think so... - Why not simply convert geom_dump.c:g_trace() into a 'static inline' in > geom.h, and not have to bother with the macro at all? > I'd have done that :) you wouldn't have that weird (corner) of the language exposed... but the static inline might have been bigger... Warner What am I missing? > > Thanks, > > Ravi (rpokala@) > > MFC after: 2 weeks > Sponsored by: iXsystems, Inc. > > Modified: > head/sys/geom/geom.h > head/sys/geom/geom_dump.c > > Modified: head/sys/geom/geom.h > > ============================================================================== > --- head/sys/geom/geom.h Thu Dec 5 04:18:22 2019 (r355411) > +++ head/sys/geom/geom.h Thu Dec 5 04:52:19 2019 (r355412) > @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); > struct g_provider *g_dev_getprovider(struct cdev *dev); > > /* geom_dump.c */ > -void g_trace(int level, const char *, ...); > +void (g_trace)(int level, const char *, ...) __printflike(2, 3); > # define G_T_TOPOLOGY 1 > # define G_T_BIO 2 > # define G_T_ACCESS 4 > - > +extern int g_debugflags; > +#define g_trace(level, fmt, ...) do { \ > + if (__predict_false(g_debugflags & (level))) \ > + (g_trace)(level, fmt, ## __VA_ARGS__); \ > +} while (0) > > /* geom_event.c */ > typedef void g_event_t(void *, int flag); > > Modified: head/sys/geom/geom_dump.c > > ============================================================================== > --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 > (r355411) > +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 > (r355412) > @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) > } > > void > -g_trace(int level, const char *fmt, ...) > +(g_trace)(int level, const char *fmt, ...) > { > va_list ap; > > > > > From owner-svn-src-all@freebsd.org Thu Dec 5 05:14:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 476C81BB362; Thu, 5 Dec 2019 05:14:36 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47T3mq42Jkz3HwG; Thu, 5 Dec 2019 05:14:35 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-oi1-x243.google.com with SMTP id d62so1576838oia.11; Wed, 04 Dec 2019 21:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=rlw7p8qkRt5wBWHEcyYEFFwmnn6ESdty/bftfJIK8BU=; b=qduouTzWDw4Mt/KqP8cTxy4SO6y0ef5wbAak56nUYnY0F6vWmbUPUi3zH5V9VmKV1F ivgYtd3HtXqPr47jeFlnaVUpUhqGw7F2u2T0rZB6cAhy3UBrF/78qTVyKGahz+SZACav JJWq2dzAbzF7LB3MRob8k0x2+m0Ytyxcb7AAu7Q0de+FHsD0vtkMn9tbyM9GHT6YEQhl ogp/CFbvpHdxFqSH1UqOA0v74FyNQ/i9qXkd3NQPi89ge/HRjDg1EQyL5N8yAYES2rbT jhkeyPgUZ7dwh23IAZ2iat2wsrWJgsZ2uReMfLll7BkjGw28fZwcb2/U81q04P7yB5HP rmmw== 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:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=rlw7p8qkRt5wBWHEcyYEFFwmnn6ESdty/bftfJIK8BU=; b=YEg4rdj2JlcMaQ0h8bVdCk/Q9JuKciKqCW6dPsevjxwXWewoQw2obcP/zdACBqW03W MFRt8inZBK9HiDahLtWTm442L10axssZlNRr01LpX9VbergJNBIp4hvcg9RCqmxWqOi5 r6063vidROiSVnHUSCDnczDfntVL84LQSKUzDuLdjugsRBKHYaoZfKzA4RdpcXUTsuCA nlqjwu9r9fQ83kTOVUsF8ZR8mBkkTfjIZB9lgfVqg48PGcuyHG9yV7VAe3UvwKFqQ9Zb SXytXY25McEswfIZNLOIKgqYX7x2XOhbFiqXhlLBcVBDtaQeOPM89kAFb6J1D9dkKG1p MqTA== X-Gm-Message-State: APjAAAWG3t2/P39kyoXfXkbyivha7tDHsCH0op48U+F9b81Y/iSh4Ut3 Es5j19k+cTN4yyb+fqOd4BFpOEo0 X-Google-Smtp-Source: APXvYqzhHXX5v20XVhMR7aqR8GsLm4Lzxp9nt63hMdPNJgJk7MAYh8QBEjVuR79GQaswcGTZwtMypg== X-Received: by 2002:aca:31c8:: with SMTP id x191mr5639022oix.25.1575522873122; Wed, 04 Dec 2019 21:14:33 -0800 (PST) Received: from spectre.mavhome.dp.ua ([2600:1700:3580:3560:228:f8ff:fe04:d12]) by smtp.gmail.com with ESMTPSA id r124sm3244641oie.9.2019.12.04.21.14.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Dec 2019 21:14:32 -0800 (PST) Sender: Alexander Motin Subject: Re: svn commit: r355412 - head/sys/geom To: Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912050452.xB54qKV0080126@repo.freebsd.org> <516874DA-E57F-4EAA-852B-1129A95BB998@panasas.com> 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: <3e7a9cfe-46c6-73bd-3bd8-3e3c5daf52b9@FreeBSD.org> Date: Thu, 5 Dec 2019 00:14:31 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.0 MIME-Version: 1.0 In-Reply-To: <516874DA-E57F-4EAA-852B-1129A95BB998@panasas.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47T3mq42Jkz3HwG X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=qduouTzW; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::243 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-2.56 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.36)[ip: (2.42), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.4.2.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; 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]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:14:36 -0000 Hi. On 05.12.2019 00:00, Ravi Pokala wrote: > -----Original Message----- > From: on behalf of Alexander Motin > Date: 2019-12-04, Wednesday at 20:52 > To: , , > Subject: svn commit: r355412 - head/sys/geom > > Author: mav > Date: Thu Dec 5 04:52:19 2019 > New Revision: 355412 > URL: https://svnweb.freebsd.org/changeset/base/355412 > > Log: > Wrap g_trace() into a macro to avoid unneeded calls. > > In most cases with debug disabled this function does nothing, but argument > passing and the call still cost measurable time due to cache misses, etc. > > Hi Alexander, > > I'm having trouble understanding this change, on a few levels. > > - Why did you add parentheses around the function declaration and definition? To make pre-processor not replace them also. > - How can that function with that name co-exist with a macro of the same name? The macro is handled first by pre-processor, compiler goes second on the result. > - Isn't the "g_debugflags" test in geom_dump.c:g_trace() now redundant? > - Why not simply convert geom_dump.c:g_trace() into a 'static inline' in geom.h, and not have to bother with the macro at all? One answer to both questions: compatibility with already built modules require the function to be present and behave same as before, while newly built code should be more efficient without changes. > What am I missing? > > Thanks, > > Ravi (rpokala@) > > MFC after: 2 weeks > Sponsored by: iXsystems, Inc. > > Modified: > head/sys/geom/geom.h > head/sys/geom/geom_dump.c > > Modified: head/sys/geom/geom.h > ============================================================================== > --- head/sys/geom/geom.h Thu Dec 5 04:18:22 2019 (r355411) > +++ head/sys/geom/geom.h Thu Dec 5 04:52:19 2019 (r355412) > @@ -255,11 +255,15 @@ void g_dev_physpath_changed(void); > struct g_provider *g_dev_getprovider(struct cdev *dev); > > /* geom_dump.c */ > -void g_trace(int level, const char *, ...); > +void (g_trace)(int level, const char *, ...) __printflike(2, 3); > # define G_T_TOPOLOGY 1 > # define G_T_BIO 2 > # define G_T_ACCESS 4 > - > +extern int g_debugflags; > +#define g_trace(level, fmt, ...) do { \ > + if (__predict_false(g_debugflags & (level))) \ > + (g_trace)(level, fmt, ## __VA_ARGS__); \ > +} while (0) > > /* geom_event.c */ > typedef void g_event_t(void *, int flag); > > Modified: head/sys/geom/geom_dump.c > ============================================================================== > --- head/sys/geom/geom_dump.c Thu Dec 5 04:18:22 2019 (r355411) > +++ head/sys/geom/geom_dump.c Thu Dec 5 04:52:19 2019 (r355412) > @@ -319,7 +319,7 @@ g_confxml(void *p, int flag) > } > > void > -g_trace(int level, const char *fmt, ...) > +(g_trace)(int level, const char *fmt, ...) > { > va_list ap; -- Alexander Motin From owner-svn-src-all@freebsd.org Thu Dec 5 05:24:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7145E1BB76A; Thu, 5 Dec 2019 05:24:32 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47T40H1dxTz3JLk; Thu, 5 Dec 2019 05:24:30 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB55ORmj042421; Wed, 4 Dec 2019 21:24:27 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB55ORHH042420; Wed, 4 Dec 2019 21:24:27 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912050524.xB55ORHH042420@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355330 - head/share/man/man9 In-Reply-To: <201912031548.xB3FmSDs054775@repo.freebsd.org> To: Warner Losh Date: Wed, 4 Dec 2019 21:24:27 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47T40H1dxTz3JLk X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.36 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.44)[-0.437,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.14)[-0.140,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; TO_DN_SOME(0.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; AUTH_NA(1.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:24:32 -0000 > Author: imp > Date: Tue Dec 3 15:48:28 2019 > New Revision: 355330 > URL: https://svnweb.freebsd.org/changeset/base/355330 > > Log: > Regularize copyright notices for me. > > Remove stray All Rights Reserved and other non-license stuff. Make sure all > copyrights have year. Thank you! -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Dec 5 05:28:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1041B1BB96E; Thu, 5 Dec 2019 05:28:20 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47T44g0m3Cz3JW9; Thu, 5 Dec 2019 05:28:18 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB55SG3Y042438; Wed, 4 Dec 2019 21:28:16 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB55SG9C042437; Wed, 4 Dec 2019 21:28:16 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912050528.xB55SG9C042437@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355362 - in stable/12: share/man/man4 sys/dev/imcsmb sys/dev/jedec_dimm In-Reply-To: <201912032249.xB3MnOWT004438@repo.freebsd.org> To: Ravi Pokala Date: Wed, 4 Dec 2019 21:28:16 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47T44g0m3Cz3JW9 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.55 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.40)[-0.397,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; NEURAL_SPAM_LONG(0.01)[0.012,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:28:20 -0000 > Author: rpokala > Date: Tue Dec 3 22:49:24 2019 > New Revision: 355362 > URL: https://svnweb.freebsd.org/changeset/base/355362 > > Log: > MFC r343583: > > Remove unecessary "All rights reserved" from files under my or Panasas's > copyright. > > When all member nations of the Buenos Aires Convention adopted the Berne > Convention, the phrase "All rights reserved" became unnecessary to assert > copyright. Remove it from files under my or Panasas's copyright. The files > related to jedec_dimm(4) also bear avg@'s copyright; he has approved this > change. Thank you! -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Dec 5 05:35:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 86C751BBD98; Thu, 5 Dec 2019 05:35:29 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47T4Dw5cPMz3Jw7; Thu, 5 Dec 2019 05:35:28 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB55ZQuL042494; Wed, 4 Dec 2019 21:35:26 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB55ZQxt042493; Wed, 4 Dec 2019 21:35:26 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912050535.xB55ZQxt042493@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve In-Reply-To: To: Vincenzo Maffione Date: Wed, 4 Dec 2019 21:35:26 -0800 (PST) CC: John Baldwin , Ian Lepore , Rodney Grimes , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47T4Dw5cPMz3Jw7 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.73 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.34)[-0.342,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; NEURAL_SPAM_LONG(0.13)[0.133,0]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:35:29 -0000 > I see, thanks for the pointers. > It looks like cfmakeraw() and tcsetattr() were what I was looking for. > A bhyve-specific printf wrapper looks the right solution to me. > I can try to sketch a patch for you guys to review, if that's useful. > > Cheers, > Vincenzo Meanwhile could you please revert the commit, and add a note to D22552 to the effects that this was not the right solution? Thanks, Rod > Il giorno mar 3 dic 2019 alle ore 18:38 John Baldwin ha > scritto: > > > On 12/3/19 7:14 AM, Ian Lepore wrote: > > > On Mon, 2019-12-02 at 23:22 -0800, Rodney W. Grimes wrote: > > >>> On Mon, 2019-12-02 at 20:51 +0000, Vincenzo Maffione wrote: > > >>>> Author: vmaffione > > >>>> Date: Mon Dec 2 20:51:46 2019 > > >>>> New Revision: 355301 > > >>>> URL: https://svnweb.freebsd.org/changeset/base/355301 > > >>>> > > >>>> Log: > > >>>> bhyve: uniform printf format string newlines > > >>>> > > >>>> Some of the printf statements only use LF to get a newline. > > >>>> However, a CR character is also required for the serial console to > > >>>> print debug logs in a nice way. > > >>>> Fix those code locations that only use LF, by adding a CR > > >>>> character. > > >>>> > > >>>> Reviewed by: markj, aleksandr.fedorov@itglobal.com > > >>>> MFC after: 1 week > > >>>> Differential Revision: https://reviews.freebsd.org/D22552 > > >>>> > > >>>> Modified: > > >>>> head/usr.sbin/bhyve/audio.c > > >>>> head/usr.sbin/bhyve/hda_codec.c > > >>>> head/usr.sbin/bhyve/net_backends.c > > >>>> head/usr.sbin/bhyve/pci_ahci.c > > >>>> head/usr.sbin/bhyve/pci_e82545.c > > >>>> head/usr.sbin/bhyve/pci_hda.c > > >>>> head/usr.sbin/bhyve/pci_nvme.c > > >>>> head/usr.sbin/bhyve/pci_virtio_block.c > > >>>> head/usr.sbin/bhyve/pci_virtio_console.c > > >>>> head/usr.sbin/bhyve/pci_virtio_net.c > > >>>> head/usr.sbin/bhyve/pci_virtio_rnd.c > > >>>> head/usr.sbin/bhyve/pci_virtio_scsi.c > > >>>> head/usr.sbin/bhyve/pci_xhci.c > > >>>> head/usr.sbin/bhyve/rfb.c > > >>>> > > >>> > > >>> These changes seem wrong in a couple ways... > > >>> > > >>> - Lines are terminated by linefeeds in unix-like systems. If > > >>> linefeeds need to be translated to include carriage returns, that's the > > >>> responsibility of the terminal/line-discipline layer, not the source > > >>> strings being printed. > > >> > > >> Fully agree, this change seems wrong to me for Ian's stated reason here. > > >> > > >>> > > >>> - The sequence \n\r is very strange. For systems that do prefer > > >>> carriage returns, the \r always comes before the \n (or stands alone on > > >>> Mac systems), not after. > > >>> > > >>> I have a feeling that the root of this is something like "lots of > > >>> people use bhyve for Windows, so they use Windows apps to look at logs, > > >>> so the logs should be formatted for Windows." If that's the reasoning, > > >>> then why shouldn't we convert EVERY printf in the source base to > > >>> include carriage returns, just in case a windows user wants to browse a > > >>> log file? > > >> > > >> This is not that issue, it is something going on with the line > > >> discipline when using the bhyve console device. I believe the > > >> line displine being different from what bhyve itself is expecting > > >> so when console output is intermixed with output from bhyve itself > > >> things go wrong. > > >> > > >> The printf's in this patch are coming from the bhyve process that > > >> has a fd open to the launching tty, the line discipline on that tty > > >> is changed to something different after you open the > > >> console device from that same controlling tty, or that is my hypothosis > > >> on what is going wrong. > > > > > > There is a cfmakeraw() call in usr.sbin/bhyve/consport.c; that would > > > definitely turn off nl->crnl translations. I think that is the other > > > end of the bhyve console that I posted a patch for yesterday, and I > > > think the console driver is probably still the right place to do that > > > translation (because other console drivers do it that way). But I'm > > > not set up to run bhyve here, so I can't test my theory. > > > > That patch won't work alone. Most people don't use bvmcons, most people > > running bhyve use a standard uart as the console (bvmcons was an early > > console devices before bhyve had a ns8250 uart device model). When using > > the uart as the device model you still have raw output in the bhyve > > process itself. (See cfmakeraw() in uart_emul.c as well). We don't > > get to change how guest OS's use a uart, so any changes have to be in > > usr.sbin/bhyve, not in sys/. > > > > However, to do that you have to actually do something more complicated to > > turn \r\n and \n\r sequences from the guest into plain \n to stdout while > > still DTRT for "bare" \r and \n characters. You also have to make sure > > you do the right thing for input and not just output in the device models. > > > > I'm not quite a fan of this commit as-is since you will get spurious new > > lines now if you don't use a serial console. I would perhaps rather have > > a custom printf() wrapper in bhyve that outputs the \r as needed for > > debug and error printfs only when stdio has been changed to be raw. I > > was busy with family stuff and thanksgiving last week so didn't have time > > to review it before it was committed unfortunately. > > > > -- > > John Baldwin > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Dec 5 05:52:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0DE01BC5B0; Thu, 5 Dec 2019 05:52:01 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47T4c11mmkz3KY7; Thu, 5 Dec 2019 05:52:00 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB55pxjJ042574; Wed, 4 Dec 2019 21:51:59 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB55pxjG042573; Wed, 4 Dec 2019 21:51:59 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912050551.xB55pxjG042573@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355382 - head/sys/dev/pci In-Reply-To: <201912040803.xB483XH3035514@repo.freebsd.org> To: Stefan Esser Date: Wed, 4 Dec 2019 21:51:59 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47T4c11mmkz3KY7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-0.99)[-0.994,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 05:52:01 -0000 > Author: se > Date: Wed Dec 4 08:03:33 2019 > New Revision: 355382 > URL: https://svnweb.freebsd.org/changeset/base/355382 > > Log: > Remove "All rights reserved" phrase from copyright notes. > > With the ratification of the Berne Convention in 2000, it became obsolete. > > I have removed that phrase and the "(c)" only from files without copyright > claims by other parties. There are 2 files (pci.c, pci_private.h) that are > also claimed by Michael Smith and by BSDi, which have > therefore not been included in this commit. > > When all member nations of the Buenos Aires Convention adopted the Berne > Convention, the phrase "All rights reserved" became unnecessary to assert > copyright. Remove it from files under my copyright. > > There are 2 files (pci.c, pci_private.h) that) that do also bear msmith's > and BSDi's copyright. I have left them unchanged for now, since I do not > know whether they (or the legal successor in case of BSDi) would agree. Picking one last one at random. I am not who or why this effort to clean up the All Rights Reserved strings got started, but I am very glad to see it happening. To all who have or shall do this a big THANK You. Regards, Rod > Modified: > head/sys/dev/pci/hostb_pci.c > head/sys/dev/pci/pci_user.c > head/sys/dev/pci/pcireg.h > head/sys/dev/pci/pcivar.h > > Modified: head/sys/dev/pci/hostb_pci.c > ============================================================================== > --- head/sys/dev/pci/hostb_pci.c Wed Dec 4 04:01:53 2019 (r355381) > +++ head/sys/dev/pci/hostb_pci.c Wed Dec 4 08:03:33 2019 (r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > > Modified: head/sys/dev/pci/pci_user.c > ============================================================================== > --- head/sys/dev/pci/pci_user.c Wed Dec 4 04:01:53 2019 (r355381) > +++ head/sys/dev/pci/pci_user.c Wed Dec 4 08:03:33 2019 (r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > > Modified: head/sys/dev/pci/pcireg.h > ============================================================================== > --- head/sys/dev/pci/pcireg.h Wed Dec 4 04:01:53 2019 (r355381) > +++ head/sys/dev/pci/pcireg.h Wed Dec 4 08:03:33 2019 (r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > > Modified: head/sys/dev/pci/pcivar.h > ============================================================================== > --- head/sys/dev/pci/pcivar.h Wed Dec 4 04:01:53 2019 (r355381) > +++ head/sys/dev/pci/pcivar.h Wed Dec 4 08:03:33 2019 (r355382) > @@ -1,8 +1,7 @@ > /*- > * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > * > - * Copyright (c) 1997, Stefan Esser > - * All rights reserved. > + * Copyright 1997, Stefan Esser > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Dec 5 13:20:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CE4F1C9682; Thu, 5 Dec 2019 13:20:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TGYL4Qqjz4BcC; Thu, 5 Dec 2019 13:20:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BBF3196E6; Thu, 5 Dec 2019 13:20:22 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5DKMXx073661; Thu, 5 Dec 2019 13:20:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5DKFok073626; Thu, 5 Dec 2019 13:20:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912051320.xB5DKFok073626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 5 Dec 2019 13:20:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355413 - in head: contrib/elftoolchain contrib/elftoolchain/addr2line contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/elfdump contrib/elftoolchain/libdwar... X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head: contrib/elftoolchain contrib/elftoolchain/addr2line contrib/elftoolchain/common contrib/elftoolchain/elfcopy contrib/elftoolchain/elfdump contrib/elftoolchain/libdwarf contrib/elftoolchain/li... X-SVN-Commit-Revision: 355413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 13:20:22 -0000 Author: emaste Date: Thu Dec 5 13:20:15 2019 New Revision: 355413 URL: https://svnweb.freebsd.org/changeset/base/355413 Log: Update ELF Tool Chain to upstream r3769 This contains many small bugfixes and documentation improvements. Sponsored by: The FreeBSD Foundation Added: head/contrib/elftoolchain/.cirrus.yml - copied unchanged from r349544, vendor/elftoolchain/dist/.cirrus.yml head/contrib/elftoolchain/libelf/os.Linux.mk - copied unchanged from r349544, vendor/elftoolchain/dist/libelf/os.Linux.mk Modified: head/contrib/elftoolchain/README.rst head/contrib/elftoolchain/addr2line/addr2line.c head/contrib/elftoolchain/common/elfdefinitions.h head/contrib/elftoolchain/common/native-elf-format head/contrib/elftoolchain/elfcopy/ascii.c head/contrib/elftoolchain/elfcopy/binary.c head/contrib/elftoolchain/elfcopy/elfcopy.h head/contrib/elftoolchain/elfcopy/main.c head/contrib/elftoolchain/elfcopy/sections.c head/contrib/elftoolchain/elfdump/elfdump.c head/contrib/elftoolchain/libdwarf/dwarf.h head/contrib/elftoolchain/libdwarf/dwarf_dump.c head/contrib/elftoolchain/libdwarf/libdwarf_attr.c head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c head/contrib/elftoolchain/libelf/_libelf.h head/contrib/elftoolchain/libelf/_libelf_config.h head/contrib/elftoolchain/libelf/elf.3 head/contrib/elftoolchain/libelf/elf_data.c head/contrib/elftoolchain/libelf/elf_end.c head/contrib/elftoolchain/libelf/elf_flagdata.3 head/contrib/elftoolchain/libelf/elf_getdata.3 head/contrib/elftoolchain/libelf/elf_getident.c head/contrib/elftoolchain/libelf/elf_next.3 head/contrib/elftoolchain/libelf/elf_next.c head/contrib/elftoolchain/libelf/elf_open.3 head/contrib/elftoolchain/libelf/elf_rand.c head/contrib/elftoolchain/libelf/elf_rawfile.c head/contrib/elftoolchain/libelf/elf_scn.c head/contrib/elftoolchain/libelf/elf_update.3 head/contrib/elftoolchain/libelf/elf_update.c head/contrib/elftoolchain/libelf/gelf.3 head/contrib/elftoolchain/libelf/gelf_cap.c head/contrib/elftoolchain/libelf/gelf_dyn.c head/contrib/elftoolchain/libelf/gelf_getcap.3 head/contrib/elftoolchain/libelf/gelf_getdyn.3 head/contrib/elftoolchain/libelf/gelf_getmove.3 head/contrib/elftoolchain/libelf/gelf_getrel.3 head/contrib/elftoolchain/libelf/gelf_getrela.3 head/contrib/elftoolchain/libelf/gelf_getsym.3 head/contrib/elftoolchain/libelf/gelf_getsyminfo.3 head/contrib/elftoolchain/libelf/gelf_getsymshndx.3 head/contrib/elftoolchain/libelf/gelf_move.c head/contrib/elftoolchain/libelf/gelf_newehdr.3 head/contrib/elftoolchain/libelf/gelf_newphdr.3 head/contrib/elftoolchain/libelf/gelf_rel.c head/contrib/elftoolchain/libelf/gelf_rela.c head/contrib/elftoolchain/libelf/gelf_sym.c head/contrib/elftoolchain/libelf/gelf_syminfo.c head/contrib/elftoolchain/libelf/gelf_symshndx.c head/contrib/elftoolchain/libelf/libelf_allocate.c head/contrib/elftoolchain/libelf/libelf_ar.c head/contrib/elftoolchain/libelf/libelf_convert.m4 head/contrib/elftoolchain/libelf/libelf_data.c head/contrib/elftoolchain/libelf/libelf_ehdr.c head/contrib/elftoolchain/libelf/libelf_extended.c head/contrib/elftoolchain/libelf/libelf_memory.c head/contrib/elftoolchain/libelf/libelf_msize.m4 head/contrib/elftoolchain/libelf/libelf_phdr.c head/contrib/elftoolchain/libelf/libelf_xlate.c head/contrib/elftoolchain/libelftc/elftc_bfd_find_target.3 head/contrib/elftoolchain/libelftc/elftc_string_table.c head/contrib/elftoolchain/libelftc/elftc_string_table_create.3 head/contrib/elftoolchain/libelftc/libelftc.h head/contrib/elftoolchain/libelftc/libelftc_bfdtarget.c head/contrib/elftoolchain/libelftc/make-toolchain-version head/contrib/elftoolchain/nm/nm.c head/contrib/elftoolchain/readelf/readelf.1 head/contrib/elftoolchain/readelf/readelf.c head/lib/libelftc/elftc_version.c Directory Properties: head/contrib/elftoolchain/ (props changed) head/contrib/elftoolchain/elfdump/ (props changed) Copied: head/contrib/elftoolchain/.cirrus.yml (from r349544, vendor/elftoolchain/dist/.cirrus.yml) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/elftoolchain/.cirrus.yml Thu Dec 5 13:20:15 2019 (r355413, copy of r349544, vendor/elftoolchain/dist/.cirrus.yml) @@ -0,0 +1,22 @@ +freebsd_11_task: + freebsd_instance: + image: freebsd-11-2-release-amd64 + install_script: pkg install -y git py27-yaml + script: + - fetch http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz + - tar -x -C test/tet -f tet3.8-src.tar.gz + - make + +debian_stable_task: + container: + image: debian:stable + setup_script: + - apt-get update + - apt-get install -y + binutils bison bmake curl flex g++ gcc git + libarchive-dev libbsd-dev libc6-dev libexpat1-dev lsb-release + m4 perl python-yaml sharutils zlib1g-dev + script: + - curl -O http://tetworks.opengroup.org/downloads/38/software/Sources/3.8/tet3.8-src.tar.gz + - tar -x -C test/tet -z -f tet3.8-src.tar.gz + - bmake Modified: head/contrib/elftoolchain/README.rst ============================================================================== --- head/contrib/elftoolchain/README.rst Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/README.rst Thu Dec 5 13:20:15 2019 (r355413) @@ -62,12 +62,12 @@ The project uses subversion_ for its version control s The subversion branch for the current set of sources may be accessed at the following URL:: - https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain/trunk + https://sourceforge.net/p/elftoolchain/code/HEAD/tree/trunk/ The project's source tree may be checked out from its repository by using the ``svn checkout`` command:: - % svn checkout https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain/trunk + % svn checkout https://svn.code.sf.net/p/elftoolchain/code/trunk Checked-out sources may be kept upto-date by running ``svn update`` inside the source directory:: @@ -105,10 +105,10 @@ The project's developers may be contacted using the ma Reporting Bugs -------------- -Please use our `Trac instance`_ for viewing existing bug reports and +Please use our `bug tracker`_ for viewing existing bug reports and for submitting new bug reports. -.. _`Trac instance`: http://sourceforge.net/apps/trac/elftoolchain/report +.. _`bug tracker`: https://sourceforge.net/p/elftoolchain/tickets/ Additional Information @@ -119,7 +119,7 @@ website`_. .. _project website: http://elftoolchain.sourceforge.net/ -.. $Id: README.rst 3656 2018-12-26 09:46:24Z jkoshy $ +.. $Id: README.rst 3677 2019-02-11 09:37:09Z jkoshy $ .. Local Variables: .. mode: rst Modified: head/contrib/elftoolchain/addr2line/addr2line.c ============================================================================== --- head/contrib/elftoolchain/addr2line/addr2line.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/addr2line/addr2line.c Thu Dec 5 13:20:15 2019 (r355413) @@ -42,7 +42,7 @@ #include "uthash.h" #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3544 2017-06-05 14:51:44Z emaste $"); +ELFTC_VCSID("$Id: addr2line.c 3499 2016-11-25 16:06:29Z emaste $"); struct Func { char *name; Modified: head/contrib/elftoolchain/common/elfdefinitions.h ============================================================================== --- head/contrib/elftoolchain/common/elfdefinitions.h Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/common/elfdefinitions.h Thu Dec 5 13:20:15 2019 (r355413) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfdefinitions.h 3515 2017-01-24 22:04:22Z emaste $ + * $Id: elfdefinitions.h 3769 2019-06-29 15:15:02Z emaste $ */ /* @@ -72,7 +72,39 @@ _ELF_DEFINE_DF(DF_TEXTREL, 0x4, \ _ELF_DEFINE_DF(DF_BIND_NOW, 0x8, \ "process relocation entries at load time") \ _ELF_DEFINE_DF(DF_STATIC_TLS, 0x10, \ - "uses static thread-local storage") + "uses static thread-local storage") \ +_ELF_DEFINE_DF(DF_1_BIND_NOW, 0x1, \ + "process relocation entries at load time") \ +_ELF_DEFINE_DF(DF_1_GLOBAL, 0x2, \ + "unused") \ +_ELF_DEFINE_DF(DF_1_GROUP, 0x4, \ + "object is a member of a group") \ +_ELF_DEFINE_DF(DF_1_NODELETE, 0x8, \ + "object cannot be deleted from a process") \ +_ELF_DEFINE_DF(DF_1_LOADFLTR, 0x10, \ + "immediate load filtees") \ +_ELF_DEFINE_DF(DF_1_INITFIRST, 0x20, \ + "initialize object first") \ +_ELF_DEFINE_DF(DF_1_NOOPEN, 0x40, \ + "disallow dlopen()") \ +_ELF_DEFINE_DF(DF_1_ORIGIN, 0x80, \ + "object being loaded may refer to $ORIGIN") \ +_ELF_DEFINE_DF(DF_1_DIRECT, 0x100, \ + "direct bindings enabled") \ +_ELF_DEFINE_DF(DF_1_INTERPOSE, 0x400, \ + "object is interposer") \ +_ELF_DEFINE_DF(DF_1_NODEFLIB, 0x800, \ + "ignore default library search path") \ +_ELF_DEFINE_DF(DF_1_NODUMP, 0x1000, \ + "disallow dldump()") \ +_ELF_DEFINE_DF(DF_1_CONFALT, 0x2000, \ + "object is a configuration alternative") \ +_ELF_DEFINE_DF(DF_1_ENDFILTEE, 0x4000, \ + "filtee terminates filter search") \ +_ELF_DEFINE_DF(DF_1_DISPRELDNE, 0x8000, \ + "displacement relocation done") \ +_ELF_DEFINE_DF(DF_1_DISPRELPND, 0x10000, \ + "displacement relocation pending") #undef _ELF_DEFINE_DF #define _ELF_DEFINE_DF(N, V, DESCR) N = V , enum { @@ -2464,7 +2496,10 @@ _ELF_DEFINE_NT(NT_PSTATUS, 10, "Linux process status") _ELF_DEFINE_NT(NT_FPREGS, 12, "Linux floating point regset") \ _ELF_DEFINE_NT(NT_PSINFO, 13, "Linux process information") \ _ELF_DEFINE_NT(NT_LWPSTATUS, 16, "Linux lwpstatus_t type") \ -_ELF_DEFINE_NT(NT_LWPSINFO, 17, "Linux lwpinfo_t type") +_ELF_DEFINE_NT(NT_LWPSINFO, 17, "Linux lwpinfo_t type") \ +_ELF_DEFINE_NT(NT_FREEBSD_NOINIT_TAG, 2, "FreeBSD no .init tag") \ +_ELF_DEFINE_NT(NT_FREEBSD_ARCH_TAG, 3, "FreeBSD arch tag") \ +_ELF_DEFINE_NT(NT_FREEBSD_FEATURE_CTL, 4, "FreeBSD feature control") #undef _ELF_DEFINE_NT #define _ELF_DEFINE_NT(N, V, DESCR) N = V , @@ -2822,7 +2857,8 @@ typedef struct { #define ELF64_R_SYM(I) ((I) >> 32) #define ELF64_R_TYPE(I) ((I) & 0xFFFFFFFFUL) -#define ELF64_R_INFO(S,T) (((S) << 32) + ((T) & 0xFFFFFFFFUL)) +#define ELF64_R_INFO(S,T) \ + (((Elf64_Xword) (S) << 32) + ((T) & 0xFFFFFFFFUL)) /* * Symbol versioning structures. Modified: head/contrib/elftoolchain/common/native-elf-format ============================================================================== --- head/contrib/elftoolchain/common/native-elf-format Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/common/native-elf-format Thu Dec 5 13:20:15 2019 (r355413) @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: native-elf-format 3650 2018-11-25 12:06:28Z jkoshy $ +# $Id: native-elf-format 3735 2019-04-25 19:44:47Z jkoshy $ # # Find the native ELF format for a host platform by compiling a # test object and examining the resulting object. @@ -37,6 +37,8 @@ $1 ~ "Machine:" { elfarch = "EM_MIPS"; } else if (match($0, ".*[xX]86[-_]64")) { elfarch = "EM_X86_64"; + } else if (match($0, "PowerPC64")) { + elfarch = "EM_PPC64"; } else { elfarch = "unknown"; } Modified: head/contrib/elftoolchain/elfcopy/ascii.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/ascii.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/elfcopy/ascii.c Thu Dec 5 13:20:15 2019 (r355413) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: ascii.c 3487 2016-08-24 18:12:08Z emaste $"); +ELFTC_VCSID("$Id: ascii.c 3757 2019-06-28 01:15:28Z emaste $"); static void append_data(struct section *s, const void *buf, size_t sz); static char hex_digit(uint8_t n); Modified: head/contrib/elftoolchain/elfcopy/binary.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/binary.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/elfcopy/binary.c Thu Dec 5 13:20:15 2019 (r355413) @@ -36,7 +36,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: binary.c 3611 2018-04-16 21:35:18Z jkoshy $"); +ELFTC_VCSID("$Id: binary.c 3757 2019-06-28 01:15:28Z emaste $"); /* * Convert ELF object to `binary'. Sections with SHF_ALLOC flag set Modified: head/contrib/elftoolchain/elfcopy/elfcopy.h ============================================================================== --- head/contrib/elftoolchain/elfcopy/elfcopy.h Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/elfcopy/elfcopy.h Thu Dec 5 13:20:15 2019 (r355413) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elfcopy.h 3615 2018-05-17 04:12:24Z kaiwang27 $ + * $Id: elfcopy.h 3757 2019-06-28 01:15:28Z emaste $ */ #include Modified: head/contrib/elftoolchain/elfcopy/main.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/main.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/elfcopy/main.c Thu Dec 5 13:20:15 2019 (r355413) @@ -39,7 +39,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: main.c 3577 2017-09-14 02:19:42Z emaste $"); +ELFTC_VCSID("$Id: main.c 3757 2019-06-28 01:15:28Z emaste $"); enum options { Modified: head/contrib/elftoolchain/elfcopy/sections.c ============================================================================== --- head/contrib/elftoolchain/elfcopy/sections.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/elfcopy/sections.c Thu Dec 5 13:20:15 2019 (r355413) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: sections.c 3646 2018-10-27 02:25:39Z emaste $"); +ELFTC_VCSID("$Id: sections.c 3758 2019-06-28 01:16:50Z emaste $"); static void add_gnu_debuglink(struct elfcopy *ecp); static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc); Modified: head/contrib/elftoolchain/elfdump/elfdump.c ============================================================================== --- head/contrib/elftoolchain/elfdump/elfdump.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/elfdump/elfdump.c Thu Dec 5 13:20:15 2019 (r355413) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3584 2017-11-05 20:51:43Z jkoshy $"); +ELFTC_VCSID("$Id: elfdump.c 3762 2019-06-28 21:06:24Z emaste $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" Modified: head/contrib/elftoolchain/libdwarf/dwarf.h ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf.h Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libdwarf/dwarf.h Thu Dec 5 13:20:15 2019 (r355413) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwarf.h 3494 2016-09-20 17:16:13Z emaste $ + * $Id: dwarf.h 3749 2019-06-28 01:10:44Z emaste $ */ #ifndef _DWARF_H_ Modified: head/contrib/elftoolchain/libdwarf/dwarf_dump.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/dwarf_dump.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libdwarf/dwarf_dump.c Thu Dec 5 13:20:15 2019 (r355413) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: dwarf_dump.c 3494 2016-09-20 17:16:13Z emaste $"); +ELFTC_VCSID("$Id: dwarf_dump.c 3749 2019-06-28 01:10:44Z emaste $"); int dwarf_get_ACCESS_name(unsigned access, const char **s) @@ -605,7 +605,7 @@ dwarf_get_DS_name(unsigned ds, const char **s) case DW_DS_leading_separate: *s = "DW_DS_leading_separate"; break; case DW_DS_trailing_separate: - *s = "DW_DS_trailing_separate"; + *s = "DW_DS_trailing_separate"; break; default: return (DW_DLV_NO_ENTRY); } Modified: head/contrib/elftoolchain/libdwarf/libdwarf_attr.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/libdwarf_attr.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libdwarf/libdwarf_attr.c Thu Dec 5 13:20:15 2019 (r355413) @@ -27,7 +27,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: libdwarf_attr.c 3064 2014-06-06 19:35:55Z kaiwang27 $"); +ELFTC_VCSID("$Id: libdwarf_attr.c 3748 2019-06-28 01:11:13Z emaste $"); int _dwarf_attr_alloc(Dwarf_Die die, Dwarf_Attribute *atp, Dwarf_Error *error) Modified: head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c ============================================================================== --- head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libdwarf/libdwarf_reloc.c Thu Dec 5 13:20:15 2019 (r355413) @@ -26,7 +26,7 @@ #include "_libdwarf.h" -ELFTC_VCSID("$Id: libdwarf_reloc.c 3578 2017-09-14 02:21:28Z emaste $"); +ELFTC_VCSID("$Id: libdwarf_reloc.c 3741 2019-06-07 06:32:01Z jkoshy $"); Dwarf_Unsigned _dwarf_get_reloc_type(Dwarf_P_Debug dbg, int is64) Modified: head/contrib/elftoolchain/libelf/_libelf.h ============================================================================== --- head/contrib/elftoolchain/libelf/_libelf.h Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/_libelf.h Thu Dec 5 13:20:15 2019 (r355413) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _libelf.h 3632 2018-10-10 21:12:43Z jkoshy $ + * $Id: _libelf.h 3738 2019-05-05 21:49:06Z jkoshy $ */ #ifndef __LIBELF_H_ @@ -94,7 +94,7 @@ struct _Elf { Elf_Kind e_kind; /* ELF_K_* */ Elf *e_parent; /* non-NULL for archive members */ unsigned char *e_rawfile; /* uninterpreted bytes */ - size_t e_rawsize; /* size of uninterpreted bytes */ + off_t e_rawsize; /* size of uninterpreted bytes */ unsigned int e_version; /* file version */ /* @@ -233,7 +233,7 @@ Elf *_libelf_open_object(int _fd, Elf_Cmd _c, int _rep Elf64_Xword _libelf_mips64el_r_info_tof(Elf64_Xword r_info); Elf64_Xword _libelf_mips64el_r_info_tom(Elf64_Xword r_info); struct _Libelf_Data *_libelf_release_data(struct _Libelf_Data *_d); -Elf *_libelf_release_elf(Elf *_e); +void _libelf_release_elf(Elf *_e); Elf_Scn *_libelf_release_scn(Elf_Scn *_s); int _libelf_setphnum(Elf *_e, void *_eh, int _elfclass, size_t _phnum); int _libelf_setshnum(Elf *_e, void *_eh, int _elfclass, size_t _shnum); Modified: head/contrib/elftoolchain/libelf/_libelf_config.h ============================================================================== --- head/contrib/elftoolchain/libelf/_libelf_config.h Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/_libelf_config.h Thu Dec 5 13:20:15 2019 (r355413) @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: _libelf_config.h 3566 2017-08-31 02:28:40Z emaste $ + * $Id: _libelf_config.h 3764 2019-06-28 21:44:46Z emaste $ */ #if defined(__APPLE__) || defined(__DragonFly__) @@ -98,6 +98,12 @@ #define LIBELF_CLASS ELFCLASS32 #elif defined(__riscv) && (__riscv_xlen == 64) + +#define LIBELF_ARCH EM_RISCV +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS64 + +#elif defined(__riscv64) #define LIBELF_ARCH EM_RISCV #define LIBELF_BYTEORDER ELFDATA2LSB Modified: head/contrib/elftoolchain/libelf/elf.3 ============================================================================== --- head/contrib/elftoolchain/libelf/elf.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf.3 Thu Dec 5 13:20:15 2019 (r355413) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2006-2008,2011 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006-2008,2011,2019 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf.3 3643 2018-10-14 21:09:24Z jkoshy $ +.\" $Id: elf.3 3743 2019-06-12 19:36:30Z jkoshy $ .\" -.Dd October 10, 2018 +.Dd June 12, 2019 .Dt ELF 3 .Os .Sh NAME @@ -266,36 +266,43 @@ The operating version for the data in this buffer. .El .Pp .Vt Elf_Data -descriptors are usually associated with +descriptors are usually used in conjunction with .Vt Elf_Scn descriptors. -Existing data descriptors associated with an ELF section may be -structures are retrieved using the -.Fn elf_getdata -and -.Fn elf_rawdata -functions. -The -.Fn elf_newdata -function may be used to attach new data descriptors to an ELF section. .It Vt Elf_Scn .Vt Elf_Scn -descriptors represent a section in an ELF object. +descriptors represent sections in an ELF object. +These descriptors are opaque and contain no application modifiable +fields. .Pp -They are retrieved using the +The +.Vt Elf_Scn +descriptor for a specific section in an ELF object can be +retrieved using the .Fn elf_getscn function. -An application may iterate through the existing sections of an ELF -object using the +The sections contained in an ELF object can be traversed using the .Fn elf_nextscn function. -New sections may be allocated using the +New sections are allocated using the .Fn elf_newscn function. .Pp The -.Vt Elf_Scn -descriptor is opaque and contains no application modifiable fields. +.Vt Elf_Data +descriptors associated with a given section can be retrieved +using the +.Fn elf_getdata +function. +New data descriptors can be added to a section +descriptor using the +.Fn elf_newdata +function. +The untranslated +.Dq file +representation of data in a section can be retrieved using the +.Fn elf_rawdata +function. .El .Ss Supported Elf Types The following ELF datatypes are supported by the library. @@ -608,8 +615,11 @@ descriptor itself. .Xr ar 5 , .Xr elf 5 .Sh HISTORY -The original ELF(3) API was developed for Unix System V. -The current implementation of the ELF(3) API appeared in +The original +.Nm +API was developed for +.At V . +The current implementation of the API appeared in .Fx 7.0 . .Sh AUTHORS The ELF library was written by Modified: head/contrib/elftoolchain/libelf/elf_data.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_data.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_data.c Thu Dec 5 13:20:15 2019 (r355413) @@ -32,7 +32,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: elf_data.c 3632 2018-10-10 21:12:43Z jkoshy $"); +ELFTC_VCSID("$Id: elf_data.c 3732 2019-04-22 11:08:38Z jkoshy $"); Elf_Data * elf_getdata(Elf_Scn *s, Elf_Data *ed) @@ -42,7 +42,7 @@ elf_getdata(Elf_Scn *s, Elf_Data *ed) int elfclass, elftype; size_t count, fsz, msz; struct _Libelf_Data *d; - uint64_t sh_align, sh_offset, sh_size; + uint64_t sh_align, sh_offset, sh_size, raw_size; _libelf_translator_function *xlate; d = (struct _Libelf_Data *) ed; @@ -59,7 +59,8 @@ elf_getdata(Elf_Scn *s, Elf_Data *ed) return (&d->d_data); if (d != NULL) - return (&STAILQ_NEXT(d, d_next)->d_data); + return (STAILQ_NEXT(d, d_next) ? + &STAILQ_NEXT(d, d_next)->d_data : NULL); if (e->e_rawfile == NULL) { /* @@ -91,9 +92,10 @@ elf_getdata(Elf_Scn *s, Elf_Data *ed) return (NULL); } + raw_size = (uint64_t) e->e_rawsize; if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && - (sh_offset > e->e_rawsize || sh_size > e->e_rawsize - sh_offset))) { + (sh_offset > raw_size || sh_size > raw_size - sh_offset))) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); } @@ -116,7 +118,8 @@ elf_getdata(Elf_Scn *s, Elf_Data *ed) count = (size_t) (sh_size / fsz); - msz = _libelf_msize(elftype, elfclass, e->e_version); + if ((msz = _libelf_msize(elftype, elfclass, e->e_version)) == 0) + return (NULL); if (count > 0 && msz > SIZE_MAX / count) { LIBELF_SET_ERROR(RANGE, 0); @@ -215,7 +218,7 @@ elf_rawdata(Elf_Scn *s, Elf_Data *ed) int elf_class; uint32_t sh_type; struct _Libelf_Data *d; - uint64_t sh_align, sh_offset, sh_size; + uint64_t sh_align, sh_offset, sh_size, raw_size; if (s == NULL || (e = s->s_elf) == NULL || e->e_rawfile == NULL) { LIBELF_SET_ERROR(ARGUMENT, 0); @@ -253,8 +256,9 @@ elf_rawdata(Elf_Scn *s, Elf_Data *ed) return (NULL); } + raw_size = (uint64_t) e->e_rawsize; if (sh_type != SHT_NOBITS && - (sh_offset > e->e_rawsize || sh_size > e->e_rawsize - sh_offset)) { + (sh_offset > raw_size || sh_size > raw_size - sh_offset)) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); } Modified: head/contrib/elftoolchain/libelf/elf_end.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_end.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_end.c Thu Dec 5 13:20:15 2019 (r355413) @@ -34,7 +34,7 @@ #include #endif -ELFTC_VCSID("$Id: elf_end.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: elf_end.c 3738 2019-05-05 21:49:06Z jkoshy $"); int elf_end(Elf *e) @@ -80,14 +80,14 @@ elf_end(Elf *e) free(e->e_rawfile); #if ELFTC_HAVE_MMAP else if (e->e_flags & LIBELF_F_RAWFILE_MMAP) - (void) munmap(e->e_rawfile, e->e_rawsize); + (void) munmap(e->e_rawfile, (size_t) e->e_rawsize); #endif } sv = e; if ((e = e->e_parent) != NULL) e->e_u.e_ar.e_nchildren--; - sv = _libelf_release_elf(sv); + _libelf_release_elf(sv); } return (0); Modified: head/contrib/elftoolchain/libelf/elf_flagdata.3 ============================================================================== --- head/contrib/elftoolchain/libelf/elf_flagdata.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_flagdata.3 Thu Dec 5 13:20:15 2019 (r355413) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_flagdata.3 3639 2018-10-14 14:07:02Z jkoshy $ +.\" $Id: elf_flagdata.3 3743 2019-06-12 19:36:30Z jkoshy $ .\" -.Dd December 3, 2011 +.Dd June 12, 2019 .Dt ELF_FLAGDATA 3 .Os .Sh NAME @@ -34,7 +34,7 @@ .Nm elf_flagphdr , .Nm elf_flagscn , .Nm elf_flagshdr -.Nd manipulate flags associated with ELF(3) data structures +.Nd manipulate flags associated with ELF data structures .Sh LIBRARY .Lb libelf .Sh SYNOPSIS @@ -65,7 +65,9 @@ and .Ar scn denote the data structures whose flags need to be changed. These values should have been returned by prior calls to -functions in the ELF(3) API set: +functions in the +.Xr elf 3 +API set: .Bl -bullet -compact .It Argument @@ -175,7 +177,9 @@ function and the .Dv ELF_F_ARCHIVE and .Dv ELF_F_ARCHIVE_SYSV -flags are an extension to the ELF(3) API. +flags are an extension to the +.Xr elf 3 +API. .Sh ERRORS These functions may fail with the following errors: .Bl -tag -width "[ELF_E_RESOURCE]" Modified: head/contrib/elftoolchain/libelf/elf_getdata.3 ============================================================================== --- head/contrib/elftoolchain/libelf/elf_getdata.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_getdata.3 Thu Dec 5 13:20:15 2019 (r355413) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_getdata.3 3643 2018-10-14 21:09:24Z jkoshy $ +.\" $Id: elf_getdata.3 3734 2019-04-22 14:10:49Z jkoshy $ .\" -.Dd January 26, 2011 +.Dd April 22, 2019 .Dt ELF_GETDATA 3 .Os .Sh NAME @@ -214,7 +214,12 @@ is incorrect. .It Bq Er ELF_E_UNIMPL The section type associated with section .Ar scn -is currently unsupported by the library. +is not supported. +.It Bq Er ELF_E_VERSION +Section +.Ar scn +was associated with an ELF object with an unsupported +version. .El .Sh SEE ALSO .Xr elf 3 , Modified: head/contrib/elftoolchain/libelf/elf_getident.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_getident.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_getident.c Thu Dec 5 13:20:15 2019 (r355413) @@ -30,7 +30,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: elf_getident.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: elf_getident.c 3712 2019-03-16 22:23:34Z jkoshy $"); char * elf_getident(Elf *e, size_t *sz) @@ -54,7 +54,7 @@ elf_getident(Elf *e, size_t *sz) else if (e->e_kind == ELF_K_ELF) *sz = EI_NIDENT; else - *sz = e->e_rawsize; + *sz = (size_t) e->e_rawsize; } return ((char *) e->e_rawfile); Modified: head/contrib/elftoolchain/libelf/elf_next.3 ============================================================================== --- head/contrib/elftoolchain/libelf/elf_next.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_next.3 Thu Dec 5 13:20:15 2019 (r355413) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_next.3 3639 2018-10-14 14:07:02Z jkoshy $ +.\" $Id: elf_next.3 3698 2019-02-28 06:34:42Z jkoshy $ .\" -.Dd June 17, 2006 +.Dd February 27, 2019 .Dt ELF_NEXT 3 .Os .Sh NAME @@ -88,6 +88,9 @@ Argument was not associated with a containing .Xr ar 1 archive. +.It Bq Er ELF_E_ARGUMENT +An error was encountered while parsing the archive containing argument +.Ar elf . .El .Sh SEE ALSO .Xr elf 3 , Modified: head/contrib/elftoolchain/libelf/elf_next.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_next.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_next.c Thu Dec 5 13:20:15 2019 (r355413) @@ -30,7 +30,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: elf_next.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: elf_next.c 3710 2019-03-12 09:42:35Z jkoshy $"); Elf_Cmd elf_next(Elf *e) @@ -59,6 +59,20 @@ elf_next(Elf *e) */ parent->e_u.e_ar.e_next = (next >= (off_t) parent->e_rawsize) ? (off_t) 0 : next; + + /* + * Return an error if the 'e_next' field falls outside the current + * file. + * + * This check is performed after updating the parent descriptor's + * 'e_next' field so that the next call to elf_begin(3) will terminate + * traversal of a too-small archive even if client code forgets to + * check the return value from elf_next(3). + */ + if (next > (off_t) parent->e_rawsize) { + LIBELF_SET_ERROR(ARGUMENT, 0); + return (ELF_C_NULL); + } return (ELF_C_READ); } Modified: head/contrib/elftoolchain/libelf/elf_open.3 ============================================================================== --- head/contrib/elftoolchain/libelf/elf_open.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_open.3 Thu Dec 5 13:20:15 2019 (r355413) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_open.3 3643 2018-10-14 21:09:24Z jkoshy $ +.\" $Id: elf_open.3 3743 2019-06-12 19:36:30Z jkoshy $ .\" -.Dd May 31, 2012 +.Dd June 12, 2019 .Dt ELF_OPEN 3 .Os .Sh NAME @@ -43,7 +43,9 @@ The functions .Fn elf_open and .Fn elf_openmemory -are extensions to the ELF(3) API, for the internal use of the +are extensions to the +.Xr elf 3 +API, for the internal use of the Elftoolchain project. Portable applications should not use these functions. .Pp @@ -71,7 +73,9 @@ specifies the size of the memory area in bytes. The function returns a pointer to a ELF descriptor if successful, or NULL if an error occurred. .Sh COMPATIBILITY -These functions are non-standard extensions to the ELF(3) API set. +These functions are non-standard extensions to the +.Xr elf 3 +API set. .Pp The behavior of these functions differs from their counterparts .Xr elf_begin 3 Modified: head/contrib/elftoolchain/libelf/elf_rand.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_rand.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_rand.c Thu Dec 5 13:20:15 2019 (r355413) @@ -29,16 +29,25 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: elf_rand.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: elf_rand.c 3716 2019-03-18 22:01:01Z jkoshy $"); off_t elf_rand(Elf *ar, off_t offset) { struct ar_hdr *arh; + off_t offset_of_member; if (ar == NULL || ar->e_kind != ELF_K_AR || (offset & 1) || offset < SARMAG || - (size_t) offset + sizeof(struct ar_hdr) >= ar->e_rawsize) { + offset >= ar->e_rawsize) { + LIBELF_SET_ERROR(ARGUMENT, 0); + return 0; + } + + offset_of_member = offset + (off_t) sizeof(struct ar_hdr); + + if (offset_of_member <= 0 || /* Numeric overflow. */ + offset_of_member >= ar->e_rawsize) { LIBELF_SET_ERROR(ARGUMENT, 0); return 0; } Modified: head/contrib/elftoolchain/libelf/elf_rawfile.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_rawfile.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_rawfile.c Thu Dec 5 13:20:15 2019 (r355413) @@ -28,15 +28,13 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: elf_rawfile.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: elf_rawfile.c 3712 2019-03-16 22:23:34Z jkoshy $"); char * elf_rawfile(Elf *e, size_t *sz) { - size_t size; unsigned char *ptr; - size = e ? e->e_rawsize : 0; ptr = NULL; if (e == NULL) @@ -45,7 +43,7 @@ elf_rawfile(Elf *e, size_t *sz) LIBELF_SET_ERROR(SEQUENCE, 0); if (sz) - *sz = size; + *sz = e ? (size_t) e->e_rawsize : 0; return ((char *) ptr); } Modified: head/contrib/elftoolchain/libelf/elf_scn.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_scn.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_scn.c Thu Dec 5 13:20:15 2019 (r355413) @@ -36,7 +36,7 @@ #include "_libelf.h" -ELFTC_VCSID("$Id: elf_scn.c 3632 2018-10-10 21:12:43Z jkoshy $"); +ELFTC_VCSID("$Id: elf_scn.c 3712 2019-03-16 22:23:34Z jkoshy $"); static int elfscn_cmp(struct _Elf_Scn *s1, struct _Elf_Scn *s2) @@ -71,10 +71,11 @@ _libelf_load_section_headers(Elf *e, void *ehdr) assert((e->e_flags & LIBELF_F_SHDRS_LOADED) == 0); #define CHECK_EHDR(E,EH) do { \ - if (shoff > e->e_rawsize || \ + uintmax_t rawsize = (uintmax_t) e->e_rawsize; \ + if (shoff > (uintmax_t) e->e_rawsize || \ fsz != (EH)->e_shentsize || \ shnum > SIZE_MAX / fsz || \ - fsz * shnum > e->e_rawsize - shoff) { \ + fsz * shnum > rawsize - shoff) { \ LIBELF_SET_ERROR(HEADER, 0); \ return (0); \ } \ Modified: head/contrib/elftoolchain/libelf/elf_update.3 ============================================================================== --- head/contrib/elftoolchain/libelf/elf_update.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_update.3 Thu Dec 5 13:20:15 2019 (r355413) @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_update.3 3639 2018-10-14 14:07:02Z jkoshy $ +.\" $Id: elf_update.3 3734 2019-04-22 14:10:49Z jkoshy $ .\" -.Dd August 14, 2011 +.Dd April 22, 2019 .Dt ELF_UPDATE 3 .Os .Sh NAME @@ -345,6 +345,10 @@ operation was requested after a prior call to disassociated the ELF descriptor .Ar elf from its underlying file. +.It Bq Er ELF_E_UNIMPL +Argument +.Ar elf +contained a section with an unsupported ELF type. .It Bq Er ELF_E_VERSION Argument .Ar elf Modified: head/contrib/elftoolchain/libelf/elf_update.c ============================================================================== --- head/contrib/elftoolchain/libelf/elf_update.c Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/elf_update.c Thu Dec 5 13:20:15 2019 (r355413) @@ -41,7 +41,7 @@ #include #endif -ELFTC_VCSID("$Id: elf_update.c 3632 2018-10-10 21:12:43Z jkoshy $"); +ELFTC_VCSID("$Id: elf_update.c 3763 2019-06-28 21:43:27Z emaste $"); /* * Layout strategy: @@ -142,7 +142,7 @@ _libelf_compute_section_extents(Elf *e, Elf_Scn *s, of assert(sh_type != SHT_NULL && sh_type != SHT_NOBITS); elftype = _libelf_xlate_shtype(sh_type); - if (elftype > ELF_T_LAST) { + if (elftype < ELF_T_FIRST || elftype > ELF_T_LAST) { LIBELF_SET_ERROR(SECTION, 0); return (0); } @@ -222,10 +222,16 @@ _libelf_compute_section_extents(Elf *e, Elf_Scn *s, of } /* + * The data buffer's ELF type, ELF class and ELF version + * should be supported. + */ + if ((msz = _libelf_msize(d->d_type, ec, e->e_version)) == 0) + return (0); + + /* * The buffer's size should be a multiple of the * memory size of the underlying type. */ - msz = _libelf_msize(d->d_type, ec, e->e_version); if (d->d_size % msz) { LIBELF_SET_ERROR(DATA, 0); return (0); @@ -802,7 +808,8 @@ _libelf_write_scn(Elf *e, unsigned char *nf, struct _E d = &ld->d_data; - msz = _libelf_msize(d->d_type, ec, e->e_version); + if ((msz = _libelf_msize(d->d_type, ec, e->e_version)) == 0) + return ((off_t) -1); if ((uint64_t) rc < sh_off + d->d_off) (void) memset(nf + rc, @@ -813,8 +820,8 @@ _libelf_write_scn(Elf *e, unsigned char *nf, struct _E assert(d->d_buf != NULL); assert(d->d_version == e->e_version); - assert(msz != 0); assert(d->d_size % msz == 0); + assert(msz != 0); nobjects = (size_t) (d->d_size / msz); @@ -854,7 +861,8 @@ _libelf_write_ehdr(Elf *e, unsigned char *nf, struct _ assert(ehdr != NULL); fsz = _libelf_fsize(ELF_T_EHDR, ec, e->e_version, (size_t) 1); - msz = _libelf_msize(ELF_T_EHDR, ec, e->e_version); + if ((msz = _libelf_msize(ELF_T_EHDR, ec, e->e_version)) == 0) + return ((off_t) -1); em = _libelf_elfmachine(e); @@ -888,15 +896,17 @@ _libelf_write_phdr(Elf *e, unsigned char *nf, struct _ Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; Elf_Data dst, src; - size_t fsz, phnum; + size_t fsz, msz, phnum; uint64_t phoff; assert(ex->ex_type == ELF_EXTENT_PHDR); ec = e->e_class; + ehdr = _libelf_ehdr(e, ec, 0); - phnum = e->e_u.e_elf.e_nphdr; + assert(ehdr != NULL); + phnum = e->e_u.e_elf.e_nphdr; assert(phnum > 0); if (ec == ELFCLASS32) { @@ -916,14 +926,15 @@ _libelf_write_phdr(Elf *e, unsigned char *nf, struct _ (void) memset(&dst, 0, sizeof(dst)); (void) memset(&src, 0, sizeof(src)); + if ((msz = _libelf_msize(ELF_T_PHDR, ec, e->e_version)) == 0) + return ((off_t) -1); fsz = _libelf_fsize(ELF_T_PHDR, ec, e->e_version, phnum); assert(fsz > 0); src.d_buf = _libelf_getphdr(e, ec); src.d_version = dst.d_version = e->e_version; src.d_type = ELF_T_PHDR; - src.d_size = phnum * _libelf_msize(ELF_T_PHDR, ec, - e->e_version); + src.d_size = phnum * msz; dst.d_size = fsz; dst.d_buf = nf + ex->ex_start; @@ -948,13 +959,16 @@ _libelf_write_shdr(Elf *e, unsigned char *nf, struct _ uint64_t shoff; Elf32_Ehdr *eh32; Elf64_Ehdr *eh64; - size_t fsz, nscn; + size_t fsz, msz, nscn; Elf_Data dst, src; assert(ex->ex_type == ELF_EXTENT_SHDR); ec = e->e_class; + ehdr = _libelf_ehdr(e, ec, 0); + assert(ehdr != NULL); + nscn = e->e_u.e_elf.e_nscn; if (ec == ELFCLASS32) { @@ -974,8 +988,11 @@ _libelf_write_shdr(Elf *e, unsigned char *nf, struct _ (void) memset(&dst, 0, sizeof(dst)); (void) memset(&src, 0, sizeof(src)); + if ((msz = _libelf_msize(ELF_T_SHDR, ec, e->e_version)) == 0) + return ((off_t) -1); + src.d_type = ELF_T_SHDR; - src.d_size = _libelf_msize(ELF_T_SHDR, ec, e->e_version); + src.d_size = msz; src.d_version = dst.d_version = e->e_version; fsz = _libelf_fsize(ELF_T_SHDR, ec, e->e_version, (size_t) 1); @@ -1087,7 +1104,7 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_E if (e->e_flags & LIBELF_F_RAWFILE_MMAP) { assert(e->e_rawfile != NULL); assert(e->e_cmd == ELF_C_RDWR); - if (munmap(e->e_rawfile, e->e_rawsize) < 0) { + if (munmap(e->e_rawfile, (size_t) e->e_rawsize) < 0) { LIBELF_SET_ERROR(IO, errno); goto error; } @@ -1112,12 +1129,14 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_E assert((e->e_flags & LIBELF_F_RAWFILE_MALLOC) || (e->e_flags & LIBELF_F_RAWFILE_MMAP)); if (e->e_flags & LIBELF_F_RAWFILE_MALLOC) { + assert((e->e_flags & LIBELF_F_RAWFILE_MMAP) == 0); free(e->e_rawfile); e->e_rawfile = newfile; newfile = NULL; } #if ELFTC_HAVE_MMAP else if (e->e_flags & LIBELF_F_RAWFILE_MMAP) { + assert((e->e_flags & LIBELF_F_RAWFILE_MALLOC) == 0); if ((e->e_rawfile = mmap(NULL, (size_t) newsize, PROT_READ, MAP_PRIVATE, e->e_fd, (off_t) 0)) == MAP_FAILED) { @@ -1128,7 +1147,7 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_E #endif /* ELFTC_HAVE_MMAP */ /* Record the new size of the file. */ - e->e_rawsize = (size_t) newsize; + e->e_rawsize = newsize; } else { /* File opened in ELF_C_WRITE mode. */ assert(e->e_rawfile == NULL); Modified: head/contrib/elftoolchain/libelf/gelf.3 ============================================================================== --- head/contrib/elftoolchain/libelf/gelf.3 Thu Dec 5 04:52:19 2019 (r355412) +++ head/contrib/elftoolchain/libelf/gelf.3 Thu Dec 5 13:20:15 2019 (r355413) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Dec 5 13:28:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD8E91C9926; Thu, 5 Dec 2019 13:28:58 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47TGlF0T2Fz4C1m; Thu, 5 Dec 2019 13:28:56 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id y11so3587927wrt.6; Thu, 05 Dec 2019 05:28:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=8rySKockyxgkE1/9czTvnTr671ZBBakuZCtMaOSfTlc=; b=gefZiboDh6poPBmg9uiTrQ5p+Ip37jjEcah2yGAky7Ep/JINf1YFXkQJVy+sPBj+dc K5XBeo+T0drXg4ki4fj4c/zrsQ63u3u2TtTecVZW6Lwl3UTGvrxPGFwA8A291WYSRojt C7xTeGvLx0dzNrdo7igZfKIHUZXy0u7saouu3Klr/GVr1AbOtTSWx5Menx7GhbvPmdl3 9IcK3AmyyKsI33GS44OwXJZUulT45SSgbN41aVhgU3+Dc1b7wNJ39AAVnIWMj2PS2njj QwzJTtJb1ieH/mtoX1S/ZwXnaMLGtuAEpZ5eDIwzKZL9oM0YIPhsJjcrVj8QJp6yC+X3 TJ3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=8rySKockyxgkE1/9czTvnTr671ZBBakuZCtMaOSfTlc=; b=OWJVH6M1WEzeo/yn+BoHNQXGyflomh6FynhpzM2dD67FloYrd09J0oIbDKOuis1LUV 2FChYm8zIATTSBgAh6Xc9KvxRrvVZKn0P3oMYUlUg26E12+vFSoLjVEQYUoqyxiukHZM oSSXV5FCW3pf2JeWg8xX+bDp4489JE6F4oVwGWd4yO80+J+SlRfjhzSJwb2rrpqO4tQ4 P8sAU5C6IvPbVbisEzea5xEP/DTQ5Z1UAuGnjB51AcGDUucthXOWW3vSh1vH7oRguKVg d6eVo/u0aeceKX0y9w0psthm1YnTvHbOTeYbKMWZYLlqZp4ocF8Pi+NUSGLGEIn3fsoo uWFQ== X-Gm-Message-State: APjAAAXsEa3cVwBBaHgW7D0azyhfyWiuDA9AfzIN0NZwzZD9KBY+/Ktg sJ1DpoLNFWcp9nrGapQoldmYhYe2nGTdvgnjdGF1Qw== X-Google-Smtp-Source: APXvYqwwaOkstIuF2Loc4G679b+3K1g3LykJ3QVKTT2inBjKHG8arfj0RXNHcVAFJskniBEYRxzd9nG4bIWzY5evhzk= X-Received: by 2002:adf:d0c1:: with SMTP id z1mr10486315wrh.371.1575552535266; Thu, 05 Dec 2019 05:28:55 -0800 (PST) MIME-Version: 1.0 Received: by 2002:adf:9ed0:0:0:0:0:0 with HTTP; Thu, 5 Dec 2019 05:28:54 -0800 (PST) In-Reply-To: <201911152301.xAFN1hBM046422@repo.freebsd.org> References: <201911152301.xAFN1hBM046422@repo.freebsd.org> From: Mateusz Guzik Date: Thu, 5 Dec 2019 14:28:54 +0100 Message-ID: Subject: Re: svn commit: r354754 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47TGlF0T2Fz4C1m X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=gefZiboD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::435 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; IP_SCORE_FREEMAIL(0.00)[]; IP_SCORE(0.00)[ip: (-9.39), ipnet: 2a00:1450::/32(-2.69), asn: 15169(-1.93), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[5.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 13:28:58 -0000 On 11/16/19, John Baldwin wrote: > Author: jhb > Date: Fri Nov 15 23:01:43 2019 > New Revision: 354754 > URL: https://svnweb.freebsd.org/changeset/base/354754 > > Log: > Use a sv_copyout_auxargs hook in the Linux ELF ABIs. > This makes Linux binaries instantly segfault for me on amd64. You check: https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-root.tar.xz I unpack this to tmpfs and chroot inside. Works without this commit. -- Mateusz Guzik From owner-svn-src-all@freebsd.org Thu Dec 5 13:35:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F6711C9BE9; Thu, 5 Dec 2019 13:35:53 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47TGvF0PWyz4CZH; Thu, 5 Dec 2019 13:35:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xB5DZiU3064471 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 5 Dec 2019 15:35:48 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xB5DZiU3064471 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xB5DZi3E064470; Thu, 5 Dec 2019 15:35:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 5 Dec 2019 15:35:44 +0200 From: Konstantin Belousov To: Kubilay Kocak Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355407 - head/sys/fs/tmpfs Message-ID: <20191205133544.GE2744@kib.kiev.ua> References: <201912050003.xB503HtP008634@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47TGvF0PWyz4CZH X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 13:35:53 -0000 On Thu, Dec 05, 2019 at 02:38:07PM +1100, Kubilay Kocak wrote: > On 5/12/2019 11:03 am, Konstantin Belousov wrote: > > Author: kib > > Date: Thu Dec 5 00:03:17 2019 > > New Revision: 355407 > > URL: https://svnweb.freebsd.org/changeset/base/355407 > > Could you elaborate on the why/rationale? > > Is there memory wastage/duplication, bug(s), performance or > development/maintenance benefit? Each mount/unmount of tmpfs created and destroyed two zones, as it is easy to see from the patch. > > The review summary doesnt appear to include this information either > > > Log: > > Stop using per-mount tmpfs zones. > > > > Requested and reviewed by: jeff > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D22643 > > > > Modified: > > head/sys/fs/tmpfs/tmpfs.h > > head/sys/fs/tmpfs/tmpfs_subr.c > > head/sys/fs/tmpfs/tmpfs_vfsops.c > > > > Modified: head/sys/fs/tmpfs/tmpfs.h > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs.h Wed Dec 4 23:24:40 2019 (r355406) > > +++ head/sys/fs/tmpfs/tmpfs.h Thu Dec 5 00:03:17 2019 (r355407) > > @@ -378,10 +378,6 @@ struct tmpfs_mount { > > /* All node lock to protect the node list and tmp_pages_used. */ > > struct mtx tm_allnode_lock; > > > > - /* Zones used to store file system meta data, per tmpfs mount. */ > > - uma_zone_t tm_dirent_pool; > > - uma_zone_t tm_node_pool; > > - > > /* Read-only status. */ > > bool tm_ronly; > > /* Do not use namecache. */ > > @@ -493,8 +489,9 @@ struct tmpfs_dirent *tmpfs_dir_next(struct tmpfs_node > > #endif > > > > size_t tmpfs_mem_avail(void); > > - > > size_t tmpfs_pages_used(struct tmpfs_mount *tmp); > > +void tmpfs_subr_init(void); > > +void tmpfs_subr_uninit(void); > > > > #endif > > > > > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs_subr.c Wed Dec 4 23:24:40 2019 (r355406) > > +++ head/sys/fs/tmpfs/tmpfs_subr.c Thu Dec 5 00:03:17 2019 (r355407) > > @@ -72,7 +72,74 @@ SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW, 0, "tmp > > > > static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED; > > > > +static uma_zone_t tmpfs_dirent_pool; > > +static uma_zone_t tmpfs_node_pool; > > + > > static int > > +tmpfs_node_ctor(void *mem, int size, void *arg, int flags) > > +{ > > + struct tmpfs_node *node; > > + > > + node = mem; > > + node->tn_gen++; > > + node->tn_size = 0; > > + node->tn_status = 0; > > + node->tn_flags = 0; > > + node->tn_links = 0; > > + node->tn_vnode = NULL; > > + node->tn_vpstate = 0; > > + return (0); > > +} > > + > > +static void > > +tmpfs_node_dtor(void *mem, int size, void *arg) > > +{ > > + struct tmpfs_node *node; > > + > > + node = mem; > > + node->tn_type = VNON; > > +} > > + > > +static int > > +tmpfs_node_init(void *mem, int size, int flags) > > +{ > > + struct tmpfs_node *node; > > + > > + node = mem; > > + node->tn_id = 0; > > + mtx_init(&node->tn_interlock, "tmpfsni", NULL, MTX_DEF); > > + node->tn_gen = arc4random(); > > + return (0); > > +} > > + > > +static void > > +tmpfs_node_fini(void *mem, int size) > > +{ > > + struct tmpfs_node *node; > > + > > + node = mem; > > + mtx_destroy(&node->tn_interlock); > > +} > > + > > +void > > +tmpfs_subr_init(void) > > +{ > > + tmpfs_dirent_pool = uma_zcreate("TMPFS dirent", > > + sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, > > + UMA_ALIGN_PTR, 0); > > + tmpfs_node_pool = uma_zcreate("TMPFS node", > > + sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, > > + tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); > > +} > > + > > +void > > +tmpfs_subr_uninit(void) > > +{ > > + uma_zdestroy(tmpfs_node_pool); > > + uma_zdestroy(tmpfs_dirent_pool); > > +} > > + > > +static int > > sysctl_mem_reserved(SYSCTL_HANDLER_ARGS) > > { > > int error; > > @@ -219,8 +286,7 @@ tmpfs_alloc_node(struct mount *mp, struct tmpfs_mount > > if ((mp->mnt_kern_flag & MNT_RDONLY) != 0) > > return (EROFS); > > > > - nnode = (struct tmpfs_node *)uma_zalloc_arg(tmp->tm_node_pool, tmp, > > - M_WAITOK); > > + nnode = uma_zalloc_arg(tmpfs_node_pool, tmp, M_WAITOK); > > > > /* Generic initialization. */ > > nnode->tn_type = type; > > @@ -367,7 +433,7 @@ tmpfs_free_node_locked(struct tmpfs_mount *tmp, struct > > panic("tmpfs_free_node: type %p %d", node, (int)node->tn_type); > > } > > > > - uma_zfree(tmp->tm_node_pool, node); > > + uma_zfree(tmpfs_node_pool, node); > > TMPFS_LOCK(tmp); > > tmpfs_free_tmp(tmp); > > return (true); > > @@ -434,7 +500,7 @@ tmpfs_alloc_dirent(struct tmpfs_mount *tmp, struct tmp > > { > > struct tmpfs_dirent *nde; > > > > - nde = uma_zalloc(tmp->tm_dirent_pool, M_WAITOK); > > + nde = uma_zalloc(tmpfs_dirent_pool, M_WAITOK); > > nde->td_node = node; > > if (name != NULL) { > > nde->ud.td_name = malloc(len, M_TMPFSNAME, M_WAITOK); > > @@ -470,7 +536,7 @@ tmpfs_free_dirent(struct tmpfs_mount *tmp, struct tmpf > > } > > if (!tmpfs_dirent_duphead(de) && de->ud.td_name != NULL) > > free(de->ud.td_name, M_TMPFSNAME); > > - uma_zfree(tmp->tm_dirent_pool, de); > > + uma_zfree(tmpfs_dirent_pool, de); > > } > > > > void > > > > Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c > > ============================================================================== > > --- head/sys/fs/tmpfs/tmpfs_vfsops.c Wed Dec 4 23:24:40 2019 (r355406) > > +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Thu Dec 5 00:03:17 2019 (r355407) > > @@ -99,49 +99,6 @@ static const char *tmpfs_updateopts[] = { > > "from", "export", "size", NULL > > }; > > > > -static int > > -tmpfs_node_ctor(void *mem, int size, void *arg, int flags) > > -{ > > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > > - > > - node->tn_gen++; > > - node->tn_size = 0; > > - node->tn_status = 0; > > - node->tn_flags = 0; > > - node->tn_links = 0; > > - node->tn_vnode = NULL; > > - node->tn_vpstate = 0; > > - > > - return (0); > > -} > > - > > -static void > > -tmpfs_node_dtor(void *mem, int size, void *arg) > > -{ > > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > > - node->tn_type = VNON; > > -} > > - > > -static int > > -tmpfs_node_init(void *mem, int size, int flags) > > -{ > > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > > - node->tn_id = 0; > > - > > - mtx_init(&node->tn_interlock, "tmpfs node interlock", NULL, MTX_DEF); > > - node->tn_gen = arc4random(); > > - > > - return (0); > > -} > > - > > -static void > > -tmpfs_node_fini(void *mem, int size) > > -{ > > - struct tmpfs_node *node = (struct tmpfs_node *)mem; > > - > > - mtx_destroy(&node->tn_interlock); > > -} > > - > > /* > > * Handle updates of time from writes to mmaped regions. Use > > * MNT_VNODE_FOREACH_ALL instead of MNT_VNODE_FOREACH_ACTIVE, since > > @@ -481,12 +438,6 @@ tmpfs_mount(struct mount *mp) > > tmp->tm_pages_max = pages; > > tmp->tm_pages_used = 0; > > new_unrhdr64(&tmp->tm_ino_unr, 2); > > - tmp->tm_dirent_pool = uma_zcreate("TMPFS dirent", > > - sizeof(struct tmpfs_dirent), NULL, NULL, NULL, NULL, > > - UMA_ALIGN_PTR, 0); > > - tmp->tm_node_pool = uma_zcreate("TMPFS node", > > - sizeof(struct tmpfs_node), tmpfs_node_ctor, tmpfs_node_dtor, > > - tmpfs_node_init, tmpfs_node_fini, UMA_ALIGN_PTR, 0); > > tmp->tm_ronly = (mp->mnt_flag & MNT_RDONLY) != 0; > > tmp->tm_nonc = nonc; > > > > @@ -495,8 +446,6 @@ tmpfs_mount(struct mount *mp) > > root_mode & ALLPERMS, NULL, NULL, VNOVAL, &root); > > > > if (error != 0 || root == NULL) { > > - uma_zdestroy(tmp->tm_node_pool); > > - uma_zdestroy(tmp->tm_dirent_pool); > > free(tmp, M_TMPFSMNT); > > return (error); > > } > > @@ -590,9 +539,6 @@ tmpfs_free_tmp(struct tmpfs_mount *tmp) > > } > > TMPFS_UNLOCK(tmp); > > > > - uma_zdestroy(tmp->tm_dirent_pool); > > - uma_zdestroy(tmp->tm_node_pool); > > - > > mtx_destroy(&tmp->tm_allnode_lock); > > MPASS(tmp->tm_pages_used == 0); > > MPASS(tmp->tm_nodes_inuse == 0); > > @@ -702,10 +648,23 @@ tmpfs_susp_clean(struct mount *mp __unused) > > { > > } > > > > +static int > > +tmpfs_init(struct vfsconf *conf) > > +{ > > + tmpfs_subr_init(); > > + return (0); > > +} > > + > > +static int > > +tmpfs_uninit(struct vfsconf *conf) > > +{ > > + tmpfs_subr_uninit(); > > + return (0); > > +} > > + > > /* > > * tmpfs vfs operations. > > */ > > - > > struct vfsops tmpfs_vfsops = { > > .vfs_mount = tmpfs_mount, > > .vfs_unmount = tmpfs_unmount, > > @@ -715,5 +674,7 @@ struct vfsops tmpfs_vfsops = { > > .vfs_fhtovp = tmpfs_fhtovp, > > .vfs_sync = tmpfs_sync, > > .vfs_susp_clean = tmpfs_susp_clean, > > + .vfs_init = tmpfs_init, > > + .vfs_uninit = tmpfs_uninit, > > }; > > VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL); > > _______________________________________________ > > svn-src-head@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/svn-src-head > > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > > From owner-svn-src-all@freebsd.org Thu Dec 5 13:40:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A1201C9E87; Thu, 5 Dec 2019 13:40:11 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TH0B6H9Cz4Cq8; Thu, 5 Dec 2019 13:40:10 +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 B64C619A79; Thu, 5 Dec 2019 13:40:10 +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 xB5DeAnY085497; Thu, 5 Dec 2019 13:40:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5DeAsW085496; Thu, 5 Dec 2019 13:40:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912051340.xB5DeAsW085496@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Dec 2019 13:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355414 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 13:40:11 -0000 Author: mjg Date: Thu Dec 5 13:40:10 2019 New Revision: 355414 URL: https://svnweb.freebsd.org/changeset/base/355414 Log: vfs: remove 'active' variable from _vdrop No functional changes. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Thu Dec 5 13:20:15 2019 (r355413) +++ head/sys/kern/vfs_subr.c Thu Dec 5 13:40:10 2019 (r355414) @@ -3154,7 +3154,6 @@ _vdrop(struct vnode *vp, bool locked) { struct bufobj *bo; struct mount *mp; - int active; if (locked) ASSERT_VI_LOCKED(vp, __func__); @@ -3185,13 +3184,12 @@ _vdrop(struct vnode *vp, bool locked) ("vnode already free")); VNASSERT(vp->v_holdcnt == 0, vp, ("vdropl: freeing when we shouldn't")); - active = vp->v_iflag & VI_ACTIVE; if ((vp->v_iflag & VI_OWEINACT) == 0) { - vp->v_iflag &= ~VI_ACTIVE; mp = vp->v_mount; if (mp != NULL) { mtx_lock(&mp->mnt_listmtx); - if (active) { + if (vp->v_iflag & VI_ACTIVE) { + vp->v_iflag &= ~VI_ACTIVE; TAILQ_REMOVE(&mp->mnt_activevnodelist, vp, v_actfreelist); mp->mnt_activevnodelistsize--; @@ -3207,7 +3205,7 @@ _vdrop(struct vnode *vp, bool locked) vnlru_return_batch_locked(mp); mtx_unlock(&mp->mnt_listmtx); } else { - VNASSERT(active == 0, vp, + VNASSERT((vp->v_iflag & VI_ACTIVE) == 0, vp, ("vdropl: active vnode not on per mount " "vnode list")); mtx_lock(&vnode_free_list_mtx); From owner-svn-src-all@freebsd.org Thu Dec 5 13:41:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D2DC51CA056; Thu, 5 Dec 2019 13:41:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TH1Z5DfLz4D1P; Thu, 5 Dec 2019 13:41:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96CA019AC0; Thu, 5 Dec 2019 13:41:22 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5DfMVO087837; Thu, 5 Dec 2019 13:41:22 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5DfMdc087836; Thu, 5 Dec 2019 13:41:22 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912051341.xB5DfMdc087836@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Dec 2019 13:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355415 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 355415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 13:41:22 -0000 Author: mjg Date: Thu Dec 5 13:41:22 2019 New Revision: 355415 URL: https://svnweb.freebsd.org/changeset/base/355415 Log: nullfs: locklessly check for entries in null_hashget During random sampling over poudriere -j 104 over 10% of calls returned NULL. Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Thu Dec 5 13:40:10 2019 (r355414) +++ head/sys/fs/nullfs/null_subr.c Thu Dec 5 13:41:22 2019 (r355415) @@ -113,6 +113,8 @@ null_hashget(mp, lowervp) * reference count (but NOT the lower vnode's VREF counter). */ hd = NULL_NHASH(lowervp); + if (LIST_EMPTY(hd)) + return (NULLVP); rw_rlock(&null_hash_lock); LIST_FOREACH(a, hd, null_hash) { if (a->null_lowervp == lowervp && NULLTOV(a)->v_mount == mp) { From owner-svn-src-all@freebsd.org Thu Dec 5 13:43:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 864DE1CA10B; Thu, 5 Dec 2019 13:43:45 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TH4K30gTz4DJv; Thu, 5 Dec 2019 13:43:45 +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 4AB4919C45; Thu, 5 Dec 2019 13:43:45 +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 xB5Dhjie090823; Thu, 5 Dec 2019 13:43:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Dhj4G090822; Thu, 5 Dec 2019 13:43:45 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912051343.xB5Dhj4G090822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 5 Dec 2019 13:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355416 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 13:43:45 -0000 Author: mjg Date: Thu Dec 5 13:43:44 2019 New Revision: 355416 URL: https://svnweb.freebsd.org/changeset/base/355416 Log: sx: check for SX_LOCK_SHARED | SX_LOCK_WRITE_SPINNER when exclusive-locking First, this removes a spurious difference compared to rw locks. More importantly though this avoids a trip through sleepq code if the lock happens to be caught in this state. Modified: head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Thu Dec 5 13:41:22 2019 (r355415) +++ head/sys/kern/kern_sx.c Thu Dec 5 13:43:44 2019 (r355416) @@ -661,6 +661,12 @@ _sx_xlock_hard(struct sx *sx, uintptr_t x, int opts LO lda.spin_cnt++; #endif #ifdef ADAPTIVE_SX + if (x == (SX_LOCK_SHARED | SX_LOCK_WRITE_SPINNER)) { + if (atomic_fcmpset_acq_ptr(&sx->sx_lock, &x, tid)) + break; + continue; + } + /* * If the lock is write locked and the owner is * running on another CPU, spin until the owner stops From owner-svn-src-all@freebsd.org Thu Dec 5 14:50:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 287B11CB2B2; Thu, 5 Dec 2019 14:50:47 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TJYg0JB2z4Gv3; Thu, 5 Dec 2019 14:50:47 +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 E2FFF1A77F; Thu, 5 Dec 2019 14:50:46 +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 xB5EokLT028395; Thu, 5 Dec 2019 14:50:46 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Eokl2028393; Thu, 5 Dec 2019 14:50:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051450.xB5Eokl2028393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 14:50: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: r355417 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 355417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 14:50:47 -0000 Author: hselasky Date: Thu Dec 5 14:50:46 2019 New Revision: 355417 URL: https://svnweb.freebsd.org/changeset/base/355417 Log: MFC r355108 and r355170: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 Sponsored by: Mellanox Technologies Modified: stable/12/sys/kern/kern_linker.c stable/12/sys/kern/subr_firmware.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_linker.c ============================================================================== --- stable/12/sys/kern/kern_linker.c Thu Dec 5 13:43:44 2019 (r355416) +++ stable/12/sys/kern/kern_linker.c Thu Dec 5 14:50:46 2019 (r355417) @@ -2061,14 +2061,18 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module Modified: stable/12/sys/kern/subr_firmware.c ============================================================================== --- stable/12/sys/kern/subr_firmware.c Thu Dec 5 13:43:44 2019 (r355416) +++ stable/12/sys/kern/subr_firmware.c Thu Dec 5 14:50:46 2019 (r355417) @@ -257,7 +257,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -267,11 +266,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", From owner-svn-src-all@freebsd.org Thu Dec 5 14:52:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AE891CB588; Thu, 5 Dec 2019 14:52: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TJbC0v5Dz4H9K; Thu, 5 Dec 2019 14:52: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 022AC1A911; Thu, 5 Dec 2019 14:52:07 +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 xB5Eq62v029227; Thu, 5 Dec 2019 14:52:06 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Eq6CI029226; Thu, 5 Dec 2019 14:52:06 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051452.xB5Eq6CI029226@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 14:52:06 +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: r355418 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 355418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 14:52:07 -0000 Author: hselasky Date: Thu Dec 5 14:52:06 2019 New Revision: 355418 URL: https://svnweb.freebsd.org/changeset/base/355418 Log: MFC r355108 and r355170: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 Sponsored by: Mellanox Technologies Modified: stable/11/sys/kern/kern_linker.c stable/11/sys/kern/subr_firmware.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_linker.c ============================================================================== --- stable/11/sys/kern/kern_linker.c Thu Dec 5 14:50:46 2019 (r355417) +++ stable/11/sys/kern/kern_linker.c Thu Dec 5 14:52:06 2019 (r355418) @@ -2022,14 +2022,18 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module Modified: stable/11/sys/kern/subr_firmware.c ============================================================================== --- stable/11/sys/kern/subr_firmware.c Thu Dec 5 14:50:46 2019 (r355417) +++ stable/11/sys/kern/subr_firmware.c Thu Dec 5 14:52:06 2019 (r355418) @@ -255,7 +255,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -265,11 +264,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", From owner-svn-src-all@freebsd.org Thu Dec 5 14:53:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83AAB1CB6BB; Thu, 5 Dec 2019 14:53:47 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TJd72vgCz4HTM; Thu, 5 Dec 2019 14:53:47 +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 2E6D31A943; Thu, 5 Dec 2019 14:53:47 +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 xB5Erlp1032240; Thu, 5 Dec 2019 14:53:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5ErkcH032239; Thu, 5 Dec 2019 14:53:46 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051453.xB5ErkcH032239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 14:53:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r355419 - stable/10/sys/kern X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/10/sys/kern X-SVN-Commit-Revision: 355419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 14:53:47 -0000 Author: hselasky Date: Thu Dec 5 14:53:46 2019 New Revision: 355419 URL: https://svnweb.freebsd.org/changeset/base/355419 Log: MFC r355108 and r355170: Fix panic when loading kernel modules before root file system is mounted. Make sure the rootvnode is always NULL checked. Differential Revision: https://reviews.freebsd.org/D22545 PR: 241639 Sponsored by: Mellanox Technologies Modified: stable/10/sys/kern/kern_linker.c stable/10/sys/kern/subr_firmware.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_linker.c ============================================================================== --- stable/10/sys/kern/kern_linker.c Thu Dec 5 14:52:06 2019 (r355418) +++ stable/10/sys/kern/kern_linker.c Thu Dec 5 14:53:46 2019 (r355419) @@ -2000,14 +2000,18 @@ linker_load_module(const char *kldname, const char *mo */ KASSERT(verinfo == NULL, ("linker_load_module: verinfo" " is not NULL")); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); pathname = linker_search_kld(kldname); } else { if (modlist_lookup2(modname, verinfo) != NULL) return (EEXIST); + /* check if root file system is not mounted */ + if (rootvnode == NULL || curproc->p_fd->fd_rdir == NULL) + return (ENXIO); if (kldname != NULL) pathname = strdup(kldname, M_LINKER); - else if (rootvnode == NULL) - pathname = NULL; else /* * Need to find a KLD with required module Modified: stable/10/sys/kern/subr_firmware.c ============================================================================== --- stable/10/sys/kern/subr_firmware.c Thu Dec 5 14:52:06 2019 (r355418) +++ stable/10/sys/kern/subr_firmware.c Thu Dec 5 14:53:46 2019 (r355419) @@ -255,7 +255,6 @@ firmware_unregister(const char *imagename) static void loadimage(void *arg, int npending) { - struct thread *td = curthread; char *imagename = arg; struct priv_fw *fp; linker_file_t result; @@ -265,11 +264,6 @@ loadimage(void *arg, int npending) mtx_lock(&firmware_mtx); mtx_unlock(&firmware_mtx); - if (td->td_proc->p_fd->fd_rdir == NULL) { - printf("%s: root not mounted yet, no way to load image\n", - imagename); - goto done; - } error = linker_reference_module(imagename, NULL, &result); if (error != 0) { printf("%s: could not load firmware image, error %d\n", From owner-svn-src-all@freebsd.org Thu Dec 5 15:07:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AE661CBBA3; Thu, 5 Dec 2019 15:07:34 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TJx23c8Gz4J7l; Thu, 5 Dec 2019 15:07:34 +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 5F1BF1AB59; Thu, 5 Dec 2019 15:07:34 +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 xB5F7Ybo038381; Thu, 5 Dec 2019 15:07:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5F7WtS038374; Thu, 5 Dec 2019 15:07:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912051507.xB5F7WtS038374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 5 Dec 2019 15:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355420 - in head/sys/geom: . mirror part X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/geom: . mirror part X-SVN-Commit-Revision: 355420 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 15:07:34 -0000 Author: mav Date: Thu Dec 5 15:07:32 2019 New Revision: 355420 URL: https://svnweb.freebsd.org/changeset/base/355420 Log: Remove duplicate g_debugflags declaration. While there, define G_F_FOOTSHOOTING instead of numeric constants. MFC after: 13 days X-MFX-with: r355412 Modified: head/sys/geom/geom.h head/sys/geom/geom_int.h head/sys/geom/geom_subr.c head/sys/geom/mirror/g_mirror_ctl.c head/sys/geom/part/g_part.c head/sys/geom/part/g_part_mbr.c head/sys/geom/part/g_part_vtoc8.c Modified: head/sys/geom/geom.h ============================================================================== --- head/sys/geom/geom.h Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/geom.h Thu Dec 5 15:07:32 2019 (r355420) @@ -256,10 +256,13 @@ struct g_provider *g_dev_getprovider(struct cdev *dev) /* geom_dump.c */ void (g_trace)(int level, const char *, ...) __printflike(2, 3); -# define G_T_TOPOLOGY 1 -# define G_T_BIO 2 -# define G_T_ACCESS 4 +#define G_T_TOPOLOGY 0x01 +#define G_T_BIO 0x02 +#define G_T_ACCESS 0x04 extern int g_debugflags; +#define G_F_FOOTSHOOTING 0x10 +#define G_F_DISKIOCTL 0x40 +#define G_F_CTLDUMP 0x80 #define g_trace(level, fmt, ...) do { \ if (__predict_false(g_debugflags & (level))) \ (g_trace)(level, fmt, ## __VA_ARGS__); \ Modified: head/sys/geom/geom_int.h ============================================================================== --- head/sys/geom/geom_int.h Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/geom_int.h Thu Dec 5 15:07:32 2019 (r355420) @@ -44,18 +44,6 @@ extern int g_collectstats; #define G_STATS_PROVIDERS 1 /* Collect I/O stats for providers */ #define G_STATS_CONSUMERS 2 /* Collect I/O stats for consumers */ -extern int g_debugflags; -/* - * 1 G_T_TOPOLOGY - * 2 G_T_BIO - * 4 G_T_ACCESS - * 8 (unused) - * 16 Allow footshooting on rank#1 providers - * 32 G_T_DETAILS - */ -#define G_F_DISKIOCTL 64 -#define G_F_CTLDUMP 128 - /* geom_dump.c */ void g_confxml(void *, int flag); void g_conf_specific(struct sbuf *sb, struct g_class *mp, struct g_geom *gp, struct g_provider *pp, struct g_consumer *cp); Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/geom_subr.c Thu Dec 5 15:07:32 2019 (r355420) @@ -983,7 +983,7 @@ g_access(struct g_consumer *cp, int dcr, int dcw, int pp, pp->name); /* If foot-shooting is enabled, any open on rank#1 is OK */ - if ((g_debugflags & 16) && gp->rank == 1) + if ((g_debugflags & G_F_FOOTSHOOTING) && gp->rank == 1) ; /* If we try exclusive but already write: fail */ else if (dce > 0 && pw > 0) Modified: head/sys/geom/mirror/g_mirror_ctl.c ============================================================================== --- head/sys/geom/mirror/g_mirror_ctl.c Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/mirror/g_mirror_ctl.c Thu Dec 5 15:07:32 2019 (r355420) @@ -853,7 +853,7 @@ g_mirror_ctl_resize(struct gctl_req *req, struct g_cla return; } /* Deny shrinking of an opened provider */ - if ((g_debugflags & 16) == 0 && sc->sc_provider_open > 0) { + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && sc->sc_provider_open > 0) { if (sc->sc_mediasize > mediasize) { gctl_error(req, "Device %s is busy.", sc->sc_provider->name); Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/part/g_part.c Thu Dec 5 15:07:32 2019 (r355420) @@ -1383,7 +1383,7 @@ g_part_ctl_resize(struct gctl_req *req, struct g_part_ } pp = entry->gpe_pp; - if ((g_debugflags & 16) == 0 && + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && (pp->acr > 0 || pp->acw > 0 || pp->ace > 0)) { if (entry->gpe_end - entry->gpe_start + 1 > gpp->gpp_size) { /* Deny shrinking of an opened partition. */ Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/part/g_part_mbr.c Thu Dec 5 15:07:32 2019 (r355420) @@ -381,7 +381,7 @@ g_part_mbr_resize(struct g_part_table *basetable, return (EINVAL); /* XXX: prevent unexpected shrinking. */ pp = baseentry->gpe_pp; - if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && size < gpp->gpp_size && pp->mediasize / pp->sectorsize > size) return (EBUSY); entry = (struct g_part_mbr_entry *)baseentry; Modified: head/sys/geom/part/g_part_vtoc8.c ============================================================================== --- head/sys/geom/part/g_part_vtoc8.c Thu Dec 5 14:53:46 2019 (r355419) +++ head/sys/geom/part/g_part_vtoc8.c Thu Dec 5 15:07:32 2019 (r355420) @@ -373,7 +373,7 @@ g_part_vtoc8_resize(struct g_part_table *basetable, return (EINVAL); /* XXX: prevent unexpected shrinking. */ pp = entry->gpe_pp; - if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && + if ((g_debugflags & G_F_FOOTSHOOTING) == 0 && size < gpp->gpp_size && pp->mediasize / pp->sectorsize > size) return (EBUSY); entry->gpe_end = entry->gpe_start + size - 1; From owner-svn-src-all@freebsd.org Thu Dec 5 15:16:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1D161CBE03; Thu, 5 Dec 2019 15:16:21 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TK795yVDz4JY6; Thu, 5 Dec 2019 15:16:21 +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 AF9C91AD25; Thu, 5 Dec 2019 15:16:21 +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 xB5FGLPE044490; Thu, 5 Dec 2019 15:16:21 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5FGJbT044480; Thu, 5 Dec 2019 15:16:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912051516.xB5FGJbT044480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 5 Dec 2019 15:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355421 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf dev/mlx5 dev/mlx5/mlx5_core dev/mlx5/mlx5_en modules/mlx5 X-SVN-Commit-Revision: 355421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 15:16:21 -0000 Author: hselasky Date: Thu Dec 5 15:16:19 2019 New Revision: 355421 URL: https://svnweb.freebsd.org/changeset/base/355421 Log: Add basic support for TCP/IP based hardware TLS offload to mlx5core. The hardware offload is primarily targeted for TLS v1.2 and v1.3, using AES 128/256 bit pre-shared keys. This patch adds all the needed hardware structures, capabilites and firmware commands. Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_core/mlx5_tls.c (contents, props changed) head/sys/dev/mlx5/tls.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c head/sys/dev/mlx5/mlx5_core/mlx5_fw.c head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_ifc.h head/sys/modules/mlx5/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/conf/files Thu Dec 5 15:16:19 2019 (r355421) @@ -4756,6 +4756,8 @@ dev/mlx5/mlx5_core/mlx5_rl.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_srq.c optional mlx5 pci \ compile-with "${OFED_C}" +dev/mlx5/mlx5_core/mlx5_tls.c optional mlx5 pci \ + compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_transobj.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_uar.c optional mlx5 pci \ Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/dev/mlx5/device.h Thu Dec 5 15:16:19 2019 (r355421) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2018, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -382,6 +382,18 @@ enum { }; enum { + MLX5_OPCODE_MOD_UMR_UMR = 0x0, + MLX5_OPCODE_MOD_UMR_TLS_TIS_STATIC_PARAMS = 0x1, + MLX5_OPCODE_MOD_UMR_TLS_TIR_STATIC_PARAMS = 0x2, +}; + +enum { + MLX5_OPCODE_MOD_PSV_PSV = 0x0, + MLX5_OPCODE_MOD_PSV_TLS_TIS_PROGRESS_PARAMS = 0x1, + MLX5_OPCODE_MOD_PSV_TLS_TIR_PROGRESS_PARAMS = 0x2, +}; + +enum { MLX5_SET_PORT_RESET_QKEY = 0, MLX5_SET_PORT_GUID0 = 16, MLX5_SET_PORT_NODE_GUID = 17, @@ -919,6 +931,10 @@ enum mlx5_cap_type { MLX5_CAP_VECTOR_CALC, MLX5_CAP_QOS, MLX5_CAP_DEBUG, + MLX5_CAP_NVME, + MLX5_CAP_DMC, + MLX5_CAP_DEC, + MLX5_CAP_TLS, /* NUM OF CAP Types */ MLX5_CAP_NUM }; @@ -951,6 +967,9 @@ enum mlx5_mcam_feature_groups { #define MLX5_CAP_GEN(mdev, cap) \ MLX5_GET(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap) +#define MLX5_CAP_GEN_64(mdev, cap) \ + MLX5_GET64(cmd_hca_cap, mdev->hca_caps_cur[MLX5_CAP_GENERAL], cap) + #define MLX5_CAP_GEN_MAX(mdev, cap) \ MLX5_GET(cmd_hca_cap, mdev->hca_caps_max[MLX5_CAP_GENERAL], cap) @@ -1075,6 +1094,9 @@ enum mlx5_mcam_feature_groups { #define MLX5_CAP64_FPGA(mdev, cap) \ MLX5_GET64(fpga_cap, (mdev)->caps.fpga, cap) + +#define MLX5_CAP_TLS(mdev, cap) \ + MLX5_GET(tls_capabilities, (mdev)->hca_caps_cur[MLX5_CAP_TLS], cap) enum { MLX5_CMD_STAT_OK = 0x0, Modified: head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/dev/mlx5/mlx5_core/mlx5_cmd.c Thu Dec 5 15:16:19 2019 (r355421) @@ -361,6 +361,7 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor case MLX5_CMD_OP_MODIFY_FLOW_TABLE: case MLX5_CMD_OP_SET_FLOW_TABLE_ENTRY: case MLX5_CMD_OP_SET_FLOW_TABLE_ROOT: + case MLX5_CMD_OP_DESTROY_GENERAL_OBJ: return MLX5_CMD_STAT_OK; case MLX5_CMD_OP_QUERY_HCA_CAP: @@ -459,6 +460,9 @@ static int mlx5_internal_err_ret_value(struct mlx5_cor case MLX5_CMD_OP_CREATE_FLOW_GROUP: case MLX5_CMD_OP_QUERY_FLOW_GROUP: case MLX5_CMD_OP_QUERY_FLOW_TABLE_ENTRY: + case MLX5_CMD_OP_CREATE_GENERAL_OBJ: + case MLX5_CMD_OP_MODIFY_GENERAL_OBJ: + case MLX5_CMD_OP_QUERY_GENERAL_OBJ: *status = MLX5_DRIVER_STATUS_ABORTED; *synd = MLX5_DRIVER_SYND; return -EIO; @@ -606,6 +610,10 @@ const char *mlx5_command_str(int command) MLX5_COMMAND_STR_CASE(DELETE_FLOW_TABLE_ENTRY); MLX5_COMMAND_STR_CASE(SET_DIAGNOSTICS); MLX5_COMMAND_STR_CASE(QUERY_DIAGNOSTICS); + MLX5_COMMAND_STR_CASE(CREATE_GENERAL_OBJ); + MLX5_COMMAND_STR_CASE(MODIFY_GENERAL_OBJ); + MLX5_COMMAND_STR_CASE(QUERY_GENERAL_OBJ); + MLX5_COMMAND_STR_CASE(DESTROY_GENERAL_OBJ); default: return "unknown command opcode"; } } Modified: head/sys/dev/mlx5/mlx5_core/mlx5_fw.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/dev/mlx5/mlx5_core/mlx5_fw.c Thu Dec 5 15:16:19 2019 (r355421) @@ -227,6 +227,12 @@ int mlx5_query_hca_caps(struct mlx5_core_dev *dev) return err; } + if (MLX5_CAP_GEN(dev, tls)) { + err = mlx5_core_get_caps(dev, MLX5_CAP_TLS); + if (err) + return err; + } + err = mlx5_core_query_special_contexts(dev); if (err) return err; Added: head/sys/dev/mlx5/mlx5_core/mlx5_tls.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_core/mlx5_tls.c Thu Dec 5 15:16:19 2019 (r355421) @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2019, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +#include +#include +#include + +#include "mlx5_core.h" +#include "transobj.h" + +int mlx5_encryption_key_create(struct mlx5_core_dev *mdev, u32 pdn, + const void *p_key, u32 key_len, u32 *p_obj_id) +{ + u32 in[MLX5_ST_SZ_DW(create_encryption_key_in)] = {}; + u32 out[MLX5_ST_SZ_DW(create_encryption_key_out)] = {}; + u64 general_obj_types; + int err; + + general_obj_types = MLX5_CAP_GEN_64(mdev, general_obj_types); + if (!(general_obj_types & MLX5_HCA_CAP_GENERAL_OBJ_TYPES_ENCRYPTION_KEY)) + return -EINVAL; + + switch (key_len) { + case 128 / 8: + memcpy(MLX5_ADDR_OF(create_encryption_key_in, in, + encryption_key_object.key[4]), p_key, 128 / 8); + MLX5_SET(create_encryption_key_in, in, encryption_key_object.pd, pdn); + MLX5_SET(create_encryption_key_in, in, encryption_key_object.key_size, + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_128); + MLX5_SET(create_encryption_key_in, in, encryption_key_object.key_type, + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK); + break; + case 256 / 8: + memcpy(MLX5_ADDR_OF(create_encryption_key_in, in, + encryption_key_object.key[0]), p_key, 256 / 8); + MLX5_SET(create_encryption_key_in, in, encryption_key_object.pd, pdn); + MLX5_SET(create_encryption_key_in, in, encryption_key_object.key_size, + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_256); + MLX5_SET(create_encryption_key_in, in, encryption_key_object.key_type, + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK); + break; + default: + return -EINVAL; + } + + MLX5_SET(create_encryption_key_in, in, opcode, MLX5_CMD_OP_CREATE_GENERAL_OBJ); + MLX5_SET(create_encryption_key_in, in, obj_type, MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY); + + err = mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); + if (err == 0) + *p_obj_id = MLX5_GET(create_encryption_key_out, out, obj_id); + + /* avoid leaking key on the stack */ + memset(in, 0, sizeof(in)); + + return err; +} + +int mlx5_encryption_key_destroy(struct mlx5_core_dev *mdev, u32 oid) +{ + u32 in[MLX5_ST_SZ_DW(destroy_encryption_key_in)] = {}; + u32 out[MLX5_ST_SZ_DW(destroy_encryption_key_out)] = {}; + + MLX5_SET(destroy_encryption_key_in, in, opcode, MLX5_CMD_OP_DESTROY_GENERAL_OBJ); + MLX5_SET(destroy_encryption_key_in, in, obj_type, MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY); + MLX5_SET(destroy_encryption_key_in, in, obj_id, oid); + + return mlx5_cmd_exec(mdev, in, sizeof(in), out, sizeof(out)); +} + +int mlx5_tls_open_tis(struct mlx5_core_dev *mdev, int tc, int tdn, int pdn, u32 *p_tisn) +{ + u32 in[MLX5_ST_SZ_DW(create_tis_in)] = {}; + void *tisc = MLX5_ADDR_OF(create_tis_in, in, ctx); + int err; + + MLX5_SET(tisc, tisc, prio, tc); + MLX5_SET(tisc, tisc, transport_domain, tdn); + MLX5_SET(tisc, tisc, tls_en, 1); + MLX5_SET(tisc, tisc, pd, pdn); + + err = mlx5_core_create_tis(mdev, in, sizeof(in), p_tisn); + if (err) + return (err); + else if (*p_tisn == 0) + return (-EINVAL); + else + return (0); /* success */ +} + +void mlx5_tls_close_tis(struct mlx5_core_dev *mdev, u32 tisn) +{ + + mlx5_core_destroy_tis(mdev, tisn); +} Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/dev/mlx5/mlx5_en/en.h Thu Dec 5 15:16:19 2019 (r355421) @@ -1059,6 +1059,17 @@ struct mlx5e_tx_wqe { struct mlx5_wqe_eth_seg eth; }; +struct mlx5e_tx_umr_wqe { + struct mlx5_wqe_ctrl_seg ctrl; + struct mlx5_wqe_umr_ctrl_seg umr; + uint8_t mkc[64]; +}; + +struct mlx5e_tx_psv_wqe { + struct mlx5_wqe_ctrl_seg ctrl; + struct mlx5_seg_set_psv psv; +}; + struct mlx5e_rx_wqe { struct mlx5_wqe_srq_next_seg next; struct mlx5_wqe_data_seg data[]; Modified: head/sys/dev/mlx5/mlx5_ifc.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ifc.h Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/dev/mlx5/mlx5_ifc.h Thu Dec 5 15:16:19 2019 (r355421) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2017, Mellanox Technologies, Ltd. All rights reserved. + * Copyright (c) 2013-2019, Mellanox Technologies, Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -63,6 +63,7 @@ enum { MLX5_EVENT_TYPE_NIC_VPORT_CHANGE = 0xd, MLX5_EVENT_TYPE_FPGA_ERROR = 0x20, MLX5_EVENT_TYPE_FPGA_QP_ERROR = 0x21, + MLX5_EVENT_TYPE_CODING_GENERAL_OBJ_EVENT = 0x27, }; enum { @@ -252,6 +253,11 @@ enum { MLX5_CMD_OP_FPGA_QUERY_QP = 0x962, MLX5_CMD_OP_FPGA_DESTROY_QP = 0x963, MLX5_CMD_OP_FPGA_QUERY_QP_COUNTERS = 0x964, + MLX5_CMD_OP_CREATE_GENERAL_OBJ = 0xa00, + MLX5_CMD_OP_MODIFY_GENERAL_OBJ = 0xa01, + MLX5_CMD_OP_QUERY_GENERAL_OBJ = 0xa02, + MLX5_CMD_OP_DESTROY_GENERAL_OBJ = 0xa03, + }; enum { @@ -269,6 +275,23 @@ enum { MLX5_ICMD_CMDS_OPCODE_ICMD_OPCODE_INIT_OCSD = 0xf004 }; +enum { + MLX5_GENERAL_OBJECT_TYPES_ENCRYPTION_KEY = 0xc, +}; + +enum { + MLX5_HCA_CAP_GENERAL_OBJ_TYPES_ENCRYPTION_KEY = 1 << 0xc, +}; + +enum { + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_128 = 0x0, + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_KEY_SIZE_256 = 0x1, +}; + +enum { + MLX5_GENERAL_OBJECT_TYPE_ENCRYPTION_KEY_TYPE_DEK = 0x1, +}; + struct mlx5_ifc_flow_table_fields_supported_bits { u8 outer_dmac[0x1]; u8 outer_smac[0x1]; @@ -1268,8 +1291,18 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_61[0x3]; u8 log_max_current_uc_list[0x5]; - u8 reserved_62[0x80]; + u8 general_obj_types[0x40]; + u8 reserved_at_440[0x8]; + u8 create_qp_start_hint[0x18]; + + u8 tls[0x1]; + u8 reserved_at_461[0x2]; + u8 log_max_uctx[0x5]; + u8 reserved_at_468[0x3]; + u8 log_max_umem[0x5]; + u8 max_num_eqs[0x10]; + u8 reserved_63[0x3]; u8 log_max_l2_table[0x5]; u8 reserved_64[0x8]; @@ -1287,7 +1320,13 @@ struct mlx5_ifc_cmd_hca_cap_bits { u8 reserved_67[0x10]; u8 log_max_atomic_size_dc[0x8]; - u8 reserved_68[0x1f]; + u8 reserved_at_5a0[0x13]; + u8 log_max_dek[0x5]; + u8 reserved_at_5b8[0x4]; + u8 mini_cqe_resp_stride_index[0x1]; + u8 cqe_128_always[0x1]; + u8 cqe_compression_128b[0x1]; + u8 cqe_compression[0x1]; u8 cqe_compression_timeout[0x10]; @@ -1332,6 +1371,16 @@ struct mlx5_ifc_rx_hash_field_select_bits { u8 selected_fields[0x1e]; }; +struct mlx5_ifc_tls_capabilities_bits { + u8 tls_1_2_aes_gcm_128[0x1]; + u8 tls_1_3_aes_gcm_128[0x1]; + u8 tls_1_2_aes_gcm_256[0x1]; + u8 tls_1_3_aes_gcm_256[0x1]; + u8 reserved_at_4[0x1c]; + + u8 reserved_at_20[0x7e0]; +}; + enum { MLX5_WQ_TYPE_LINKED_LIST = 0x0, MLX5_WQ_TYPE_CYCLIC = 0x1, @@ -2212,7 +2261,8 @@ struct mlx5_ifc_traffic_counter_bits { struct mlx5_ifc_tisc_bits { u8 strict_lag_tx_port_affinity[0x1]; - u8 reserved_at_1[0x3]; + u8 tls_en[0x1]; + u8 reserved_at_2[0x2]; u8 lag_tx_port_affinity[0x04]; u8 reserved_at_8[0x4]; @@ -2227,7 +2277,10 @@ struct mlx5_ifc_tisc_bits { u8 reserved_4[0x8]; u8 underlay_qpn[0x18]; - u8 reserved_5[0x3a0]; + u8 reserved_5[0x8]; + u8 pd[0x18]; + + u8 reserved_6[0x380]; }; enum { @@ -2255,7 +2308,8 @@ struct mlx5_ifc_tirc_bits { u8 reserved_0[0x20]; u8 disp_type[0x4]; - u8 reserved_1[0x1c]; + u8 tls_en[0x1]; + u8 reserved_at_25[0x1b]; u8 reserved_2[0x40]; @@ -2717,6 +2771,7 @@ union mlx5_ifc_hca_cap_union_bits { struct mlx5_ifc_snapshot_cap_bits snapshot_cap; struct mlx5_ifc_debug_cap_bits diagnostic_counters_cap; struct mlx5_ifc_qos_cap_bits qos_cap; + struct mlx5_ifc_tls_capabilities_bits tls_capabilities; u8 reserved_0[0x8000]; }; @@ -5956,6 +6011,24 @@ struct mlx5_ifc_get_dropped_packet_log_in_bits { u8 reserved_2[0x40]; }; +struct mlx5_ifc_encryption_key_obj_bits { + u8 modify_field_select[0x40]; + + u8 reserved_at_40[0x14]; + u8 key_size[0x4]; + u8 reserved_at_58[0x4]; + u8 key_type[0x4]; + + u8 reserved_at_60[0x8]; + u8 pd[0x18]; + + u8 reserved_at_80[0x180]; + + u8 key[8][0x20]; + + u8 reserved_at_300[0x500]; +}; + struct mlx5_ifc_gen_eqe_in_bits { u8 opcode[0x10]; u8 reserved_0[0x10]; @@ -6428,6 +6501,27 @@ struct mlx5_ifc_destroy_flow_group_in_bits { u8 reserved_6[0x120]; }; +struct mlx5_ifc_destroy_encryption_key_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 reserved_at_40[0x40]; +}; + +struct mlx5_ifc_destroy_encryption_key_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 obj_type[0x10]; + + u8 obj_id[0x20]; + + u8 reserved_at_60[0x20]; +}; + struct mlx5_ifc_destroy_eq_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -7257,6 +7351,29 @@ struct mlx5_ifc_create_flow_group_in_bits { u8 reserved_10[0xe00]; }; +struct mlx5_ifc_create_encryption_key_out_bits { + u8 status[0x8]; + u8 reserved_at_8[0x18]; + + u8 syndrome[0x20]; + + u8 obj_id[0x20]; + + u8 reserved_at_60[0x20]; +}; + +struct mlx5_ifc_create_encryption_key_in_bits { + u8 opcode[0x10]; + u8 reserved_at_10[0x10]; + + u8 reserved_at_20[0x10]; + u8 obj_type[0x10]; + + u8 reserved_at_40[0x40]; + + struct mlx5_ifc_encryption_key_obj_bits encryption_key_object; +}; + struct mlx5_ifc_create_eq_out_bits { u8 status[0x8]; u8 reserved_0[0x18]; @@ -9744,6 +9861,44 @@ struct mlx5_ifc_mtt_bits { u8 reserved_0[0x6]; u8 wr_en[0x1]; u8 rd_en[0x1]; +}; + +struct mlx5_ifc_tls_progress_params_bits { + u8 valid[0x1]; + u8 reserved_at_1[0x7]; + u8 pd[0x18]; + + u8 next_record_tcp_sn[0x20]; + + u8 hw_resync_tcp_sn[0x20]; + + u8 record_tracker_state[0x2]; + u8 auth_state[0x2]; + u8 reserved_at_64[0x4]; + u8 hw_offset_record_number[0x18]; +}; + +struct mlx5_ifc_tls_static_params_bits { + u8 const_2[0x2]; + u8 tls_version[0x4]; + u8 const_1[0x2]; + u8 reserved_at_8[0x14]; + u8 encryption_standard[0x4]; + + u8 reserved_at_20[0x20]; + + u8 initial_record_number[0x40]; + + u8 resync_tcp_sn[0x20]; + + u8 gcm_iv[0x20]; + + u8 implicit_iv[0x40]; + + u8 reserved_at_100[0x8]; + u8 dek_index[0x18]; + + u8 reserved_at_120[0xe0]; }; /* Vendor Specific Capabilities, VSC */ Added: head/sys/dev/mlx5/tls.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/tls.h Thu Dec 5 15:16:19 2019 (r355421) @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2019, Mellanox Technologies, Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 __MLX5_TLS_H__ +#define __MLX5_TLS_H__ + +struct mlx5_core_dev; + +int mlx5_encryption_key_create(struct mlx5_core_dev *mdev, u32 pdn, + const void *p_key, u32 key_len, u32 * p_obj_id); +int mlx5_encryption_key_destroy(struct mlx5_core_dev *mdev, u32 oid); +int mlx5_tls_open_tis(struct mlx5_core_dev *mdev, int tc, int tdn, int pdn, u32 *p_tisn); +void mlx5_tls_close_tis(struct mlx5_core_dev *mdev, u32 tisn); + +#endif /* __MLX5_TLS_H__ */ Modified: head/sys/modules/mlx5/Makefile ============================================================================== --- head/sys/modules/mlx5/Makefile Thu Dec 5 15:07:32 2019 (r355420) +++ head/sys/modules/mlx5/Makefile Thu Dec 5 15:16:19 2019 (r355421) @@ -26,6 +26,7 @@ mlx5_port.c \ mlx5_qp.c \ mlx5_rl.c \ mlx5_srq.c \ +mlx5_tls.c \ mlx5_transobj.c \ mlx5_uar.c \ mlx5_vport.c \ From owner-svn-src-all@freebsd.org Thu Dec 5 15:21:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 656141CC046; Thu, 5 Dec 2019 15:21:14 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TKDp23vsz4JtT; Thu, 5 Dec 2019 15:21:14 +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 2B87C1AD70; Thu, 5 Dec 2019 15:21:14 +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 xB5FLEZH046103; Thu, 5 Dec 2019 15:21:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5FLDVK046099; Thu, 5 Dec 2019 15:21:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912051521.xB5FLDVK046099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 5 Dec 2019 15:21:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355422 - in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/dev/mlx5: . mlx5_core mlx5_en X-SVN-Commit-Revision: 355422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 15:21:14 -0000 Author: kib Date: Thu Dec 5 15:21:13 2019 New Revision: 355422 URL: https://svnweb.freebsd.org/changeset/base/355422 Log: mlx5: Do not poke hardware for statistic after teardown is started. Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/driver.h head/sys/dev/mlx5/mlx5_core/mlx5_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Modified: head/sys/dev/mlx5/driver.h ============================================================================== --- head/sys/dev/mlx5/driver.h Thu Dec 5 15:16:19 2019 (r355421) +++ head/sys/dev/mlx5/driver.h Thu Dec 5 15:21:13 2019 (r355422) @@ -640,7 +640,8 @@ enum mlx5_device_state { }; enum mlx5_interface_state { - MLX5_INTERFACE_STATE_UP, + MLX5_INTERFACE_STATE_UP = 0x1, + MLX5_INTERFACE_STATE_TEARDOWN = 0x2, }; enum mlx5_pci_status { Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec 5 15:16:19 2019 (r355421) +++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Thu Dec 5 15:21:13 2019 (r355422) @@ -1606,6 +1606,8 @@ static void shutdown_one(struct pci_dev *pdev) /* enter polling mode */ mlx5_cmd_use_polling(dev); + set_bit(MLX5_INTERFACE_STATE_TEARDOWN, &dev->intf_state); + /* disable all interrupts */ mlx5_disable_interrupts(dev); Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 5 15:16:19 2019 (r355421) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c Thu Dec 5 15:21:13 2019 (r355422) @@ -1038,9 +1038,10 @@ mlx5e_update_stats_work(struct work_struct *work) { struct mlx5e_priv *priv; - priv = container_of(work, struct mlx5e_priv, update_stats_work); + priv = container_of(work, struct mlx5e_priv, update_stats_work); PRIV_LOCK(priv); - if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0) + if (test_bit(MLX5E_STATE_OPENED, &priv->state) != 0 && + !test_bit(MLX5_INTERFACE_STATE_TEARDOWN, &priv->mdev->intf_state)) mlx5e_update_stats_locked(priv); PRIV_UNLOCK(priv); } From owner-svn-src-all@freebsd.org Thu Dec 5 15:32:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1B9A1CC469; Thu, 5 Dec 2019 15:32:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TKTs6DH7z4KX0; Thu, 5 Dec 2019 15:32:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B90E91B0BF; Thu, 5 Dec 2019 15:32:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5FWXcj055707; Thu, 5 Dec 2019 15:32:33 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5FWX2U055706; Thu, 5 Dec 2019 15:32:33 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912051532.xB5FWX2U055706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 5 Dec 2019 15:32:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355423 - head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 355423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 15:32:34 -0000 Author: kevans Date: Thu Dec 5 15:32:33 2019 New Revision: 355423 URL: https://svnweb.freebsd.org/changeset/base/355423 Log: UPDATING: Add long-belated note about certs in base While the interaction between this and the ETCSYMLINK option of security/ca_root_nss isn't necessarily fatal, one should be aware and attempt to understand the ramifications of mixing the two. ports-secteam will be contacted to discuss the default option for branches where certs are being included in base. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Thu Dec 5 15:21:13 2019 (r355422) +++ head/UPDATING Thu Dec 5 15:32:33 2019 (r355423) @@ -26,6 +26,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191205: + The root certificates of the Mozilla CA Certificate Store have been + imported into the base system and can be managed with the certctl(8) + utility. If you have installed the security/ca_root_nss port or package + with the ETCSYMLINK option (the default), be advised that there may be + differences between those included in the port and those included in + base due to differences in nss branch used as well as general update + frequency. Note also that certctl(8) cannot manage certs in the + format used by the security/ca_root_nss port. + 20191120: The amd(8) automount daemon has been disabled by default, and will be removed in the future. As of FreeBSD 10.1 the autofs(5) is available From owner-svn-src-all@freebsd.org Thu Dec 5 15:36:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6A391CC672 for ; Thu, 5 Dec 2019 15:36:41 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TKZd4Vc9z4Ktn for ; Thu, 5 Dec 2019 15:36:41 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 6BEDB136D9 for ; Thu, 5 Dec 2019 15:36:41 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f49.google.com with SMTP id n8so1408702qvg.11 for ; Thu, 05 Dec 2019 07:36:41 -0800 (PST) X-Gm-Message-State: APjAAAVbHa4BKgnTyDH0a69QsU98BHawozsO2JksbM9+8V7F7yQoifTe guZGiKX2QhwZJpV1BjP7Tkc/ewQJWiEjwefp7EI= X-Received: by 2002:ad4:474b:: with SMTP id c11mt7789993qvx.181.1575560200906; Thu, 05 Dec 2019 07:36:40 -0800 (PST) MIME-Version: 1.0 References: <201912051532.xB5FWX2U055706@repo.freebsd.org> In-Reply-To: <201912051532.xB5FWX2U055706@repo.freebsd.org> From: Kyle Evans Date: Thu, 5 Dec 2019 09:36:29 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355423 - head Cc: src-committers , svn-src-all , svn-src-head , ports-secteam@freebsd.org, Jan Beich Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 15:36:41 -0000 On Thu, Dec 5, 2019 at 9:32 AM Kyle Evans wrote: > > Author: kevans > Date: Thu Dec 5 15:32:33 2019 > New Revision: 355423 > URL: https://svnweb.freebsd.org/changeset/base/355423 > > Log: > UPDATING: Add long-belated note about certs in base > > While the interaction between this and the ETCSYMLINK option of > security/ca_root_nss isn't necessarily fatal, one should be aware and > attempt to understand the ramifications of mixing the two. > > ports-secteam will be contacted to discuss the default option for branches > where certs are being included in base. > > Modified: > head/UPDATING > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Thu Dec 5 15:21:13 2019 (r355422) > +++ head/UPDATING Thu Dec 5 15:32:33 2019 (r355423) > @@ -26,6 +26,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20191205: > + The root certificates of the Mozilla CA Certificate Store have been > + imported into the base system and can be managed with the certctl(8) > + utility. If you have installed the security/ca_root_nss port or package > + with the ETCSYMLINK option (the default), be advised that there may be > + differences between those included in the port and those included in > + base due to differences in nss branch used as well as general update > + frequency. Note also that certctl(8) cannot manage certs in the > + format used by the security/ca_root_nss port. > + > 20191120: > The amd(8) automount daemon has been disabled by default, and will be > removed in the future. As of FreeBSD 10.1 the autofs(5) is available CC'ing ports-secteam@ and jbeich@- I think it would make sense and be A Good Thing(TM?) to go ahead and flip the default of ETCSYMLINK to "off" for -CURRENT/13.0 now that certs should be effectively managed in base and updated with etcupdate/mergemaster. Thoughts? Thanks, Kyle Evans From owner-svn-src-all@freebsd.org Thu Dec 5 16:17:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75DF61CD35D; Thu, 5 Dec 2019 16:17:57 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TLVF2MQLz4MtW; Thu, 5 Dec 2019 16:17:57 +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 352DA1B820; Thu, 5 Dec 2019 16:17:57 +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 xB5GHvA6080385; Thu, 5 Dec 2019 16:17:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5GHu63080384; Thu, 5 Dec 2019 16:17:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912051617.xB5GHu63080384@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 5 Dec 2019 16:17:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355424 - in head/release: arm arm64 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/release: arm arm64 X-SVN-Commit-Revision: 355424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 16:17:57 -0000 Author: kevans Date: Thu Dec 5 16:17:56 2019 New Revision: 355424 URL: https://svnweb.freebsd.org/changeset/base/355424 Log: release: chase ports r519089 (rpi-firmware update) The recent rpi-firmware update renamed "0" to "zero" in the RPi0 DTB filename It also included the components needed to boot the RPi4, so install those now -- interested parties can install sysutils/u-boot-rpi4 and copy config_rpi4.txt to config.txt on the FAT partition in order to boot the board. Do note that we currently don't support ethernet/usb/pci. Reviewed by: manu MFC after: 3 days Modified: head/release/arm/RPI-B.conf head/release/arm64/RPI3.conf Modified: head/release/arm/RPI-B.conf ============================================================================== --- head/release/arm/RPI-B.conf Thu Dec 5 15:32:33 2019 (r355423) +++ head/release/arm/RPI-B.conf Thu Dec 5 16:17:56 2019 (r355424) @@ -16,7 +16,7 @@ NODOC=1 UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi" RPI_FIRMWARE_DIR="/usr/local/share/rpi-firmware" OL_DIR="${RPI_FIRMWARE_DIR}/overlays" -OVERLAYS="mmc.dtbo pi3-disable-bt.dtbo" +OVERLAYS="mmc.dtbo disable-bt.dtbo" PART_SCHEME="MBR" export BOARDNAME="RPI-B" @@ -25,8 +25,8 @@ arm_install_uboot() { RPI_FIRMWARE_FILES="bootcode.bin config.txt \ fixup.dat fixup_cd.dat fixup_db.dat fixup_x.dat \ start.elf start_cd.elf start_db.elf start_x.elf \ - bcm2708-rpi-0-w.dtb bcm2708-rpi-b-plus.dtb bcm2708-rpi-b.dtb \ - bcm2708-rpi-cm.dtb" + bcm2708-rpi-zero-w.dtb bcm2708-rpi-b-plus.dtb \ + bcm2708-rpi-b.dtb bcm2708-rpi-cm.dtb" FATMOUNT="${DESTDIR%${KERNEL}}/fat" chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" chroot ${CHROOTDIR} mount_msdosfs /dev/${mddev}s1 ${FATMOUNT} Modified: head/release/arm64/RPI3.conf ============================================================================== --- head/release/arm64/RPI3.conf Thu Dec 5 15:32:33 2019 (r355423) +++ head/release/arm64/RPI3.conf Thu Dec 5 16:17:56 2019 (r355424) @@ -4,7 +4,7 @@ # DTB_DIR="/usr/local/share/rpi-firmware" -DTB="bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb" +DTB="bcm2710-rpi-3-b.dtb bcm2710-rpi-3-b-plus.dtb bcm2711-rpi-4-b.dtb" EMBEDDED_TARGET_ARCH="aarch64" EMBEDDED_TARGET="arm64" EMBEDDEDBUILD=1 @@ -16,14 +16,14 @@ KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 OL_DIR="${DTB_DIR}/overlays" -OVERLAYS="mmc.dtbo pwm.dtbo pi3-disable-bt.dtbo" +OVERLAYS="mmc.dtbo pwm.dtbo disable-bt.dtbo" PART_SCHEME="MBR" export BOARDNAME="RPI3" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi3" UBOOT_FILES="README u-boot.bin" - DTB_FILES="armstub8.bin bootcode.bin fixup_cd.dat \ + DTB_FILES="armstub8.bin armstub8-gic.bin bootcode.bin fixup_cd.dat \ fixup_db.dat fixup_x.dat fixup.dat LICENCE.broadcom \ start_cd.elf start_db.elf start_x.elf start.elf ${DTB}" FATMOUNT="${DESTDIR%${KERNEL}}fat" @@ -37,6 +37,8 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${_DF} \ ${FATMOUNT}/${_DF} done + chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi4.txt \ + ${FATMOUNT} chroot ${CHROOTDIR} cp -p ${DTB_DIR}/config_rpi3.txt \ ${FATMOUNT}/config.txt chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays From owner-svn-src-all@freebsd.org Thu Dec 5 16:47:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0390C1CDFD3; Thu, 5 Dec 2019 16:47:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TM846GzHz4PmS; Thu, 5 Dec 2019 16:47:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 08E7913EDA; Thu, 5 Dec 2019 16:47:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve To: rgrimes@freebsd.org, Vincenzo Maffione Cc: Ian Lepore , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912050535.xB55ZQxt042493@gndrsh.dnsmgr.net> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Thu, 5 Dec 2019 08:47:11 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <201912050535.xB55ZQxt042493@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 16:47:17 -0000 On 12/4/19 9:35 PM, Rodney W. Grimes wrote: >> I see, thanks for the pointers. >> It looks like cfmakeraw() and tcsetattr() were what I was looking for. >> A bhyve-specific printf wrapper looks the right solution to me. >> I can try to sketch a patch for you guys to review, if that's useful. >> >> Cheers, >> Vincenzo > > Meanwhile could you please revert the commit, and add a note to > D22552 to the effects that this was not the right solution? I don't think we have to revert as it isn't that big of a deal. Just fixing it going forward is probably fine. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Dec 5 16:49:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13A9A1CE0CF; Thu, 5 Dec 2019 16:49:49 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TMC06hVmz4Q1M; Thu, 5 Dec 2019 16:49:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-5.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 0775213EDE; Thu, 5 Dec 2019 16:49:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354754 - in head/sys: amd64/linux amd64/linux32 arm64/linux i386/linux To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201911152301.xAFN1hBM046422@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <82511db1-efe3-5ab2-5ca9-081e7065b11f@FreeBSD.org> Date: Thu, 5 Dec 2019 08:49:46 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 16:49:49 -0000 On 12/5/19 5:28 AM, Mateusz Guzik wrote: > On 11/16/19, John Baldwin wrote: >> Author: jhb >> Date: Fri Nov 15 23:01:43 2019 >> New Revision: 354754 >> URL: https://svnweb.freebsd.org/changeset/base/354754 >> >> Log: >> Use a sv_copyout_auxargs hook in the Linux ELF ABIs. >> > > This makes Linux binaries instantly segfault for me on amd64. > > You check: https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64-root.tar.xz > > I unpack this to tmpfs and chroot inside. Works without this commit. Yes, trasz@ has let me know and the issue is that I'm calculating the stack alignment wrong (doesn't factor in the variable number of argv and envv entries). It works for linux-base-c7 which is why my testing didn't catch it. arm64 linuxulator has a similar issue I think, and I actually have another use case to want to copy auxv later, so my plan is to rework this change to go back to statically allocating room for auxargs and invoking this callback at the end of copyout_strings passing in the address at the end of envv. I should be able to work on that today or tomorrow. -- John Baldwin From owner-svn-src-all@freebsd.org Thu Dec 5 16:50:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D11911CE17E; Thu, 5 Dec 2019 16:50:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TMDG5BVWz4Q91; Thu, 5 Dec 2019 16:50:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9629F1BDEA; Thu, 5 Dec 2019 16:50:54 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5GosA7098423; Thu, 5 Dec 2019 16:50:54 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Gosuf098422; Thu, 5 Dec 2019 16:50:54 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201912051650.xB5Gosuf098422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 5 Dec 2019 16:50:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355425 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 355425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 16:50:54 -0000 Author: kp Date: Thu Dec 5 16:50:54 2019 New Revision: 355425 URL: https://svnweb.freebsd.org/changeset/base/355425 Log: Remove useless NULL check Coverity points out that we've already dereferenced m by the time we check, so there's no reason to keep the check. Moreover, it's safe to pass NULL to m_freem() anyway. CID: 1019092 Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Dec 5 16:17:56 2019 (r355424) +++ head/sys/netinet6/udp6_usrreq.c Thu Dec 5 16:50:54 2019 (r355425) @@ -528,8 +528,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); badunlocked: - if (m) - m_freem(m); + m_freem(m); *mp = NULL; return (IPPROTO_DONE); } From owner-svn-src-all@freebsd.org Thu Dec 5 18:05:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DF571CF995; Thu, 5 Dec 2019 18:05:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-yw1-xc41.google.com (mail-yw1-xc41.google.com [IPv6:2607:f8b0:4864:20::c41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47TNt23FWSz4TKR; Thu, 5 Dec 2019 18:05:14 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-yw1-xc41.google.com with SMTP id 192so1584259ywy.0; Thu, 05 Dec 2019 10:05:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=FZ+i34y1tWVBLv/Js9FqA5kpD3n9G/iJj9V/MUwjnc8=; b=H0Po1HBSPACxGpDepiPMZtu19kkvOs//3wIKpKvSUw6APEapGE7KcY1BkEy1pkhJEM qdEcC0iv//pfLCPeggbPVO3iZZPhGJLPYkEEe+KS/2rlM8L3CxyuZZu5kjKaoHiUVrCA JxKxCYs9uF7VExGKIbUNhP5FdiFRu1gr9k70CXfvwDMBbSSHxJpkMYLJiwhlKqdommai q9TazfmO3voIFMX0LgA+ycYWZQ5GceCOUW0ib6meblhtJsPK2W2LyomIeXjoSfdLg+UU +8q0MrnvtQN0gyukSPeT12E4XeSMZ6+Y+XEz1GMtN2WkZYwTQeP/Fq+zgIgxx+iuaFPA 8ooQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=FZ+i34y1tWVBLv/Js9FqA5kpD3n9G/iJj9V/MUwjnc8=; b=ss99yz9eHJiPXBPtIJSW5fo+J8KZFWZX+N/eeTdCFuTn4e6vfbgcQWaLcmrqEy/Ueq t0wMrRqjLhw7CbGc5g6FD4NTQpU60tgw+ROTNK/aNFeGoKFt8LpRgaymTGhQBUHYm5MX YNIUUGxOHheJpFEEMX95XIJpJY4Is7TIsxymSdptiNOaHYyzFRUpVqwIVLDUIvM0/Lbb qw6VClnQq54UBcKWIVgc49Wby6y/1s2I9yIsaaNEJz+mEioYHmgE82XdvnA5p6Xh4LED VFEJ9SE/6BWv5nMkMSCWFgb5ymNY16V0+/2y0exRMSTwFQNM0UvggKGy0pmGKjjEy0aN pzpQ== X-Gm-Message-State: APjAAAVjEt1h/UI94U27d1WiD/1FU2NGbe2j+744TYaUCq3zq4kQHtrd VvUGwhyzuNlRxDypp//BWBk= X-Google-Smtp-Source: APXvYqyU+dR0Uxv8Rz0dS0jYr1KNeh/F85J3TEH0EkyxEE6Pbj+P6yjC0Q35ufuZyGu0XGWd5dA7Wg== X-Received: by 2002:a81:6205:: with SMTP id w5mr7009410ywb.72.1575569112850; Thu, 05 Dec 2019 10:05:12 -0800 (PST) Received: from ?IPv6:2607:fb90:f33c:c8b4:a999:6cdf:17f7:3d55? ([2607:fb90:f33c:c8b4:a999:6cdf:17f7:3d55]) by smtp.gmail.com with ESMTPSA id u81sm4684205ywa.17.2019.12.05.10.05.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Dec 2019 10:05:12 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r355407 - head/sys/fs/tmpfs Date: Thu, 5 Dec 2019 10:05:10 -0800 Message-Id: <80859C2E-1973-4E89-BAD2-5586CC683504@gmail.com> References: <20191205133544.GE2744@kib.kiev.ua> Cc: Kubilay Kocak , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <20191205133544.GE2744@kib.kiev.ua> To: Konstantin Belousov X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 47TNt23FWSz4TKR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=H0Po1HBS; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::c41 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; MV_CASE(0.50)[]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (1.55), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[1.4.c.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 18:05:15 -0000 > On Dec 5, 2019, at 05:36, Konstantin Belousov wrote:= ... >> Could you elaborate on the why/rationale? >>=20 >> Is there memory wastage/duplication, bug(s), performance or=20 >> development/maintenance benefit? > Each mount/unmount of tmpfs created and destroyed two zones, as it is > easy to see from the patch. Commit messages should provide helpful summaries of changes. Having to look a= t and understand the patch requires domain knowledge which the reader may or= may not have. Kubilay=E2=80=99s request seems valid to me. -Enji= From owner-svn-src-all@freebsd.org Thu Dec 5 18:16:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1221B1CFEE0 for ; Thu, 5 Dec 2019 18:16:04 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47TP6W4qhCz4V3C for ; Thu, 5 Dec 2019 18:16:03 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575569761; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=JjGFcct1oaiFH4PyJdII9vr2G7p7OUTG0bs8MdmUXOQgJ0Ec1yXhpycitkQWWdg5q0zeXEuDlN9yA kqpxR3Qp7y0elBzcfKoiHkup8ZkfiGL5CLVG6wCwgCHndNE+T3/8Pvs9p8T6lGswEMpA7tSNy1NFZT HqaLp/74Jq84aXo7olfPhJb8lOL4cMq06/Ufr/4h6Y9Ygr96GjjUBXevtyASypoAvOnvvxWaQZWZv3 XBfbWEFl+u6/eEZ3bemI291jMxBVa+0hN42UUVFlhFfvotbuXOMN12O/1xpwlQm2eBKmM92kPeA9LV gZj2cC4NAiT7v4nPVCMqlVvJgl9/aqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=byI02FFAuuBPCD5z+MwDdMDQrYvzLz5oq9XMWQ+wfoc=; b=aSVPKRHIw6bt9D9ssb8A7jllLmXCzjZQT/9+R3hPdwu3h2ZID/Vffs2mbhkaL2uhUxYVv0UsHSCm0 lRO9aT9zKh7DTAbPPJZt1aoVR9pQ5/NYao+l0Z+jJJzoetRFd3mteFjQWf58z4CwjuztpbIysL7Jtx qWftLR9VUDK/hHMOLnWO1TJKlJ4A0U8DkSvaA7B0CoGc15lPEzKRKoGThHpMaU61Yy6/wrBQ0vgRhC MiEigKET02mwUZ3NAqpEBHd53+8XNiFifqMInuC93Tf+RliOq+1UqviPvZ3jM8g/T227XMpZjHh1F0 vIv5915LgtmaovcEWoyLUfTQK/VWBMg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=byI02FFAuuBPCD5z+MwDdMDQrYvzLz5oq9XMWQ+wfoc=; b=sog+3nazyEp1wz/dB8Ilc7M3zgBio0Ic7ghiC7ozx54EfR+eoVJ301Kmrx1T+UpOkvi78Q7+f52Cv xvt+AxvOWQTfTnTqKh3FaHEjVEJZoHSkxNVdhwk/TDAeB8q9aTw7pd9g1Bzh1tvJtbl6nmhzyQPyjS fBRVBLpjZDRlCW65zzHwLqpgnMaTd0uYrgjN/pyFBzK9EbtN5k3yAeoreWj91CR31lhB/EogbYiHgo kK0KisxYYR5rdKlhFyjhdjG766QGOLmWQb5OKvqgMlT2yV2Gd++li65iW6gMKn9G1Lyl7t5D3bI0Bu kJaV1CfATChL6O99z7XT2VnOEMYavBw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 49692a5a-178b-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 49692a5a-178b-11ea-b80c-052b4a66b6b2; Thu, 05 Dec 2019 18:16:00 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB5IFwfr008118; Thu, 5 Dec 2019 11:15:58 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <2db52a541d0a48ec0e706de2fb4605749f9c4fa4.camel@freebsd.org> Subject: Re: svn commit: r355407 - head/sys/fs/tmpfs From: Ian Lepore To: Enji Cooper , Konstantin Belousov Cc: Kubilay Kocak , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 05 Dec 2019 11:15:58 -0700 In-Reply-To: <80859C2E-1973-4E89-BAD2-5586CC683504@gmail.com> References: <20191205133544.GE2744@kib.kiev.ua> <80859C2E-1973-4E89-BAD2-5586CC683504@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47TP6W4qhCz4V3C X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.96 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.98)[-0.982,0]; NEURAL_HAM_LONG(-0.98)[-0.981,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 18:16:04 -0000 On Thu, 2019-12-05 at 10:05 -0800, Enji Cooper wrote: > > On Dec 5, 2019, at 05:36, Konstantin Belousov > > wrote: > > ... > > > > Could you elaborate on the why/rationale? > > > > > > Is there memory wastage/duplication, bug(s), performance or > > > development/maintenance benefit? > > > > Each mount/unmount of tmpfs created and destroyed two zones, as it > > is > > easy to see from the patch. > > Commit messages should provide helpful summaries of changes. Having > to look at and understand the patch requires domain knowledge which > the reader may or may not have. Kubilay’s request seems valid to me. > > -Enji I agree. You read the diff to see the details of what changed. You read the commit message to see why. -- Ian From owner-svn-src-all@freebsd.org Thu Dec 5 18:47:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C78C61A8975; Thu, 5 Dec 2019 18:47:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TPpq4wBQz4WTn; Thu, 5 Dec 2019 18:47:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 879D81D39E; Thu, 5 Dec 2019 18:47:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5IlVTj069800; Thu, 5 Dec 2019 18:47:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5IlTmK069792; Thu, 5 Dec 2019 18:47:29 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912051847.xB5IlTmK069792@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Dec 2019 18:47:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355426 - in head/sys: dev/ahci dev/ata dev/mvs dev/siis net/altq powerpc/mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: dev/ahci dev/ata dev/mvs dev/siis net/altq powerpc/mpc85xx X-SVN-Commit-Revision: 355426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 18:47:31 -0000 Author: jhb Date: Thu Dec 5 18:47:29 2019 New Revision: 355426 URL: https://svnweb.freebsd.org/changeset/base/355426 Log: Use a void * argument to callout handlers instead of timeout_t casts. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22684 Modified: head/sys/dev/ahci/ahci.c head/sys/dev/ata/ata-all.c head/sys/dev/ata/ata-all.h head/sys/dev/ata/ata-lowlevel.c head/sys/dev/mvs/mvs.c head/sys/dev/siis/siis.c head/sys/net/altq/altq_rmclass.c head/sys/powerpc/mpc85xx/fsl_sata.c Modified: head/sys/dev/ahci/ahci.c ============================================================================== --- head/sys/dev/ahci/ahci.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/dev/ahci/ahci.c Thu Dec 5 18:47:29 2019 (r355426) @@ -67,7 +67,7 @@ static void ahci_ch_intr_main(struct ahci_channel *ch, static void ahci_begin_transaction(struct ahci_channel *ch, union ccb *ccb); static void ahci_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void ahci_execute_transaction(struct ahci_slot *slot); -static void ahci_timeout(struct ahci_slot *slot); +static void ahci_timeout(void *arg); static void ahci_end_transaction(struct ahci_slot *slot, enum ahci_err_type et); static int ahci_setup_fis(struct ahci_channel *ch, struct ahci_cmd_tab *ctp, union ccb *ccb, int tag); static void ahci_dmainit(device_t dev); @@ -1793,7 +1793,7 @@ ahci_execute_transaction(struct ahci_slot *slot) } /* Start command execution timeout */ callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout / 2, - 0, (timeout_t*)ahci_timeout, slot, 0); + 0, ahci_timeout, slot, 0); return; } @@ -1830,14 +1830,15 @@ ahci_rearm_timeout(struct ahci_channel *ch) continue; callout_reset_sbt(&slot->timeout, SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, - (timeout_t*)ahci_timeout, slot, 0); + ahci_timeout, slot, 0); } } /* Locked by callout mechanism. */ static void -ahci_timeout(struct ahci_slot *slot) +ahci_timeout(void *arg) { + struct ahci_slot *slot = arg; struct ahci_channel *ch = slot->ch; device_t dev = ch->dev; uint32_t sstatus; @@ -1864,7 +1865,7 @@ ahci_timeout(struct ahci_slot *slot) callout_reset_sbt(&slot->timeout, SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, - (timeout_t*)ahci_timeout, slot, 0); + ahci_timeout, slot, 0); return; } Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/dev/ata/ata-all.c Thu Dec 5 18:47:29 2019 (r355426) @@ -702,10 +702,12 @@ ata_atapi(device_t dev, int target) } void -ata_timeout(struct ata_request *request) +ata_timeout(void *arg) { + struct ata_request *request; struct ata_channel *ch; + request = arg; ch = device_get_softc(request->parent); //request->flags |= ATA_R_DEBUG; ATA_DEBUG_RQ(request, "timeout"); Modified: head/sys/dev/ata/ata-all.h ============================================================================== --- head/sys/dev/ata/ata-all.h Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/dev/ata/ata-all.h Thu Dec 5 18:47:29 2019 (r355426) @@ -477,7 +477,7 @@ const char *ata_mode2str(int mode); void ata_setmode(device_t dev); void ata_print_cable(device_t dev, u_int8_t *who); int ata_atapi(device_t dev, int target); -void ata_timeout(struct ata_request *); +void ata_timeout(void *); /* ata-lowlevel.c: */ void ata_generic_hw(device_t dev); Modified: head/sys/dev/ata/ata-lowlevel.c ============================================================================== --- head/sys/dev/ata/ata-lowlevel.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/dev/ata/ata-lowlevel.c Thu Dec 5 18:47:29 2019 (r355426) @@ -237,7 +237,7 @@ begin_finished: begin_continue: callout_reset(&request->callout, request->timeout * hz, - (timeout_t*)ata_timeout, request); + ata_timeout, request); return ATA_OP_CONTINUES; } Modified: head/sys/dev/mvs/mvs.c ============================================================================== --- head/sys/dev/mvs/mvs.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/dev/mvs/mvs.c Thu Dec 5 18:47:29 2019 (r355426) @@ -82,7 +82,7 @@ static void mvs_legacy_intr(device_t dev, int poll); static void mvs_crbq_intr(device_t dev); static void mvs_begin_transaction(device_t dev, union ccb *ccb); static void mvs_legacy_execute_transaction(struct mvs_slot *slot); -static void mvs_timeout(struct mvs_slot *slot); +static void mvs_timeout(void *arg); static void mvs_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void mvs_requeue_frozen(device_t dev); @@ -1418,7 +1418,7 @@ mvs_legacy_execute_transaction(struct mvs_slot *slot) } /* Start command execution timeout */ callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, - (timeout_t*)mvs_timeout, slot, 0); + mvs_timeout, slot, 0); } /* Must be called with channel locked. */ @@ -1532,7 +1532,7 @@ mvs_execute_transaction(struct mvs_slot *slot) ch->dma.workrq_bus + MVS_CRQB_OFFSET + (MVS_CRQB_SIZE * ch->out_idx)); /* Start command execution timeout */ callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, - (timeout_t*)mvs_timeout, slot, 0); + mvs_timeout, slot, 0); return; } @@ -1571,14 +1571,15 @@ mvs_rearm_timeout(device_t dev) continue; callout_reset_sbt(&slot->timeout, SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, - (timeout_t*)mvs_timeout, slot, 0); + mvs_timeout, slot, 0); } } /* Locked by callout mechanism. */ static void -mvs_timeout(struct mvs_slot *slot) +mvs_timeout(void *arg) { + struct mvs_slot *slot = arg; device_t dev = slot->dev; struct mvs_channel *ch = device_get_softc(dev); Modified: head/sys/dev/siis/siis.c ============================================================================== --- head/sys/dev/siis/siis.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/dev/siis/siis.c Thu Dec 5 18:47:29 2019 (r355426) @@ -72,7 +72,7 @@ static void siis_ch_led(void *priv, int onoff); static void siis_begin_transaction(device_t dev, union ccb *ccb); static void siis_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void siis_execute_transaction(struct siis_slot *slot); -static void siis_timeout(struct siis_slot *slot); +static void siis_timeout(void *arg); static void siis_end_transaction(struct siis_slot *slot, enum siis_err_type et); static int siis_setup_fis(device_t dev, struct siis_cmd *ctp, union ccb *ccb, int tag); static void siis_dmainit(device_t dev); @@ -1123,7 +1123,7 @@ siis_execute_transaction(struct siis_slot *slot) ATA_OUTL(ch->r_mem, SIIS_P_CACTH(slot->slot), prb_bus >> 32); /* Start command execution timeout */ callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout, 0, - (timeout_t*)siis_timeout, slot, 0); + siis_timeout, slot, 0); return; } @@ -1166,14 +1166,15 @@ siis_rearm_timeout(device_t dev) continue; callout_reset_sbt(&slot->timeout, SBT_1MS * slot->ccb->ccb_h.timeout, 0, - (timeout_t*)siis_timeout, slot, 0); + siis_timeout, slot, 0); } } /* Locked by callout mechanism. */ static void -siis_timeout(struct siis_slot *slot) +siis_timeout(void *arg) { + struct siis_slot *slot = arg; device_t dev = slot->dev; struct siis_channel *ch = device_get_softc(dev); union ccb *ccb = slot->ccb; Modified: head/sys/net/altq/altq_rmclass.c ============================================================================== --- head/sys/net/altq/altq_rmclass.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/net/altq/altq_rmclass.c Thu Dec 5 18:47:29 2019 (r355426) @@ -87,7 +87,7 @@ static mbuf_t *_rmc_pollq(rm_class_t *); static int rmc_under_limit(struct rm_class *, struct timeval *); static void rmc_tl_satisfied(struct rm_ifdat *, struct timeval *); static void rmc_drop_action(struct rm_class *); -static void rmc_restart(struct rm_class *); +static void rmc_restart(void *); static void rmc_root_overlimit(struct rm_class *, struct rm_class *); #define BORROW_OFFTIME @@ -1530,8 +1530,7 @@ rmc_delay_action(struct rm_class *cl, struct rm_class t = hzto(&cl->undertime_); } else t = 2; - CALLOUT_RESET(&cl->callout_, t, - (timeout_t *)rmc_restart, (caddr_t)cl); + CALLOUT_RESET(&cl->callout_, t, rmc_restart, cl); } } @@ -1553,8 +1552,9 @@ rmc_delay_action(struct rm_class *cl, struct rm_class */ static void -rmc_restart(struct rm_class *cl) +rmc_restart(void *arg) { + struct rm_class *cl = arg; struct rm_ifdat *ifd = cl->ifdat_; int s; Modified: head/sys/powerpc/mpc85xx/fsl_sata.c ============================================================================== --- head/sys/powerpc/mpc85xx/fsl_sata.c Thu Dec 5 16:50:54 2019 (r355425) +++ head/sys/powerpc/mpc85xx/fsl_sata.c Thu Dec 5 18:47:29 2019 (r355426) @@ -70,7 +70,7 @@ static void fsl_sata_intr_main(struct fsl_sata_channel static void fsl_sata_begin_transaction(struct fsl_sata_channel *ch, union ccb *ccb); static void fsl_sata_dmasetprd(void *arg, bus_dma_segment_t *segs, int nsegs, int error); static void fsl_sata_execute_transaction(struct fsl_sata_slot *slot); -static void fsl_sata_timeout(struct fsl_sata_slot *slot); +static void fsl_sata_timeout(void *arg); static void fsl_sata_end_transaction(struct fsl_sata_slot *slot, enum fsl_sata_err_type et); static int fsl_sata_setup_fis(struct fsl_sata_channel *ch, struct fsl_sata_cmd_tab *ctp, union ccb *ccb, int tag); static void fsl_sata_dmainit(device_t dev); @@ -1107,7 +1107,7 @@ fsl_sata_execute_transaction(struct fsl_sata_slot *slo } /* Start command execution timeout */ callout_reset_sbt(&slot->timeout, SBT_1MS * ccb->ccb_h.timeout / 2, - 0, (timeout_t*)fsl_sata_timeout, slot, 0); + 0, fsl_sata_timeout, slot, 0); return; } @@ -1144,14 +1144,15 @@ fsl_sata_rearm_timeout(struct fsl_sata_channel *ch) continue; callout_reset_sbt(&slot->timeout, SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, - (timeout_t*)fsl_sata_timeout, slot, 0); + fsl_sata_timeout, slot, 0); } } /* Locked by callout mechanism. */ static void -fsl_sata_timeout(struct fsl_sata_slot *slot) +fsl_sata_timeout(void *arg) { + struct fsl_sata_slot *slot = arg; struct fsl_sata_channel *ch = slot->ch; device_t dev = ch->dev; uint32_t sstatus; @@ -1169,7 +1170,7 @@ fsl_sata_timeout(struct fsl_sata_slot *slot) callout_reset_sbt(&slot->timeout, SBT_1MS * slot->ccb->ccb_h.timeout / 2, 0, - (timeout_t*)fsl_sata_timeout, slot, 0); + fsl_sata_timeout, slot, 0); return; } From owner-svn-src-all@freebsd.org Thu Dec 5 19:21:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 812DA1A94DF; Thu, 5 Dec 2019 19:21:36 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47TQZ72K5gz4Y0c; Thu, 5 Dec 2019 19:21:34 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB5JLT0M045372; Thu, 5 Dec 2019 11:21:30 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB5JLTMk045371; Thu, 5 Dec 2019 11:21:29 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912051921.xB5JLTMk045371@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve In-Reply-To: To: John Baldwin Date: Thu, 5 Dec 2019 11:21:29 -0800 (PST) CC: rgrimes@FreeBSD.org, Vincenzo Maffione , Ian Lepore , src-committers , svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Reply-To: rgrimes@FreeBSD.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47TQZ72K5gz4Y0c X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.05 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.519,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.37)[-0.366,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 19:21:36 -0000 > On 12/4/19 9:35 PM, Rodney W. Grimes wrote: > >> I see, thanks for the pointers. > >> It looks like cfmakeraw() and tcsetattr() were what I was looking for. > >> A bhyve-specific printf wrapper looks the right solution to me. > >> I can try to sketch a patch for you guys to review, if that's useful. > >> > >> Cheers, > >> Vincenzo > > > > Meanwhile could you please revert the commit, and add a note to > > D22552 to the effects that this was not the right solution? > > I don't think we have to revert as it isn't that big of a deal. Just > fixing it going forward is probably fine. I disagree. Not reverting this leads to a bunch of un-needed changes in the forward moving review, clouding the view of what is really being changed in that new review which is now a mix of undoing this and adding a new set of macros to deal with end of line. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Thu Dec 5 19:25:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 881951A98B5; Thu, 5 Dec 2019 19:25:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TQg239XQz4YMx; Thu, 5 Dec 2019 19:25:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F9F41DB24; Thu, 5 Dec 2019 19:25:50 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5JPopn093038; Thu, 5 Dec 2019 19:25:50 GMT (envelope-from alc@FreeBSD.org) Received: (from alc@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5JPoDY093037; Thu, 5 Dec 2019 19:25:50 GMT (envelope-from alc@FreeBSD.org) Message-Id: <201912051925.xB5JPoDY093037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: alc set sender to alc@FreeBSD.org using -f From: Alan Cox Date: Thu, 5 Dec 2019 19:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355427 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: alc X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 355427 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 19:25:50 -0000 Author: alc Date: Thu Dec 5 19:25:49 2019 New Revision: 355427 URL: https://svnweb.freebsd.org/changeset/base/355427 Log: On a context switch, handle the possibility that the old thread was preempted after an "ic" or "tlbi" instruction but before it performed a "dsb" instruction. The "ic" and "tlbi" instructions have unusual synchronization requirements. If the old thread migrates to a new processor, its completion of a "dsb" instruction on that new processor does not guarantee that the "ic" or "tlbi" instructions performed on the old processor have completed. This issue is not restricted to the kernel. Since locore.S sets the UCI bit in SCTLR, user-space programs can perform "ic ivau" instructions (as well as some forms of the "dc" instruction). Reviewed by: andrew, kib, markj, mmel X-MFC with: r355145 Differential Revision: https://reviews.freebsd.org/D22622 Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Dec 5 18:47:29 2019 (r355426) +++ head/sys/arm64/arm64/pmap.c Thu Dec 5 19:25:49 2019 (r355427) @@ -5850,8 +5850,18 @@ pmap_activate_int(pmap_t pmap) KASSERT(PCPU_GET(curpmap) != NULL, ("no active pmap")); KASSERT(pmap != kernel_pmap, ("kernel pmap activation")); - if (pmap == PCPU_GET(curpmap)) + if (pmap == PCPU_GET(curpmap)) { + /* + * Handle the possibility that the old thread was preempted + * after an "ic" or "tlbi" instruction but before it performed + * a "dsb" instruction. If the old thread migrates to a new + * processor, its completion of a "dsb" instruction on that + * new processor does not guarantee that the "ic" or "tlbi" + * instructions performed on the old processor have completed. + */ + dsb(ish); return (false); + } /* * Ensure that the store to curpmap is globally visible before the From owner-svn-src-all@freebsd.org Thu Dec 5 19:26:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 119DB1A99DC for ; Thu, 5 Dec 2019 19:26:01 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47TQgD69jmz4YXF for ; Thu, 5 Dec 2019 19:26:00 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575573959; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=HUyGIy0lwOYhxsy64CAVBoXDvzRcgy72jW6kHVhZj8JIuM/5pji9xDGBc+YVs4IhzcNZBYoWJWtE7 H+lPg+3izolVpdUUQMiJl46XpdwleYXefc6Jo026/glqvWqazmz++lPkg0kEIB2Y/ceBwwuIeyzgc1 6ayscfQNJmM/YVVSK++OAvCZK2eaLi6lJoJFNOb6JW3/cYpUWvq7uKvnaQHfzHMlBw+kPgB2flqk5H KLjF6mzs0M20xR0+KlbruzUExu5g29b+dKW7HVLGGw6+0pL/b+CaGJXA5dLuPC2DrrOVAXhZoX1A87 Fu7En0FvJZj7bQ8xtsEIE64/8eCyvvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=FTzEkFY5lec1ncDRzac7Em410katDo4T5ZLdv1XkYPo=; b=orEflsp2+VIv3N2exv8WSEj+wpVyS/XQ/SRdYATFXjr0E6v0ZreRcLpsRteJ0fHSpAY50Slnd9GWt UH+UJlRnIkU4TuD/tntzEOBU24Jpx24fYIiUNfNmQm7NG9X9CXkNVEjxhDt8sWwXIAxwo8pKzMyJY7 f12b6uMhNX6aIu7EjGF/0HDjnoiwVlyO+6xOWIeEvvB5UCXA4j+VpaPqHLWVXyaFtqB8UJrf8/eHKj 6lCp6bhHN0tQk/vYwCId12WsmqR4o3Pku3FSxp+zE7o6aoERjrMOWNtA4qa8HgS43dBBACQtS9fv8g p3hIkcbdzrcbhTU/7slV0laSifjO9UQ== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=FTzEkFY5lec1ncDRzac7Em410katDo4T5ZLdv1XkYPo=; b=ZJZ7eE1caeGqjwzPNPWtUy2+oB7k8KAlPb1bMKIcK/g865dvs0jzITk2lyloOtkpSRi6JmXXmEGGr FTxdmlFJYTUgiI9mDDvjtrC/2A2OZA/0+DQE2eHrKfKBowR2mm1oJs/VG+Mtpf5AdWJNrL1kXO855f niwWQInptmQpcggAqAjg1UIQCj88zELIWix4xZM2bQXxhBqGAM391iYU/bO85BEAAAwcN8tLIUFHDJ JKsW4qb7zsFgr5iFSyH+ODP8Uam4dwberbKHhaWy3V2b7E1Td8BknhZo+4OUUOT2DHY20MVzCm+jH8 cMwRkxXpeNYhVrve7Rrcnjyx/gnScEw== X-MHO-RoutePath: aGlwcGll X-MHO-User: 0ffa423f-1795-11ea-b80c-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 0ffa423f-1795-11ea-b80c-052b4a66b6b2; Thu, 05 Dec 2019 19:25:58 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB5JPvxe008340; Thu, 5 Dec 2019 12:25:57 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve From: Ian Lepore To: rgrimes@FreeBSD.org, John Baldwin Cc: Vincenzo Maffione , src-committers , svn-src-all@FreeBSD.org, svn-src-head@FreeBSD.org Date: Thu, 05 Dec 2019 12:25:57 -0700 In-Reply-To: <201912051921.xB5JLTMk045371@gndrsh.dnsmgr.net> References: <201912051921.xB5JLTMk045371@gndrsh.dnsmgr.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47TQgD69jmz4YXF X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.98)[-0.983,0]; NEURAL_HAM_LONG(-0.98)[-0.983,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 19:26:01 -0000 On Thu, 2019-12-05 at 11:21 -0800, Rodney W. Grimes wrote: > > On 12/4/19 9:35 PM, Rodney W. Grimes wrote: > > > > I see, thanks for the pointers. > > > > It looks like cfmakeraw() and tcsetattr() were what I was > > > > looking for. > > > > A bhyve-specific printf wrapper looks the right solution to me. > > > > I can try to sketch a patch for you guys to review, if that's > > > > useful. > > > > > > > > Cheers, > > > > Vincenzo > > > > > > Meanwhile could you please revert the commit, and add a note to > > > D22552 to the effects that this was not the right solution? > > > > I don't think we have to revert as it isn't that big of a > > deal. Just > > fixing it going forward is probably fine. > > I disagree. Not reverting this leads to a bunch of un-needed changes > in the forward moving review, clouding the view of what is really > being changed in that new review which is now a mix of undoing this > and adding a new set of macros to deal with end of line. > It doesn't cloud anything in the new review. Reverting it will change all the \n\r back to just \n. Then exactly the same lines will need changing on the do-over to remove the \n. There are times when backing out a changeset and doing things over from scratch make sense, but this doesn't seem to be one of them. -- Ian From owner-svn-src-all@freebsd.org Thu Dec 5 19:37:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DD6D1A9F85; Thu, 5 Dec 2019 19:37:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TQwW0sjhz4Z5p; Thu, 5 Dec 2019 19:37:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 012371DD14; Thu, 5 Dec 2019 19:37:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5JbUH9098937; Thu, 5 Dec 2019 19:37:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5JbUuD098935; Thu, 5 Dec 2019 19:37:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912051937.xB5JbUuD098935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 5 Dec 2019 19:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355428 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 355428 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 19:37:31 -0000 Author: jhb Date: Thu Dec 5 19:37:30 2019 New Revision: 355428 URL: https://svnweb.freebsd.org/changeset/base/355428 Log: Add a new "riscv-relaxations" linker feature. When the linker doesn't have this feature, add -mno-relax to CFLAGS on RISC-V. Define the feature for ld.bfd, but not lld. If lld gains relaxation support in a newer version, we can enable it for those versions of lld in bsd.linker.mk. Reviewed by: mhorne Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22659 Modified: head/share/mk/bsd.cpu.mk head/share/mk/bsd.linker.mk head/sys/conf/kern.mk Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Thu Dec 5 19:25:49 2019 (r355427) +++ head/share/mk/bsd.cpu.mk Thu Dec 5 19:37:30 2019 (r355428) @@ -375,6 +375,10 @@ CFLAGS += -march=rv64imac -mabi=lp64 .else CFLAGS += -march=rv64imafdc -mabi=lp64d .endif + +.if ${LINKER_FEATURES:U:Mriscv-relaxations} == "" +CFLAGS += -mno-relax +.endif .endif # NB: COPTFLAGS is handled in /usr/src/sys/conf/kern.pre.mk Modified: head/share/mk/bsd.linker.mk ============================================================================== --- head/share/mk/bsd.linker.mk Thu Dec 5 19:25:49 2019 (r355427) +++ head/share/mk/bsd.linker.mk Thu Dec 5 19:37:30 2019 (r355428) @@ -86,6 +86,9 @@ ${X_}LINKER_FEATURES= ${X_}LINKER_FEATURES+= build-id ${X_}LINKER_FEATURES+= ifunc .endif +.if ${${X_}LINKER_TYPE} == "bfd" && ${${X_}LINKER_VERSION} > 21750 +${X_}LINKER_FEATURES+= riscv-relaxations +.endif .if ${${X_}LINKER_TYPE} == "lld" && ${${X_}LINKER_VERSION} >= 60000 ${X_}LINKER_FEATURES+= retpoline .endif Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Dec 5 19:25:49 2019 (r355427) +++ head/sys/conf/kern.mk Thu Dec 5 19:37:30 2019 (r355428) @@ -144,6 +144,10 @@ CFLAGS+= -march=rv64imafdc -mabi=lp64 CFLAGS.clang+= -mcmodel=medium CFLAGS.gcc+= -mcmodel=medany INLINE_LIMIT?= 8000 + +.if ${LINKER_FEATURES:Mriscv-relaxations} == "" +CFLAGS+= -mno-relax +.endif .endif # From owner-svn-src-all@freebsd.org Thu Dec 5 19:39:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5EC51AA0D4; Thu, 5 Dec 2019 19:39:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TQzD3yFhz4ZG7; Thu, 5 Dec 2019 19:39:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50C5C1DD1F; Thu, 5 Dec 2019 19:39:52 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB5JdqO4099076; Thu, 5 Dec 2019 19:39:52 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB5Jdp6C099074; Thu, 5 Dec 2019 19:39:51 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912051939.xB5Jdp6C099074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Thu, 5 Dec 2019 19:39:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355429 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 355429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 19:39:52 -0000 Author: scottl Date: Thu Dec 5 19:39:51 2019 New Revision: 355429 URL: https://svnweb.freebsd.org/changeset/base/355429 Log: Add support for new sound HDA hardware Sponsored by: Intel Modified: head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdac.h head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Thu Dec 5 19:37:30 2019 (r355428) +++ head/sys/dev/sound/pci/hda/hdac.c Thu Dec 5 19:39:51 2019 (r355429) @@ -106,6 +106,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: head/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.h Thu Dec 5 19:37:30 2019 (r355428) +++ head/sys/dev/sound/pci/hda/hdac.h Thu Dec 5 19:39:51 2019 (r355429) @@ -81,6 +81,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) @@ -703,6 +704,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_INTELCL HDA_CODEC_CONSTRUCT(INTEL, 0x29fb) #define HDA_CODEC_INTELXXXX HDA_CODEC_CONSTRUCT(INTEL, 0xffff) Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Thu Dec 5 19:37:30 2019 (r355428) +++ head/sys/dev/sound/pci/hda/hdacc.c Thu Dec 5 19:39:51 2019 (r355429) @@ -375,6 +375,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-all@freebsd.org Thu Dec 5 19:40:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17AEE1AA184; Thu, 5 Dec 2019 19:40:10 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47TQzY02G5z4ZPn; Thu, 5 Dec 2019 19:40:08 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id xB5Je7h8045500; Thu, 5 Dec 2019 11:40:07 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id xB5Je7xW045499; Thu, 5 Dec 2019 11:40:07 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201912051940.xB5Je7xW045499@gndrsh.dnsmgr.net> Subject: Re: svn commit: r355301 - head/usr.sbin/bhyve In-Reply-To: To: Ian Lepore Date: Thu, 5 Dec 2019 11:40:07 -0800 (PST) CC: rgrimes@freebsd.org, John Baldwin , Vincenzo Maffione , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 47TQzY02G5z4ZPn X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of freebsd@gndrsh.dnsmgr.net has no SPF policy when checking 69.59.192.140) smtp.mailfrom=freebsd@gndrsh.dnsmgr.net X-Spamd-Result: default: False [0.06 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.518,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.36)[-0.361,0]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; IP_SCORE(0.04)[ip: (0.14), ipnet: 69.59.192.0/19(0.07), asn: 13868(0.03), country: US(-0.05)]; RCPT_COUNT_SEVEN(0.00)[7]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Dec 2019 19:40:10 -0000 > On Thu, 2019-12-05 at 11:21 -0800, Rodney W. Grimes wrote: > > > On 12/4/19 9:35 PM, Rodney W. Grimes wrote: > > > > > I see, thanks for the pointers. > > > > > It looks like cfmakeraw() and tcsetattr() were what I was > > > > > looking for. > > > > > A bhyve-specific printf wrapper looks the right solution to me. > > > > > I can try to sketch a patch for you guys to review, if that's > > > > > useful. > > > > > > > > > > Cheers, > > > > > Vincenzo > > > > > > > > Meanwhile could you please revert the commit, and add a note to > > > > D22552 to the effects that this was not the right solution? > > > > > > I don't think we have to revert as it isn't that big of a > > > deal. Just > > > fixing it going forward is probably fine. > > > > I disagree. Not reverting this leads to a bunch of un-needed changes > > in the forward moving review, clouding the view of what is really > > being changed in that new review which is now a mix of undoing this > > and adding a new set of macros to deal with end of line. > > > > It doesn't cloud anything in the new review. Reverting it will change > all the \n\r back to just \n. Then exactly the same lines will need > changing on the do-over to remove the \n. ACK Ok, my oversight, I thought the \n would be staying, but your right it goes too. > There are times when backing out a changeset and doing things over from > scratch make sense, but this doesn't seem to be one of them. Perhaps... but fundementally, IMHO, a wrong change should just be reverted even if the fix is simple and soon. Again, IMHO, we are far to shy about using revert. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Fri Dec 6 00:06:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3D821B0445; Fri, 6 Dec 2019 00:06:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TXtQ3qyWz3Hhx; Fri, 6 Dec 2019 00:06:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D01B20D1C; Fri, 6 Dec 2019 00:06:06 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB60664X058964; Fri, 6 Dec 2019 00:06:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6066qR058963; Fri, 6 Dec 2019 00:06:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060006.xB6066qR058963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355430 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 355430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:06:06 -0000 Author: asomers Date: Fri Dec 6 00:06:05 2019 New Revision: 355430 URL: https://svnweb.freebsd.org/changeset/base/355430 Log: ses: sanitize illegal strings in SES element descriptors The SES4r3 standard requires that element descriptors may only contain ASCII characters in the range 0x20 to 0x7e. Some SuperMicro expanders violate that rule. This patch adds a sanity check to ses(4). Descriptors in violation will be replaced by "". This patch fixes "sesutil --libxo xml" on such systems. Previously it would generate non-well-formed XML output. PR: 241929 Reviewed by: allanjude MFC after: 2 weeks Sponsored by: Axcient Modified: head/sys/cam/scsi/scsi_enc_ses.c Modified: head/sys/cam/scsi/scsi_enc_ses.c ============================================================================== --- head/sys/cam/scsi/scsi_enc_ses.c Thu Dec 5 19:39:51 2019 (r355429) +++ head/sys/cam/scsi/scsi_enc_ses.c Fri Dec 6 00:06:05 2019 (r355430) @@ -110,7 +110,7 @@ typedef struct ses_addl_status { typedef struct ses_element { uint8_t eip; /* eip bit is set */ uint16_t descr_len; /* length of the descriptor */ - char *descr; /* descriptor for this object */ + const char *descr; /* descriptor for this object */ struct ses_addl_status addl; /* additional status info */ } ses_element_t; @@ -1977,6 +1977,35 @@ ses_publish_cache(enc_softc_t *enc, struct enc_fsm_sta return (0); } +/* + * \brief Sanitize an element descriptor + * + * The SES4r3 standard, sections 3.1.2 and 6.1.10, specifies that element + * descriptors may only contain ASCII characters in the range 0x20 to 0x7e. + * But some vendors violate that rule. Ensure that we only expose compliant + * descriptors to userland. + * + * \param desc SES element descriptor as reported by the hardware + * \param len Length of desc in bytes, not necessarily including + * trailing NUL. It will be modified if desc is invalid. + */ +static const char* +ses_sanitize_elm_desc(const char *desc, uint16_t *len) +{ + const char *invalid = ""; + int i; + + for (i = 0; i < *len; i++) { + if (desc[i] < 0x20 || desc[i] > 0x7e) { + *len = strlen(invalid); + return (invalid); + } else if (desc[i] == 0) { + break; + } + } + return (desc); +} + /** * \brief Parse the descriptors for each object. * @@ -2061,7 +2090,8 @@ ses_process_elm_descs(enc_softc_t *enc, struct enc_fsm if (length > 0) { elmpriv = element->elm_private; elmpriv->descr_len = length; - elmpriv->descr = &buf[offset]; + elmpriv->descr = ses_sanitize_elm_desc(&buf[offset], + &elmpriv->descr_len); } /* skip over the descriptor itself */ From owner-svn-src-all@freebsd.org Fri Dec 6 00:12:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E5841B0932; Fri, 6 Dec 2019 00:12:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TY1X1Bk9z3J1f; Fri, 6 Dec 2019 00:12:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C17D20EBF; Fri, 6 Dec 2019 00:12:16 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB60CFIB064291; Fri, 6 Dec 2019 00:12:15 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60CEoW064284; Fri, 6 Dec 2019 00:12:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060012.xB60CEoW064284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355431 - in head: etc/mtree sys/geom sys/geom/multipath tests/sys/geom/class tests/sys/geom/class/multipath X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: etc/mtree sys/geom sys/geom/multipath tests/sys/geom/class tests/sys/geom/class/multipath X-SVN-Commit-Revision: 355431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:12:16 -0000 Author: asomers Date: Fri Dec 6 00:12:14 2019 New Revision: 355431 URL: https://svnweb.freebsd.org/changeset/base/355431 Log: gmultipath: add ATF tests Add ATF tests for most gmultipath operations. Add some dtrace probes too, primarily for configuration changes that happen in response to provider errors. PR: 178473 MFC after: 2 weeks Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22235 Added: head/tests/sys/geom/class/multipath/ head/tests/sys/geom/class/multipath/Makefile (contents, props changed) head/tests/sys/geom/class/multipath/conf.sh (contents, props changed) head/tests/sys/geom/class/multipath/failloop.sh (contents, props changed) head/tests/sys/geom/class/multipath/misc.sh (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/sys/geom/geom_subr.c head/sys/geom/multipath/g_multipath.c head/tests/sys/geom/class/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Fri Dec 6 00:06:05 2019 (r355430) +++ head/etc/mtree/BSD.tests.dist Fri Dec 6 00:12:14 2019 (r355431) @@ -754,6 +754,8 @@ .. mirror .. + multipath + .. nop .. part Modified: head/sys/geom/geom_subr.c ============================================================================== --- head/sys/geom/geom_subr.c Fri Dec 6 00:06:05 2019 (r355430) +++ head/sys/geom/geom_subr.c Fri Dec 6 00:12:14 2019 (r355431) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -65,6 +66,8 @@ __FBSDID("$FreeBSD$"); #ifdef KDB #include #endif + +SDT_PROVIDER_DEFINE(geom); struct class_list_head g_classes = LIST_HEAD_INITIALIZER(g_classes); static struct g_tailq_head geoms = TAILQ_HEAD_INITIALIZER(geoms); Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Fri Dec 6 00:06:05 2019 (r355430) +++ head/sys/geom/multipath/g_multipath.c Fri Dec 6 00:12:14 2019 (r355431) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -61,6 +62,14 @@ static u_int g_multipath_exclusive = 1; SYSCTL_UINT(_kern_geom_multipath, OID_AUTO, exclusive, CTLFLAG_RW, &g_multipath_exclusive, 0, "Exclusively open providers"); +SDT_PROVIDER_DECLARE(geom); +SDT_PROBE_DEFINE2(geom, multipath, config, restore, "char*", "char*"); +SDT_PROBE_DEFINE2(geom, multipath, config, remove, "char*", "char*"); +SDT_PROBE_DEFINE2(geom, multipath, config, disconnect, "char*", "char*"); +SDT_PROBE_DEFINE3(geom, multipath, config, fail, "char*", "char*", "int"); +SDT_PROBE_DEFINE2(geom, multipath, config, taste, "char*", "char*"); +SDT_PROBE_DEFINE2(geom, multipath, io, restart, "struct bio*", "struct bio*"); + static enum { GKT_NIL, GKT_RUN, @@ -146,6 +155,8 @@ g_multipath_fault(struct g_consumer *cp, int cause) printf("GEOM_MULTIPATH: " "all paths in %s were marked FAIL, restore %s\n", sc->sc_name, lcp->provider->name); + SDT_PROBE2(geom, multipath, config, restore, + sc->sc_name, lcp->provider->name); lcp->index &= ~MP_FAIL; } } @@ -217,6 +228,8 @@ g_mpd(void *arg, int flags __unused) if (cp->provider) { printf("GEOM_MULTIPATH: %s removed from %s\n", cp->provider->name, gp->name); + SDT_PROBE2(geom, multipath, config, remove, + gp->name, cp->provider->name); g_detach(cp); } g_destroy_consumer(cp); @@ -234,6 +247,8 @@ g_multipath_orphan(struct g_consumer *cp) g_topology_assert(); printf("GEOM_MULTIPATH: %s in %s was disconnected\n", cp->provider->name, cp->geom->name); + SDT_PROBE2(geom, multipath, config, disconnect, + cp->geom->name, cp->provider->name); sc = cp->geom->softc; cnt = (uintptr_t *)&cp->private; mtx_lock(&sc->sc_mtx); @@ -411,6 +426,8 @@ g_multipath_done_error(struct bio *bp) if ((cp->index & MP_FAIL) == 0) { printf("GEOM_MULTIPATH: Error %d, %s in %s marked FAIL\n", bp->bio_error, pp->name, sc->sc_name); + SDT_PROBE3(geom, multipath, config, fail, + sc->sc_name, pp->name, bp->bio_error); g_multipath_fault(cp, MP_FAIL); } (*cnt)--; @@ -426,6 +443,7 @@ g_multipath_done_error(struct bio *bp) */ if (pbp->bio_children < (uintptr_t)pbp->bio_driver1) { pbp->bio_inbed++; + SDT_PROBE2(geom, multipath, io, restart, bp, pbp); g_destroy_bio(bp); g_multipath_start(pbp); } else { @@ -831,6 +849,7 @@ g_multipath_taste(struct g_class *mp, struct g_provide return (NULL); if (g_multipath_debug) printf("MULTIPATH: %s/%s\n", md.md_name, md.md_uuid); + SDT_PROBE2(geom, multipath, config, taste, md.md_name, md.md_uuid); /* * Let's check if such a device already is present. We check against @@ -1230,8 +1249,12 @@ g_multipath_ctl_fail(struct gctl_req *req, struct g_cl name, sc->sc_name, fail ? "FAIL" : "OK"); if (fail) { g_multipath_fault(cp, MP_FAIL); + SDT_PROBE3(geom, multipath, config, fail, + sc->sc_name, cp->provider->name, 0); } else { cp->index &= ~MP_FAIL; + SDT_PROBE2(geom, multipath, config, restore, + sc->sc_name, cp->provider->name); } } } @@ -1277,6 +1300,8 @@ g_multipath_ctl_remove(struct gctl_req *req, struct g_ found = 1; printf("GEOM_MULTIPATH: removing %s from %s\n", cp->provider->name, cp->geom->name); + SDT_PROBE2(geom, multipath, config, remove, + cp->geom->name, cp->provider->name); sc->sc_ndisks--; g_multipath_fault(cp, MP_LOST); cnt = (uintptr_t *)&cp->private; Modified: head/tests/sys/geom/class/Makefile ============================================================================== --- head/tests/sys/geom/class/Makefile Fri Dec 6 00:06:05 2019 (r355430) +++ head/tests/sys/geom/class/Makefile Fri Dec 6 00:12:14 2019 (r355431) @@ -8,6 +8,7 @@ TESTS_SUBDIRS+= concat TESTS_SUBDIRS+= eli TESTS_SUBDIRS+= gate TESTS_SUBDIRS+= mirror +TESTS_SUBDIRS+= multipath TESTS_SUBDIRS+= nop TESTS_SUBDIRS+= part TESTS_SUBDIRS+= raid3 Added: head/tests/sys/geom/class/multipath/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/multipath/Makefile Fri Dec 6 00:12:14 2019 (r355431) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + +ATF_TESTS_SH+= failloop +ATF_TESTS_SH+= misc +TEST_METADATA.failloop+= is_exclusive=true + +${PACKAGE}FILES+= conf.sh + +.include Added: head/tests/sys/geom/class/multipath/conf.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/multipath/conf.sh Fri Dec 6 00:12:14 2019 (r355431) @@ -0,0 +1,107 @@ +#!/bin/sh +# Copyright (c) 2019 Axcient +# +# 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$ + +MD_DEVS="md.devs" +MULTIPATH_DEVS="multipath.devs" + +alloc_md() +{ + local md + + md=$(mdconfig -a -t swap -s 1M) || atf_fail "mdconfig -a failed" + echo ${md} >> $MD_DEVS + echo ${md} +} + +# Verify expected state. +# check_multipath_state [prov2_state] +check_multipath_state() +{ + local want_active_path=$1 + local want_geom_state=$2 + local want_prov0_state=$3 + local want_prov1_state=$4 + local want_prov2_state=$5 + local geom_state + local prov0_state + local prov1_state + local prov2_state + + geom_state=`gmultipath list "$name" | awk '/^State:/ {print $2}'` + atf_check_equal "$want_geom_state" "$geom_state" + prov0_state=`gmultipath list "$name" | awk '/1. Name: md[0-9]/ {trigger=1} /State:/ && trigger == 1 {print $2; trigger=0;}'` + prov1_state=`gmultipath list "$name" | awk '/2. Name: md[0-9]/ {trigger=1} /State:/ && trigger == 1 {print $2; trigger=0;}'` + prov2_state=`gmultipath list "$name" | awk '/3. Name: md[0-9]/ {trigger=1} /State:/ && trigger == 1 {print $2; trigger=0;}'` + atf_check_equal "$want_active_path" "`gmultipath getactive "$name"`" + atf_check_equal "$want_prov0_state" $prov0_state + atf_check_equal "$want_prov1_state" $prov1_state + if [ -n "$want_prov2_state" ]; then + atf_check_equal "$want_prov2_state" $prov2_state + fi +} + +common_cleanup() +{ + name=$(cat $MULTIPATH_DEVS) + if [ -n "$name" -a -c "/dev/multipath/$name" ]; then + gmultipath destroy "$name" + rm $MULTIPATH_DEVS + fi + if [ -f "$MD_DEVS" ]; then + while read test_md; do + gnop destroy -f ${test_md}.nop 2>/dev/null + mdconfig -d -u $test_md 2>/dev/null + done < $MD_DEVS + rm $MD_DEVS + fi + true +} + +load_dtrace() +{ + if ! kldstat -q -m sdt; then + kldload sdt || atf_skip "could not load module for dtrace SDT" + fi +} + +load_gmultipath() +{ + if ! kldstat -q -m g_multipath; then + geom multipath load || atf_skip "could not load module for geom multipath" + fi +} + +load_gnop() +{ + if ! kldstat -q -m g_nop; then + geom nop load || atf_skip "could not load module for geom nop" + fi +} + +mkname() +{ + mktemp -u mp.XXXXXX | tee $MULTIPATH_DEVS +} Added: head/tests/sys/geom/class/multipath/failloop.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/multipath/failloop.sh Fri Dec 6 00:12:14 2019 (r355431) @@ -0,0 +1,77 @@ +#!/bin/sh +# Copyright (c) 2019 Axcient +# +# 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$ + +. $(atf_get_srcdir)/conf.sh + +# See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=178473 +atf_test_case failloop cleanup +failloop_head() +{ + atf_set "descr" "A persistent failure in the provider should not cause an infinite loop, nor restore any providers that were faulted by the same bio" + atf_set "require.user" "root" + atf_set "require.config" "allow_sysctl_side_effects" +} +failloop_body() +{ + sysctl -n kern.geom.notaste > kern.geom.notaste.txt + load_gnop + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check gnop create /dev/${md0} + atf_check gnop create /dev/${md1} + atf_check -s exit:0 gmultipath create "$name" ${md0}.nop ${md1}.nop + sysctl kern.geom.notaste=1 + + atf_check gnop configure -r 100 -w 100 ${md0}.nop + atf_check gnop configure -r 100 -w 100 ${md1}.nop + dd_status=`dtrace \ + -o restore_count \ + -i 'geom:multipath:config:restore {@restore = count()}' \ + -c "dd if=/dev/zero of=/dev/multipath/"$name" bs=4096 count=1" \ + 2>&1 | awk '/exited with status/ {print $NF}'` + # The dd command should've failed ... + atf_check_equal 1 $dd_status + # and triggered 1 or 2 path restores + if [ `cat restore_count` -gt 2 ]; then + atf_fail "gmultipath restored paths too many times" + fi +} +failloop_cleanup() +{ + if [ -f kern.geom.notaste.txt ]; then + sysctl kern.geom.notaste=`cat kern.geom.notaste.txt` + fi + common_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case failloop +} Added: head/tests/sys/geom/class/multipath/misc.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/geom/class/multipath/misc.sh Fri Dec 6 00:12:14 2019 (r355431) @@ -0,0 +1,363 @@ +#!/bin/sh +# Copyright (c) 2019 Axcient +# +# 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$ + +. $(atf_get_srcdir)/conf.sh + +atf_test_case add cleanup +add_head() +{ + atf_set "descr" "Add a new path" + atf_set "require.user" "root" +} +add_body() +{ + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + md2=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create "$name" ${md0} ${md1} + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "PASSIVE" + + # Add a new path + atf_check -s exit:0 gmultipath add "$name" ${md2} + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "PASSIVE" "PASSIVE" +} +add_cleanup() +{ + common_cleanup +} + +atf_test_case create_A cleanup +create_A_head() +{ + atf_set "descr" "Create an Active/Active multipath device" + atf_set "require.user" "root" +} +create_A_body() +{ + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create -A "$name" ${md0} ${md1} + check_multipath_state "${md1} ${md0}" "OPTIMAL" "ACTIVE" "ACTIVE" +} +create_A_cleanup() +{ + common_cleanup +} + +atf_test_case create_R cleanup +create_R_head() +{ + atf_set "descr" "Create an Active/Read multipath device" + atf_set "require.user" "root" +} +create_R_body() +{ + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create -R "$name" ${md0} ${md1} + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "READ" +} +create_R_cleanup() +{ + common_cleanup +} + +atf_test_case depart_and_arrive cleanup +depart_and_arrive_head() +{ + atf_set "descr" "gmultipath should remove devices that disappear, and automatically reattach labeled providers that reappear" + atf_set "require.user" "root" +} +depart_and_arrive_body() +{ + load_gnop + load_gmultipath + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + # We need a non-zero offset to gmultipath won't see the label when it + # tastes the md device. We only want the label to be visible on the + # gnop device. + offset=131072 + atf_check gnop create -o $offset /dev/${md0} + atf_check gnop create -o $offset /dev/${md1} + atf_check -s exit:0 gmultipath label "$name" ${md0}.nop + # gmultipath is too smart to let us create a gmultipath device by label + # when the two providers aren't actually related. So we create a + # device by label with one provider, and then manually add the second. + atf_check -s exit:0 gmultipath add "$name" ${md1}.nop + NDEVS=`gmultipath list "$name" | grep -c 'md[0-9]*\.nop'` + atf_check_equal 2 $NDEVS + + # Now fail the labeled provider + atf_check -s exit:0 gnop destroy -f ${md0}.nop + # It should be automatically removed from the multipath device + NDEVS=`gmultipath list "$name" | grep -c 'md[0-9]*\.nop'` + atf_check_equal 1 $NDEVS + + # Now return the labeled provider + atf_check gnop create -o $offset /dev/${md0} + # It should be automatically restored to the multipath device. We + # don't really care which path is active. + NDEVS=`gmultipath list "$name" | grep -c 'md[0-9]*\.nop'` + atf_check_equal 2 $NDEVS + STATE=`gmultipath list "$name" | awk '/^State:/ {print $2}'` + atf_check_equal "OPTIMAL" $STATE +} +depart_and_arrive_cleanup() +{ + common_cleanup +} + + +atf_test_case fail cleanup +fail_head() +{ + atf_set "descr" "Manually fail a path" + atf_set "require.user" "root" +} +fail_body() +{ + load_gmultipath + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create "$name" ${md0} ${md1} + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "PASSIVE" + # Manually fail the active path + atf_check -s exit:0 gmultipath fail "$name" ${md0} + check_multipath_state ${md1} "DEGRADED" "FAIL" "ACTIVE" +} +fail_cleanup() +{ + common_cleanup +} + +atf_test_case fail_on_error cleanup +fail_on_error_head() +{ + atf_set "descr" "An error in the provider will cause gmultipath to mark it as FAIL" + atf_set "require.user" "root" +} +fail_on_error_body() +{ + load_gnop + load_gmultipath + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check gnop create /dev/${md0} + atf_check gnop create /dev/${md1} + atf_check -s exit:0 gmultipath create "$name" ${md0}.nop ${md1}.nop + # The first I/O to the first path should fail, causing gmultipath to + # fail over to the second path. + atf_check gnop configure -q 100 -r 100 -w 100 -x 100 ${md0}.nop + atf_check -s exit:0 -o ignore -e ignore dd if=/dev/zero of=/dev/multipath/"$name" bs=4096 count=1 + check_multipath_state ${md1}.nop "DEGRADED" "FAIL" "ACTIVE" +} +fail_on_error_cleanup() +{ + common_cleanup +} + +atf_test_case physpath cleanup +physpath_head() +{ + atf_set "descr" "gmultipath should pass through the underlying providers' physical path" + atf_set "require.user" "root" +} +physpath_body() +{ + load_gnop + load_gmultipath + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + physpath="some/physical/path" + # Create two providers with the same physical paths, mimicing how + # multipathed SAS drives appear. This is the normal way to use + # gmultipath. If the underlying providers' physical paths differ, + # then you're probably using gmultipath wrong. + atf_check gnop create -z $physpath /dev/${md0} + atf_check gnop create -z $physpath /dev/${md1} + atf_check -s exit:0 gmultipath create "$name" ${md0}.nop ${md1}.nop + gmultipath_physpath=$(diskinfo -p multipath/"$name") + atf_check_equal "$physpath" "$gmultipath_physpath" +} +physpath_cleanup() +{ + common_cleanup +} + +atf_test_case prefer cleanup +prefer_head() +{ + atf_set "descr" "Manually select the preferred path" + atf_set "require.user" "root" +} +prefer_body() +{ + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + md2=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create "$name" ${md0} ${md1} ${md2} + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "PASSIVE" "PASSIVE" + + # Explicitly prefer the final path + atf_check -s exit:0 gmultipath prefer "$name" ${md2} + check_multipath_state ${md2} "OPTIMAL" "PASSIVE" "PASSIVE" "ACTIVE" +} +prefer_cleanup() +{ + common_cleanup +} + +atf_test_case restore cleanup +restore_head() +{ + atf_set "descr" "Manually restore a failed path" + atf_set "require.user" "root" +} +restore_body() +{ + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create "$name" ${md0} ${md1} + + # Explicitly fail the first path + atf_check -s exit:0 gmultipath fail "$name" ${md0} + check_multipath_state ${md1} "DEGRADED" "FAIL" "ACTIVE" + + # Explicitly restore it + atf_check -s exit:0 gmultipath restore "$name" ${md0} + check_multipath_state ${md1} "OPTIMAL" "PASSIVE" "ACTIVE" +} +restore_cleanup() +{ + common_cleanup +} + +atf_test_case restore_on_error cleanup +restore_on_error_head() +{ + atf_set "descr" "A failed path should be restored if an I/O error is encountered on all other active paths" + atf_set "require.user" "root" +} +restore_on_error_body() +{ + load_gnop + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + name=$(mkname) + atf_check gnop create /dev/${md0} + atf_check gnop create /dev/${md1} + atf_check -s exit:0 gmultipath create "$name" ${md0}.nop ${md1}.nop + # Explicitly fail the first path + atf_check -s exit:0 gmultipath fail "$name" ${md0}.nop + + # Setup the second path to fail on the next I/O + atf_check gnop configure -r 100 -w 100 ${md1}.nop + atf_check -s exit:0 -o ignore -e ignore \ + dd if=/dev/zero of=/dev/multipath/"$name" bs=4096 count=1 + + # Now the first path should be active, and the second should be failed + check_multipath_state ${md0}.nop "DEGRADED" "ACTIVE" "FAIL" +} +restore_on_error_cleanup() +{ + common_cleanup +} + +atf_test_case rotate cleanup +rotate_head() +{ + atf_set "descr" "Manually rotate the active path" + atf_set "require.user" "root" +} +rotate_body() +{ + load_gmultipath + load_dtrace + + md0=$(alloc_md) + md1=$(alloc_md) + md2=$(alloc_md) + name=$(mkname) + atf_check -s exit:0 gmultipath create "$name" ${md0} ${md1} ${md2} + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "PASSIVE" "PASSIVE" + + # Explicitly rotate the paths + atf_check -s exit:0 gmultipath rotate "$name" + check_multipath_state ${md2} "OPTIMAL" "PASSIVE" "PASSIVE" "ACTIVE" + # Again + atf_check -s exit:0 gmultipath rotate "$name" + check_multipath_state ${md1} "OPTIMAL" "PASSIVE" "ACTIVE" "PASSIVE" + # Final rotation should restore original configuration + atf_check -s exit:0 gmultipath rotate "$name" + check_multipath_state ${md0} "OPTIMAL" "ACTIVE" "PASSIVE" "PASSIVE" +} +rotate_cleanup() +{ + common_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case add + atf_add_test_case create_A + atf_add_test_case create_R + atf_add_test_case depart_and_arrive + atf_add_test_case fail + atf_add_test_case fail_on_error + atf_add_test_case physpath + atf_add_test_case prefer + atf_add_test_case restore + atf_add_test_case restore_on_error + atf_add_test_case rotate +} From owner-svn-src-all@freebsd.org Fri Dec 6 00:24:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 997181B0DF1; Fri, 6 Dec 2019 00:24:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TYHh3HxTz3Jgv; Fri, 6 Dec 2019 00:24:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55645210A0; Fri, 6 Dec 2019 00:24:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB60OWEq071310; Fri, 6 Dec 2019 00:24:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60OWo0071309; Fri, 6 Dec 2019 00:24:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060024.xB60OWo0071309@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:24:32 +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: r355432 - stable/12/usr.sbin/sesutil X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/usr.sbin/sesutil X-SVN-Commit-Revision: 355432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:24:32 -0000 Author: asomers Date: Fri Dec 6 00:24:31 2019 New Revision: 355432 URL: https://svnweb.freebsd.org/changeset/base/355432 Log: MFC r354664-r354666 r354664: sesutil: fix an out-of-bounds array access sesutil would allow the user to toggle an LED that was one past the maximum element. If he tried, ENCIOC_GETELMSTAT would return EINVAL. Reported by: Coverity Coverity CID: 1398940 Sponsored by: Axcient r354665: sesutil: fix some memory leaks Reported by: Coverity Coverity CID: 1331665 Sponsored by: Axcient r354666: sesutil: fix another memory leak Instead of calloc()ing (and forgetting to free) in a tight loop, just put this small array on the stack. Reported by: Coverity Coverity CID: 1331665 Sponsored by: Axcient Modified: stable/12/usr.sbin/sesutil/sesutil.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/sesutil/sesutil.c ============================================================================== --- stable/12/usr.sbin/sesutil/sesutil.c Fri Dec 6 00:12:14 2019 (r355431) +++ stable/12/usr.sbin/sesutil/sesutil.c Fri Dec 6 00:24:31 2019 (r355432) @@ -242,35 +242,38 @@ sesled(int argc, char **argv, bool setfault) } if (ioctl(fd, ENCIOC_GETELMMAP, (caddr_t) objp) < 0) { + free(objp); close(fd); xo_err(EXIT_FAILURE, "ENCIOC_GETELMMAP"); } if (isses) { - if (sesid > nobj) { + if (sesid >= nobj) { + free(objp); close(fd); xo_errx(EXIT_FAILURE, "Requested SES ID does not exist"); } do_led(fd, sesid, objp[sesid].elm_type, onoff, setfault); ndisks++; + free(objp); close(fd); break; } for (j = 0; j < nobj; j++) { + const int devnames_size = 128; + char devnames[devnames_size]; + if (all) { do_led(fd, objp[j].elm_idx, objp[j].elm_type, onoff, setfault); continue; } memset(&objdn, 0, sizeof(objdn)); + memset(devnames, 0, devnames_size); objdn.elm_idx = objp[j].elm_idx; - objdn.elm_names_size = 128; - objdn.elm_devnames = calloc(128, sizeof(char)); - if (objdn.elm_devnames == NULL) { - close(fd); - xo_err(EXIT_FAILURE, "calloc()"); - } + objdn.elm_names_size = devnames_size; + objdn.elm_devnames = devnames; if (ioctl(fd, ENCIOC_GETELMDEVNAMES, (caddr_t) &objdn) <0) { continue; From owner-svn-src-all@freebsd.org Fri Dec 6 00:27:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73ED81B1276; Fri, 6 Dec 2019 00:27:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TYLs2G9fz3K1v; Fri, 6 Dec 2019 00:27:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C27D210A1; Fri, 6 Dec 2019 00:27:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB60RHW2071486; Fri, 6 Dec 2019 00:27:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60RHSM071485; Fri, 6 Dec 2019 00:27:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060027.xB60RHSM071485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:27:17 +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: r355433 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 355433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:27:17 -0000 Author: asomers Date: Fri Dec 6 00:27:16 2019 New Revision: 355433 URL: https://svnweb.freebsd.org/changeset/base/355433 Log: MFC r354812: Update the ses(4) man page This driver was largely rewritten in 2015 (svn r235911) but the man page was never updated to match. Reviewed by: trasz Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22339 Modified: stable/12/share/man/man4/ses.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ses.4 ============================================================================== --- stable/12/share/man/man4/ses.4 Fri Dec 6 00:24:31 2019 (r355432) +++ stable/12/share/man/man4/ses.4 Fri Dec 6 00:27:16 2019 (r355433) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 05, 2015 +.Dd November 12, 2019 .Dt SES 4 .Os .Sh NAME @@ -77,33 +77,47 @@ calls apply to .Nm devices. They are defined in the header file -.In cam/scsi/scsi_ses.h +.In cam/scsi/scsi_enc.h (\fIq.v.\fR). -.Bl -tag -width SESIOC_GETENCSTAT -.It Dv SESIOC_GETNOBJ +.Bl -tag -width ENCIOC_GETENCSTAT +.It Dv ENCIOC_GETNELM Used to find out how many .Nm -objects are driven by this particular device instance. -.It Dv SESIOC_GETOBJMAP -Read, from the kernel, an array of SES objects which contains -the object identifier, which subenclosure it is in, and the +elements are driven by this particular device instance. +.It Dv ENCIOC_GETELMMAP +Read, from the kernel, an array of SES elements which contains +the element identifier, which subenclosure it is in, and the .Nm -type of the object. -.It Dv SESIOC_GETENCSTAT +type of the element. +.It Dv ENCIOC_GETENCSTAT Get the overall enclosure status. -.It Dv SESIOC_SETENCSTAT +.It Dv ENCIOC_SETENCSTAT Set the overall enclosure status. -.It Dv SESIOC_GETOBJSTAT -Get the status of a particular object. -.It Dv SESIOC_SETOBJSTAT -Set the status of a particular object. -.It Dv SESIOC_GETTEXT -Get the associated help text for an object (not yet implemented). +.It Dv ENCIOC_GETELMSTAT +Get the status of a particular element. +.It Dv ENCIOC_SETELMSTAT +Set the status of a particular element. +.It Dv ENCIOC_GETTEXT +Get the associated help text for an element (not yet implemented). .Nm -devices often have descriptive text for an object which can tell +devices often have descriptive text for an element which can tell you things like location (e.g., "left power supply"). -.It Dv SESIOC_INIT +.It Dv ENCIOC_INIT Initialize the enclosure. +.It Dv ENCIOC_GETELMDESC +Get the element's descriptor string. +.It Dv ENCIOC_GETELMDEVNAMES +Get the device names, if any, associated with this element. +.It Dv ENCIOC_GETSTRING +Used to read the SES String In Diagnostic Page. +The contents of this page are device-specific. +.It Dv ENCIOC_SETSTRING +Used to set the SES String Out Diagnostic Page. +The contents of this page are device-specific. +.It Dv ENCIOC_GETENCNAME +Used to get the name of the enclosure. +.It Dv ENCIOC_GETENCID +Used to get the Enclosure Logical Identifier. .El .Sh EXAMPLE USAGE The files contained in @@ -128,9 +142,12 @@ parameters to the console. .Sh HISTORY The .Nm -driver was written for the +driver was originally written for the .Tn CAM .Tn SCSI -subsystem by Matthew Jacob. -This is a functional equivalent of a similar +subsystem by Matthew Jacob and first released in +.Fx 4.3 . +It was a functional equivalent of a similar driver available in Solaris, Release 7. +It was largely rewritten by Alexander Motin, Justin Gibbs, and Will Andrews for +.Fx 9.2 . From owner-svn-src-all@freebsd.org Fri Dec 6 00:29:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B6D51B1366; Fri, 6 Dec 2019 00:29:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TYP91FCPz3K8P; Fri, 6 Dec 2019 00:29:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09828210A2; Fri, 6 Dec 2019 00:29:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB60TGvR071620; Fri, 6 Dec 2019 00:29:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB60TGoc071619; Fri, 6 Dec 2019 00:29:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912060029.xB60TGoc071619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 6 Dec 2019 00:29: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: r355434 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 355434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 00:29:17 -0000 Author: asomers Date: Fri Dec 6 00:29:16 2019 New Revision: 355434 URL: https://svnweb.freebsd.org/changeset/base/355434 Log: MFC r354779: Actually hook CAM_IO_STATS up to the build It's still disabled by default, but now it can be enabled with config(5) and it will be build in LINT. Reviewed by: imp Sponsored by: Axcient Differential Revision: https://reviews.freebsd.org/D22383 Modified: stable/12/sys/conf/NOTES stable/12/sys/conf/options Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/NOTES ============================================================================== --- stable/12/sys/conf/NOTES Fri Dec 6 00:27:16 2019 (r355433) +++ stable/12/sys/conf/NOTES Fri Dec 6 00:29:16 2019 (r355434) @@ -1356,6 +1356,7 @@ device ctl #CAM Target Layer # CAM_DEBUG_TARGET Limit debugging to the given target. # CAM_DEBUG_LUN Limit debugging to the given lun. # CAM_DEBUG_DELAY Delay in us after printing each debug line. +# CAM_IO_STATS Publish additional CAM device statics by sysctl # # CAM_MAX_HIGHPOWER: Maximum number of concurrent high power (start unit) cmds # SCSI_NO_SENSE_STRINGS: When defined disables sense descriptions @@ -1377,6 +1378,7 @@ options SCSI_NO_SENSE_STRINGS options SCSI_NO_OP_STRINGS options SCSI_DELAY=5000 # Be pessimistic about Joe SCSI device options CAM_IOSCHED_DYNAMIC +options CAM_IO_STATS options CAM_TEST_FAILURE # Options for the CAM CDROM driver: Modified: stable/12/sys/conf/options ============================================================================== --- stable/12/sys/conf/options Fri Dec 6 00:27:16 2019 (r355433) +++ stable/12/sys/conf/options Fri Dec 6 00:29:16 2019 (r355434) @@ -346,6 +346,7 @@ CAM_DEBUG_LUN opt_cam.h CAM_DEBUG_FLAGS opt_cam.h CAM_BOOT_DELAY opt_cam.h CAM_IOSCHED_DYNAMIC opt_cam.h +CAM_IO_STATS opt_cam.h CAM_TEST_FAILURE opt_cam.h SCSI_DELAY opt_scsi.h SCSI_NO_SENSE_STRINGS opt_scsi.h From owner-svn-src-all@freebsd.org Fri Dec 6 01:53:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 215851B2E86; Fri, 6 Dec 2019 01:53:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TbFq061qz3N7G; Fri, 6 Dec 2019 01:53:03 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBF9222089; Fri, 6 Dec 2019 01:53:02 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB61r2Y3023690; Fri, 6 Dec 2019 01:53:02 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB61r2Zu023689; Fri, 6 Dec 2019 01:53:02 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912060153.xB61r2Zu023689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 6 Dec 2019 01:53:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355435 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 355435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 01:53:03 -0000 Author: rmacklem Date: Fri Dec 6 01:53:02 2019 New Revision: 355435 URL: https://svnweb.freebsd.org/changeset/base/355435 Log: Add some definitions for NFSv4.2 which will be used by subsequent commits. This is a preliminary commit of NFSv4.2 definitions that will be used by subsequent commits which adds NFSv4.2 support to the NFS client and server. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Modified: head/sys/fs/nfs/nfsproto.h Modified: head/sys/fs/nfs/nfsproto.h ============================================================================== --- head/sys/fs/nfs/nfsproto.h Fri Dec 6 00:29:16 2019 (r355434) +++ head/sys/fs/nfs/nfsproto.h Fri Dec 6 01:53:02 2019 (r355435) @@ -705,6 +705,7 @@ /* Flags for File Layout. */ #define NFSFLAYUTIL_DENSE 0x1 #define NFSFLAYUTIL_COMMIT_THRU_MDS 0x2 +#define NFSFLAYUTIL_IOADVISE_THRU_MDS 0x4 #define NFSFLAYUTIL_STRIPE_MASK 0xffffffc0 /* Flags for Flex File Layout. */ @@ -874,6 +875,24 @@ struct nfsv3_sattr { u_int32_t sa_mtimetype; nfstime3 sa_mtime; }; + +/* + * IO Advise hint bits for NFSv4.2. + * Since these go on the wire as a bitmap, the NFSATTRBIT macros are + * used to manipulate these bits. + */ +#define NFSV4IOHINT_NORMAL 0 +#define NFSV4IOHINT_SEQUENTIAL 1 +#define NFSV4IOHINT_SEQUENTIALBACK 2 +#define NFSV4IOHINT_RANDOM 3 +#define NFSV4IOHINT_WILLNEED 4 +#define NFSV4IOHINT_WILLNEEDOPTUN 5 +#define NFSV4IOHINT_DONTNEED 6 +#define NFSV4IOHINT_NOREUSE 7 +#define NFSV4IOHINT_READ 8 +#define NFSV4IOHINT_WRITE 9 +#define NFSV4IOHINT_INITPROXIMITY 10 + #endif /* _KERNEL */ /* @@ -960,6 +979,12 @@ struct nfsv3_sattr { #define NFSATTRBIT_MODESETMASKED 74 #define NFSATTRBIT_SUPPATTREXCLCREAT 75 #define NFSATTRBIT_FSCHARSETCAP 76 +#define NFSATTRBIT_CLONEBLKSIZE 77 +#define NFSATTRBIT_SPACEFREED 78 +#define NFSATTRBIT_CHANGEATTRTYPE 79 +#define NFSATTRBIT_SECLABEL 80 +/* Not sure what attribute bit #81 is? */ +#define NFSATTRBIT_XATTRSUPPORT 82 #define NFSATTRBM_SUPPORTEDATTRS 0x00000001 #define NFSATTRBM_TYPE 0x00000002 @@ -1038,6 +1063,12 @@ struct nfsv3_sattr { #define NFSATTRBM_MODESETMASKED 0x00000400 #define NFSATTRBM_SUPPATTREXCLCREAT 0x00000800 #define NFSATTRBM_FSCHARSETCAP 0x00001000 +#define NFSATTRBM_CLONEBLKSIZE 0x00002000 +#define NFSATTRBM_SPACEFREED 0x00004000 +#define NFSATTRBM_CHANGEATTRTYPE 0x00008000 +#define NFSATTRBM_SECLABEL 0x00010000 +/* Not sure what attribute bit#81/0x00020000 is? */ +#define NFSATTRBM_XATTRSUPPORT 0x00040000 #define NFSATTRBIT_MAX 77 @@ -1162,6 +1193,11 @@ struct nfsv3_sattr { NFSATTRBM_SUPPATTREXCLCREAT) /* + * NFSATTRBIT_NFSV42 - Attributes only supported by NFSv4.2. + */ +#define NFSATTRBIT_NFSV42_2 NFSATTRBM_XATTRSUPPORT + +/* * Set of attributes that the getattr vnode op needs. * OR of the following bits. * NFSATTRBIT_GETATTR0 - bits 0<->31 @@ -1462,5 +1498,14 @@ typedef struct nfsv4stateid nfsv4stateid_t; #define NFSV4LAYOUTRET_FILE 1 #define NFSV4LAYOUTRET_FSID 2 #define NFSV4LAYOUTRET_ALL 3 + +/* Seek Contents. */ +#define NFSV4CONTENT_DATA 0 +#define NFSV4CONTENT_HOLE 1 + +/* Options for Set Extended attribute (RFC-8276). */ +#define NFSV4SXATTR_EITHER 0 +#define NFSV4SXATTR_CREATE 1 +#define NFSV4SXATTR_REPLACE 2 #endif /* _NFS_NFSPROTO_H_ */ From owner-svn-src-all@freebsd.org Fri Dec 6 02:43:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 700501B3DE1; Fri, 6 Dec 2019 02:43:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TcMZ24tbz3PsM; Fri, 6 Dec 2019 02:43:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C08522957; Fri, 6 Dec 2019 02:43:06 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB62h6Jv053094; Fri, 6 Dec 2019 02:43:06 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB62h5So053092; Fri, 6 Dec 2019 02:43:05 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912060243.xB62h5So053092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 6 Dec 2019 02:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355436 - in head/sys: amd64/amd64 x86/x86 X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head/sys: amd64/amd64 x86/x86 X-SVN-Commit-Revision: 355436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 02:43:06 -0000 Author: scottl Date: Fri Dec 6 02:43:05 2019 New Revision: 355436 URL: https://svnweb.freebsd.org/changeset/base/355436 Log: Move the mds, irbs, and ssb mitigation knobs into machdep.mitigations. They're in both the old and new places in HEAD for the moment for discussion and transition. The old locations will be garbage collected in 4 weeks. MFCs to 12 an 11 will keep the old and new for transition purposes. Reviewed by: kib MFC after: 4 weeks Sponsored by: Intel Differential Revision: https://reviews.freebsd.org/D22590 Modified: head/sys/amd64/amd64/machdep.c head/sys/x86/x86/cpu_machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Dec 6 01:53:02 2019 (r355435) +++ head/sys/amd64/amd64/machdep.c Fri Dec 6 02:43:05 2019 (r355436) @@ -1778,10 +1778,17 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) vty_set_preferred(VTY_VT); TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); + TUNABLE_INT_FETCH("machdep.mitigations.ibrs.disable", &hw_ibrs_disable); + TUNABLE_INT_FETCH("hw.spec_store_bypass_disable", &hw_ssb_disable); + TUNABLE_INT_FETCH("machdep.mitigations.ssb.disable", &hw_ssb_disable); + TUNABLE_INT_FETCH("machdep.syscall_ret_l1d_flush", &syscall_ret_l1d_flush_mode); + TUNABLE_INT_FETCH("hw.mds_disable", &hw_mds_disable); + TUNABLE_INT_FETCH("machdep.mitigations.mds.disable", &hw_mds_disable); + TUNABLE_INT_FETCH("machdep.mitigations.taa.enable", &x86_taa_enable); finishidentcpu(); /* Final stage of CPU initialization */ Modified: head/sys/x86/x86/cpu_machdep.c ============================================================================== --- head/sys/x86/x86/cpu_machdep.c Fri Dec 6 01:53:02 2019 (r355435) +++ head/sys/x86/x86/cpu_machdep.c Fri Dec 6 02:43:05 2019 (r355436) @@ -877,6 +877,12 @@ int hw_ibrs_disable = 1; SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0, "Indirect Branch Restricted Speculation active"); +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, ibrs, CTLFLAG_RW, 0, + "Indirect Branch Restricted Speculation active"); + +SYSCTL_INT(_machdep_mitigations_ibrs, OID_AUTO, active, CTLFLAG_RD, + &hw_ibrs_active, 0, "Indirect Branch Restricted Speculation active"); + void hw_ibrs_recalculate(void) { @@ -907,6 +913,11 @@ SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", "Disable Indirect Branch Restricted Speculation"); +SYSCTL_PROC(_machdep_mitigations_ibrs, OID_AUTO, disable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + hw_ibrs_disable_handler, "I", + "Disable Indirect Branch Restricted Speculation"); + int hw_ssb_active; int hw_ssb_disable; @@ -914,6 +925,12 @@ SYSCTL_INT(_hw, OID_AUTO, spec_store_bypass_disable_ac &hw_ssb_active, 0, "Speculative Store Bypass Disable active"); +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, ssb, CTLFLAG_RW, 0, + "Speculative Store Bypass Disable active"); + +SYSCTL_INT(_machdep_mitigations_ssb, OID_AUTO, active, CTLFLAG_RD, + &hw_ssb_active, 0, "Speculative Store Bypass Disable active"); + static void hw_ssb_set(bool enable, bool for_all_cpus) { @@ -967,6 +984,11 @@ SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, hw_ssb_disable_handler, "I", "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); +SYSCTL_PROC(_machdep_mitigations_ssb, OID_AUTO, disable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + hw_ssb_disable_handler, "I", + "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); + int hw_mds_disable; /* @@ -1016,6 +1038,14 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable_state, sysctl_hw_mds_disable_state_handler, "A", "Microarchitectural Data Sampling Mitigation state"); +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, mds, CTLFLAG_RW, 0, + "Microarchitectural Data Sampling Mitigation state"); + +SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, state, + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, + sysctl_hw_mds_disable_state_handler, "A", + "Microarchitectural Data Sampling Mitigation state"); + _Static_assert(__offsetof(struct pcpu, pc_mds_tmp) % 64 == 0, "MDS AVX512"); void @@ -1172,6 +1202,11 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | "Microarchitectural Data Sampling Mitigation " "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); +SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, disable, CTLTYPE_INT | + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, + sysctl_mds_disable_handler, "I", + "Microarchitectural Data Sampling Mitigation " + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); /* * Intel Transactional Memory Asynchronous Abort Mitigation From owner-svn-src-all@freebsd.org Fri Dec 6 03:18:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EF841B47DF; Fri, 6 Dec 2019 03:18:38 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Td8Z2Wy2z3R7B; Fri, 6 Dec 2019 03:18:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20CEE22F39; Fri, 6 Dec 2019 03:18:38 +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 xB63Icwp071587; Fri, 6 Dec 2019 03:18:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB63IbwI071586; Fri, 6 Dec 2019 03:18:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912060318.xB63IbwI071586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 6 Dec 2019 03:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355437 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 03:18:38 -0000 Author: mav Date: Fri Dec 6 03:18:37 2019 New Revision: 355437 URL: https://svnweb.freebsd.org/changeset/base/355437 Log: Make GEOM_DEV code slightly more compact. Should be no functional change. MFC after: 2 weeks Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Fri Dec 6 02:43:05 2019 (r355436) +++ head/sys/geom/geom_dev.c Fri Dec 6 03:18:37 2019 (r355437) @@ -524,12 +524,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data i = IOCPARM_LEN(cmd); switch (cmd) { case DIOCGSECTORSIZE: - *(u_int *)data = cp->provider->sectorsize; + *(u_int *)data = pp->sectorsize; if (*(u_int *)data == 0) error = ENOENT; break; case DIOCGMEDIASIZE: - *(off_t *)data = cp->provider->mediasize; + *(off_t *)data = pp->mediasize; if (*(off_t *)data == 0) error = ENOENT; break; @@ -626,15 +626,14 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data case DIOCGDELETE: offset = ((off_t *)data)[0]; length = ((off_t *)data)[1]; - if ((offset % cp->provider->sectorsize) != 0 || - (length % cp->provider->sectorsize) != 0 || length <= 0) { + if ((offset % pp->sectorsize) != 0 || + (length % pp->sectorsize) != 0 || length <= 0) { printf("%s: offset=%jd length=%jd\n", __func__, offset, length); error = EINVAL; break; } - if ((cp->provider->mediasize > 0) && - (offset >= cp->provider->mediasize)) { + if ((pp->mediasize > 0) && (offset >= pp->mediasize)) { /* * Catch out-of-bounds requests here. The problem is * that due to historical GEOM I/O implementation @@ -649,14 +648,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data } while (length > 0) { chunk = length; - if (g_dev_del_max_sectors != 0 && chunk > - g_dev_del_max_sectors * cp->provider->sectorsize) { - chunk = g_dev_del_max_sectors * - cp->provider->sectorsize; - if (cp->provider->stripesize > 0) { + if (g_dev_del_max_sectors != 0 && + chunk > g_dev_del_max_sectors * pp->sectorsize) { + chunk = g_dev_del_max_sectors * pp->sectorsize; + if (pp->stripesize > 0) { odd = (offset + chunk + - cp->provider->stripeoffset) % - cp->provider->stripesize; + pp->stripeoffset) % pp->stripesize; if (chunk > odd) chunk -= odd; } @@ -684,10 +681,10 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data strlcpy(data, pp->name, i); break; case DIOCGSTRIPESIZE: - *(off_t *)data = cp->provider->stripesize; + *(off_t *)data = pp->stripesize; break; case DIOCGSTRIPEOFFSET: - *(off_t *)data = cp->provider->stripeoffset; + *(off_t *)data = pp->stripeoffset; break; case DIOCGPHYSPATH: error = g_io_getattr("GEOM::physpath", cp, &i, data); @@ -739,8 +736,8 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data break; } default: - if (cp->provider->geom->ioctl != NULL) { - error = cp->provider->geom->ioctl(cp->provider, cmd, data, fflag, td); + if (pp->geom->ioctl != NULL) { + error = pp->geom->ioctl(pp, cmd, data, fflag, td); } else { error = ENOIOCTL; } From owner-svn-src-all@freebsd.org Fri Dec 6 03:46:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DFA51B4EBF; Fri, 6 Dec 2019 03:46:39 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tdmt6rk6z3xLp; Fri, 6 Dec 2019 03:46:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE6BA234AA; Fri, 6 Dec 2019 03:46:38 +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 xB63kc9n089119; Fri, 6 Dec 2019 03:46:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB63kcgM089118; Fri, 6 Dec 2019 03:46:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912060346.xB63kcgM089118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 6 Dec 2019 03:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355438 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 03:46:39 -0000 Author: mav Date: Fri Dec 6 03:46:38 2019 New Revision: 355438 URL: https://svnweb.freebsd.org/changeset/base/355438 Log: Block ioctls for dying GEOM_DEV instances. For normal I/Os consumer and provider statuses are checked by g_io_check(). But ioctl calls often do not go through it, being dispatched directly. This change makes their semantics more alike, protecting lower levels. MFC after: 2 weeks Modified: head/sys/geom/geom_dev.c Modified: head/sys/geom/geom_dev.c ============================================================================== --- head/sys/geom/geom_dev.c Fri Dec 6 03:18:37 2019 (r355437) +++ head/sys/geom/geom_dev.c Fri Dec 6 03:46:38 2019 (r355438) @@ -497,12 +497,6 @@ g_dev_close(struct cdev *dev, int flags, int fmt, stru return (error); } -/* - * XXX: Until we have unmessed the ioctl situation, there is a race against - * XXX: a concurrent orphanization. We cannot close it by holding topology - * XXX: since that would prevent us from doing our job, and stalling events - * XXX: will break (actually: stall) the BSD disklabel hacks. - */ static int g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td) { @@ -517,6 +511,12 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data cp = dev->si_drv2; pp = cp->provider; + /* If consumer or provider is dying, don't disturb. */ + if (cp->flags & G_CF_ORPHAN) + return (ENXIO); + if (pp->error) + return (pp->error); + error = 0; KASSERT(cp->acr || cp->acw, ("Consumer with zero access count in g_dev_ioctl")); @@ -676,8 +676,6 @@ g_dev_ioctl(struct cdev *dev, u_long cmd, caddr_t data error = g_io_getattr("GEOM::ident", cp, &i, data); break; case DIOCGPROVIDERNAME: - if (pp == NULL) - return (ENOENT); strlcpy(data, pp->name, i); break; case DIOCGSTRIPESIZE: From owner-svn-src-all@freebsd.org Fri Dec 6 03:48:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40EB01B4F98; Fri, 6 Dec 2019 03:48:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tdq80ywnz3xVT; Fri, 6 Dec 2019 03:48:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 045F4234B2; Fri, 6 Dec 2019 03:48:36 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB63mZHq089245; Fri, 6 Dec 2019 03:48:35 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB63mZu3089242; Fri, 6 Dec 2019 03:48:35 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912060348.xB63mZu3089242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 6 Dec 2019 03:48:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355439 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 355439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 03:48:36 -0000 Author: ian Date: Fri Dec 6 03:48:35 2019 New Revision: 355439 URL: https://svnweb.freebsd.org/changeset/base/355439 Log: Declare the global kernel symbols created by ldscript.arm in arm's machdep.h, and remove a couple scattered local declarations. Most of these aren't referenced in C code (there are some references in asm code), and they also aren't documented anywhere. This helps a bit with the latter. Modified: head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/unwind.c head/sys/arm/include/machdep.h Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Fri Dec 6 03:46:38 2019 (r355438) +++ head/sys/arm/arm/mp_machdep.c Fri Dec 6 03:48:35 2019 (r355439) @@ -106,8 +106,6 @@ check_ap(void) return (-2); } -extern unsigned char _end[]; - /* Initialize and fire up non-boot processors */ void cpu_mp_start(void) Modified: head/sys/arm/arm/unwind.c ============================================================================== --- head/sys/arm/arm/unwind.c Fri Dec 6 03:46:38 2019 (r355438) +++ head/sys/arm/arm/unwind.c Fri Dec 6 03:48:35 2019 (r355439) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "linker_if.h" @@ -61,12 +62,6 @@ __FBSDID("$FreeBSD$"); #define EXIDX_CANTUNWIND 1 /* - * These are set in the linker script. Their addresses will be - * either the start or end of the exception table or index. - */ -extern int exidx_start, exidx_end; - -/* * Entry types. * These are the only entry types that have been seen in the kernel. */ @@ -154,9 +149,9 @@ find_index(uint32_t addr, int search_modules) int32_t prel31_addr; uint32_t func_addr; - start = (struct unwind_idx *)&exidx_start; - idx_start = (caddr_t)&exidx_start; - idx_end = (caddr_t)&exidx_end; + start = (struct unwind_idx *)&_exidx_start; + idx_start = (caddr_t)&_exidx_start; + idx_end = (caddr_t)&_exidx_end; /* This may acquire a lock */ if (search_modules) { Modified: head/sys/arm/include/machdep.h ============================================================================== --- head/sys/arm/include/machdep.h Fri Dec 6 03:46:38 2019 (r355438) +++ head/sys/arm/include/machdep.h Fri Dec 6 03:48:35 2019 (r355439) @@ -61,4 +61,24 @@ void arm_add_efi_map_entries(struct efi_map_header *ef struct mem_region *mr, int *mrcnt); #endif +/* + * Symbols created by ldscript.arm which are accessible in the kernel as global + * symbols. They have uint8 type because they mark the byte location where the + * corresponding data starts or ends (in the end case, it's the next byte + * following the data, so the data size is end-start). These are listed below + * in the order they occur within the kernel (i.e., the address of each variable + * should be greater than any of the ones before it). + */ +extern uint8_t _start; /* Kernel entry point in locore.S */ +extern uint8_t _etext; /* text segment end */ +extern uint8_t _extab_start; /* unwind table start */ +extern uint8_t _exidx_start; /* unwind index start */ +extern uint8_t _exidx_end; /* unwind index end */ +extern uint8_t _start_ctors; /* ctors data start */ +extern uint8_t _stop_ctors; /* ctors data end */ +extern uint8_t _edata; /* data segment end */ +extern uint8_t __bss_start; /* bss segment start */ +extern uint8_t _ebss; /* bss segment end */ +extern uint8_t _end; /* End of kernel (text+ctors+unwind+data+bss) */ + #endif /* !_MACHINE_MACHDEP_H_ */ From owner-svn-src-all@freebsd.org Fri Dec 6 09:40:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A6511C74AD for ; Fri, 6 Dec 2019 09:40:43 +0000 (UTC) (envelope-from steven@multiplay.co.uk) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47TndQ5sB3z4Dm0 for ; Fri, 6 Dec 2019 09:40:42 +0000 (UTC) (envelope-from steven@multiplay.co.uk) Received: by mail-io1-xd31.google.com with SMTP id x1so6692066iop.7 for ; Fri, 06 Dec 2019 01:40:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=KmALm3fGagqIjHhe215DLoZ5+2NZeaFu7dFRYKUj7xk=; b=zmeJ/URJkipaHCEy7qxLxXu0aC836B/ErA6RMYDX3Spi8pSiduFNgFqwHOiNDb5yPq 99t3tNdXORNPRNsdoetA0N9SbcD7TI9K3mtdap7d2kEaxdz7mGf/YoyhEM8AAPzaYD31 nCAJdGpVE7RvIoa6jdWHpEtbovS5d3EDfc+cDPnBc9RF9jQohpSzzo271PwWhmsGT0zs kkt9ouPdQ/P9VaD1DNE4W8IOZnTMj49Vx9vd7PfCgB/DB7nAv4vH0YRFHvcjs35FLVco qaRP9FhV9qdfBQEUIEk0gcBN77AUHf+CBfUc4ZtWio3Yq/QP8+K/7ydPOhz/zBEAI2YU mJUA== 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=KmALm3fGagqIjHhe215DLoZ5+2NZeaFu7dFRYKUj7xk=; b=BFdAAnPPPMDgQpUcknOAu/P4P5tuYchBf/p3bRDxRGSlTF/8+nkii9i5UnKrg+xibN satt5XvHnNHkaKaX5cm46POnhCFUGPDcXu4UfOY19xiwjeY8YExR8238ENsjA7Zz+c/4 wagKFb0S8qMHbpm3SU7j1ES1uUVILilXeg/ukacDamqBHdLqE5hpjHSrKdq1C+v/Tx7C E7A86hNFno6vHUlvwXDM5AijlCUjojbBoypxgElpZEKdlmOtg4fVqzL/h8lTLhIaPOf0 80+pj/6WhJQLo8J1oQqErUOdsEVCew/G/h3kI7ZDZlqpKd7C+WmRyuqyLur8bA9uRLoN ZVYA== X-Gm-Message-State: APjAAAVM06Js7xUQO0+jiER9xIxPceGULtahhEiCgKWi8KfWIC3wmn0g VDhhY9yRUfFsH8wtJvv7Dexl4WDxvZGKXno8f5l7CA== X-Google-Smtp-Source: APXvYqwh9PMcRzby9DEZN35LYY5gZCYo22qLKws3sntaOv7M9cCYH8gne3USEPu2L1h8EhQPjzlcIVapgT8WYsX/TuY= X-Received: by 2002:a5d:88c9:: with SMTP id i9mr10275977iol.225.1575625241109; Fri, 06 Dec 2019 01:40:41 -0800 (PST) MIME-Version: 1.0 References: <201912060006.xB6066qR058963@repo.freebsd.org> In-Reply-To: <201912060006.xB6066qR058963@repo.freebsd.org> From: Steven Hartland Date: Fri, 6 Dec 2019 09:40:29 +0000 Message-ID: Subject: Re: svn commit: r355430 - head/sys/cam/scsi To: Alan Somers Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 47TndQ5sB3z4Dm0 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=multiplay-co-uk.20150623.gappssmtp.com header.s=20150623 header.b=zmeJ/URJ; dmarc=pass (policy=none) header.from=multiplay.co.uk; spf=pass (mx1.freebsd.org: domain of steven@multiplay.co.uk designates 2607:f8b0:4864:20::d31 as permitted sender) smtp.mailfrom=steven@multiplay.co.uk X-Spamd-Result: default: False [-3.83 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[multiplay-co-uk.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[multiplay-co-uk.20150623.gappssmtp.com:+]; DMARC_POLICY_ALLOW(-0.50)[multiplay.co.uk,none]; RCVD_IN_DNSWL_NONE(0.00)[1.3.d.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[steven.hartland@multiplay.co.uk,steven@multiplay.co.uk]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.13)[ip: (-6.42), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[steven.hartland@multiplay.co.uk,steven@multiplay.co.uk]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 09:40:43 -0000 If the illegal chars where removed or replaced would the result be useful, if so might that be a better approach? On Fri, 6 Dec 2019 at 00:06, Alan Somers wrote: > Author: asomers > Date: Fri Dec 6 00:06:05 2019 > New Revision: 355430 > URL: https://svnweb.freebsd.org/changeset/base/355430 > > Log: > ses: sanitize illegal strings in SES element descriptors > > The SES4r3 standard requires that element descriptors may only contain > ASCII > characters in the range 0x20 to 0x7e. Some SuperMicro expanders violate > that rule. This patch adds a sanity check to ses(4). Descriptors in > violation will be replaced by "". > > This patch fixes "sesutil --libxo xml" on such systems. Previously it > would > generate non-well-formed XML output. > > PR: 241929 > Reviewed by: allanjude > MFC after: 2 weeks > Sponsored by: Axcient > > Modified: > head/sys/cam/scsi/scsi_enc_ses.c > > Modified: head/sys/cam/scsi/scsi_enc_ses.c > > ============================================================================== > --- head/sys/cam/scsi/scsi_enc_ses.c Thu Dec 5 19:39:51 2019 > (r355429) > +++ head/sys/cam/scsi/scsi_enc_ses.c Fri Dec 6 00:06:05 2019 > (r355430) > @@ -110,7 +110,7 @@ typedef struct ses_addl_status { > typedef struct ses_element { > uint8_t eip; /* eip bit is set */ > uint16_t descr_len; /* length of the descriptor */ > - char *descr; /* descriptor for this object */ > + const char *descr; /* descriptor for this object */ > struct ses_addl_status addl; /* additional status info */ > } ses_element_t; > > @@ -1977,6 +1977,35 @@ ses_publish_cache(enc_softc_t *enc, struct > enc_fsm_sta > return (0); > } > > +/* > + * \brief Sanitize an element descriptor > + * > + * The SES4r3 standard, sections 3.1.2 and 6.1.10, specifies that element > + * descriptors may only contain ASCII characters in the range 0x20 to > 0x7e. > + * But some vendors violate that rule. Ensure that we only expose > compliant > + * descriptors to userland. > + * > + * \param desc SES element descriptor as reported by the hardware > + * \param len Length of desc in bytes, not necessarily including > + * trailing NUL. It will be modified if desc is > invalid. > + */ > +static const char* > +ses_sanitize_elm_desc(const char *desc, uint16_t *len) > +{ > + const char *invalid = ""; > + int i; > + > + for (i = 0; i < *len; i++) { > + if (desc[i] < 0x20 || desc[i] > 0x7e) { > + *len = strlen(invalid); > + return (invalid); > + } else if (desc[i] == 0) { > + break; > + } > + } > + return (desc); > +} > + > /** > * \brief Parse the descriptors for each object. > * > @@ -2061,7 +2090,8 @@ ses_process_elm_descs(enc_softc_t *enc, struct > enc_fsm > if (length > 0) { > elmpriv = element->elm_private; > elmpriv->descr_len = length; > - elmpriv->descr = &buf[offset]; > + elmpriv->descr = > ses_sanitize_elm_desc(&buf[offset], > + &elmpriv->descr_len); > } > > /* skip over the descriptor itself */ > From owner-svn-src-all@freebsd.org Fri Dec 6 09:50:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01E6E1C7818; Fri, 6 Dec 2019 09:50:02 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tnr96Cycz4FL3; Fri, 6 Dec 2019 09:50:01 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8BC3274E7; Fri, 6 Dec 2019 09:50:01 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB69o1ej099893; Fri, 6 Dec 2019 09:50:01 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB69o1Oc099892; Fri, 6 Dec 2019 09:50:01 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201912060950.xB69o1Oc099892@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 6 Dec 2019 09:50:01 +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: r355440 - stable/12/sys/amd64/vmm/intel X-SVN-Group: stable-12 X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: stable/12/sys/amd64/vmm/intel X-SVN-Commit-Revision: 355440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 09:50:02 -0000 Author: scottl Date: Fri Dec 6 09:50:01 2019 New Revision: 355440 URL: https://svnweb.freebsd.org/changeset/base/355440 Log: MFC r349184. This fixing PCI passthrough via VT-d on modern chipsets with multiple translation units. PR: 229852 Submitted by: callum@mitchison.org Modified: stable/12/sys/amd64/vmm/intel/vtd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/intel/vtd.c ============================================================================== --- stable/12/sys/amd64/vmm/intel/vtd.c Fri Dec 6 03:48:35 2019 (r355439) +++ stable/12/sys/amd64/vmm/intel/vtd.c Fri Dec 6 09:50:01 2019 (r355440) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); * Architecture Spec, September 2008. */ +#define VTD_DRHD_INCLUDE_PCI_ALL(Flags) (((Flags) >> 0) & 0x1) + /* Section 10.4 "Register Descriptions" */ struct vtdmap { volatile uint32_t version; @@ -116,10 +118,11 @@ struct domain { static SLIST_HEAD(, domain) domhead; #define DRHD_MAX_UNITS 8 -static int drhd_num; -static struct vtdmap *vtdmaps[DRHD_MAX_UNITS]; -static int max_domains; -typedef int (*drhd_ident_func_t)(void); +static ACPI_DMAR_HARDWARE_UNIT *drhds[DRHD_MAX_UNITS]; +static int drhd_num; +static struct vtdmap *vtdmaps[DRHD_MAX_UNITS]; +static int max_domains; +typedef int (*drhd_ident_func_t)(void); static uint64_t root_table[PAGE_SIZE / sizeof(uint64_t)] __aligned(4096); static uint64_t ctx_tables[256][PAGE_SIZE / sizeof(uint64_t)] __aligned(4096); @@ -175,6 +178,69 @@ domain_id(void) return (id); } +static struct vtdmap * +vtd_device_scope(uint16_t rid) +{ + int i, remaining, pathremaining; + char *end, *pathend; + struct vtdmap *vtdmap; + ACPI_DMAR_HARDWARE_UNIT *drhd; + ACPI_DMAR_DEVICE_SCOPE *device_scope; + ACPI_DMAR_PCI_PATH *path; + + for (i = 0; i < drhd_num; i++) { + drhd = drhds[i]; + + if (VTD_DRHD_INCLUDE_PCI_ALL(drhd->Flags)) { + /* + * From Intel VT-d arch spec, version 3.0: + * If a DRHD structure with INCLUDE_PCI_ALL flag Set is reported + * for a Segment, it must be enumerated by BIOS after all other + * DRHD structures for the same Segment. + */ + vtdmap = vtdmaps[i]; + return(vtdmap); + } + + end = (char *)drhd + drhd->Header.Length; + remaining = drhd->Header.Length - sizeof(ACPI_DMAR_HARDWARE_UNIT); + while (remaining > sizeof(ACPI_DMAR_DEVICE_SCOPE)) { + device_scope = (ACPI_DMAR_DEVICE_SCOPE *)(end - remaining); + remaining -= device_scope->Length; + + switch (device_scope->EntryType){ + /* 0x01 and 0x02 are PCI device entries */ + case 0x01: + case 0x02: + break; + default: + continue; + } + + if (PCI_RID2BUS(rid) != device_scope->Bus) + continue; + + pathend = (char *)device_scope + device_scope->Length; + pathremaining = device_scope->Length - sizeof(ACPI_DMAR_DEVICE_SCOPE); + while (pathremaining >= sizeof(ACPI_DMAR_PCI_PATH)) { + path = (ACPI_DMAR_PCI_PATH *)(pathend - pathremaining); + pathremaining -= sizeof(ACPI_DMAR_PCI_PATH); + + if (PCI_RID2SLOT(rid) != path->Device) + continue; + if (PCI_RID2FUNC(rid) != path->Function) + continue; + + vtdmap = vtdmaps[i]; + return (vtdmap); + } + } + } + + /* No matching scope */ + return (NULL); +} + static void vtd_wbflush(struct vtdmap *vtdmap) { @@ -240,7 +306,7 @@ vtd_translation_disable(struct vtdmap *vtdmap) static int vtd_init(void) { - int i, units, remaining; + int i, units, remaining, tmp; struct vtdmap *vtdmap; vm_paddr_t ctx_paddr; char *end, envname[32]; @@ -291,8 +357,9 @@ vtd_init(void) break; drhd = (ACPI_DMAR_HARDWARE_UNIT *)hdr; - vtdmaps[units++] = (struct vtdmap *)PHYS_TO_DMAP(drhd->Address); - if (units >= DRHD_MAX_UNITS) + drhds[units] = drhd; + vtdmaps[units] = (struct vtdmap *)PHYS_TO_DMAP(drhd->Address); + if (++units >= DRHD_MAX_UNITS) break; remaining -= hdr->Length; } @@ -302,13 +369,19 @@ vtd_init(void) skip_dmar: drhd_num = units; - vtdmap = vtdmaps[0]; - if (VTD_CAP_CM(vtdmap->cap) != 0) - panic("vtd_init: invalid caching mode"); + max_domains = 64 * 1024; /* maximum valid value */ + for (i = 0; i < drhd_num; i++){ + vtdmap = vtdmaps[i]; - max_domains = vtd_max_domains(vtdmap); + if (VTD_CAP_CM(vtdmap->cap) != 0) + panic("vtd_init: invalid caching mode"); + /* take most compatible (minimum) value */ + if ((tmp = vtd_max_domains(vtdmap)) < max_domains) + max_domains = tmp; + } + /* * Set up the root-table to point to the context-entry tables */ @@ -373,7 +446,6 @@ vtd_add_device(void *arg, uint16_t rid) struct vtdmap *vtdmap; uint8_t bus; - vtdmap = vtdmaps[0]; bus = PCI_RID2BUS(rid); ctxp = ctx_tables[bus]; pt_paddr = vtophys(dom->ptp); @@ -385,6 +457,10 @@ vtd_add_device(void *arg, uint16_t rid) (uint16_t)(ctxp[idx + 1] >> 8)); } + if ((vtdmap = vtd_device_scope(rid)) == NULL) + panic("vtd_add_device: device %x is not in scope for " + "any DMA remapping unit", rid); + /* * Order is important. The 'present' bit is set only after all fields * of the context pointer are initialized. @@ -568,8 +644,6 @@ vtd_create_domain(vm_paddr_t maxaddr) if (drhd_num <= 0) panic("vtd_create_domain: no dma remapping hardware available"); - vtdmap = vtdmaps[0]; - /* * Calculate AGAW. * Section 3.4.2 "Adjusted Guest Address Width", Architecture Spec. @@ -594,7 +668,14 @@ vtd_create_domain(vm_paddr_t maxaddr) pt_levels = 2; sagaw = 30; addrwidth = 0; - tmp = VTD_CAP_SAGAW(vtdmap->cap); + + tmp = ~0; + for (i = 0; i < drhd_num; i++) { + vtdmap = vtdmaps[i]; + /* take most compatible value */ + tmp &= VTD_CAP_SAGAW(vtdmap->cap); + } + for (i = 0; i < 5; i++) { if ((tmp & (1 << i)) != 0 && sagaw >= agaw) break; @@ -606,8 +687,8 @@ vtd_create_domain(vm_paddr_t maxaddr) } if (i >= 5) { - panic("vtd_create_domain: SAGAW 0x%lx does not support AGAW %d", - VTD_CAP_SAGAW(vtdmap->cap), agaw); + panic("vtd_create_domain: SAGAW 0x%x does not support AGAW %d", + tmp, agaw); } dom = malloc(sizeof(struct domain), M_VTD, M_ZERO | M_WAITOK); @@ -634,7 +715,12 @@ vtd_create_domain(vm_paddr_t maxaddr) * There is not any code to deal with the demotion at the moment * so we disable superpage mappings altogether. */ - dom->spsmask = VTD_CAP_SPS(vtdmap->cap); + dom->spsmask = ~0; + for (i = 0; i < drhd_num; i++) { + vtdmap = vtdmaps[i]; + /* take most compatible value */ + dom->spsmask &= VTD_CAP_SPS(vtdmap->cap); + } #endif SLIST_INSERT_HEAD(&domhead, dom, next); From owner-svn-src-all@freebsd.org Fri Dec 6 09:50:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3012D1C78A7; Fri, 6 Dec 2019 09:50:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tnrk0b6Fz4FRt; Fri, 6 Dec 2019 09:50:30 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EBB53274E9; Fri, 6 Dec 2019 09:50:29 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB69oTrN099971; Fri, 6 Dec 2019 09:50:29 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB69oTkO099970; Fri, 6 Dec 2019 09:50:29 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201912060950.xB69oTkO099970@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 6 Dec 2019 09:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355441 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 355441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 09:50:30 -0000 Author: tsoome Date: Fri Dec 6 09:50:29 2019 New Revision: 355441 URL: https://svnweb.freebsd.org/changeset/base/355441 Log: loader.efi: print ImageBase so we know where we are Output a bit of debugging aid. Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Fri Dec 6 09:50:01 2019 (r355440) +++ head/stand/efi/loader/main.c Fri Dec 6 09:50:29 2019 (r355441) @@ -999,6 +999,7 @@ main(int argc, CHAR16 *argv[]) printf(" %S", argv[i]); printf("\n"); + printf(" Image base: 0x%lx\n", (unsigned long)boot_img->ImageBase); printf(" EFI version: %d.%02d\n", ST->Hdr.Revision >> 16, ST->Hdr.Revision & 0xffff); printf(" EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor, From owner-svn-src-all@freebsd.org Fri Dec 6 11:46:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F8091C97EB; Fri, 6 Dec 2019 11:46:16 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TrQJ0pJyz4KsY; Fri, 6 Dec 2019 11:46:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2FCEAFF; Fri, 6 Dec 2019 11:46:15 +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 xB6BkFQh070108; Fri, 6 Dec 2019 11:46:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6BkF5F070105; Fri, 6 Dec 2019 11:46:15 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912061146.xB6BkF5F070105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 6 Dec 2019 11:46:15 +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: r355442 - in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Commit-Revision: 355442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 11:46:16 -0000 Author: kib Date: Fri Dec 6 11:46:15 2019 New Revision: 355442 URL: https://svnweb.freebsd.org/changeset/base/355442 Log: MFC r355211: Add a VN_OPEN_INVFS flag. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/12/sys/kern/vfs_vnops.c stable/12/sys/sys/vnode.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 09:50:29 2019 (r355441) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) @@ -5541,7 +5541,7 @@ vop_getextattr { flags = FREAD; NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, VN_OPEN_INVFS, 0, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { @@ -5678,7 +5678,8 @@ vop_setextattr { flags = FFLAGS(O_WRONLY | O_CREAT); NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0600, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred, + NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { Modified: stable/12/sys/kern/vfs_vnops.c ============================================================================== --- stable/12/sys/kern/vfs_vnops.c Fri Dec 6 09:50:29 2019 (r355441) +++ stable/12/sys/kern/vfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) @@ -216,7 +216,8 @@ restart: ndp->ni_cnd.cn_flags |= AUDITVNODE1; if (vn_open_flags & VN_OPEN_NOCAPCHECK) ndp->ni_cnd.cn_flags |= NOCAPCHECK; - bwillwrite(); + if ((vn_open_flags & VN_OPEN_INVFS) == 0) + bwillwrite(); if ((error = namei(ndp)) != 0) return (error); if (ndp->ni_vp == NULL) { Modified: stable/12/sys/sys/vnode.h ============================================================================== --- stable/12/sys/sys/vnode.h Fri Dec 6 09:50:29 2019 (r355441) +++ stable/12/sys/sys/vnode.h Fri Dec 6 11:46:15 2019 (r355442) @@ -577,6 +577,7 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t * #define VN_OPEN_NOAUDIT 0x00000001 #define VN_OPEN_NOCAPCHECK 0x00000002 #define VN_OPEN_NAMECACHE 0x00000004 +#define VN_OPEN_INVFS 0x00000008 /* * Public vnode manipulation functions. From owner-svn-src-all@freebsd.org Fri Dec 6 11:48:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E92411C9885; Fri, 6 Dec 2019 11:48:23 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TrSl5y41z4L19; Fri, 6 Dec 2019 11:48:23 +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 957E1B01; Fri, 6 Dec 2019 11:48:23 +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 xB6BmNCI070252; Fri, 6 Dec 2019 11:48:23 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6BmMdH070249; Fri, 6 Dec 2019 11:48:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912061148.xB6BmMdH070249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 6 Dec 2019 11:48:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355443 - in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: cddl/contrib/opensolaris/uts/common/fs/zfs kern sys X-SVN-Commit-Revision: 355443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 11:48:24 -0000 Author: kib Date: Fri Dec 6 11:48:22 2019 New Revision: 355443 URL: https://svnweb.freebsd.org/changeset/base/355443 Log: MFC r355211: Add a VN_OPEN_INVFS flag. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/11/sys/kern/vfs_vnops.c stable/11/sys/sys/vnode.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 11:48:22 2019 (r355443) @@ -5544,7 +5544,7 @@ vop_getextattr { flags = FREAD; NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, VN_OPEN_INVFS, 0, ap->a_cred, NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { @@ -5681,7 +5681,8 @@ vop_setextattr { flags = FFLAGS(O_WRONLY | O_CREAT); NDINIT_ATVP(&nd, LOOKUP, NOFOLLOW, UIO_SYSSPACE, attrname, xvp, td); - error = vn_open_cred(&nd, &flags, 0600, 0, ap->a_cred, NULL); + error = vn_open_cred(&nd, &flags, 0600, VN_OPEN_INVFS, ap->a_cred, + NULL); vp = nd.ni_vp; NDFREE(&nd, NDF_ONLY_PNBUF); if (error != 0) { Modified: stable/11/sys/kern/vfs_vnops.c ============================================================================== --- stable/11/sys/kern/vfs_vnops.c Fri Dec 6 11:46:15 2019 (r355442) +++ stable/11/sys/kern/vfs_vnops.c Fri Dec 6 11:48:22 2019 (r355443) @@ -217,7 +217,8 @@ restart: ndp->ni_cnd.cn_flags |= AUDITVNODE1; if (vn_open_flags & VN_OPEN_NOCAPCHECK) ndp->ni_cnd.cn_flags |= NOCAPCHECK; - bwillwrite(); + if ((vn_open_flags & VN_OPEN_INVFS) == 0) + bwillwrite(); if ((error = namei(ndp)) != 0) return (error); if (ndp->ni_vp == NULL) { Modified: stable/11/sys/sys/vnode.h ============================================================================== --- stable/11/sys/sys/vnode.h Fri Dec 6 11:46:15 2019 (r355442) +++ stable/11/sys/sys/vnode.h Fri Dec 6 11:48:22 2019 (r355443) @@ -591,6 +591,7 @@ typedef void vop_getpages_iodone_t(void *, vm_page_t * #define VN_OPEN_NOAUDIT 0x00000001 #define VN_OPEN_NOCAPCHECK 0x00000002 #define VN_OPEN_NAMECACHE 0x00000004 +#define VN_OPEN_INVFS 0x00000008 /* * Public vnode manipulation functions. From owner-svn-src-all@freebsd.org Fri Dec 6 12:55:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17D131CB950; Fri, 6 Dec 2019 12:55:40 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TsyN0b82z4P6D; Fri, 6 Dec 2019 12:55:40 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D24E817D5; Fri, 6 Dec 2019 12:55:39 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6CtdAO011377; Fri, 6 Dec 2019 12:55:39 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6CtdJw011374; Fri, 6 Dec 2019 12:55:39 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912061255.xB6CtdJw011374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 6 Dec 2019 12:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355444 - in head/sys: arm/mv arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: in head/sys: arm/mv arm64/conf conf X-SVN-Commit-Revision: 355444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 12:55:40 -0000 Author: loos Date: Fri Dec 6 12:55:39 2019 New Revision: 355444 URL: https://svnweb.freebsd.org/changeset/base/355444 Log: Add the SPI driver for the Marvell Armada 37x0 SoC. Interrupt based driver, implements SPI mode and clock configuration. Tested on espressobin and SG-3200. Sponsored by: Rubicon Communications, LLC (Netgate) Added: head/sys/arm/mv/a37x0_spi.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Added: head/sys/arm/mv/a37x0_spi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/a37x0_spi.c Fri Dec 6 12:55:39 2019 (r355444) @@ -0,0 +1,494 @@ +/*- + * Copyright (c) 2018, 2019 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include "spibus_if.h" + +struct a37x0_spi_softc { + device_t sc_dev; + struct mtx sc_mtx; + struct resource *sc_mem_res; + struct resource *sc_irq_res; + struct spi_command *sc_cmd; + bus_space_tag_t sc_bst; + bus_space_handle_t sc_bsh; + uint32_t sc_len; + uint32_t sc_maxfreq; + uint32_t sc_read; + uint32_t sc_flags; + uint32_t sc_written; + void *sc_intrhand; +}; + +#define A37X0_SPI_WRITE(_sc, _off, _val) \ + bus_space_write_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off), (_val)) +#define A37X0_SPI_READ(_sc, _off) \ + bus_space_read_4((_sc)->sc_bst, (_sc)->sc_bsh, (_off)) +#define A37X0_SPI_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define A37X0_SPI_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) + +#define A37X0_SPI_BUSY (1 << 0) +/* + * While the A3700 utils from Marvell usually sets the QSF clock to 200MHz, + * there is no guarantee that it is correct without the proper clock framework + * to retrieve the actual TBG and PLL settings. + */ +#define A37X0_SPI_CLOCK 200000000 /* QSF Clock 200MHz */ + +#define A37X0_SPI_CONTROL 0x0 +#define A37X0_SPI_CS_SHIFT 16 +#define A37X0_SPI_CS_MASK (0xf << A37X0_SPI_CS_SHIFT) +#define A37X0_SPI_CONF 0x4 +#define A37X0_SPI_WFIFO_THRS_SHIFT 28 +#define A37X0_SPI_RFIFO_THRS_SHIFT 24 +#define A37X0_SPI_AUTO_CS_EN (1 << 20) +#define A37X0_SPI_DMA_WR_EN (1 << 19) +#define A37X0_SPI_DMA_RD_EN (1 << 18) +#define A37X0_SPI_FIFO_MODE (1 << 17) +#define A37X0_SPI_SRST (1 << 16) +#define A37X0_SPI_XFER_START (1 << 15) +#define A37X0_SPI_XFER_STOP (1 << 14) +#define A37X0_SPI_INSTR_PIN (1 << 13) +#define A37X0_SPI_ADDR_PIN (1 << 12) +#define A37X0_SPI_DATA_PIN_MASK 0x3 +#define A37X0_SPI_DATA_PIN_SHIFT 10 +#define A37X0_SPI_FIFO_FLUSH (1 << 9) +#define A37X0_SPI_RW_EN (1 << 8) +#define A37X0_SPI_CLK_POL (1 << 7) +#define A37X0_SPI_CLK_PHASE (1 << 6) +#define A37X0_SPI_BYTE_LEN (1 << 5) +#define A37X0_SPI_PSC_MASK 0x1f +#define A37X0_SPI_DATA_OUT 0x8 +#define A37X0_SPI_DATA_IN 0xc +#define A37X0_SPI_INTR_STAT 0x28 +#define A37X0_SPI_INTR_MASK 0x2c +#define A37X0_SPI_RDY (1 << 1) +#define A37X0_SPI_XFER_DONE (1 << 0) + +static struct ofw_compat_data compat_data[] = { + { "marvell,armada-3700-spi", 1 }, + { NULL, 0 } +}; + +static void a37x0_spi_intr(void *); + +static int +a37x0_spi_wait(struct a37x0_spi_softc *sc, int timeout, uint32_t reg, + uint32_t mask) +{ + int i; + + for (i = 0; i < timeout; i++) { + if ((A37X0_SPI_READ(sc, reg) & mask) == 0) + return (0); + DELAY(100); + } + + return (ETIMEDOUT); +} + +static int +a37x0_spi_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + device_set_desc(dev, "Armada 37x0 SPI controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +a37x0_spi_attach(device_t dev) +{ + int err, rid; + pcell_t maxfreq; + struct a37x0_spi_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + + rid = 0; + sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (!sc->sc_mem_res) { + device_printf(dev, "cannot allocate memory window\n"); + return (ENXIO); + } + + sc->sc_bst = rman_get_bustag(sc->sc_mem_res); + sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); + + rid = 0; + sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE); + if (!sc->sc_irq_res) { + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot allocate interrupt\n"); + return (ENXIO); + } + + /* Make sure that no CS is asserted. */ + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONTROL); + A37X0_SPI_WRITE(sc, A37X0_SPI_CONTROL, reg & ~A37X0_SPI_CS_MASK); + + /* Reset FIFO. */ + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONF); + A37X0_SPI_WRITE(sc, A37X0_SPI_CONF, reg | A37X0_SPI_FIFO_FLUSH); + err = a37x0_spi_wait(sc, 20, A37X0_SPI_CONF, A37X0_SPI_FIFO_FLUSH); + if (err != 0) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot flush the controller fifo.\n"); + return (ENXIO); + } + + /* Reset the Controller. */ + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONF); + A37X0_SPI_WRITE(sc, A37X0_SPI_CONF, reg | A37X0_SPI_SRST); + DELAY(1000); + /* Enable the single byte IO, disable FIFO. */ + reg &= ~(A37X0_SPI_FIFO_MODE | A37X0_SPI_BYTE_LEN); + A37X0_SPI_WRITE(sc, A37X0_SPI_CONF, reg); + + /* Disable and clear interrupts. */ + A37X0_SPI_WRITE(sc, A37X0_SPI_INTR_MASK, 0); + reg = A37X0_SPI_READ(sc, A37X0_SPI_INTR_STAT); + A37X0_SPI_WRITE(sc, A37X0_SPI_INTR_STAT, reg); + + /* Hook up our interrupt handler. */ + if (bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, a37x0_spi_intr, sc, &sc->sc_intrhand)) { + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + device_printf(dev, "cannot setup the interrupt handler\n"); + return (ENXIO); + } + + mtx_init(&sc->sc_mtx, "a37x0_spi", NULL, MTX_DEF); + + /* Read the controller max-frequency. */ + if (OF_getencprop(ofw_bus_get_node(dev), "spi-max-frequency", &maxfreq, + sizeof(maxfreq)) == -1) + maxfreq = 0; + sc->sc_maxfreq = maxfreq; + + device_add_child(dev, "spibus", -1); + + /* Probe and attach the spibus when interrupts are available. */ + config_intrhook_oneshot((ich_func_t)bus_generic_attach, dev); + + return (0); +} + +static int +a37x0_spi_detach(device_t dev) +{ + struct a37x0_spi_softc *sc; + + bus_generic_detach(dev); + sc = device_get_softc(dev); + mtx_destroy(&sc->sc_mtx); + if (sc->sc_intrhand) + bus_teardown_intr(dev, sc->sc_irq_res, sc->sc_intrhand); + if (sc->sc_irq_res) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq_res); + if (sc->sc_mem_res) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); + + return (0); +} + +static __inline void +a37x0_spi_rx_byte(struct a37x0_spi_softc *sc) +{ + struct spi_command *cmd; + uint32_t read; + uint8_t *p; + + if (sc->sc_read == sc->sc_len) + return; + cmd = sc->sc_cmd; + p = (uint8_t *)cmd->rx_cmd; + read = sc->sc_read++; + if (read >= cmd->rx_cmd_sz) { + p = (uint8_t *)cmd->rx_data; + read -= cmd->rx_cmd_sz; + } + p[read] = A37X0_SPI_READ(sc, A37X0_SPI_DATA_IN) & 0xff; +} + +static __inline void +a37x0_spi_tx_byte(struct a37x0_spi_softc *sc) +{ + struct spi_command *cmd; + uint32_t written; + uint8_t *p; + + if (sc->sc_written == sc->sc_len) + return; + cmd = sc->sc_cmd; + p = (uint8_t *)cmd->tx_cmd; + written = sc->sc_written++; + if (written >= cmd->tx_cmd_sz) { + p = (uint8_t *)cmd->tx_data; + written -= cmd->tx_cmd_sz; + } + A37X0_SPI_WRITE(sc, A37X0_SPI_DATA_OUT, p[written]); +} + +static __inline void +a37x0_spi_set_clock(struct a37x0_spi_softc *sc, uint32_t clock) +{ + uint32_t psc, reg; + + if (sc->sc_maxfreq > 0 && clock > sc->sc_maxfreq) + clock = sc->sc_maxfreq; + psc = A37X0_SPI_CLOCK / clock; + if ((A37X0_SPI_CLOCK % clock) > 0) + psc++; + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONF); + reg &= ~A37X0_SPI_PSC_MASK; + reg |= psc & A37X0_SPI_PSC_MASK; + A37X0_SPI_WRITE(sc, A37X0_SPI_CONF, reg); +} + +static __inline void +a37x0_spi_set_pins(struct a37x0_spi_softc *sc, uint32_t npins) +{ + uint32_t reg; + + /* Sets single, dual or quad SPI mode. */ + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONF); + reg &= ~(A37X0_SPI_DATA_PIN_MASK << A37X0_SPI_DATA_PIN_SHIFT); + reg |= (npins / 2) << A37X0_SPI_DATA_PIN_SHIFT; + reg |= A37X0_SPI_INSTR_PIN | A37X0_SPI_ADDR_PIN; + A37X0_SPI_WRITE(sc, A37X0_SPI_CONF, reg); +} + +static __inline void +a37x0_spi_set_mode(struct a37x0_spi_softc *sc, uint32_t mode) +{ + uint32_t reg; + + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONF); + switch (mode) { + case 0: + reg &= ~(A37X0_SPI_CLK_PHASE | A37X0_SPI_CLK_POL); + break; + case 1: + reg &= ~A37X0_SPI_CLK_POL; + reg |= A37X0_SPI_CLK_PHASE; + break; + case 2: + reg &= ~A37X0_SPI_CLK_PHASE; + reg |= A37X0_SPI_CLK_POL; + break; + case 3: + reg |= (A37X0_SPI_CLK_PHASE | A37X0_SPI_CLK_POL); + break; + } + A37X0_SPI_WRITE(sc, A37X0_SPI_CONF, reg); +} + +static void +a37x0_spi_intr(void *arg) +{ + struct a37x0_spi_softc *sc; + uint32_t status; + + sc = (struct a37x0_spi_softc *)arg; + A37X0_SPI_LOCK(sc); + + /* Filter stray interrupts. */ + if ((sc->sc_flags & A37X0_SPI_BUSY) == 0) { + A37X0_SPI_UNLOCK(sc); + return; + } + + status = A37X0_SPI_READ(sc, A37X0_SPI_INTR_STAT); + if (status & A37X0_SPI_XFER_DONE) + a37x0_spi_rx_byte(sc); + + /* Clear the interrupt status. */ + A37X0_SPI_WRITE(sc, A37X0_SPI_INTR_STAT, status); + + /* Check for end of transfer. */ + if (sc->sc_written == sc->sc_len && sc->sc_read == sc->sc_len) + wakeup(sc->sc_dev); + else + a37x0_spi_tx_byte(sc); + + A37X0_SPI_UNLOCK(sc); +} + +static int +a37x0_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + int timeout; + struct a37x0_spi_softc *sc; + uint32_t clock, cs, mode, reg; + + KASSERT(cmd->tx_cmd_sz == cmd->rx_cmd_sz, + ("TX/RX command sizes should be equal")); + KASSERT(cmd->tx_data_sz == cmd->rx_data_sz, + ("TX/RX data sizes should be equal")); + + /* Get the proper data for this child. */ + spibus_get_cs(child, &cs); + cs &= ~SPIBUS_CS_HIGH; + if (cs > 3) { + device_printf(dev, + "Invalid CS %d requested by %s\n", cs, + device_get_nameunit(child)); + return (EINVAL); + } + spibus_get_clock(child, &clock); + if (clock == 0) { + device_printf(dev, + "Invalid clock %uHz requested by %s\n", clock, + device_get_nameunit(child)); + return (EINVAL); + } + spibus_get_mode(child, &mode); + if (mode > 3) { + device_printf(dev, + "Invalid mode %u requested by %s\n", mode, + device_get_nameunit(child)); + return (EINVAL); + } + + sc = device_get_softc(dev); + A37X0_SPI_LOCK(sc); + + /* Wait until the controller is free. */ + while (sc->sc_flags & A37X0_SPI_BUSY) + mtx_sleep(dev, &sc->sc_mtx, 0, "a37x0_spi", 0); + + /* Now we have control over SPI controller. */ + sc->sc_flags = A37X0_SPI_BUSY; + + /* Set transfer mode and clock. */ + a37x0_spi_set_mode(sc, mode); + a37x0_spi_set_pins(sc, 1); + a37x0_spi_set_clock(sc, clock); + + /* Set CS. */ + A37X0_SPI_WRITE(sc, A37X0_SPI_CONTROL, 1 << (A37X0_SPI_CS_SHIFT + cs)); + + /* Save a pointer to the SPI command. */ + sc->sc_cmd = cmd; + sc->sc_read = 0; + sc->sc_written = 0; + sc->sc_len = cmd->tx_cmd_sz + cmd->tx_data_sz; + + /* Clear interrupts. */ + reg = A37X0_SPI_READ(sc, A37X0_SPI_INTR_STAT); + A37X0_SPI_WRITE(sc, A37X0_SPI_INTR_STAT, reg); + + while ((sc->sc_len - sc->sc_written) > 0) { + /* + * Write to start the transmission and read the byte + * back when ready. + */ + a37x0_spi_tx_byte(sc); + timeout = 1000; + while (--timeout > 0) { + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONTROL); + if (reg & A37X0_SPI_XFER_DONE) + break; + DELAY(1); + } + if (timeout == 0) + break; + a37x0_spi_rx_byte(sc); + } + + /* Stop the controller. */ + reg = A37X0_SPI_READ(sc, A37X0_SPI_CONTROL); + A37X0_SPI_WRITE(sc, A37X0_SPI_CONTROL, reg & ~A37X0_SPI_CS_MASK); + A37X0_SPI_WRITE(sc, A37X0_SPI_INTR_MASK, 0); + + /* Release the controller and wakeup the next thread waiting for it. */ + sc->sc_flags = 0; + wakeup_one(dev); + A37X0_SPI_UNLOCK(sc); + + return ((timeout == 0) ? EIO : 0); +} + +static phandle_t +a37x0_spi_get_node(device_t bus, device_t dev) +{ + + return (ofw_bus_get_node(bus)); +} + +static device_method_t a37x0_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, a37x0_spi_probe), + DEVMETHOD(device_attach, a37x0_spi_attach), + DEVMETHOD(device_detach, a37x0_spi_detach), + + /* SPI interface */ + DEVMETHOD(spibus_transfer, a37x0_spi_transfer), + + /* ofw_bus interface */ + DEVMETHOD(ofw_bus_get_node, a37x0_spi_get_node), + + DEVMETHOD_END +}; + +static devclass_t a37x0_spi_devclass; + +static driver_t a37x0_spi_driver = { + "spi", + a37x0_spi_methods, + sizeof(struct a37x0_spi_softc), +}; + +DRIVER_MODULE(a37x0_spi, simplebus, a37x0_spi_driver, a37x0_spi_devclass, 0, 0); Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Dec 6 11:48:22 2019 (r355443) +++ head/sys/arm64/conf/GENERIC Fri Dec 6 12:55:39 2019 (r355444) @@ -288,6 +288,7 @@ device mv_thermal # Marvell Thermal Sensor Controller # SPI device spibus +device a37x0_spi # Marvell Armada 37x0 SPI Controller device bcm2835_spi # Broadcom BCM283x SPI bus device rk_spi # RockChip SPI controller Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Dec 6 11:48:22 2019 (r355443) +++ head/sys/conf/files.arm64 Fri Dec 6 12:55:39 2019 (r355444) @@ -108,6 +108,7 @@ arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm arm/broadcom/bcm2835/bcm283x_dwc_fdt.c optional dwcotg fdt soc_brcm_bcm2837 | dwcotg fdt soc_brcm_bcm2838 arm/mv/a37x0_gpio.c optional a37x0_gpio gpio fdt arm/mv/a37x0_iic.c optional a37x0_iic iicbus fdt +arm/mv/a37x0_spi.c optional a37x0_spi spibus fdt arm/mv/armada38x/armada38x_rtc.c optional mv_rtc fdt arm/mv/gpio.c optional mv_gpio fdt arm/mv/mvebu_pinctrl.c optional mvebu_pinctrl fdt From owner-svn-src-all@freebsd.org Fri Dec 6 14:19:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F89F1CCF3C; Fri, 6 Dec 2019 14:19:24 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tvq01Tm1z4SZS; Fri, 6 Dec 2019 14:19:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id xB6EJFWf011153 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 6 Dec 2019 16:19:18 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua xB6EJFWf011153 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id xB6EJFLC011152; Fri, 6 Dec 2019 16:19:15 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 6 Dec 2019 16:19:15 +0200 From: Konstantin Belousov To: Scott Long Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355436 - in head/sys: amd64/amd64 x86/x86 Message-ID: <20191206141915.GK2744@kib.kiev.ua> References: <201912060243.xB62h5So053092@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201912060243.xB62h5So053092@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 47Tvq01Tm1z4SZS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 14:19:24 -0000 On Fri, Dec 06, 2019 at 02:43:05AM +0000, Scott Long wrote: > Author: scottl > Date: Fri Dec 6 02:43:05 2019 > New Revision: 355436 > URL: https://svnweb.freebsd.org/changeset/base/355436 > > Log: > Move the mds, irbs, and ssb mitigation knobs into machdep.mitigations. > They're in both the old and new places in HEAD for the moment for > discussion and transition. The old locations will be garbage collected > in 4 weeks. MFCs to 12 an 11 will keep the old and new for transition > purposes. > > Reviewed by: kib You did not updated security(7). > MFC after: 4 weeks > Sponsored by: Intel > Differential Revision: https://reviews.freebsd.org/D22590 > > Modified: > head/sys/amd64/amd64/machdep.c > head/sys/x86/x86/cpu_machdep.c > > Modified: head/sys/amd64/amd64/machdep.c > ============================================================================== > --- head/sys/amd64/amd64/machdep.c Fri Dec 6 01:53:02 2019 (r355435) > +++ head/sys/amd64/amd64/machdep.c Fri Dec 6 02:43:05 2019 (r355436) > @@ -1778,10 +1778,17 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) > vty_set_preferred(VTY_VT); > > TUNABLE_INT_FETCH("hw.ibrs_disable", &hw_ibrs_disable); > + TUNABLE_INT_FETCH("machdep.mitigations.ibrs.disable", &hw_ibrs_disable); > + > TUNABLE_INT_FETCH("hw.spec_store_bypass_disable", &hw_ssb_disable); > + TUNABLE_INT_FETCH("machdep.mitigations.ssb.disable", &hw_ssb_disable); > + > TUNABLE_INT_FETCH("machdep.syscall_ret_l1d_flush", > &syscall_ret_l1d_flush_mode); > + > TUNABLE_INT_FETCH("hw.mds_disable", &hw_mds_disable); > + TUNABLE_INT_FETCH("machdep.mitigations.mds.disable", &hw_mds_disable); > + > TUNABLE_INT_FETCH("machdep.mitigations.taa.enable", &x86_taa_enable); > > finishidentcpu(); /* Final stage of CPU initialization */ > > Modified: head/sys/x86/x86/cpu_machdep.c > ============================================================================== > --- head/sys/x86/x86/cpu_machdep.c Fri Dec 6 01:53:02 2019 (r355435) > +++ head/sys/x86/x86/cpu_machdep.c Fri Dec 6 02:43:05 2019 (r355436) > @@ -877,6 +877,12 @@ int hw_ibrs_disable = 1; > SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0, > "Indirect Branch Restricted Speculation active"); > > +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, ibrs, CTLFLAG_RW, 0, > + "Indirect Branch Restricted Speculation active"); > + > +SYSCTL_INT(_machdep_mitigations_ibrs, OID_AUTO, active, CTLFLAG_RD, > + &hw_ibrs_active, 0, "Indirect Branch Restricted Speculation active"); > + > void > hw_ibrs_recalculate(void) > { > @@ -907,6 +913,11 @@ SYSCTL_PROC(_hw, OID_AUTO, ibrs_disable, CTLTYPE_INT | > CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ibrs_disable_handler, "I", > "Disable Indirect Branch Restricted Speculation"); > > +SYSCTL_PROC(_machdep_mitigations_ibrs, OID_AUTO, disable, CTLTYPE_INT | > + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, > + hw_ibrs_disable_handler, "I", > + "Disable Indirect Branch Restricted Speculation"); > + > int hw_ssb_active; > int hw_ssb_disable; > > @@ -914,6 +925,12 @@ SYSCTL_INT(_hw, OID_AUTO, spec_store_bypass_disable_ac > &hw_ssb_active, 0, > "Speculative Store Bypass Disable active"); > > +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, ssb, CTLFLAG_RW, 0, > + "Speculative Store Bypass Disable active"); > + > +SYSCTL_INT(_machdep_mitigations_ssb, OID_AUTO, active, CTLFLAG_RD, > + &hw_ssb_active, 0, "Speculative Store Bypass Disable active"); > + > static void > hw_ssb_set(bool enable, bool for_all_cpus) > { > @@ -967,6 +984,11 @@ SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, > hw_ssb_disable_handler, "I", > "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); > > +SYSCTL_PROC(_machdep_mitigations_ssb, OID_AUTO, disable, CTLTYPE_INT | > + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, > + hw_ssb_disable_handler, "I", > + "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); > + > int hw_mds_disable; > > /* > @@ -1016,6 +1038,14 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable_state, > sysctl_hw_mds_disable_state_handler, "A", > "Microarchitectural Data Sampling Mitigation state"); > > +SYSCTL_NODE(_machdep_mitigations, OID_AUTO, mds, CTLFLAG_RW, 0, > + "Microarchitectural Data Sampling Mitigation state"); > + > +SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, state, > + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, > + sysctl_hw_mds_disable_state_handler, "A", > + "Microarchitectural Data Sampling Mitigation state"); > + > _Static_assert(__offsetof(struct pcpu, pc_mds_tmp) % 64 == 0, "MDS AVX512"); > > void > @@ -1172,6 +1202,11 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | > "Microarchitectural Data Sampling Mitigation " > "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); > > +SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, disable, CTLTYPE_INT | > + CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, > + sysctl_mds_disable_handler, "I", > + "Microarchitectural Data Sampling Mitigation " > + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); > > /* > * Intel Transactional Memory Asynchronous Abort Mitigation From owner-svn-src-all@freebsd.org Fri Dec 6 14:23:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 972901CD24A; Fri, 6 Dec 2019 14:23:30 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f44.google.com (mail-io1-f44.google.com [209.85.166.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47Tvvk3XTqz4T5F; Fri, 6 Dec 2019 14:23:30 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f44.google.com with SMTP id f82so7469017ioa.9; Fri, 06 Dec 2019 06:23:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=w6Nh7dkgMiWsBWYuhUiiA+2Wrb0LkF2AK04qghWrnw8=; b=VKEXqwZrblfPRZm/t16bJpw54BUVlqyy2/HW+gjGShFCyKrxteL3CgN9nh7364OP9n vtYsuamIM493V6tm00eB7KpXdnh/IFQGkkxaDcwFBDZJ1KENV76rRjr29pg4GpDoU4G/ JuamBFcoq3QZSrTffvLscfQscPAkVjbII4JQcmUCw6UUkvCl2P39QipllEIb2DoLdjQ7 r3rj2eZ+rQMm8IAacRiEz8yEHcBRAFOE5wfG4vskMFCduY+48MA2PbXzJGJheh1akDuK G2PjeHkvgzGgMF8VdBnAsyH1cHaJ5fIaSF6pWYZB0yfcVM1b/DLPbRvi8bb0Fmgh2yIo 5N2Q== X-Gm-Message-State: APjAAAVOvYoAN8zHu/gJiblrxN/oZSN2RIcLAdLwo0cv/O5gsoi1Fkhx fPe0w57BsLguHQkMfqreDdKM9FRvGho6v30D1ztzkA5g X-Google-Smtp-Source: APXvYqx6wFv2LVWRTvPuzA0v/dtwlcpoAhnNVg5MRKVPYKfvC6O7Vj4JH/4l3uxG+DtPhlL+kcjupVdjHfoKD/rItX4= X-Received: by 2002:a05:6638:3b6:: with SMTP id z22mr7037830jap.35.1575642209209; Fri, 06 Dec 2019 06:23:29 -0800 (PST) MIME-Version: 1.0 References: <201912060243.xB62h5So053092@repo.freebsd.org> In-Reply-To: <201912060243.xB62h5So053092@repo.freebsd.org> From: Ed Maste Date: Fri, 6 Dec 2019 05:36:59 -0500 Message-ID: Subject: Re: svn commit: r355436 - in head/sys: amd64/amd64 x86/x86 To: Scott Long Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47Tvvk3XTqz4T5F X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 14:23:30 -0000 On Thu, 5 Dec 2019 at 21:43, Scott Long wrote: > > Author: scottl > Date: Fri Dec 6 02:43:05 2019 > New Revision: 355436 > URL: https://svnweb.freebsd.org/changeset/base/355436 > > Log: > Move the mds, irbs, and ssb mitigation knobs into machdep.mitigations. If we're moving them and adding backwards-compatibility scaffolding we really should correct the sense of the sysctls at the same time. From owner-svn-src-all@freebsd.org Fri Dec 6 14:58:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55ADC1CE01C; Fri, 6 Dec 2019 14:58:57 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [IPv6:2607:fc50:1000:7400:216:3eff:fe72:314f]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Twhd1PPZz4VlS; Fri, 6 Dec 2019 14:58:56 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from cerise.vangyzen.net (unknown [70.97.188.230]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 341D65648D; Fri, 6 Dec 2019 08:58:50 -0600 (CST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: svn commit: r355436 - in head/sys: amd64/amd64 x86/x86 From: Eric van Gyzen In-Reply-To: Date: Fri, 6 Dec 2019 08:58:48 -0600 Cc: Scott Long , src-committers , svn-src-all , svn-src-head Content-Transfer-Encoding: quoted-printable Message-Id: References: <201912060243.xB62h5So053092@repo.freebsd.org> To: Ed Maste X-Mailer: Apple Mail (2.3601.0.10) X-Rspamd-Queue-Id: 47Twhd1PPZz4VlS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 14:58:57 -0000 > On Dec 6, 2019, at 4:36 AM, Ed Maste wrote: >=20 > On Thu, 5 Dec 2019 at 21:43, Scott Long wrote: >>=20 >> Author: scottl >> Date: Fri Dec 6 02:43:05 2019 >> New Revision: 355436 >> URL: https://svnweb.freebsd.org/changeset/base/355436 >>=20 >> Log: >> Move the mds, irbs, and ssb mitigation knobs into = machdep.mitigations. >=20 > If we're moving them and adding backwards-compatibility scaffolding we > really should correct the sense of the sysctls at the same time. I was just going to suggest that. For some, 0 is secure; for others, 1 = is secure. Since they=E2=80=99re under =E2=80=9Cmitigations,=E2=80=9D I = think 1 should consistently mean =E2=80=9Cmitigated.=E2=80=9D Eric= From owner-svn-src-all@freebsd.org Fri Dec 6 15:01:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D53481CE217; Fri, 6 Dec 2019 15:01:37 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Twlj5KhFz4W7q; Fri, 6 Dec 2019 15:01:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9A8632D7A; Fri, 6 Dec 2019 15:01:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6F1bxt085158; Fri, 6 Dec 2019 15:01:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6F1bQD085156; Fri, 6 Dec 2019 15:01:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061501.xB6F1bQD085156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 15:01:37 +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: r355445 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 15:01:37 -0000 Author: markj Date: Fri Dec 6 15:01:36 2019 New Revision: 355445 URL: https://svnweb.freebsd.org/changeset/base/355445 Log: MFC r355001: Fix locking in vm_reserv_reclaim_contig(). Modified: stable/12/sys/vm/vm_reserv.c stable/12/sys/vm/vm_reserv.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_reserv.c ============================================================================== --- stable/12/sys/vm/vm_reserv.c Fri Dec 6 12:55:39 2019 (r355444) +++ stable/12/sys/vm/vm_reserv.c Fri Dec 6 15:01:36 2019 (r355445) @@ -181,10 +181,11 @@ popmap_is_set(popmap_t popmap[], int i) * * A partially populated reservation can be broken and reclaimed at any time. * - * r - vm_reserv_lock + * c - constant after boot * d - vm_reserv_domain_lock * o - vm_reserv_object_lock - * c - constant after boot + * r - vm_reserv_lock + * s - vm_reserv_domain_scan_lock */ struct vm_reserv { struct mtx lock; /* reservation lock. */ @@ -200,6 +201,8 @@ struct vm_reserv { popmap_t popmap[NPOPMAP_MAX]; /* (r) bit vector, used pages */ }; +TAILQ_HEAD(vm_reserv_queue, vm_reserv); + #define vm_reserv_lockptr(rv) (&(rv)->lock) #define vm_reserv_assert_locked(rv) \ mtx_assert(vm_reserv_lockptr(rv), MA_OWNED) @@ -238,18 +241,26 @@ static vm_reserv_t vm_reserv_array; * is the least recently changed, partially populated reservation. * * Access to this queue is synchronized by the per-domain reservation lock. + * Threads reclaiming free pages from the queue must hold the per-domain scan + * lock. */ struct vm_reserv_domain { - struct mtx lock; - TAILQ_HEAD(, vm_reserv) partpop; + struct mtx lock; + struct vm_reserv_queue partpop; /* (d) */ + struct vm_reserv marker; /* (d, s) scan marker/lock */ } __aligned(CACHE_LINE_SIZE); static struct vm_reserv_domain vm_rvd[MAXMEMDOM]; #define vm_reserv_domain_lockptr(d) (&vm_rvd[(d)].lock) +#define vm_reserv_domain_assert_locked(d) \ + mtx_assert(vm_reserv_domain_lockptr(d), MA_OWNED) #define vm_reserv_domain_lock(d) mtx_lock(vm_reserv_domain_lockptr(d)) #define vm_reserv_domain_unlock(d) mtx_unlock(vm_reserv_domain_lockptr(d)) +#define vm_reserv_domain_scan_lock(d) mtx_lock(&vm_rvd[(d)].marker.lock) +#define vm_reserv_domain_scan_unlock(d) mtx_unlock(&vm_rvd[(d)].marker.lock) + static SYSCTL_NODE(_vm, OID_AUTO, reserv, CTLFLAG_RD, 0, "Reservation Info"); static counter_u64_t vm_reserv_broken = EARLY_COUNTER; @@ -350,6 +361,8 @@ sysctl_vm_reserv_partpopq(SYSCTL_HANDLER_ARGS) unused_pages = 0; vm_reserv_domain_lock(domain); TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { + if (rv == &vm_rvd[domain].marker) + continue; counter++; unused_pages += VM_LEVEL_0_NPAGES - rv->popcnt; } @@ -1156,7 +1169,8 @@ vm_reserv_init(void) vm_paddr_t paddr; struct vm_phys_seg *seg; struct vm_reserv *rv; - int i, segind; + struct vm_reserv_domain *rvd; + int i, j, segind; /* * Initialize the reservation array. Specifically, initialize the @@ -1175,8 +1189,18 @@ vm_reserv_init(void) } } for (i = 0; i < MAXMEMDOM; i++) { - mtx_init(&vm_rvd[i].lock, "VM reserv domain", NULL, MTX_DEF); - TAILQ_INIT(&vm_rvd[i].partpop); + rvd = &vm_rvd[i]; + mtx_init(&rvd->lock, "vm reserv domain", NULL, MTX_DEF); + TAILQ_INIT(&rvd->partpop); + mtx_init(&rvd->marker.lock, "vm reserv marker", NULL, MTX_DEF); + + /* + * Fully populated reservations should never be present in the + * partially populated reservation queues. + */ + rvd->marker.popcnt = VM_LEVEL_0_NPAGES; + for (j = 0; j < NBPOPMAP; j++) + popmap_set(rvd->marker.popmap, j); } for (i = 0; i < VM_RESERV_OBJ_LOCK_COUNT; i++) @@ -1226,50 +1250,71 @@ vm_reserv_level_iffullpop(vm_page_t m) } /* - * Breaks the given partially populated reservation, releasing its free pages - * to the physical memory allocator. + * Remove a partially populated reservation from the queue. */ static void -vm_reserv_reclaim(vm_reserv_t rv) +vm_reserv_dequeue(vm_reserv_t rv) { + vm_reserv_domain_assert_locked(rv->domain); vm_reserv_assert_locked(rv); CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); - vm_reserv_domain_lock(rv->domain); KASSERT(rv->inpartpopq, ("vm_reserv_reclaim: reserv %p's inpartpopq is FALSE", rv)); - KASSERT(rv->domain < vm_ndomains, - ("vm_reserv_reclaim: reserv %p's domain is corrupted %d", - rv, rv->domain)); + TAILQ_REMOVE(&vm_rvd[rv->domain].partpop, rv, partpopq); rv->inpartpopq = FALSE; - vm_reserv_domain_unlock(rv->domain); +} + +/* + * Breaks the given partially populated reservation, releasing its free pages + * to the physical memory allocator. + */ +static void +vm_reserv_reclaim(vm_reserv_t rv) +{ + + vm_reserv_assert_locked(rv); + CTR5(KTR_VM, "%s: rv %p object %p popcnt %d inpartpop %d", + __FUNCTION__, rv, rv->object, rv->popcnt, rv->inpartpopq); + if (rv->inpartpopq) { + vm_reserv_domain_lock(rv->domain); + vm_reserv_dequeue(rv); + vm_reserv_domain_unlock(rv->domain); + } vm_reserv_break(rv); counter_u64_add(vm_reserv_reclaimed, 1); } /* - * Breaks the reservation at the head of the partially populated reservation + * Breaks a reservation near the head of the partially populated reservation * queue, releasing its free pages to the physical memory allocator. Returns * TRUE if a reservation is broken and FALSE otherwise. */ -boolean_t +bool vm_reserv_reclaim_inactive(int domain) { vm_reserv_t rv; - while ((rv = TAILQ_FIRST(&vm_rvd[domain].partpop)) != NULL) { - vm_reserv_lock(rv); - if (rv != TAILQ_FIRST(&vm_rvd[domain].partpop)) { - vm_reserv_unlock(rv); - continue; + vm_reserv_domain_lock(domain); + TAILQ_FOREACH(rv, &vm_rvd[domain].partpop, partpopq) { + /* + * A locked reservation is likely being updated or reclaimed, + * so just skip ahead. + */ + if (rv != &vm_rvd[domain].marker && vm_reserv_trylock(rv)) { + vm_reserv_dequeue(rv); + break; } + } + vm_reserv_domain_unlock(domain); + if (rv != NULL) { vm_reserv_reclaim(rv); vm_reserv_unlock(rv); - return (TRUE); + return (true); } - return (FALSE); + return (false); } /* @@ -1355,20 +1400,23 @@ vm_reserv_test_contig(vm_reserv_t rv, u_long npages, v * contiguous physical memory. If a satisfactory reservation is found, it is * broken. Returns true if a reservation is broken and false otherwise. */ -boolean_t +bool vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary) { + struct vm_reserv_queue *queue; vm_paddr_t pa, size; - vm_reserv_t rv, rvn; + vm_reserv_t marker, rv, rvn; if (npages > VM_LEVEL_0_NPAGES - 1) return (false); + marker = &vm_rvd[domain].marker; + queue = &vm_rvd[domain].partpop; size = npages << PAGE_SHIFT; + + vm_reserv_domain_scan_lock(domain); vm_reserv_domain_lock(domain); -again: - for (rv = TAILQ_FIRST(&vm_rvd[domain].partpop); rv != NULL; rv = rvn) { - rvn = TAILQ_NEXT(rv, partpopq); + TAILQ_FOREACH_SAFE(rv, queue, partpopq, rvn) { pa = VM_PAGE_TO_PHYS(&rv->pages[0]); if (pa + VM_LEVEL_0_SIZE - size < low) { /* This entire reservation is too low; go to next. */ @@ -1378,29 +1426,35 @@ again: /* This entire reservation is too high; go to next. */ continue; } + if (vm_reserv_trylock(rv) == 0) { + TAILQ_INSERT_AFTER(queue, rv, marker, partpopq); vm_reserv_domain_unlock(domain); vm_reserv_lock(rv); - if (!rv->inpartpopq) { + if (!rv->inpartpopq || + TAILQ_NEXT(rv, partpopq) != marker) { + vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (!rvn->inpartpopq) - goto again; + rvn = TAILQ_NEXT(marker, partpopq); + TAILQ_REMOVE(queue, marker, partpopq); continue; } - } else - vm_reserv_domain_unlock(domain); + vm_reserv_domain_lock(domain); + TAILQ_REMOVE(queue, marker, partpopq); + } + vm_reserv_domain_unlock(domain); if (vm_reserv_test_contig(rv, npages, low, high, alignment, boundary)) { + vm_reserv_domain_scan_unlock(domain); vm_reserv_reclaim(rv); vm_reserv_unlock(rv); return (true); } vm_reserv_unlock(rv); vm_reserv_domain_lock(domain); - if (rvn != NULL && !rvn->inpartpopq) - goto again; } vm_reserv_domain_unlock(domain); + vm_reserv_domain_scan_unlock(domain); return (false); } Modified: stable/12/sys/vm/vm_reserv.h ============================================================================== --- stable/12/sys/vm/vm_reserv.h Fri Dec 6 12:55:39 2019 (r355444) +++ stable/12/sys/vm/vm_reserv.h Fri Dec 6 15:01:36 2019 (r355445) @@ -64,10 +64,10 @@ void vm_reserv_init(void); bool vm_reserv_is_page_free(vm_page_t m); int vm_reserv_level(vm_page_t m); int vm_reserv_level_iffullpop(vm_page_t m); -boolean_t vm_reserv_reclaim_contig(int domain, u_long npages, +bool vm_reserv_reclaim_contig(int domain, u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); -boolean_t vm_reserv_reclaim_inactive(int domain); +bool vm_reserv_reclaim_inactive(int domain); void vm_reserv_rename(vm_page_t m, vm_object_t new_object, vm_object_t old_object, vm_pindex_t old_object_offset); int vm_reserv_size(int level); From owner-svn-src-all@freebsd.org Fri Dec 6 15:36:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDBEC1CEC4C; Fri, 6 Dec 2019 15:36: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TxX158QXz4XcD; Fri, 6 Dec 2019 15:36: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 8F8AE3424; Fri, 6 Dec 2019 15:36: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 xB6FaXY0006552; Fri, 6 Dec 2019 15:36:33 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6FaWFg006545; Fri, 6 Dec 2019 15:36:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912061536.xB6FaWFg006545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 6 Dec 2019 15:36:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355446 - in head/sys: conf dev/mlx5 dev/mlx5/mlx5_en modules/mlx5en X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in head/sys: conf dev/mlx5 dev/mlx5/mlx5_en modules/mlx5en X-SVN-Commit-Revision: 355446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 15:36:33 -0000 Author: hselasky Date: Fri Dec 6 15:36:32 2019 New Revision: 355446 URL: https://svnweb.freebsd.org/changeset/base/355446 Log: Implement hardware TLS via send tags for mlx5en(4), which is supported by ConnectX-6 DX. Currently TLS v1.2 and v1.3 with AES 128/256 crypto over TCP/IP (v4 and v6) is supported. A per PCI device UMA zone is used to manage the memory of the send tags. To optimize performance some crypto contexts may be cached by the UMA zone, until the UMA zone finishes the memory of the given send tag. An asynchronous task is used manage setup of the send tags towards the firmware. Most importantly setting the AES 128/256 bit pre-shared keys for the crypto context. Updating the state of the AES crypto engine and encrypting data, is all done in the fast path. Each send tag tracks the TCP sequence number in order to detect non-contiguous blocks of data, which may require a dump of prior unencrypted data, to restore the crypto state prior to wire transmission. Statistics counters have been added to count the amount of TLS data transmitted in total, and the amount of TLS data which has been dumped prior to transmission. When non-contiguous TCP sequence numbers are detected, the software needs to dump the beginning of the current TLS record up until the point of retransmission. All TLS counters utilize the counter(9) API. In order to enable hardware TLS offload the following sysctls must be set: kern.ipc.mb_use_ext_pgs=1 kern.ipc.tls.ifnet.permitted=1 kern.ipc.tls.enable=1 Sponsored by: Mellanox Technologies Added: head/sys/dev/mlx5/mlx5_en/en_hw_tls.h (contents, props changed) head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/mlx5/device.h head/sys/dev/mlx5/mlx5_en/en.h head/sys/dev/mlx5/mlx5_en/en_rl.h head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c head/sys/dev/mlx5/mlx5_en/mlx5_en_rl.c head/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c head/sys/modules/mlx5en/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Dec 6 15:01:36 2019 (r355445) +++ head/sys/conf/files Fri Dec 6 15:36:32 2019 (r355446) @@ -4781,6 +4781,8 @@ dev/mlx5/mlx5_en/mlx5_en_tx.c optional mlx5en pci in compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_flow_table.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" +dev/mlx5/mlx5_en/mlx5_en_hw_tls.c optional mlx5en pci inet inet6 \ + compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_rx.c optional mlx5en pci inet inet6 \ compile-with "${OFED_C}" dev/mlx5/mlx5_en/mlx5_en_rl.c optional mlx5en pci inet inet6 \ Modified: head/sys/dev/mlx5/device.h ============================================================================== --- head/sys/dev/mlx5/device.h Fri Dec 6 15:01:36 2019 (r355445) +++ head/sys/dev/mlx5/device.h Fri Dec 6 15:36:32 2019 (r355446) @@ -361,6 +361,7 @@ enum { MLX5_OPCODE_ATOMIC_MASKED_FA = 0x15, MLX5_OPCODE_BIND_MW = 0x18, MLX5_OPCODE_CONFIG_CMD = 0x1f, + MLX5_OPCODE_DUMP = 0x23, MLX5_RECV_OPCODE_RDMA_WRITE_IMM = 0x00, MLX5_RECV_OPCODE_SEND = 0x01, Modified: head/sys/dev/mlx5/mlx5_en/en.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en.h Fri Dec 6 15:01:36 2019 (r355445) +++ head/sys/dev/mlx5/mlx5_en/en.h Fri Dec 6 15:36:32 2019 (r355446) @@ -53,6 +53,7 @@ #include #include #include +#include #include "opt_rss.h" @@ -167,6 +168,7 @@ typedef void (mlx5e_cq_comp_t)(struct mlx5_core_cq *); #define MLX5E_STATS_COUNT(a, ...) a #define MLX5E_STATS_VAR(a, b, c, ...) b c; +#define MLX5E_STATS_COUNTER(a, b, c, ...) counter_##b##_t c; #define MLX5E_STATS_DESC(a, b, c, d, e, ...) d, e, #define MLX5E_VPORT_STATS(m) \ @@ -724,6 +726,7 @@ struct mlx5e_params_ethtool { u8 fec_avail_10x_25x[MLX5E_MAX_FEC_10X_25X]; u16 fec_avail_50x[MLX5E_MAX_FEC_50X]; u32 fec_mode_active; + u32 hw_mtu_msb; }; struct mlx5e_cq { @@ -775,6 +778,7 @@ struct mlx5e_rq { struct mlx5e_sq_mbuf { bus_dmamap_t dma_map; struct mbuf *mbuf; + volatile s32 *p_refcount; /* in use refcount, if any */ u32 num_bytes; u32 num_wqebbs; }; @@ -959,9 +963,14 @@ struct mlx5e_flow_tables { struct mlx5e_flow_table inner_rss; }; -#ifdef RATELIMIT +struct mlx5e_xmit_args { + volatile s32 *pref; + u32 tisn; + u16 ihs; +}; + #include "en_rl.h" -#endif +#include "en_hw_tls.h" #define MLX5E_TSTMP_PREC 10 @@ -1035,10 +1044,11 @@ struct mlx5e_priv { int media_active_last; struct callout watchdog; -#ifdef RATELIMIT + struct mlx5e_rl_priv_data rl; -#endif + struct mlx5e_tls tls; + struct callout tstmp_clbr; int clbr_done; int clbr_curr; @@ -1092,6 +1102,8 @@ struct mlx5e_eeprom { #define MLX5E_FLD_MAX(typ, fld) ((1ULL << __mlx5_bit_sz(typ, fld)) - 1ULL) +bool mlx5e_do_send_cqe(struct mlx5e_sq *); +int mlx5e_get_full_header_size(struct mbuf *, struct tcphdr **); int mlx5e_xmit(struct ifnet *, struct mbuf *); int mlx5e_open_locked(struct ifnet *); @@ -1163,7 +1175,12 @@ void mlx5e_create_ethtool(struct mlx5e_priv *); void mlx5e_create_stats(struct sysctl_ctx_list *, struct sysctl_oid_list *, const char *, const char **, unsigned, u64 *); +void mlx5e_create_counter_stats(struct sysctl_ctx_list *, + struct sysctl_oid_list *, const char *, + const char **, unsigned, counter_u64_t *); void mlx5e_send_nop(struct mlx5e_sq *, u32); +int mlx5e_sq_dump_xmit(struct mlx5e_sq *, struct mlx5e_xmit_args *, struct mbuf **); +int mlx5e_sq_xmit(struct mlx5e_sq *, struct mbuf **); void mlx5e_sq_cev_timeout(void *); int mlx5e_refresh_channel_params(struct mlx5e_priv *); int mlx5e_open_cq(struct mlx5e_priv *, struct mlx5e_cq_param *, @@ -1182,5 +1199,10 @@ void mlx5e_update_sq_inline(struct mlx5e_sq *sq); void mlx5e_refresh_sq_inline(struct mlx5e_priv *priv); int mlx5e_update_buf_lossy(struct mlx5e_priv *priv); int mlx5e_fec_update(struct mlx5e_priv *priv); + +if_snd_tag_alloc_t mlx5e_ul_snd_tag_alloc; +if_snd_tag_modify_t mlx5e_ul_snd_tag_modify; +if_snd_tag_query_t mlx5e_ul_snd_tag_query; +if_snd_tag_free_t mlx5e_ul_snd_tag_free; #endif /* _MLX5_EN_H_ */ Added: head/sys/dev/mlx5/mlx5_en/en_hw_tls.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_en/en_hw_tls.h Fri Dec 6 15:36:32 2019 (r355446) @@ -0,0 +1,104 @@ +/*- + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 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 _MLX5_TLS_H_ +#define _MLX5_TLS_H_ + +#include + +#define MLX5E_TLS_TAG_LOCK(tag) mtx_lock(&(tag)->mtx) +#define MLX5E_TLS_TAG_UNLOCK(tag) mtx_unlock(&(tag)->mtx) + +#define MLX5E_TLS_STAT_INC(tag, field, num) \ + counter_u64_add((tag)->tls->stats.field, num) + +enum { + MLX5E_TLS_LOOP = 0, + MLX5E_TLS_FAILURE = 1, + MLX5E_TLS_DEFERRED = 2, + MLX5E_TLS_CONTINUE = 3, +}; + +struct mlx5e_tls_tag { + struct mlx5e_snd_tag tag; + STAILQ_ENTRY(mlx5e_tls_tag) entry; + volatile s32 refs; /* number of pending mbufs */ + uint32_t tisn; /* HW TIS context number */ + uint32_t dek_index; /* HW TLS context number */ + struct mlx5e_tls *tls; + struct m_snd_tag *rl_tag; + struct mtx mtx; + uint32_t expected_seq; /* expected TCP sequence number */ + uint32_t state; /* see MLX5E_TLS_ST_XXX */ +#define MLX5E_TLS_ST_INIT 0 +#define MLX5E_TLS_ST_SETUP 1 +#define MLX5E_TLS_ST_TXRDY 2 +#define MLX5E_TLS_ST_FREED 3 + struct work_struct work; + + uint32_t dek_index_ok:1; + + /* parameters needed */ + uint8_t crypto_params[128] __aligned(4); +} __aligned(MLX5E_CACHELINE_SIZE); + +#define MLX5E_TLS_STATS(m) \ + m(+1, u64, tx_packets, "tx_packets", "Transmitted packets") \ + m(+1, u64, tx_bytes, "tx_bytes", "Transmitted bytes") \ + m(+1, u64, tx_packets_ooo, "tx_packets_ooo", "Transmitted packets out of order") \ + m(+1, u64, tx_bytes_ooo, "tx_bytes_ooo", "Transmitted bytes out of order") \ + m(+1, u64, tx_error, "tx_error", "Transmitted packets with error") + +#define MLX5E_TLS_STATS_NUM (0 MLX5E_TLS_STATS(MLX5E_STATS_COUNT)) + +struct mlx5e_tls_stats { + struct sysctl_ctx_list ctx; + counter_u64_t arg[0]; + MLX5E_TLS_STATS(MLX5E_STATS_COUNTER) +}; + +struct mlx5e_tls { + struct sysctl_ctx_list ctx; + struct mlx5e_tls_stats stats; + struct workqueue_struct *wq; + uma_zone_t zone; + uint32_t max_resources; /* max number of resources */ + volatile uint32_t num_resources; /* current number of resources */ + int init; /* set when ready */ + char zname[32]; +}; + +int mlx5e_tls_init(struct mlx5e_priv *); +void mlx5e_tls_cleanup(struct mlx5e_priv *); +int mlx5e_sq_tls_xmit(struct mlx5e_sq *, struct mlx5e_xmit_args *, struct mbuf **); + +if_snd_tag_alloc_t mlx5e_tls_snd_tag_alloc; +if_snd_tag_modify_t mlx5e_tls_snd_tag_modify; +if_snd_tag_query_t mlx5e_tls_snd_tag_query; +if_snd_tag_free_t mlx5e_tls_snd_tag_free; + +#endif /* _MLX5_TLS_H_ */ Modified: head/sys/dev/mlx5/mlx5_en/en_rl.h ============================================================================== --- head/sys/dev/mlx5/mlx5_en/en_rl.h Fri Dec 6 15:01:36 2019 (r355445) +++ head/sys/dev/mlx5/mlx5_en/en_rl.h Fri Dec 6 15:36:32 2019 (r355446) @@ -167,6 +167,7 @@ struct mlx5e_rl_priv_data { int mlx5e_rl_init(struct mlx5e_priv *priv); void mlx5e_rl_cleanup(struct mlx5e_priv *priv); void mlx5e_rl_refresh_sq_inline(struct mlx5e_rl_priv_data *rl); + if_snd_tag_alloc_t mlx5e_rl_snd_tag_alloc; if_snd_tag_modify_t mlx5e_rl_snd_tag_modify; if_snd_tag_query_t mlx5e_rl_snd_tag_query; Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Dec 6 15:01:36 2019 (r355445) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_ethtool.c Fri Dec 6 15:36:32 2019 (r355446) @@ -48,6 +48,26 @@ mlx5e_create_stats(struct sysctl_ctx_list *ctx, } } +void +mlx5e_create_counter_stats(struct sysctl_ctx_list *ctx, + struct sysctl_oid_list *parent, const char *buffer, + const char **desc, unsigned num, counter_u64_t *arg) +{ + struct sysctl_oid *node; + unsigned x; + + sysctl_ctx_init(ctx); + + node = SYSCTL_ADD_NODE(ctx, parent, OID_AUTO, + buffer, CTLFLAG_RD, NULL, "Statistics"); + if (node == NULL) + return; + for (x = 0; x != num; x++) { + SYSCTL_ADD_COUNTER_U64(ctx, SYSCTL_CHILDREN(node), OID_AUTO, + desc[2 * x], CTLFLAG_RD, arg + x, desc[2 * x + 1]); + } +} + static void mlx5e_ethtool_sync_tx_completion_fact(struct mlx5e_priv *priv) { Added: head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_hw_tls.c Fri Dec 6 15:36:32 2019 (r355446) @@ -0,0 +1,834 @@ +/*- + * Copyright (c) 2019 Mellanox Technologies. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY 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 AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include "opt_kern_tls.h" + +#include "en.h" + +#include + +#include +#include +#include + +#ifdef KERN_TLS + +MALLOC_DEFINE(M_MLX5E_TLS, "MLX5E_TLS", "MLX5 ethernet HW TLS"); + +/* software TLS context */ +struct mlx5_ifc_sw_tls_cntx_bits { + struct mlx5_ifc_tls_static_params_bits param; + struct mlx5_ifc_tls_progress_params_bits progress; + struct { + uint8_t key_data[8][0x20]; + uint8_t key_len[0x20]; + } key; +}; + +CTASSERT(MLX5_ST_SZ_BYTES(sw_tls_cntx) <= sizeof(((struct mlx5e_tls_tag *)0)->crypto_params)); +CTASSERT(MLX5_ST_SZ_BYTES(mkc) == sizeof(((struct mlx5e_tx_umr_wqe *)0)->mkc)); + +static const char *mlx5e_tls_stats_desc[] = { + MLX5E_TLS_STATS(MLX5E_STATS_DESC) +}; + +static void mlx5e_tls_work(struct work_struct *); + +static int +mlx5e_tls_tag_zinit(void *mem, int size, int flags) +{ + struct mlx5e_tls_tag *ptag = mem; + + MPASS(size == sizeof(*ptag)); + + memset(ptag, 0, sizeof(*ptag)); + mtx_init(&ptag->mtx, "mlx5-tls-tag-mtx", NULL, MTX_DEF); + INIT_WORK(&ptag->work, mlx5e_tls_work); + + return (0); +} + +static void +mlx5e_tls_tag_zfini(void *mem, int size) +{ + struct mlx5e_tls_tag *ptag = mem; + struct mlx5e_priv *priv; + struct mlx5e_tls *ptls; + + ptls = ptag->tls; + priv = container_of(ptls, struct mlx5e_priv, tls); + + flush_work(&ptag->work); + + if (ptag->tisn != 0) { + mlx5_tls_close_tis(priv->mdev, ptag->tisn); + atomic_add_32(&ptls->num_resources, -1U); + } + + mtx_destroy(&ptag->mtx); +} + +static void +mlx5e_tls_tag_zfree(struct mlx5e_tls_tag *ptag) +{ + + /* reset some variables */ + ptag->state = MLX5E_TLS_ST_INIT; + ptag->dek_index = 0; + ptag->dek_index_ok = 0; + + /* avoid leaking keys */ + memset(ptag->crypto_params, 0, sizeof(ptag->crypto_params)); + + /* update number of TIS contexts */ + if (ptag->tisn == 0) + atomic_add_32(&ptag->tls->num_resources, -1U); + + /* return tag to UMA */ + uma_zfree(ptag->tls->zone, ptag); +} + +int +mlx5e_tls_init(struct mlx5e_priv *priv) +{ + struct mlx5e_tls *ptls = &priv->tls; + struct sysctl_oid *node; + uint32_t x; + + if (MLX5_CAP_GEN(priv->mdev, tls) == 0) + return (0); + + ptls->wq = create_singlethread_workqueue("mlx5-tls-wq"); + if (ptls->wq == NULL) + return (ENOMEM); + + sysctl_ctx_init(&ptls->ctx); + + snprintf(ptls->zname, sizeof(ptls->zname), + "mlx5_%u_tls", device_get_unit(priv->mdev->pdev->dev.bsddev)); + + ptls->zone = uma_zcreate(ptls->zname, sizeof(struct mlx5e_tls_tag), + NULL, NULL, mlx5e_tls_tag_zinit, mlx5e_tls_tag_zfini, UMA_ALIGN_CACHE, 0); + + ptls->max_resources = 1U << MLX5_CAP_GEN(priv->mdev, log_max_dek); + + for (x = 0; x != MLX5E_TLS_STATS_NUM; x++) + ptls->stats.arg[x] = counter_u64_alloc(M_WAITOK); + + ptls->init = 1; + + node = SYSCTL_ADD_NODE(&priv->sysctl_ctx, + SYSCTL_CHILDREN(priv->sysctl_ifnet), OID_AUTO, + "tls", CTLFLAG_RW, NULL, "Hardware TLS offload"); + if (node == NULL) + return (0); + + mlx5e_create_counter_stats(&ptls->ctx, + SYSCTL_CHILDREN(node), "stats", + mlx5e_tls_stats_desc, MLX5E_TLS_STATS_NUM, + ptls->stats.arg); + + return (0); +} + +void +mlx5e_tls_cleanup(struct mlx5e_priv *priv) +{ + struct mlx5e_tls *ptls = &priv->tls; + uint32_t x; + + if (MLX5_CAP_GEN(priv->mdev, tls) == 0) + return; + + ptls->init = 0; + flush_workqueue(ptls->wq); + sysctl_ctx_free(&ptls->ctx); + uma_zdestroy(ptls->zone); + destroy_workqueue(ptls->wq); + + /* check if all resources are freed */ + MPASS(priv->tls.num_resources == 0); + + for (x = 0; x != MLX5E_TLS_STATS_NUM; x++) + counter_u64_free(ptls->stats.arg[x]); +} + +static void +mlx5e_tls_work(struct work_struct *work) +{ + struct mlx5e_tls_tag *ptag; + struct mlx5e_priv *priv; + int err; + + ptag = container_of(work, struct mlx5e_tls_tag, work); + priv = container_of(ptag->tls, struct mlx5e_priv, tls); + + switch (ptag->state) { + case MLX5E_TLS_ST_SETUP: + /* try to open TIS, if not present */ + if (ptag->tisn == 0) { + err = mlx5_tls_open_tis(priv->mdev, 0, priv->tdn, + priv->pdn, &ptag->tisn); + if (err) { + MLX5E_TLS_STAT_INC(ptag, tx_error, 1); + break; + } + } + MLX5_SET(sw_tls_cntx, ptag->crypto_params, progress.pd, ptag->tisn); + + /* try to allocate a DEK context ID */ + err = mlx5_encryption_key_create(priv->mdev, priv->pdn, + MLX5_ADDR_OF(sw_tls_cntx, ptag->crypto_params, key.key_data), + MLX5_GET(sw_tls_cntx, ptag->crypto_params, key.key_len), + &ptag->dek_index); + if (err) { + MLX5E_TLS_STAT_INC(ptag, tx_error, 1); + break; + } + + MLX5_SET(sw_tls_cntx, ptag->crypto_params, param.dek_index, ptag->dek_index); + + ptag->dek_index_ok = 1; + + MLX5E_TLS_TAG_LOCK(ptag); + if (ptag->state == MLX5E_TLS_ST_SETUP) + ptag->state = MLX5E_TLS_ST_TXRDY; + MLX5E_TLS_TAG_UNLOCK(ptag); + break; + + case MLX5E_TLS_ST_FREED: + /* wait for all refs to go away */ + while (ptag->refs != 0) + msleep(1); + + /* try to destroy DEK context by ID */ + if (ptag->dek_index_ok) + err = mlx5_encryption_key_destroy(priv->mdev, ptag->dek_index); + + /* free tag */ + mlx5e_tls_tag_zfree(ptag); + break; + + default: + break; + } +} + +static int +mlx5e_tls_set_params(void *ctx, const struct tls_session_params *en) +{ + + MLX5_SET(sw_tls_cntx, ctx, param.const_2, 2); + if (en->tls_vminor == TLS_MINOR_VER_TWO) + MLX5_SET(sw_tls_cntx, ctx, param.tls_version, 2); /* v1.2 */ + else + MLX5_SET(sw_tls_cntx, ctx, param.tls_version, 3); /* v1.3 */ + MLX5_SET(sw_tls_cntx, ctx, param.const_1, 1); + MLX5_SET(sw_tls_cntx, ctx, param.encryption_standard, 1); /* TLS */ + + /* copy the initial vector in place */ + if (en->iv_len == MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv)) { + memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, param.gcm_iv), + en->iv, MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv)); + } else if (en->iv_len == (MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv) + + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv))) { + memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, param.gcm_iv), + (char *)en->iv + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv), + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.gcm_iv)); + memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, param.implicit_iv), + en->iv, + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param.implicit_iv)); + } else { + return (EINVAL); + } + + if (en->cipher_key_len <= MLX5_FLD_SZ_BYTES(sw_tls_cntx, key.key_data)) { + memcpy(MLX5_ADDR_OF(sw_tls_cntx, ctx, key.key_data), + en->cipher_key, en->cipher_key_len); + MLX5_SET(sw_tls_cntx, ctx, key.key_len, en->cipher_key_len); + } else { + return (EINVAL); + } + return (0); +} + +/* Verify zero default */ +CTASSERT(MLX5E_TLS_ST_INIT == 0); + +int +mlx5e_tls_snd_tag_alloc(struct ifnet *ifp, + union if_snd_tag_alloc_params *params, + struct m_snd_tag **ppmt) +{ + struct if_snd_tag_alloc_rate_limit rl_params; + struct mlx5e_priv *priv; + struct mlx5e_tls_tag *ptag; + const struct tls_session_params *en; + int error; + + priv = ifp->if_softc; + + if (priv->tls.init == 0) + return (EOPNOTSUPP); + + /* allocate new tag from zone, if any */ + ptag = uma_zalloc(priv->tls.zone, M_NOWAIT); + if (ptag == NULL) + return (ENOMEM); + + /* sanity check default values */ + MPASS(ptag->state == MLX5E_TLS_ST_INIT); + MPASS(ptag->dek_index == 0); + MPASS(ptag->dek_index_ok == 0); + + /* setup TLS tag */ + ptag->tls = &priv->tls; + ptag->tag.type = params->hdr.type; + + /* check if there is no TIS context */ + if (ptag->tisn == 0) { + uint32_t value; + + value = atomic_fetchadd_32(&priv->tls.num_resources, 1U); + + /* check resource limits */ + if (value >= priv->tls.max_resources) { + error = ENOMEM; + goto failure; + } + } + + en = ¶ms->tls.tls->params; + + /* only TLS v1.2 and v1.3 is currently supported */ + if (en->tls_vmajor != TLS_MAJOR_VER_ONE || + (en->tls_vminor != TLS_MINOR_VER_TWO +#ifdef TLS_MINOR_VER_THREE + && en->tls_vminor != TLS_MINOR_VER_THREE +#endif + )) { + error = EPROTONOSUPPORT; + goto failure; + } + + switch (en->cipher_algorithm) { + case CRYPTO_AES_NIST_GCM_16: + switch (en->cipher_key_len) { + case 128 / 8: + if (en->auth_algorithm != CRYPTO_AES_128_NIST_GMAC) { + error = EINVAL; + goto failure; + } + if (en->tls_vminor == TLS_MINOR_VER_TWO) { + if (MLX5_CAP_TLS(priv->mdev, tls_1_2_aes_gcm_128) == 0) { + error = EPROTONOSUPPORT; + goto failure; + } + } else { + if (MLX5_CAP_TLS(priv->mdev, tls_1_3_aes_gcm_128) == 0) { + error = EPROTONOSUPPORT; + goto failure; + } + } + error = mlx5e_tls_set_params(ptag->crypto_params, en); + if (error) + goto failure; + break; + + case 256 / 8: + if (en->auth_algorithm != CRYPTO_AES_256_NIST_GMAC) { + error = EINVAL; + goto failure; + } + if (en->tls_vminor == TLS_MINOR_VER_TWO) { + if (MLX5_CAP_TLS(priv->mdev, tls_1_2_aes_gcm_256) == 0) { + error = EPROTONOSUPPORT; + goto failure; + } + } else { + if (MLX5_CAP_TLS(priv->mdev, tls_1_3_aes_gcm_256) == 0) { + error = EPROTONOSUPPORT; + goto failure; + } + } + error = mlx5e_tls_set_params(ptag->crypto_params, en); + if (error) + goto failure; + break; + + default: + error = EINVAL; + goto failure; + } + break; + default: + error = EPROTONOSUPPORT; + goto failure; + } + + switch (ptag->tag.type) { +#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT) + case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: + memset(&rl_params, 0, sizeof(rl_params)); + rl_params.hdr = params->tls_rate_limit.hdr; + rl_params.hdr.type = IF_SND_TAG_TYPE_RATE_LIMIT; + rl_params.max_rate = params->tls_rate_limit.max_rate; + + error = mlx5e_rl_snd_tag_alloc(ifp, + container_of(&rl_params, union if_snd_tag_alloc_params, rate_limit), + &ptag->rl_tag); + if (error) + goto failure; + break; +#endif + case IF_SND_TAG_TYPE_TLS: + memset(&rl_params, 0, sizeof(rl_params)); + rl_params.hdr = params->tls.hdr; + rl_params.hdr.type = IF_SND_TAG_TYPE_UNLIMITED; + + error = mlx5e_ul_snd_tag_alloc(ifp, + container_of(&rl_params, union if_snd_tag_alloc_params, unlimited), + &ptag->rl_tag); + if (error) + goto failure; + break; + default: + error = EOPNOTSUPP; + goto failure; + } + + /* store pointer to mbuf tag */ + MPASS(ptag->tag.m_snd_tag.refcount == 0); + m_snd_tag_init(&ptag->tag.m_snd_tag, ifp); + *ppmt = &ptag->tag.m_snd_tag; + return (0); + +failure: + mlx5e_tls_tag_zfree(ptag); + return (error); +} + +int +mlx5e_tls_snd_tag_modify(struct m_snd_tag *pmt, union if_snd_tag_modify_params *params) +{ +#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT) + struct if_snd_tag_rate_limit_params rl_params; + int error; +#endif + struct mlx5e_tls_tag *ptag = + container_of(pmt, struct mlx5e_tls_tag, tag.m_snd_tag); + + switch (ptag->tag.type) { +#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT) + case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: + memset(&rl_params, 0, sizeof(rl_params)); + rl_params.max_rate = params->tls_rate_limit.max_rate; + error = mlx5e_rl_snd_tag_modify(ptag->rl_tag, + container_of(&rl_params, union if_snd_tag_modify_params, rate_limit)); + return (error); +#endif + default: + return (EOPNOTSUPP); + } +} + +int +mlx5e_tls_snd_tag_query(struct m_snd_tag *pmt, union if_snd_tag_query_params *params) +{ + struct mlx5e_tls_tag *ptag = + container_of(pmt, struct mlx5e_tls_tag, tag.m_snd_tag); + int error; + + switch (ptag->tag.type) { +#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT) + case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: + error = mlx5e_rl_snd_tag_query(ptag->rl_tag, params); + break; +#endif + case IF_SND_TAG_TYPE_TLS: + error = mlx5e_ul_snd_tag_query(ptag->rl_tag, params); + break; + default: + error = EOPNOTSUPP; + break; + } + return (error); +} + +void +mlx5e_tls_snd_tag_free(struct m_snd_tag *pmt) +{ + struct mlx5e_tls_tag *ptag = + container_of(pmt, struct mlx5e_tls_tag, tag.m_snd_tag); + struct mlx5e_priv *priv; + + switch (ptag->tag.type) { +#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT) + case IF_SND_TAG_TYPE_TLS_RATE_LIMIT: + mlx5e_rl_snd_tag_free(ptag->rl_tag); + break; +#endif + case IF_SND_TAG_TYPE_TLS: + mlx5e_ul_snd_tag_free(ptag->rl_tag); + break; + default: + break; + } + + MLX5E_TLS_TAG_LOCK(ptag); + ptag->state = MLX5E_TLS_ST_FREED; + MLX5E_TLS_TAG_UNLOCK(ptag); + + priv = ptag->tag.m_snd_tag.ifp->if_softc; + queue_work(priv->tls.wq, &ptag->work); +} + +CTASSERT((MLX5_FLD_SZ_BYTES(sw_tls_cntx, param) % 16) == 0); + +static void +mlx5e_tls_send_static_parameters(struct mlx5e_sq *sq, struct mlx5e_tls_tag *ptag) +{ + const u32 ds_cnt = DIV_ROUND_UP(sizeof(struct mlx5e_tx_umr_wqe) + + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param), MLX5_SEND_WQE_DS); + struct mlx5e_tx_umr_wqe *wqe; + u16 pi; + + pi = sq->pc & sq->wq.sz_m1; + wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi); + + memset(wqe, 0, sizeof(*wqe)); + + wqe->ctrl.opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | + MLX5_OPCODE_UMR | (MLX5_OPCODE_MOD_UMR_TLS_TIS_STATIC_PARAMS << 24)); + wqe->ctrl.qpn_ds = cpu_to_be32((sq->sqn << 8) | ds_cnt); + wqe->ctrl.imm = cpu_to_be32(ptag->tisn << 8); + + if (mlx5e_do_send_cqe(sq)) + wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE | MLX5_FENCE_MODE_INITIATOR_SMALL; + else + wqe->ctrl.fm_ce_se = MLX5_FENCE_MODE_INITIATOR_SMALL; + + /* fill out UMR control segment */ + wqe->umr.flags = 0x80; /* inline data */ + wqe->umr.bsf_octowords = cpu_to_be16(MLX5_FLD_SZ_BYTES(sw_tls_cntx, param) / 16); + + /* copy in the static crypto parameters */ + memcpy(wqe + 1, MLX5_ADDR_OF(sw_tls_cntx, ptag->crypto_params, param), + MLX5_FLD_SZ_BYTES(sw_tls_cntx, param)); + + /* copy data for doorbell */ + memcpy(sq->doorbell.d32, &wqe->ctrl, sizeof(sq->doorbell.d32)); + + sq->mbuf[pi].mbuf = NULL; + sq->mbuf[pi].num_bytes = 0; + sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); + sq->mbuf[pi].p_refcount = &ptag->refs; + atomic_add_int(&ptag->refs, 1); + sq->pc += sq->mbuf[pi].num_wqebbs; +} + +CTASSERT(MLX5_FLD_SZ_BYTES(sw_tls_cntx, progress) == + sizeof(((struct mlx5e_tx_psv_wqe *)0)->psv)); + +static void +mlx5e_tls_send_progress_parameters(struct mlx5e_sq *sq, struct mlx5e_tls_tag *ptag) +{ + const u32 ds_cnt = DIV_ROUND_UP(sizeof(struct mlx5e_tx_psv_wqe), + MLX5_SEND_WQE_DS); + struct mlx5e_tx_psv_wqe *wqe; + u16 pi; + + pi = sq->pc & sq->wq.sz_m1; + wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi); + + memset(wqe, 0, sizeof(*wqe)); + + wqe->ctrl.opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | + MLX5_OPCODE_SET_PSV | (MLX5_OPCODE_MOD_PSV_TLS_TIS_PROGRESS_PARAMS << 24)); + wqe->ctrl.qpn_ds = cpu_to_be32((sq->sqn << 8) | ds_cnt); + + if (mlx5e_do_send_cqe(sq)) + wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE | MLX5_FENCE_MODE_INITIATOR_SMALL; + else + wqe->ctrl.fm_ce_se = MLX5_FENCE_MODE_INITIATOR_SMALL; + + /* copy in the PSV control segment */ + memcpy(&wqe->psv, MLX5_ADDR_OF(sw_tls_cntx, ptag->crypto_params, progress), + sizeof(wqe->psv)); + + /* copy data for doorbell */ + memcpy(sq->doorbell.d32, &wqe->ctrl, sizeof(sq->doorbell.d32)); + + sq->mbuf[pi].mbuf = NULL; + sq->mbuf[pi].num_bytes = 0; + sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); + sq->mbuf[pi].p_refcount = &ptag->refs; + atomic_add_int(&ptag->refs, 1); + sq->pc += sq->mbuf[pi].num_wqebbs; +} + +static void +mlx5e_tls_send_nop(struct mlx5e_sq *sq, struct mlx5e_tls_tag *ptag) +{ + const u32 ds_cnt = MLX5_SEND_WQEBB_NUM_DS; + struct mlx5e_tx_wqe *wqe; + u16 pi; + + pi = sq->pc & sq->wq.sz_m1; + wqe = mlx5_wq_cyc_get_wqe(&sq->wq, pi); + + memset(&wqe->ctrl, 0, sizeof(wqe->ctrl)); + + wqe->ctrl.opmod_idx_opcode = cpu_to_be32((sq->pc << 8) | MLX5_OPCODE_NOP); + wqe->ctrl.qpn_ds = cpu_to_be32((sq->sqn << 8) | ds_cnt); + if (mlx5e_do_send_cqe(sq)) + wqe->ctrl.fm_ce_se = MLX5_WQE_CTRL_CQ_UPDATE | MLX5_FENCE_MODE_INITIATOR_SMALL; + else + wqe->ctrl.fm_ce_se = MLX5_FENCE_MODE_INITIATOR_SMALL; + + /* Copy data for doorbell */ + memcpy(sq->doorbell.d32, &wqe->ctrl, sizeof(sq->doorbell.d32)); + + sq->mbuf[pi].mbuf = NULL; + sq->mbuf[pi].num_bytes = 0; + sq->mbuf[pi].num_wqebbs = DIV_ROUND_UP(ds_cnt, MLX5_SEND_WQEBB_NUM_DS); + sq->mbuf[pi].p_refcount = &ptag->refs; + atomic_add_int(&ptag->refs, 1); + sq->pc += sq->mbuf[pi].num_wqebbs; +} + +#define SBTLS_MBUF_NO_DATA ((struct mbuf *)1) + +static struct mbuf * +sbtls_recover_record(struct mbuf *mb, int wait, uint32_t tcp_old, uint32_t *ptcp_seq) +{ + struct mbuf *mr; + uint32_t offset; + uint32_t delta; + + /* check format of incoming mbuf */ + if (mb->m_next == NULL || + (mb->m_next->m_flags & (M_NOMAP | M_EXT)) != (M_NOMAP | M_EXT) || + mb->m_next->m_ext.ext_buf == NULL) { + mr = NULL; + goto done; + } + + /* get unmapped data offset */ + offset = mtod(mb->m_next, uintptr_t); + + /* check if we don't need to re-transmit anything */ + if (offset == 0) { + mr = SBTLS_MBUF_NO_DATA; + goto done; + } + + /* try to get a new mbufs with packet header */ + mr = m_gethdr(wait, MT_DATA); + if (mr == NULL) + goto done; + + mb_dupcl(mr, mb->m_next); + + /* the beginning of the TLS record */ + mr->m_data = NULL; + + /* setup packet header length */ + mr->m_pkthdr.len = mr->m_len = offset; + + /* check for partial re-transmit */ + delta = *ptcp_seq - tcp_old; + + if (delta < offset) { + m_adj(mr, offset - delta); + offset = delta; + } + + /* + * Rewind the TCP sequence number by the amount of data + * retransmitted: + */ + *ptcp_seq -= offset; +done: + return (mr); +} + +static int +mlx5e_sq_tls_populate(struct mbuf *mb, uint64_t *pseq) +{ + struct mbuf_ext_pgs *ext_pgs; + + for (; mb != NULL; mb = mb->m_next) { + if (!(mb->m_flags & M_NOMAP)) + continue; + ext_pgs = (void *)mb->m_ext.ext_buf; + *pseq = ext_pgs->seqno; + return (1); + } + return (0); +} + +int +mlx5e_sq_tls_xmit(struct mlx5e_sq *sq, struct mlx5e_xmit_args *parg, struct mbuf **ppmb) +{ + struct mlx5e_tls_tag *ptls_tag; + struct mlx5e_snd_tag *ptag; + struct tcphdr *th; + struct mbuf *mb = *ppmb; + u64 rcd_sn; + u32 header_size; + u32 mb_seq; + + if ((mb->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0) + return (MLX5E_TLS_CONTINUE); + + ptag = container_of(mb->m_pkthdr.snd_tag, + struct mlx5e_snd_tag, m_snd_tag); + + if ( +#if defined(RATELIMIT) && defined(IF_SND_TAG_TYPE_TLS_RATE_LIMIT) + ptag->type != IF_SND_TAG_TYPE_TLS_RATE_LIMIT && +#endif + ptag->type != IF_SND_TAG_TYPE_TLS) + return (MLX5E_TLS_CONTINUE); + + ptls_tag = container_of(ptag, struct mlx5e_tls_tag, tag); + + header_size = mlx5e_get_full_header_size(mb, &th); + if (unlikely(header_size == 0 || th == NULL)) + return (MLX5E_TLS_FAILURE); + + /* + * Send non-TLS TCP packets AS-IS: + */ + if (header_size == mb->m_pkthdr.len || + mlx5e_sq_tls_populate(mb, &rcd_sn) == 0) { + parg->tisn = 0; + parg->ihs = header_size; + return (MLX5E_TLS_CONTINUE); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Dec 6 15:57:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A8411CF243; Fri, 6 Dec 2019 15:57:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47Ty032c7rz4YWd; Fri, 6 Dec 2019 15:57:22 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9F42A2602DF; Fri, 6 Dec 2019 16:57:14 +0100 (CET) Subject: Re: svn commit: r355444 - in head/sys: arm/mv arm64/conf conf To: Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201912061255.xB6CtdJw011374@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <02a39414-b122-7858-622f-cdd8e70ea963@selasky.org> Date: Fri, 6 Dec 2019 16:54:57 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <201912061255.xB6CtdJw011374@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47Ty032c7rz4YWd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 15:57:23 -0000 On 2019-12-06 13:55, Luiz Otavio O Souza wrote: > Author: loos > Date: Fri Dec 6 12:55:39 2019 > New Revision: 355444 > URL: https://svnweb.freebsd.org/changeset/base/355444 > > Log: > Add the SPI driver for the Marvell Armada 37x0 SoC. > > Interrupt based driver, implements SPI mode and clock configuration. > > Tested on espressobin and SG-3200. > > Sponsored by: Rubicon Communications, LLC (Netgate) > > Added: This breaks aarch64. You need to add #include somewhere: 13:30:54 ctfconvert -L VERSION -g bcm2835_rng.o 13:30:54 --- a37x0_spi.o --- 13:30:54 /usr/src/sys/arm/mv/a37x0_spi.c:212:2: error: implicit declaration of function 'mtx_init' is invalid in C99 [-Werror,-Wimplicit-function-declaration] 13:30:54 mtx_init(&sc->sc_mtx, "a37x0_spi", NULL, MTX_DEF); 13:30:54 ^ 13:30:54 --- mv_ap806_gicp.o --- 13:30:54 cc -target aarch64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/arm64.aarch64/tmp -B/usr/obj/usr/src/arm64.aarch64/tmp/usr/bin - https://ci.freebsd.org/tinderbox/ --HPS From owner-svn-src-all@freebsd.org Fri Dec 6 16:20:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 261831CF6FE; Fri, 6 Dec 2019 16:20:23 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TyVb04Llz4ZQg; Fri, 6 Dec 2019 16:20:23 +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 D5FA93D9C; Fri, 6 Dec 2019 16:20:22 +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 xB6GKMJY030401; Fri, 6 Dec 2019 16:20:22 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6GKMth030400; Fri, 6 Dec 2019 16:20:22 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201912061620.xB6GKMth030400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 6 Dec 2019 16:20:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355447 - head/sys/dev/mlx5 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/dev/mlx5 X-SVN-Commit-Revision: 355447 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:20:23 -0000 Author: hselasky Date: Fri Dec 6 16:20:22 2019 New Revision: 355447 URL: https://svnweb.freebsd.org/changeset/base/355447 Log: Fix compilation issue with mlx5core and sparc64 (gcc48): sys/dev/mlx5/mlx5_en/mlx5_en_tx.c:335: error: requested alignment is not a constant MFC after: 1 week Sponsored by: Mellanox Technologies Modified: head/sys/dev/mlx5/qp.h Modified: head/sys/dev/mlx5/qp.h ============================================================================== --- head/sys/dev/mlx5/qp.h Fri Dec 6 15:36:32 2019 (r355446) +++ head/sys/dev/mlx5/qp.h Fri Dec 6 16:20:22 2019 (r355447) @@ -143,11 +143,8 @@ enum { MLX5_WQE_CTRL_SOLICITED = 1 << 1, }; -enum { - MLX5_SEND_WQE_DS = 16, - MLX5_SEND_WQE_BB = 64, -}; - +#define MLX5_SEND_WQE_DS 16 +#define MLX5_SEND_WQE_BB 64 #define MLX5_SEND_WQEBB_NUM_DS (MLX5_SEND_WQE_BB / MLX5_SEND_WQE_DS) enum { From owner-svn-src-all@freebsd.org Fri Dec 6 16:34:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 016E41CFCB0; Fri, 6 Dec 2019 16:34:05 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TypN5WyRz4bMv; Fri, 6 Dec 2019 16:34:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 882884166; Fri, 6 Dec 2019 16:34:04 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6GY47k042267; Fri, 6 Dec 2019 16:34:04 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6GY4gf042266; Fri, 6 Dec 2019 16:34:04 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912061634.xB6GY4gf042266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 6 Dec 2019 16:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355448 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:34:05 -0000 Author: bz Date: Fri Dec 6 16:34:04 2019 New Revision: 355448 URL: https://svnweb.freebsd.org/changeset/base/355448 Log: Improve EPOCH_TRACE Two changes to EPOCH_TRACE: (1) add a sysctl to surpress the backtrace from epoch_trace_report(). Sometimes the log line for the recursion is enough and the backtrace massively spams the console. (2) In order to be able to go without the backtrace do not only print where the previous occurance happened, but also where the current one happens. That way we have file:line information for both and can look at them without the need for getting line numbers from backtrace and a debugging tool. Reviewed by: glebius Sponsored by: Netflix (originally) Differential Revision: https://reviews.freebsd.org/D22641 Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Fri Dec 6 16:20:22 2019 (r355447) +++ head/sys/kern/subr_epoch.c Fri Dec 6 16:34:04 2019 (r355448) @@ -169,6 +169,10 @@ RB_GENERATE_STATIC(stacktree, stackentry, se_node, sta static struct mtx epoch_stacks_lock; MTX_SYSINIT(epochstacks, &epoch_stacks_lock, "epoch_stacks", MTX_DEF); +static bool epoch_trace_stack_print = true; +SYSCTL_BOOL(_kern_epoch, OID_AUTO, trace_stack_print, CTLFLAG_RWTUN, + &epoch_trace_stack_print, 0, "Print stack traces on epoch reports"); + static void epoch_trace_report(const char *fmt, ...) __printflike(1, 2); static inline void epoch_trace_report(const char *fmt, ...) @@ -197,7 +201,8 @@ epoch_trace_report(const char *fmt, ...) va_start(ap, fmt); (void)vprintf(fmt, ap); va_end(ap); - stack_print_ddb(&se.se_stack); + if (epoch_trace_stack_print) + stack_print_ddb(&se.se_stack); } static inline void @@ -209,8 +214,9 @@ epoch_trace_enter(struct thread *td, epoch_t epoch, ep SLIST_FOREACH(iet, &td->td_epochs, et_tlink) if (iet->et_epoch == epoch) epoch_trace_report("Recursively entering epoch %s " - "previously entered at %s:%d\n", - epoch->e_name, iet->et_file, iet->et_line); + "at %s:%d, previously entered at %s:%d\n", + epoch->e_name, file, line, + iet->et_file, iet->et_line); et->et_epoch = epoch; et->et_file = file; et->et_line = line; @@ -223,9 +229,10 @@ epoch_trace_exit(struct thread *td, epoch_t epoch, epo { if (SLIST_FIRST(&td->td_epochs) != et) { - epoch_trace_report("Exiting epoch %s in a not nested order. " - "Most recently entered %s at %s:%d\n", + epoch_trace_report("Exiting epoch %s in a not nested order " + "at %s:%d. Most recently entered %s at %s:%d\n", epoch->e_name, + file, line, SLIST_FIRST(&td->td_epochs)->et_epoch->e_name, SLIST_FIRST(&td->td_epochs)->et_file, SLIST_FIRST(&td->td_epochs)->et_line); From owner-svn-src-all@freebsd.org Fri Dec 6 16:35:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E4311CFD59; Fri, 6 Dec 2019 16:35:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TyrP1Rq6z4bW9; Fri, 6 Dec 2019 16:35:49 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EFFD1416D; Fri, 6 Dec 2019 16:35:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6GZmEi042393; Fri, 6 Dec 2019 16:35:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6GZmpS042391; Fri, 6 Dec 2019 16:35:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912061635.xB6GZmpS042391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 6 Dec 2019 16:35:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355449 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 355449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:35:49 -0000 Author: bz Date: Fri Dec 6 16:35:48 2019 New Revision: 355449 URL: https://svnweb.freebsd.org/changeset/base/355449 Log: carp: replace caddr_t with char * Change the remaining caddr_t usages to char * following the removal of the KAME macros No functional change. Requested by: glebius Reviewed by: glebius MFC after: 2 weeks Sponsored by: Netflix (originally) Differential Revision: https://reviews.freebsd.org/D22399 Modified: head/sys/netinet/ip_carp.c head/sys/netinet/ip_carp.h Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Dec 6 16:34:04 2019 (r355448) +++ head/sys/netinet/ip_carp.c Fri Dec 6 16:35:48 2019 (r355449) @@ -575,7 +575,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } } - ch = (struct carp_header *)(mtod(m, caddr_t) + *offp); + ch = (struct carp_header *)(mtod(m, char *) + *offp); /* verify the CARP checksum */ @@ -978,6 +978,7 @@ carp_send_ad_locked(struct carp_softc *sc) #endif /* INET */ #ifdef INET6 if (sc->sc_naddrs6) { + struct epoch_tracker et; struct ip6_hdr *ip6; m = m_gethdr(M_NOWAIT, MT_DATA); @@ -1031,8 +1032,10 @@ carp_send_ad_locked(struct carp_softc *sc) CARPSTATS_INC(carps_opackets6); + NET_EPOCH_ENTER(et); carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0, &sc->sc_carpdev->if_carp->cif_im6o, NULL, NULL)); + NET_EPOCH_EXIT(et); } #endif /* INET6 */ @@ -1190,7 +1193,7 @@ carp_iamatch6(struct ifnet *ifp, struct in6_addr *tadd return (ifa); } -caddr_t +char * carp_macmatch6(struct ifnet *ifp, struct mbuf *m, const struct in6_addr *taddr) { struct ifaddr *ifa; @@ -1847,7 +1850,7 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa carp_carprcp(&carpr, sc, priveleged); carpr.carpr_count = count; error = copyout(&carpr, - (caddr_t)ifr_data_get_ptr(ifr) + + (char *)ifr_data_get_ptr(ifr) + (i * sizeof(carpr)), sizeof(carpr)); if (error) { CIF_UNLOCK(ifp->if_carp); Modified: head/sys/netinet/ip_carp.h ============================================================================== --- head/sys/netinet/ip_carp.h Fri Dec 6 16:34:04 2019 (r355448) +++ head/sys/netinet/ip_carp.h Fri Dec 6 16:35:48 2019 (r355449) @@ -149,7 +149,7 @@ int carp_output (struct ifnet *, struct mbuf *, int carp_master(struct ifaddr *); int carp_iamatch(struct ifaddr *, uint8_t **); struct ifaddr *carp_iamatch6(struct ifnet *, struct in6_addr *); -caddr_t carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); +char * carp_macmatch6(struct ifnet *, struct mbuf *, const struct in6_addr *); int carp_forus(struct ifnet *, u_char *); /* These are external networking stack hooks for CARP */ @@ -174,7 +174,7 @@ extern int (*carp_iamatch_p)(struct ifaddr *, uint8_t #ifdef INET6 /* netinet6/nd6_nbr.c */ extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *); -extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, +extern char * (*carp_macmatch6_p)(struct ifnet *, struct mbuf *, const struct in6_addr *); #endif #endif From owner-svn-src-all@freebsd.org Fri Dec 6 16:42:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B02131B00CC; Fri, 6 Dec 2019 16:42:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tz0g4CmGz4c16; Fri, 6 Dec 2019 16:42:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74226432D; Fri, 6 Dec 2019 16:42:59 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6Ggxjb047954; Fri, 6 Dec 2019 16:42:59 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6GgxCA047953; Fri, 6 Dec 2019 16:42:59 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912061642.xB6GgxCA047953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 6 Dec 2019 16:42:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355450 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 355450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:42:59 -0000 Author: bz Date: Fri Dec 6 16:42:58 2019 New Revision: 355450 URL: https://svnweb.freebsd.org/changeset/base/355450 Log: ip6_input: remove redundant v4mapped check In ip6_input() we apply the same v4mapped address check twice. The only case which skipps the first one is M_FASTFWD_OURS which should have passed the check on the firstinput pass and passed the firewall. Remove the 2nd redundant check. Reviewed by: kp, melifaro MFC after: 2 weeks Sponsored by: Netflix (originally) Differential Revision: https://reviews.freebsd.org/D22462 Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Dec 6 16:35:48 2019 (r355449) +++ head/sys/netinet6/ip6_input.c Fri Dec 6 16:42:58 2019 (r355450) @@ -897,24 +897,6 @@ passin: return; } - ip6 = mtod(m, struct ip6_hdr *); - - /* - * Malicious party may be able to use IPv4 mapped addr to confuse - * tcp/udp stack and bypass security checks (act as if it was from - * 127.0.0.1 by using IPv6 src ::ffff:127.0.0.1). Be cautious. - * - * For SIIT end node behavior, you may want to disable the check. - * However, you will become vulnerable to attacks using IPv4 mapped - * source. - */ - if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || - IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { - IP6STAT_INC(ip6s_badscope); - in6_ifstat_inc(rcvif, ifs6_in_addrerr); - goto bad; - } - /* * Tell launch routine the next header */ From owner-svn-src-all@freebsd.org Fri Dec 6 16:48:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9418C1B01D7; Fri, 6 Dec 2019 16:48:37 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Tz793F4Zz4cF4; Fri, 6 Dec 2019 16:48:37 +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 534004365; Fri, 6 Dec 2019 16:48:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6GmbOX048253; Fri, 6 Dec 2019 16:48:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6Gmbqo048252; Fri, 6 Dec 2019 16:48:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912061648.xB6Gmbqo048252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 6 Dec 2019 16:48:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355451 - head/sys/geom X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/geom X-SVN-Commit-Revision: 355451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:48:37 -0000 Author: mav Date: Fri Dec 6 16:48:36 2019 New Revision: 355451 URL: https://svnweb.freebsd.org/changeset/base/355451 Log: Remove some branching from GEOM_DISK hot path. pp->private just can not be NULL in those places. In g_disk_start() and g_disk_ioctl() both dp != NULL and !dp->d_destroyed should always be true if disk_gone() and disk_destroy() are used properly, since GEOM does not send requests to errored providers. If the protocol is not followed, then no amount of additional checks here give real safety. In g_disk_access() though the checks are useful, since GEOM blocks only new opens for errored providers, but allows closes. It should not happen if disk_gone() and disk_destroy() are used properly, but may otherwise. To improve cases when disk_gone() is not used, call it from disk_destroy(). It does not give full guaranties, but it errors the provider and makes GEOM block unwanted requests at least after some race. MFC after: 2 weeks Modified: head/sys/geom/geom_disk.c Modified: head/sys/geom/geom_disk.c ============================================================================== --- head/sys/geom/geom_disk.c Fri Dec 6 16:42:58 2019 (r355450) +++ head/sys/geom/geom_disk.c Fri Dec 6 16:48:36 2019 (r355451) @@ -108,7 +108,7 @@ g_disk_access(struct g_provider *pp, int r, int w, int pp->name, r, w, e); g_topology_assert(); sc = pp->private; - if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) { + if ((dp = sc->dp) == NULL || dp->d_destroyed) { /* * Allow decreasing access count even if disk is not * available anymore. @@ -274,6 +274,8 @@ g_disk_ioctl(struct g_provider *pp, u_long cmd, void * sc = pp->private; dp = sc->dp; + KASSERT(dp != NULL && !dp->d_destroyed, + ("g_disk_ioctl(%lx) on destroyed disk %s", cmd, pp->name)); if (dp->d_ioctl == NULL) return (ENOIOCTL); @@ -432,10 +434,9 @@ g_disk_start(struct bio *bp) biotrack(bp, __func__); sc = bp->bio_to->private; - if (sc == NULL || (dp = sc->dp) == NULL || dp->d_destroyed) { - g_io_deliver(bp, ENXIO); - return; - } + dp = sc->dp; + KASSERT(dp != NULL && !dp->d_destroyed, + ("g_disk_start(%p) on destroyed disk %s", bp, bp->bio_to->name)); error = EJUSTRETURN; switch(bp->bio_cmd) { case BIO_DELETE: @@ -896,8 +897,9 @@ void disk_destroy(struct disk *dp) { - g_cancel_event(dp); + disk_gone(dp); dp->d_destroyed = 1; + g_cancel_event(dp); if (dp->d_devstat != NULL) devstat_remove_entry(dp->d_devstat); g_post_event(g_disk_destroy, dp, M_WAITOK, NULL); @@ -922,6 +924,16 @@ disk_gone(struct disk *dp) struct g_provider *pp; mtx_pool_lock(mtxpool_sleep, dp); + + /* + * Second wither call makes no sense, plus we can not access the list + * of providers without topology lock after calling wither once. + */ + if (dp->d_goneflag != 0) { + mtx_pool_unlock(mtxpool_sleep, dp); + return; + } + dp->d_goneflag = 1; /* @@ -946,13 +958,11 @@ disk_gone(struct disk *dp) mtx_pool_unlock(mtxpool_sleep, dp); gp = dp->d_geom; - if (gp != NULL) { - pp = LIST_FIRST(&gp->provider); - if (pp != NULL) { - KASSERT(LIST_NEXT(pp, provider) == NULL, - ("geom %p has more than one provider", gp)); - g_wither_provider(pp, ENXIO); - } + pp = LIST_FIRST(&gp->provider); + if (pp != NULL) { + KASSERT(LIST_NEXT(pp, provider) == NULL, + ("geom %p has more than one provider", gp)); + g_wither_provider(pp, ENXIO); } } From owner-svn-src-all@freebsd.org Fri Dec 6 16:53:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C85D51B0484; Fri, 6 Dec 2019 16:53:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47TzF24yKgz4chM; Fri, 6 Dec 2019 16:53:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8EB6E4531; Fri, 6 Dec 2019 16:53:42 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6GrgLC053748; Fri, 6 Dec 2019 16:53:42 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6GrgrF053747; Fri, 6 Dec 2019 16:53:42 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912061653.xB6GrgrF053747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 6 Dec 2019 16:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355452 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 355452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:53:42 -0000 Author: bz Date: Fri Dec 6 16:53:42 2019 New Revision: 355452 URL: https://svnweb.freebsd.org/changeset/base/355452 Log: Update comment. Update the comment related to SIIT and v4mapped addresses being rejected by us when coming from the wire given we have supported IPv6-only kernels for a few years now. See also draft-itojun-v6ops-v4mapped-harmful. Suggested by: melifaro MFC after: 2 weeks Modified: head/sys/netinet6/ip6_input.c Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Fri Dec 6 16:48:36 2019 (r355451) +++ head/sys/netinet6/ip6_input.c Fri Dec 6 16:53:42 2019 (r355452) @@ -677,11 +677,10 @@ ip6_input(struct mbuf *m) * and bypass security checks (act as if it was from 127.0.0.1 by using * IPv6 src ::ffff:127.0.0.1). Be cautious. * - * This check chokes if we are in an SIIT cloud. As none of BSDs - * support IPv4-less kernel compilation, we cannot support SIIT - * environment at all. So, it makes more sense for us to reject any - * malicious packets for non-SIIT environment, than try to do a - * partial support for SIIT environment. + * We have supported IPv6-only kernels for a few years and this issue + * has not come up. The world seems to move mostly towards not using + * v4mapped on the wire, so it makes sense for us to keep rejecting + * any such packets. */ if (IN6_IS_ADDR_V4MAPPED(&ip6->ip6_src) || IN6_IS_ADDR_V4MAPPED(&ip6->ip6_dst)) { From owner-svn-src-all@freebsd.org Fri Dec 6 16:58:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9855C1B0584 for ; Fri, 6 Dec 2019 16:58:29 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47TzLY1Qjwz4ct2 for ; Fri, 6 Dec 2019 16:58:28 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575651507; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=U5hcPSlJig4htwX3/jdX1pGgKkem9tY1uQxMpPcMlnLzoaBRvM4wCpOtL39WyTuFpE8ymX3uzeyTN lIZAIpU95gk9/pyxgA4LFQ/YMcaJpHS8tdC8Bkb2M0Mo5poyPL1Cy4EHIwaRFGoiEZz3RFAVsiWpn4 3Av+d5caJZeoIhlkuhhlwgeiAHARwu/IbzqGMOVT1oxDdb5itlYMI4iWz6G3vdvhZFODnO6rGQ8ZfV kiPw42U7ML19kAw+zrLHkxeOes1LvRiw4xAwVw4aq/Drgk4GYwpxTnOTE7mbufmhfQ01Pxwq112MuG JKWaS7drIzTGGabUSXyyMsUf1Bw1HAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=Vl+pAJcVPhMg0uQE7O5ZVCUoBTgBUsUjKtUSWdiXqs4=; b=CzZPqkGpD+5MUkQx2/oahKXp4q25SODSYhikREL+4xl+SL53PGWOt/qer2HzmybQ2UO017rs+Wprg cn0rHxVl8ozt2TiFQ6rehDYCMssc83tg6oiMlgm7XhZqNtixkGEUKRkcrs/YG/QI/Z42m8NJ+MYeen bo7LENK8nB52hwLuxGgxg2HcIrUwsm1GqyfTjzsClIWr6gahe0DG7UULOjinEgqNO0+4z9162Plw4m qZpUupVfTCUDnCPg6JZewTs6C4HAC+5NBeQq2UwNKGyWOFBCidVzPZcH70q/DuhSwHVIXXEMwfLNR8 g3kvfHcn5lb/gAmJSZH4WzKc2qiCivg== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=Vl+pAJcVPhMg0uQE7O5ZVCUoBTgBUsUjKtUSWdiXqs4=; b=JGg7zdU9Hn2OXQWBzHm/n/FotI1XoUubWAnr1cOMZ97qgaS8McFyhARX+Q2KSKhlWiaORSlKPW7nJ TgYolAi1RMRHc5QTItpsZxd6bRrIv+hiJuNJBeZY0KT+Q8DJ8n1QPCGZxqreND3hu2fIvAySC6OW9O +17IOuW76e2KzqZPfUYAvRhojNJVQhhEMAw/8Ce+RDykH+K3arecyHAmAQHdN5/GkDuYreSdtAlo6T o74miPtDC5IRV+wh6wc8wpdg83DFAuPYhuVdGEdAYtRdc2aFKeqOyJIWg5OOHCvhjvlxB9Qfp8krWm bsC+fdva4aPbl0TyRobf01JghhqVIsQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: 9defd064-1849-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 9defd064-1849-11ea-829e-79a40d15cccd; Fri, 06 Dec 2019 16:58:26 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB6GwOxw011708; Fri, 6 Dec 2019 09:58:24 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <7160a41739e5b251b50defb44ad08f3c722ea9c7.camel@freebsd.org> Subject: Re: svn commit: r355444 - in head/sys: arm/mv arm64/conf conf From: Ian Lepore To: Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 06 Dec 2019 09:58:24 -0700 In-Reply-To: <201912061255.xB6CtdJw011374@repo.freebsd.org> References: <201912061255.xB6CtdJw011374@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47TzLY1Qjwz4ct2 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.985,0]; NEURAL_HAM_LONG(-0.98)[-0.980,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 16:58:29 -0000 On Fri, 2019-12-06 at 12:55 +0000, Luiz Otavio O Souza wrote: > Author: loos > Date: Fri Dec 6 12:55:39 2019 > New Revision: 355444 > URL: https://svnweb.freebsd.org/changeset/base/355444 > > Log: > Add the SPI driver for the Marvell Armada 37x0 SoC. > > Interrupt based driver, implements SPI mode and clock configuration. > > Tested on espressobin and SG-3200. > > Sponsored by: Rubicon Communications, LLC (Netgate) > > Added: > head/sys/arm/mv/a37x0_spi.c (contents, props changed) > Modified: > head/sys/arm64/conf/GENERIC > head/sys/conf/files.arm64 > > Added: head/sys/arm/mv/a37x0_spi.c > > > +static int > +a37x0_spi_detach(device_t dev) > +{ > + struct a37x0_spi_softc *sc; > + > + bus_generic_detach(dev); > It's possible for detaching children to fail (like if one of them returns EBUSY from its detach), in which case you should bail on your detach and return the error status. Also, this needs a device_destroy_children() here after detaching them, to remove the spibus child added in attach (in case the module is unloaded then reloaded, that avoids adding a second copy of the child). -- Ian From owner-svn-src-all@freebsd.org Fri Dec 6 17:58:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B7B21B1E5D; Fri, 6 Dec 2019 17:58:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V0gm2Jx1z3C2L; Fri, 6 Dec 2019 17:58:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E8A45072; Fri, 6 Dec 2019 17:58:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6HwRMP089105; Fri, 6 Dec 2019 17:58:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6HwRv6089104; Fri, 6 Dec 2019 17:58:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201912061758.xB6HwRv6089104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 6 Dec 2019 17:58:27 +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: r355453 - stable/12/sys/dev/bwn X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/dev/bwn X-SVN-Commit-Revision: 355453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 17:58:28 -0000 Author: brooks Date: Fri Dec 6 17:58:27 2019 New Revision: 355453 URL: https://svnweb.freebsd.org/changeset/base/355453 Log: MFC r355139: Fix a logic bug when "mask" contains a ?: operator. Newer versions of clang warn that '&' evaluates before '?:'. Reviewed by: markj Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22573 Modified: stable/12/sys/dev/bwn/if_bwnvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/bwn/if_bwnvar.h ============================================================================== --- stable/12/sys/dev/bwn/if_bwnvar.h Fri Dec 6 16:53:42 2019 (r355452) +++ stable/12/sys/dev/bwn/if_bwnvar.h Fri Dec 6 17:58:27 2019 (r355453) @@ -129,7 +129,7 @@ struct bwn_mac; mac->mac_phy.phy_maskset(mac, offset, mask, 0); \ } else \ BWN_PHY_WRITE(mac, offset, \ - BWN_PHY_READ(mac, offset) & mask); \ + BWN_PHY_READ(mac, offset) & (mask)); \ } while (0) #define BWN_PHY_COPY(mac, dst, src) do { \ KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \ From owner-svn-src-all@freebsd.org Fri Dec 6 18:15:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C48B1B28CD; Fri, 6 Dec 2019 18:15:28 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V13M71gqz3D6K; Fri, 6 Dec 2019 18:15:27 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D441E541E; Fri, 6 Dec 2019 18:15:27 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6IFRgH000568; Fri, 6 Dec 2019 18:15:27 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IFRcI000567; Fri, 6 Dec 2019 18:15:27 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201912061815.xB6IFRcI000567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 6 Dec 2019 18:15:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355454 - stable/11/sys/dev/bwn X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/sys/dev/bwn X-SVN-Commit-Revision: 355454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:15:28 -0000 Author: brooks Date: Fri Dec 6 18:15:27 2019 New Revision: 355454 URL: https://svnweb.freebsd.org/changeset/base/355454 Log: MFC r355139: Fix a logic bug when "mask" contains a ?: operator. Newer versions of clang warn that '&' evaluates before '?:'. Reviewed by: markj Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22573 Modified: stable/11/sys/dev/bwn/if_bwnvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/bwn/if_bwnvar.h ============================================================================== --- stable/11/sys/dev/bwn/if_bwnvar.h Fri Dec 6 17:58:27 2019 (r355453) +++ stable/11/sys/dev/bwn/if_bwnvar.h Fri Dec 6 18:15:27 2019 (r355454) @@ -125,7 +125,7 @@ struct bwn_mac; mac->mac_phy.phy_maskset(mac, offset, mask, 0); \ } else \ BWN_PHY_WRITE(mac, offset, \ - BWN_PHY_READ(mac, offset) & mask); \ + BWN_PHY_READ(mac, offset) & (mask)); \ } while (0) #define BWN_PHY_COPY(mac, dst, src) do { \ KASSERT(mac->mac_status < BWN_MAC_STATUS_INITED || \ From owner-svn-src-all@freebsd.org Fri Dec 6 18:26:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5265B1B2B93; Fri, 6 Dec 2019 18:26:39 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V1JH2BmVz3DZd; Fri, 6 Dec 2019 18:26:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DE1B55EF; Fri, 6 Dec 2019 18:26:39 +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 xB6IQd2F006806; Fri, 6 Dec 2019 18:26:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IQZTf006786; Fri, 6 Dec 2019 18:26:35 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061826.xB6IQZTf006786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 18:26:35 +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: r355455 - in stable/12: bin/dd sbin/dhclient sbin/md5 usr.bin/cmp usr.bin/diff usr.bin/diff3 usr.bin/elfdump usr.bin/indent usr.bin/jot usr.bin/ktrdump usr.bin/lam usr.bin/rwho usr.bin/... X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12: bin/dd sbin/dhclient sbin/md5 usr.bin/cmp usr.bin/diff usr.bin/diff3 usr.bin/elfdump usr.bin/indent usr.bin/jot usr.bin/ktrdump usr.bin/lam usr.bin/rwho usr.bin/tee usr.bin/uniq usr.bin/... X-SVN-Commit-Revision: 355455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:26:39 -0000 Author: markj Date: Fri Dec 6 18:26:34 2019 New Revision: 355455 URL: https://svnweb.freebsd.org/changeset/base/355455 Log: MFC r340138 (by oshogbo): capsicum: use a new capsicum helpers in tools Modified: stable/12/bin/dd/dd.c stable/12/sbin/dhclient/bpf.c stable/12/sbin/dhclient/dhclient.c stable/12/sbin/md5/md5.c stable/12/usr.bin/cmp/cmp.c stable/12/usr.bin/diff/diffreg.c stable/12/usr.bin/diff3/diff3.c stable/12/usr.bin/elfdump/elfdump.c stable/12/usr.bin/indent/indent.c stable/12/usr.bin/jot/jot.c stable/12/usr.bin/ktrdump/ktrdump.c stable/12/usr.bin/lam/lam.c stable/12/usr.bin/rwho/rwho.c stable/12/usr.bin/tee/tee.c stable/12/usr.bin/uniq/uniq.c stable/12/usr.bin/units/units.c stable/12/usr.bin/write/write.c stable/12/usr.sbin/rwhod/rwhod.c Directory Properties: stable/12/ (props changed) Modified: stable/12/bin/dd/dd.c ============================================================================== --- stable/12/bin/dd/dd.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/bin/dd/dd.c Fri Dec 6 18:26:34 2019 (r355455) @@ -157,7 +157,7 @@ setup(void) getfdtype(&in); cap_rights_init(&rights, CAP_READ, CAP_SEEK); - if (cap_rights_limit(in.fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(in.fd, &rights) == -1) err(1, "unable to limit capability rights"); if (files_cnt > 1 && !(in.flags & ISTAPE)) @@ -188,10 +188,9 @@ setup(void) getfdtype(&out); - if (cap_rights_limit(out.fd, &rights) == -1 && errno != ENOSYS) + if (caph_rights_limit(out.fd, &rights) == -1) err(1, "unable to limit capability rights"); - if (cap_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1 && - errno != ENOSYS) + if (caph_ioctls_limit(out.fd, cmds, nitems(cmds)) == -1) err(1, "unable to limit capability rights"); if (in.fd != STDIN_FILENO && out.fd != STDIN_FILENO) { Modified: stable/12/sbin/dhclient/bpf.c ============================================================================== --- stable/12/sbin/dhclient/bpf.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/sbin/dhclient/bpf.c Fri Dec 6 18:26:34 2019 (r355455) @@ -57,6 +57,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #define BPF_FORMAT "/dev/bpf%d" /* @@ -164,7 +166,7 @@ if_register_send(struct interface_info *info) error("Cannot lock bpf"); cap_rights_init(&rights, CAP_WRITE); - if (cap_rights_limit(info->wfdesc, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(info->wfdesc, &rights) < 0) error("Can't limit bpf descriptor: %m"); /* @@ -270,9 +272,9 @@ if_register_receive(struct interface_info *info) error("Cannot lock bpf"); cap_rights_init(&rights, CAP_IOCTL, CAP_EVENT, CAP_READ); - if (cap_rights_limit(info->rfdesc, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(info->rfdesc, &rights) < 0) error("Can't limit bpf descriptor: %m"); - if (cap_ioctls_limit(info->rfdesc, cmds, 2) < 0 && errno != ENOSYS) + if (caph_ioctls_limit(info->rfdesc, cmds, 2) < 0) error("Can't limit ioctls for bpf descriptor: %m"); } Modified: stable/12/sbin/dhclient/dhclient.c ============================================================================== --- stable/12/sbin/dhclient/dhclient.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/sbin/dhclient/dhclient.c Fri Dec 6 18:26:34 2019 (r355455) @@ -512,7 +512,7 @@ main(int argc, char *argv[]) close(pipe_fd[0]); privfd = pipe_fd[1]; cap_rights_init(&rights, CAP_READ, CAP_WRITE); - if (cap_rights_limit(privfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(privfd, &rights) < 0) error("can't limit private descriptor: %m"); if ((fd = open(path_dhclient_db, O_RDONLY|O_EXLOCK|O_CREAT, 0)) == -1) @@ -526,7 +526,7 @@ main(int argc, char *argv[]) if (shutdown(routefd, SHUT_WR) < 0) error("can't shutdown route socket: %m"); cap_rights_init(&rights, CAP_EVENT, CAP_READ); - if (cap_rights_limit(routefd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(routefd, &rights) < 0) error("can't limit route socket: %m"); endpwent(); @@ -1928,12 +1928,10 @@ rewrite_client_leases(void) error("can't create %s: %m", path_dhclient_db); cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_FSYNC, CAP_FTRUNCATE, CAP_SEEK, CAP_WRITE); - if (cap_rights_limit(fileno(leaseFile), &rights) < 0 && - errno != ENOSYS) { + if (caph_rights_limit(fileno(leaseFile), &rights) < 0) { error("can't limit lease descriptor: %m"); } - if (cap_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0 && - errno != ENOSYS) { + if (caph_fcntls_limit(fileno(leaseFile), CAP_FCNTL_GETFL) < 0) { error("can't limit lease descriptor fcntls: %m"); } } else { @@ -2461,20 +2459,24 @@ go_daemon(void) cap_rights_init(&rights); - if (pidfile != NULL) + if (pidfile != NULL) { pidfile_write(pidfile); + if (caph_rights_limit(pidfile_fileno(pidfile), &rights) < 0) + error("can't limit pidfile descriptor: %m"); + } + if (nullfd != -1) { close(nullfd); nullfd = -1; } - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) error("can't limit stdin: %m"); cap_rights_init(&rights, CAP_WRITE); - if (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDOUT_FILENO, &rights) < 0) error("can't limit stdout: %m"); - if (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDERR_FILENO, &rights) < 0) error("can't limit stderr: %m"); } Modified: stable/12/sbin/md5/md5.c ============================================================================== --- stable/12/sbin/md5/md5.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/sbin/md5/md5.c Fri Dec 6 18:26:34 2019 (r355455) @@ -242,8 +242,8 @@ main(int argc, char *argv[]) if (*(argv + 1) == NULL) { #ifdef HAVE_CAPSICUM cap_rights_init(&rights, CAP_READ); - if ((cap_rights_limit(fd, &rights) < 0 && - errno != ENOSYS) || caph_enter() < 0) + if (caph_rights_limit(fd, &rights) < 0 || + caph_enter() < 0) err(1, "capsicum"); #endif } Modified: stable/12/usr.bin/cmp/cmp.c ============================================================================== --- stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:26:34 2019 (r355455) @@ -163,22 +163,21 @@ main(int argc, char *argv[]) } cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_MMAP_R); - if (cap_rights_limit(fd1, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd1, &rights) < 0) err(ERR_EXIT, "unable to limit rights for %s", file1); - if (cap_rights_limit(fd2, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd2, &rights) < 0) err(ERR_EXIT, "unable to limit rights for %s", file2); /* Required for fdopen(3). */ fcntls = CAP_FCNTL_GETFL; - if (cap_fcntls_limit(fd1, fcntls) < 0 && errno != ENOSYS) + if (caph_fcntls_limit(fd1, fcntls) < 0) err(ERR_EXIT, "unable to limit fcntls for %s", file1); - if (cap_fcntls_limit(fd2, fcntls) < 0 && errno != ENOSYS) + if (caph_fcntls_limit(fd2, fcntls) < 0) err(ERR_EXIT, "unable to limit fcntls for %s", file2); if (!special) { cap_rights_init(&rights); - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && - errno != ENOSYS) { + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) { err(ERR_EXIT, "unable to limit stdio"); } } Modified: stable/12/usr.bin/diff/diffreg.c ============================================================================== --- stable/12/usr.bin/diff/diffreg.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/diff/diffreg.c Fri Dec 6 18:26:34 2019 (r355455) @@ -319,11 +319,9 @@ diffreg(char *file1, char *file2, int flags, int capsi if (capsicum) { cap_rights_init(&rights_ro, CAP_READ, CAP_FSTAT, CAP_SEEK); - if (cap_rights_limit(fileno(f1), &rights_ro) < 0 - && errno != ENOSYS) + if (caph_rights_limit(fileno(f1), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file1); - if (cap_rights_limit(fileno(f2), &rights_ro) < 0 && - errno != ENOSYS) + if (caph_rights_limit(fileno(f2), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file2); if (fileno(f1) == STDIN_FILENO || fileno(f2) == STDIN_FILENO) { /* stding has already been limited */ Modified: stable/12/usr.bin/diff3/diff3.c ============================================================================== --- stable/12/usr.bin/diff3/diff3.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/diff3/diff3.c Fri Dec 6 18:26:34 2019 (r355455) @@ -717,19 +717,19 @@ main(int argc, char **argv) fp[0] = fopen(file1, "r"); if (fp[0] == NULL) err(2, "Can't open %s", file1); - if (cap_rights_limit(fileno(fp[0]), &rights_ro) < 0) + if (caph_rights_limit(fileno(fp[0]), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file1); fp[1] = fopen(file2, "r"); if (fp[1] == NULL) err(2, "Can't open %s", file2); - if (cap_rights_limit(fileno(fp[1]), &rights_ro) < 0) + if (caph_rights_limit(fileno(fp[1]), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file2); fp[2] = fopen(file3, "r"); if (fp[2] == NULL) err(2, "Can't open %s", file3); - if (cap_rights_limit(fileno(fp[2]), &rights_ro) < 0) + if (caph_rights_limit(fileno(fp[2]), &rights_ro) < 0) err(2, "unable to limit rights on: %s", file3); if (pipe(fd13)) Modified: stable/12/usr.bin/elfdump/elfdump.c ============================================================================== --- stable/12/usr.bin/elfdump/elfdump.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/elfdump/elfdump.c Fri Dec 6 18:26:34 2019 (r355455) @@ -557,7 +557,7 @@ main(int ac, char **av) if ((out = fopen(optarg, "w")) == NULL) err(1, "%s", optarg); cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); - if (cap_rights_limit(fileno(out), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(out), &rights) < 0) err(1, "unable to limit rights for %s", optarg); break; case '?': @@ -572,10 +572,10 @@ main(int ac, char **av) fstat(fd, &sb) < 0) err(1, "%s", *av); cap_rights_init(&rights, CAP_MMAP_R); - if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) < 0) err(1, "unable to limit rights for %s", *av); cap_rights_init(&rights); - if ((cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) || + if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || caph_limit_stdout() < 0 || caph_limit_stderr() < 0) { err(1, "unable to limit rights for stdio"); } Modified: stable/12/usr.bin/indent/indent.c ============================================================================== --- stable/12/usr.bin/indent/indent.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/indent/indent.c Fri Dec 6 18:26:34 2019 (r355455) @@ -245,10 +245,10 @@ main(int argc, char **argv) /* Restrict input/output descriptors and enter Capsicum sandbox. */ cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); - if (cap_rights_limit(fileno(output), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(output), &rights) < 0) err(EXIT_FAILURE, "unable to limit rights for %s", out_name); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); - if (cap_rights_limit(fileno(input), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(input), &rights) < 0) err(EXIT_FAILURE, "unable to limit rights for %s", in_name); if (caph_enter() < 0) err(EXIT_FAILURE, "unable to enter capability mode"); Modified: stable/12/usr.bin/jot/jot.c ============================================================================== --- stable/12/usr.bin/jot/jot.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/jot/jot.c Fri Dec 6 18:26:34 2019 (r355455) @@ -114,7 +114,7 @@ main(int argc, char **argv) if (caph_limit_stdio() < 0) err(1, "unable to limit rights for stdio"); cap_rights_init(&rights); - if (cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0) err(1, "unable to limit rights for stdin"); /* Modified: stable/12/usr.bin/ktrdump/ktrdump.c ============================================================================== --- stable/12/usr.bin/ktrdump/ktrdump.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/ktrdump/ktrdump.c Fri Dec 6 18:26:34 2019 (r355455) @@ -132,8 +132,7 @@ main(int ac, char **av) if ((in = open(optarg, O_RDONLY)) == -1) err(1, "%s", optarg); cap_rights_init(&rights, CAP_FSTAT, CAP_MMAP_R); - if (cap_rights_limit(in, &rights) < 0 && - errno != ENOSYS) + if (caph_rights_limit(in, &rights) < 0) err(1, "unable to limit rights for %s", optarg); break; Modified: stable/12/usr.bin/lam/lam.c ============================================================================== --- stable/12/usr.bin/lam/lam.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/lam/lam.c Fri Dec 6 18:26:34 2019 (r355455) @@ -136,8 +136,7 @@ getargs(char *av[]) else if ((ip->fp = fopen(p, "r")) == NULL) { err(1, "%s", p); } - if (cap_rights_limit(fileno(ip->fp), &rights_ro) < 0 - && errno != ENOSYS) + if (caph_rights_limit(fileno(ip->fp), &rights_ro) < 0) err(1, "unable to limit rights on: %s", p); ip->pad = P; if (!ip->sepstring) Modified: stable/12/usr.bin/rwho/rwho.c ============================================================================== --- stable/12/usr.bin/rwho/rwho.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/rwho/rwho.c Fri Dec 6 18:26:34 2019 (r355455) @@ -129,7 +129,7 @@ main(int argc, char *argv[]) dfd = dirfd(dirp); mp = myutmp; cap_rights_init(&rights, CAP_READ, CAP_LOOKUP); - if (cap_rights_limit(dfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(dfd, &rights) < 0) err(1, "cap_rights_limit failed: %s", _PATH_RWHODIR); /* * Cache files required for time(3) and localtime(3) before entering @@ -147,7 +147,7 @@ main(int argc, char *argv[]) f = openat(dfd, dp->d_name, O_RDONLY); if (f < 0) continue; - if (cap_rights_limit(f, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(f, &rights) < 0) err(1, "cap_rights_limit failed: %s", dp->d_name); cc = read(f, (char *)&wd, sizeof(struct whod)); if (cc < WHDRSIZE) { Modified: stable/12/usr.bin/tee/tee.c ============================================================================== --- stable/12/usr.bin/tee/tee.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/tee/tee.c Fri Dec 6 18:26:34 2019 (r355455) @@ -147,7 +147,7 @@ add(int fd, const char *name) err(EXIT_FAILURE, "unable to limit stdout"); } else { cap_rights_init(&rights, CAP_WRITE, CAP_FSTAT); - if (cap_rights_limit(fd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fd, &rights) < 0) err(EXIT_FAILURE, "unable to limit rights"); } Modified: stable/12/usr.bin/uniq/uniq.c ============================================================================== --- stable/12/usr.bin/uniq/uniq.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/uniq/uniq.c Fri Dec 6 18:26:34 2019 (r355455) @@ -143,14 +143,14 @@ main (int argc, char *argv[]) if (argc > 0 && strcmp(argv[0], "-") != 0) ifp = file(ifn = argv[0], "r"); cap_rights_init(&rights, CAP_FSTAT, CAP_READ); - if (cap_rights_limit(fileno(ifp), &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(fileno(ifp), &rights) < 0) err(1, "unable to limit rights for %s", ifn); cap_rights_init(&rights, CAP_FSTAT, CAP_WRITE); if (argc > 1) ofp = file(argv[1], "w"); else cap_rights_set(&rights, CAP_IOCTL); - if (cap_rights_limit(fileno(ofp), &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(fileno(ofp), &rights) < 0) { err(1, "unable to limit rights for %s", argc > 1 ? argv[1] : "stdout"); } @@ -159,8 +159,7 @@ main (int argc, char *argv[]) cmd = TIOCGETA; /* required by isatty(3) in printf(3) */ - if (cap_ioctls_limit(fileno(ofp), &cmd, 1) < 0 && - errno != ENOSYS) { + if (caph_ioctls_limit(fileno(ofp), &cmd, 1) < 0) { err(1, "unable to limit ioctls for %s", argc > 1 ? argv[1] : "stdout"); } Modified: stable/12/usr.bin/units/units.c ============================================================================== --- stable/12/usr.bin/units/units.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/units/units.c Fri Dec 6 18:26:34 2019 (r355455) @@ -156,8 +156,7 @@ readunits(const char *userfile) } } cap_rights_init(&unitfilerights, CAP_READ, CAP_FSTAT); - if (cap_rights_limit(fileno(unitfile), &unitfilerights) < 0 - && errno != ENOSYS) + if (caph_rights_limit(fileno(unitfile), &unitfilerights) < 0) err(1, "cap_rights_limit() failed"); while (!feof(unitfile)) { if (!fgets(line, sizeof(line), unitfile)) Modified: stable/12/usr.bin/write/write.c ============================================================================== --- stable/12/usr.bin/write/write.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.bin/write/write.c Fri Dec 6 18:26:34 2019 (r355455) @@ -97,7 +97,7 @@ main(int argc, char **argv) err(1, "open(/dev)"); cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_LOOKUP, CAP_PWRITE); - if (cap_rights_limit(devfd, &rights) < 0 && errno != ENOSYS) + if (caph_rights_limit(devfd, &rights) < 0) err(1, "can't limit devfd rights"); /* @@ -106,15 +106,15 @@ main(int argc, char **argv) */ cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_IOCTL, CAP_READ, CAP_WRITE); - if ((cap_rights_limit(STDIN_FILENO, &rights) < 0 && errno != ENOSYS) || - (cap_rights_limit(STDOUT_FILENO, &rights) < 0 && errno != ENOSYS) || - (cap_rights_limit(STDERR_FILENO, &rights) < 0 && errno != ENOSYS) || - (cap_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) < 0 && errno != ENOSYS) || - (cap_ioctls_limit(STDOUT_FILENO, cmds, nitems(cmds)) < 0 && errno != ENOSYS) || - (cap_ioctls_limit(STDERR_FILENO, cmds, nitems(cmds)) < 0 && errno != ENOSYS) || - (cap_fcntls_limit(STDIN_FILENO, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) || - (cap_fcntls_limit(STDOUT_FILENO, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS) || - (cap_fcntls_limit(STDERR_FILENO, CAP_FCNTL_GETFL) < 0 && errno != ENOSYS)) + if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || + caph_rights_limit(STDOUT_FILENO, &rights) < 0 || + caph_rights_limit(STDERR_FILENO, &rights) < 0 || + caph_ioctls_limit(STDIN_FILENO, cmds, nitems(cmds)) < 0 || + caph_ioctls_limit(STDOUT_FILENO, cmds, nitems(cmds)) < 0 || + caph_ioctls_limit(STDERR_FILENO, cmds, nitems(cmds)) < 0 || + caph_fcntls_limit(STDIN_FILENO, CAP_FCNTL_GETFL) < 0 || + caph_fcntls_limit(STDOUT_FILENO, CAP_FCNTL_GETFL) < 0 || + caph_fcntls_limit(STDERR_FILENO, CAP_FCNTL_GETFL) < 0) err(1, "can't limit stdio rights"); caph_cache_catpages(); Modified: stable/12/usr.sbin/rwhod/rwhod.c ============================================================================== --- stable/12/usr.sbin/rwhod/rwhod.c Fri Dec 6 18:15:27 2019 (r355454) +++ stable/12/usr.sbin/rwhod/rwhod.c Fri Dec 6 18:26:34 2019 (r355455) @@ -369,7 +369,7 @@ receiver_process(void) } cap_rights_init(&rights, CAP_CREATE, CAP_FSTAT, CAP_FTRUNCATE, CAP_LOOKUP, CAP_SEEK, CAP_WRITE); - if (cap_rights_limit(dirfd, &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(dirfd, &rights) < 0) { syslog(LOG_WARNING, "cap_rights_limit: %m"); exit(1); } @@ -415,7 +415,7 @@ receiver_process(void) continue; } cap_rights_init(&rights, CAP_FSTAT, CAP_FTRUNCATE, CAP_WRITE); - if (cap_rights_limit(whod, &rights) < 0 && errno != ENOSYS) { + if (caph_rights_limit(whod, &rights) < 0) { syslog(LOG_WARNING, "cap_rights_limit: %m"); exit(1); } From owner-svn-src-all@freebsd.org Fri Dec 6 18:27:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D65D1B2C40; Fri, 6 Dec 2019 18:27:51 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V1Kg39j8z3Dhy; Fri, 6 Dec 2019 18:27:51 +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 5166E55F2; Fri, 6 Dec 2019 18:27:51 +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 xB6IRpfw006910; Fri, 6 Dec 2019 18:27:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IRoMB006907; Fri, 6 Dec 2019 18:27:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061827.xB6IRoMB006907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 18:27: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: r355456 - in stable/12/usr.bin/cmp: . tests X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/usr.bin/cmp: . tests X-SVN-Commit-Revision: 355456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:27:51 -0000 Author: markj Date: Fri Dec 6 18:27:50 2019 New Revision: 355456 URL: https://svnweb.freebsd.org/changeset/base/355456 Log: MFC r344551: Fix handling of rights on stdio streams, take two. PR: 234885 Modified: stable/12/usr.bin/cmp/cmp.c stable/12/usr.bin/cmp/regular.c stable/12/usr.bin/cmp/special.c stable/12/usr.bin/cmp/tests/cmp_test2.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/cmp/cmp.c ============================================================================== --- stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/cmp.c Fri Dec 6 18:27:50 2019 (r355456) @@ -45,7 +45,6 @@ static char sccsid[] = "@(#)cmp.c 8.3 (Berkeley) 4/2/9 __FBSDID("$FreeBSD$"); #include -#include #include #include @@ -80,8 +79,6 @@ main(int argc, char *argv[]) off_t skip1, skip2; int ch, fd1, fd2, oflag, special; const char *file1, *file2; - cap_rights_t rights; - uint32_t fcntls; oflag = O_RDONLY; while ((ch = getopt_long(argc, argv, "+hlsxz", long_opts, NULL)) != -1) @@ -116,14 +113,19 @@ main(int argc, char *argv[]) if (argc < 2 || argc > 4) usage(); + /* Don't limit rights on stdin since it may be one of the inputs. */ + if (caph_limit_stream(STDOUT_FILENO, CAPH_WRITE | CAPH_IGNORE_EBADF)) + err(ERR_EXIT, "unable to limit rights on stdout"); + if (caph_limit_stream(STDERR_FILENO, CAPH_WRITE | CAPH_IGNORE_EBADF)) + err(ERR_EXIT, "unable to limit rights on stderr"); + /* Backward compatibility -- handle "-" meaning stdin. */ special = 0; if (strcmp(file1 = argv[0], "-") == 0) { special = 1; - fd1 = 0; + fd1 = STDIN_FILENO; file1 = "stdin"; - } - else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { + } else if ((fd1 = open(file1, oflag, 0)) < 0 && errno != EMLINK) { if (!sflag) err(ERR_EXIT, "%s", file1); else @@ -134,10 +136,9 @@ main(int argc, char *argv[]) errx(ERR_EXIT, "standard input may only be specified once"); special = 1; - fd2 = 0; + fd2 = STDIN_FILENO; file2 = "stdin"; - } - else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { + } else if ((fd2 = open(file2, oflag, 0)) < 0 && errno != EMLINK) { if (!sflag) err(ERR_EXIT, "%s", file2); else @@ -162,33 +163,8 @@ main(int argc, char *argv[]) exit(ERR_EXIT); } - cap_rights_init(&rights, CAP_FCNTL, CAP_FSTAT, CAP_MMAP_R); - if (caph_rights_limit(fd1, &rights) < 0) - err(ERR_EXIT, "unable to limit rights for %s", file1); - if (caph_rights_limit(fd2, &rights) < 0) - err(ERR_EXIT, "unable to limit rights for %s", file2); - - /* Required for fdopen(3). */ - fcntls = CAP_FCNTL_GETFL; - if (caph_fcntls_limit(fd1, fcntls) < 0) - err(ERR_EXIT, "unable to limit fcntls for %s", file1); - if (caph_fcntls_limit(fd2, fcntls) < 0) - err(ERR_EXIT, "unable to limit fcntls for %s", file2); - - if (!special) { - cap_rights_init(&rights); - if (caph_rights_limit(STDIN_FILENO, &rights) < 0) { - err(ERR_EXIT, "unable to limit stdio"); - } - } - - if (caph_limit_stdout() == -1 || caph_limit_stderr() == -1) - err(ERR_EXIT, "unable to limit stdio"); - + /* FD rights are limited in c_special() and c_regular(). */ caph_cache_catpages(); - - if (caph_enter() < 0) - err(ERR_EXIT, "unable to enter capability mode"); if (!special) { if (fstat(fd1, &sb1)) { Modified: stable/12/usr.bin/cmp/regular.c ============================================================================== --- stable/12/usr.bin/cmp/regular.c Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/regular.c Fri Dec 6 18:27:50 2019 (r355456) @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -61,12 +62,13 @@ void c_regular(int fd1, const char *file1, off_t skip1, off_t len1, int fd2, const char *file2, off_t skip2, off_t len2) { + struct sigaction act, oact; + cap_rights_t rights; u_char ch, *p1, *p2, *m1, *m2, *e1, *e2; off_t byte, length, line; - int dfound; off_t pagemask, off1, off2; size_t pagesize; - struct sigaction act, oact; + int dfound; if (skip1 > len1) eofmsg(file1); @@ -78,12 +80,6 @@ c_regular(int fd1, const char *file1, off_t skip1, off if (sflag && len1 != len2) exit(DIFF_EXIT); - sigemptyset(&act.sa_mask); - act.sa_flags = SA_NODEFER; - act.sa_handler = segv_handler; - if (sigaction(SIGSEGV, &act, &oact)) - err(ERR_EXIT, "sigaction()"); - pagesize = getpagesize(); pagemask = (off_t)pagesize - 1; off1 = ROUNDPAGE(skip1); @@ -101,6 +97,19 @@ c_regular(int fd1, const char *file1, off_t skip1, off c_special(fd1, file1, skip1, fd2, file2, skip2); return; } + + if (caph_rights_limit(fd1, cap_rights_init(&rights, CAP_MMAP_R)) < 0) + err(1, "unable to limit rights for %s", file1); + if (caph_rights_limit(fd2, cap_rights_init(&rights, CAP_MMAP_R)) < 0) + err(1, "unable to limit rights for %s", file2); + if (caph_enter() < 0) + err(ERR_EXIT, "unable to enter capability mode"); + + sigemptyset(&act.sa_mask); + act.sa_flags = SA_NODEFER; + act.sa_handler = segv_handler; + if (sigaction(SIGSEGV, &act, &oact)) + err(ERR_EXIT, "sigaction()"); dfound = 0; e1 = m1 + MMAP_CHUNK; Modified: stable/12/usr.bin/cmp/special.c ============================================================================== --- stable/12/usr.bin/cmp/special.c Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/special.c Fri Dec 6 18:27:50 2019 (r355456) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -54,6 +55,13 @@ c_special(int fd1, const char *file1, off_t skip1, off_t byte, line; FILE *fp1, *fp2; int dfound; + + if (caph_limit_stream(fd1, CAPH_READ) < 0) + err(ERR_EXIT, "caph_limit_stream(%s)", file1); + if (caph_limit_stream(fd2, CAPH_READ) < 0) + err(ERR_EXIT, "caph_limit_stream(%s)", file2); + if (caph_enter() < 0) + err(ERR_EXIT, "unable to enter capability mode"); if ((fp1 = fdopen(fd1, "r")) == NULL) err(ERR_EXIT, "%s", file1); Modified: stable/12/usr.bin/cmp/tests/cmp_test2.sh ============================================================================== --- stable/12/usr.bin/cmp/tests/cmp_test2.sh Fri Dec 6 18:26:34 2019 (r355455) +++ stable/12/usr.bin/cmp/tests/cmp_test2.sh Fri Dec 6 18:27:50 2019 (r355456) @@ -36,6 +36,8 @@ special_body() { atf_check -s exit:0 -o empty -e empty -x "cat a | cmp - a" atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp a -" atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp - a" + + atf_check -s exit:0 -o empty -e empty -x "cmp a a <&-" } atf_test_case symlink From owner-svn-src-all@freebsd.org Fri Dec 6 18:39:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC09C1B2F28; Fri, 6 Dec 2019 18:39:05 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V1Zd5SjTz3FFV; Fri, 6 Dec 2019 18:39:05 +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 9EBA957BC; Fri, 6 Dec 2019 18:39:05 +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 xB6Id5nj012714; Fri, 6 Dec 2019 18:39:05 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6Id5CF012713; Fri, 6 Dec 2019 18:39:05 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912061839.xB6Id5CF012713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 6 Dec 2019 18:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355457 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:39:05 -0000 Author: mav Date: Fri Dec 6 18:39:05 2019 New Revision: 355457 URL: https://svnweb.freebsd.org/changeset/base/355457 Log: Make devstat_end_transaction_bio() count BIO_ORDERED. MFC after: 2 weeks Modified: head/sys/kern/subr_devstat.c Modified: head/sys/kern/subr_devstat.c ============================================================================== --- head/sys/kern/subr_devstat.c Fri Dec 6 18:27:50 2019 (r355456) +++ head/sys/kern/subr_devstat.c Fri Dec 6 18:39:05 2019 (r355457) @@ -349,11 +349,16 @@ devstat_end_transaction_bio_bt(struct devstat *ds, con const struct bintime *now) { devstat_trans_flags flg; + devstat_tag_type tag; /* sanity check */ if (ds == NULL) return; + if (bp->bio_flags & BIO_ORDERED) + tag = DEVSTAT_TAG_ORDERED; + else + tag = DEVSTAT_TAG_SIMPLE; if (bp->bio_cmd == BIO_DELETE) flg = DEVSTAT_FREE; else if ((bp->bio_cmd == BIO_READ) @@ -366,7 +371,7 @@ devstat_end_transaction_bio_bt(struct devstat *ds, con flg = DEVSTAT_NO_DATA; devstat_end_transaction(ds, bp->bio_bcount - bp->bio_resid, - DEVSTAT_TAG_SIMPLE, flg, now, &bp->bio_t0); + tag, flg, now, &bp->bio_t0); DTRACE_DEVSTAT_BIO_DONE(); } From owner-svn-src-all@freebsd.org Fri Dec 6 18:51:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D3171B3472; Fri, 6 Dec 2019 18:51:17 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V1rj3hbJz3Fsk; Fri, 6 Dec 2019 18:51:17 +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 486E259C1; Fri, 6 Dec 2019 18:51:17 +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 xB6IpHve022423; Fri, 6 Dec 2019 18:51:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6IpHIj022422; Fri, 6 Dec 2019 18:51:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912061851.xB6IpHIj022422@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 18:51:17 +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: r355458 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 355458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 18:51:17 -0000 Author: markj Date: Fri Dec 6 18:51:16 2019 New Revision: 355458 URL: https://svnweb.freebsd.org/changeset/base/355458 Log: MFC r355003: Update the checks in vm_page_zone_import(). Modified: stable/12/sys/vm/vm_page.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Fri Dec 6 18:39:05 2019 (r355457) +++ stable/12/sys/vm/vm_page.c Fri Dec 6 18:51:16 2019 (r355458) @@ -1755,21 +1755,14 @@ vm_page_alloc_after(vm_object_t object, vm_pindex_t pi * Returns true if the number of free pages exceeds the minimum * for the request class and false otherwise. */ -int -vm_domain_allocate(struct vm_domain *vmd, int req, int npages) +static int +_vm_domain_allocate(struct vm_domain *vmd, int req_class, int npages) { u_int limit, old, new; - req = req & VM_ALLOC_CLASS_MASK; - - /* - * The page daemon is allowed to dig deeper into the free page list. - */ - if (curproc == pageproc && req != VM_ALLOC_INTERRUPT) - req = VM_ALLOC_SYSTEM; - if (req == VM_ALLOC_INTERRUPT) + if (req_class == VM_ALLOC_INTERRUPT) limit = 0; - else if (req == VM_ALLOC_SYSTEM) + else if (req_class == VM_ALLOC_SYSTEM) limit = vmd->vmd_interrupt_free_min; else limit = vmd->vmd_free_reserved; @@ -1797,6 +1790,20 @@ vm_domain_allocate(struct vm_domain *vmd, int req, int return (1); } +int +vm_domain_allocate(struct vm_domain *vmd, int req, int npages) +{ + int req_class; + + /* + * The page daemon is allowed to dig deeper into the free page list. + */ + req_class = req & VM_ALLOC_CLASS_MASK; + if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) + req_class = VM_ALLOC_SYSTEM; + return (_vm_domain_allocate(vmd, req_class, npages)); +} + vm_page_t vm_page_alloc_domain_after(vm_object_t object, vm_pindex_t pindex, int domain, int req, vm_page_t mpred) @@ -2244,8 +2251,13 @@ vm_page_zone_import(void *arg, void **store, int cnt, pgcache = arg; vmd = VM_DOMAIN(pgcache->domain); - /* Only import if we can bring in a full bucket. */ - if (cnt == 1 || !vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) + + /* + * The page daemon should avoid creating extra memory pressure since its + * main purpose is to replenish the store of free pages. + */ + if (vmd->vmd_severeset || curproc == pageproc || + !_vm_domain_allocate(vmd, VM_ALLOC_NORMAL, cnt)) return (0); domain = vmd->vmd_domain; vm_domain_free_lock(vmd); From owner-svn-src-all@freebsd.org Fri Dec 6 19:20:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 357D31B3D86; Fri, 6 Dec 2019 19:20:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V2Vk0lS6z3HRt; Fri, 6 Dec 2019 19:20:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F27465F0A; Fri, 6 Dec 2019 19:20:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6JKjVA038384; Fri, 6 Dec 2019 19:20:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6JKjI4038383; Fri, 6 Dec 2019 19:20:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201912061920.xB6JKjI4038383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 6 Dec 2019 19:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355459 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 355459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 19:20:46 -0000 Author: jhb Date: Fri Dec 6 19:20:45 2019 New Revision: 355459 URL: https://svnweb.freebsd.org/changeset/base/355459 Log: Remove SPARE_USRSPACE. This constant was used to reserve space at the top of the stack to hold translated system call arguments for non-default ABIs (the "stackgap"). However, none of the compatibility ABIs have used the stackgap in many years and the last use of SPARE_USRSPACE was removed in r355373. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22697 Modified: head/sys/sys/exec.h Modified: head/sys/sys/exec.h ============================================================================== --- head/sys/sys/exec.h Fri Dec 6 18:51:16 2019 (r355458) +++ head/sys/sys/exec.h Fri Dec 6 19:20:45 2019 (r355459) @@ -77,7 +77,6 @@ struct execsw { * Prefer the kern.ps_strings or kern.proc.ps_strings sysctls to this constant. */ #define PS_STRINGS (USRSTACK - sizeof(struct ps_strings)) -#define SPARE_USRSPACE 4096 int exec_map_first_page(struct image_params *); void exec_unmap_first_page(struct image_params *); From owner-svn-src-all@freebsd.org Fri Dec 6 19:33:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C42521B435E; Fri, 6 Dec 2019 19:33:40 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V2nc4mp8z3J9Q; Fri, 6 Dec 2019 19:33:40 +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 874F46273; Fri, 6 Dec 2019 19:33:40 +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 xB6JXenr047847; Fri, 6 Dec 2019 19:33:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6JXdxo047844; Fri, 6 Dec 2019 19:33:39 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912061933.xB6JXdxo047844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Dec 2019 19:33:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355460 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 355460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 19:33:40 -0000 Author: kevans Date: Fri Dec 6 19:33:39 2019 New Revision: 355460 URL: https://svnweb.freebsd.org/changeset/base/355460 Log: libbe: fix build against sysutils/openzfs, part 1 This is the half of the changes required that work as-is with both in-tree ZFS and the new hotness, sysutils/openzfs. Highlights are less dependency on header pollution (from somewhere) and using 'mnttab' instead of 'extmnttab'. In the in-tree ZFS, the latter is a #define for the former, but in the port extmnttab is actually a distinct struct that's a super-set of mnttab. We really want mnttab here anyways, so just use it. Modified: head/lib/libbe/be.c head/lib/libbe/be_access.c head/lib/libbe/be_info.c Modified: head/lib/libbe/be.c ============================================================================== --- head/lib/libbe/be.c Fri Dec 6 19:20:45 2019 (r355459) +++ head/lib/libbe/be.c Fri Dec 6 19:33:39 2019 (r355460) @@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include #include @@ -67,7 +70,7 @@ static int be_locate_rootfs(libbe_handle_t *lbh) { struct statfs sfs; - struct extmnttab entry; + struct mnttab entry; zfs_handle_t *zfs; /* Modified: head/lib/libbe/be_access.c ============================================================================== --- head/lib/libbe/be_access.c Fri Dec 6 19:20:45 2019 (r355459) +++ head/lib/libbe/be_access.c Fri Dec 6 19:33:39 2019 (r355460) @@ -31,6 +31,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "be.h" #include "be_impl.h" Modified: head/lib/libbe/be_info.c ============================================================================== --- head/lib/libbe/be_info.c Fri Dec 6 19:20:45 2019 (r355459) +++ head/lib/libbe/be_info.c Fri Dec 6 19:33:39 2019 (r355460) @@ -30,6 +30,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "be.h" #include "be_impl.h" From owner-svn-src-all@freebsd.org Fri Dec 6 20:05:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D25041B4C7D; Fri, 6 Dec 2019 20:05:08 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V3Tw5BB7z3LC9; Fri, 6 Dec 2019 20:05:08 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9599E67F9; Fri, 6 Dec 2019 20:05:08 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6K58xY065450; Fri, 6 Dec 2019 20:05:08 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6K58OX065449; Fri, 6 Dec 2019 20:05:08 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912062005.xB6K58OX065449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 6 Dec 2019 20:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355461 - head/sys/arm/mv X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: head/sys/arm/mv X-SVN-Commit-Revision: 355461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 20:05:08 -0000 Author: loos Date: Fri Dec 6 20:05:08 2019 New Revision: 355461 URL: https://svnweb.freebsd.org/changeset/base/355461 Log: Fix the ARM64 build, include the necessary header. While here, call device_delete_children() to detach and dealloc all the existent children and handle the child's detach errors properly. Reported by: jenkins, hselasky, ian Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/arm/mv/a37x0_spi.c Modified: head/sys/arm/mv/a37x0_spi.c ============================================================================== --- head/sys/arm/mv/a37x0_spi.c Fri Dec 6 19:33:39 2019 (r355460) +++ head/sys/arm/mv/a37x0_spi.c Fri Dec 6 20:05:08 2019 (r355461) @@ -29,9 +29,9 @@ __FBSDID("$FreeBSD$"); #include #include #include - #include #include +#include #include #include @@ -228,9 +228,11 @@ a37x0_spi_attach(device_t dev) static int a37x0_spi_detach(device_t dev) { + int err; struct a37x0_spi_softc *sc; - bus_generic_detach(dev); + if ((err = device_delete_children(dev)) != 0) + return (err); sc = device_get_softc(dev); mtx_destroy(&sc->sc_mtx); if (sc->sc_intrhand) From owner-svn-src-all@freebsd.org Fri Dec 6 20:10:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C5AF1B4E08; Fri, 6 Dec 2019 20:10:09 +0000 (UTC) (envelope-from loos.br@gmail.com) Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47V3bj1qt7z3LYw; Fri, 6 Dec 2019 20:10:09 +0000 (UTC) (envelope-from loos.br@gmail.com) Received: by mail-io1-xd42.google.com with SMTP id x1so8575484iop.7; Fri, 06 Dec 2019 12:10:09 -0800 (PST) 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=40xzA7/CCtF2ieDGz/5A6zTdi4pEKj1ctuSk4L11Ksw=; b=l+1FdMFoftdZCUjvq6WEks7UWD8u3p8bLwXg9kH0nplkxNZWsPCdQhn97vpVed5s/N BBzP3NUpI8lCffiQb8mCgO12qVuVeDI1vukTB8NNj0JfDW+Yfk3PNw0yjaAMVE1H+oGm yahDKyGrG3YA1SoCpPM4xZN1Wt2Wf3pSHNAiFpWILKI3f6E9a7Qk1GzMM7dn7HK4CDB6 sWCXBfMQ0lXOTllv8Nfr+j7rXYQ8J6ThJab+chRlWcvrF85rNcO9BoW+xJ3SpnETIGcp D9r6QBlMDImcPLZhn9lQIHMNPaQlh8K7Hk3aTNLD4JjW2Efcx4+V1ovuXNU8zPYZBL7t i4Ww== 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=40xzA7/CCtF2ieDGz/5A6zTdi4pEKj1ctuSk4L11Ksw=; b=fUqHLyGqgq0D5c/PDj9fSrA/09iq7S9vxGB3ZbTEbYTNWL9LMsEmFvhjcbIm4dqLCD n/wxO1WToOjrEqE2JUBZwGfgTQgCEFTsS9ex0UHLpnUtZA33g0WuQRdkaa6C5gAsEsqk qQOKrK6FQmNDjsCLuOIBx936iLetfZ750+OHyXUg8ZFKfwMuodGmnN60Z6Ui0VcxfA1P IM1bxuAzuCrgAgfe2P7EgpqZ53ZW8DPfIXwfXO1AYL7m0uK5ZA02YJSEB+GTQiws//yE fkevQeyBr3rQII6yJsDwY/PslT/bW5HABvZyQ07h7MqfU84GCNoikzkc13sbAG0i3Kfk KmHw== X-Gm-Message-State: APjAAAVvXMmCBae8YM/xQU9U5C04bATxlBlL5MF/JbuYUqJvvntSm1c5 oJrlgoTLpbUUbyKIAWMZflQyv+fMfI4ccaKnIEYstf4i X-Google-Smtp-Source: APXvYqy5kHeF2tH7PfSiu0+CQbxf3iwUhrZlOnsyKWOk0DkYkzinv3fTkw1DezpzQQf9Pe5OrICPjb9M4SNKutXVvwU= X-Received: by 2002:a02:a919:: with SMTP id n25mr12823321jam.140.1575663007896; Fri, 06 Dec 2019 12:10:07 -0800 (PST) MIME-Version: 1.0 References: <201912061255.xB6CtdJw011374@repo.freebsd.org> <7160a41739e5b251b50defb44ad08f3c722ea9c7.camel@freebsd.org> In-Reply-To: <7160a41739e5b251b50defb44ad08f3c722ea9c7.camel@freebsd.org> From: Luiz Otavio O Souza Date: Fri, 6 Dec 2019 17:09:56 -0300 Message-ID: Subject: Re: svn commit: r355444 - in head/sys: arm/mv arm64/conf conf To: Ian Lepore Cc: Luiz Otavio O Souza , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47V3bj1qt7z3LYw X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 20:10:09 -0000 On Fri, Dec 6, 2019 at 1:58 PM Ian Lepore wrote: > > On Fri, 2019-12-06 at 12:55 +0000, Luiz Otavio O Souza wrote: > > Author: loos > > Date: Fri Dec 6 12:55:39 2019 > > New Revision: 355444 > > URL: https://svnweb.freebsd.org/changeset/base/355444 > > > > Log: > > Add the SPI driver for the Marvell Armada 37x0 SoC. > > > > Interrupt based driver, implements SPI mode and clock configuration. > > > > Tested on espressobin and SG-3200. > > > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > > Added: > > head/sys/arm/mv/a37x0_spi.c (contents, props changed) > > Modified: > > head/sys/arm64/conf/GENERIC > > head/sys/conf/files.arm64 > > > > Added: head/sys/arm/mv/a37x0_spi.c > > > > > > +static int > > +a37x0_spi_detach(device_t dev) > > +{ > > + struct a37x0_spi_softc *sc; > > + > > + bus_generic_detach(dev); > > > > It's possible for detaching children to fail (like if one of them > returns EBUSY from its detach), in which case you should bail on your > detach and return the error status. Also, this needs a > device_destroy_children() here after detaching them, to remove the > spibus child added in attach (in case the module is unloaded then > reloaded, that avoids adding a second copy of the child). > Fixed in r355461. Thanks Ian. Luiz From owner-svn-src-all@freebsd.org Fri Dec 6 20:11:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D47581B4ECE; Fri, 6 Dec 2019 20:11:20 +0000 (UTC) (envelope-from loos.br@gmail.com) Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47V3d35t1Jz3Lks; Fri, 6 Dec 2019 20:11:19 +0000 (UTC) (envelope-from loos.br@gmail.com) Received: by mail-il1-x143.google.com with SMTP id g12so7332503ild.2; Fri, 06 Dec 2019 12:11:19 -0800 (PST) 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=VXve3nzAcoNpgupXqwjyxL+CU0I1qjB20e8cIzQK69A=; b=YdxDj+honBgDS0+t46/HMzA4OUxb3NFZjR2+KM4/TsFsyGqnpOzwKLjSnfqsrwvRUt b1CHEJIWQr43PoPQn2F4eXvbR50dE4uQCpkwZaJ9uwCc975uhyqkqPodbWaKcJl2l4kS +MoPZWi8NzNeM8hfW8cb76JBtv4MxYD2zKLdPx2LeN2XFAddpeOu6FfRrNB8dQziDp/Q otI/H8lpjs9HiCbBHvtxD+2526EangiECnI9gON+lXQ4u12dFKwNUerf65i6w5275wK9 FuKYfjmFXdR+i671D/AHh+9rhBDKA03VOpkt4jWe+KKqguY8aPNfS3gj7xy7YrOZ2WGB hBKQ== 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=VXve3nzAcoNpgupXqwjyxL+CU0I1qjB20e8cIzQK69A=; b=tYwRqBU62PodieubryTno9dE8A6RvdfkpWKEL1Knnh/7TS6YmpNJtWF687oOyuhABT Zac4MRppn4nrXLS4unis8uvxXensKwZnrvq1KCHSeJdq8gFUj/jJAN7/fEOHilg9YRpU 5WXKryxJh4wuEblyTHfB3Hm8QLYCtTJ6otxgTCpH8ReUl/HWzrIxa/XOMoTYTuC8GFfU 5j23+H8vz5vy4rxK3PcB2E0JWIianQixLz3ULlY0IeDvXUlH+A4QSoYtGRccBVo0ttqU uODZnDfDggIlKvUZLX+YwM9D8oJft8FRTtHlJhEdid0qColXG/M8ctbaFFtFl5BVSsBj Pt4g== X-Gm-Message-State: APjAAAVfuZK+myqWgdqD1zK+LlNRkOh4xyafGSeq2y9tt9oJBXxxwJHt Dvy+cwMxI05yq5j6iLJs9YNNx7YYKS/1370Q448= X-Google-Smtp-Source: APXvYqzknas3qtttRoFTDYm51QfMakE7T0pIvRiZtxzR5AEbp3C6pNQajXQA0kAFPK2MQqq3bcJ01j6qbuXo8R5v2sw= X-Received: by 2002:a92:601:: with SMTP id x1mr15071192ilg.35.1575663078802; Fri, 06 Dec 2019 12:11:18 -0800 (PST) MIME-Version: 1.0 References: <201912061255.xB6CtdJw011374@repo.freebsd.org> <02a39414-b122-7858-622f-cdd8e70ea963@selasky.org> In-Reply-To: <02a39414-b122-7858-622f-cdd8e70ea963@selasky.org> From: Luiz Otavio O Souza Date: Fri, 6 Dec 2019 17:11:07 -0300 Message-ID: Subject: Re: svn commit: r355444 - in head/sys: arm/mv arm64/conf conf To: Hans Petter Selasky Cc: Luiz Otavio O Souza , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 47V3d35t1Jz3Lks X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=YdxDj+ho; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of loosbr@gmail.com designates 2607:f8b0:4864:20::143 as permitted sender) smtp.mailfrom=loosbr@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (1.78), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[3.4.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 20:11:20 -0000 On Fri, Dec 6, 2019 at 12:57 PM Hans Petter Selasky wrote: > > On 2019-12-06 13:55, Luiz Otavio O Souza wrote: > > Author: loos > > Date: Fri Dec 6 12:55:39 2019 > > New Revision: 355444 > > URL: https://svnweb.freebsd.org/changeset/base/355444 > > > > Log: > > Add the SPI driver for the Marvell Armada 37x0 SoC. > > > > Interrupt based driver, implements SPI mode and clock configuration. > > > > Tested on espressobin and SG-3200. > > > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > > Added: > > This breaks aarch64. You need to add #include Fixed in r355461. Sorry for the breakage. Luiz From owner-svn-src-all@freebsd.org Fri Dec 6 20:17:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B76FD1B529C for ; Fri, 6 Dec 2019 20:17:41 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2m.ore.mailhop.org (outbound2m.ore.mailhop.org [54.149.155.156]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47V3mP1y0hz3MGc for ; Fri, 6 Dec 2019 20:17:41 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1575663459; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=s0Goqi/nldnGbBys+9zyEMx/z1tvHVESDsAxzQ966F+lUHiPdmi+75yWkhP89lymP5hmH93SZcWRc LbY8ZnHEciEBlsTTmvgk/8f6vcBcjaKSp75lYM/hO/S6rXQ2D9Kx2euawRpep44ilRj/qP6ymkvNFI irCuFG7Auxx00UCbUyHHDHjLp/3SW1Yf/Sf49+e4dTyFZc1JEql2d5Z6l18vQpIVxIslmUBQvAZW7c EewOF68RutCvS36YXgygePF61hOiSjaE32s7uW6rpUV5mwcbEJurQ2UUrzWLUCenK6xplUqC3cAKKL IrVAEofPszqqzTRRpA/AocZU3dJCSGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=cuux4Ly1OA7fVynSAp2COGJpFQQkBeajYlHWoet/GP0=; b=KHoe8zcubnVkmUrBbT1cTaJiiVvebdOnVjTDpbN3sEaRu9SRfBYITeE+x1MwJTBmOgN8OoZFhDIUY UYWpOx32q8RwOlRp+wFX2vHRtgKlxxYd7ANAg60oAjViOOB16LBh4x7IK48aoMVEO0IoBumNB7JYj9 JwsYSrG8d1mjmPl+1Ub/OJFRUD7hRVolnSSbXkhNDi0dnAI2mXzIA1MgELCkdtG56fv5ecXEqE+3hJ 8GXxsbLjJ1aY5mK5uYnNdCawPVj2NZV4af6a6l1HXvo6bncebQaiwMgM0fq7+wNt/uycQsXPuAz35/ fRP0fUMqZrAwV7GookQy5XQZJH6UL4Q== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=cuux4Ly1OA7fVynSAp2COGJpFQQkBeajYlHWoet/GP0=; b=jf0WlaCJDW7RMR+FVdN3YMFVITdPcltc1YJDm6nBfapEflSQi8Ez+kQ7sZn9Y8hDOb4hSlEkj6KfT Yolgxl2ck8ns+mJ0CSwCPPS1InPe0x//D+wegtnHjEO8Y4O97IpcxlYEZIsLnCxc3B3+j9YfkCfN1Z rl3LqnlnRtTN0HttbMRuTbYdWp/deftdcxw/uAnEo6m8ujIMvofyIh1UTtecPDOZVognS0Y8yAdDxz kQMWiPcsevlgPi5idSFNzLA41A65T977B8fGsfTozkYdXQnpJdJYzo1Dz0ig/1ti+5YTG0g30Y/NuV EaXstZdoD5djn9qKDLci51gexxu3YIg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 7187e685-1865-11ea-829e-79a40d15cccd X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 7187e685-1865-11ea-829e-79a40d15cccd; Fri, 06 Dec 2019 20:17:38 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id xB6KHaS6012391; Fri, 6 Dec 2019 13:17:36 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <4e4999fec53ec82f9cfa9a441be09b884cb77e4d.camel@freebsd.org> Subject: Re: svn commit: r355461 - head/sys/arm/mv From: Ian Lepore To: Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 06 Dec 2019 13:17:36 -0700 In-Reply-To: <201912062005.xB6K58OX065449@repo.freebsd.org> References: <201912062005.xB6K58OX065449@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47V3mP1y0hz3MGc X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.97 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.985,0]; ASN(0.00)[asn:16509, ipnet:54.148.0.0/15, country:US]; NEURAL_HAM_LONG(-0.98)[-0.980,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 20:17:41 -0000 On Fri, 2019-12-06 at 20:05 +0000, Luiz Otavio O Souza wrote: > Author: loos > Date: Fri Dec 6 20:05:08 2019 > New Revision: 355461 > URL: https://svnweb.freebsd.org/changeset/base/355461 > > Log: > Fix the ARM64 build, include the necessary header. > > While here, call device_delete_children() to detach and dealloc all > the > existent children and handle the child's detach errors properly. > > Reported by: jenkins, hselasky, ian > Sponsored by: Rubicon Communications, LLC (Netgate) > > Modified: > head/sys/arm/mv/a37x0_spi.c > > Modified: head/sys/arm/mv/a37x0_spi.c > ===================================================================== > ========= > --- head/sys/arm/mv/a37x0_spi.c Fri Dec 6 19:33:39 2019 (r355 > 460) > +++ head/sys/arm/mv/a37x0_spi.c Fri Dec 6 20:05:08 2019 (r355 > 461) > @@ -29,9 +29,9 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > - > #include > #include > +#include > #include > > #include > @@ -228,9 +228,11 @@ a37x0_spi_attach(device_t dev) > static int > a37x0_spi_detach(device_t dev) > { > + int err; > struct a37x0_spi_softc *sc; > > - bus_generic_detach(dev); > + if ((err = device_delete_children(dev)) != 0) > + return (err); > sc = device_get_softc(dev); > mtx_destroy(&sc->sc_mtx); > if (sc->sc_intrhand) Oops, not quite right; I should have been more explicit. Something more like this: if ((err = bus_generic_detach(dev)) != 0) return (err); device_delete_children(dev); The delete is basically cannot-fail (as long as they're not attached), but bus_generic_detach() can fail if the detach method of any child/grandchilden fails. Hrm. You know, now that I've just looked in the code for device_delete_children(), it appears it will call detach if necessary, so maybe your approach is fine. I've just never done it that way. If anyone knows a reason why one approach is better than the other, say so. Otherwise I guess we should call this good. -- Ian From owner-svn-src-all@freebsd.org Fri Dec 6 20:21:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCBE51B538C; Fri, 6 Dec 2019 20:21:08 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V3rN4wmrz3MRD; Fri, 6 Dec 2019 20:21:08 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C5436A25; Fri, 6 Dec 2019 20:21:08 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6KL8a1074792; Fri, 6 Dec 2019 20:21:08 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6KL86S074790; Fri, 6 Dec 2019 20:21:08 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201912062021.xB6KL86S074790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 6 Dec 2019 20:21:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355462 - in head/sys: conf dev/gpio X-SVN-Group: head X-SVN-Commit-Author: loos X-SVN-Commit-Paths: in head/sys: conf dev/gpio X-SVN-Commit-Revision: 355462 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 20:21:08 -0000 Author: loos Date: Fri Dec 6 20:21:07 2019 New Revision: 355462 URL: https://svnweb.freebsd.org/changeset/base/355462 Log: Add a GPIO based MDIO bit-banging bus driver. Uses two GPIO pins as MDC (clock) and MDIO (bidirectional I/O), relies on mii_bitbang. Tested on SG-3200 where the PHY for one of the ports is wired independently of the SoC MDIO bus. Sponsored by: Rubicon Communications, LLC (Netgate) Added: head/sys/dev/gpio/gpiomdio.c (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Dec 6 20:05:08 2019 (r355461) +++ head/sys/conf/files Fri Dec 6 20:21:07 2019 (r355462) @@ -1753,6 +1753,7 @@ dev/gpio/gpioc.c optional gpio \ dev/gpio/gpioiic.c optional gpioiic dev/gpio/gpioled.c optional gpioled !fdt dev/gpio/gpioled_fdt.c optional gpioled fdt +dev/gpio/gpiomdio.c optional gpiomdio mii_bitbang dev/gpio/gpiopower.c optional gpiopower fdt dev/gpio/gpioregulator.c optional gpioregulator fdt ext_resources dev/gpio/gpiospi.c optional gpiospi Added: head/sys/dev/gpio/gpiomdio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiomdio.c Fri Dec 6 20:21:07 2019 (r355462) @@ -0,0 +1,243 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "gpiobus_if.h" +#include "miibus_if.h" + +#define GPIOMDIO_MDC_DFLT 0 +#define GPIOMDIO_MDIO_DFLT 1 +#define GPIOMDIO_MIN_PINS 2 + +#define MDO_BIT 0x01 +#define MDI_BIT 0x02 +#define MDC_BIT 0x04 +#define MDIRPHY_BIT 0x08 +#define MDIRHOST_BIT 0x10 +#define MDO sc->miibb_ops.mbo_bits[MII_BIT_MDO] +#define MDI sc->miibb_ops.mbo_bits[MII_BIT_MDI] +#define MDC sc->miibb_ops.mbo_bits[MII_BIT_MDC] +#define MDIRPHY sc->miibb_ops.mbo_bits[MII_BIT_DIR_HOST_PHY] +#define MDIRHOST sc->miibb_ops.mbo_bits[MII_BIT_DIR_PHY_HOST] + +static uint32_t gpiomdio_bb_read(device_t); +static void gpiomdio_bb_write(device_t, uint32_t); + +struct gpiomdio_softc +{ + device_t sc_dev; + device_t sc_busdev; + int mdc_pin; + int mdio_pin; + struct mii_bitbang_ops miibb_ops; +}; + + +static int +gpiomdio_probe(device_t dev) +{ + struct gpiobus_ivar *devi; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (!ofw_bus_is_compatible(dev, "freebsd,gpiomdio")) + return (ENXIO); + devi = GPIOBUS_IVAR(dev); + if (devi->npins < GPIOMDIO_MIN_PINS) { + device_printf(dev, + "gpiomdio needs at least %d GPIO pins (only %d given).\n", + GPIOMDIO_MIN_PINS, devi->npins); + return (ENXIO); + } + device_set_desc(dev, "GPIO MDIO bit-banging Bus driver"); + + return (BUS_PROBE_DEFAULT); +} + +static int +gpiomdio_attach(device_t dev) +{ + phandle_t node; + pcell_t pin; + struct gpiobus_ivar *devi; + struct gpiomdio_softc *sc; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_busdev = device_get_parent(dev); + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + if (OF_getencprop(node, "mdc", &pin, sizeof(pin)) > 0) + sc->mdc_pin = (int)pin; + if (OF_getencprop(node, "mdio", &pin, sizeof(pin)) > 0) + sc->mdio_pin = (int)pin; + + if (sc->mdc_pin < 0 || sc->mdc_pin > 1) + sc->mdc_pin = GPIOMDIO_MDC_DFLT; + if (sc->mdio_pin < 0 || sc->mdio_pin > 1) + sc->mdio_pin = GPIOMDIO_MDIO_DFLT; + + devi = GPIOBUS_IVAR(dev); + device_printf(dev, "MDC pin: %d, MDIO pin: %d\n", + devi->pins[sc->mdc_pin], devi->pins[sc->mdio_pin]); + + /* Initialize mii_bitbang_ops. */ + MDO = MDO_BIT; + MDI = MDI_BIT; + MDC = MDC_BIT; + MDIRPHY = MDIRPHY_BIT; + MDIRHOST = MDIRHOST_BIT; + sc->miibb_ops.mbo_read = gpiomdio_bb_read; + sc->miibb_ops.mbo_write = gpiomdio_bb_write; + + /* Register our MDIO Bus device. */ + OF_device_register_xref(OF_xref_from_node(node), dev); + + return (0); +} + +static uint32_t +gpiomdio_bb_read(device_t dev) +{ + struct gpiomdio_softc *sc; + unsigned int val; + + sc = device_get_softc(dev); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->mdio_pin, &val); + + return (val != 0 ? MDI_BIT : 0); +} + +static void +gpiomdio_bb_write(device_t dev, uint32_t val) +{ + struct gpiomdio_softc *sc; + + sc = device_get_softc(dev); + + /* Set the data pin state. */ + if ((val & (MDIRPHY_BIT | MDO_BIT)) == (MDIRPHY_BIT | MDO_BIT)) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->mdio_pin, 1); + else if ((val & (MDIRPHY_BIT | MDO_BIT)) == MDIRPHY_BIT) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->mdio_pin, 0); + if (val & MDIRPHY_BIT) + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->mdio_pin, + GPIO_PIN_OUTPUT); + else if (val & MDIRHOST_BIT) + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->mdio_pin, + GPIO_PIN_INPUT); + + /* And now the clock state. */ + if (val & MDC_BIT) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->mdc_pin, 1); + else + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->mdc_pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->mdc_pin, + GPIO_PIN_OUTPUT); +} + +static int +gpiomdio_readreg(device_t dev, int phy, int reg) +{ + struct gpiomdio_softc *sc; + + sc = device_get_softc(dev); + + return (mii_bitbang_readreg(dev, &sc->miibb_ops, phy, reg)); +} + +static int +gpiomdio_writereg(device_t dev, int phy, int reg, int val) +{ + struct gpiomdio_softc *sc; + + sc = device_get_softc(dev); + mii_bitbang_writereg(dev, &sc->miibb_ops, phy, reg, val); + + return (0); +} + +static phandle_t +gpiomdio_get_node(device_t bus, device_t dev) +{ + + return (ofw_bus_get_node(bus)); +} + +static devclass_t gpiomdio_devclass; + +static device_method_t gpiomdio_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, gpiomdio_probe), + DEVMETHOD(device_attach, gpiomdio_attach), + DEVMETHOD(device_detach, bus_generic_detach), + + /* MDIO interface */ + DEVMETHOD(miibus_readreg, gpiomdio_readreg), + DEVMETHOD(miibus_writereg, gpiomdio_writereg), + + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_node, gpiomdio_get_node), + + DEVMETHOD_END +}; + +static driver_t gpiomdio_driver = { + "gpiomdio", + gpiomdio_methods, + sizeof(struct gpiomdio_softc), +}; + +EARLY_DRIVER_MODULE(gpiomdio, gpiobus, gpiomdio_driver, gpiomdio_devclass, + 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); +DRIVER_MODULE(miibus, gpiomdio, miibus_driver, miibus_devclass, 0, 0); +MODULE_DEPEND(gpiomdio, gpiobus, 1, 1, 1); +MODULE_DEPEND(gpiomdio, miibus, 1, 1, 1); +MODULE_DEPEND(gpiomdio, mii_bitbang, 1, 1, 1); From owner-svn-src-all@freebsd.org Fri Dec 6 20:21:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DEF061B55CC for ; Fri, 6 Dec 2019 20:21:37 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) 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 47V3rx14Hjz3MbC for ; Fri, 6 Dec 2019 20:21:36 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72f.google.com with SMTP id i18so7533395qkl.11 for ; Fri, 06 Dec 2019 12:21:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=H6o7LB6plxnzAII3A9Ta78o0q1IwvApczhpxMDRJQrc=; b=iO7dgyEWgTNfQBCR4stmrnq92FX23/xVF6a5qc5GRozMoN7/4WFJZWsoo8rF19iI2t 5SzGblCoY66RD/ENm8WRYrL1CP1rn+TFgvUtXMq+EjMDnT2ZLptU2XGG1h3ADnTeWc3o be0cRRLTUMXFWWtrMbSCyn2QIOuGz7iOXO3jxGjREn73Ht7b6dKSMr+IBwUlOnnTW2Mh vxXAT5US48F+qlcMBOmrh3ihmtByPwTaUmMfR63QCrC2BCQ5lRzVwDmzkSjHy/YUrMnX ry2BXa0Pg2AtiBNq+N8Z3GXxCSImYsm9TCTqp/cUDnGTbwQa5EOCQioZhur7vTIHrAvI coXA== 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=H6o7LB6plxnzAII3A9Ta78o0q1IwvApczhpxMDRJQrc=; b=tVr0HqO+udLGLPxG8BjCU4PTxQEfVtJ70eHXo/q9sLiMkfqhQ9s7u34dKBSeqeV8+i g52M0pPUzu+blrLFNADVH/dEqsLBbBlUrtGhWrovurcnehW8wnuk0axTf/BmDLeDYnG1 E4bNQ6+ULB4wOuLVMd0jSxRh5gqdSy3axXo6f+ky3Wt+J8lXi+rJIIPv7WJjQRjf5tJO hyghhD8cIEn203FvNmfEuoQ1OKjVuVabj+wx7Dg7nU40EaMx49UzEPlFrtdsKkyfaLdy 3TcKKbzG/5aQnU2o9kyhT+qB4ZapMwQTt85/aqfK0hSQRGjuKG0iKzOia5U6eQAePxge JVGQ== X-Gm-Message-State: APjAAAXjdQZpP040tYgaNg9Bk5LCUdK7i58hDG8XR8uvbRA+4wFSVULH LGOPVZKqgWTMuYFEwE0TXf6tS3PZ2B9K94aEir8eiw== X-Google-Smtp-Source: APXvYqwW3hVtuMWII9Lh2KsrjicqtSHRKQltb5/be43/N5MJ2fT4UA5E6rMFwkiKRB+fEnWyCTfjUqEl472X2Dq/agc= X-Received: by 2002:a37:b0c5:: with SMTP id z188mr9465527qke.215.1575663695120; Fri, 06 Dec 2019 12:21:35 -0800 (PST) MIME-Version: 1.0 References: <201912062005.xB6K58OX065449@repo.freebsd.org> <4e4999fec53ec82f9cfa9a441be09b884cb77e4d.camel@freebsd.org> In-Reply-To: <4e4999fec53ec82f9cfa9a441be09b884cb77e4d.camel@freebsd.org> From: Warner Losh Date: Fri, 6 Dec 2019 13:21:24 -0700 Message-ID: Subject: Re: svn commit: r355461 - head/sys/arm/mv To: Ian Lepore Cc: Luiz Otavio O Souza , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 47V3rx14Hjz3MbC X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=iO7dgyEW; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::72f) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.72 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[f.2.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.72)[ip: (-9.38), ipnet: 2607:f8b0::/32(-2.23), asn: 15169(-1.93), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 20:21:37 -0000 On Fri, Dec 6, 2019 at 1:17 PM Ian Lepore wrote: > On Fri, 2019-12-06 at 20:05 +0000, Luiz Otavio O Souza wrote: > > Author: loos > > Date: Fri Dec 6 20:05:08 2019 > > New Revision: 355461 > > URL: https://svnweb.freebsd.org/changeset/base/355461 > > > > Log: > > Fix the ARM64 build, include the necessary header. > > > > While here, call device_delete_children() to detach and dealloc all > > the > > existent children and handle the child's detach errors properly. > > > > Reported by: jenkins, hselasky, ian > > Sponsored by: Rubicon Communications, LLC (Netgate) > > > > Modified: > > head/sys/arm/mv/a37x0_spi.c > > > > Modified: head/sys/arm/mv/a37x0_spi.c > > ===================================================================== > > ========= > > --- head/sys/arm/mv/a37x0_spi.c Fri Dec 6 19:33:39 2019 > (r355 > > 460) > > +++ head/sys/arm/mv/a37x0_spi.c Fri Dec 6 20:05:08 2019 > (r355 > > 461) > > @@ -29,9 +29,9 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > - > > #include > > #include > > +#include > > #include > > > > #include > > @@ -228,9 +228,11 @@ a37x0_spi_attach(device_t dev) > > static int > > a37x0_spi_detach(device_t dev) > > { > > + int err; > > struct a37x0_spi_softc *sc; > > > > - bus_generic_detach(dev); > > + if ((err = device_delete_children(dev)) != 0) > > + return (err); > > sc = device_get_softc(dev); > > mtx_destroy(&sc->sc_mtx); > > if (sc->sc_intrhand) > > Oops, not quite right; I should have been more explicit. Something > more like this: > > if ((err = bus_generic_detach(dev)) != 0) > return (err); > device_delete_children(dev); > > The delete is basically cannot-fail (as long as they're not attached), > but bus_generic_detach() can fail if the detach method of any > child/grandchilden fails. > > Hrm. You know, now that I've just looked in the code for > device_delete_children(), it appears it will call detach if necessary, > so maybe your approach is fine. I've just never done it that way. If > anyone knows a reason why one approach is better than the other, say > so. Otherwise I guess we should call this good. > Once upon a time, delete_children would fail if anything was attached (well, before that was there were for loops everywhere that did this thing). Now it calls detach so we can move that common code into one routine. You see a mix in the tree because not all uses were updated when functionality increased. I'd prefer the approach that Luiz did, honestly. Warner From owner-svn-src-all@freebsd.org Fri Dec 6 21:14:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CD081B68EA; Fri, 6 Dec 2019 21:14:35 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47V5221gqCz3QGX; Fri, 6 Dec 2019 21:14:33 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0B97E229E0; Fri, 6 Dec 2019 16:14:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 06 Dec 2019 16:14:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=n RHKFkwYcEBiyTnLwqiLLeykLSV9JzX4WUGkBpOfdEk=; b=Fjr8jxrjxIPD6Q8TL icvxRYjCstaAJ9S66v1s9WH0uTUD7oGe64h7DBisU2C3LD7ly8+PwPG8d1hBYw4h V5V+pu+D0MmXZoOzpqaVExIfqq1oNyQmTPc844nECZ6TJVtET0qz/IozoWabJRAf Zngh+XVhlA4/OiI9kZk5wUUikirChWwW3/BPVAQAW6um/REk1NYKRxmAMfJHO0h2 OOfQLIlVWHUluiuGAx892CXS6R32C9WVrc3u8BxkO3FnJ5kSxCrNlcJUbaeaJ9zQ Fc8/yIAG+IGOTZwF+Fg+X4IuCCG0k0xWgsv6CKQNl2eJs3dEdT8SPCIqOSgwXWH5 X1Y2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=nRHKFkwYcEBiyTnLwqiLLeykLSV9JzX4WUGkBpOfd Ek=; b=yBxiQU8PBklSn4CKsUSc4bWjxzp8VyE65fzu5Wuiy+xCey1uHByEDlbge AgU1l94JrnSgQWdQrSq3y1CWCCWuee3GNh/Kstu3bXIf5g7xhdYdGlthQHhSqg8k yZCfeuNF6usDZpvjWAitY6EiMERS39fCgCGdPQFAPQOOSXweIGPOfbRlB47K6og5 pfSezXHwqxN++lz/QIqtUelbN5is6JTT2BXH4NTpNFZpONETH3YPjO6mZZ96cdRF eI595Daip5ur1F0EAI0/q5BGPBt8pc/rDm5UzVNXadoZzWSIAIrR/6Nd8ztM5RuN Dfd/TaeGlVIRq6aylqe2mBvFmBL2A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudekfedgudegudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpegtggfuhfgjfffgkfhfvffosehtqhhmtdhhtdejnecuhfhrohhmpefutgho thhtucfnohhnghcuoehstghothhtlhesshgrmhhstghordhorhhgqeenucffohhmrghinh epfhhrvggvsghsugdrohhrghenucfkphepjeehrddutdegrdeikedruddufeenucfrrghr rghmpehmrghilhhfrhhomhepshgtohhtthhlsehsrghmshgtohdrohhrghenucevlhhush htvghrufhiiigvpedt X-ME-Proxy: Received: from [172.27.7.51] (unknown [75.104.68.113]) by mail.messagingengine.com (Postfix) with ESMTPA id 71D8430600AA; Fri, 6 Dec 2019 16:14:26 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3601.0.10\)) Subject: Re: svn commit: r355436 - in head/sys: amd64/amd64 x86/x86 From: Scott Long In-Reply-To: Date: Fri, 6 Dec 2019 13:14:21 -0800 Cc: Ed Maste , Scott Long , src-committers , svn-src-all , svn-src-head Content-Transfer-Encoding: quoted-printable Message-Id: <14B1D2C7-E7A4-45B5-BC98-DE263304ACD3@samsco.org> References: <201912060243.xB62h5So053092@repo.freebsd.org> To: Eric van Gyzen X-Mailer: Apple Mail (2.3601.0.10) X-Rspamd-Queue-Id: 47V5221gqCz3QGX X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=samsco.org header.s=fm2 header.b=Fjr8jxrj; dkim=pass header.d=messagingengine.com header.s=fm1 header.b=yBxiQU8P; dmarc=none; spf=pass (mx1.freebsd.org: domain of scottl@samsco.org designates 66.111.4.27 as permitted sender) smtp.mailfrom=scottl@samsco.org X-Spamd-Result: default: False [-5.59 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[samsco.org:s=fm2,messagingengine.com:s=fm1]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.27]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[samsco.org]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[samsco.org:+,messagingengine.com:+]; IP_SCORE(-3.49)[ip: (-9.83), ipnet: 66.111.4.0/24(-4.87), asn: 11403(-2.68), country: US(-0.05)]; RCVD_IN_DNSWL_LOW(-0.10)[27.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[113.68.104.75.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 21:14:35 -0000 I=E2=80=99m not opposed to the idea, but making any change invites a = bike shed on naming, and making no change at all invites a bike shed on naming, and honestly the name doesn=E2=80=99t matter to me at this point. I = encourage you and Ed to own this. Scott > On Dec 6, 2019, at 6:58 AM, Eric van Gyzen wrote: >=20 >=20 >=20 >> On Dec 6, 2019, at 4:36 AM, Ed Maste wrote: >>=20 >> On Thu, 5 Dec 2019 at 21:43, Scott Long wrote: >>>=20 >>> Author: scottl >>> Date: Fri Dec 6 02:43:05 2019 >>> New Revision: 355436 >>> URL: https://svnweb.freebsd.org/changeset/base/355436 >>>=20 >>> Log: >>> Move the mds, irbs, and ssb mitigation knobs into = machdep.mitigations. >>=20 >> If we're moving them and adding backwards-compatibility scaffolding = we >> really should correct the sense of the sysctls at the same time. >=20 > I was just going to suggest that. For some, 0 is secure; for others, = 1 is secure. Since they=E2=80=99re under =E2=80=9Cmitigations,=E2=80=9D = I think 1 should consistently mean =E2=80=9Cmitigated.=E2=80=9D >=20 > Eric From owner-svn-src-all@freebsd.org Fri Dec 6 21:20:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 109541B6B98; Fri, 6 Dec 2019 21:20:33 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V58w6mM9z3QRW; Fri, 6 Dec 2019 21:20:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC2BE74D1; Fri, 6 Dec 2019 21:20:32 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6LKWAS007460; Fri, 6 Dec 2019 21:20:32 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6LKWbN007459; Fri, 6 Dec 2019 21:20:32 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201912062120.xB6LKWbN007459@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 6 Dec 2019 21: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: r355463 - stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/release/doc/en_US.ISO8859-1/errata X-SVN-Commit-Revision: 355463 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 21:20:33 -0000 Author: gjb Date: Fri Dec 6 21:20:32 2019 New Revision: 355463 URL: https://svnweb.freebsd.org/changeset/base/355463 Log: Document the 11.3-RELEASE images in GCE do not work, and provide information regarding alternative solutions. PR: 242303 (related) Sponsored by: Rubicon Communications, LLC (netgate.com) Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/errata/article.xml ============================================================================== --- stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Dec 6 20:21:07 2019 (r355462) +++ stable/11/release/doc/en_US.ISO8859-1/errata/article.xml Fri Dec 6 21:20:32 2019 (r355463) @@ -135,6 +135,30 @@ Late-Breaking News - No news. + + + [2019-12-06] An issue has been reported with the + &os; 11.3-RELEASE images on the Google Compute Engine + platform which causes virtual machines to fail to start + properly. + + While we intend to investigate how to handle similar + situations should they arise in the future, updated images + will not be provided as of this time. + + Users wanting to use &os; in Google Compute Engine are + advised to use 12.0-RELEASE or 12.1-RELEASE, or for those + who wish to track 11.X, the + freebsd-11-3-stable-amd64-v20190801 + snapshot from stable/11 has been + + reported to work correctly. + + More details can be found in PR + 242303. + + From owner-svn-src-all@freebsd.org Fri Dec 6 21:50:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE9C01B7E39; Fri, 6 Dec 2019 21:50:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V5qP4bSxz3xFQ; Fri, 6 Dec 2019 21:50:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C9887A78; Fri, 6 Dec 2019 21:50:25 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6LoPAD024736; Fri, 6 Dec 2019 21:50:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6LoOf1024732; Fri, 6 Dec 2019 21:50:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201912062150.xB6LoOf1024732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 6 Dec 2019 21:50:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355464 - head/sys/dev/aacraid X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/aacraid X-SVN-Commit-Revision: 355464 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 21:50:25 -0000 Author: imp Date: Fri Dec 6 21:50:24 2019 New Revision: 355464 URL: https://svnweb.freebsd.org/changeset/base/355464 Log: Remove ifdefs for FreeBSD 6, 7, 8 and 9. Assume we're past that. Differential Revision: https://reviews.freebsd.org/D22539 Modified: head/sys/dev/aacraid/aacraid.c head/sys/dev/aacraid/aacraid_cam.c head/sys/dev/aacraid/aacraid_linux.c head/sys/dev/aacraid/aacraid_var.h Modified: head/sys/dev/aacraid/aacraid.c ============================================================================== --- head/sys/dev/aacraid/aacraid.c Fri Dec 6 21:20:32 2019 (r355463) +++ head/sys/dev/aacraid/aacraid.c Fri Dec 6 21:50:24 2019 (r355464) @@ -188,11 +188,7 @@ static char *aac_describe_code(struct aac_code_lookup static d_open_t aac_open; static d_ioctl_t aac_ioctl; static d_poll_t aac_poll; -#if __FreeBSD_version >= 702000 static void aac_cdevpriv_dtor(void *arg); -#else -static d_close_t aac_close; -#endif static int aac_ioctl_sendfib(struct aac_softc *sc, caddr_t ufib); static int aac_ioctl_send_raw_srb(struct aac_softc *sc, caddr_t arg); static void aac_handle_aif(struct aac_softc *sc, struct aac_fib *fib); @@ -220,9 +216,6 @@ static struct cdevsw aacraid_cdevsw = { .d_version = D_VERSION, .d_flags = 0, .d_open = aac_open, -#if __FreeBSD_version < 702000 - .d_close = aac_close, -#endif .d_ioctl = aac_ioctl, .d_poll = aac_poll, .d_name = "aacraid", @@ -275,10 +268,9 @@ aacraid_attach(struct aac_softc *sc) TAILQ_INIT(&sc->aac_container_tqh); TAILQ_INIT(&sc->aac_ev_cmfree); -#if __FreeBSD_version >= 800000 /* Initialize the clock daemon callout. */ callout_init_mtx(&sc->aac_daemontime, &sc->aac_io_lock, 0); -#endif + /* * Initialize the adapter. */ @@ -351,18 +343,9 @@ aacraid_attach(struct aac_softc *sc) /* enable interrupts now */ AAC_ACCESS_DEVREG(sc, AAC_ENABLE_INTERRUPT); -#if __FreeBSD_version >= 800000 mtx_lock(&sc->aac_io_lock); callout_reset(&sc->aac_daemontime, 60 * hz, aac_daemon, sc); mtx_unlock(&sc->aac_io_lock); -#else - { - struct timeval tv; - tv.tv_sec = 60; - tv.tv_usec = 0; - sc->timeout_id = timeout(aac_daemon, (void *)sc, tvtohz(&tv)); - } -#endif return(0); } @@ -378,14 +361,10 @@ aac_daemon(void *arg) sc = arg; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); -#if __FreeBSD_version >= 800000 mtx_assert(&sc->aac_io_lock, MA_OWNED); if (callout_pending(&sc->aac_daemontime) || callout_active(&sc->aac_daemontime) == 0) return; -#else - mtx_lock(&sc->aac_io_lock); -#endif getmicrotime(&tv); if (!aacraid_alloc_command(sc, &cm)) { @@ -412,14 +391,7 @@ aac_daemon(void *arg) aacraid_release_command(cm); } -#if __FreeBSD_version >= 800000 callout_schedule(&sc->aac_daemontime, 30 * 60 * hz); -#else - mtx_unlock(&sc->aac_io_lock); - tv.tv_sec = 30 * 60; - tv.tv_usec = 0; - sc->timeout_id = timeout(aac_daemon, (void *)sc, tvtohz(&tv)); -#endif } void @@ -762,11 +734,7 @@ aacraid_detach(device_t dev) sc = device_get_softc(dev); fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); -#if __FreeBSD_version >= 800000 callout_drain(&sc->aac_daemontime); -#else - untimeout(aac_daemon, (void *)sc, sc->timeout_id); -#endif /* Remove the child containers */ while ((co = TAILQ_FIRST(&sc->aac_container_tqh)) != NULL) { TAILQ_REMOVE(&sc->aac_container_tqh, co, co_link); @@ -2591,10 +2559,8 @@ aac_open(struct cdev *dev, int flags, int fmt, struct sc = dev->si_drv1; fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); -#if __FreeBSD_version >= 702000 device_busy(sc->aac_dev); devfs_set_cdevpriv(sc, aac_cdevpriv_dtor); -#endif return 0; } @@ -3077,7 +3043,6 @@ aac_request_aif(struct aac_softc *sc) } -#if __FreeBSD_version >= 702000 /* * cdevpriv interface private destructor. */ @@ -3090,17 +3055,6 @@ aac_cdevpriv_dtor(void *arg) fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); device_unbusy(sc->aac_dev); } -#else -static int -aac_close(struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct aac_softc *sc; - - sc = dev->si_drv1; - fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, ""); - return 0; -} -#endif /* * Handle an AIF sent to us by the controller; queue it for later reference. Modified: head/sys/dev/aacraid/aacraid_cam.c ============================================================================== --- head/sys/dev/aacraid/aacraid_cam.c Fri Dec 6 21:20:32 2019 (r355463) +++ head/sys/dev/aacraid/aacraid_cam.c Fri Dec 6 21:50:24 2019 (r355464) @@ -49,9 +49,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if __FreeBSD_version < 801000 -#include -#endif #include #include #include @@ -73,11 +70,9 @@ __FBSDID("$FreeBSD$"); #include #include -#if __FreeBSD_version >= 700025 #ifndef CAM_NEW_TRAN_CODE #define CAM_NEW_TRAN_CODE 1 #endif -#endif #ifndef SVPD_SUPPORTED_PAGE_LIST struct scsi_vpd_supported_page_list @@ -93,11 +88,7 @@ struct scsi_vpd_supported_page_list #endif /************************** Version Compatibility *************************/ -#if __FreeBSD_version < 700031 -#define aac_sim_alloc(a,b,c,d,e,f,g,h,i) cam_sim_alloc(a,b,c,d,e,g,h,i) -#else #define aac_sim_alloc cam_sim_alloc -#endif struct aac_cam { device_t dev; @@ -113,10 +104,8 @@ static void aac_cam_action(struct cam_sim *, union ccb static void aac_cam_poll(struct cam_sim *); static void aac_cam_complete(struct aac_command *); static void aac_container_complete(struct aac_command *); -#if __FreeBSD_version >= 700000 static void aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id); -#endif static void aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status, u_int8_t key, u_int8_t asc, u_int8_t ascq); static int aac_load_map_command_sg(struct aac_softc *, struct aac_command *); @@ -154,12 +143,8 @@ static void aac_set_scsi_error(struct aac_softc *sc, union ccb *ccb, u_int8_t status, u_int8_t key, u_int8_t asc, u_int8_t ascq) { -#if __FreeBSD_version >= 900000 struct scsi_sense_data_fixed *sense = (struct scsi_sense_data_fixed *)&ccb->csio.sense_data; -#else - struct scsi_sense_data *sense = &ccb->csio.sense_data; -#endif fwprintf(sc, HBA_FLAGS_DBG_FUNCTION_ENTRY_B, "Error %d!", status); @@ -179,7 +164,6 @@ aac_set_scsi_error(struct aac_softc *sc, union ccb *cc } } -#if __FreeBSD_version >= 700000 static void aac_cam_rescan(struct aac_softc *sc, uint32_t channel, uint32_t target_id) { @@ -215,7 +199,6 @@ aac_cam_rescan(struct aac_softc *sc, uint32_t channel, break; } } -#endif static void aac_cam_event(struct aac_softc *sc, struct aac_event *event, void *arg) @@ -327,9 +310,7 @@ aac_cam_attach(device_t dev) return (EIO); } -#if __FreeBSD_version >= 700000 inf->aac_sc->cam_rescan_cb = aac_cam_rescan; -#endif mtx_unlock(&inf->aac_sc->aac_io_lock); camsc->sim = sim; @@ -1021,9 +1002,7 @@ aac_cam_action(struct cam_sim *sim, union ccb *ccb) cpi->max_lun = 7; /* Per the controller spec */ cpi->initiator_id = camsc->inf->InitiatorBusId; cpi->bus_id = camsc->inf->BusNumber; -#if __FreeBSD_version >= 800000 cpi->maxio = sc->aac_max_sectors << 9; -#endif /* * Resetting via the passthrough or parallel bus scan Modified: head/sys/dev/aacraid/aacraid_linux.c ============================================================================== --- head/sys/dev/aacraid/aacraid_linux.c Fri Dec 6 21:20:32 2019 (r355463) +++ head/sys/dev/aacraid/aacraid_linux.c Fri Dec 6 21:50:24 2019 (r355464) @@ -36,9 +36,7 @@ __FBSDID("$FreeBSD$"); */ #include -#if __FreeBSD_version >= 900000 #include -#endif #include #include #include @@ -82,16 +80,12 @@ static int aacraid_linux_ioctl(struct thread *td, struct linux_ioctl_args *args) { struct file *fp; -#if __FreeBSD_version >= 900000 cap_rights_t rights; -#endif u_long cmd; int error; if ((error = fget(td, args->fd, -#if __FreeBSD_version >= 900000 cap_rights_init(&rights, CAP_IOCTL), -#endif &fp)) != 0) { return (error); } Modified: head/sys/dev/aacraid/aacraid_var.h ============================================================================== --- head/sys/dev/aacraid/aacraid_var.h Fri Dec 6 21:20:32 2019 (r355463) +++ head/sys/dev/aacraid/aacraid_var.h Fri Dec 6 21:50:24 2019 (r355464) @@ -33,9 +33,7 @@ */ #include -#if __FreeBSD_version >= 800000 #include -#endif #include #include #include @@ -56,38 +54,17 @@ # define AAC_DRIVER_BUILD 1 #endif -#if __FreeBSD_version <= 601000 -#define bus_get_dma_tag(x) NULL -#endif - /* **************************** NewBUS interrupt Crock ************************/ -#if __FreeBSD_version < 700031 -#define aac_bus_setup_intr(d, i, f, U, if, ifa, hp) \ - bus_setup_intr(d, i, f, if, ifa, hp) -#else #define aac_bus_setup_intr bus_setup_intr -#endif /* **************************** NewBUS CAM Support ****************************/ -#if __FreeBSD_version < 700049 -#define aac_xpt_bus_register(sim, parent, bus) \ - xpt_bus_register(sim, bus) -#else #define aac_xpt_bus_register xpt_bus_register -#endif /**************************** Kernel Thread Support ***************************/ -#if __FreeBSD_version > 800001 #define aac_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ kproc_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) #define aac_kthread_exit(status) \ kproc_exit(status) -#else -#define aac_kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) \ - kthread_create(func, farg, proc_ptr, flags, stackpgs, fmtstr, arg) -#define aac_kthread_exit(status) \ - kthread_exit(status) -#endif /* * Driver Parameter Definitions @@ -362,11 +339,7 @@ struct aac_softc void *aac_intr[AAC_MAX_MSIX]; /* interrupt handle */ struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */ eventhandler_tag eh; -#if __FreeBSD_version >= 800000 struct callout aac_daemontime; /* clock daemon callout */ -#else - struct callout_handle timeout_id; /* timeout handle */ -#endif /* controller features, limits and status */ int aac_state; From owner-svn-src-all@freebsd.org Fri Dec 6 22:09:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4E751B8455; Fri, 6 Dec 2019 22:09:34 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V6FV34zSz3y2Z; Fri, 6 Dec 2019 22:09:34 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id xB6M9PZa046459 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 6 Dec 2019 14:09:25 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id xB6M9P6K046458; Fri, 6 Dec 2019 14:09:25 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Fri, 6 Dec 2019 14:09:25 -0800 From: Gleb Smirnoff To: "Bjoern A. Zeeb" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355449 - head/sys/netinet Message-ID: <20191206220925.GJ2706@FreeBSD.org> References: <201912061635.xB6GZmpS042391@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201912061635.xB6GZmpS042391@repo.freebsd.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 47V6FV34zSz3y2Z X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 22:09:34 -0000 Hi, there is a functional change here: On Fri, Dec 06, 2019 at 04:35:48PM +0000, Bjoern A. Zeeb wrote: B> URL: https://svnweb.freebsd.org/changeset/base/355449 B> B> Log: B> carp: replace caddr_t with char * B> B> Change the remaining caddr_t usages to char * following the removal B> of the KAME macros B> B> No functional change. ... B> @@ -978,6 +978,7 @@ carp_send_ad_locked(struct carp_softc *sc) B> #endif /* INET */ B> #ifdef INET6 B> if (sc->sc_naddrs6) { B> + struct epoch_tracker et; B> struct ip6_hdr *ip6; B> B> m = m_gethdr(M_NOWAIT, MT_DATA); B> @@ -1031,8 +1032,10 @@ carp_send_ad_locked(struct carp_softc *sc) B> B> CARPSTATS_INC(carps_opackets6); B> B> + NET_EPOCH_ENTER(et); B> carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0, B> &sc->sc_carpdev->if_carp->cif_im6o, NULL, NULL)); B> + NET_EPOCH_EXIT(et); B> } B> #endif /* INET6 */ This could be correct change, just needs some explanation. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Fri Dec 6 22:12:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 627EB1B8760; Fri, 6 Dec 2019 22:12:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V6K41zwjz3yQB; Fri, 6 Dec 2019 22:12:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27730800E; Fri, 6 Dec 2019 22:12:40 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6MCe2k041747; Fri, 6 Dec 2019 22:12:40 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6MCedu041746; Fri, 6 Dec 2019 22:12:40 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201912062212.xB6MCedu041746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 6 Dec 2019 22:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355465 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 355465 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 22:12:40 -0000 Author: imp Date: Fri Dec 6 22:12:39 2019 New Revision: 355465 URL: https://svnweb.freebsd.org/changeset/base/355465 Log: trackers always know what qpair they are on Don't needlessly pass around qpair pointers when the tracker knows what qpair it's on. This will simplify code and make it easier to split submission and completion queues in the future. Signed-off-by: John Meneghini Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Fri Dec 6 21:50:24 2019 (r355464) +++ head/sys/dev/nvme/nvme_qpair.c Fri Dec 6 22:12:39 2019 (r355465) @@ -418,9 +418,10 @@ nvme_completion_is_retry(const struct nvme_completion } static void -nvme_qpair_complete_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr, +nvme_qpair_complete_tracker(struct nvme_tracker *tr, struct nvme_completion *cpl, error_print_t print_on_error) { + struct nvme_qpair * qpair = tr->qpair; struct nvme_request *req; boolean_t retry, error, retriable; @@ -484,19 +485,22 @@ nvme_qpair_complete_tracker(struct nvme_qpair *qpair, } static void -nvme_qpair_manual_complete_tracker(struct nvme_qpair *qpair, +nvme_qpair_manual_complete_tracker( struct nvme_tracker *tr, uint32_t sct, uint32_t sc, uint32_t dnr, error_print_t print_on_error) { struct nvme_completion cpl; memset(&cpl, 0, sizeof(cpl)); + + struct nvme_qpair * qpair = tr->qpair; + cpl.sqid = qpair->id; cpl.cid = tr->cid; cpl.status |= (sct & NVME_STATUS_SCT_MASK) << NVME_STATUS_SCT_SHIFT; cpl.status |= (sc & NVME_STATUS_SC_MASK) << NVME_STATUS_SC_SHIFT; cpl.status |= (dnr & NVME_STATUS_DNR_MASK) << NVME_STATUS_DNR_SHIFT; - nvme_qpair_complete_tracker(qpair, tr, &cpl, print_on_error); + nvme_qpair_complete_tracker(tr, &cpl, print_on_error); } void @@ -589,7 +593,7 @@ nvme_qpair_process_completions(struct nvme_qpair *qpai tr = qpair->act_tr[cpl.cid]; if (tr != NULL) { - nvme_qpair_complete_tracker(qpair, tr, &cpl, ERROR_PRINT_ALL); + nvme_qpair_complete_tracker(tr, &cpl, ERROR_PRINT_ALL); qpair->sq_head = cpl.sqhd; done++; } else if (!in_panic) { @@ -842,7 +846,7 @@ nvme_admin_qpair_abort_aers(struct nvme_qpair *qpair) tr = TAILQ_FIRST(&qpair->outstanding_tr); while (tr != NULL) { if (tr->req->cmd.opc == NVME_OPC_ASYNC_EVENT_REQUEST) { - nvme_qpair_manual_complete_tracker(qpair, tr, + nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC, NVME_SC_ABORTED_SQ_DELETION, 0, ERROR_PRINT_NONE); tr = TAILQ_FIRST(&qpair->outstanding_tr); @@ -886,7 +890,7 @@ nvme_abort_complete(void *arg, const struct nvme_compl */ nvme_printf(tr->qpair->ctrlr, "abort command failed, aborting command manually\n"); - nvme_qpair_manual_complete_tracker(tr->qpair, tr, + nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_ALL); } } @@ -1104,7 +1108,7 @@ _nvme_qpair_submit_request(struct nvme_qpair *qpair, s * with the qpair lock held. */ mtx_unlock(&qpair->lock); - nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC, + nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC, NVME_SC_DATA_TRANSFER_ERROR, DO_NOT_RETRY, ERROR_PRINT_ALL); mtx_lock(&qpair->lock); } @@ -1162,7 +1166,7 @@ nvme_admin_qpair_enable(struct nvme_qpair *qpair) TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { nvme_printf(qpair->ctrlr, "aborting outstanding admin command\n"); - nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC, + nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL); } @@ -1184,7 +1188,7 @@ nvme_io_qpair_enable(struct nvme_qpair *qpair) */ TAILQ_FOREACH_SAFE(tr, &qpair->outstanding_tr, tailq, tr_temp) { nvme_printf(qpair->ctrlr, "aborting outstanding i/o\n"); - nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC, + nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, 0, ERROR_PRINT_NO_RETRY); } @@ -1263,11 +1267,10 @@ nvme_qpair_fail(struct nvme_qpair *qpair) */ nvme_printf(qpair->ctrlr, "failing outstanding i/o\n"); mtx_unlock(&qpair->lock); - nvme_qpair_manual_complete_tracker(qpair, tr, NVME_SCT_GENERIC, + nvme_qpair_manual_complete_tracker(tr, NVME_SCT_GENERIC, NVME_SC_ABORTED_BY_REQUEST, DO_NOT_RETRY, ERROR_PRINT_ALL); mtx_lock(&qpair->lock); } mtx_unlock(&qpair->lock); } - From owner-svn-src-all@freebsd.org Fri Dec 6 22:20:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC5691B8AA7; Fri, 6 Dec 2019 22:20:26 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V6V25Yg9z3yqL; Fri, 6 Dec 2019 22:20:26 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ED4F8041; Fri, 6 Dec 2019 22:20:26 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6MKQ1p042155; Fri, 6 Dec 2019 22:20:26 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6MKQsF042154; Fri, 6 Dec 2019 22:20:26 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201912062220.xB6MKQsF042154@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 6 Dec 2019 22:20:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355466 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 355466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 22:20:26 -0000 Author: bz Date: Fri Dec 6 22:20:26 2019 New Revision: 355466 URL: https://svnweb.freebsd.org/changeset/base/355466 Log: Remove the extra epoch tracker change sneaked into r355449 and was not part of the originally reviewed or described change. Pointyhat to: bz Reported by: glebius Modified: head/sys/netinet/ip_carp.c Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Fri Dec 6 22:12:39 2019 (r355465) +++ head/sys/netinet/ip_carp.c Fri Dec 6 22:20:26 2019 (r355466) @@ -978,7 +978,6 @@ carp_send_ad_locked(struct carp_softc *sc) #endif /* INET */ #ifdef INET6 if (sc->sc_naddrs6) { - struct epoch_tracker et; struct ip6_hdr *ip6; m = m_gethdr(M_NOWAIT, MT_DATA); @@ -1032,10 +1031,8 @@ carp_send_ad_locked(struct carp_softc *sc) CARPSTATS_INC(carps_opackets6); - NET_EPOCH_ENTER(et); carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0, &sc->sc_carpdev->if_carp->cif_im6o, NULL, NULL)); - NET_EPOCH_EXIT(et); } #endif /* INET6 */ From owner-svn-src-all@freebsd.org Fri Dec 6 22:22:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2F2C1B8D2D; Fri, 6 Dec 2019 22:22:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V6Wv3knkz40CQ; Fri, 6 Dec 2019 22:22:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4DD1B1327; Fri, 6 Dec 2019 22:22:03 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 43AD18D4A25E; Fri, 6 Dec 2019 22:22:01 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id B3CA4E707D5; Fri, 6 Dec 2019 22:22:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 9tpLqsmy4EN5; Fri, 6 Dec 2019 22:21:59 +0000 (UTC) Received: from [192.168.2.110] (unknown [IPv6:fde9:577b:c1a9:31:cd01:97c2:711b:1d46]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 1C504E707AC; Fri, 6 Dec 2019 22:21:59 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Gleb Smirnoff" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r355449 - head/sys/netinet Date: Fri, 06 Dec 2019 22:21:58 +0000 X-Mailer: MailMate (2.0BETAr6146) Message-ID: <128F09FF-8F61-4967-9558-1C7F8976204F@FreeBSD.org> In-Reply-To: <20191206220925.GJ2706@FreeBSD.org> References: <201912061635.xB6GZmpS042391@repo.freebsd.org> <20191206220925.GJ2706@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 22:22:03 -0000 On 6 Dec 2019, at 22:09, Gleb Smirnoff wrote: > Hi, > > there is a functional change here: > > On Fri, Dec 06, 2019 at 04:35:48PM +0000, Bjoern A. Zeeb wrote: > B> URL: https://svnweb.freebsd.org/changeset/base/355449 > B> > B> Log: > B> carp: replace caddr_t with char * > B> > B> Change the remaining caddr_t usages to char * following the > removal > B> of the KAME macros > B> > B> No functional change. > ... > B> @@ -978,6 +978,7 @@ carp_send_ad_locked(struct carp_softc *sc) > B> #endif /* INET */ > B> #ifdef INET6 > B> if (sc->sc_naddrs6) { > B> + struct epoch_tracker et; > B> struct ip6_hdr *ip6; > B> > B> m = m_gethdr(M_NOWAIT, MT_DATA); > B> @@ -1031,8 +1032,10 @@ carp_send_ad_locked(struct carp_softc *sc) > B> > B> CARPSTATS_INC(carps_opackets6); > B> > B> + NET_EPOCH_ENTER(et); > B> carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0, > B> &sc->sc_carpdev->if_carp->cif_im6o, NULL, NULL)); > B> + NET_EPOCH_EXIT(et); > B> } > B> #endif /* INET6 */ > > This could be correct change, just needs some explanation. Sorry. My bad. I had a patch from a different branch applied in between review and commit and forgot to clean up before committing. I’ll put the epoch changes up for review the next hours/days. I have reverted this part in the meantime in 355466. Thanks for catching this. /bz From owner-svn-src-all@freebsd.org Fri Dec 6 22:32:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B20481B9226; Fri, 6 Dec 2019 22:32:06 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V6lV4Klyz40jy; Fri, 6 Dec 2019 22:32:06 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 796DB8391; Fri, 6 Dec 2019 22:32:06 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6MW6lH052875; Fri, 6 Dec 2019 22:32:06 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6MW6Y7052874; Fri, 6 Dec 2019 22:32:06 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912062232.xB6MW6Y7052874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Fri, 6 Dec 2019 22:32:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355467 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 355467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 22:32:06 -0000 Author: ian Date: Fri Dec 6 22:32:06 2019 New Revision: 355467 URL: https://svnweb.freebsd.org/changeset/base/355467 Log: Implement bus_rescan for gpiobus(4). This allows on-the-fly reconfiguration of gpio devices by using kenv to add hints for a new device and then do 'devctl rescan gpiobus4' to make the new device(s) attach. It's not particularly easy to detect whether the 'at' hint has been deleted for a child device that's currently attached, so this doesn't handle that. But the user can use devctl commands to manually detach an existing device. Modified: head/sys/dev/gpio/gpiobus.c Modified: head/sys/dev/gpio/gpiobus.c ============================================================================== --- head/sys/dev/gpio/gpiobus.c Fri Dec 6 22:20:26 2019 (r355466) +++ head/sys/dev/gpio/gpiobus.c Fri Dec 6 22:32:06 2019 (r355467) @@ -716,6 +716,21 @@ gpiobus_add_child(device_t dev, u_int order, const cha return (child); } +static int +gpiobus_rescan(device_t dev) +{ + + /* + * Re-scan is supposed to remove and add children, but if someone has + * deleted the hints for a child we attached earlier, we have no easy + * way to handle that. So this just attaches new children for whom new + * hints or drivers have arrived since we last tried. + */ + bus_enumerate_hinted_children(dev); + bus_generic_attach(dev); + return (0); +} + static void gpiobus_hinted_child(device_t bus, const char *dname, int dunit) { @@ -725,6 +740,10 @@ gpiobus_hinted_child(device_t bus, const char *dname, const char *pins; int irq, pinmask; + if (device_find_child(bus, dname, dunit) != NULL) { + return; + } + child = BUS_ADD_CHILD(bus, 0, dname, dunit); devi = GPIOBUS_IVAR(child); if (resource_int_value(dname, dunit, "pins", &pinmask) == 0) { @@ -1077,6 +1096,7 @@ static device_method_t gpiobus_methods[] = { DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), DEVMETHOD(bus_get_resource_list, gpiobus_get_resource_list), DEVMETHOD(bus_add_child, gpiobus_add_child), + DEVMETHOD(bus_rescan, gpiobus_rescan), DEVMETHOD(bus_probe_nomatch, gpiobus_probe_nomatch), DEVMETHOD(bus_print_child, gpiobus_print_child), DEVMETHOD(bus_child_pnpinfo_str, gpiobus_child_pnpinfo_str), From owner-svn-src-all@freebsd.org Fri Dec 6 22:45:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAEA11B9B11; Fri, 6 Dec 2019 22:45:36 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V73455Tpz41sf; Fri, 6 Dec 2019 22:45:36 +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 92E3A85A7; Fri, 6 Dec 2019 22:45:36 +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 xB6MjaG3059488; Fri, 6 Dec 2019 22:45:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6MjaCr059487; Fri, 6 Dec 2019 22:45:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201912062245.xB6MjaCr059487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 6 Dec 2019 22:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355468 - head/sys/tools X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/tools X-SVN-Commit-Revision: 355468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 22:45:36 -0000 Author: kevans Date: Fri Dec 6 22:45:36 2019 New Revision: 355468 URL: https://svnweb.freebsd.org/changeset/base/355468 Log: makesyscalls.lua: improve config processing The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways: - Strip only whole-line comments on every single iteration - Abort if we see a malformed line that doesn't match the key=value format - For quoted (backtick or double quote) strings, we'll advance to the end of the key=value pair and make sure there's not extra stuff left over - For unquoted key=value pairs, we'll strip any trailing comments and verify there's no internal whitespace This has revealed the caveat that key/value pairs can't even include escaped quotes (and haven't been able to). I don't know if this is actually problematic, as we're usually looking at cases like "#include " or raw identifiers.The current version will strip out #include directives appearing inside strings, which is clearly wrong. Improve the processing entirely in the following ways: Reviewed and noticed by: brooks Differential Revision: https://reviews.freebsd.org/D22698 Modified: head/sys/tools/makesyscalls.lua Modified: head/sys/tools/makesyscalls.lua ============================================================================== --- head/sys/tools/makesyscalls.lua Fri Dec 6 22:32:06 2019 (r355467) +++ head/sys/tools/makesyscalls.lua Fri Dec 6 22:45:36 2019 (r355468) @@ -208,8 +208,13 @@ end -- be fine to make various assumptions local function process_config(file) local cfg = {} - local commentExpr = "#.*" - local lineExpr = "([%w%p]+)%s*=%s*([`\"]?[^\"`]+[`\"]?)" + local comment_line_expr = "^%s*#.*" + -- We capture any whitespace padding here so we can easily advance to + -- the end of the line as needed to check for any trailing bogus bits. + -- Alternatively, we could drop the whitespace and instead try to + -- use a pattern to strip out the meaty part of the line, but then we + -- would need to sanitize the line for potentially special characters. + local line_expr = "^([%w%p]+%s*)=(%s*[`\"]?[^\"`]+[`\"]?)" if file == nil then return nil, "No file given" @@ -221,18 +226,36 @@ local function process_config(file) end for nextline in fh:lines() do - -- Strip any comments - nextline = nextline:gsub(commentExpr, "") + -- Strip any whole-line comments + nextline = nextline:gsub(comment_line_expr, "") -- Parse it into key, value pairs - local key, value = nextline:match(lineExpr) + local key, value = nextline:match(line_expr) if key ~= nil and value ~= nil then - if value:sub(1,1) == '`' then + local kvp = key .. "=" .. value + key = trim(key) + value = trim(value) + local delim = value:sub(1,1) + if delim == '`' or delim == '"' then + local trailing_context + -- Strip off the key/value part + trailing_context = nextline:sub(kvp:len() + 1) + -- Strip off any trailing comment + trailing_context = trailing_context:gsub("#.*$", + "") + -- Strip off leading/trailing whitespace + trailing_context = trim(trailing_context) + if trailing_context ~= "" then + print(trailing_context) + abort(1, "Malformed line: " .. nextline) + end + end + if delim == '`' then -- Command substition may use $1 and $2 to mean -- the syscall definition file and itself -- respectively. We'll go ahead and replace -- $[0-9] with respective arg in case we want to -- expand this in the future easily... - value = trim(value, "`") + value = trim(value, delim) for capture in value:gmatch("$([0-9]+)") do capture = tonumber(capture) if capture > #arg then @@ -244,10 +267,24 @@ local function process_config(file) end value = exec(value) + elseif delim == '"' then + value = trim(value, delim) else - value = trim(value, '"') + -- Strip off potential comments + value = value:gsub("#.*$", "") + -- Strip off any padding whitespace + value = trim(value) + if value:match("%s") then + abort(1, "Malformed config line: " .. + nextline) + end end cfg[key] = value + elseif not nextline:match("^%s*$") then + -- Make sure format violations don't get overlooked + -- here, but ignore blank lines. Comments are already + -- stripped above. + abort(1, "Malformed config line: " .. nextline) end end From owner-svn-src-all@freebsd.org Fri Dec 6 23:39:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C84C31BB795; Fri, 6 Dec 2019 23:39: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V8Dr4dkLz45Mr; Fri, 6 Dec 2019 23:39: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 827708EA1; Fri, 6 Dec 2019 23:39: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 xB6Nd86l088591; Fri, 6 Dec 2019 23:39:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6Nd8C4088590; Fri, 6 Dec 2019 23:39:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912062339.xB6Nd8C4088590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 23:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355469 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 23:39:08 -0000 Author: markj Date: Fri Dec 6 23:39:08 2019 New Revision: 355469 URL: https://svnweb.freebsd.org/changeset/base/355469 Log: Fix fault_type handling in vm_map_lookup(). Suppose that the map entry is wired, so that we later assign fault_type = entry->protection. Suppose further that we jump back to RetryLookup. Then fault_type will no longer contain the original fault protection mask, but instead that of the wired entry. Submitted by: Wuyang Chung Reviewed by: kib MFC after: 3 days Github PR: https://github.com/freebsd/freebsd/pull/419 Differential Revision: https://reviews.freebsd.org/D22683 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Fri Dec 6 22:45:36 2019 (r355468) +++ head/sys/vm/vm_map.c Fri Dec 6 23:39:08 2019 (r355469) @@ -4687,7 +4687,7 @@ vm_map_lookup(vm_map_t *var_map, /* IN/OUT */ vm_map_entry_t entry; vm_map_t map = *var_map; vm_prot_t prot; - vm_prot_t fault_type = fault_typea; + vm_prot_t fault_type; vm_object_t eobject; vm_size_t size; struct ucred *cred; @@ -4731,7 +4731,7 @@ RetryLookupLocked: vm_map_growstack(map, vaddr, entry) == KERN_SUCCESS) goto RetryLookupLocked; } - fault_type &= VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; + fault_type = fault_typea & VM_PROT_ALL; if ((fault_type & prot) != fault_type || prot == VM_PROT_NONE) { vm_map_unlock_read(map); return (KERN_PROTECTION_FAILURE); From owner-svn-src-all@freebsd.org Fri Dec 6 23:39:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BECA01BB81C; Fri, 6 Dec 2019 23:39:38 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V8FQ4cfTz45Vg; Fri, 6 Dec 2019 23:39:38 +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 81F518EA6; Fri, 6 Dec 2019 23:39:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6NdctM088651; Fri, 6 Dec 2019 23:39:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6Ndceu088650; Fri, 6 Dec 2019 23:39:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912062339.xB6Ndceu088650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 23:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355470 - head/usr.bin/tail X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/tail X-SVN-Commit-Revision: 355470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 23:39:38 -0000 Author: markj Date: Fri Dec 6 23:39:38 2019 New Revision: 355470 URL: https://svnweb.freebsd.org/changeset/base/355470 Log: Fix tail -f in capability mode. We were not adding CAP_EVENT to input file capabilities, so kevent() always failed with ENOTCAPABLE. tail implements a fallback mode to poll the file in this case, so the failure was not apparent. Reviewed by: emaste MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22709 Modified: head/usr.bin/tail/tail.c Modified: head/usr.bin/tail/tail.c ============================================================================== --- head/usr.bin/tail/tail.c Fri Dec 6 23:39:08 2019 (r355469) +++ head/usr.bin/tail/tail.c Fri Dec 6 23:39:38 2019 (r355470) @@ -93,11 +93,6 @@ main(int argc, char *argv[]) char *p; cap_rights_t rights; - cap_rights_init(&rights, CAP_FSTAT, CAP_FSTATFS, CAP_FCNTL, CAP_MMAP_RW); - if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || - caph_limit_stderr() < 0 || caph_limit_stdout() < 0) - err(1, "can't limit stdio rights"); - /* * Tail's options are weird. First, -n10 is the same as -n-10, not * -n+10. Second, the number options are 1 based and not offsets, @@ -166,6 +161,14 @@ main(int argc, char *argv[]) argv += optind; no_files = argc ? argc : 1; + + cap_rights_init(&rights, CAP_FSTAT, CAP_FSTATFS, CAP_FCNTL, + CAP_MMAP_R); + if (fflag) + cap_rights_set(&rights, CAP_EVENT); + if (caph_rights_limit(STDIN_FILENO, &rights) < 0 || + caph_limit_stderr() < 0 || caph_limit_stdout() < 0) + err(1, "can't limit stdio rights"); fa = fileargs_init(argc, argv, O_RDONLY, 0, &rights, FA_OPEN); if (fa == NULL) From owner-svn-src-all@freebsd.org Fri Dec 6 23:49:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7F4B1BBC48; Fri, 6 Dec 2019 23:49:37 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V8Sx5Z9Lz46KL; Fri, 6 Dec 2019 23:49:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A285C9073; Fri, 6 Dec 2019 23:49:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6NnbX3095039; Fri, 6 Dec 2019 23:49:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6NnbgR095038; Fri, 6 Dec 2019 23:49:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912062349.xB6NnbgR095038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 6 Dec 2019 23:49:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355471 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 355471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 23:49:38 -0000 Author: markj Date: Fri Dec 6 23:49:37 2019 New Revision: 355471 URL: https://svnweb.freebsd.org/changeset/base/355471 Log: Fix an inverted condition introduced in r353539. This would have most likely resulted in read errors causing page leaks. Submitted by: jeff Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 23:39:38 2019 (r355470) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Dec 6 23:49:37 2019 (r355471) @@ -550,7 +550,7 @@ mappedread_sf(vnode_t *vp, int nbytes, uio_t *uio) vm_page_unlock(pp); } vm_page_sunbusy(pp); - if (error != 0 && !vm_page_wired(pp) == 0 && + if (error != 0 && !vm_page_wired(pp) && pp->valid == 0 && vm_page_tryxbusy(pp)) vm_page_free(pp); } else { From owner-svn-src-all@freebsd.org Fri Dec 6 23:51:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DB391BBD32; Fri, 6 Dec 2019 23:51:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V8Vm1Q6rz46bX; Fri, 6 Dec 2019 23:51:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1563090B8; Fri, 6 Dec 2019 23:51:12 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6NpBr5096595; Fri, 6 Dec 2019 23:51:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6NpB1w096594; Fri, 6 Dec 2019 23:51:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912062351.xB6NpB1w096594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 6 Dec 2019 23:51:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355472 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 355472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 23:51:12 -0000 Author: rmacklem Date: Fri Dec 6 23:51:11 2019 New Revision: 355472 URL: https://svnweb.freebsd.org/changeset/base/355472 Log: Add a couple of definitions for NFSv4.2 and update macros to use them. This patch adds code to macros to clear attribute bits not supported by NFSv4.2. For now, these bits are never set anyhow, but this prepares the code for the addition of NFSv4.2 support in a future commit. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Modified: head/sys/fs/nfs/nfs.h Modified: head/sys/fs/nfs/nfs.h ============================================================================== --- head/sys/fs/nfs/nfs.h Fri Dec 6 23:49:37 2019 (r355471) +++ head/sys/fs/nfs/nfs.h Fri Dec 6 23:51:11 2019 (r355472) @@ -335,6 +335,7 @@ struct nfsreferral { #define LCL_NFSV41 0x00020000 #define LCL_DONEBINDCONN 0x00040000 #define LCL_RECLAIMONEFS 0x00080000 +#define LCL_NFSV42 0x00100000 #define LCL_GSS LCL_KERBV /* Or of all mechs */ @@ -431,6 +432,8 @@ typedef struct { (b)->bits[1] &= ~NFSATTRBIT_NFSV41_1; \ (b)->bits[2] &= ~NFSATTRBIT_NFSV41_2; \ } \ + if (((n)->nd_flag & ND_NFSV42) == 0) \ + (b)->bits[2] &= ~NFSATTRBIT_NFSV42_2; \ } while (0) #define NFSISSET_ATTRBIT(b, p) ((b)->bits[(p) / 32] & (1 << ((p) % 32))) @@ -457,6 +460,8 @@ typedef struct { (b)->bits[1] &= ~NFSATTRBIT_NFSV41_1; \ (b)->bits[2] &= ~NFSATTRBIT_NFSV41_2; \ } \ + if (((n)->nd_flag & ND_NFSV42) == 0) \ + (b)->bits[2] &= ~NFSATTRBIT_NFSV42_2; \ } while (0) #define NFSCLRNOTSETABLE_ATTRBIT(b, n) do { \ @@ -465,6 +470,8 @@ typedef struct { (b)->bits[2] &= NFSATTRBIT_SETABLE2; \ if (((n)->nd_flag & ND_NFSV41) == 0) \ (b)->bits[2] &= ~NFSATTRBIT_NFSV41_2; \ + if (((n)->nd_flag & ND_NFSV42) == 0) \ + (b)->bits[2] &= ~NFSATTRBIT_NFSV42_2; \ } while (0) #define NFSNONZERO_ATTRBIT(b) ((b)->bits[0] || (b)->bits[1] || (b)->bits[2]) @@ -701,6 +708,7 @@ struct nfsrv_descript { #define ND_CURSTATEID 0x80000000 #define ND_SAVEDCURSTATEID 0x100000000 #define ND_HASSLOTID 0x200000000 +#define ND_NFSV42 0x400000000 /* * ND_GSS should be the "or" of all GSS type authentications. From owner-svn-src-all@freebsd.org Fri Dec 6 23:59:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4FB01BC211; Fri, 6 Dec 2019 23:59:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V8hF5Zsgz46sc; Fri, 6 Dec 2019 23:59:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A3D61924A; Fri, 6 Dec 2019 23:59:25 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB6NxPwr000779; Fri, 6 Dec 2019 23:59:25 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB6NxOfM000771; Fri, 6 Dec 2019 23:59:24 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201912062359.xB6NxOfM000771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 6 Dec 2019 23:59:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355473 - in head/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 arm64/linux compat/cloudabi32 compat/cloudabi64 compat/freebsd32 i386/linux kern X-SVN-Commit-Revision: 355473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Dec 2019 23:59:26 -0000 Author: brooks Date: Fri Dec 6 23:59:23 2019 New Revision: 355473 URL: https://svnweb.freebsd.org/changeset/base/355473 Log: sysent: Reduce duplication and improve readability. Use the power of variable to avoid spelling out source and generated files too many times. The previous Makefiles were hard to read, hard to edit, and badly formatted. Reviewed by: kevans, emaste Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22714 Modified: head/sys/amd64/linux/Makefile head/sys/amd64/linux32/Makefile head/sys/arm64/linux/Makefile head/sys/compat/cloudabi32/Makefile head/sys/compat/cloudabi64/Makefile head/sys/compat/freebsd32/Makefile head/sys/i386/linux/Makefile head/sys/kern/Makefile Modified: head/sys/amd64/linux/Makefile ============================================================================== --- head/sys/amd64/linux/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/amd64/linux/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -7,11 +7,19 @@ .include +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= syscalls.conf \ + syscalls.master +GENERATED= linux_proto.h \ + linux_syscall.h \ + linux_syscalls.c \ + linux_sysent.c \ + linux_systrace_args.c + all: @echo "make sysent only" -sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c +sysent: ${GENERATED} -linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf - ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf Modified: head/sys/amd64/linux32/Makefile ============================================================================== --- head/sys/amd64/linux32/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/amd64/linux32/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -7,11 +7,19 @@ .include +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= syscalls.conf \ + syscalls.master +GENERATED= linux32_proto.h \ + linux32_syscall.h \ + linux32_syscalls.c \ + linux32_sysent.c \ + linux32_systrace_args.c + all: @echo "make sysent only" -sysent: linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c +sysent: ${GENERATED} -linux32_sysent.c linux32_syscall.h linux32_proto.h linux32_syscalls.c linux32_systrace_args.c: ../../tools/makesyscalls.lua \ - syscalls.master ${.CURDIR}/syscalls.conf - ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf Modified: head/sys/arm64/linux/Makefile ============================================================================== --- head/sys/arm64/linux/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/arm64/linux/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -7,11 +7,19 @@ .include +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= syscalls.conf \ + syscalls.master +GENERATED= linux_proto.h \ + linux_syscall.h \ + linux_syscalls.c \ + linux_sysent.c \ + linux_systrace_args.c + all: @echo "make sysent only" -sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c +sysent: ${GENERATED} -linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf - ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf Modified: head/sys/compat/cloudabi32/Makefile ============================================================================== --- head/sys/compat/cloudabi32/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/compat/cloudabi32/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -5,15 +5,20 @@ .include +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= syscalls.conf \ + ../../contrib/cloudabi/syscalls32.master +GENERATED= cloudabi32_proto.h \ + cloudabi32_syscall.h \ + cloudabi32_syscalls.c \ + cloudabi32_sysent.c \ + cloudabi32_systrace_args.c + all: @echo "make sysent only" -sysent: cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \ - cloudabi32_syscalls.c cloudabi32_systrace_args.c +sysent: ${GENERATED} -cloudabi32_sysent.c cloudabi32_syscall.h cloudabi32_proto.h \ - cloudabi32_syscalls.c cloudabi32_systrace_args.c: \ - ../../tools/makesyscalls.lua ../../contrib/cloudabi/syscalls32.master \ - ${.CURDIR}/syscalls.conf - ${LUA} ../../tools/makesyscalls.lua \ - ../../contrib/cloudabi/syscalls32.master ${.CURDIR}/syscalls.conf +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} \ + ../../contrib/cloudabi/syscalls32.master syscalls.conf Modified: head/sys/compat/cloudabi64/Makefile ============================================================================== --- head/sys/compat/cloudabi64/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/compat/cloudabi64/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -5,15 +5,20 @@ # Don't use an OBJDIR .OBJDIR: ${.CURDIR} +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= syscalls.conf \ + ../../contrib/cloudabi/syscalls64.master +GENERATED= cloudabi64_proto.h \ + cloudabi64_syscall.h \ + cloudabi64_syscalls.c \ + cloudabi64_sysent.c \ + cloudabi64_systrace_args.c + all: @echo "make sysent only" -sysent: cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \ - cloudabi64_syscalls.c cloudabi64_systrace_args.c +sysent: ${GENERATED} -cloudabi64_sysent.c cloudabi64_syscall.h cloudabi64_proto.h \ - cloudabi64_syscalls.c cloudabi64_systrace_args.c: \ - ../../tools/makesyscalls.lua ../../contrib/cloudabi/syscalls64.master \ - ${.CURDIR}/syscalls.conf - ${LUA} ../../tools/makesyscalls.lua \ - ../../contrib/cloudabi/syscalls64.master ${.CURDIR}/syscalls.conf +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} \ + ../../contrib/cloudabi/syscalls64.master syscalls.conf Modified: head/sys/compat/freebsd32/Makefile ============================================================================== --- head/sys/compat/freebsd32/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/compat/freebsd32/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -7,15 +7,20 @@ .include +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= ../../kern/capabilities.conf \ + syscalls.conf \ + syscalls.master +GENERATED= freebsd32_proto.h \ + freebsd32_syscall.h \ + freebsd32_syscalls.c \ + freebsd32_sysent.c \ + freebsd32_systrace_args.c + all: @echo "make sysent only" -sysent: freebsd32_sysent.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c +sysent: ${GENERATED} -freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h freebsd32_systrace_args.c : \ - ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf ../../kern/capabilities.conf - ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf - -clean: - rm -f freebsd32_sysent.c freebsd32_syscalls.c freebsd32_syscall.h freebsd32_proto.h - rm -f freebsd32_systrace_args.c +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf Modified: head/sys/i386/linux/Makefile ============================================================================== --- head/sys/i386/linux/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/i386/linux/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -7,11 +7,19 @@ .include +MAKESYSCALLS= ../../tools/makesyscalls.lua +SRCS= syscalls.conf \ + syscalls.master +GENERATED= linux_proto.h \ + linux_syscall.h \ + linux_syscalls.c \ + linux_sysent.c \ + linux_systrace_args.c + all: @echo "make sysent only" -sysent: linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c +sysent: ${GENERATED} -linux_sysent.c linux_syscall.h linux_proto.h linux_syscalls.c linux_systrace_args.c: \ - ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf - ${LUA} ../../tools/makesyscalls.lua syscalls.master ${.CURDIR}/syscalls.conf +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} syscalls.master syscalls.conf Modified: head/sys/kern/Makefile ============================================================================== --- head/sys/kern/Makefile Fri Dec 6 23:51:11 2019 (r355472) +++ head/sys/kern/Makefile Fri Dec 6 23:59:23 2019 (r355473) @@ -8,13 +8,19 @@ .include +MAKESYSCALLS= ../tools/makesyscalls.lua +SRCS= capabilities.conf \ + syscalls.master +GENERATED= init_sysent.c \ + syscalls.c \ + ../sys/syscall.h \ + ../sys/syscall.mk \ + ../sys/sysproto.h + all: @echo "make sysent only" -sysent: init_sysent.c syscalls.c ../sys/syscall.h ../sys/syscall.mk \ -../sys/sysproto.h +sysent: ${GENERATED} -init_sysent.c syscalls.c systrace_args.c ../sys/syscall.h \ -../sys/syscall.mk ../sys/sysproto.h: ../tools/makesyscalls.lua syscalls.master \ -capabilities.conf - ${LUA} ../tools/makesyscalls.lua syscalls.master +${GENERATED}: ${MAKESYSCALLS} ${SRCS} + ${LUA} ${MAKESYSCALLS} syscalls.master From owner-svn-src-all@freebsd.org Sat Dec 7 00:23:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 585371BD0CB; Sat, 7 Dec 2019 00:23:20 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9Cr1fkGz48J9; Sat, 7 Dec 2019 00:23:20 +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 1C428979C; Sat, 7 Dec 2019 00:23:20 +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 xB70NJ75018282; Sat, 7 Dec 2019 00:23:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70NJxO018281; Sat, 7 Dec 2019 00:23:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912070023.xB70NJxO018281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 7 Dec 2019 00:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355474 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 355474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:23:20 -0000 Author: kib Date: Sat Dec 7 00:23:19 2019 New Revision: 355474 URL: https://svnweb.freebsd.org/changeset/base/355474 Log: amd64: properly set the start of the io permission bitmap for BSP ... after the initial common TSS is copied into its final location during PCPU reallocation. Reported by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Fri Dec 6 23:59:23 2019 (r355473) +++ head/sys/amd64/amd64/pmap.c Sat Dec 7 00:23:19 2019 (r355474) @@ -1771,6 +1771,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu)); amd64_bsp_pcpu_init1(&__pcpu[0]); amd64_bsp_ist_init(&__pcpu[0]); + __pcpu[0].pc_common_tss.tss_iobase = sizeof(struct amd64tss) + + IOPERM_BITMAP_SIZE; memcpy(__pcpu[0].pc_gdt, temp_bsp_pcpu.pc_gdt, NGDT * sizeof(struct user_segment_descriptor)); gdt_segs[GPROC0_SEL].ssd_base = (uintptr_t)&__pcpu[0].pc_common_tss; From owner-svn-src-all@freebsd.org Sat Dec 7 00:28:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6D1F1BD64A; Sat, 7 Dec 2019 00:28:10 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9KP513Dz48nV; Sat, 7 Dec 2019 00:28:09 +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 286EE97A1; Sat, 7 Dec 2019 00:28:09 +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 xB70S9HI018776; Sat, 7 Dec 2019 00:28:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70S9c7018775; Sat, 7 Dec 2019 00:28:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912070028.xB70S9c7018775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 7 Dec 2019 00:28:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355475 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 355475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:28:11 -0000 Author: kib Date: Sat Dec 7 00:28:08 2019 New Revision: 355475 URL: https://svnweb.freebsd.org/changeset/base/355475 Log: x86: Restore the critical section around whole ipi_bitmap_handler() if hardclock IPI is delivered. In the current code after r355311, critical section is taken only around hardclockintr() call, and sched_preempt() is called after the section is exited. If we reschedule after exit, as we typically would due to conditions that caused IPI, in ULE the runq tdq_ipipending is not cleared, which blocks generation of further preempt IPIs. Since all relatively modern (10 years) hardware has per-cpu event timers, restoring the critical section conditionally does not affect it. Reported and tested by: cy Diagnosed and reviewed by: jeff (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D22716 Modified: head/sys/x86/x86/mp_x86.c Modified: head/sys/x86/x86/mp_x86.c ============================================================================== --- head/sys/x86/x86/mp_x86.c Sat Dec 7 00:23:19 2019 (r355474) +++ head/sys/x86/x86/mp_x86.c Sat Dec 7 00:28:08 2019 (r355475) @@ -1262,10 +1262,28 @@ ipi_bitmap_handler(struct trapframe frame) u_int ipi_bitmap; td = curthread; + ipi_bitmap = atomic_readandclear_int(&cpuid_to_pcpu[cpu]-> + pc_ipi_bitmap); + + /* + * sched_preempt() must be called to clear the pending preempt + * IPI to enable delivery of further preempts. However, the + * critical section will cause extra scheduler lock thrashing + * when used unconditionally. Only critical_enter() if + * hardclock must also run, which requires the section entry. + */ + if (ipi_bitmap & (1 << IPI_HARDCLOCK)) + critical_enter(); + td->td_intr_nesting_level++; oldframe = td->td_intr_frame; td->td_intr_frame = &frame; - ipi_bitmap = atomic_readandclear_int(&cpuid_to_pcpu[cpu]->pc_ipi_bitmap); + if (ipi_bitmap & (1 << IPI_PREEMPT)) { +#ifdef COUNT_IPIS + (*ipi_preempt_counts[cpu])++; +#endif + sched_preempt(td); + } if (ipi_bitmap & (1 << IPI_AST)) { #ifdef COUNT_IPIS (*ipi_ast_counts[cpu])++; @@ -1273,23 +1291,15 @@ ipi_bitmap_handler(struct trapframe frame) /* Nothing to do for AST */ } if (ipi_bitmap & (1 << IPI_HARDCLOCK)) { - critical_enter(); #ifdef COUNT_IPIS (*ipi_hardclock_counts[cpu])++; #endif hardclockintr(); - critical_exit(); } - - /* Run preempt after clock handlers since it may switch. */ - if (ipi_bitmap & (1 << IPI_PREEMPT)) { -#ifdef COUNT_IPIS - (*ipi_preempt_counts[cpu])++; -#endif - sched_preempt(td); - } td->td_intr_frame = oldframe; td->td_intr_nesting_level--; + if (ipi_bitmap & (1 << IPI_HARDCLOCK)) + critical_exit(); } /* From owner-svn-src-all@freebsd.org Sat Dec 7 00:33:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D7451BDB35; Sat, 7 Dec 2019 00:33:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9R90qQHz49Pl; Sat, 7 Dec 2019 00:33:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3AA49973; Sat, 7 Dec 2019 00:33:08 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB70X8ao024394; Sat, 7 Dec 2019 00:33:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70X8nG024393; Sat, 7 Dec 2019 00:33:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912070033.xB70X8nG024393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 7 Dec 2019 00:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355476 - head/libexec/rc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/libexec/rc X-SVN-Commit-Revision: 355476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:33:09 -0000 Author: emaste Date: Sat Dec 7 00:33:08 2019 New Revision: 355476 URL: https://svnweb.freebsd.org/changeset/base/355476 Log: rc.shutdown: kill shutdown process after logging message Move the kill -KILL $$ back to the pre-r354446 location at the end of the shutdown timeout handler. MFC with: r354446 Modified: head/libexec/rc/rc.shutdown Modified: head/libexec/rc/rc.shutdown ============================================================================== --- head/libexec/rc/rc.shutdown Sat Dec 7 00:28:08 2019 (r355475) +++ head/libexec/rc/rc.shutdown Sat Dec 7 00:33:08 2019 (r355476) @@ -69,13 +69,13 @@ _rcshutdown_watchdog= if [ -n "$rcshutdown_timeout" ]; then debug "Initiating watchdog timer." sleep $rcshutdown_timeout && ( - kill -KILL $$ >/dev/null 2>&1 _msg="$rcshutdown_timeout second watchdog" _msg="$_msg timeout expired. Shutdown terminated." logger -t rc.shutdown "$_msg" echo echo "$_msg" date + kill -KILL $$ >/dev/null 2>&1 ) & _rcshutdown_watchdog=$! fi From owner-svn-src-all@freebsd.org Sat Dec 7 00:51:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CF761BE218; Sat, 7 Dec 2019 00:51:39 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9rV5ZtNz4BTQ; Sat, 7 Dec 2019 00:51: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 3D6B79BB0; Sat, 7 Dec 2019 00:51: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 xB70pc1V034806; Sat, 7 Dec 2019 00:51:38 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70pcag034798; Sat, 7 Dec 2019 00:51:38 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070051.xB70pcag034798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:51:38 +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: r355477 - in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Commit-Revision: 355477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:51:39 -0000 Author: cy Date: Sat Dec 7 00:51:37 2019 New Revision: 355477 URL: https://svnweb.freebsd.org/changeset/base/355477 Log: MFC r355300: Fix a typo (upto --> up to) and reword to improve word flow. Modified: stable/12/contrib/ipfilter/man/ipf.5 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/man/ipf.5 Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/man/ipf.5 ============================================================================== --- stable/12/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:33:08 2019 (r355476) +++ stable/12/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:51:37 2019 (r355477) @@ -1191,7 +1191,7 @@ pass in log or-block first quick proto tcp from any \\ .fi .PP By default, IPFilter will only log the header portion of a packet received -on the network. A portion of the body of a packet, upto 128 bytes, can also +on the network. Up to 128 bytes of a packet's body can also be logged with the body keyword. ipmon(8) will display the contents of the portion of the body logged in hex. .PP From owner-svn-src-all@freebsd.org Sat Dec 7 00:51:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D1E81BE20D; Sat, 7 Dec 2019 00:51: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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9rV144Yz4BSB; Sat, 7 Dec 2019 00:51: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 DE7C29BAF; Sat, 7 Dec 2019 00:51:37 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB70pbs6034778; Sat, 7 Dec 2019 00:51:37 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70pb7M034777; Sat, 7 Dec 2019 00:51:37 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070051.xB70pb7M034777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:51:37 +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: r355477 - in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Commit-Revision: 355477 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:51:38 -0000 Author: cy Date: Sat Dec 7 00:51:37 2019 New Revision: 355477 URL: https://svnweb.freebsd.org/changeset/base/355477 Log: MFC r355300: Fix a typo (upto --> up to) and reword to improve word flow. Modified: stable/11/contrib/ipfilter/man/ipf.5 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/ipfilter/man/ipf.5 Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/man/ipf.5 ============================================================================== --- stable/11/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:33:08 2019 (r355476) +++ stable/11/contrib/ipfilter/man/ipf.5 Sat Dec 7 00:51:37 2019 (r355477) @@ -1191,7 +1191,7 @@ pass in log or-block first quick proto tcp from any \\ .fi .PP By default, IPFilter will only log the header portion of a packet received -on the network. A portion of the body of a packet, upto 128 bytes, can also +on the network. Up to 128 bytes of a packet's body can also be logged with the body keyword. ipmon(8) will display the contents of the portion of the body logged in hex. .PP From owner-svn-src-all@freebsd.org Sat Dec 7 00:53:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B6241BE4DF; Sat, 7 Dec 2019 00:53:23 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9tV6yzsz4Bsl; Sat, 7 Dec 2019 00:53:22 +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 D362D9CF1; Sat, 7 Dec 2019 00:53:22 +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 xB70rMgD036481; Sat, 7 Dec 2019 00:53:22 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70rMFq036480; Sat, 7 Dec 2019 00:53:22 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070053.xB70rMFq036480@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:53:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355478 - in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Commit-Revision: 355478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:53:23 -0000 Author: cy Date: Sat Dec 7 00:53:22 2019 New Revision: 355478 URL: https://svnweb.freebsd.org/changeset/base/355478 Log: MFC r355388: Chase r352304. The default rlimit memlock is no memory locking. Reported by: egypcio@ Modified: stable/11/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.sbin/ntp/doc/ntp.conf.5 ============================================================================== --- stable/11/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:51:37 2019 (r355477) +++ stable/11/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:53:22 2019 (r355478) @@ -2965,7 +2965,7 @@ Probably only available under Linux, this option may b when dropping root (the .Fl i option). -The default is 32 megabytes on non\-Linux machines, and \-1 under Linux. +The default is \-1. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory". .It Cm stacksize Ar N4kPages From owner-svn-src-all@freebsd.org Sat Dec 7 00:53:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D5461BE4E4; Sat, 7 Dec 2019 00:53:23 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47V9tW2LSMz4Bsm; Sat, 7 Dec 2019 00:53:23 +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 3395E9CF2; Sat, 7 Dec 2019 00:53:23 +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 xB70rNgr036487; Sat, 7 Dec 2019 00:53:23 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB70rNR1036486; Sat, 7 Dec 2019 00:53:23 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201912070053.xB70rNR1036486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 7 Dec 2019 00:53: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: r355478 - in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/usr.sbin/ntp/doc 12/usr.sbin/ntp/doc X-SVN-Commit-Revision: 355478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 00:53:23 -0000 Author: cy Date: Sat Dec 7 00:53:22 2019 New Revision: 355478 URL: https://svnweb.freebsd.org/changeset/base/355478 Log: MFC r355388: Chase r352304. The default rlimit memlock is no memory locking. Reported by: egypcio@ Modified: stable/12/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/ntp/doc/ntp.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/ntp/doc/ntp.conf.5 ============================================================================== --- stable/12/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:51:37 2019 (r355477) +++ stable/12/usr.sbin/ntp/doc/ntp.conf.5 Sat Dec 7 00:53:22 2019 (r355478) @@ -2965,7 +2965,7 @@ Probably only available under Linux, this option may b when dropping root (the .Fl i option). -The default is 32 megabytes on non\-Linux machines, and \-1 under Linux. +The default is \-1. -1 means "do not lock the process into memory". 0 means "lock whatever memory the process wants into memory". .It Cm stacksize Ar N4kPages From owner-svn-src-all@freebsd.org Sat Dec 7 01:10:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B39921BEB84; Sat, 7 Dec 2019 01:10:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VBGQ4Q3Xz4CYf; Sat, 7 Dec 2019 01:10:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7BC069EE6; Sat, 7 Dec 2019 01:10:38 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB71AcTv043062; Sat, 7 Dec 2019 01:10:38 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB71Acoa043061; Sat, 7 Dec 2019 01:10:38 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912070110.xB71Acoa043061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 7 Dec 2019 01:10:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355479 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 355479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 01:10:38 -0000 Author: rmacklem Date: Sat Dec 7 01:10:38 2019 New Revision: 355479 URL: https://svnweb.freebsd.org/changeset/base/355479 Log: Set the XATTRSUPPORT attribute bit for NFSv4.2, always cleared for now. Since r355472 added code which clears the XATTRSUPPORT bit for non-NFSv4.2 mounts, it is now safe to set it. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. This commit completes updates to nfsproto.h required by the NFSv4.2. Modified: head/sys/fs/nfs/nfsproto.h Modified: head/sys/fs/nfs/nfsproto.h ============================================================================== --- head/sys/fs/nfs/nfsproto.h Sat Dec 7 00:53:22 2019 (r355478) +++ head/sys/fs/nfs/nfsproto.h Sat Dec 7 01:10:38 2019 (r355479) @@ -1154,7 +1154,8 @@ struct nfsv3_sattr { (NFSATTRBM_LAYOUTTYPE | \ NFSATTRBM_LAYOUTBLKSIZE | \ NFSATTRBM_LAYOUTALIGNMENT | \ - NFSATTRBM_SUPPATTREXCLCREAT) + NFSATTRBM_SUPPATTREXCLCREAT | \ + NFSATTRBM_XATTRSUPPORT) /* * These are the set only attributes. From owner-svn-src-all@freebsd.org Sat Dec 7 03:29:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39F761C5C9F; Sat, 7 Dec 2019 03:29:59 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VFMB5QCGz4LSH; Sat, 7 Dec 2019 03:29:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9891AB9AA; Sat, 7 Dec 2019 03:29:58 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB73TwRi026602; Sat, 7 Dec 2019 03:29:58 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB73Tw7h026601; Sat, 7 Dec 2019 03:29:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912070329.xB73Tw7h026601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 7 Dec 2019 03:29: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: r355480 - stable/12/libexec/rc X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/libexec/rc X-SVN-Commit-Revision: 355480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 03:29:59 -0000 Author: emaste Date: Sat Dec 7 03:29:58 2019 New Revision: 355480 URL: https://svnweb.freebsd.org/changeset/base/355480 Log: MFC r354446: rc.shutdown: print a newline before watchdog timeout message Previously the watchdog timeout message was appended to the last entry in the "Waiting for PIDS" list, resulting in a message like Waiting for PIDS: 31299 31296 90201 9020090 second watchdog timeout expired. Shutdown terminated. Print a newline to separate the watchdog timeout message. Also MFC 355476: rc.shutdown: kill shutdown process after logging message Move the kill -KILL $$ back to the pre-r354446 location at the end of the shutdown timeout handler. PR: 241072 Sponsored by: The FreeBSD Foundation Modified: stable/12/libexec/rc/rc.shutdown Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.shutdown ============================================================================== --- stable/12/libexec/rc/rc.shutdown Sat Dec 7 01:10:38 2019 (r355479) +++ stable/12/libexec/rc/rc.shutdown Sat Dec 7 03:29:58 2019 (r355480) @@ -72,6 +72,7 @@ if [ -n "$rcshutdown_timeout" ]; then _msg="$rcshutdown_timeout second watchdog" _msg="$_msg timeout expired. Shutdown terminated." logger -t rc.shutdown "$_msg" + echo echo "$_msg" date kill -KILL $$ >/dev/null 2>&1 From owner-svn-src-all@freebsd.org Sat Dec 7 03:34:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E49E1C60B3; Sat, 7 Dec 2019 03:34:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VFRx1zRYz4Lrc; Sat, 7 Dec 2019 03:34:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2853ABD12; Sat, 7 Dec 2019 03:34:05 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB73Y5WL032278; Sat, 7 Dec 2019 03:34:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB73Y3Wq032270; Sat, 7 Dec 2019 03:34:03 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201912070334.xB73Y3Wq032270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 7 Dec 2019 03:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355481 - in head/sys: powerpc/aim powerpc/booke powerpc/include powerpc/powerpc vm X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: powerpc/aim powerpc/booke powerpc/include powerpc/powerpc vm X-SVN-Commit-Revision: 355481 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 03:34:05 -0000 Author: jhibbits Date: Sat Dec 7 03:34:03 2019 New Revision: 355481 URL: https://svnweb.freebsd.org/changeset/base/355481 Log: powerpc/pmap: NUMA-ize vm_page_array on powerpc Summary: This matches r351198 from amd64. This only applies to AIM64 and Book-E. On AIM64 it short-circuits with one domain, to behave similar to existing. Otherwise it will allocate 16MB huge pages to hold the page array, across all NUMA domains. On the first domain it will shift the page array base up, to "upper-align" the page array in that domain, so as to reduce the number of pages from the next domain appearing in this domain. After the first domain, subsequent domains will be allocated in full 16MB pages, until the final domain, which can be short. This means some inner domains may have pages accounted in earlier domains. On Book-E the page array is setup at MMU bootstrap time so that it's always mapped in TLB1, on both 32-bit and 64-bit. This reduces the TLB0 overhead for touching the vm_page_array, which reduces up to one TLB miss per array access. Since page_range (vm_page_startup()) is no longer used on Book-E but is on 32-bit AIM, mark the variable as potentially unused, rather than using a nasty #if defined() list. Reviewed by: luporl Differential Revision: https://reviews.freebsd.org/D21449 Modified: head/sys/powerpc/aim/mmu_oea64.c head/sys/powerpc/aim/slb.c head/sys/powerpc/booke/pmap.c head/sys/powerpc/include/pmap.h head/sys/powerpc/include/vmparam.h head/sys/powerpc/powerpc/mmu_if.m head/sys/powerpc/powerpc/pmap_dispatch.c head/sys/vm/vm_page.c Modified: head/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- head/sys/powerpc/aim/mmu_oea64.c Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/aim/mmu_oea64.c Sat Dec 7 03:34:03 2019 (r355481) @@ -309,6 +309,7 @@ static int moea64_decode_kernel_ptr(mmu_t mmu, vm_offs int *is_user, vm_offset_t *decoded_addr); static size_t moea64_scan_pmap(mmu_t mmu); static void *moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs); +static void moea64_page_array_startup(mmu_t, long); static mmu_method_t moea64_methods[] = { @@ -348,6 +349,7 @@ static mmu_method_t moea64_methods[] = { MMUMETHOD(mmu_page_set_memattr, moea64_page_set_memattr), MMUMETHOD(mmu_quick_enter_page, moea64_quick_enter_page), MMUMETHOD(mmu_quick_remove_page, moea64_quick_remove_page), + MMUMETHOD(mmu_page_array_startup, moea64_page_array_startup), /* Internal interfaces */ MMUMETHOD(mmu_mapdev, moea64_mapdev), @@ -639,11 +641,33 @@ moea64_bootstrap_slb_prefault(vm_offset_t va, int larg } #endif +static int +moea64_kenter_large(mmu_t mmup, vm_offset_t va, vm_paddr_t pa, uint64_t attr, int bootstrap) +{ + struct pvo_entry *pvo; + uint64_t pte_lo; + int error; + + pte_lo = LPTE_M; + pte_lo |= attr; + + pvo = alloc_pvo_entry(bootstrap); + pvo->pvo_vaddr |= PVO_WIRED | PVO_LARGE; + init_pvo_entry(pvo, kernel_pmap, va); + + pvo->pvo_pte.prot = VM_PROT_READ | VM_PROT_WRITE | + VM_PROT_EXECUTE; + pvo->pvo_pte.pa = pa | pte_lo; + error = moea64_pvo_enter(mmup, pvo, NULL, NULL); + if (error != 0) + panic("Error %d inserting large page\n", error); + return (0); +} + static void moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernelstart, vm_offset_t kernelend) { - struct pvo_entry *pvo; register_t msr; vm_paddr_t pa, pkernelstart, pkernelend; vm_offset_t size, off; @@ -660,15 +684,6 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel for (pa = pregions[i].mr_start; pa < pregions[i].mr_start + pregions[i].mr_size; pa += moea64_large_page_size) { pte_lo = LPTE_M; - - pvo = alloc_pvo_entry(1 /* bootstrap */); - pvo->pvo_vaddr |= PVO_WIRED | PVO_LARGE; - init_pvo_entry(pvo, kernel_pmap, PHYS_TO_DMAP(pa)); - - /* - * Set memory access as guarded if prefetch within - * the page could exit the available physmem area. - */ if (pa & moea64_large_page_mask) { pa &= moea64_large_page_mask; pte_lo |= LPTE_G; @@ -677,10 +692,7 @@ moea64_setup_direct_map(mmu_t mmup, vm_offset_t kernel pregions[i].mr_start + pregions[i].mr_size) pte_lo |= LPTE_G; - pvo->pvo_pte.prot = VM_PROT_READ | VM_PROT_WRITE | - VM_PROT_EXECUTE; - pvo->pvo_pte.pa = pa | pte_lo; - moea64_pvo_enter(mmup, pvo, NULL, NULL); + moea64_kenter_large(mmup, PHYS_TO_DMAP(pa), pa, pte_lo, 1); } } PMAP_UNLOCK(kernel_pmap); @@ -3013,3 +3025,97 @@ moea64_dump_pmap_init(mmu_t mmu, unsigned blkpgs) } #endif + +static void +moea64_map_range(mmu_t mmu, vm_offset_t va, vm_paddr_t pa, vm_size_t npages) +{ + + for (; npages > 0; --npages) { + if (moea64_large_page_size != 0 && + (pa & moea64_large_page_mask) == 0 && + (va & moea64_large_page_mask) == 0 && + npages >= (moea64_large_page_size >> PAGE_SHIFT)) { + PMAP_LOCK(kernel_pmap); + moea64_kenter_large(mmu, va, pa, 0, 0); + PMAP_UNLOCK(kernel_pmap); + pa += moea64_large_page_size; + va += moea64_large_page_size; + npages -= (moea64_large_page_size >> PAGE_SHIFT) - 1; + } else { + moea64_kenter(mmu, va, pa); + pa += PAGE_SIZE; + va += PAGE_SIZE; + } + } +} + +static void +moea64_page_array_startup(mmu_t mmu, long pages) +{ + long dom_pages[MAXMEMDOM]; + vm_paddr_t pa; + vm_offset_t va, vm_page_base; + vm_size_t needed, size; + long page; + int domain; + int i; + + vm_page_base = 0xd000000000000000ULL; + + /* Short-circuit single-domain systems. */ + if (vm_ndomains == 1) { + size = round_page(pages * sizeof(struct vm_page)); + pa = vm_phys_early_alloc(0, size); + vm_page_base = moea64_map(mmu, &vm_page_base, + pa, pa + size, VM_PROT_READ | VM_PROT_WRITE); + vm_page_array_size = pages; + vm_page_array = (vm_page_t)vm_page_base; + return; + } + + page = 0; + for (i = 0; i < MAXMEMDOM; i++) + dom_pages[i] = 0; + + /* Now get the number of pages required per domain. */ + for (i = 0; i < vm_phys_nsegs; i++) { + domain = vm_phys_segs[i].domain; + KASSERT(domain < MAXMEMDOM, + ("Invalid vm_phys_segs NUMA domain %d!\n", domain)); + /* Get size of vm_page_array needed for this segment. */ + size = btoc(vm_phys_segs[i].end - vm_phys_segs[i].start); + dom_pages[domain] += size; + } + + for (i = 0; phys_avail[i + 1] != 0; i+= 2) { + domain = _vm_phys_domain(phys_avail[i]); + KASSERT(domain < MAXMEMDOM, + ("Invalid phys_avail NUMA domain %d!\n", domain)); + size = btoc(phys_avail[i + 1] - phys_avail[i]); + dom_pages[domain] += size; + } + + /* + * Map in chunks that can get us all 16MB pages. There will be some + * overlap between domains, but that's acceptable for now. + */ + vm_page_array_size = 0; + va = vm_page_base; + for (i = 0; i < MAXMEMDOM && vm_page_array_size < pages; i++) { + if (dom_pages[i] == 0) + continue; + size = ulmin(pages - vm_page_array_size, dom_pages[i]); + size = round_page(size * sizeof(struct vm_page)); + needed = size; + size = roundup2(size, moea64_large_page_size); + pa = vm_phys_early_alloc(i, size); + vm_page_array_size += size / sizeof(struct vm_page); + moea64_map_range(mmu, va, pa, size >> PAGE_SHIFT); + /* Scoot up domain 0, to reduce the domain page overlap. */ + if (i == 0) + vm_page_base += size - needed; + va += size; + } + vm_page_array = (vm_page_t)vm_page_base; + vm_page_array_size = pages; +} Modified: head/sys/powerpc/aim/slb.c ============================================================================== --- head/sys/powerpc/aim/slb.c Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/aim/slb.c Sat Dec 7 03:34:03 2019 (r355481) @@ -221,7 +221,10 @@ kernel_va_to_slbv(vm_offset_t va) if (mem_valid(DMAP_TO_PHYS(va), 0) == 0) slbv |= SLBV_L; - } + } else if (moea64_large_page_size != 0 && + va >= (vm_offset_t)vm_page_array && + va <= (uintptr_t)(&vm_page_array[vm_page_array_size])) + slbv |= SLBV_L; return (slbv); } Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/booke/pmap.c Sat Dec 7 03:34:03 2019 (r355481) @@ -393,6 +393,7 @@ static int mmu_booke_map_user_ptr(mmu_t mmu, pmap_t p volatile const void *uaddr, void **kaddr, size_t ulen, size_t *klen); static int mmu_booke_decode_kernel_ptr(mmu_t mmu, vm_offset_t addr, int *is_user, vm_offset_t *decoded_addr); +static void mmu_booke_page_array_startup(mmu_t , long); static mmu_method_t mmu_booke_methods[] = { @@ -434,6 +435,7 @@ static mmu_method_t mmu_booke_methods[] = { MMUMETHOD(mmu_deactivate, mmu_booke_deactivate), MMUMETHOD(mmu_quick_enter_page, mmu_booke_quick_enter_page), MMUMETHOD(mmu_quick_remove_page, mmu_booke_quick_remove_page), + MMUMETHOD(mmu_page_array_startup, mmu_booke_page_array_startup), /* Internal interfaces */ MMUMETHOD(mmu_bootstrap, mmu_booke_bootstrap), @@ -1619,8 +1621,30 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o debugf(" kernel pdir at 0x%"PRI0ptrX" end = 0x%"PRI0ptrX"\n", kernel_pdir, data_end); + /* Retrieve phys/avail mem regions */ + mem_regions(&physmem_regions, &physmem_regions_sz, + &availmem_regions, &availmem_regions_sz); + + if (PHYS_AVAIL_ENTRIES < availmem_regions_sz) + panic("mmu_booke_bootstrap: phys_avail too small"); + + data_end = round_page(data_end); + vm_page_array = (vm_page_t)data_end; + /* + * Get a rough idea (upper bound) on the size of the page array. The + * vm_page_array will not handle any more pages than we have in the + * avail_regions array, and most likely much less. + */ + sz = 0; + for (mp = availmem_regions; mp->mr_size; mp++) { + sz += mp->mr_size; + } + sz = (round_page(sz) / (PAGE_SIZE + sizeof(struct vm_page))); + data_end += round_page(sz * sizeof(struct vm_page)); + /* Pre-round up to 1MB. This wastes some space, but saves TLB entries */ data_end = roundup2(data_end, 1 << 20); + debugf(" data_end: 0x%"PRI0ptrX"\n", data_end); debugf(" kernstart: %#zx\n", kernstart); debugf(" kernsize: %#zx\n", kernsize); @@ -1690,13 +1714,6 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o * to us. Also, sort the entries for ascending addresses. */ - /* Retrieve phys/avail mem regions */ - mem_regions(&physmem_regions, &physmem_regions_sz, - &availmem_regions, &availmem_regions_sz); - - if (PHYS_AVAIL_ENTRIES < availmem_regions_sz) - panic("mmu_booke_bootstrap: phys_avail too small"); - sz = 0; cnt = availmem_regions_sz; debugf("processing avail regions:\n"); @@ -3662,6 +3679,12 @@ mmu_booke_change_attr(mmu_t mmu, vm_offset_t addr, vm_ mtx_unlock_spin(&tlbivax_mutex); return (0); +} + +static void +mmu_booke_page_array_startup(mmu_t mmu, long pages) +{ + vm_page_array_size = pages; } /**************************************************************************/ Modified: head/sys/powerpc/include/pmap.h ============================================================================== --- head/sys/powerpc/include/pmap.h Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/include/pmap.h Sat Dec 7 03:34:03 2019 (r355481) @@ -270,6 +270,8 @@ int pmap_dev_direct_mapped(vm_paddr_t, vm_size_t); boolean_t pmap_mmu_install(char *name, int prio); const char *pmap_mmu_name(void); +void pmap_page_array_startup(long count); + #define vtophys(va) pmap_kextract((vm_offset_t)(va)) extern vm_offset_t virtual_avail; Modified: head/sys/powerpc/include/vmparam.h ============================================================================== --- head/sys/powerpc/include/vmparam.h Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/include/vmparam.h Sat Dec 7 03:34:03 2019 (r355481) @@ -242,6 +242,21 @@ struct pmap_physseg { #endif #endif +#if defined(__powerpc64__) || defined(BOOKE) +/* + * powerpc64 and Book-E will provide their own page array allocators. + * + * On AIM, this will allocate a single virtual array, with pages from the + * correct memory domains. + * On Book-E this will let us put the array in TLB1, removing the need for TLB + * thrashing. + * + * VM_MIN_KERNEL_ADDRESS is just a dummy. It will get set by the MMU driver. + */ +#define PA_MIN_ADDRESS VM_MIN_KERNEL_ADDRESS +#define PMAP_HAS_PAGE_ARRAY 1 +#endif + #define PMAP_HAS_DMAP (hw_direct_map) #define PHYS_TO_DMAP(x) ({ \ KASSERT(hw_direct_map, ("Direct map not provided by PMAP")); \ Modified: head/sys/powerpc/powerpc/mmu_if.m ============================================================================== --- head/sys/powerpc/powerpc/mmu_if.m Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/powerpc/mmu_if.m Sat Dec 7 03:34:03 2019 (r355481) @@ -1075,3 +1075,12 @@ METHOD int change_attr { vm_memattr_t _mode; } DEFAULT mmu_null_change_attr; +/** + * @brief Initialize the page array. + * + * @param _pages The number of pages to be accounted by the array. + */ +METHOD void page_array_startup { + mmu_t _mmu; + long _pages; +}; Modified: head/sys/powerpc/powerpc/pmap_dispatch.c ============================================================================== --- head/sys/powerpc/powerpc/pmap_dispatch.c Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/powerpc/powerpc/pmap_dispatch.c Sat Dec 7 03:34:03 2019 (r355481) @@ -610,6 +610,13 @@ pmap_change_attr(vm_offset_t addr, vm_size_t size, vm_ return (MMU_CHANGE_ATTR(mmu_obj, addr, size, mode)); } +void +pmap_page_array_startup(long pages) +{ + CTR2(KTR_PMAP, "%s(%ld)", __func__, pages); + MMU_PAGE_ARRAY_STARTUP(mmu_obj, pages); +} + /* * MMU install routines. Highest priority wins, equal priority also * overrides allowing last-set to win. Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Sat Dec 7 03:29:58 2019 (r355480) +++ head/sys/vm/vm_page.c Sat Dec 7 03:34:03 2019 (r355481) @@ -559,7 +559,8 @@ vm_page_startup(vm_offset_t vaddr) vm_page_t m; char *list, *listend; vm_offset_t mapped; - vm_paddr_t end, high_avail, low_avail, new_end, page_range, size; + vm_paddr_t end, high_avail, low_avail, new_end, size; + vm_paddr_t page_range __unused; vm_paddr_t last_pa, pa; u_long pagecount; int biggestone, i, segind; From owner-svn-src-all@freebsd.org Sat Dec 7 03:56:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 755DA1C6F32; Sat, 7 Dec 2019 03:56:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VFxx279yz4MwB; Sat, 7 Dec 2019 03:56:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CEE6C0B9; Sat, 7 Dec 2019 03:56:37 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB73ubPj043787; Sat, 7 Dec 2019 03:56:37 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB73ubvP043786; Sat, 7 Dec 2019 03:56:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201912070356.xB73ubvP043786@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 7 Dec 2019 03:56:37 +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: r355482 - stable/12/sbin/dhclient X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sbin/dhclient X-SVN-Commit-Revision: 355482 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 03:56:37 -0000 Author: emaste Date: Sat Dec 7 03:56:36 2019 New Revision: 355482 URL: https://svnweb.freebsd.org/changeset/base/355482 Log: MFC r238022 (cem): dhclient: fix braino in previous bugfix r300174 The previous revision missed the exact same error in a copy paste block of the same code in another function. Fix the identical case, too. A DHCP client identifier is simply the hardware type (one byte) concatenated with the hardware address (some variable number of bytes, but at most 16). Limit the size of the temporary buffer to match and the rest of the calculations shake out correctly. PR: 238022 Reported by: Young Submitted by: Young Modified: stable/12/sbin/dhclient/dhclient.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/dhclient/dhclient.c ============================================================================== --- stable/12/sbin/dhclient/dhclient.c Sat Dec 7 03:34:03 2019 (r355481) +++ stable/12/sbin/dhclient/dhclient.c Sat Dec 7 03:56:36 2019 (r355482) @@ -1774,7 +1774,7 @@ make_request(struct interface_info *ip, struct client_ } /* set unique client identifier */ - char client_ident[sizeof(struct hardware)]; + char client_ident[sizeof(ip->hw_address.haddr) + 1]; if (!options[DHO_DHCP_CLIENT_IDENTIFIER]) { int hwlen = (ip->hw_address.hlen < sizeof(client_ident)-1) ? ip->hw_address.hlen : sizeof(client_ident)-1; From owner-svn-src-all@freebsd.org Sat Dec 7 09:33:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BD001CF005; Sat, 7 Dec 2019 09:33:29 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mx0.gentlemail.de (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 47VPQc3NCMz4c8c; Sat, 7 Dec 2019 09:33:27 +0000 (UTC) (envelope-from freebsd@omnilan.de) Received: from mh0.gentlemail.de (ezra.dcm1.omnilan.net [IPv6:2a00:e10:2800::a135]) by mx0.gentlemail.de (8.14.5/8.14.5) with ESMTP id xB79XI6g000341; Sat, 7 Dec 2019 10:33:18 +0100 (CET) (envelope-from freebsd@omnilan.de) Received: from titan.inop.mo1.omnilan.net (s1.omnilan.de [217.91.127.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mh0.gentlemail.de (Postfix) with ESMTPSA id A2C6D53E; Sat, 7 Dec 2019 10:33:18 +0100 (CET) Subject: Re: svn commit: r355482 - stable/12/sbin/dhclient To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201912070356.xB73ubvP043786@repo.freebsd.org> From: Harry Schmalzbauer Organization: OmniLAN Message-ID: Date: Sat, 7 Dec 2019 10:33:18 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201912070356.xB73ubvP043786@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (mx0.gentlemail.de [IPv6:2a00:e10:2800::a130]); Sat, 07 Dec 2019 10:33:18 +0100 (CET) X-Milter: Spamilter (Reciever: mx0.gentlemail.de; Sender-ip: ; Sender-helo: mh0.gentlemail.de; ) X-Rspamd-Queue-Id: 47VPQc3NCMz4c8c X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of freebsd@omnilan.de designates 2a00:e10:2800::a130 as permitted sender) smtp.mailfrom=freebsd@omnilan.de X-Spamd-Result: default: False [-4.62 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[omnilan.de]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(-2.32)[ip: (-9.19), ipnet: 2a00:e10:2800::/38(-4.56), asn: 61157(2.15), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:61157, ipnet:2a00:e10:2800::/38, country:DE]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 09:33:29 -0000 Am 07.12.2019 um 04:56 schrieb Ed Maste: > Author: emaste > Date: Sat Dec 7 03:56:36 2019 > New Revision: 355482 > URL: https://svnweb.freebsd.org/changeset/base/355482 > > Log: > MFC r238022 (cem): dhclient: fix braino in previous bugfix r300174 PR vs. SVN typo, cem's commit was r355204. Thanks, -harry From owner-svn-src-all@freebsd.org Sat Dec 7 12:55:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 093381D2FA1; Sat, 7 Dec 2019 12:55:59 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VTwG6H7tz3J3Q; Sat, 7 Dec 2019 12:55:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B622F1A280; Sat, 7 Dec 2019 12:55:58 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7Ctw2D063003; Sat, 7 Dec 2019 12:55:58 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7CtwJL063002; Sat, 7 Dec 2019 12:55:58 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912071255.xB7CtwJL063002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 7 Dec 2019 12:55:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355483 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 12:55:59 -0000 Author: mjg Date: Sat Dec 7 12:55:58 2019 New Revision: 355483 URL: https://svnweb.freebsd.org/changeset/base/355483 Log: vfs: catch vn_printf up with reality - add the missing VV_VMSIZEVNLOCK and VV_READLINK flags - add decoding v_mflag While here sort flags. Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Dec 7 03:56:36 2019 (r355482) +++ head/sys/kern/vfs_subr.c Sat Dec 7 12:55:58 2019 (r355483) @@ -3745,6 +3745,8 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VV_ETERNALDEV", sizeof(buf)); if (vp->v_vflag & VV_CACHEDLABEL) strlcat(buf, "|VV_CACHEDLABEL", sizeof(buf)); + if (vp->v_vflag & VV_VMSIZEVNLOCK) + strlcat(buf, "|VV_VMSIZEVNLOCK", sizeof(buf)); if (vp->v_vflag & VV_COPYONWRITE) strlcat(buf, "|VV_COPYONWRITE", sizeof(buf)); if (vp->v_vflag & VV_SYSTEM) @@ -3759,6 +3761,8 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VV_MD", sizeof(buf)); if (vp->v_vflag & VV_FORCEINSMQ) strlcat(buf, "|VV_FORCEINSMQ", sizeof(buf)); + if (vp->v_vflag & VV_READLINK) + strlcat(buf, "|VV_READLINK", sizeof(buf)); flags = vp->v_vflag & ~(VV_ROOT | VV_ISTTY | VV_NOSYNC | VV_ETERNALDEV | VV_CACHEDLABEL | VV_COPYONWRITE | VV_SYSTEM | VV_PROCDEP | VV_NOKNOTE | VV_DELETED | VV_MD | VV_FORCEINSMQ); @@ -3766,6 +3770,8 @@ vn_printf(struct vnode *vp, const char *fmt, ...) snprintf(buf2, sizeof(buf2), "|VV(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); } + if (vp->v_iflag & VI_TEXT_REF) + strlcat(buf, "|VI_TEXT_REF", sizeof(buf)); if (vp->v_iflag & VI_MOUNT) strlcat(buf, "|VI_MOUNT", sizeof(buf)); if (vp->v_iflag & VI_DOOMED) @@ -3778,12 +3784,17 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VI_DOINGINACT", sizeof(buf)); if (vp->v_iflag & VI_OWEINACT) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); - if (vp->v_iflag & VI_TEXT_REF) - strlcat(buf, "|VI_TEXT_REF", sizeof(buf)); - flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE | - VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT | VI_TEXT_REF); + flags = vp->v_iflag & ~(VI_TEXT_REF | VI_MOUNT | VI_DOOMED | VI_FREE | + VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); + strlcat(buf, buf2, sizeof(buf)); + } + if (vp->v_mflag & VMP_TMPMNTFREELIST) + strlcat(buf, "|VMP_TMPMNTFREELIST", sizeof(buf)); + flags = vp->v_mflag & ~(VMP_TMPMNTFREELIST); + if (flags != 0) { + snprintf(buf2, sizeof(buf2), "|VMP(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); } printf(" flags (%s)\n", buf + 1); From owner-svn-src-all@freebsd.org Sat Dec 7 12:56:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92CF11D3019; Sat, 7 Dec 2019 12:56:25 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VTwn3PMvz3J9v; Sat, 7 Dec 2019 12:56:25 +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 57FA01A284; Sat, 7 Dec 2019 12:56:25 +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 xB7CuPf3063070; Sat, 7 Dec 2019 12:56:25 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7CuPgI063069; Sat, 7 Dec 2019 12:56:25 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912071256.xB7CuPgI063069@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 7 Dec 2019 12:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355484 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 355484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 12:56:25 -0000 Author: mjg Date: Sat Dec 7 12:56:24 2019 New Revision: 355484 URL: https://svnweb.freebsd.org/changeset/base/355484 Log: vfs: clean up delmntque similarly to vdrop r355414 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Dec 7 12:55:58 2019 (r355483) +++ head/sys/kern/vfs_subr.c Sat Dec 7 12:56:24 2019 (r355484) @@ -1670,7 +1670,6 @@ static void delmntque(struct vnode *vp) { struct mount *mp; - int active; mp = vp->v_mount; if (mp == NULL) @@ -1680,9 +1679,8 @@ delmntque(struct vnode *vp) KASSERT(mp->mnt_activevnodelistsize <= mp->mnt_nvnodelistsize, ("Active vnode list size %d > Vnode list size %d", mp->mnt_activevnodelistsize, mp->mnt_nvnodelistsize)); - active = vp->v_iflag & VI_ACTIVE; - vp->v_iflag &= ~VI_ACTIVE; - if (active) { + if (vp->v_iflag & VI_ACTIVE) { + vp->v_iflag &= ~VI_ACTIVE; mtx_lock(&mp->mnt_listmtx); TAILQ_REMOVE(&mp->mnt_activevnodelist, vp, v_actfreelist); mp->mnt_activevnodelistsize--; From owner-svn-src-all@freebsd.org Sat Dec 7 14:17:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90D3D1D4183; Sat, 7 Dec 2019 14:17:57 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VWks3Bs8z3Lp5; Sat, 7 Dec 2019 14:17:57 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4CDCF1B0C3; Sat, 7 Dec 2019 14:17:57 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7EHvrN010806; Sat, 7 Dec 2019 14:17:57 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7EHvoI010805; Sat, 7 Dec 2019 14:17:57 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201912071417.xB7EHvoI010805@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sat, 7 Dec 2019 14:17: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: r355485 - stable/12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: stable/12/sbin/bectl X-SVN-Commit-Revision: 355485 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 14:17:57 -0000 Author: bcr (doc committer) Date: Sat Dec 7 14:17:56 2019 New Revision: 355485 URL: https://svnweb.freebsd.org/changeset/base/355485 Log: MFC r355225: Capitalize some user-visible output messages in the bectl utility. No functional changes. Approved by: imp@ Differential Revision: https://reviews.freebsd.org/D22330 Modified: stable/12/sbin/bectl/bectl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Sat Dec 7 12:56:24 2019 (r355484) +++ stable/12/sbin/bectl/bectl.c Sat Dec 7 14:17:56 2019 (r355485) @@ -68,7 +68,7 @@ usage(bool explicit) fp = explicit ? stdout : stderr; fprintf(fp, "%s", - "usage:\tbectl {-h | -? | subcommand [args...]}\n" + "Usage:\tbectl {-h | -? | subcommand [args...]}\n" #if SOON "\tbectl add (path)*\n" #endif @@ -167,10 +167,10 @@ bectl_cmd_activate(int argc, char *argv[]) /* activate logic goes here */ if ((err = be_activate(be, argv[0], temp)) != 0) /* XXX TODO: more specific error msg based on err */ - printf("did not successfully activate boot environment %s\n", + printf("Did not successfully activate boot environment %s\n", argv[0]); else - printf("successfully activated boot environment %s\n", argv[0]); + printf("Successfully activated boot environment %s\n", argv[0]); if (temp) printf("for next boot\n"); @@ -250,14 +250,14 @@ bectl_cmd_create(int argc, char *argv[]) default: if (atpos != NULL) fprintf(stderr, - "failed to create a snapshot '%s' of '%s'\n", + "Failed to create a snapshot '%s' of '%s'\n", atpos, bootenv); else if (snapname == NULL) fprintf(stderr, - "failed to create bootenv %s\n", bootenv); + "Failed to create bootenv %s\n", bootenv); else fprintf(stderr, - "failed to create bootenv %s from snapshot %s\n", + "Failed to create bootenv %s from snapshot %s\n", bootenv, snapname); } @@ -424,12 +424,12 @@ bectl_cmd_mount(int argc, char *argv[]) switch (err) { case BE_ERR_SUCCESS: - printf("successfully mounted %s at %s\n", bootenv, result_loc); + printf("Successfully mounted %s at %s\n", bootenv, result_loc); break; default: fprintf(stderr, - (argc == 3) ? "failed to mount bootenv %s at %s\n" : - "failed to mount bootenv %s at temporary path %s\n", + (argc == 3) ? "Failed to mount bootenv %s at %s\n" : + "Failed to mount bootenv %s at temporary path %s\n", bootenv, mountpoint); } @@ -462,7 +462,7 @@ bectl_cmd_rename(int argc, char *argv[]) case BE_ERR_SUCCESS: break; default: - fprintf(stderr, "failed to rename bootenv %s to %s\n", + fprintf(stderr, "Failed to rename bootenv %s to %s\n", src, dest); } @@ -507,7 +507,7 @@ bectl_cmd_unmount(int argc, char *argv[]) case BE_ERR_SUCCESS: break; default: - fprintf(stderr, "failed to unmount bootenv %s\n", bootenv); + fprintf(stderr, "Failed to unmount bootenv %s\n", bootenv); } return (err); @@ -563,7 +563,7 @@ main(int argc, char *argv[]) return (usage(true)); if ((cmd = get_cmd_info(command)) == NULL) { - fprintf(stderr, "unknown command: %s\n", command); + fprintf(stderr, "Unknown command: %s\n", command); return (usage(false)); } From owner-svn-src-all@freebsd.org Sat Dec 7 15:17:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A56511D51B2; Sat, 7 Dec 2019 15:17:01 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VY313gnZz3Nqm; Sat, 7 Dec 2019 15:17:01 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DFD21BB58; Sat, 7 Dec 2019 15:17:01 +0000 (UTC) (envelope-from schweikh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7FH1xb045853; Sat, 7 Dec 2019 15:17:01 GMT (envelope-from schweikh@FreeBSD.org) Received: (from schweikh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7FH1Ar045852; Sat, 7 Dec 2019 15:17:01 GMT (envelope-from schweikh@FreeBSD.org) Message-Id: <201912071517.xB7FH1Ar045852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: schweikh set sender to schweikh@FreeBSD.org using -f From: Jens Schweikhardt Date: Sat, 7 Dec 2019 15:17:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355486 - head/sbin/mount_fusefs X-SVN-Group: head X-SVN-Commit-Author: schweikh X-SVN-Commit-Paths: head/sbin/mount_fusefs X-SVN-Commit-Revision: 355486 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 15:17:01 -0000 Author: schweikh Date: Sat Dec 7 15:17:00 2019 New Revision: 355486 URL: https://svnweb.freebsd.org/changeset/base/355486 Log: Correct a handful of typos/grammos. Modified: head/sbin/mount_fusefs/mount_fusefs.8 Modified: head/sbin/mount_fusefs/mount_fusefs.8 ============================================================================== --- head/sbin/mount_fusefs/mount_fusefs.8 Sat Dec 7 14:17:56 2019 (r355485) +++ head/sbin/mount_fusefs/mount_fusefs.8 Sat Dec 7 15:17:00 2019 (r355486) @@ -60,7 +60,7 @@ Basic usage is to start a fuse daemon on the given file. In practice, the daemon is assigned a .Ar special -file automatically, which can then be indentified via +file automatically, which can then be identified via .Xr fstat 1 . That special file can then be mounted by .Nm . @@ -100,7 +100,7 @@ is an integer it will be interpreted as the number of the file descriptor of an already open fuse device (used when the Fuse library invokes .Nm . -(See +See .Sx DAEMON MOUNTS ) . .Pp The options are as follows: @@ -181,7 +181,7 @@ are supported by the Fuse library. One can list these by passing .Fl h to a Fuse daemon. -Most of these options only have affect on the behavior of the daemon (that is, +Most of these options only have effect on the behavior of the daemon (that is, their scope is limited to userspace). However, there are some which do require in-kernel support. Currently the options supported by the kernel are: @@ -209,7 +209,7 @@ has the same effect as This is the recommended usage when you want basic usage (eg, run the daemon at a low privilege level but mount it as root). .Sh STRICT ACCESS POLICY -The strict access policy for Fuse filesystems lets one to use the filesystem +The strict access policy for Fuse filesystems lets one use the filesystem only if the filesystem daemon has the same credentials (uid, real uid, gid, real gid) as the user. .Pp @@ -222,7 +222,7 @@ This is to shield users from the daemon .Dq spying on their I/O activities. .Pp -Users might opt to willingly relax strict access policy (as far they +Users might opt to willingly relax strict access policy (as far as they are concerned) by doing their own secondary mount (See .Sx SHARED MOUNTS ) . .Sh SHARED MOUNTS @@ -259,13 +259,13 @@ However, given that is capable of invoking an arbitrary program, one must be careful when doing this. .Nm is designed in a way such that it makes that easy. -For this purpose, there are options which disable certain risky features ( -.Fl S +For this purpose, there are options which disable certain risky features +.Fl ( S and .Fl A ) , and command line parsing is done in a flexible way: mixing options and non-options is allowed, but processing them stops at the third non-option -argument (after the first two has been utilized as device and mountpoint). +argument (after the first two have been utilized as device and mountpoint). The rest of the command line specifies the daemon and its arguments. (Alternatively, the daemon, the special and the mount path can be specified using the respective options.) Note that From owner-svn-src-all@freebsd.org Sat Dec 7 16:14:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7EFF1D61A7; Sat, 7 Dec 2019 16:14:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VZKD65VRz3R2P; Sat, 7 Dec 2019 16:14:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B438B1C5A8; Sat, 7 Dec 2019 16:14:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7GEOaC080799; Sat, 7 Dec 2019 16:14:24 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7GENQ3080793; Sat, 7 Dec 2019 16:14:23 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201912071614.xB7GENQ3080793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 7 Dec 2019 16:14:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355487 - in head/sys: arm64/arm64 arm64/include conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/include conf X-SVN-Commit-Revision: 355487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 16:14:25 -0000 Author: mmel Date: Sat Dec 7 16:14:23 2019 New Revision: 355487 URL: https://svnweb.freebsd.org/changeset/base/355487 Log: Add support for booting kernel directly from U-Boot using booti command. In some cases, like is locked bootstrap or device's inability to boot from removable media, we cannot use standard boot sequence and is necessary to boot kernel directly from U-Boot. Discussed with: jhibbits MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D13861 Added: head/sys/arm64/arm64/machdep_boot.c (contents, props changed) Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/machdep.c head/sys/arm64/include/machdep.h head/sys/conf/Makefile.arm64 head/sys/conf/files.arm64 head/sys/conf/options.arm64 Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Sat Dec 7 15:17:00 2019 (r355486) +++ head/sys/arm64/arm64/locore.S Sat Dec 7 16:14:23 2019 (r355487) @@ -43,6 +43,24 @@ .globl kernbase .set kernbase, KERNBASE + +/* U-Boot booti related constants. */ +#if defined(LINUX_BOOT_ABI) +#define FDT_MAGIC 0xEDFE0DD0 /* FDT blob Magic */ + +#ifndef UBOOT_IMAGE_OFFSET +#define UBOOT_IMAGE_OFFSET 0 /* Image offset from start of */ +#endif /* 2 MiB page */ + +#ifndef UBOOT_IMAGE_SIZE /* Total size of image */ +#define UBOOT_IMAGE_SIZE _end - _start +#endif + +#ifndef UBOOT_IMAGE_FLAGS +#define UBOOT_IMAGE_FLAGS 0 /* LE kernel, unspecified */ +#endif /* page size */ +#endif /* defined(LINUX_BOOT_ABI) */ + /* * We assume: * MMU on with an identity map, or off @@ -54,6 +72,21 @@ .text .globl _start _start: +#if defined(LINUX_BOOT_ABI) + /* U-boot image header */ + b 1f /* code 0 */ + .long 0 /* code 1 */ + .quad UBOOT_IMAGE_OFFSET /* Image offset in 2 MiB page, LE */ + .quad UBOOT_IMAGE_SIZE /* Image size, LE */ + .quad UBOOT_IMAGE_FLAGS /* Flags for kernel. LE */ + .quad 0 /* Reserved */ + .quad 0 /* Reserved */ + .quad 0 /* Reserved */ + .long 0x644d5241 /* Magic "ARM\x64", LE */ + .long 0 /* Reserved for PE COFF offset*/ +1: +#endif /* defined(LINUX_BOOT_ABI) */ + /* Drop to EL1 */ bl drop_to_el1 @@ -350,11 +383,50 @@ create_pagetables: /* Find the size of the kernel */ mov x6, #(KERNBASE) + +#if defined(LINUX_BOOT_ABI) + /* X19 is used as 'map FDT data' flag */ + mov x19, xzr + + /* No modules or FDT pointer ? */ + cbz x0, booti_no_fdt + + /* Test if modulep points to modules descriptor or to FDT */ + ldr w8, [x0] + ldr w7, =FDT_MAGIC + cmp w7, w8 + b.eq booti_fdt +#endif + + /* Booted with modules pointer */ /* Find modulep - begin */ sub x8, x0, x6 /* Add two 2MiB pages for the module data and round up */ ldr x7, =(3 * L2_SIZE - 1) add x8, x8, x7 + b common + +#if defined(LINUX_BOOT_ABI) +booti_fdt: + /* Booted by U-Boot booti with FDT data */ + /* Set 'map FDT data' flag */ + mov x19, #1 + +booti_no_fdt: + /* Booted by U-Boot booti without FTD data */ + /* Find the end - begin */ + ldr x7, .Lend + sub x8, x7, x6 + + /* + * Add one 2MiB page for copy of FDT data (maximum FDT size), + * one for metadata and round up + */ + ldr x7, =(3 * L2_SIZE - 1) + add x8, x8, x7 +#endif + +common: /* Get the number of l2 pages to allocate, rounded down */ lsr x10, x8, #(L2_SHIFT) @@ -404,9 +476,21 @@ create_pagetables: bl build_l1_block_pagetable #endif - /* - * Create the VA = PA map - */ +#if defined(LINUX_BOOT_ABI) + /* Map FDT data ? */ + cbz x19, 1f + + /* Create the identity mapping for FDT data (2 MiB max) */ + mov x7, #(ATTR_nG | ATTR_IDX(VM_MEMATTR_UNCACHEABLE)) + mov x9, x0 + mov x8, x0 /* VA start (== PA start) */ + mov x10, #1 + bl build_l1_block_pagetable + +1: +#endif + + /* Create the VA = PA map */ mov x7, #(ATTR_nG | ATTR_IDX(VM_MEMATTR_UNCACHEABLE)) mov x9, x27 mov x8, x9 /* VA start (== PA start) */ Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sat Dec 7 15:17:00 2019 (r355486) +++ head/sys/arm64/arm64/machdep.c Sat Dec 7 16:14:23 2019 (r355487) @@ -964,6 +964,15 @@ try_load_dtb(caddr_t kmdp) vm_offset_t dtbp; dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); +#if defined(FDT_DTB_STATIC) + /* + * In case the device tree blob was not retrieved (from metadata) try + * to use the statically embedded one. + */ + if (dtbp == 0) + dtbp = (vm_offset_t)&fdt_static_dtb; +#endif + if (dtbp == (vm_offset_t)NULL) { printf("ERROR loading DTB\n"); return; @@ -974,6 +983,8 @@ try_load_dtb(caddr_t kmdp) if (OF_init((void *)dtbp) != 0) panic("OF_init failed with the found device tree"); + + parse_fdt_bootargs(); } #endif @@ -1082,26 +1093,18 @@ initarm(struct arm64_bootparams *abp) caddr_t kmdp; bool valid; - /* Set the module data location */ - preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); + /* Parse loader or FDT boot parametes. Determine last used address. */ + lastaddr = parse_boot_param(abp); /* Find the kernel address */ kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); - boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); - init_static_kenv(MD_FETCH(kmdp, MODINFOMD_ENVP, char *), 0); link_elf_ireloc(kmdp); - -#ifdef FDT try_load_dtb(kmdp); -#endif efi_systbl_phys = MD_FETCH(kmdp, MODINFOMD_FW_HANDLE, vm_paddr_t); - - /* Find the address to start allocating from */ - lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); /* Load the physical memory ranges */ efihdr = (struct efi_map_header *)preload_search_info(kmdp, Added: head/sys/arm64/arm64/machdep_boot.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/arm64/machdep_boot.c Sat Dec 7 16:14:23 2019 (r355487) @@ -0,0 +1,254 @@ +/*- + * Copyright (c) 2004 Olivier Houchard + * Copyright (c) 1994-1998 Mark Brinicombe. + * Copyright (c) 1994 Brini. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#ifdef FDT +#include +#endif + +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#endif + +extern int *end; +static char *loader_envp; +static char static_kenv[4096]; + + +#ifdef FDT +#define CMDLINE_GUARD "FreeBSD:" +#define LBABI_MAX_COMMAND_LINE 512 +static char linux_command_line[LBABI_MAX_COMMAND_LINE + 1]; +#endif + +/* + * Fake up a boot descriptor table + */ + #define PRELOAD_PUSH_VALUE(type, value) do { \ + *(type *)(preload_ptr + size) = (value); \ + size += sizeof(type); \ +} while (0) + + #define PRELOAD_PUSH_STRING(str) do { \ + uint32_t ssize; \ + ssize = strlen(str) + 1; \ + PRELOAD_PUSH_VALUE(uint32_t, ssize); \ + strcpy((char*)(preload_ptr + size), str); \ + size += ssize; \ + size = roundup(size, sizeof(u_long)); \ +} while (0) + + +/* Build minimal set of metatda. */ +static vm_offset_t +fake_preload_metadata(void *dtb_ptr, size_t dtb_size) +{ +#ifdef DDB + vm_offset_t zstart = 0, zend = 0; +#endif + vm_offset_t lastaddr; + static char fake_preload[256]; + caddr_t preload_ptr; + size_t size; + + preload_ptr = (caddr_t)&fake_preload[0]; + size = 0; + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_NAME); + PRELOAD_PUSH_STRING("kernel"); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_TYPE); + PRELOAD_PUSH_STRING("elf kernel"); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_ADDR); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); + PRELOAD_PUSH_VALUE(uint64_t, VM_MIN_KERNEL_ADDRESS); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_SIZE); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(size_t)); + PRELOAD_PUSH_VALUE(uint64_t, (size_t)(&end - VM_MIN_KERNEL_ADDRESS)); +#ifdef DDB + if (*(uint64_t *)VM_MIN_KERNEL_ADDRESS == MAGIC_TRAMP_NUMBER) { + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA|MODINFOMD_SSYM); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); + PRELOAD_PUSH_VALUE(uint64_t, + *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 4)); + + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA | MODINFOMD_ESYM); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(vm_offset_t)); + PRELOAD_PUSH_VALUE(uint64_t, + *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 8)); + + lastaddr = *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 8); + zend = lastaddr; + zstart = *(uint64_t *)(VM_MIN_KERNEL_ADDRESS + 4); + db_fetch_ksymtab(zstart, zend); + } else +#endif + lastaddr = (vm_offset_t)&end; + if (dtb_ptr != NULL) { + /* Copy DTB to KVA space and insert it into module chain. */ + lastaddr = roundup(lastaddr, sizeof(int)); + PRELOAD_PUSH_VALUE(uint32_t, MODINFO_METADATA | MODINFOMD_DTBP); + PRELOAD_PUSH_VALUE(uint32_t, sizeof(uint64_t)); + PRELOAD_PUSH_VALUE(uint64_t, (uint64_t)lastaddr); + memmove((void *)lastaddr, dtb_ptr, dtb_size); + lastaddr += dtb_size; + lastaddr = roundup(lastaddr, sizeof(int)); + } + /* End marker */ + PRELOAD_PUSH_VALUE(uint32_t, 0); + PRELOAD_PUSH_VALUE(uint32_t, 0); + + preload_metadata = (caddr_t)(uintptr_t)fake_preload; + + init_static_kenv(NULL, 0); + + return (lastaddr); +} + +#ifdef FDT + +/* Convert the U-Boot command line into FreeBSD kenv and boot options. */ +static void +cmdline_set_env(char *cmdline, const char *guard) +{ + size_t guard_len; + + /* Skip leading spaces. */ + while (isspace(*cmdline)) + cmdline++; + + /* Test and remove guard. */ + if (guard != NULL && guard[0] != '\0') { + guard_len = strlen(guard); + if (strncasecmp(cmdline, guard, guard_len) != 0) + return; + cmdline += guard_len; + } + + boothowto |= boot_parse_cmdline(cmdline); +} + +void +parse_fdt_bootargs(void) +{ + + if (loader_envp == NULL && fdt_get_chosen_bootargs(linux_command_line, + LBABI_MAX_COMMAND_LINE) == 0) { + init_static_kenv(static_kenv, sizeof(static_kenv)); + cmdline_set_env(linux_command_line, CMDLINE_GUARD); + } +} + +#endif + +#if defined(LINUX_BOOT_ABI) && defined(FDT) +static vm_offset_t +linux_parse_boot_param(struct arm64_bootparams *abp) +{ + struct fdt_header *dtb_ptr; + size_t dtb_size; + + if (abp->modulep == 0) + return (0); + /* Test if modulep point to valid DTB. */ + dtb_ptr = (struct fdt_header *)abp->modulep; + if (fdt_check_header(dtb_ptr) != 0) + return (0); + dtb_size = fdt_totalsize(dtb_ptr); + return (fake_preload_metadata(dtb_ptr, dtb_size)); +} + +#endif + +static vm_offset_t +freebsd_parse_boot_param(struct arm64_bootparams *abp) +{ + vm_offset_t lastaddr = 0; + void *kmdp; +#ifdef DDB + vm_offset_t ksym_start; + vm_offset_t ksym_end; +#endif + + if (abp->modulep == 0) + return (0); + + preload_metadata = (caddr_t)(uintptr_t)(abp->modulep); + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + return (0); + + boothowto = MD_FETCH(kmdp, MODINFOMD_HOWTO, int); + loader_envp = MD_FETCH(kmdp, MODINFOMD_ENVP, char *); + init_static_kenv(static_kenv, 0); + lastaddr = MD_FETCH(kmdp, MODINFOMD_KERNEND, vm_offset_t); +#ifdef DDB + ksym_start = MD_FETCH(kmdp, MODINFOMD_SSYM, uintptr_t); + ksym_end = MD_FETCH(kmdp, MODINFOMD_ESYM, uintptr_t); + db_fetch_ksymtab(ksym_start, ksym_end); +#endif + return (lastaddr); +} + +vm_offset_t +parse_boot_param(struct arm64_bootparams *abp) +{ + vm_offset_t lastaddr; + +#if defined(LINUX_BOOT_ABI) && defined(FDT) + lastaddr = linux_parse_boot_param(abp); + if (lastaddr != 0) + return (lastaddr); +#endif + lastaddr = freebsd_parse_boot_param(abp); + if (lastaddr != 0) + return (lastaddr); + + /* Fall back to hardcoded metadata. */ + lastaddr = fake_preload_metadata(NULL, 0); + + return (lastaddr); +} Modified: head/sys/arm64/include/machdep.h ============================================================================== --- head/sys/arm64/include/machdep.h Sat Dec 7 15:17:00 2019 (r355486) +++ head/sys/arm64/include/machdep.h Sat Dec 7 16:14:23 2019 (r355487) @@ -47,6 +47,10 @@ extern enum arm64_bus arm64_bus_method; void dbg_init(void); void initarm(struct arm64_bootparams *); +vm_offset_t parse_boot_param(struct arm64_bootparams *abp); +#ifdef FDT +void parse_fdt_bootargs(void); +#endif extern void (*pagezero)(void *); #endif /* _MACHINE_MACHDEP_H_ */ Modified: head/sys/conf/Makefile.arm64 ============================================================================== --- head/sys/conf/Makefile.arm64 Sat Dec 7 15:17:00 2019 (r355486) +++ head/sys/conf/Makefile.arm64 Sat Dec 7 16:14:23 2019 (r355487) @@ -27,10 +27,24 @@ S= ../../.. INCLUDES+= -I$S/contrib/libfdt +#SYSTEM_LD:= ${SYSTEM_LD:$S/conf/ldscript.$M=ldscript.$M} +#SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/ldscript.$M=ldscript.$M} + .if !empty(DDB_ENABLED) CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer .endif +SYSTEM_LD_ = ${LD} -m ${LD_EMULATION} -Bdynamic -T ldscript.$M.noheader \ + ${_LDFLAGS} --no-warn-mismatch --warn-common --export-dynamic \ + --dynamic-linker /red/herring \ + -o ${FULLKERNEL}.noheader -X ${SYSTEM_OBJS} vers.o +SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADERS"// $(LDSCRIPT)\ + >ldscript.$M.noheader;\ + ${SYSTEM_LD_}; \ + ${OBJCOPY} -S -O binary ${FULLKERNEL}.noheader \ + ${KERNEL_KO}.bin; \ + rm ${FULLKERNEL}.noheader + %BEFORE_DEPEND %OBJS @@ -42,6 +56,7 @@ CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame %FILES.m %CLEAN +CLEAN+= ldscript.$M ${KERNEL_KO}.bin ldscript.$M.noheader %RULES Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sat Dec 7 15:17:00 2019 (r355486) +++ head/sys/conf/files.arm64 Sat Dec 7 16:14:23 2019 (r355487) @@ -156,6 +156,7 @@ arm64/arm64/identcpu.c standard arm64/arm64/in_cksum.c optional inet | inet6 arm64/arm64/locore.S standard no-obj arm64/arm64/machdep.c standard +arm64/arm64/machdep_boot.c standard arm64/arm64/mem.c standard arm64/arm64/memcpy.S standard arm64/arm64/memmove.S standard Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Sat Dec 7 15:17:00 2019 (r355486) +++ head/sys/conf/options.arm64 Sat Dec 7 16:14:23 2019 (r355487) @@ -6,6 +6,7 @@ SOCDEV_PA opt_global.h SOCDEV_VA opt_global.h THUNDERX_PASS_1_1_ERRATA opt_global.h VFP opt_global.h +LINUX_BOOT_ABI opt_global.h # Binary compatibility COMPAT_FREEBSD32 opt_global.h From owner-svn-src-all@freebsd.org Sat Dec 7 16:29:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68EEC1D649E; Sat, 7 Dec 2019 16:29:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VZg926mzz3wh8; Sat, 7 Dec 2019 16:29:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BE031C7A3; Sat, 7 Dec 2019 16:29:57 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7GTvdQ087158; Sat, 7 Dec 2019 16:29:57 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7GTvI7087157; Sat, 7 Dec 2019 16:29:57 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912071629.xB7GTvI7087157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 7 Dec 2019 16:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355488 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 355488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 16:29:57 -0000 Author: asomers Date: Sat Dec 7 16:29:56 2019 New Revision: 355488 URL: https://svnweb.freebsd.org/changeset/base/355488 Log: lio_listio(2): add a HISTORY section MFC after: 2 weeks Modified: head/lib/libc/sys/lio_listio.2 Modified: head/lib/libc/sys/lio_listio.2 ============================================================================== --- head/lib/libc/sys/lio_listio.2 Sat Dec 7 16:14:23 2019 (r355487) +++ head/lib/libc/sys/lio_listio.2 Sat Dec 7 16:29:56 2019 (r355488) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Oct 23, 2017 +.Dd Dec 7, 2019 .Dt LIO_LISTIO 2 .Os .Sh NAME @@ -216,3 +216,8 @@ The .Fn lio_listio function is expected to conform to .St -p1003.1-2001 . +.Sh HISTORY +The +.Fn lio_listio +system call first appeared in +.Fx 3.0 . From owner-svn-src-all@freebsd.org Sat Dec 7 16:45:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AF441D69A0; Sat, 7 Dec 2019 16:45:13 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vb0m6QX2z3xQY; Sat, 7 Dec 2019 16:45:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C11CB1CB18; Sat, 7 Dec 2019 16:45:12 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7GjCpT098705; Sat, 7 Dec 2019 16:45:12 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7GjCDr098704; Sat, 7 Dec 2019 16:45:12 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201912071645.xB7GjCDr098704@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 7 Dec 2019 16:45:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355489 - head/lib/libc/sys X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libc/sys X-SVN-Commit-Revision: 355489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 16:45:13 -0000 Author: asomers Date: Sat Dec 7 16:45:12 2019 New Revision: 355489 URL: https://svnweb.freebsd.org/changeset/base/355489 Log: clock_gettime(2): add a HISTORY section MFC after: 2 weeks Modified: head/lib/libc/sys/clock_gettime.2 Modified: head/lib/libc/sys/clock_gettime.2 ============================================================================== --- head/lib/libc/sys/clock_gettime.2 Sat Dec 7 16:29:56 2019 (r355488) +++ head/lib/libc/sys/clock_gettime.2 Sat Dec 7 16:45:12 2019 (r355489) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 20, 2017 +.Dd December 7, 2019 .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -174,3 +174,11 @@ The clock IDs .Fa CLOCK_UPTIME_PRECISE , .Fa CLOCK_SECOND are FreeBSD extensions to the POSIX interface. +.Sh HISTORY +The +.Fn clock_gettime , +.Fn clock_settime , +and +.Fn clock_getres +system calls first appeared in +.Fx 3.0 . From owner-svn-src-all@freebsd.org Sat Dec 7 17:10:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 739431D727A; Sat, 7 Dec 2019 17:10:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VbYT2lBmz3yWT; Sat, 7 Dec 2019 17:10:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D7DD1CED0; Sat, 7 Dec 2019 17:10:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HA5TV011185; Sat, 7 Dec 2019 17:10:05 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HA4ap011179; Sat, 7 Dec 2019 17:10:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071710.xB7HA4ap011179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:10: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: r355490 - in stable/12: share/man/man4 sys/dev/gpio sys/dev/ofw X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/gpio sys/dev/ofw X-SVN-Commit-Revision: 355490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:10:05 -0000 Author: ian Date: Sat Dec 7 17:10:03 2019 New Revision: 355490 URL: https://svnweb.freebsd.org/changeset/base/355490 Log: MFC r355214, r355239, r355274, r355276-r355277, r355295, r355298 r355214: Ignore "gpio-hog" nodes when instantiating ofw_gpiobus children. Also, in ofw_gpiobus_probe() return BUS_PROBE_DEFAULT rather than 0; we are not the only possible driver to handle this device, we're just slightly better than the base gpiobus (which probes at BUS_PROBE_GENERIC). In the time since this code was first written, the gpio controller bindings aquired the concept of a "hog" node which could be used to preset one or more gpio pins as input or output at a specified level. This change doesn't fully implement the hogging concept, it just filters out hog nodes when instantiating child devices by scanning for child nodes in the fdt data. The whole concept of having child nodes under the controller node is not supported by the standard bindings, and appears to be a freebsd extension, probably left over from the days when we had no support for cross-tree phandle references in the fdt data. r355239: Add an OFWBUS_PNP_INFO() macro for devices that hang directly off the root ofwbus. Also, apply some style(9) whitespace fixing to the SIMPLEBUS_PNP_INFO() macro (no functional change). r355274: Move most of the gpio_pin_* functions from ofw_gpiobus.c to gpiobus.c so that they can be used by drivers on non-FDT-configured systems. Only the functions related to acquiring pins by parsing FDT data remain in ofw_gpiobus. Also, add two new functions for acquiring gpio pins based on child device_t and index, or on the bus device_t and pin number. And finally, defer reserving pins for gpiobus children until they acquire the pin, rather than reserving them as soon as the child is added (before it's even known whether the child will attach). This will allow drivers configured with hints (or any other mechanism) to use the same code as drivers configured via FDT data. Until now, a hinted driver and an FDT driver had to be two completely different sets of code, because hinted drivers could only use gpiobus calls to manipulate pins, while fdt-configured drivers could not use that API (due to not always being children of the bus that owns the pins) and had to use the newer gpio_pin_xxxx() functions. Now drivers can be written in the more traditional form, where most of the code is shared and only the resource acquisition code at attachment time changes. r355276: Rewrite gpioiic(4) to use the gpio_pin_* API, and to conform to the modern FDT bindings document for gpio-i2c devices. Using the gpio_pin_* functions to acquire/release/manipulate gpio pins removes the constraint that both gpio pins must belong to the same gpio controller/bank, and that the gpioiic instance must be a child of gpiobus. Removing those constraints allows the driver to be fully compatible with the modern dts bindings for a gpio bitbanged i2c bus. For hinted attachment, the two gpio pins still must be on the same gpiobus, and the device instance must be a child of that bus. This preserves compatibility for existing installations that have use gpioiic(4) with hints. r355277: Fix leading whitespace (spaces->tabs) in comments; no functional change. r355295: Remove "all rights reserved" from copyright after getting a response from Luiz that he also was not intentionally asserting that right, it was already there when he added his name. r355298: Do not initialize the flags field in struct gpiobus_pin from the flags in struct gpio_pin. It turns out these two sets of flags are completely unrelated to each other. Also, update the comment for GPIO_ACTIVE_LOW to reflect the fact that it does get set, somewhat unobviously, by code that parses FDT data. The bits from the FDT cell containing flags are just copied to gpiobus_pin.flags, so there's never any obvious reference to the symbol GPIO_ACTIVE_LOW being stored into the flags field. Modified: stable/12/share/man/man4/gpioiic.4 stable/12/sys/dev/gpio/gpiobus.c stable/12/sys/dev/gpio/gpiobusvar.h stable/12/sys/dev/gpio/gpioiic.c stable/12/sys/dev/gpio/ofw_gpiobus.c stable/12/sys/dev/ofw/ofw_bus_subr.h Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/gpioiic.4 ============================================================================== --- stable/12/share/man/man4/gpioiic.4 Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/share/man/man4/gpioiic.4 Sat Dec 7 17:10:03 2019 (r355490) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 2014 +.Dd December 1, 2019 .Dt GPIOIIC 4 .Os .Sh NAME @@ -37,38 +37,42 @@ kernel configuration file: .Bd -ragged -offset indent .Cd "device gpio" .Cd "device gpioiic" -.Cd "device iic" .Cd "device iicbb" .Cd "device iicbus" .Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +gpioiic_load="YES" +.Ed .Sh DESCRIPTION The .Nm driver provides an IIC bit-banging interface using two GPIO pins for the -SCL and SDA on the -.Nm gpiobus . +SCL and SDA lines on the bus. +.Pp .Nm -implements an open collector kind of output, as recommended by the standard, -when driving the pins on the -.Nm gpiobus , -i.e, they are never switched to the logical value of '1', -or they are '0' or simply open (Hi-Z/tri-state). -So the pullup resistors are required so -.Nm -can work. +simulates an open collector kind of output when managing the pins on the +bus, even on systems which don't directly support configuring gpio pins +in that mode. +The pins are never driven to the logical value of '1'. +They are driven to '0' or switched to input mode (Hi-Z/tri-state), and +an external pullup resistor pulls the line to the 1 state unless some +other device on the bus is driving it to 0. .Pp +.Sh HINTS CONFIGURATION On a .Xr device.hints 5 -based system, like -.Li MIPS , -these values are configurable for the +based system, such as MIPS, these values are configurable for .Nm : .Bl -tag -width ".Va hint.gpioiic.%d.atXXX" .It Va hint.gpioiic.%d.at The .Nm gpiobus you are attaching to. -Normally just gpiobus0. +Normally just gpiobus0 on systems with a single bank of gpio pins. .It Va hint.gpioiic.%d.pins This is a bitmask of the pins on the .Nm gpiobus @@ -78,6 +82,9 @@ To configure pin 0 and 7, use the bitmask of 0b10000001 and convert it to a hexadecimal value of 0x0081. Please note that this mask should only ever have two bits set (any other bits - i.e., pins - will be ignored). +Because +.Nm +must be a child of the gpiobus, both gpio pins must be part of that bus. .It Va hint.gpioiic.%d.scl Indicates which bit in the .Va hint.gpioiic.%d.pins @@ -91,35 +98,32 @@ should be used as the SDATA source. Optional, defaults to 1. .El -.Pp -On a +.Sh FDT CONFIGURATION +On an .Xr FDT 4 -based system, like -.Li ARM , -the DTS part for a +based system, such as ARM, the DTS node for .Nm gpioiic -device usually looks like: +conforms to the standard bindings document i2c/i2c-gpio.yaml. +The device node typically appears at the root of the device tree. +The following is an example of a +.Nm +node with one slave device +on the IIC bus: .Bd -literal -gpio: gpio { - - gpio-controller; - ... - +/ { gpioiic0 { - compatible = "gpioiic"; - /* - * Attach to GPIO pins 21 and 22. Set them - * initially as inputs. - */ - gpios = <&gpio 21 1 0 - &gpio 22 1 0>; - scl = <0>; /* GPIO pin 21 - optional */ - sda = <1>; /* GPIO pin 22 - optional */ + compatible = "i2c-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpioiic0>; + scl-gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; + sda-gpios = <&gpio7 11 GPIO_ACTIVE_HIGH>; + status = "okay"; - /* This is an example of a gpioiic child. */ - gpioiic-child0 { - compatible = "lm75"; - i2c-address = <0x4f>; + /* One slave device on the i2c bus. */ + rtc@51 { + compatible="nxp,pcf2127"; + reg = <0x51>; + status = "okay"; }; }; }; @@ -128,35 +132,19 @@ gpio: gpio { Where: .Bl -tag -width ".Va compatible" .It Va compatible -Should always be set to "gpioiic". -.It Va gpios -The -.Va gpios -property indicates which GPIO pins should be used for SCLOCK and SDATA -on the GPIO IIC bit-banging bus. -For more details about the -.Va gpios -property, please consult -.Pa /usr/src/sys/dts/bindings-gpio.txt . -.It Va scl -The -.Va scl -option indicates which bit in the -.Va gpios -should be used as the SCLOCK source. -Optional, defaults to 0. -.It Va sda -The -.Va sda -option indicates which bit in the -.Va gpios -should be used as the SDATA source. -Optional, defaults to 1. +Should be set to "i2c-gpio". +The deprecated string "gpioiic" is also accepted for backwards compatibility. +.It Va scl-gpios Va sda-gpios +These properties indicate which GPIO pins should be used for clock +and data on the GPIO IIC bit-banging bus. +There is no requirement that the two pins belong to the same gpio controller. +.It Va pinctrl-names pinctrl-0 +These properties may be required to configure the chosen pins as gpio +pins, unless the pins default to that state on your system. .El .Sh SEE ALSO .Xr fdt 4 , .Xr gpio 4 , -.Xr gpioled 4 , .Xr iic 4 , .Xr iicbb 4 , .Xr iicbus 4 Modified: stable/12/sys/dev/gpio/gpiobus.c ============================================================================== --- stable/12/sys/dev/gpio/gpiobus.c Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/gpiobus.c Sat Dec 7 17:10:03 2019 (r355490) @@ -78,6 +78,18 @@ static int gpiobus_pin_get(device_t, device_t, uint32_ static int gpiobus_pin_toggle(device_t, device_t, uint32_t); /* + * gpiobus_pin flags + * The flags in struct gpiobus_pin are not related to the flags used by the + * low-level controller driver in struct gpio_pin. Currently, only pins + * acquired via FDT data have gpiobus_pin.flags set, sourced from the flags in + * the FDT properties. In theory, these flags are defined per-platform. In + * practice they are always the flags from the dt-bindings/gpio/gpio.h file. + * The only one of those flags we currently support is for handling active-low + * pins, so we just define that flag here instead of including a GPL'd header. + */ +#define GPIO_ACTIVE_LOW 1 + +/* * XXX -> Move me to better place - gpio_subr.c? * Also, this function must be changed when interrupt configuration * data will be moved into struct resource. @@ -135,6 +147,114 @@ gpio_check_flags(uint32_t caps, uint32_t flags) return (0); } +int +gpio_pin_get_by_bus_pinnum(device_t busdev, uint32_t pinnum, gpio_pin_t *ppin) +{ + gpio_pin_t pin; + int err; + + err = gpiobus_acquire_pin(busdev, pinnum); + if (err != 0) + return (EBUSY); + + pin = malloc(sizeof(*pin), M_DEVBUF, M_WAITOK | M_ZERO); + + pin->dev = device_get_parent(busdev); + pin->pin = pinnum; + pin->flags = 0; + + *ppin = pin; + return (0); +} + +int +gpio_pin_get_by_child_index(device_t childdev, uint32_t idx, gpio_pin_t *ppin) +{ + struct gpiobus_ivar *devi; + + devi = GPIOBUS_IVAR(childdev); + if (idx >= devi->npins) + return (EINVAL); + + return (gpio_pin_get_by_bus_pinnum(device_get_parent(childdev), + devi->pins[idx], ppin)); +} + +int +gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps) +{ + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps)); +} + +int +gpio_pin_is_active(gpio_pin_t pin, bool *active) +{ + int rv; + uint32_t tmp; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + rv = GPIO_PIN_GET(pin->dev, pin->pin, &tmp); + if (rv != 0) { + return (rv); + } + + if (pin->flags & GPIO_ACTIVE_LOW) + *active = tmp == 0; + else + *active = tmp != 0; + return (0); +} + +void +gpio_pin_release(gpio_pin_t gpio) +{ + device_t busdev; + + if (gpio == NULL) + return; + + KASSERT(gpio->dev != NULL, ("GPIO pin device is NULL.")); + + busdev = GPIO_GET_BUS(gpio->dev); + if (busdev != NULL) + gpiobus_release_pin(busdev, gpio->pin); + + free(gpio, M_DEVBUF); +} + +int +gpio_pin_set_active(gpio_pin_t pin, bool active) +{ + int rv; + uint32_t tmp; + + if (pin->flags & GPIO_ACTIVE_LOW) + tmp = active ? 0 : 1; + else + tmp = active ? 1 : 0; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + rv = GPIO_PIN_SET(pin->dev, pin->pin, tmp); + return (rv); +} + +int +gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) +{ + int rv; + + KASSERT(pin != NULL, ("GPIO pin is NULL.")); + KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); + + rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags); + return (rv); +} + static void gpiobus_print_pins(struct gpiobus_ivar *devi, char *buf, size_t buflen) { @@ -370,8 +490,6 @@ gpiobus_parse_pins(struct gpiobus_softc *sc, device_t devi->pins[npins++] = i; } - if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) - return (EINVAL); return (0); } @@ -425,8 +543,6 @@ gpiobus_parse_pin_list(struct gpiobus_softc *sc, devic p = endp + 1; } - if (gpiobus_acquire_child_pins(sc->sc_busdev, child) != 0) - return (EINVAL); return (0); } Modified: stable/12/sys/dev/gpio/gpiobusvar.h ============================================================================== --- stable/12/sys/dev/gpio/gpiobusvar.h Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/gpiobusvar.h Sat Dec 7 17:10:03 2019 (r355490) @@ -141,7 +141,7 @@ int ofw_gpiobus_parse_gpios(device_t, char *, struct g void ofw_gpiobus_register_provider(device_t); void ofw_gpiobus_unregister_provider(device_t); -/* Consumers interface. */ +/* Acquire a pin by parsing FDT data. */ int gpio_pin_get_by_ofw_name(device_t consumer, phandle_t node, char *name, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_idx(device_t consumer, phandle_t node, @@ -150,14 +150,29 @@ int gpio_pin_get_by_ofw_property(device_t consumer, ph char *name, gpio_pin_t *gpio); int gpio_pin_get_by_ofw_propidx(device_t consumer, phandle_t node, char *name, int idx, gpio_pin_t *gpio); +#endif /* FDT */ + +/* Acquire a pin by bus and pin number. */ +int gpio_pin_get_by_bus_pinnum(device_t _bus, uint32_t _pinnum, gpio_pin_t *_gp); + +/* Acquire a pin by child and index (used by direct children of gpiobus). */ +int gpio_pin_get_by_child_index(device_t _child, uint32_t _idx, gpio_pin_t *_gp); + +/* Release a pin acquired via any gpio_pin_get_xxx() function. */ void gpio_pin_release(gpio_pin_t gpio); + +/* Work with gpio pins acquired using the functions above. */ int gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps); int gpio_pin_is_active(gpio_pin_t pin, bool *active); int gpio_pin_set_active(gpio_pin_t pin, bool active); int gpio_pin_setflags(gpio_pin_t pin, uint32_t flags); -#endif struct resource *gpio_alloc_intr_resource(device_t consumer_dev, int *rid, u_int alloc_flags, gpio_pin_t pin, uint32_t intr_mode); + +/* + * Functions shared between gpiobus and other bus classes that derive from it; + * these should not be called directly by other drivers. + */ int gpio_check_flags(uint32_t, uint32_t); device_t gpiobus_attach_bus(device_t); int gpiobus_detach_bus(device_t); Modified: stable/12/sys/dev/gpio/gpioiic.c ============================================================================== --- stable/12/sys/dev/gpio/gpioiic.c Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/gpioiic.c Sat Dec 7 17:10:03 2019 (r355490) @@ -1,9 +1,9 @@ /*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * SPDX-License-Identifier: BSD-2-Clause * * Copyright (c) 2009 Oleksandr Tymoshenko * Copyright (c) 2010 Luiz Otavio O Souza - * All rights reserved. + * Copyright (c) 2019 Ian Lepore * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,14 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef FDT -#include -#include -#endif - #include #include -#include #include "gpiobus_if.h" #include "iicbb_if.h" @@ -57,200 +51,281 @@ __FBSDID("$FreeBSD$"); struct gpioiic_softc { - device_t sc_dev; - device_t sc_busdev; - int scl_pin; - int sda_pin; + device_t dev; + gpio_pin_t sclpin; + gpio_pin_t sdapin; }; -static int gpioiic_probe(device_t); -static int gpioiic_attach(device_t); +#ifdef FDT -/* iicbb interface */ -static void gpioiic_reset_bus(device_t); -static void gpioiic_setsda(device_t, int); -static void gpioiic_setscl(device_t, int); -static int gpioiic_getsda(device_t); -static int gpioiic_getscl(device_t); -static int gpioiic_reset(device_t, u_char, u_char, u_char *); +#include +static struct ofw_compat_data compat_data[] = { + {"i2c-gpio", true}, /* Standard devicetree compat string */ + {"gpioiic", true}, /* Deprecated old freebsd compat string */ + {NULL, false} +}; +OFWBUS_PNP_INFO(compat_data); +SIMPLEBUS_PNP_INFO(compat_data); + +static phandle_t +gpioiic_get_node(device_t bus, device_t dev) +{ + + /* Share our fdt node with iicbus so it can find its child nodes. */ + return (ofw_bus_get_node(bus)); +} + static int -gpioiic_probe(device_t dev) +gpioiic_setup_fdt_pins(struct gpioiic_softc *sc) { - struct gpiobus_ivar *devi; + phandle_t node; + int err; -#ifdef FDT - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - if (!ofw_bus_is_compatible(dev, "gpioiic")) - return (ENXIO); -#endif - devi = GPIOBUS_IVAR(dev); - if (devi->npins < GPIOIIC_MIN_PINS) { - device_printf(dev, - "gpioiic needs at least %d GPIO pins (only %d given).\n", - GPIOIIC_MIN_PINS, devi->npins); - return (ENXIO); - } - device_set_desc(dev, "GPIO I2C bit-banging driver"); + node = ofw_bus_get_node(sc->dev); - return (BUS_PROBE_DEFAULT); + /* + * Historically, we used the first two array elements of the gpios + * property. The modern bindings specify separate scl-gpios and + * sda-gpios properties. We cope with whichever is present. + */ + if (OF_hasprop(node, "gpios")) { + if ((err = gpio_pin_get_by_ofw_idx(sc->dev, node, + GPIOIIC_SCL_DFLT, &sc->sclpin)) != 0) { + device_printf(sc->dev, "invalid gpios property\n"); + return (err); + } + if ((err = gpio_pin_get_by_ofw_idx(sc->dev, node, + GPIOIIC_SDA_DFLT, &sc->sdapin)) != 0) { + device_printf(sc->dev, "ivalid gpios property\n"); + return (err); + } + } else { + if ((err = gpio_pin_get_by_ofw_property(sc->dev, node, + "scl-gpios", &sc->sclpin)) != 0) { + device_printf(sc->dev, "missing scl-gpios property\n"); + return (err); + } + if ((err = gpio_pin_get_by_ofw_property(sc->dev, node, + "sda-gpios", &sc->sdapin)) != 0) { + device_printf(sc->dev, "missing sda-gpios property\n"); + return (err); + } + } + return (0); } +#endif /* FDT */ static int -gpioiic_attach(device_t dev) +gpioiic_setup_hinted_pins(struct gpioiic_softc *sc) { - device_t bitbang; -#ifdef FDT - phandle_t node; - pcell_t pin; -#endif - struct gpiobus_ivar *devi; - struct gpioiic_softc *sc; + device_t busdev; + const char *busname, *devname; + int err, numpins, sclnum, sdanum, unit; - sc = device_get_softc(dev); - sc->sc_dev = dev; - sc->sc_busdev = device_get_parent(dev); - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "scl", &sc->scl_pin)) - sc->scl_pin = GPIOIIC_SCL_DFLT; - if (resource_int_value(device_get_name(dev), - device_get_unit(dev), "sda", &sc->sda_pin)) - sc->sda_pin = GPIOIIC_SDA_DFLT; + devname = device_get_name(sc->dev); + unit = device_get_unit(sc->dev); + busdev = device_get_parent(sc->dev); + /* + * If there is not an "at" hint naming our actual parent, then we + * weren't instantiated as a child of gpiobus via hints, and we thus + * can't access ivars that only exist for such children. + */ + if (resource_string_value(devname, unit, "at", &busname) != 0 || + (strcmp(busname, device_get_nameunit(busdev)) != 0 && + strcmp(busname, device_get_name(busdev)) != 0)) { + return (ENOENT); + } + + /* Make sure there were hints for at least two pins. */ + numpins = gpiobus_get_npins(sc->dev); + if (numpins < GPIOIIC_MIN_PINS) { #ifdef FDT - if ((node = ofw_bus_get_node(dev)) == -1) - return (ENXIO); - if (OF_getencprop(node, "scl", &pin, sizeof(pin)) > 0) - sc->scl_pin = (int)pin; - if (OF_getencprop(node, "sda", &pin, sizeof(pin)) > 0) - sc->sda_pin = (int)pin; + /* + * Be silent when there are no hints on FDT systems; the FDT + * data will provide the pin config (we'll whine if it doesn't). + */ + if (numpins == 0) { + return (ENOENT); + } #endif + device_printf(sc->dev, + "invalid pins hint; it must contain at least %d pins\n", + GPIOIIC_MIN_PINS); + return (EINVAL); + } - if (sc->scl_pin < 0 || sc->scl_pin > 1) - sc->scl_pin = GPIOIIC_SCL_DFLT; - if (sc->sda_pin < 0 || sc->sda_pin > 1) - sc->sda_pin = GPIOIIC_SDA_DFLT; + /* + * Our parent bus has already parsed the pins hint and it will use that + * info when we call gpio_pin_get_by_child_index(). But we have to + * handle the scl/sda index hints that tell us which of the two pins is + * the clock and which is the data. They're optional, but if present + * they must be a valid index (0 <= index < numpins). + */ + if ((err = resource_int_value(devname, unit, "scl", &sclnum)) != 0) + sclnum = GPIOIIC_SCL_DFLT; + else if (sclnum < 0 || sclnum >= numpins) { + device_printf(sc->dev, "invalid scl hint %d\n", sclnum); + return (EINVAL); + } + if ((err = resource_int_value(devname, unit, "sda", &sdanum)) != 0) + sdanum = GPIOIIC_SDA_DFLT; + else if (sdanum < 0 || sdanum >= numpins) { + device_printf(sc->dev, "invalid sda hint %d\n", sdanum); + return (EINVAL); + } - devi = GPIOBUS_IVAR(dev); - device_printf(dev, "SCL pin: %d, SDA pin: %d\n", - devi->pins[sc->scl_pin], devi->pins[sc->sda_pin]); + /* Allocate gpiobus_pin structs for the pins we found above. */ + if ((err = gpio_pin_get_by_child_index(sc->dev, sclnum, + &sc->sclpin)) != 0) + return (err); + if ((err = gpio_pin_get_by_child_index(sc->dev, sdanum, + &sc->sdapin)) != 0) + return (err); - /* add generic bit-banging code */ - bitbang = device_add_child(dev, "iicbb", -1); - device_probe_and_attach(bitbang); - return (0); } -static int -gpioiic_detach(device_t dev) -{ - - bus_generic_detach(dev); - device_delete_children(dev); - return (0); -} - -/* - * Reset bus by setting SDA first and then SCL. - * Must always be called with gpio bus locked. - */ static void -gpioiic_reset_bus(device_t dev) +gpioiic_setsda(device_t dev, int val) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); + /* + * Some controllers cannot set an output value while a pin is in input + * mode; in that case we set the pin again after changing mode. + */ + err = gpio_pin_set_active(sc->sdapin, val); + gpio_pin_setflags(sc->sdapin, GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + if (err != 0) + gpio_pin_set_active(sc->sdapin, val); } static void -gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val) +gpioiic_setscl(device_t dev, int val) { - int err; + struct gpioiic_softc *sc = device_get_softc(dev); - if (val == 0) { - err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, - GPIO_PIN_OUTPUT); - - /* - * Some controllers cannot set output value while a pin is in - * input mode. - */ - if (err != 0) - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); - } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, - GPIO_PIN_INPUT); - } + gpio_pin_setflags(sc->sclpin, GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + gpio_pin_set_active(sc->sclpin, val); } -static void -gpioiic_setsda(device_t dev, int val) +static int +gpioiic_getscl(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + bool val; - gpioiic_setpin(sc, sc->sda_pin, val); + gpio_pin_setflags(sc->sclpin, GPIO_PIN_INPUT); + gpio_pin_is_active(sc->sclpin, &val); + return (val); } -static void -gpioiic_setscl(device_t dev, int val) +static int +gpioiic_getsda(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + struct gpioiic_softc *sc = device_get_softc(dev); + bool val; - gpioiic_setpin(sc, sc->scl_pin, val); + gpio_pin_setflags(sc->sdapin, GPIO_PIN_INPUT); + gpio_pin_is_active(sc->sdapin, &val); + return (val); } static int -gpioiic_getpin(struct gpioiic_softc *sc, int pin) +gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) { - unsigned int val; + struct gpioiic_softc *sc = device_get_softc(dev); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, &val); - return ((int)val); + /* Stop driving the bus pins. */ + gpio_pin_setflags(sc->sdapin, GPIO_PIN_INPUT); + gpio_pin_setflags(sc->sclpin, GPIO_PIN_INPUT); + + /* Indicate that we have no slave address (master mode). */ + return (IIC_ENOADDR); } -static int -gpioiic_getscl(device_t dev) +static void +gpioiic_cleanup(struct gpioiic_softc *sc) { - struct gpioiic_softc *sc = device_get_softc(dev); - return (gpioiic_getpin(sc, sc->scl_pin)); + device_delete_children(sc->dev); + + if (sc->sclpin != NULL) + gpio_pin_release(sc->sclpin); + + if (sc->sdapin != NULL) + gpio_pin_release(sc->sdapin); } static int -gpioiic_getsda(device_t dev) +gpioiic_probe(device_t dev) { - struct gpioiic_softc *sc = device_get_softc(dev); + int rv; - return (gpioiic_getpin(sc, sc->sda_pin)); + /* + * By default we only bid to attach if specifically added by our parent + * (usually via hint.gpioiic.#.at=busname). On FDT systems we bid as + * the default driver based on being configured in the FDT data. + */ + rv = BUS_PROBE_NOWILDCARD; + +#ifdef FDT + if (ofw_bus_status_okay(dev) && + ofw_bus_search_compatible(dev, compat_data)->ocd_data) + rv = BUS_PROBE_DEFAULT; +#endif + + device_set_desc(dev, "GPIO I2C"); + + return (rv); } static int -gpioiic_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr) +gpioiic_attach(device_t dev) { - struct gpioiic_softc *sc; + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - sc = device_get_softc(dev); - gpioiic_reset_bus(sc->sc_dev); + sc->dev = dev; - return (IIC_ENOADDR); + /* Acquire our gpio pins. */ + err = gpioiic_setup_hinted_pins(sc); +#ifdef FDT + if (err != 0) + err = gpioiic_setup_fdt_pins(sc); +#endif + if (err != 0) { + device_printf(sc->dev, "no pins configured\n"); + gpioiic_cleanup(sc); + return (ENXIO); + } + + /* Say what we came up with for pin config. */ + device_printf(dev, "SCL pin: %s:%d, SDA pin: %s:%d\n", + device_get_nameunit(GPIO_GET_BUS(sc->sclpin->dev)), sc->sclpin->pin, + device_get_nameunit(GPIO_GET_BUS(sc->sdapin->dev)), sc->sdapin->pin); + + /* Add the bitbang driver as our only child; it will add iicbus. */ + device_add_child(sc->dev, "iicbb", -1); + return (bus_generic_attach(dev)); } -#ifdef FDT -static phandle_t -gpioiic_get_node(device_t bus, device_t dev) +static int +gpioiic_detach(device_t dev) { + struct gpioiic_softc *sc = device_get_softc(dev); + int err; - /* We only have one child, the iicbb, which needs our own node. */ - return (ofw_bus_get_node(bus)); + if ((err = bus_generic_detach(dev)) != 0) + return (err); + + gpioiic_cleanup(sc); + + return (0); } -#endif static devclass_t gpioiic_devclass; @@ -282,6 +357,7 @@ static driver_t gpioiic_driver = { }; DRIVER_MODULE(gpioiic, gpiobus, gpioiic_driver, gpioiic_devclass, 0, 0); +DRIVER_MODULE(gpioiic, simplebus, gpioiic_driver, gpioiic_devclass, 0, 0); DRIVER_MODULE(iicbb, gpioiic, iicbb_driver, iicbb_devclass, 0, 0); MODULE_DEPEND(gpioiic, iicbb, IICBB_MINVER, IICBB_PREFVER, IICBB_MAXVER); MODULE_DEPEND(gpioiic, gpiobus, 1, 1, 1); Modified: stable/12/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- stable/12/sys/dev/gpio/ofw_gpiobus.c Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/gpio/ofw_gpiobus.c Sat Dec 7 17:10:03 2019 (r355490) @@ -43,8 +43,6 @@ __FBSDID("$FreeBSD$"); #include "gpiobus_if.h" -#define GPIO_ACTIVE_LOW 1 - static struct ofw_gpiobus_devinfo *ofw_gpiobus_setup_devinfo(device_t, device_t, phandle_t); static void ofw_gpiobus_destroy_devinfo(device_t, struct ofw_gpiobus_devinfo *); @@ -140,82 +138,6 @@ gpio_pin_get_by_ofw_name(device_t consumer, phandle_t return (gpio_pin_get_by_ofw_idx(consumer, node, idx, pin)); } -void -gpio_pin_release(gpio_pin_t gpio) -{ - device_t busdev; - - if (gpio == NULL) - return; - - KASSERT(gpio->dev != NULL, ("invalid pin state")); - - busdev = GPIO_GET_BUS(gpio->dev); - if (busdev != NULL) - gpiobus_release_pin(busdev, gpio->pin); - - /* XXXX Unreserve pin. */ - free(gpio, M_DEVBUF); -} - -int -gpio_pin_getcaps(gpio_pin_t pin, uint32_t *caps) -{ - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - return (GPIO_PIN_GETCAPS(pin->dev, pin->pin, caps)); -} - -int -gpio_pin_is_active(gpio_pin_t pin, bool *active) -{ - int rv; - uint32_t tmp; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - rv = GPIO_PIN_GET(pin->dev, pin->pin, &tmp); - if (rv != 0) { - return (rv); - } - - if (pin->flags & GPIO_ACTIVE_LOW) - *active = tmp == 0; - else - *active = tmp != 0; - return (0); -} - -int -gpio_pin_set_active(gpio_pin_t pin, bool active) -{ - int rv; - uint32_t tmp; - - if (pin->flags & GPIO_ACTIVE_LOW) - tmp = active ? 0 : 1; - else - tmp = active ? 1 : 0; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - rv = GPIO_PIN_SET(pin->dev, pin->pin, tmp); - return (rv); -} - -int -gpio_pin_setflags(gpio_pin_t pin, uint32_t flags) -{ - int rv; - - KASSERT(pin != NULL, ("GPIO pin is NULL.")); - KASSERT(pin->dev != NULL, ("GPIO pin device is NULL.")); - - rv = GPIO_PIN_SETFLAGS(pin->dev, pin->pin, flags); - return (rv); -} - /* * OFW_GPIOBUS driver. */ @@ -492,7 +414,7 @@ ofw_gpiobus_probe(device_t dev) return (ENXIO); device_set_desc(dev, "OFW GPIO bus"); - return (0); + return (BUS_PROBE_DEFAULT); } static int @@ -511,6 +433,8 @@ ofw_gpiobus_attach(device_t dev) */ for (child = OF_child(ofw_bus_get_node(dev)); child != 0; child = OF_peer(child)) { + if (OF_hasprop(child, "gpio-hog")) + continue; if (!OF_hasprop(child, "gpios")) continue; if (ofw_gpiobus_add_fdt_child(dev, NULL, child) == NULL) Modified: stable/12/sys/dev/ofw/ofw_bus_subr.h ============================================================================== --- stable/12/sys/dev/ofw/ofw_bus_subr.h Sat Dec 7 16:45:12 2019 (r355489) +++ stable/12/sys/dev/ofw/ofw_bus_subr.h Sat Dec 7 17:10:03 2019 (r355490) @@ -69,7 +69,8 @@ struct intr_map_data_fdt { #define FDTCOMPAT_PNP_INFO(t, busname) \ MODULE_PNP_INFO(FDTCOMPAT_PNP_DESCR, busname, t, t, sizeof(t) / sizeof(t[0])); -#define SIMPLEBUS_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, simplebus) +#define OFWBUS_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, ofwbus) +#define SIMPLEBUS_PNP_INFO(t) FDTCOMPAT_PNP_INFO(t, simplebus) /* Generic implementation of ofw_bus_if.m methods and helper routines */ int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *, phandle_t); From owner-svn-src-all@freebsd.org Sat Dec 7 17:14:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B64A1D7519; Sat, 7 Dec 2019 17:14:34 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vbff2Pprz403T; Sat, 7 Dec 2019 17:14:34 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 373621D088; Sat, 7 Dec 2019 17:14:34 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HEYpl016837; Sat, 7 Dec 2019 17:14:34 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HEXaD016835; Sat, 7 Dec 2019 17:14:33 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912071714.xB7HEXaD016835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sat, 7 Dec 2019 17:14:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355491 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355491 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:14:34 -0000 Author: dougm Date: Sat Dec 7 17:14:33 2019 New Revision: 355491 URL: https://svnweb.freebsd.org/changeset/base/355491 Log: Remove the next and prev fields from vm_map_entry, to save a bit of space. Where the vm_map tree now has null pointers, store pointers to next and previous entries in right and left fields, making the binary tree threaded. Have the predecessor and successor functions compute what the prev and next fields previously stored. Reviewed by: markj, kib (previous version) Tested by: pho (previous version) Differential Revision: https://reviews.freebsd.org/D21964 Modified: head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Dec 7 17:10:03 2019 (r355490) +++ head/sys/vm/vm_map.c Sat Dec 7 17:14:33 2019 (r355491) @@ -896,7 +896,6 @@ static void _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t min, vm_offset_t max) { - map->header.next = map->header.prev = &map->header; map->header.eflags = MAP_ENTRY_HEADER; map->needs_wakeup = FALSE; map->system_map = 0; @@ -904,6 +903,7 @@ _vm_map_init(vm_map_t map, pmap_t pmap, vm_offset_t mi map->header.end = min; map->header.start = max; map->flags = 0; + map->header.left = map->header.right = &map->header; map->root = NULL; map->timestamp = 0; map->busy = 0; @@ -977,7 +977,7 @@ static inline vm_size_t vm_map_entry_max_free_left(vm_map_entry_t root, vm_map_entry_t left_ancestor) { - return (root->left != NULL ? + return (root->left != left_ancestor ? root->left->max_free : root->start - left_ancestor->end); } @@ -985,7 +985,7 @@ static inline vm_size_t vm_map_entry_max_free_right(vm_map_entry_t root, vm_map_entry_t right_ancestor) { - return (root->right != NULL ? + return (root->right != right_ancestor ? root->right->max_free : right_ancestor->start - root->end); } @@ -994,16 +994,22 @@ vm_map_entry_max_free_right(vm_map_entry_t root, vm_ma * * Find the {predecessor, successor} of the entry by taking one step * in the appropriate direction and backtracking as much as necessary. + * vm_map_entry_succ is defined in vm_map.h. */ static inline vm_map_entry_t vm_map_entry_pred(vm_map_entry_t entry) { + vm_map_entry_t prior; - return (entry->prev); + prior = entry->left; + if (prior->right->start < entry->start) { + do + prior = prior->right; + while (prior->right != entry); + } + return (prior); } -/* vm_map_entry_succ is defined in vm_map.h. */ - static inline vm_size_t vm_size_max(vm_size_t a, vm_size_t b) { @@ -1011,7 +1017,8 @@ vm_size_max(vm_size_t a, vm_size_t b) return (a > b ? a : b); } -#define SPLAY_LEFT_STEP(root, y, rlist, test) do { \ +#define SPLAY_LEFT_STEP(root, y, llist, rlist, test) do { \ + vm_map_entry_t z; \ vm_size_t max_free; \ \ /* \ @@ -1023,16 +1030,20 @@ vm_size_max(vm_size_t a, vm_size_t b) max_free = root->max_free; \ KASSERT(max_free >= vm_map_entry_max_free_right(root, rlist), \ ("%s: max_free invariant fails", __func__)); \ - if (y == NULL ? max_free > 0 : max_free - 1 < y->max_free) \ + if (y == llist ? max_free > 0 : max_free - 1 < y->max_free) \ max_free = vm_map_entry_max_free_right(root, rlist); \ - if (y != NULL && (test)) { \ + if (y != llist && (test)) { \ /* Rotate right and make y root. */ \ - root->left = y->right; \ - y->right = root; \ - if (max_free < y->max_free) \ + z = y->right; \ + if (z != root) { \ + root->left = z; \ + y->right = root; \ + if (max_free < y->max_free) \ + root->max_free = max_free = \ + vm_size_max(max_free, z->max_free); \ + } else if (max_free < y->max_free) \ root->max_free = max_free = \ - vm_size_max(max_free, \ - vm_map_entry_max_free_left(root, y)); \ + vm_size_max(max_free, root->start - y->end);\ root = y; \ y = root->left; \ } \ @@ -1042,10 +1053,11 @@ vm_size_max(vm_size_t a, vm_size_t b) ("%s: max_free not copied from right", __func__)); \ root->left = rlist; \ rlist = root; \ - root = y; \ + root = y != llist ? y : NULL; \ } while (0) -#define SPLAY_RIGHT_STEP(root, y, llist, test) do { \ +#define SPLAY_RIGHT_STEP(root, y, llist, rlist, test) do { \ + vm_map_entry_t z; \ vm_size_t max_free; \ \ /* \ @@ -1057,16 +1069,20 @@ vm_size_max(vm_size_t a, vm_size_t b) max_free = root->max_free; \ KASSERT(max_free >= vm_map_entry_max_free_left(root, llist), \ ("%s: max_free invariant fails", __func__)); \ - if (y == NULL ? max_free > 0 : max_free - 1 < y->max_free) \ + if (y == rlist ? max_free > 0 : max_free - 1 < y->max_free) \ max_free = vm_map_entry_max_free_left(root, llist); \ - if (y != NULL && (test)) { \ + if (y != rlist && (test)) { \ /* Rotate left and make y root. */ \ - root->right = y->left; \ - y->left = root; \ - if (max_free < y->max_free) \ + z = y->left; \ + if (z != root) { \ + root->right = z; \ + y->left = root; \ + if (max_free < y->max_free) \ + root->max_free = max_free = \ + vm_size_max(max_free, z->max_free); \ + } else if (max_free < y->max_free) \ root->max_free = max_free = \ - vm_size_max(max_free, \ - vm_map_entry_max_free_right(root, y)); \ + vm_size_max(max_free, y->start - root->end);\ root = y; \ y = root->right; \ } \ @@ -1076,61 +1092,73 @@ vm_size_max(vm_size_t a, vm_size_t b) ("%s: max_free not copied from left", __func__)); \ root->right = llist; \ llist = root; \ - root = y; \ + root = y != rlist ? y : NULL; \ } while (0) /* - * Walk down the tree until we find addr or a NULL pointer where addr would go, - * breaking off left and right subtrees of nodes less than, or greater than - * addr. Treat pointers to nodes with max_free < length as NULL pointers. - * llist and rlist are the two sides in reverse order (bottom-up), with llist - * linked by the right pointer and rlist linked by the left pointer in the - * vm_map_entry, and both lists terminated by &map->header. This function, and - * the subsequent call to vm_map_splay_merge, rely on the start and end address + * Walk down the tree until we find addr or a gap where addr would go, breaking + * off left and right subtrees of nodes less than, or greater than addr. Treat + * subtrees with root->max_free < length as empty trees. llist and rlist are + * the two sides in reverse order (bottom-up), with llist linked by the right + * pointer and rlist linked by the left pointer in the vm_map_entry, and both + * lists terminated by &map->header. This function, and the subsequent call to + * vm_map_splay_merge_{left,right,pred,succ}, rely on the start and end address * values in &map->header. */ static __always_inline vm_map_entry_t vm_map_splay_split(vm_map_t map, vm_offset_t addr, vm_size_t length, vm_map_entry_t *llist, vm_map_entry_t *rlist) { - vm_map_entry_t root, y; + vm_map_entry_t left, right, root, y; - *llist = *rlist = &map->header; + left = right = &map->header; root = map->root; while (root != NULL && root->max_free >= length) { - KASSERT((*llist)->end <= root->start && - root->end <= (*rlist)->start, + KASSERT(left->end <= root->start && + root->end <= right->start, ("%s: root not within tree bounds", __func__)); if (addr < root->start) { - SPLAY_LEFT_STEP(root, y, *rlist, + SPLAY_LEFT_STEP(root, y, left, right, y->max_free >= length && addr < y->start); } else if (addr >= root->end) { - SPLAY_RIGHT_STEP(root, y, *llist, + SPLAY_RIGHT_STEP(root, y, left, right, y->max_free >= length && addr >= y->end); } else break; } + *llist = left; + *rlist = right; return (root); } static __always_inline void vm_map_splay_findnext(vm_map_entry_t root, vm_map_entry_t *rlist) { - vm_map_entry_t hi, y; + vm_map_entry_t hi, right, y; - hi = root->right; - while (hi != NULL) - SPLAY_LEFT_STEP(hi, y, *rlist, true); + right = *rlist; + hi = root->right == right ? NULL : root->right; + if (hi == NULL) + return; + do + SPLAY_LEFT_STEP(hi, y, root, right, true); + while (hi != NULL); + *rlist = right; } static __always_inline void vm_map_splay_findprev(vm_map_entry_t root, vm_map_entry_t *llist) { - vm_map_entry_t lo, y; + vm_map_entry_t left, lo, y; - lo = root->left; - while (lo != NULL) - SPLAY_RIGHT_STEP(lo, y, *llist, true); + left = *llist; + lo = root->left == left ? NULL : root->left; + if (lo == NULL) + return; + do + SPLAY_RIGHT_STEP(lo, y, left, root, true); + while (lo != NULL); + *llist = left; } static inline void @@ -1178,9 +1206,10 @@ vm_map_splay_merge_pred(vm_map_entry_t header, vm_map_ max_free = root->start - llist->end; if (llist != header) { max_free = vm_map_splay_merge_left_walk(header, root, - NULL, max_free, llist); + root, max_free, llist); } else { - root->left = NULL; + root->left = header; + header->right = root; } return (max_free); } @@ -1197,7 +1226,8 @@ vm_map_splay_merge_left(vm_map_entry_t header, vm_map_ max_free = vm_map_entry_max_free_left(root, llist); if (llist != header) { max_free = vm_map_splay_merge_left_walk(header, root, - root->left, max_free, llist); + root->left == llist ? root : root->left, + max_free, llist); } return (max_free); } @@ -1233,9 +1263,10 @@ vm_map_splay_merge_succ(vm_map_entry_t header, vm_map_ max_free = rlist->start - root->end; if (rlist != header) { max_free = vm_map_splay_merge_right_walk(header, root, - NULL, max_free, rlist); + root, max_free, rlist); } else { - root->right = NULL; + root->right = header; + header->left = root; } return (max_free); } @@ -1252,7 +1283,8 @@ vm_map_splay_merge_right(vm_map_entry_t header, vm_map max_free = vm_map_entry_max_free_right(root, rlist); if (rlist != header) { max_free = vm_map_splay_merge_right_walk(header, root, - root->right, max_free, rlist); + root->right == rlist ? root : root->right, + max_free, rlist); } return (max_free); } @@ -1267,6 +1299,14 @@ vm_map_splay_merge_right(vm_map_entry_t header, vm_map * the pointers and compute max_free. The time bound is O(log n) * amortized. * + * The tree is threaded, which means that there are no null pointers. + * When a node has no left child, its left pointer points to its + * predecessor, which the last ancestor on the search path from the root + * where the search branched right. Likewise, when a node has no right + * child, its right pointer points to its successor. The map header node + * is the predecessor of the first map entry, and the successor of the + * last. + * * The new root is the vm_map_entry containing "addr", or else an * adjacent entry (lower if possible) if addr is not in the tree. * @@ -1332,9 +1372,6 @@ vm_map_entry_link(vm_map_t map, vm_map_entry_t entry) root = vm_map_splay_split(map, entry->start, 0, &llist, &rlist); KASSERT(root == NULL, ("vm_map_entry_link: link object already mapped")); - entry->prev = llist; - entry->next = rlist; - llist->next = rlist->prev = entry; root = entry; root->max_free = vm_size_max( vm_map_splay_merge_pred(header, root, llist), @@ -1352,7 +1389,7 @@ static void vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry, enum unlink_merge_type op) { - vm_map_entry_t header, llist, rlist, root, y; + vm_map_entry_t header, llist, rlist, root; vm_size_t max_free_left, max_free_right; VM_MAP_ASSERT_LOCKED(map); @@ -1377,11 +1414,10 @@ vm_map_entry_unlink(vm_map_t map, vm_map_entry_t entry rlist = root->left; max_free_left = vm_map_splay_merge_pred(header, root, llist); max_free_right = vm_map_splay_merge_right(header, root, rlist); - } else + } else { + header->left = header->right = header; root = NULL; - y = entry->next; - y->prev = entry->prev; - y->prev->next = y; + } if (root != NULL) root->max_free = vm_size_max(max_free_left, max_free_right); map->root = root; @@ -1435,7 +1471,7 @@ vm_map_lookup_entry( vm_offset_t address, vm_map_entry_t *entry) /* OUT */ { - vm_map_entry_t cur, header, lbound; + vm_map_entry_t cur, header, lbound, ubound; boolean_t locked; /* @@ -1482,18 +1518,23 @@ vm_map_lookup_entry( * Since the map is only locked for read access, perform a * standard binary search tree lookup for "address". */ - lbound = header; - do { + lbound = ubound = header; + for (;;) { if (address < cur->start) { + ubound = cur; cur = cur->left; + if (cur == lbound) + break; } else if (cur->end <= address) { lbound = cur; cur = cur->right; + if (cur == ubound) + break; } else { *entry = cur; return (TRUE); } - } while (cur != NULL); + } *entry = lbound; return (FALSE); } @@ -1760,7 +1801,7 @@ vm_map_findspace(vm_map_t map, vm_offset_t start, vm_s gap_end = rlist->start; if (root != NULL) { start = root->end; - if (root->right != NULL) + if (root->right != rlist) gap_end = start; max_free_left = vm_map_splay_merge_left(header, root, llist); max_free_right = vm_map_splay_merge_right(header, root, rlist); @@ -1782,7 +1823,7 @@ vm_map_findspace(vm_map_t map, vm_offset_t start, vm_s return (start); /* With max_free, can immediately tell if no solution. */ - if (root->right == NULL || length > root->right->max_free) + if (root->right == header || length > root->right->max_free) return (vm_map_max(map) - length + 1); /* @@ -1792,10 +1833,10 @@ vm_map_findspace(vm_map_t map, vm_offset_t start, vm_s for (left_length = 0;; left_length = vm_map_entry_max_free_left(root, llist)) { if (length <= left_length) - SPLAY_LEFT_STEP(root, y, rlist, + SPLAY_LEFT_STEP(root, y, llist, rlist, length <= vm_map_entry_max_free_left(y, llist)); else - SPLAY_RIGHT_STEP(root, y, llist, + SPLAY_RIGHT_STEP(root, y, llist, rlist, length > vm_map_entry_max_free_left(y, root)); if (root == NULL) break; @@ -1812,7 +1853,6 @@ vm_map_findspace(vm_map_t map, vm_offset_t start, vm_s y->max_free = vm_size_max( vm_map_splay_merge_pred(root, y, root), vm_map_splay_merge_right(header, y, rlist)); - root->right = y; root->max_free = vm_size_max(max_free_left, y->max_free); } map->root = root; @@ -4961,6 +5001,7 @@ static void _vm_map_assert_consistent(vm_map_t map, int check) { vm_map_entry_t entry, prev; + vm_map_entry_t cur, header, lbound, ubound; vm_size_t max_left, max_right; #ifdef DIAGNOSTIC @@ -4969,7 +5010,7 @@ _vm_map_assert_consistent(vm_map_t map, int check) if (enable_vmmap_check != check) return; - prev = &map->header; + header = prev = &map->header; VM_MAP_ENTRY_FOREACH(entry, map) { KASSERT(prev->end <= entry->start, ("map %p prev->end = %jx, start = %jx", map, @@ -4977,23 +5018,39 @@ _vm_map_assert_consistent(vm_map_t map, int check) KASSERT(entry->start < entry->end, ("map %p start = %jx, end = %jx", map, (uintmax_t)entry->start, (uintmax_t)entry->end)); - KASSERT(entry->end <= vm_map_entry_succ(entry)->start, - ("map %p end = %jx, next->start = %jx", map, - (uintmax_t)entry->end, - (uintmax_t)vm_map_entry_succ(entry)->start)); - KASSERT(entry->left == NULL || + KASSERT(entry->left == header || entry->left->start < entry->start, ("map %p left->start = %jx, start = %jx", map, (uintmax_t)entry->left->start, (uintmax_t)entry->start)); - KASSERT(entry->right == NULL || + KASSERT(entry->right == header || entry->start < entry->right->start, ("map %p start = %jx, right->start = %jx", map, (uintmax_t)entry->start, (uintmax_t)entry->right->start)); - max_left = vm_map_entry_max_free_left(entry, - vm_map_entry_pred(entry)); - max_right = vm_map_entry_max_free_right(entry, - vm_map_entry_succ(entry)); - KASSERT(entry->max_free == MAX(max_left, max_right), + cur = map->root; + lbound = ubound = header; + for (;;) { + if (entry->start < cur->start) { + ubound = cur; + cur = cur->left; + KASSERT(cur != lbound, + ("map %p cannot find %jx", + map, entry->start)); + } else if (cur->end <= entry->start) { + lbound = cur; + cur = cur->right; + KASSERT(cur != ubound, + ("map %p cannot find %jx", + map, entry->start)); + } else { + KASSERT(cur == entry, + ("map %p cannot find %jx", + map, entry->start)); + break; + } + } + max_left = vm_map_entry_max_free_left(entry, lbound); + max_right = vm_map_entry_max_free_right(entry, ubound); + KASSERT(entry->max_free == vm_size_max(max_left, max_right), ("map %p max = %jx, max_left = %jx, max_right = %jx", map, (uintmax_t)entry->max_free, (uintmax_t)max_left, (uintmax_t)max_right)); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sat Dec 7 17:10:03 2019 (r355490) +++ head/sys/vm/vm_map.h Sat Dec 7 17:14:33 2019 (r355491) @@ -99,10 +99,8 @@ union vm_map_object { * Also included is control information for virtual copy operations. */ struct vm_map_entry { - struct vm_map_entry *prev; /* previous entry */ - struct vm_map_entry *next; /* next entry */ - struct vm_map_entry *left; /* left child in binary search tree */ - struct vm_map_entry *right; /* right child in binary search tree */ + struct vm_map_entry *left; /* left child or previous entry */ + struct vm_map_entry *right; /* right child or next entry */ vm_offset_t start; /* start address */ vm_offset_t end; /* end address */ vm_offset_t next_read; /* vaddr of the next sequential read */ @@ -175,9 +173,12 @@ vm_map_entry_system_wired_count(vm_map_entry_t entry) /* * A map is a set of map entries. These map entries are - * organized both as a binary search tree and as a doubly-linked - * list. Both structures are ordered based upon the start and - * end addresses contained within each map entry. + * organized as a threaded binary search tree. Both structures + * are ordered based upon the start and end addresses contained + * within each map entry. The largest gap between an entry in a + * subtree and one of its neighbors is saved in the max_free + * field, and that field is updated when the tree is + * restructured. * * Sleator and Tarjan's top-down splay algorithm is employed to * control height imbalance in the binary search tree. @@ -185,10 +186,12 @@ vm_map_entry_system_wired_count(vm_map_entry_t entry) * The map's min offset value is stored in map->header.end, and * its max offset value is stored in map->header.start. These * values act as sentinels for any forward or backward address - * scan of the list. The map header has a special value for the - * eflags field, MAP_ENTRY_HEADER, that is set initially, is - * never changed, and prevents an eflags match of the header - * with any other map entry. + * scan of the list. The right and left fields of the map + * header point to the first and list map entries. The map + * header has a special value for the eflags field, + * MAP_ENTRY_HEADER, that is set initially, is never changed, + * and prevents an eflags match of the header with any other map + * entry. * * List of locks * (c) const until freed @@ -424,14 +427,21 @@ static inline vm_map_entry_t vm_map_entry_first(vm_map_t map) { - return (map->header.next); + return (map->header.right); } static inline vm_map_entry_t vm_map_entry_succ(vm_map_entry_t entry) { + vm_map_entry_t after; - return (entry->next); + after = entry->right; + if (after->left->start > entry->start) { + do + after = after->left; + while (after->left != entry); + } + return (after); } #define VM_MAP_ENTRY_FOREACH(it, map) \ From owner-svn-src-all@freebsd.org Sat Dec 7 17:17:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 247D51D75F7; Sat, 7 Dec 2019 17:17:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vbk70907z40Qt; Sat, 7 Dec 2019 17:17:35 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8A631D090; Sat, 7 Dec 2019 17:17:34 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HHYPs017016; Sat, 7 Dec 2019 17:17:34 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HHY7D017013; Sat, 7 Dec 2019 17:17:34 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071717.xB7HHY7D017013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:17:34 +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: r355492 - in stable/12/sys/arm/ti: . am335x X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in stable/12/sys/arm/ti: . am335x X-SVN-Commit-Revision: 355492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:17:35 -0000 Author: ian Date: Sat Dec 7 17:17:34 2019 New Revision: 355492 URL: https://svnweb.freebsd.org/changeset/base/355492 Log: MFC r352196, r352333, r352342, r353653 r352196: In am335x_dmtpps, use a spin mutex to interlock between PPS capture and PPS ioctl(2) handling. This allows doing the pps_event() work in the polling routine, instead of using a taskqueue task to do that work. Also, add PNPINFO, and switch to using make_dev_s() to create the cdev. Using a spin mutex and calling pps_event() from the polling function works around the situation which requires more than 2 sets of timecounter timehands in a single-core system to get reliable PPS capture. That problem would happen when a single-core system is idle in cpu_idle() then gets woken up with an event timer event which was scheduled to handle a hardclock tick. That processing path would end up calling tc_windup 3 or 4 times between when the tc polling function was called and when the taskqueue task would eventually run, and with only two sets of timehands, the th_generation count would always be too old to allow the captured PPS data to be used. r352333: Include , required to use spinlocks in this code. r352342: Make the ti_sysc device quiet. It's an internal utility pseudo-device that makes the upstream FDT data work right, so we don't need to see a couple dozen instances of it spam the dmesg at boot time unless it's a verbose boot. r353653: Update some comments; no functional changes. Some historical old comments in this driver indicate that the SD_CAPA register is write-once and after being set one time the values in it cannot be changed. That turns out not to be the case -- the values written to it survive a reset, but they can be rewritten/changed at any time. Modified: stable/12/sys/arm/ti/am335x/am335x_dmtpps.c stable/12/sys/arm/ti/ti_sdhci.c stable/12/sys/arm/ti/ti_sysc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/ti/am335x/am335x_dmtpps.c ============================================================================== --- stable/12/sys/arm/ti/am335x/am335x_dmtpps.c Sat Dec 7 17:14:33 2019 (r355491) +++ stable/12/sys/arm/ti/am335x/am335x_dmtpps.c Sat Dec 7 17:17:34 2019 (r355492) @@ -48,11 +48,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include #include #include #include @@ -79,7 +79,6 @@ struct dmtpps_softc { uint32_t tclr; /* Cached TCLR register. */ struct timecounter tc; int pps_curmode; /* Edge mode now set in hw. */ - struct task pps_task; /* For pps_event handling. */ struct cdev * pps_cdev; struct pps_state pps_state; struct mtx pps_mtx; @@ -93,6 +92,7 @@ static struct ofw_compat_data compat_data[] = { {"ti,am335x-timer-1ms", 1}, {NULL, 0}, }; +SIMPLEBUS_PNP_INFO(compat_data); /* * A table relating pad names to the hardware timer number they can be mux'd to. @@ -285,48 +285,29 @@ dmtpps_poll(struct timecounter *tc) * populates it from the current DMT_TCRR register) with the latched * value from the TCAR1 register. * - * There is no locking here, by design. pps_capture() writes into an - * area of struct pps_state which is read only by pps_event(). The - * synchronization of access to that area is temporal rather than - * interlock based... we write in this routine and trigger the task that - * will read the data, so no simultaneous access can occur. - * * Note that we don't have the TCAR interrupt enabled, but the hardware * still provides the status bits in the "RAW" status register even when * they're masked from generating an irq. However, when clearing the * TCAR status to re-arm the capture for the next second, we have to * write to the IRQ status register, not the RAW register. Quirky. + * + * We do not need to hold a lock while capturing the pps data, because + * it is captured into an area of the pps_state struct which is read + * only by pps_event(). We do need to hold a lock while calling + * pps_event(), because it manipulates data which is also accessed from + * the ioctl(2) context by userland processes. */ if (DMTIMER_READ4(sc, DMT_IRQSTATUS_RAW) & DMT_IRQ_TCAR) { pps_capture(&sc->pps_state); sc->pps_state.capcount = DMTIMER_READ4(sc, DMT_TCAR1); DMTIMER_WRITE4(sc, DMT_IRQSTATUS, DMT_IRQ_TCAR); - taskqueue_enqueue(taskqueue_fast, &sc->pps_task); + + mtx_lock_spin(&sc->pps_mtx); + pps_event(&sc->pps_state, PPS_CAPTUREASSERT); + mtx_unlock_spin(&sc->pps_mtx); } } -static void -dmtpps_event(void *arg, int pending) -{ - struct dmtpps_softc *sc; - - sc = arg; - - /* This is the task function that gets enqueued by poll_pps. Once the - * time has been captured by the timecounter polling code which runs in - * primary interrupt context, the remaining (more expensive) work to - * process the event is done later in a threaded context. - * - * Here there is an interlock that protects the event data in struct - * pps_state. That data can be accessed at any time from userland via - * ioctl() calls so we must ensure that there is no read access to - * partially updated data while pps_event() does its work. - */ - mtx_lock(&sc->pps_mtx); - pps_event(&sc->pps_state, PPS_CAPTUREASSERT); - mtx_unlock(&sc->pps_mtx); -} - static int dmtpps_open(struct cdev *dev, int flags, int fmt, struct thread *td) @@ -374,9 +355,9 @@ dmtpps_ioctl(struct cdev *dev, u_long cmd, caddr_t dat sc = dev->si_drv1; /* Let the kernel do the heavy lifting for ioctl. */ - mtx_lock(&sc->pps_mtx); + mtx_lock_spin(&sc->pps_mtx); err = pps_ioctl(cmd, data, &sc->pps_state); - mtx_unlock(&sc->pps_mtx); + mtx_unlock_spin(&sc->pps_mtx); if (err != 0) return (err); @@ -436,6 +417,7 @@ static int dmtpps_attach(device_t dev) { struct dmtpps_softc *sc; + struct make_dev_args mda; clk_ident_t timer_id; int err, sysclk_freq; @@ -502,22 +484,27 @@ dmtpps_attach(device_t dev) * now, just say we can only capture assert events (the positive-going * edge of the pulse). */ - mtx_init(&sc->pps_mtx, "dmtpps", NULL, MTX_DEF); + mtx_init(&sc->pps_mtx, "dmtpps", NULL, MTX_SPIN); + sc->pps_state.flags = PPSFLAG_MTX_SPIN; sc->pps_state.ppscap = PPS_CAPTUREASSERT; sc->pps_state.driver_abi = PPS_ABI_VERSION; sc->pps_state.driver_mtx = &sc->pps_mtx; pps_init_abi(&sc->pps_state); - /* - * Init the task that does deferred pps_event() processing after - * the polling routine has captured a pps pulse time. - */ - TASK_INIT(&sc->pps_task, 0, dmtpps_event, sc); - /* Create the PPS cdev. */ - sc->pps_cdev = make_dev(&dmtpps_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, - PPS_CDEV_NAME); - sc->pps_cdev->si_drv1 = sc; + make_dev_args_init(&mda); + mda.mda_flags = MAKEDEV_WAITOK; + mda.mda_devsw = &dmtpps_cdevsw; + mda.mda_cr = NULL; + mda.mda_uid = UID_ROOT; + mda.mda_gid = GID_WHEEL; + mda.mda_mode = 0600; + mda.mda_unit = device_get_unit(dev); + mda.mda_si_drv1 = sc; + if ((err = make_dev_s(&mda, &sc->pps_cdev, PPS_CDEV_NAME)) != 0) { + device_printf(dev, "Failed to create cdev %s\n", PPS_CDEV_NAME); + return (err); + } if (bootverbose) device_printf(sc->dev, "Using %s for PPS device /dev/%s\n", Modified: stable/12/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/12/sys/arm/ti/ti_sdhci.c Sat Dec 7 17:14:33 2019 (r355491) +++ stable/12/sys/arm/ti/ti_sdhci.c Sat Dec 7 17:17:34 2019 (r355492) @@ -481,10 +481,10 @@ ti_sdhci_hw_init(device_t dev) /* * The attach() routine has examined fdt data and set flags in * slot.host.caps to reflect what voltages we can handle. Set those - * values in the CAPA register. The manual says that these values can - * only be set once, "before initialization" whatever that means, and - * that they survive a reset. So maybe doing this will be a no-op if - * u-boot has already initialized the hardware. + * values in the CAPA register. Empirical testing shows that the + * values in this register can be overwritten at any time, but the + * manual says that these values should only be set once, "before + * initialization" whatever that means, and that they survive a reset. */ regval = ti_mmchs_read_4(sc, MMCHS_SD_CAPA); if (sc->slot.host.caps & MMC_OCR_LOW_VOLTAGE) @@ -528,8 +528,7 @@ ti_sdhci_attach(device_t dev) * device, and only 1p8v on other devices unless an external transceiver * is used. The only way we could know about a transceiver is fdt data. * Note that we have to do this before calling ti_sdhci_hw_init() so - * that it can set the right values in the CAPA register, which can only - * be done once and never reset. + * that it can set the right values in the CAPA register. */ sc->slot.host.caps |= MMC_OCR_LOW_VOLTAGE; if (sc->mmchs_clk_id == MMC1_CLK || OF_hasprop(node, "ti,dual-volt")) { Modified: stable/12/sys/arm/ti/ti_sysc.c ============================================================================== --- stable/12/sys/arm/ti/ti_sysc.c Sat Dec 7 17:14:33 2019 (r355491) +++ stable/12/sys/arm/ti/ti_sysc.c Sat Dec 7 17:17:34 2019 (r355492) @@ -71,6 +71,9 @@ ti_sysc_probe(device_t dev) return (ENXIO); device_set_desc(dev, "TI SYSC Interconnect"); + if (!bootverbose) + device_quiet(dev); + return (BUS_PROBE_DEFAULT); } From owner-svn-src-all@freebsd.org Sat Dec 7 17:19:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BBE21D7674; Sat, 7 Dec 2019 17:19:37 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VbmT3bgHz40YB; Sat, 7 Dec 2019 17:19:37 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FA9F1D094; Sat, 7 Dec 2019 17:19:37 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HJbxx017137; Sat, 7 Dec 2019 17:19:37 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HJb96017136; Sat, 7 Dec 2019 17:19:37 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071719.xB7HJb96017136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:19:37 +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: r355493 - stable/12/usr.sbin/daemon X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/usr.sbin/daemon X-SVN-Commit-Revision: 355493 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:19:37 -0000 Author: ian Date: Sat Dec 7 17:19:36 2019 New Revision: 355493 URL: https://svnweb.freebsd.org/changeset/base/355493 Log: MFC r353024-r353025 r353024: Clarify how the -f option for daemon(8) interacts with other options related to redirecting stdout and stderr. r353025: Bump .Dd for earlier update (should have been part of r353024). Modified: stable/12/usr.sbin/daemon/daemon.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/daemon/daemon.8 ============================================================================== --- stable/12/usr.sbin/daemon/daemon.8 Sat Dec 7 17:17:34 2019 (r355492) +++ stable/12/usr.sbin/daemon/daemon.8 Sat Dec 7 17:19:36 2019 (r355493) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 25, 2019 +.Dd October 2, 2019 .Dt DAEMON 8 .Os .Sh NAME @@ -63,6 +63,11 @@ Change the current working directory to the root .It Fl f Redirect standard input, standard output and standard error to .Pa /dev/null . +When this option is used together with any of the options related to file +or syslog output, the standard file descriptors are first redirected to +.Pa /dev/null , +then stdout and/or stderr is redirected to a file or to syslog as +specified by the other options. .It Fl S Enable syslog output. This is implicitly applied if other syslog parameters are provided. From owner-svn-src-all@freebsd.org Sat Dec 7 17:24:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 648EB1D78B2; Sat, 7 Dec 2019 17:24:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vbsh22Dxz410Z; Sat, 7 Dec 2019 17:24:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28ED31D24A; Sat, 7 Dec 2019 17:24:08 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HO8dT022620; Sat, 7 Dec 2019 17:24:08 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HO7J8022618; Sat, 7 Dec 2019 17:24:07 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071724.xB7HO7J8022618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:24: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: r355494 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 355494 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:24:08 -0000 Author: ian Date: Sat Dec 7 17:24:07 2019 New Revision: 355494 URL: https://svnweb.freebsd.org/changeset/base/355494 Log: MFC r352338: Create a mechanism for encoding a system errno into the IIC_Exxxxx space. Errors are communicated between the i2c controller layer and upper layers (iicbus and slave device drivers) using a set of IIC_Exxxxxx constants which effectively define a private number space separate from (and having values that conflict with) the system errno number space. Sometimes it is necessary to report a plain old system error (especially EINTR) from the controller or bus layer and have that value make it back across the syscall interface intact. I initially considered replicating a few "crucial" errno values with similar names and new numbers, e.g., IIC_EINTR, IIC_ERESTART, etc. It seemed like that had the potential to grow over time until many of the errno names were duplicated into the IIC_Exxxxx space. So instead, this defines a mechanism to "encode" an errno into the IIC_Exxxx space by setting the high bit and putting the errno into the lower-order bits; a new errno2iic() function does this. The existing iic2errno() recognizes the encoded values and extracts the original errno out of the encoded value. An interesting wrinkle occurs with the pseudo-error values such as ERESTART -- they aleady have the high bit set, and turning it off would be the wrong thing to do. Instead, iic2errno() recognizes that lots of high bits are on (i.e., it's a negative number near to zero) and just returns that value as-is. Thus, existing drivers continue to work without needing any changes, and there is now a way to return errno values from the lower layers. The first use of that is in iicbus_poll() which does mtx_sleep() with the PCATCH flag, and needs to return the errno from that up the call chain. Differential Revision: https://reviews.freebsd.org/D20975 Modified: stable/12/sys/dev/iicbus/iiconf.c stable/12/sys/dev/iicbus/iiconf.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:19:36 2019 (r355493) +++ stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:24:07 2019 (r355494) @@ -42,6 +42,18 @@ __FBSDID("$FreeBSD$"); #include "iicbus_if.h" /* + * Encode a system errno value into the IIC_Exxxxx space by setting the + * IIC_ERRNO marker bit, so that iic2errno() can turn it back into a plain + * system errno value later. This lets controller- and bus-layer code get + * important system errno values (such as EINTR/ERESTART) back to the caller. + */ +int +errno2iic(int errno) +{ + return ((errno == 0) ? 0 : errno | IIC_ERRNO); +} + +/* * Translate IIC_Exxxxx status values to vaguely-equivelent errno values. */ int @@ -59,7 +71,22 @@ iic2errno(int iic_status) case IIC_ENOTSUPP: return (EOPNOTSUPP); case IIC_ENOADDR: return (EADDRNOTAVAIL); case IIC_ERESOURCE: return (ENOMEM); - default: return (EIO); + default: + /* + * If the high bit is set, that means it's a system errno value + * that was encoded into the IIC_Exxxxxx space by setting the + * IIC_ERRNO marker bit. If lots of high-order bits are set, + * then it's one of the negative pseudo-errors such as ERESTART + * and we return it as-is. Otherwise it's a plain "small + * positive integer" errno, so just remove the IIC_ERRNO marker + * bit. If it's some unknown number without the high bit set, + * there isn't much we can do except call it an I/O error. + */ + if ((iic_status & IIC_ERRNO) == 0) + return (EIO); + if ((iic_status & 0xFFFF0000) != 0) + return (iic_status); + return (iic_status & ~IIC_ERRNO); } } @@ -97,7 +124,7 @@ iicbus_poll(struct iicbus_softc *sc, int how) return (IIC_EBUSBSY); } - return (error); + return (errno2iic(error)); } /* Modified: stable/12/sys/dev/iicbus/iiconf.h ============================================================================== --- stable/12/sys/dev/iicbus/iiconf.h Sat Dec 7 17:19:36 2019 (r355493) +++ stable/12/sys/dev/iicbus/iiconf.h Sat Dec 7 17:24:07 2019 (r355494) @@ -96,12 +96,14 @@ #define IIC_ENOTSUPP 0x8 /* request not supported */ #define IIC_ENOADDR 0x9 /* no address assigned to the interface */ #define IIC_ERESOURCE 0xa /* resources (memory, whatever) unavailable */ +#define IIC_ERRNO __INT_MIN /* marker bit: errno is in low-order bits */ /* * Note that all iicbus functions return IIC_Exxxxx status values, * except iic2errno() (obviously) and iicbus_started() (returns bool). */ extern int iic2errno(int); +extern int errno2iic(int); extern int iicbus_request_bus(device_t, device_t, int); extern int iicbus_release_bus(device_t, device_t); extern device_t iicbus_alloc_bus(device_t); From owner-svn-src-all@freebsd.org Sat Dec 7 17:28:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0A521D7AE8; Sat, 7 Dec 2019 17:28:41 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vbyx5czcz41KQ; Sat, 7 Dec 2019 17:28:41 +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 A51941D24E; Sat, 7 Dec 2019 17:28:41 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HSfQs022993; Sat, 7 Dec 2019 17:28:41 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HSfaM022992; Sat, 7 Dec 2019 17:28:41 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201912071728.xB7HSfaM022992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 7 Dec 2019 17:28:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355495 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355495 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:28:41 -0000 Author: mjg Date: Sat Dec 7 17:28:41 2019 New Revision: 355495 URL: https://svnweb.freebsd.org/changeset/base/355495 Log: vm: fix sysctl vm.kstack_cache_size change report Cache gets resized correctly, but sysctl reports the wrong number: # sysctl vm.kstack_cache_size=512 vm.kstack_cache_size: 128 -> 128 patched: vm.kstack_cache_size: 128 -> 512 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D22717 Fixes: r355002 "Revise the page cache size policy." Modified: head/sys/vm/vm_glue.c Modified: head/sys/vm/vm_glue.c ============================================================================== --- head/sys/vm/vm_glue.c Sat Dec 7 17:24:07 2019 (r355494) +++ head/sys/vm/vm_glue.c Sat Dec 7 17:28:41 2019 (r355495) @@ -273,12 +273,12 @@ static int kstack_domain_iter; static int sysctl_kstack_cache_size(SYSCTL_HANDLER_ARGS) { - int error, newsize; + int error, oldsize; - newsize = kstack_cache_size; - error = sysctl_handle_int(oidp, &newsize, 0, req); - if (error == 0 && req->newptr && newsize != kstack_cache_size) - uma_zone_set_maxcache(kstack_cache, newsize); + oldsize = kstack_cache_size; + error = sysctl_handle_int(oidp, arg1, arg2, req); + if (error == 0 && req->newptr && oldsize != kstack_cache_size) + uma_zone_set_maxcache(kstack_cache, kstack_cache_size); return (error); } SYSCTL_PROC(_vm, OID_AUTO, kstack_cache_size, CTLTYPE_INT|CTLFLAG_RW, From owner-svn-src-all@freebsd.org Sat Dec 7 17:34:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 326191D7D85; Sat, 7 Dec 2019 17:34:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vc591N6jz41xp; Sat, 7 Dec 2019 17:34:05 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC0CD1D420; Sat, 7 Dec 2019 17:34:04 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HY40T029871; Sat, 7 Dec 2019 17:34:04 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HY4uQ029869; Sat, 7 Dec 2019 17:34:04 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071734.xB7HY4uQ029869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:34: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: r355496 - stable/12/sys/arm/include X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/arm/include X-SVN-Commit-Revision: 355496 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:34:05 -0000 Author: ian Date: Sat Dec 7 17:34:04 2019 New Revision: 355496 URL: https://svnweb.freebsd.org/changeset/base/355496 Log: MFC r352938: Add 8 and 16 bit versions of atomic_cmpset and atomic_fcmpset for arm. This adds 8 and 16 bit versions of the cmpset and fcmpset functions. Macros are used to generate all the flavors from the same set of instructions; the macro expansion handles the couple minor differences between each size variation (generating ldrexb/ldrexh/ldrex for 8/16/32, etc). In addition to handling new sizes, the instruction sequences used for cmpset and fcmpset are rewritten to be a bit shorter/faster, and the new sequence will not return false when *dst==*old but the store-exclusive fails because of concurrent writers. Instead, it just loops like ldrex/strex sequences normally do until it gets a non-conflicted store. The manpage allows LL/SC architectures to bogusly return false, but there's no reason to actually do so, at least on arm. Reviewed by: cognet Modified: stable/12/sys/arm/include/atomic-v4.h stable/12/sys/arm/include/atomic-v6.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/include/atomic-v4.h ============================================================================== --- stable/12/sys/arm/include/atomic-v4.h Sat Dec 7 17:28:41 2019 (r355495) +++ stable/12/sys/arm/include/atomic-v4.h Sat Dec 7 17:34:04 2019 (r355496) @@ -113,6 +113,43 @@ atomic_clear_64(volatile uint64_t *address, uint64_t c } static __inline int +atomic_fcmpset_8(volatile uint8_t *p, volatile uint8_t *cmpval, volatile uint8_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + ret = *p; + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} +static __inline int +atomic_fcmpset_16(volatile uint16_t *p, volatile uint16_t *cmpval, volatile uint16_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + ret = *p; + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} + +static __inline int atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) { int ret; @@ -150,6 +187,40 @@ atomic_fcmpset_64(volatile u_int64_t *p, volatile u_in } static __inline int +atomic_cmpset_8(volatile uint8_t *p, volatile uint8_t cmpval, volatile uint8_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + if (*p == cmpval) { + *p = newval; + ret = 1; + } else { + ret = 0; + } + }); + return (ret); +} + +static __inline int +atomic_cmpset_16(volatile uint16_t *p, volatile uint16_t cmpval, volatile uint16_t newval) +{ + int ret; + + __with_interrupts_disabled( + { + if (*p == cmpval) { + *p = newval; + ret = 1; + } else { + ret = 0; + } + }); + return (ret); +} + +static __inline int atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { int ret; @@ -450,6 +521,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v) #define atomic_fcmpset_rel_32 atomic_fcmpset_32 #define atomic_fcmpset_acq_32 atomic_fcmpset_32 #ifdef _KERNEL +#define atomic_fcmpset_rel_8 atomic_fcmpset_8 +#define atomic_fcmpset_acq_8 atomic_fcmpset_8 +#define atomic_fcmpset_rel_16 atomic_fcmpset_16 +#define atomic_fcmpset_acq_16 atomic_fcmpset_16 #define atomic_fcmpset_rel_64 atomic_fcmpset_64 #define atomic_fcmpset_acq_64 atomic_fcmpset_64 #endif @@ -458,6 +533,10 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v) #define atomic_cmpset_rel_32 atomic_cmpset_32 #define atomic_cmpset_acq_32 atomic_cmpset_32 #ifdef _KERNEL +#define atomic_cmpset_rel_8 atomic_cmpset_8 +#define atomic_cmpset_acq_8 atomic_cmpset_8 +#define atomic_cmpset_rel_16 atomic_cmpset_16 +#define atomic_cmpset_acq_16 atomic_cmpset_16 #define atomic_cmpset_rel_64 atomic_cmpset_64 #define atomic_cmpset_acq_64 atomic_cmpset_64 #endif Modified: stable/12/sys/arm/include/atomic-v6.h ============================================================================== --- stable/12/sys/arm/include/atomic-v6.h Sat Dec 7 17:28:41 2019 (r355495) +++ stable/12/sys/arm/include/atomic-v6.h Sat Dec 7 17:34:04 2019 (r355496) @@ -190,224 +190,380 @@ ATOMIC_ACQ_REL(clear, 32) ATOMIC_ACQ_REL(clear, 64) ATOMIC_ACQ_REL_LONG(clear) +#define ATOMIC_FCMPSET_CODE(RET, TYPE, SUF) \ + { \ + TYPE tmp; \ + \ + __asm __volatile( \ + "1: ldrex" SUF " %[tmp], [%[ptr]] \n" \ + " ldr %[ret], [%[oldv]] \n" \ + " teq %[tmp], %[ret] \n" \ + " ittee ne \n" \ + " str" SUF "ne %[tmp], [%[oldv]] \n" \ + " movne %[ret], #0 \n" \ + " strex" SUF "eq %[ret], %[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET), \ + [tmp] "=&r" (tmp) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + +#define ATOMIC_FCMPSET_CODE64(RET) \ + { \ + uint64_t cmp, tmp; \ + \ + __asm __volatile( \ + "1: ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" \ + " ldrd %Q[cmp], %R[cmp], [%[oldv]] \n" \ + " teq %Q[tmp], %Q[cmp] \n" \ + " it eq \n" \ + " teqeq %R[tmp], %R[cmp] \n" \ + " ittee ne \n" \ + " movne %[ret], #0 \n" \ + " strdne %[cmp], [%[oldv]] \n" \ + " strexdeq %[ret], %Q[newv], %R[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET), \ + [cmp] "=&r" (cmp), \ + [tmp] "=&r" (tmp) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + static __inline int -atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +atomic_fcmpset_8(volatile uint8_t *_ptr, uint8_t *_old, uint8_t _new) { - uint32_t tmp; - uint32_t _cmpval = *cmpval; int ret; - __asm __volatile( - " mov %0, #1 \n" - " ldrex %1, [%2] \n" - " cmp %1, %3 \n" - " it eq \n" - " strexeq %0, %4, [%2] \n" - : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) - : : "cc", "memory"); - *cmpval = tmp; - return (!ret); + ATOMIC_FCMPSET_CODE(ret, uint8_t, "b"); + return (ret); } static __inline int -atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +atomic_fcmpset_acq_8(volatile uint8_t *_ptr, uint8_t *_old, uint8_t _new) { - uint64_t tmp; - uint64_t _cmpval = *cmpval; int ret; - __asm __volatile( - "1: mov %[ret], #1 \n" - " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" - " teq %Q[tmp], %Q[_cmpval] \n" - " ite eq \n" - " teqeq %R[tmp], %R[_cmpval] \n" - " bne 2f \n" - " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" - "2: \n" - : [ret] "=&r" (ret), - [tmp] "=&r" (tmp) - : [ptr] "r" (p), - [_cmpval] "r" (_cmpval), - [newval] "r" (newval) - : "cc", "memory"); - *cmpval = tmp; - return (!ret); + ATOMIC_FCMPSET_CODE(ret, uint8_t, "b"); + dmb(); + return (ret); } static __inline int -atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) +atomic_fcmpset_rel_8(volatile uint8_t *_ptr, uint8_t *_old, uint8_t _new) { + int ret; - return (atomic_fcmpset_32((volatile uint32_t *)p, - (uint32_t *)cmpval, newval)); + dmb(); + ATOMIC_FCMPSET_CODE(ret, uint8_t, "b"); + return (ret); } static __inline int -atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +atomic_fcmpset_16(volatile uint16_t *_ptr, uint16_t *_old, uint16_t _new) { int ret; - ret = atomic_fcmpset_64(p, cmpval, newval); + ATOMIC_FCMPSET_CODE(ret, uint16_t, "h"); + return (ret); +} + +static __inline int +atomic_fcmpset_acq_16(volatile uint16_t *_ptr, uint16_t *_old, uint16_t _new) +{ + int ret; + + ATOMIC_FCMPSET_CODE(ret, uint16_t, "h"); dmb(); return (ret); } static __inline int -atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval) +atomic_fcmpset_rel_16(volatile uint16_t *_ptr, uint16_t *_old, uint16_t _new) { int ret; - ret = atomic_fcmpset_long(p, cmpval, newval); dmb(); + ATOMIC_FCMPSET_CODE(ret, uint16_t, "h"); return (ret); } static __inline int -atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +atomic_fcmpset_32(volatile uint32_t *_ptr, uint32_t *_old, uint32_t _new) { + int ret; + ATOMIC_FCMPSET_CODE(ret, uint32_t, ""); + return (ret); +} + +static __inline int +atomic_fcmpset_acq_32(volatile uint32_t *_ptr, uint32_t *_old, uint32_t _new) +{ int ret; - ret = atomic_fcmpset_32(p, cmpval, newval); + ATOMIC_FCMPSET_CODE(ret, uint32_t, ""); dmb(); return (ret); } static __inline int -atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +atomic_fcmpset_rel_32(volatile uint32_t *_ptr, uint32_t *_old, uint32_t _new) { + int ret; dmb(); - return (atomic_fcmpset_32(p, cmpval, newval)); + ATOMIC_FCMPSET_CODE(ret, uint32_t, ""); + return (ret); } static __inline int -atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +atomic_fcmpset_long(volatile long *_ptr, long *_old, long _new) { + int ret; + ATOMIC_FCMPSET_CODE(ret, long, ""); + return (ret); +} + +static __inline int +atomic_fcmpset_acq_long(volatile long *_ptr, long *_old, long _new) +{ + int ret; + + ATOMIC_FCMPSET_CODE(ret, long, ""); dmb(); - return (atomic_fcmpset_64(p, cmpval, newval)); + return (ret); } static __inline int -atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval) +atomic_fcmpset_rel_long(volatile long *_ptr, long *_old, long _new) { + int ret; dmb(); - return (atomic_fcmpset_long(p, cmpval, newval)); + ATOMIC_FCMPSET_CODE(ret, long, ""); + return (ret); } static __inline int -atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) +atomic_fcmpset_64(volatile uint64_t *_ptr, uint64_t *_old, uint64_t _new) { int ret; - __asm __volatile( - "1: ldrex %0, [%1] \n" - " cmp %0, %2 \n" - " itt ne \n" - " movne %0, #0 \n" - " bne 2f \n" - " strex %0, %3, [%1] \n" - " cmp %0, #0 \n" - " ite eq \n" - " moveq %0, #1 \n" - " bne 1b \n" - "2:" - : "=&r" (ret), "+r" (p), "+r" (cmpval), "+r" (newval) - : : "cc", "memory"); + ATOMIC_FCMPSET_CODE64(ret); return (ret); } static __inline int -atomic_cmpset_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +atomic_fcmpset_acq_64(volatile uint64_t *_ptr, uint64_t *_old, uint64_t _new) { - uint64_t tmp; - uint32_t ret; + int ret; - __asm __volatile( - "1: \n" - " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" - " teq %Q[tmp], %Q[cmpval] \n" - " itee eq \n" - " teqeq %R[tmp], %R[cmpval] \n" - " movne %[ret], #0 \n" - " bne 2f \n" - " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" - " teq %[ret], #0 \n" - " it ne \n" - " bne 1b \n" - " mov %[ret], #1 \n" - "2: \n" - : [ret] "=&r" (ret), - [tmp] "=&r" (tmp) - : [ptr] "r" (p), - [cmpval] "r" (cmpval), - [newval] "r" (newval) - : "cc", "memory"); + ATOMIC_FCMPSET_CODE64(ret); + dmb(); return (ret); } static __inline int -atomic_cmpset_long(volatile u_long *p, u_long cmpval, u_long newval) +atomic_fcmpset_rel_64(volatile uint64_t *_ptr, uint64_t *_old, uint64_t _new) { + int ret; - return (atomic_cmpset_32((volatile uint32_t *)p, cmpval, newval)); + dmb(); + ATOMIC_FCMPSET_CODE64(ret); + return (ret); } +#define ATOMIC_CMPSET_CODE(RET, SUF) \ + { \ + __asm __volatile( \ + "1: ldrex" SUF " %[ret], [%[ptr]] \n" \ + " teq %[ret], %[oldv] \n" \ + " itee ne \n" \ + " movne %[ret], #0 \n" \ + " strex" SUF "eq %[ret], %[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + +#define ATOMIC_CMPSET_CODE64(RET) \ + { \ + uint64_t tmp; \ + \ + __asm __volatile( \ + "1: ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" \ + " teq %Q[tmp], %Q[oldv] \n" \ + " it eq \n" \ + " teqeq %R[tmp], %R[oldv] \n" \ + " itee ne \n" \ + " movne %[ret], #0 \n" \ + " strexdeq %[ret], %Q[newv], %R[newv], [%[ptr]] \n" \ + " eorseq %[ret], #1 \n" \ + " beq 1b \n" \ + : [ret] "=&r" (RET), \ + [tmp] "=&r" (tmp) \ + : [ptr] "r" (_ptr), \ + [oldv] "r" (_old), \ + [newv] "r" (_new) \ + : "cc", "memory"); \ + } + static __inline int -atomic_cmpset_acq_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) +atomic_cmpset_8(volatile uint8_t *_ptr, uint8_t _old, uint8_t _new) { int ret; - ret = atomic_cmpset_32(p, cmpval, newval); + ATOMIC_CMPSET_CODE(ret, "b"); + return (ret); +} + +static __inline int +atomic_cmpset_acq_8(volatile uint8_t *_ptr, uint8_t _old, uint8_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, "b"); dmb(); return (ret); } static __inline int -atomic_cmpset_acq_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +atomic_cmpset_rel_8(volatile uint8_t *_ptr, uint8_t _old, uint8_t _new) { int ret; - ret = atomic_cmpset_64(p, cmpval, newval); dmb(); + ATOMIC_CMPSET_CODE(ret, "b"); return (ret); } static __inline int -atomic_cmpset_acq_long(volatile u_long *p, u_long cmpval, u_long newval) +atomic_cmpset_16(volatile uint16_t *_ptr, uint16_t _old, uint16_t _new) { int ret; - ret = atomic_cmpset_long(p, cmpval, newval); + ATOMIC_CMPSET_CODE(ret, "h"); + return (ret); +} + +static __inline int +atomic_cmpset_acq_16(volatile uint16_t *_ptr, uint16_t _old, uint16_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, "h"); dmb(); return (ret); } static __inline int -atomic_cmpset_rel_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) +atomic_cmpset_rel_16(volatile uint16_t *_ptr, uint16_t _old, uint16_t _new) { + int ret; dmb(); - return (atomic_cmpset_32(p, cmpval, newval)); + ATOMIC_CMPSET_CODE(ret, "h"); + return (ret); } static __inline int -atomic_cmpset_rel_64(volatile uint64_t *p, uint64_t cmpval, uint64_t newval) +atomic_cmpset_32(volatile uint32_t *_ptr, uint32_t _old, uint32_t _new) { + int ret; + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_acq_32(volatile uint32_t *_ptr, uint32_t _old, uint32_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, ""); dmb(); - return (atomic_cmpset_64(p, cmpval, newval)); + return (ret); } static __inline int -atomic_cmpset_rel_long(volatile u_long *p, u_long cmpval, u_long newval) +atomic_cmpset_rel_32(volatile uint32_t *_ptr, uint32_t _old, uint32_t _new) { + int ret; dmb(); - return (atomic_cmpset_long(p, cmpval, newval)); + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_long(volatile long *_ptr, long _old, long _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_acq_long(volatile long *_ptr, long _old, long _new) +{ + int ret; + + ATOMIC_CMPSET_CODE(ret, ""); + dmb(); + return (ret); +} + +static __inline int +atomic_cmpset_rel_long(volatile long *_ptr, long _old, long _new) +{ + int ret; + + dmb(); + ATOMIC_CMPSET_CODE(ret, ""); + return (ret); +} + +static __inline int +atomic_cmpset_64(volatile uint64_t *_ptr, uint64_t _old, uint64_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE64(ret); + return (ret); +} + +static __inline int +atomic_cmpset_acq_64(volatile uint64_t *_ptr, uint64_t _old, uint64_t _new) +{ + int ret; + + ATOMIC_CMPSET_CODE64(ret); + dmb(); + return (ret); +} + +static __inline int +atomic_cmpset_rel_64(volatile uint64_t *_ptr, uint64_t _old, uint64_t _new) +{ + int ret; + + dmb(); + ATOMIC_CMPSET_CODE64(ret); + return (ret); } static __inline uint32_t From owner-svn-src-all@freebsd.org Sat Dec 7 17:44:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7234E1C804F; Sat, 7 Dec 2019 17:44:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VcK22NT6z42Pf; Sat, 7 Dec 2019 17:44:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1AB101D61F; Sat, 7 Dec 2019 17:44:22 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HiLx0035737; Sat, 7 Dec 2019 17:44:21 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HiLrO035736; Sat, 7 Dec 2019 17:44:21 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071744.xB7HiLrO035736@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:44:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r355497 - stable/12/sys/dev/iicbus X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/dev/iicbus X-SVN-Commit-Revision: 355497 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:44:22 -0000 Author: ian Date: Sat Dec 7 17:44:21 2019 New Revision: 355497 URL: https://svnweb.freebsd.org/changeset/base/355497 Log: MFC r354973: Rewrite iicdev_writeto() to use a single buffer and a single iic_msg, rather than effectively doing scatter/gather IO with a pair of iic_msgs that direct the controller to do a single transfer with no bus STOP/START between the two buffers. It turns out we have multiple i2c hardware drivers that don't honor the NOSTOP and NOSTART flags; sometimes they just try to do the transfers anyway, creating confusing failures or leading to corrupted data. Modified: stable/12/sys/dev/iicbus/iiconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/iicbus/iiconf.c ============================================================================== --- stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:34:04 2019 (r355496) +++ stable/12/sys/dev/iicbus/iiconf.c Sat Dec 7 17:44:21 2019 (r355497) @@ -540,25 +540,47 @@ iicdev_readfrom(device_t slavedev, uint8_t regaddr, vo int iicdev_writeto(device_t slavedev, uint8_t regaddr, void *buffer, uint16_t buflen, int waithow) { - struct iic_msg msgs[2]; - uint8_t slaveaddr; + struct iic_msg msg; + uint8_t local_buffer[32]; + uint8_t *bufptr; + size_t bufsize; + int error; /* - * Two transfers back to back with no stop or start between them; first - * we write the address then we write the data to that address, all in a - * single transfer from two scattered buffers. + * Ideally, we would do two transfers back to back with no stop or start + * between them using an array of 2 iic_msgs; first we'd write the + * address byte using the IIC_M_NOSTOP flag, then we write the data + * using IIC_M_NOSTART, all in a single transfer. Unfortunately, + * several i2c hardware drivers don't support that (perhaps because the + * hardware itself can't support it). So instead we gather the + * scattered bytes into a single buffer here before writing them using a + * single iic_msg. This function is typically used to write a few bytes + * at a time, so we try to use a small local buffer on the stack, but + * fall back to allocating a temporary buffer when necessary. */ - slaveaddr = iicbus_get_addr(slavedev); - msgs[0].slave = slaveaddr; - msgs[0].flags = IIC_M_WR | IIC_M_NOSTOP; - msgs[0].len = 1; - msgs[0].buf = ®addr; + bufsize = buflen + 1; + if (bufsize <= sizeof(local_buffer)) { + bufptr = local_buffer; + } else { + bufptr = malloc(bufsize, M_DEVBUF, + (waithow & IIC_WAIT) ? M_WAITOK : M_NOWAIT); + if (bufptr == NULL) + return (errno2iic(ENOMEM)); + } - msgs[1].slave = slaveaddr; - msgs[1].flags = IIC_M_WR | IIC_M_NOSTART; - msgs[1].len = buflen; - msgs[1].buf = buffer; + bufptr[0] = regaddr; + memcpy(&bufptr[1], buffer, buflen); - return (iicbus_transfer_excl(slavedev, msgs, nitems(msgs), waithow)); + msg.slave = iicbus_get_addr(slavedev); + msg.flags = IIC_M_WR; + msg.len = bufsize; + msg.buf = bufptr; + + error = iicbus_transfer_excl(slavedev, &msg, 1, waithow); + + if (bufptr != local_buffer) + free(bufptr, M_DEVBUF); + + return (error); } From owner-svn-src-all@freebsd.org Sat Dec 7 17:46:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12DFE1C8200; Sat, 7 Dec 2019 17:46:33 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VcMX6kjlz42d6; Sat, 7 Dec 2019 17:46:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAC961D623; Sat, 7 Dec 2019 17:46:32 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HkWWb035880; Sat, 7 Dec 2019 17:46:32 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7HkW7t035879; Sat, 7 Dec 2019 17:46:32 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071746.xB7HkW7t035879@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:46:32 +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: r355498 - stable/12/sys/arm/freescale/imx X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/arm/freescale/imx X-SVN-Commit-Revision: 355498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:46:33 -0000 Author: ian Date: Sat Dec 7 17:46:32 2019 New Revision: 355498 URL: https://svnweb.freebsd.org/changeset/base/355498 Log: MFC r355193: Implement the ofw_bus_get_node method in the imx_gpio driver so that ofw_gpiobus can find its fdt metadata and instantiate child devices. Modified: stable/12/sys/arm/freescale/imx/imx_gpio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/freescale/imx/imx_gpio.c ============================================================================== --- stable/12/sys/arm/freescale/imx/imx_gpio.c Sat Dec 7 17:44:21 2019 (r355497) +++ stable/12/sys/arm/freescale/imx/imx_gpio.c Sat Dec 7 17:46:32 2019 (r355498) @@ -865,6 +865,15 @@ imx51_gpio_detach(device_t dev) return(0); } +static phandle_t +imx51_gpio_get_node(device_t bus, device_t dev) +{ + /* + * Share controller node with gpiobus device + */ + return ofw_bus_get_node(bus); +} + static device_method_t imx51_gpio_methods[] = { DEVMETHOD(device_probe, imx51_gpio_probe), DEVMETHOD(device_attach, imx51_gpio_attach), @@ -881,6 +890,9 @@ static device_method_t imx51_gpio_methods[] = { DEVMETHOD(pic_post_ithread, gpio_pic_post_ithread), DEVMETHOD(pic_pre_ithread, gpio_pic_pre_ithread), #endif + + /* OFW methods */ + DEVMETHOD(ofw_bus_get_node, imx51_gpio_get_node), /* GPIO protocol */ DEVMETHOD(gpio_get_bus, imx51_gpio_get_bus), From owner-svn-src-all@freebsd.org Sat Dec 7 17:54:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED9CA1C8659; Sat, 7 Dec 2019 17:54:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VcXx62wRz438s; Sat, 7 Dec 2019 17:54:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B25E31D7E1; Sat, 7 Dec 2019 17:54:41 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7HsfwS041571; Sat, 7 Dec 2019 17:54:41 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7Hsfx3041570; Sat, 7 Dec 2019 17:54:41 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201912071754.xB7Hsfx3041570@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sat, 7 Dec 2019 17:54:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355499 - in head/sys/modules/gpio: . gpioths X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: in head/sys/modules/gpio: . gpioths X-SVN-Commit-Revision: 355499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 17:54:42 -0000 Author: ian Date: Sat Dec 7 17:54:40 2019 New Revision: 355499 URL: https://svnweb.freebsd.org/changeset/base/355499 Log: Add module build stuff for gpioths(4), a driver for DHT11/DHT22 sensors. Added: head/sys/modules/gpio/gpioths/ head/sys/modules/gpio/gpioths/Makefile (contents, props changed) Modified: head/sys/modules/gpio/Makefile Modified: head/sys/modules/gpio/Makefile ============================================================================== --- head/sys/modules/gpio/Makefile Sat Dec 7 17:46:32 2019 (r355498) +++ head/sys/modules/gpio/Makefile Sat Dec 7 17:54:40 2019 (r355499) @@ -25,7 +25,7 @@ # SUCH DAMAGE. # -SUBDIR = gpiobus gpioiic gpioled gpiospi +SUBDIR = gpiobus gpioiic gpioled gpiospi gpioths .if !empty(OPT_FDT) SUBDIR += gpiokeys gpiopps Added: head/sys/modules/gpio/gpioths/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/gpio/gpioths/Makefile Sat Dec 7 17:54:40 2019 (r355499) @@ -0,0 +1,19 @@ +# $FreeBSD$ +# + +.PATH: ${SRCTOP}/sys/dev/gpio/ + +KMOD= gpioths +SRCS= gpioths.c + +SRCS+= \ + bus_if.h \ + device_if.h \ + gpio_if.h \ + gpiobus_if.h \ + ofw_bus_if.h \ + opt_platform.h \ + +CFLAGS+= -I. -I${SRCTOP}/sys/dev/gpio/ + +.include From owner-svn-src-all@freebsd.org Sat Dec 7 18:07:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C67B91C8C3D; Sat, 7 Dec 2019 18:07:50 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vcr64rNfz43r8; Sat, 7 Dec 2019 18:07:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A1E31D9AD; Sat, 7 Dec 2019 18:07:50 +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 xB7I7ol1047699; Sat, 7 Dec 2019 18:07:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7I7oVB047697; Sat, 7 Dec 2019 18:07:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201912071807.xB7I7oVB047697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 7 Dec 2019 18:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355500 - in head: lib/libc/sys sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: lib/libc/sys sys/kern X-SVN-Commit-Revision: 355500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 18:07:50 -0000 Author: kib Date: Sat Dec 7 18:07:49 2019 New Revision: 355500 URL: https://svnweb.freebsd.org/changeset/base/355500 Log: Only return EPERM from kill(-pid) when no process was signalled. As mandated by POSIX. Also clarify the kill(2) manpage. While there, restructure the code in killpg1() to use helper which keeps overall state of the process list iteration in the killpg1_ctx structued, later used to infer the error returned. Reported by: amdmi3 Reviewed by: jilles Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D22621 Modified: head/lib/libc/sys/kill.2 head/sys/kern/kern_sig.c Modified: head/lib/libc/sys/kill.2 ============================================================================== --- head/lib/libc/sys/kill.2 Sat Dec 7 17:54:40 2019 (r355499) +++ head/lib/libc/sys/kill.2 Sat Dec 7 18:07:49 2019 (r355500) @@ -28,7 +28,7 @@ .\" @(#)kill.2 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd December 1, 2017 +.Dd December 1, 2019 .Dt KILL 2 .Os .Sh NAME @@ -105,12 +105,11 @@ process with ID 1 .Xr init 8 ) , and the process sending the signal. If the user is not the super user, the signal is sent to all processes -with the same uid as the user excluding the process sending the signal. +which the caller has permissions to, excluding the process sending the signal. No error is returned if any process could be signaled. .El .Pp -For compatibility with System V, -if the process number is negative but not -1, +If the process number is negative but not -1, the signal is sent to all processes whose process group ID is equal to the absolute value of the process number. This is a variant of @@ -134,7 +133,7 @@ No process or process group can be found corresponding .It Bq Er EPERM The sending process does not have permission to send .Va sig -to the receiving process. +to any receiving process. .El .Sh SEE ALSO .Xr getpgrp 2 , Modified: head/sys/kern/kern_sig.c ============================================================================== --- head/sys/kern/kern_sig.c Sat Dec 7 17:54:40 2019 (r355499) +++ head/sys/kern/kern_sig.c Sat Dec 7 18:07:49 2019 (r355500) @@ -1679,6 +1679,36 @@ kern_sigaltstack(struct thread *td, stack_t *ss, stack return (0); } +struct killpg1_ctx { + struct thread *td; + ksiginfo_t *ksi; + int sig; + bool sent; + bool found; + int ret; +}; + +static void +killpg1_sendsig(struct proc *p, bool notself, struct killpg1_ctx *arg) +{ + int err; + + if (p->p_pid <= 1 || (p->p_flag & P_SYSTEM) != 0 || + (notself && p == arg->td->td_proc) || p->p_state == PRS_NEW) + return; + PROC_LOCK(p); + err = p_cansignal(arg->td, p, arg->sig); + if (err == 0 && arg->sig != 0) + pksignal(p, arg->sig, arg->ksi); + PROC_UNLOCK(p); + if (err != ESRCH) + arg->found = true; + if (err == 0) + arg->sent = true; + else if (arg->ret == 0 && err != ESRCH && err != EPERM) + arg->ret = err; +} + /* * Common code for kill process group/broadcast kill. * cp is calling process. @@ -1688,30 +1718,21 @@ killpg1(struct thread *td, int sig, int pgid, int all, { struct proc *p; struct pgrp *pgrp; - int err; - int ret; + struct killpg1_ctx arg; - ret = ESRCH; + arg.td = td; + arg.ksi = ksi; + arg.sig = sig; + arg.sent = false; + arg.found = false; + arg.ret = 0; if (all) { /* * broadcast */ sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { - if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || - p == td->td_proc || p->p_state == PRS_NEW) { - continue; - } - PROC_LOCK(p); - err = p_cansignal(td, p, sig); - if (err == 0) { - if (sig) - pksignal(p, sig, ksi); - ret = err; - } - else if (ret == ESRCH) - ret = err; - PROC_UNLOCK(p); + killpg1_sendsig(p, true, &arg); } sx_sunlock(&allproc_lock); } else { @@ -1731,25 +1752,14 @@ killpg1(struct thread *td, int sig, int pgid, int all, } sx_sunlock(&proctree_lock); LIST_FOREACH(p, &pgrp->pg_members, p_pglist) { - PROC_LOCK(p); - if (p->p_pid <= 1 || p->p_flag & P_SYSTEM || - p->p_state == PRS_NEW) { - PROC_UNLOCK(p); - continue; - } - err = p_cansignal(td, p, sig); - if (err == 0) { - if (sig) - pksignal(p, sig, ksi); - ret = err; - } - else if (ret == ESRCH) - ret = err; - PROC_UNLOCK(p); + killpg1_sendsig(p, false, &arg); } PGRP_UNLOCK(pgrp); } - return (ret); + MPASS(arg.ret != 0 || arg.found || !arg.sent); + if (arg.ret == 0 && !arg.sent) + arg.ret = arg.found ? EPERM : ESRCH; + return (arg.ret); } #ifndef _SYS_SYSPROTO_H_ From owner-svn-src-all@freebsd.org Sat Dec 7 18:16:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 209F01C900A; Sat, 7 Dec 2019 18:16:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vd2D015fz44L3; Sat, 7 Dec 2019 18:16:36 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7A841DB88; Sat, 7 Dec 2019 18:16:35 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7IGZUw053853; Sat, 7 Dec 2019 18:16:35 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7IGZkY053852; Sat, 7 Dec 2019 18:16:35 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912071816.xB7IGZkY053852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sat, 7 Dec 2019 18:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355501 - head/lib/libprocstat X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/lib/libprocstat X-SVN-Commit-Revision: 355501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 18:16:36 -0000 Author: dougm Date: Sat Dec 7 18:16:35 2019 New Revision: 355501 URL: https://svnweb.freebsd.org/changeset/base/355501 Log: r355491 broke compilation of libprocstat.c. Change that code to use new methods for accessing first, next map entries. Approved by: kib Differential Revision: https://reviews.freebsd.org/D22725 Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Dec 7 18:07:49 2019 (r355500) +++ head/lib/libprocstat/libprocstat.c Sat Dec 7 18:16:35 2019 (r355501) @@ -617,9 +617,9 @@ do_mmapped: } map = &vmspace.vm_map; - for (entryp = map->header.next; + for (entryp = vm_map_entry_first(map); entryp != &kp->ki_vmspace->vm_map.header; - entryp = vmentry.next) { + entryp = vm_map_entry_succ(vmentry)) { if (!kvm_read_all(kd, (unsigned long)entryp, &vmentry, sizeof(vmentry))) { warnx("can't read vm_map_entry at %p", From owner-svn-src-all@freebsd.org Sat Dec 7 18:40:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBF0E1C97A9; Sat, 7 Dec 2019 18:40:46 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VdZ663g9z45Pm; Sat, 7 Dec 2019 18:40:46 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B36AC1DF4F; Sat, 7 Dec 2019 18:40:46 +0000 (UTC) (envelope-from dougm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7Iekbm066161; Sat, 7 Dec 2019 18:40:46 GMT (envelope-from dougm@FreeBSD.org) Received: (from dougm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7IekjY066160; Sat, 7 Dec 2019 18:40:46 GMT (envelope-from dougm@FreeBSD.org) Message-Id: <201912071840.xB7IekjY066160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dougm set sender to dougm@FreeBSD.org using -f From: Doug Moore Date: Sat, 7 Dec 2019 18:40:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355502 - head/lib/libprocstat X-SVN-Group: head X-SVN-Commit-Author: dougm X-SVN-Commit-Paths: head/lib/libprocstat X-SVN-Commit-Revision: 355502 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 18:40:47 -0000 Author: dougm Date: Sat Dec 7 18:40:46 2019 New Revision: 355502 URL: https://svnweb.freebsd.org/changeset/base/355502 Log: Fix a type error in fixing libprocstat to be compatible with vm_map changes. Approved by: markj Differential Revision: https://reviews.freebsd.org/D22726 Modified: head/lib/libprocstat/libprocstat.c Modified: head/lib/libprocstat/libprocstat.c ============================================================================== --- head/lib/libprocstat/libprocstat.c Sat Dec 7 18:16:35 2019 (r355501) +++ head/lib/libprocstat/libprocstat.c Sat Dec 7 18:40:46 2019 (r355502) @@ -619,7 +619,7 @@ do_mmapped: for (entryp = vm_map_entry_first(map); entryp != &kp->ki_vmspace->vm_map.header; - entryp = vm_map_entry_succ(vmentry)) { + entryp = vm_map_entry_succ(&vmentry)) { if (!kvm_read_all(kd, (unsigned long)entryp, &vmentry, sizeof(vmentry))) { warnx("can't read vm_map_entry at %p", From owner-svn-src-all@freebsd.org Sat Dec 7 19:02:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A50E01CA12C; Sat, 7 Dec 2019 19:02:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vf2q4k6Lz46wS; Sat, 7 Dec 2019 19:02:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 869301E497; Sat, 7 Dec 2019 19:02:11 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7J2BbX083962; Sat, 7 Dec 2019 19:02:11 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7J29qo083948; Sat, 7 Dec 2019 19:02:09 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912071902.xB7J29qo083948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 7 Dec 2019 19:02: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: r355503 - in stable/12: contrib/less usr.bin/less X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/less usr.bin/less X-SVN-Commit-Revision: 355503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 19:02:11 -0000 Author: delphij Date: Sat Dec 7 19:02:09 2019 New Revision: 355503 URL: https://svnweb.freebsd.org/changeset/base/355503 Log: MFC r349549: MFV r349535: less v551. Relnotes: yes Modified: stable/12/contrib/less/LICENSE stable/12/contrib/less/NEWS stable/12/contrib/less/README stable/12/contrib/less/brac.c stable/12/contrib/less/ch.c stable/12/contrib/less/charset.c stable/12/contrib/less/charset.h stable/12/contrib/less/cmd.h stable/12/contrib/less/cmdbuf.c stable/12/contrib/less/command.c stable/12/contrib/less/compose.uni stable/12/contrib/less/cvt.c stable/12/contrib/less/decode.c stable/12/contrib/less/edit.c stable/12/contrib/less/filename.c stable/12/contrib/less/fmt.uni stable/12/contrib/less/forwback.c stable/12/contrib/less/funcs.h stable/12/contrib/less/help.c stable/12/contrib/less/ifile.c stable/12/contrib/less/input.c stable/12/contrib/less/jump.c stable/12/contrib/less/less.h stable/12/contrib/less/less.hlp stable/12/contrib/less/less.nro stable/12/contrib/less/lessecho.c stable/12/contrib/less/lessecho.nro stable/12/contrib/less/lesskey.c stable/12/contrib/less/lesskey.h stable/12/contrib/less/lesskey.nro stable/12/contrib/less/lglob.h stable/12/contrib/less/line.c stable/12/contrib/less/linenum.c stable/12/contrib/less/lsystem.c stable/12/contrib/less/main.c stable/12/contrib/less/mark.c stable/12/contrib/less/mkutable stable/12/contrib/less/optfunc.c stable/12/contrib/less/option.c stable/12/contrib/less/option.h stable/12/contrib/less/opttbl.c stable/12/contrib/less/os.c stable/12/contrib/less/output.c stable/12/contrib/less/pattern.c stable/12/contrib/less/pattern.h stable/12/contrib/less/pckeys.h stable/12/contrib/less/position.c stable/12/contrib/less/position.h stable/12/contrib/less/prompt.c stable/12/contrib/less/screen.c stable/12/contrib/less/scrsize.c stable/12/contrib/less/search.c stable/12/contrib/less/signal.c stable/12/contrib/less/tags.c stable/12/contrib/less/ttyin.c stable/12/contrib/less/ubin.uni stable/12/contrib/less/version.c stable/12/contrib/less/wide.uni stable/12/usr.bin/less/defines.h Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/less/LICENSE ============================================================================== --- stable/12/contrib/less/LICENSE Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/LICENSE Sat Dec 7 19:02:09 2019 (r355503) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2016 Mark Nudelman +Copyright (C) 1984-2018 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: stable/12/contrib/less/NEWS ============================================================================== --- stable/12/contrib/less/NEWS Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/NEWS Sat Dec 7 19:02:09 2019 (r355503) @@ -11,6 +11,38 @@ ====================================================================== + Major changes between "less" versions 530 and 551 + +* Add --mouse option. + +* Add --wheel-lines option. + +* Add --no-histdups option. + +* Add --save-marks option. + +* Support PCRE2 regular expression library. + +* Redraw screen on SIGWINCH even if screen size doesn't change. + +* Shell-escape filenames in history so they can be used again. + +* Ring bell if user enters invalid long option name. + +* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode. + +* Windows: use wide-char string to set console title. + +* Don't count lines in initial screen if using -X with -F. + +* Support mingw build system. + +* Fix bug in v command on empty file. + +* Fix bug in v command when filename contains shell metacharacters. + +====================================================================== + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: stable/12/contrib/less/README ============================================================================== --- stable/12/contrib/less/README Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/README Sat Dec 7 19:02:09 2019 (r355503) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 530 + Less, version 551 - This is the distribution of less, version 530, released 05 Dec 2017. + This is the distribution of less, version 551, released 11 Jun 2019. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -56,6 +56,7 @@ INSTALLATION (Unix systems only): finds a regular expression library automatically. Other values are: gnu Use the GNU regex library. pcre Use the PCRE library. + pcre2 Use the PCRE2 library. posix Use the POSIX-compatible regcomp. regcmp Use the regcmp library. re_comp Use the re_comp library. @@ -63,6 +64,7 @@ INSTALLATION (Unix systems only): regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). none No regular expressions, only simple string matching. + --with-secure Builds a "secure" version of less, with some features disabled to prevent users from viewing other files, accessing shell Modified: stable/12/contrib/less/brac.c ============================================================================== --- stable/12/contrib/less/brac.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/brac.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/ch.c ============================================================================== --- stable/12/contrib/less/ch.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/ch.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -392,7 +392,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(VOID_PARAM) { static int tried = FALSE; @@ -417,7 +417,7 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -515,7 +515,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(VOID_PARAM) { POSITION len; @@ -542,7 +542,7 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -570,7 +570,7 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(VOID_PARAM) { struct bufnode *bn; struct bufnode *firstbn; @@ -602,7 +602,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +619,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,7 +630,7 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(VOID_PARAM) { int c; @@ -653,7 +653,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(VOID_PARAM) { if (thisfile == NULL) return (EOI); @@ -693,7 +693,7 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(VOID_PARAM) { struct bufnode *bn; @@ -760,7 +760,7 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -785,7 +785,7 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(VOID_PARAM) { int h; @@ -800,7 +800,7 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(VOID_PARAM) { struct bufnode *bn; @@ -840,7 +840,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(VOID_PARAM) { ch_fsize = ch_fpos; } @@ -890,7 +890,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(VOID_PARAM) { int keepstate = FALSE; @@ -933,7 +933,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(VOID_PARAM) { if (thisfile == NULL) return (0); Modified: stable/12/contrib/less/charset.c ============================================================================== --- stable/12/contrib/less/charset.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/charset.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -245,7 +245,7 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(VOID_PARAM) { int c; @@ -315,7 +315,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt) * */ static void -set_charset() +set_charset(VOID_PARAM) { char *s; @@ -338,7 +338,7 @@ set_charset() * LESSCHARSET is not defined: try LESSCHARDEF. */ s = lgetenv("LESSCHARDEF"); - if (s != NULL && *s != '\0') + if (!isnullenv(s)) { ichardef(s); return; @@ -395,7 +395,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(VOID_PARAM) { char *s; Modified: stable/12/contrib/less/charset.h ============================================================================== --- stable/12/contrib/less/charset.h Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/charset.h Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/12/contrib/less/cmd.h ============================================================================== --- stable/12/contrib/less/cmd.h Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/cmd.h Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -71,6 +71,13 @@ #define A_RRSHIFT 59 #define A_CLRMARK 62 #define A_SETMARKBOT 63 +#define A_X11MOUSE_IN 64 +#define A_X11MOUSE_IGNORE 65 +#define A_F_MOUSE 66 +#define A_B_MOUSE 67 +/* Note "X116" refers to extended (1006) X11 mouse reporting. */ +#define A_X116MOUSE_IN 68 +#define A_X116MOUSE_IGNORE 69 #define A_INVALID 100 #define A_NOACTION 101 Modified: stable/12/contrib/less/cmdbuf.c ============================================================================== --- stable/12/contrib/less/cmdbuf.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/cmdbuf.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,8 @@ extern int sc_width; extern int utf_mode; +extern int no_hist_dups; +extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ static int cmd_col; /* Current column of the cursor */ @@ -58,6 +60,7 @@ public char closequote = '"'; #define HISTFILE_FIRST_LINE ".less-history-file:" #define HISTFILE_SEARCH_SECTION ".search" #define HISTFILE_SHELL_SECTION ".shell" +#define HISTFILE_MARK_SECTION ".mark" /* * A mlist structure represents a command history. @@ -114,7 +117,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(VOID_PARAM) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +132,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(VOID_PARAM) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -169,7 +172,7 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(VOID_PARAM) { char *s = cmdbuf; char *endline = s + strlen(s); @@ -302,7 +305,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(VOID_PARAM) { while (cmd_col > prompt_col) { @@ -321,7 +324,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(VOID_PARAM) { char *s; char *save_cp; @@ -359,7 +362,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(VOID_PARAM) { char *s; char *save_cp; @@ -389,7 +392,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(VOID_PARAM) { char *pr; char *ncp; @@ -424,7 +427,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(VOID_PARAM) { char *ncp; int width = 0; @@ -492,7 +495,7 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(VOID_PARAM) { char *s; int clen; @@ -541,7 +544,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(VOID_PARAM) { if (*cp == '\0') { @@ -560,7 +563,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(VOID_PARAM) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -586,7 +589,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(VOID_PARAM) { if (*cp == ' ') { @@ -612,7 +615,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(VOID_PARAM) { if (cmdbuf[0] == '\0') { @@ -702,6 +705,7 @@ cmd_updown(action) s = ml->string; if (s == NULL) s = ""; + cmd_offset = 0; cmd_home(); clear_eol(); strcpy(cmdbuf, s); @@ -719,6 +723,31 @@ cmd_updown(action) #endif /* + * + */ + static void +ml_link(mlist, ml) + struct mlist *mlist; + struct mlist *ml; +{ + ml->next = mlist; + ml->prev = mlist->prev; + mlist->prev->next = ml; + mlist->prev = ml; +} + +/* + * + */ + static void +ml_unlink(ml) + struct mlist *ml; +{ + ml->prev->next = ml->next; + ml->next->prev = ml->prev; +} + +/* * Add a string to an mlist. */ public void @@ -736,6 +765,21 @@ cmd_addhist(mlist, cmd, modified) if (strlen(cmd) == 0) return; + if (no_hist_dups) + { + struct mlist *next = NULL; + for (ml = mlist->next; ml->string != NULL; ml = next) + { + next = ml->next; + if (strcmp(ml->string, cmd) == 0) + { + ml_unlink(ml); + free(ml->string); + free(ml); + } + } + } + /* * Save the command unless it's a duplicate of the * last command in the history. @@ -750,10 +794,7 @@ cmd_addhist(mlist, cmd, modified) ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); ml->string = save(cmd); ml->modified = modified; - ml->next = mlist; - ml->prev = mlist->prev; - mlist->prev->next = ml; - mlist->prev = ml; + ml_link(mlist, ml); } /* * Point to the cmd just after the just-accepted command. @@ -768,13 +809,13 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(VOID_PARAM) { #if CMD_HISTORY /* * Nothing to do if there is no currently selected history list. */ - if (curr_mlist == NULL) + if (curr_mlist == NULL || curr_mlist == ml_examine) return; cmd_addhist(curr_mlist, cmdbuf, 1); curr_mlist->modified = 1; @@ -799,7 +840,7 @@ cmd_edit(c) #if TAB_COMPLETE_FILENAME #define not_in_completion() in_completion = 0 #else -#define not_in_completion() +#define not_in_completion(VOID_PARAM) #endif /* @@ -934,7 +975,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(VOID_PARAM) { char *word; #if SPACES_IN_FILENAMES @@ -1021,7 +1062,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(VOID_PARAM) { char *word; char c; @@ -1148,9 +1189,9 @@ cmd_complete(action) tk_trial = next_compl(action, tk_trial); } - /* - * Remove the original word, or the previous trial completion. - */ + /* + * Remove the original word, or the previous trial completion. + */ while (cp > tk_ipoint) (void) cmd_erase(); @@ -1323,7 +1364,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(VOID_PARAM) { return (cmdbuf); } @@ -1333,7 +1374,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(VOID_PARAM) { if (curr_mlist == NULL) return (NULL); @@ -1358,7 +1399,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(VOID_PARAM) { char *home; char *name; @@ -1366,7 +1407,7 @@ histfile_name() /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); - if (name != NULL && *name != '\0') + if (!isnullenv(name)) { if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) /* $LESSHISTFILE == "-" means don't use a history file. */ @@ -1380,11 +1421,11 @@ histfile_name() /* Otherwise, file is in $HOME. */ home = lgetenv("HOME"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) { #if OS2 home = lgetenv("INIT"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) #endif return (NULL); } @@ -1447,6 +1488,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) ml = NULL; skip = NULL; #endif + } else if (strcmp(line, HISTFILE_MARK_SECTION) == 0) + { + ml = NULL; } else if (*line == '"') { if (ml != NULL) @@ -1456,6 +1500,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) else (*action)(uparam, ml, line+1); } + } else if (*line == 'm') + { + (*action)(uparam, NULL, line); } } fclose(f); @@ -1475,9 +1522,10 @@ read_cmdhist(action, uparam, skip_search, skip_shell) static void addhist_init(void *uparam, struct mlist *ml, char *string) { - if (ml == NULL || string == NULL) - return; - cmd_addhist(ml, string, 0); + if (ml != NULL) + cmd_addhist(ml, string, 0); + else if (string != NULL) + restore_mark(string); } #endif /* CMD_HISTORY */ @@ -1485,7 +1533,7 @@ addhist_init(void *uparam, struct mlist *ml, char *str * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(VOID_PARAM) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1558,7 +1606,7 @@ copy_hist(void *uparam, struct mlist *ml, char *string { struct save_ctx *ctx = (struct save_ctx *) uparam; - if (ml != ctx->mlist) { + if (ml != NULL && ml != ctx->mlist) { /* We're changing mlists. */ if (ctx->mlist) /* Append any new entries to the end of the current mlist. */ @@ -1567,13 +1615,9 @@ copy_hist(void *uparam, struct mlist *ml, char *string ctx->mlist = ml; write_mlist_header(ctx->mlist, ctx->fout); } - if (string != NULL) + + if (string == NULL) /* End of file */ { - /* Copy the entry. */ - fprintf(ctx->fout, "\"%s\n", string); - } - if (ml == NULL) /* End of file */ - { /* Write any sections that were not in the original file. */ if (mlist_search.modified) { @@ -1587,7 +1631,12 @@ copy_hist(void *uparam, struct mlist *ml, char *string write_mlist(&mlist_shell, ctx->fout); } #endif + } else if (ml != NULL) + { + /* Copy mlist entry. */ + fprintf(ctx->fout, "\"%s\n", string); } + /* Skip marks */ } #endif /* CMD_HISTORY */ @@ -1616,7 +1665,7 @@ make_file_private(f) * Does the history file need to be updated? */ static int -histfile_modified() +histfile_modified(VOID_PARAM) { if (mlist_search.modified) return 1; @@ -1624,6 +1673,10 @@ histfile_modified() if (mlist_shell.modified) return 1; #endif +#if CMD_HISTORY + if (marks_modified) + return 1; +#endif return 0; } @@ -1631,7 +1684,7 @@ histfile_modified() * Update the .lesshst file. */ public void -save_cmdhist() +save_cmdhist(VOID_PARAM) { #if CMD_HISTORY char *histname; @@ -1665,7 +1718,8 @@ save_cmdhist() fprintf(fout, "%s\n", HISTFILE_FIRST_LINE); ctx.fout = fout; ctx.mlist = NULL; - read_cmdhist(copy_hist, &ctx, skip_search, skip_shell); + read_cmdhist(©_hist, &ctx, skip_search, skip_shell); + save_marks(fout, HISTFILE_MARK_SECTION); fclose(fout); #if MSDOS_COMPILER==WIN32C /* Modified: stable/12/contrib/less/command.c ============================================================================== --- stable/12/contrib/less/command.c Sat Dec 7 18:40:46 2019 (r355502) +++ stable/12/contrib/less/command.c Sat Dec 7 19:02:09 2019 (r355503) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -49,6 +49,7 @@ extern struct scrpos initial_scrpos; extern IFILE curr_ifile; extern void *ml_search; extern void *ml_examine; +extern int wheel_lines; #if SHELL_ESCAPE || PIPEC extern void *ml_shell; #endif @@ -60,6 +61,9 @@ extern int screen_trashed; /* The screen has been over extern int shift_count; extern int oldbot; extern int forw_prompt; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ @@ -94,14 +98,39 @@ static void multi_search(); * updating the screen. */ static void -cmd_exec() +cmd_exec(VOID_PARAM) { - clear_attn(); + clear_attn(); clear_bot(); flush(); } /* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; + deinit_mouse(); /* we don't want mouse events while entering a cmd */ + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; + init_mouse(); +} + +/* * Set up the display to start a new multi-character command. */ static void @@ -111,15 +140,13 @@ start_mca(action, prompt, mlist, cmdflags) void *mlist; int cmdflags; { - mca = action; - clear_bot(); - clear_cmd(); + set_mca(action); cmd_putstr(prompt); set_mlist(mlist, cmdflags); } public int -in_mca() +in_mca(VOID_PARAM) { return (mca != 0 && mca != A_PREFIX); } @@ -128,21 +155,18 @@ in_mca() * Set up the display to start a new search command. */ static void -mca_search() +mca_search(VOID_PARAM) { #if HILITE_SEARCH if (search_type & SRCH_FILTER) - mca = A_FILTER; + set_mca(A_FILTER); else #endif if (search_type & SRCH_FORW) - mca = A_F_SEARCH; + set_mca(A_F_SEARCH); else - mca = A_B_SEARCH; + set_mca(A_B_SEARCH); - clear_bot(); - clear_cmd(); - if (search_type & SRCH_NO_MATCH) cmd_putstr("Non-match "); if (search_type & SRCH_FIRST_FILE) @@ -171,7 +195,7 @@ mca_search() * Set up the display to start a new toggle-option command. */ static void -mca_opt_toggle() +mca_opt_toggle(VOID_PARAM) { int no_prompt; int flag; @@ -181,9 +205,7 @@ mca_opt_toggle() flag = (optflag & ~OPT_NO_PROMPT); dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; - mca = A_OPT_TOGGLE; - clear_bot(); - clear_cmd(); + set_mca(A_OPT_TOGGLE); cmd_putstr(dash); if (optgetname) cmd_putstr(dash); @@ -206,7 +228,7 @@ mca_opt_toggle() * Execute a multicharacter command. */ static void -exec_mca() +exec_mca(VOID_PARAM) { char *cbuf; @@ -373,6 +395,7 @@ mca_opt_nonfirst_char(c) { char *p; char *oname; + int err; if (curropt != NULL) { @@ -392,7 +415,8 @@ mca_opt_nonfirst_char(c) return (MCA_DONE); p = get_cmdbuf(); opt_lower = ASCII_IS_LOWER(p[0]); - curropt = findopt_name(&p, &oname, NULL); + err = 0; + curropt = findopt_name(&p, &oname, &err); if (curropt != NULL) { /* @@ -410,6 +434,9 @@ mca_opt_nonfirst_char(c) if (cmd_char(c) != CC_OK) return (MCA_DONE); } + } else if (err != OPT_AMBIG) + { + bell(); } return (MCA_MORE); } @@ -461,6 +488,7 @@ mca_opt_char(c) error("There is no %s option", &parg); return (MCA_DONE); } + opt_lower = ASCII_IS_LOWER(c); } /* * If the option which was entered does not take a @@ -470,7 +498,7 @@ mca_opt_char(c) if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || !opt_has_param(curropt)) { - toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + toggle_option(curropt, opt_lower, "", optflag); return (MCA_DONE); } /* @@ -577,7 +605,7 @@ mca_char(c) * as a normal command character. */ number = cmd_int(&fraction); - mca = 0; + clear_mca(); cmd_accept(); return (NO_MCA); } @@ -644,7 +672,7 @@ mca_char(c) * Discard any buffered file data. */ static void -clear_buffers() +clear_buffers(VOID_PARAM) { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -659,7 +687,7 @@ clear_buffers() * Make sure the screen is displayed. */ static void -make_display() +make_display(VOID_PARAM) { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -699,7 +727,7 @@ make_display() * Display the appropriate prompt. */ static void -prompt() +prompt(VOID_PARAM) { constant char *p; @@ -739,8 +767,14 @@ prompt() * In Win32, display the file name in the window title. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Dec 7 19:05:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 679881CA2FE; Sat, 7 Dec 2019 19:05:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vf732qpfz4784; Sat, 7 Dec 2019 19:05:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 257361E4B7; Sat, 7 Dec 2019 19:05:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7J5plb084184; Sat, 7 Dec 2019 19:05:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7J5ntu084172; Sat, 7 Dec 2019 19:05:49 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201912071905.xB7J5ntu084172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 7 Dec 2019 19:05:49 +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: r355504 - in stable/11: contrib/less usr.bin/less X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/less usr.bin/less X-SVN-Commit-Revision: 355504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 19:05:51 -0000 Author: delphij Date: Sat Dec 7 19:05:48 2019 New Revision: 355504 URL: https://svnweb.freebsd.org/changeset/base/355504 Log: MFC r349549: MFV r349535: less v551. Relnotes: yes Modified: stable/11/contrib/less/LICENSE stable/11/contrib/less/NEWS stable/11/contrib/less/README stable/11/contrib/less/brac.c stable/11/contrib/less/ch.c stable/11/contrib/less/charset.c stable/11/contrib/less/charset.h stable/11/contrib/less/cmd.h stable/11/contrib/less/cmdbuf.c stable/11/contrib/less/command.c stable/11/contrib/less/compose.uni stable/11/contrib/less/cvt.c stable/11/contrib/less/decode.c stable/11/contrib/less/edit.c stable/11/contrib/less/filename.c stable/11/contrib/less/fmt.uni stable/11/contrib/less/forwback.c stable/11/contrib/less/funcs.h stable/11/contrib/less/help.c stable/11/contrib/less/ifile.c stable/11/contrib/less/input.c stable/11/contrib/less/jump.c stable/11/contrib/less/less.h stable/11/contrib/less/less.hlp stable/11/contrib/less/less.nro stable/11/contrib/less/lessecho.c stable/11/contrib/less/lessecho.nro stable/11/contrib/less/lesskey.c stable/11/contrib/less/lesskey.h stable/11/contrib/less/lesskey.nro stable/11/contrib/less/lglob.h stable/11/contrib/less/line.c stable/11/contrib/less/linenum.c stable/11/contrib/less/lsystem.c stable/11/contrib/less/main.c stable/11/contrib/less/mark.c stable/11/contrib/less/mkutable stable/11/contrib/less/optfunc.c stable/11/contrib/less/option.c stable/11/contrib/less/option.h stable/11/contrib/less/opttbl.c stable/11/contrib/less/os.c stable/11/contrib/less/output.c stable/11/contrib/less/pattern.c stable/11/contrib/less/pattern.h stable/11/contrib/less/pckeys.h stable/11/contrib/less/position.c stable/11/contrib/less/position.h stable/11/contrib/less/prompt.c stable/11/contrib/less/screen.c stable/11/contrib/less/scrsize.c stable/11/contrib/less/search.c stable/11/contrib/less/signal.c stable/11/contrib/less/tags.c stable/11/contrib/less/ttyin.c stable/11/contrib/less/ubin.uni stable/11/contrib/less/version.c stable/11/contrib/less/wide.uni stable/11/usr.bin/less/defines.h Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/less/LICENSE ============================================================================== --- stable/11/contrib/less/LICENSE Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/LICENSE Sat Dec 7 19:05:48 2019 (r355504) @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2016 Mark Nudelman +Copyright (C) 1984-2018 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions Modified: stable/11/contrib/less/NEWS ============================================================================== --- stable/11/contrib/less/NEWS Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/NEWS Sat Dec 7 19:05:48 2019 (r355504) @@ -11,6 +11,38 @@ ====================================================================== + Major changes between "less" versions 530 and 551 + +* Add --mouse option. + +* Add --wheel-lines option. + +* Add --no-histdups option. + +* Add --save-marks option. + +* Support PCRE2 regular expression library. + +* Redraw screen on SIGWINCH even if screen size doesn't change. + +* Shell-escape filenames in history so they can be used again. + +* Ring bell if user enters invalid long option name. + +* Use PCRE_UTF8 flag for pcre regular expressions when in UTF-8 mode. + +* Windows: use wide-char string to set console title. + +* Don't count lines in initial screen if using -X with -F. + +* Support mingw build system. + +* Fix bug in v command on empty file. + +* Fix bug in v command when filename contains shell metacharacters. + +====================================================================== + Major changes between "less" versions 487 and 530 * Don't output terminal init sequence if using -F and file fits on one screen. Modified: stable/11/contrib/less/README ============================================================================== --- stable/11/contrib/less/README Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/README Sat Dec 7 19:05:48 2019 (r355504) @@ -7,9 +7,9 @@ ************************************************************************** ************************************************************************** - Less, version 530 + Less, version 551 - This is the distribution of less, version 530, released 05 Dec 2017. + This is the distribution of less, version 551, released 11 Jun 2019. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or @@ -56,6 +56,7 @@ INSTALLATION (Unix systems only): finds a regular expression library automatically. Other values are: gnu Use the GNU regex library. pcre Use the PCRE library. + pcre2 Use the PCRE2 library. posix Use the POSIX-compatible regcomp. regcmp Use the regcmp library. re_comp Use the re_comp library. @@ -63,6 +64,7 @@ INSTALLATION (Unix systems only): regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). none No regular expressions, only simple string matching. + --with-secure Builds a "secure" version of less, with some features disabled to prevent users from viewing other files, accessing shell Modified: stable/11/contrib/less/brac.c ============================================================================== --- stable/11/contrib/less/brac.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/brac.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/ch.c ============================================================================== --- stable/11/contrib/less/ch.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/ch.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -144,7 +144,7 @@ static int ch_addbuf(); * Get the character pointed to by the read pointer. */ int -ch_get() +ch_get(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -392,7 +392,7 @@ ch_ungetchar(c) * If we haven't read all of standard input into it, do that now. */ public void -end_logfile() +end_logfile(VOID_PARAM) { static int tried = FALSE; @@ -417,7 +417,7 @@ end_logfile() * Write all the existing buffered data to the log file. */ public void -sync_logfile() +sync_logfile(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -515,7 +515,7 @@ ch_seek(pos) * Seek to the end of the file. */ public int -ch_end_seek() +ch_end_seek(VOID_PARAM) { POSITION len; @@ -542,7 +542,7 @@ ch_end_seek() * Seek to the last position in the file that is currently buffered. */ public int -ch_end_buffer_seek() +ch_end_buffer_seek(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -570,7 +570,7 @@ ch_end_buffer_seek() * beginning of the pipe is no longer buffered. */ public int -ch_beg_seek() +ch_beg_seek(VOID_PARAM) { struct bufnode *bn; struct bufnode *firstbn; @@ -602,7 +602,7 @@ ch_beg_seek() * Return the length of the file, if known. */ public POSITION -ch_length() +ch_length(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -619,7 +619,7 @@ ch_length() * Return the current position in the file. */ public POSITION -ch_tell() +ch_tell(VOID_PARAM) { if (thisfile == NULL) return (NULL_POSITION); @@ -630,7 +630,7 @@ ch_tell() * Get the current char and post-increment the read pointer. */ public int -ch_forw_get() +ch_forw_get(VOID_PARAM) { int c; @@ -653,7 +653,7 @@ ch_forw_get() * Pre-decrement the read pointer and get the new current char. */ public int -ch_back_get() +ch_back_get(VOID_PARAM) { if (thisfile == NULL) return (EOI); @@ -693,7 +693,7 @@ ch_setbufspace(bufspace) * Flush (discard) any saved file state, including buffer contents. */ public void -ch_flush() +ch_flush(VOID_PARAM) { struct bufnode *bn; @@ -760,7 +760,7 @@ ch_flush() * The buffer is added to the tail of the buffer chain. */ static int -ch_addbuf() +ch_addbuf(VOID_PARAM) { struct buf *bp; struct bufnode *bn; @@ -785,7 +785,7 @@ ch_addbuf() * */ static void -init_hashtbl() +init_hashtbl(VOID_PARAM) { int h; @@ -800,7 +800,7 @@ init_hashtbl() * Delete all buffers for this file. */ static void -ch_delbufs() +ch_delbufs(VOID_PARAM) { struct bufnode *bn; @@ -840,7 +840,7 @@ seekable(f) * This is used after an ignore_eof read, during which the EOF may change. */ public void -ch_set_eof() +ch_set_eof(VOID_PARAM) { ch_fsize = ch_fpos; } @@ -890,7 +890,7 @@ ch_init(f, flags) * Close a filestate. */ public void -ch_close() +ch_close(VOID_PARAM) { int keepstate = FALSE; @@ -933,7 +933,7 @@ ch_close() * Return ch_flags for the current file. */ public int -ch_getflags() +ch_getflags(VOID_PARAM) { if (thisfile == NULL) return (0); Modified: stable/11/contrib/less/charset.c ============================================================================== --- stable/11/contrib/less/charset.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/charset.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -245,7 +245,7 @@ icharset(name, no_error) * Define a charset, given a locale name. */ static void -ilocale() +ilocale(VOID_PARAM) { int c; @@ -315,7 +315,7 @@ setfmt(s, fmtvarptr, attrptr, default_fmt) * */ static void -set_charset() +set_charset(VOID_PARAM) { char *s; @@ -338,7 +338,7 @@ set_charset() * LESSCHARSET is not defined: try LESSCHARDEF. */ s = lgetenv("LESSCHARDEF"); - if (s != NULL && *s != '\0') + if (!isnullenv(s)) { ichardef(s); return; @@ -395,7 +395,7 @@ set_charset() * Initialize charset data structures. */ public void -init_charset() +init_charset(VOID_PARAM) { char *s; Modified: stable/11/contrib/less/charset.h ============================================================================== --- stable/11/contrib/less/charset.h Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/charset.h Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. Modified: stable/11/contrib/less/cmd.h ============================================================================== --- stable/11/contrib/less/cmd.h Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/cmd.h Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -71,6 +71,13 @@ #define A_RRSHIFT 59 #define A_CLRMARK 62 #define A_SETMARKBOT 63 +#define A_X11MOUSE_IN 64 +#define A_X11MOUSE_IGNORE 65 +#define A_F_MOUSE 66 +#define A_B_MOUSE 67 +/* Note "X116" refers to extended (1006) X11 mouse reporting. */ +#define A_X116MOUSE_IN 68 +#define A_X116MOUSE_IGNORE 69 #define A_INVALID 100 #define A_NOACTION 101 Modified: stable/11/contrib/less/cmdbuf.c ============================================================================== --- stable/11/contrib/less/cmdbuf.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/cmdbuf.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,8 @@ extern int sc_width; extern int utf_mode; +extern int no_hist_dups; +extern int marks_modified; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ static int cmd_col; /* Current column of the cursor */ @@ -58,6 +60,7 @@ public char closequote = '"'; #define HISTFILE_FIRST_LINE ".less-history-file:" #define HISTFILE_SEARCH_SECTION ".search" #define HISTFILE_SHELL_SECTION ".shell" +#define HISTFILE_MARK_SECTION ".mark" /* * A mlist structure represents a command history. @@ -114,7 +117,7 @@ static int cmd_mbc_buf_index; * Reset command buffer (to empty). */ public void -cmd_reset() +cmd_reset(VOID_PARAM) { cp = cmdbuf; *cp = '\0'; @@ -129,7 +132,7 @@ cmd_reset() * Clear command line. */ public void -clear_cmd() +clear_cmd(VOID_PARAM) { cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; @@ -169,7 +172,7 @@ cmd_putstr(s) * How many characters are in the command buffer? */ public int -len_cmdbuf() +len_cmdbuf(VOID_PARAM) { char *s = cmdbuf; char *endline = s + strlen(s); @@ -302,7 +305,7 @@ cmd_repaint(old_cp) * and set cp to the corresponding char in cmdbuf. */ static void -cmd_home() +cmd_home(VOID_PARAM) { while (cmd_col > prompt_col) { @@ -321,7 +324,7 @@ cmd_home() * Shift the cmdbuf display left a half-screen. */ static void -cmd_lshift() +cmd_lshift(VOID_PARAM) { char *s; char *save_cp; @@ -359,7 +362,7 @@ cmd_lshift() * Shift the cmdbuf display right a half-screen. */ static void -cmd_rshift() +cmd_rshift(VOID_PARAM) { char *s; char *save_cp; @@ -389,7 +392,7 @@ cmd_rshift() * Move cursor right one character. */ static int -cmd_right() +cmd_right(VOID_PARAM) { char *pr; char *ncp; @@ -424,7 +427,7 @@ cmd_right() * Move cursor left one character. */ static int -cmd_left() +cmd_left(VOID_PARAM) { char *ncp; int width = 0; @@ -492,7 +495,7 @@ cmd_ichar(cs, clen) * Delete the char to the left of the cursor. */ static int -cmd_erase() +cmd_erase(VOID_PARAM) { char *s; int clen; @@ -541,7 +544,7 @@ cmd_erase() * Delete the char under the cursor. */ static int -cmd_delete() +cmd_delete(VOID_PARAM) { if (*cp == '\0') { @@ -560,7 +563,7 @@ cmd_delete() * Delete the "word" to the left of the cursor. */ static int -cmd_werase() +cmd_werase(VOID_PARAM) { if (cp > cmdbuf && cp[-1] == ' ') { @@ -586,7 +589,7 @@ cmd_werase() * Delete the "word" under the cursor. */ static int -cmd_wdelete() +cmd_wdelete(VOID_PARAM) { if (*cp == ' ') { @@ -612,7 +615,7 @@ cmd_wdelete() * Delete all chars in the command buffer. */ static int -cmd_kill() +cmd_kill(VOID_PARAM) { if (cmdbuf[0] == '\0') { @@ -702,6 +705,7 @@ cmd_updown(action) s = ml->string; if (s == NULL) s = ""; + cmd_offset = 0; cmd_home(); clear_eol(); strcpy(cmdbuf, s); @@ -719,6 +723,31 @@ cmd_updown(action) #endif /* + * + */ + static void +ml_link(mlist, ml) + struct mlist *mlist; + struct mlist *ml; +{ + ml->next = mlist; + ml->prev = mlist->prev; + mlist->prev->next = ml; + mlist->prev = ml; +} + +/* + * + */ + static void +ml_unlink(ml) + struct mlist *ml; +{ + ml->prev->next = ml->next; + ml->next->prev = ml->prev; +} + +/* * Add a string to an mlist. */ public void @@ -736,6 +765,21 @@ cmd_addhist(mlist, cmd, modified) if (strlen(cmd) == 0) return; + if (no_hist_dups) + { + struct mlist *next = NULL; + for (ml = mlist->next; ml->string != NULL; ml = next) + { + next = ml->next; + if (strcmp(ml->string, cmd) == 0) + { + ml_unlink(ml); + free(ml->string); + free(ml); + } + } + } + /* * Save the command unless it's a duplicate of the * last command in the history. @@ -750,10 +794,7 @@ cmd_addhist(mlist, cmd, modified) ml = (struct mlist *) ecalloc(1, sizeof(struct mlist)); ml->string = save(cmd); ml->modified = modified; - ml->next = mlist; - ml->prev = mlist->prev; - mlist->prev->next = ml; - mlist->prev = ml; + ml_link(mlist, ml); } /* * Point to the cmd just after the just-accepted command. @@ -768,13 +809,13 @@ cmd_addhist(mlist, cmd, modified) * Add it to the currently selected history list. */ public void -cmd_accept() +cmd_accept(VOID_PARAM) { #if CMD_HISTORY /* * Nothing to do if there is no currently selected history list. */ - if (curr_mlist == NULL) + if (curr_mlist == NULL || curr_mlist == ml_examine) return; cmd_addhist(curr_mlist, cmdbuf, 1); curr_mlist->modified = 1; @@ -799,7 +840,7 @@ cmd_edit(c) #if TAB_COMPLETE_FILENAME #define not_in_completion() in_completion = 0 #else -#define not_in_completion() +#define not_in_completion(VOID_PARAM) #endif /* @@ -934,7 +975,7 @@ cmd_istr(str) * cursor at the end of the word. */ static char * -delimit_word() +delimit_word(VOID_PARAM) { char *word; #if SPACES_IN_FILENAMES @@ -1021,7 +1062,7 @@ delimit_word() * which start with that word, and set tk_text to that list. */ static void -init_compl() +init_compl(VOID_PARAM) { char *word; char c; @@ -1148,9 +1189,9 @@ cmd_complete(action) tk_trial = next_compl(action, tk_trial); } - /* - * Remove the original word, or the previous trial completion. - */ + /* + * Remove the original word, or the previous trial completion. + */ while (cp > tk_ipoint) (void) cmd_erase(); @@ -1323,7 +1364,7 @@ cmd_int(frac) * Return a pointer to the command buffer. */ public char * -get_cmdbuf() +get_cmdbuf(VOID_PARAM) { return (cmdbuf); } @@ -1333,7 +1374,7 @@ get_cmdbuf() * Return the last (most recent) string in the current command history. */ public char * -cmd_lastpattern() +cmd_lastpattern(VOID_PARAM) { if (curr_mlist == NULL) return (NULL); @@ -1358,7 +1399,7 @@ mlist_size(ml) * Get the name of the history file. */ static char * -histfile_name() +histfile_name(VOID_PARAM) { char *home; char *name; @@ -1366,7 +1407,7 @@ histfile_name() /* See if filename is explicitly specified by $LESSHISTFILE. */ name = lgetenv("LESSHISTFILE"); - if (name != NULL && *name != '\0') + if (!isnullenv(name)) { if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) /* $LESSHISTFILE == "-" means don't use a history file. */ @@ -1380,11 +1421,11 @@ histfile_name() /* Otherwise, file is in $HOME. */ home = lgetenv("HOME"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) { #if OS2 home = lgetenv("INIT"); - if (home == NULL || *home == '\0') + if (isnullenv(home)) #endif return (NULL); } @@ -1447,6 +1488,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) ml = NULL; skip = NULL; #endif + } else if (strcmp(line, HISTFILE_MARK_SECTION) == 0) + { + ml = NULL; } else if (*line == '"') { if (ml != NULL) @@ -1456,6 +1500,9 @@ read_cmdhist2(action, uparam, skip_search, skip_shell) else (*action)(uparam, ml, line+1); } + } else if (*line == 'm') + { + (*action)(uparam, NULL, line); } } fclose(f); @@ -1475,9 +1522,10 @@ read_cmdhist(action, uparam, skip_search, skip_shell) static void addhist_init(void *uparam, struct mlist *ml, char *string) { - if (ml == NULL || string == NULL) - return; - cmd_addhist(ml, string, 0); + if (ml != NULL) + cmd_addhist(ml, string, 0); + else if (string != NULL) + restore_mark(string); } #endif /* CMD_HISTORY */ @@ -1485,7 +1533,7 @@ addhist_init(void *uparam, struct mlist *ml, char *str * Initialize history from a .lesshist file. */ public void -init_cmdhist() +init_cmdhist(VOID_PARAM) { #if CMD_HISTORY read_cmdhist(&addhist_init, NULL, 0, 0); @@ -1558,7 +1606,7 @@ copy_hist(void *uparam, struct mlist *ml, char *string { struct save_ctx *ctx = (struct save_ctx *) uparam; - if (ml != ctx->mlist) { + if (ml != NULL && ml != ctx->mlist) { /* We're changing mlists. */ if (ctx->mlist) /* Append any new entries to the end of the current mlist. */ @@ -1567,13 +1615,9 @@ copy_hist(void *uparam, struct mlist *ml, char *string ctx->mlist = ml; write_mlist_header(ctx->mlist, ctx->fout); } - if (string != NULL) + + if (string == NULL) /* End of file */ { - /* Copy the entry. */ - fprintf(ctx->fout, "\"%s\n", string); - } - if (ml == NULL) /* End of file */ - { /* Write any sections that were not in the original file. */ if (mlist_search.modified) { @@ -1587,7 +1631,12 @@ copy_hist(void *uparam, struct mlist *ml, char *string write_mlist(&mlist_shell, ctx->fout); } #endif + } else if (ml != NULL) + { + /* Copy mlist entry. */ + fprintf(ctx->fout, "\"%s\n", string); } + /* Skip marks */ } #endif /* CMD_HISTORY */ @@ -1616,7 +1665,7 @@ make_file_private(f) * Does the history file need to be updated? */ static int -histfile_modified() +histfile_modified(VOID_PARAM) { if (mlist_search.modified) return 1; @@ -1624,6 +1673,10 @@ histfile_modified() if (mlist_shell.modified) return 1; #endif +#if CMD_HISTORY + if (marks_modified) + return 1; +#endif return 0; } @@ -1631,7 +1684,7 @@ histfile_modified() * Update the .lesshst file. */ public void -save_cmdhist() +save_cmdhist(VOID_PARAM) { #if CMD_HISTORY char *histname; @@ -1665,7 +1718,8 @@ save_cmdhist() fprintf(fout, "%s\n", HISTFILE_FIRST_LINE); ctx.fout = fout; ctx.mlist = NULL; - read_cmdhist(copy_hist, &ctx, skip_search, skip_shell); + read_cmdhist(©_hist, &ctx, skip_search, skip_shell); + save_marks(fout, HISTFILE_MARK_SECTION); fclose(fout); #if MSDOS_COMPILER==WIN32C /* Modified: stable/11/contrib/less/command.c ============================================================================== --- stable/11/contrib/less/command.c Sat Dec 7 19:02:09 2019 (r355503) +++ stable/11/contrib/less/command.c Sat Dec 7 19:05:48 2019 (r355504) @@ -1,6 +1,6 @@ /* $FreeBSD$ */ /* - * Copyright (C) 1984-2017 Mark Nudelman + * Copyright (C) 1984-2019 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -49,6 +49,7 @@ extern struct scrpos initial_scrpos; extern IFILE curr_ifile; extern void *ml_search; extern void *ml_examine; +extern int wheel_lines; #if SHELL_ESCAPE || PIPEC extern void *ml_shell; #endif @@ -60,6 +61,9 @@ extern int screen_trashed; /* The screen has been over extern int shift_count; extern int oldbot; extern int forw_prompt; +#if MSDOS_COMPILER==WIN32C +extern int utf_mode; +#endif #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ @@ -94,14 +98,39 @@ static void multi_search(); * updating the screen. */ static void -cmd_exec() +cmd_exec(VOID_PARAM) { - clear_attn(); + clear_attn(); clear_bot(); flush(); } /* + * Indicate we are reading a multi-character command. + */ + static void +set_mca(action) + int action; +{ + mca = action; + deinit_mouse(); /* we don't want mouse events while entering a cmd */ + clear_bot(); + clear_cmd(); +} + +/* + * Indicate we are not reading a multi-character command. + */ + static void +clear_mca(VOID_PARAM) +{ + if (mca == 0) + return; + mca = 0; + init_mouse(); +} + +/* * Set up the display to start a new multi-character command. */ static void @@ -111,15 +140,13 @@ start_mca(action, prompt, mlist, cmdflags) void *mlist; int cmdflags; { - mca = action; - clear_bot(); - clear_cmd(); + set_mca(action); cmd_putstr(prompt); set_mlist(mlist, cmdflags); } public int -in_mca() +in_mca(VOID_PARAM) { return (mca != 0 && mca != A_PREFIX); } @@ -128,21 +155,18 @@ in_mca() * Set up the display to start a new search command. */ static void -mca_search() +mca_search(VOID_PARAM) { #if HILITE_SEARCH if (search_type & SRCH_FILTER) - mca = A_FILTER; + set_mca(A_FILTER); else #endif if (search_type & SRCH_FORW) - mca = A_F_SEARCH; + set_mca(A_F_SEARCH); else - mca = A_B_SEARCH; + set_mca(A_B_SEARCH); - clear_bot(); - clear_cmd(); - if (search_type & SRCH_NO_MATCH) cmd_putstr("Non-match "); if (search_type & SRCH_FIRST_FILE) @@ -171,7 +195,7 @@ mca_search() * Set up the display to start a new toggle-option command. */ static void -mca_opt_toggle() +mca_opt_toggle(VOID_PARAM) { int no_prompt; int flag; @@ -181,9 +205,7 @@ mca_opt_toggle() flag = (optflag & ~OPT_NO_PROMPT); dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; - mca = A_OPT_TOGGLE; - clear_bot(); - clear_cmd(); + set_mca(A_OPT_TOGGLE); cmd_putstr(dash); if (optgetname) cmd_putstr(dash); @@ -206,7 +228,7 @@ mca_opt_toggle() * Execute a multicharacter command. */ static void -exec_mca() +exec_mca(VOID_PARAM) { char *cbuf; @@ -373,6 +395,7 @@ mca_opt_nonfirst_char(c) { char *p; char *oname; + int err; if (curropt != NULL) { @@ -392,7 +415,8 @@ mca_opt_nonfirst_char(c) return (MCA_DONE); p = get_cmdbuf(); opt_lower = ASCII_IS_LOWER(p[0]); - curropt = findopt_name(&p, &oname, NULL); + err = 0; + curropt = findopt_name(&p, &oname, &err); if (curropt != NULL) { /* @@ -410,6 +434,9 @@ mca_opt_nonfirst_char(c) if (cmd_char(c) != CC_OK) return (MCA_DONE); } + } else if (err != OPT_AMBIG) + { + bell(); } return (MCA_MORE); } @@ -461,6 +488,7 @@ mca_opt_char(c) error("There is no %s option", &parg); return (MCA_DONE); } + opt_lower = ASCII_IS_LOWER(c); } /* * If the option which was entered does not take a @@ -470,7 +498,7 @@ mca_opt_char(c) if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || !opt_has_param(curropt)) { - toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + toggle_option(curropt, opt_lower, "", optflag); return (MCA_DONE); } /* @@ -577,7 +605,7 @@ mca_char(c) * as a normal command character. */ number = cmd_int(&fraction); - mca = 0; + clear_mca(); cmd_accept(); return (NO_MCA); } @@ -644,7 +672,7 @@ mca_char(c) * Discard any buffered file data. */ static void -clear_buffers() +clear_buffers(VOID_PARAM) { if (!(ch_getflags() & CH_CANSEEK)) return; @@ -659,7 +687,7 @@ clear_buffers() * Make sure the screen is displayed. */ static void -make_display() +make_display(VOID_PARAM) { /* * If nothing is displayed yet, display starting from initial_scrpos. @@ -699,7 +727,7 @@ make_display() * Display the appropriate prompt. */ static void -prompt() +prompt(VOID_PARAM) { constant char *p; @@ -739,8 +767,14 @@ prompt() * In Win32, display the file name in the window title. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sat Dec 7 19:36:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C0731CAEEE; Sat, 7 Dec 2019 19:36:41 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47Vfpd2jVtz48Y2; Sat, 7 Dec 2019 19:36:41 +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 3BF161EA0E; Sat, 7 Dec 2019 19:36:41 +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 xB7JafGk002223; Sat, 7 Dec 2019 19:36:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7Jafk0002222; Sat, 7 Dec 2019 19:36:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912071936.xB7Jafk0002222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 7 Dec 2019 19:36:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355505 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 355505 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 19:36:41 -0000 Author: markj Date: Sat Dec 7 19:36:40 2019 New Revision: 355505 URL: https://svnweb.freebsd.org/changeset/base/355505 Log: Provide vm_map_entry traversal routines to userspace. This is required for now to allow libprocstat to compile. Discussed with: dougm Modified: head/sys/vm/vm_map.h Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Sat Dec 7 19:05:48 2019 (r355504) +++ head/sys/vm/vm_map.h Sat Dec 7 19:36:40 2019 (r355505) @@ -402,27 +402,6 @@ long vmspace_resident_count(struct vmspace *vmspace); #define VM_MAP_WIRE_WRITE 4 /* Validate writable. */ -#ifdef _KERNEL -boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t); -vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t); -int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t); -int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, - vm_offset_t, int, vm_prot_t, vm_prot_t, int); -int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, - vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int); -int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t, - vm_prot_t, vm_prot_t, int); -vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t); -int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t); -void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t); -int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int); -int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, - vm_pindex_t *, vm_prot_t *, boolean_t *); -int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, - vm_pindex_t *, vm_prot_t *, boolean_t *); -void vm_map_lookup_done (vm_map_t, vm_map_entry_t); -boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); - static inline vm_map_entry_t vm_map_entry_first(vm_map_t map) { @@ -448,6 +427,27 @@ vm_map_entry_succ(vm_map_entry_t entry) for ((it) = vm_map_entry_first(map); \ (it) != &(map)->header; \ (it) = vm_map_entry_succ(it)) + +#ifdef _KERNEL +boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t); +vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_t); +int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t); +int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, + vm_offset_t, int, vm_prot_t, vm_prot_t, int); +int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, + vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int); +int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t, + vm_prot_t, vm_prot_t, int); +vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t); +int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t); +void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t); +int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int); +int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, + vm_pindex_t *, vm_prot_t *, boolean_t *); +int vm_map_lookup_locked(vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, + vm_pindex_t *, vm_prot_t *, boolean_t *); +void vm_map_lookup_done (vm_map_t, vm_map_entry_t); +boolean_t vm_map_lookup_entry (vm_map_t, vm_offset_t, vm_map_entry_t *); int vm_map_protect (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t, boolean_t); int vm_map_remove (vm_map_t, vm_offset_t, vm_offset_t); void vm_map_try_merge_entries(vm_map_t map, vm_map_entry_t prev, From owner-svn-src-all@freebsd.org Sat Dec 7 20:01:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 757ED1CB43B; Sat, 7 Dec 2019 20:01:56 +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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VgMm2HKsz49Xj; Sat, 7 Dec 2019 20:01:56 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31C1C1EE4A; Sat, 7 Dec 2019 20:01:56 +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 xB7K1ux5016477; Sat, 7 Dec 2019 20:01:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7K1uBE016476; Sat, 7 Dec 2019 20:01:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201912072001.xB7K1uBE016476@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sat, 7 Dec 2019 20:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355506 - head/usr.bin/gcore X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.bin/gcore X-SVN-Commit-Revision: 355506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 20:01:56 -0000 Author: markj Date: Sat Dec 7 20:01:55 2019 New Revision: 355506 URL: https://svnweb.freebsd.org/changeset/base/355506 Log: gcore: Avoid using vm_map_entry_t. Use an internally defined structure instead, to avoid relying on kernel structure details. No functional change intended. MFC after: 1 week Modified: head/usr.bin/gcore/elfcore.c Modified: head/usr.bin/gcore/elfcore.c ============================================================================== --- head/usr.bin/gcore/elfcore.c Sat Dec 7 19:36:40 2019 (r355505) +++ head/usr.bin/gcore/elfcore.c Sat Dec 7 20:01:55 2019 (r355506) @@ -44,8 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -64,8 +62,15 @@ __FBSDID("$FreeBSD$"); * Code for generating ELF core dumps. */ -typedef void (*segment_callback)(vm_map_entry_t, void *); +struct map_entry { + struct map_entry *next; + vm_offset_t start; + vm_offset_t end; + vm_prot_t protection; +}; +typedef void (*segment_callback)(struct map_entry *, void *); + /* Closure for cb_put_phdr(). */ struct phdr_closure { Elf_Phdr *phdr; /* Program header to fill in */ @@ -101,9 +106,9 @@ typedef struct ptrace_lwpinfo elfcore_lwpinfo_t; typedef void* (*notefunc_t)(void *, size_t *); -static void cb_put_phdr(vm_map_entry_t, void *); -static void cb_size_segment(vm_map_entry_t, void *); -static void each_dumpable_segment(vm_map_entry_t, segment_callback, +static void cb_put_phdr(struct map_entry *, void *); +static void cb_size_segment(struct map_entry *, void *); +static void each_dumpable_segment(struct map_entry *, segment_callback, void *closure); static void elf_detach(void); /* atexit() handler. */ static void *elf_note_fpregset(void *, size_t *); @@ -130,12 +135,12 @@ static void *elf_note_procstat_psstrings(void *, size_ static void *elf_note_procstat_rlimit(void *, size_t *); static void *elf_note_procstat_umask(void *, size_t *); static void *elf_note_procstat_vmmap(void *, size_t *); -static void elf_puthdr(int, pid_t, vm_map_entry_t, void *, size_t, size_t, +static void elf_puthdr(int, pid_t, struct map_entry *, void *, size_t, size_t, size_t, int); static void elf_putnote(int, notefunc_t, void *, struct sbuf *); static void elf_putnotes(pid_t, struct sbuf *, size_t *); -static void freemap(vm_map_entry_t); -static vm_map_entry_t readmap(pid_t); +static void freemap(struct map_entry *); +static struct map_entry *readmap(pid_t); static void *procstat_sysctl(void *, int, size_t, size_t *sizep); static pid_t g_pid; /* Pid being dumped, global for elf_detach */ @@ -193,7 +198,7 @@ elf_detach(void) static void elf_coredump(int efd, int fd, pid_t pid) { - vm_map_entry_t map; + struct map_entry *map; struct sseg_closure seginfo; struct sbuf *sb; void *hdr; @@ -294,7 +299,7 @@ elf_coredump(int efd, int fd, pid_t pid) * program header entry. */ static void -cb_put_phdr(vm_map_entry_t entry, void *closure) +cb_put_phdr(struct map_entry *entry, void *closure) { struct phdr_closure *phc = (struct phdr_closure *)closure; Elf_Phdr *phdr = phc->phdr; @@ -324,7 +329,7 @@ cb_put_phdr(vm_map_entry_t entry, void *closure) * the number of segments and their total size. */ static void -cb_size_segment(vm_map_entry_t entry, void *closure) +cb_size_segment(struct map_entry *entry, void *closure) { struct sseg_closure *ssc = (struct sseg_closure *)closure; @@ -338,11 +343,12 @@ cb_size_segment(vm_map_entry_t entry, void *closure) * data. */ static void -each_dumpable_segment(vm_map_entry_t map, segment_callback func, void *closure) +each_dumpable_segment(struct map_entry *map, segment_callback func, + void *closure) { - vm_map_entry_t entry; + struct map_entry *entry; - for (entry = map; entry != NULL; entry = entry->next) + for (entry = map; entry != NULL; entry = entry->next) (*func)(entry, closure); } @@ -440,7 +446,7 @@ elf_putnote(int type, notefunc_t notefunc, void *arg, * Generate the ELF coredump header. */ static void -elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, void *hdr, size_t hdrsize, +elf_puthdr(int efd, pid_t pid, struct map_entry *map, void *hdr, size_t hdrsize, size_t notesz, size_t segoff, int numsegs) { Elf_Ehdr *ehdr, binhdr; @@ -531,11 +537,12 @@ elf_puthdr(int efd, pid_t pid, vm_map_entry_t map, voi * Free the memory map. */ static void -freemap(vm_map_entry_t map) +freemap(struct map_entry *map) { + struct map_entry *next; while (map != NULL) { - vm_map_entry_t next = map->next; + next = map->next; free(map); map = next; } @@ -547,10 +554,10 @@ freemap(vm_map_entry_t map) * returned. The map entries in the list aren't fully filled in; only * the items we need are present. */ -static vm_map_entry_t +static struct map_entry * readmap(pid_t pid) { - vm_map_entry_t ent, *linkp, map; + struct map_entry *ent, **linkp, *map; struct kinfo_vmentry *vmentl, *kve; int i, nitems; From owner-svn-src-all@freebsd.org Sat Dec 7 23:13:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 474C41CFBBA; Sat, 7 Dec 2019 23:13:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47VldD12x8z4L6L; Sat, 7 Dec 2019 23:13:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 080E92116E; Sat, 7 Dec 2019 23:13:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB7NDpN3032501; Sat, 7 Dec 2019 23:13:51 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB7NDpPi032500; Sat, 7 Dec 2019 23:13:51 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201912072313.xB7NDpPi032500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 7 Dec 2019 23:13:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355507 - head/sys/fs/nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sys/fs/nfs X-SVN-Commit-Revision: 355507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Dec 2019 23:13:52 -0000 Author: rmacklem Date: Sat Dec 7 23:13:51 2019 New Revision: 355507 URL: https://svnweb.freebsd.org/changeset/base/355507 Log: Add some definitions for NFSv4.2 which will be used by subsequent commits. This is a preliminary commit of NFSv4.2 definitions that will be used by subsequent commits which adds NFSv4.2 support to the NFS client and server. There will be a series of these preliminary commits that will prepare for a major commit of the NFSv4.2 client/server changes currently found in subversion under projects/nfsv42/sys. Modified: head/sys/fs/nfs/nfsport.h Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Sat Dec 7 20:01:55 2019 (r355506) +++ head/sys/fs/nfs/nfsport.h Sat Dec 7 23:13:51 2019 (r355507) @@ -257,9 +257,38 @@ /* * Must be one more than last op#. - * NFSv4.2 isn't implemented yet, but define the op# limit for it. */ #define NFSV41_NOPS 59 + +/* + * Additional operations for NFSv4.2. + */ +#define NFSV4OP_ALLOCATE 59 +#define NFSV4OP_COPY 60 +#define NFSV4OP_COPYNOTIFY 61 +#define NFSV4OP_DEALLOCATE 62 +#define NFSV4OP_IOADVISE 63 +#define NFSV4OP_LAYOUTERROR 64 +#define NFSV4OP_LAYOUTSTATS 65 +#define NFSV4OP_OFFLOADCANCEL 66 +#define NFSV4OP_OFFLOADSTATUS 67 +#define NFSV4OP_READPLUS 68 +#define NFSV4OP_SEEK 69 +#define NFSV4OP_WRITESAME 70 +#define NFSV4OP_CLONE 71 + +/* One greater than the last Operation # defined in RFC-7862. */ +#define NFSV42_PURENOPS 72 + +/* and the optional Extended attribute operations (RFC-8276). */ +#define NFSV4OP_GETXATTR 72 +#define NFSV4OP_SETXATTR 73 +#define NFSV4OP_LISTXATTRS 74 +#define NFSV4OP_REMOVEXATTR 75 + +/* + * Must be one more than the last NFSv4.2 op#. + */ #define NFSV42_NOPS 72 /* Quirky case if the illegal op code */ @@ -309,6 +338,12 @@ #define NFSV4OP_CBNOTIFYDEVID 14 #define NFSV41_CBNOPS 15 + +/* + * Additional callback operations for NFSv4.2. + */ +#define NFSV4OP_CBOFFLOAD 15 + #define NFSV42_CBNOPS 16 /* @@ -366,6 +401,24 @@ * Must be defined as one higher than the last NFSv4.1 Proc# above. */ #define NFSV41_NPROCS 56 + +/* Additional procedures for NFSv4.2. */ +#define NFSPROC_IOADVISE 56 +#define NFSPROC_ALLOCATE 57 +#define NFSPROC_COPY 58 +#define NFSPROC_SEEK 59 +#define NFSPROC_SEEKDS 60 + +/* and the ones for the optional Extended attribute support (RFC-8276). */ +#define NFSPROC_GETEXTATTR 61 +#define NFSPROC_SETEXTATTR 62 +#define NFSPROC_RMEXTATTR 63 +#define NFSPROC_LISTEXTATTR 64 + +/* + * Must be defined as one higher than the last NFSv4.2 Proc# above. + */ +#define NFSV42_NPROCS 65 #endif /* NFS_V3NPROCS */