svn commit: r358566 - stable/11/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 08:24:09 2020
New Revision: 358566
URL: https://svnweb.freebsd.org/changeset/base/358566

Log:
  MFC r358297: Fix IPv6 checksums when exthdrs are present.
  
  In two places in ip6_output we are doing (delayed) checksum calculations.
  The initial logic came from SCTP in r205075,205104 and later I copied
  and adjusted it for the TCP|UDP case in r235958.
  The problem was that the original SCTP offsets were already wrong for any
  case with extension headers present given IPv6 extension headers are not
  part of the pseudo checksum calculations.
  The later changes do not help in case there is checksum offloading as for
  extension headers (incl. fragments) we do currrently never offload as we
  have no infrastructure to know whether the NIC can handle these cases.
  
  Correct the offsets for delayed checksum calculations and properly handle
  mbuf flags.  In addition harmonize the almost identical duplicate code.
  
  While here eliminate the now unneeded variable hlen and add an always
  missing mtod() call in the 1-b and 3 cases after the introduction of
  the mb_unmapped_to_ext() calls. [Keep code in sync with head]
  
  Reported by:  Francis Dupont (fdupont isc.org)
  PR:   243675

Modified:
  stable/11/sys/netinet6/ip6_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet6/ip6_output.c
==
--- stable/11/sys/netinet6/ip6_output.c Tue Mar  3 03:22:00 2020
(r358565)
+++ stable/11/sys/netinet6/ip6_output.c Tue Mar  3 08:24:09 2020
(r358566)
@@ -209,6 +209,36 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_sho
*(u_short *)mtodo(m, offset) = csum;
 }
 
+static int
+ip6_output_delayed_csum(struct mbuf *m, struct ifnet *ifp, int csum_flags,
+int plen, int optlen, bool frag __unused)
+{
+
+   KASSERT((plen >= optlen), ("%s:%d: plen %d < optlen %d, m %p, ifp %p "
+   "csum_flags %#x frag %d\n",
+   __func__, __LINE__, plen, optlen, m, ifp, csum_flags, frag));
+
+   if ((csum_flags & CSUM_DELAY_DATA_IPV6) ||
+#ifdef SCTP
+   (csum_flags & CSUM_SCTP_IPV6) ||
+#endif
+   false) {
+   if (csum_flags & CSUM_DELAY_DATA_IPV6) {
+   in6_delayed_cksum(m, plen - optlen,
+   sizeof(struct ip6_hdr) + optlen);
+   m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
+   }
+#ifdef SCTP
+   if (csum_flags & CSUM_SCTP_IPV6) {
+   sctp_delayed_cksum(m, sizeof(struct ip6_hdr) + optlen);
+   m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
+   }
+#endif
+   }
+
+   return (0);
+}
+
 int
 ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto,
 int mtu, uint32_t id)
@@ -308,7 +338,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ifnet *ifp, *origifp;
struct mbuf *m = m0;
struct mbuf *mprev;
-   int hlen, tlen, len;
+   int tlen, len;
struct route_in6 ip6route;
struct rtentry *rt = NULL;
struct sockaddr_in6 *dst, src_sa, dst_sa;
@@ -929,17 +959,10 @@ passout:
 * XXX-BZ  Need a framework to know when the NIC can handle it, even
 * with ext. hdrs.
 */
-   if (sw_csum & CSUM_DELAY_DATA_IPV6) {
-   sw_csum &= ~CSUM_DELAY_DATA_IPV6;
-   in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr));
-   }
-#ifdef SCTP
-   if (sw_csum & CSUM_SCTP_IPV6) {
-   sw_csum &= ~CSUM_SCTP_IPV6;
-   sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
-   }
-#endif
-   m->m_pkthdr.csum_flags &= ifp->if_hwassist;
+   error = ip6_output_delayed_csum(m, ifp, sw_csum, plen, optlen, false);
+   if (error != 0)
+   goto bad;
+   /* XXX-BZ m->m_pkthdr.csum_flags &= ~ifp->if_hwassist; */
tlen = m->m_pkthdr.len;
 
if ((opt && (opt->ip6po_flags & IP6PO_DONTFRAG)) || tso)
@@ -1003,11 +1026,10 @@ passout:
 * fragment if possible.
 * Must be able to put at least 8 bytes per fragment.
 */
-   hlen = unfragpartlen;
if (mtu > IPV6_MAXPACKET)
mtu = IPV6_MAXPACKET;
 
-   len = (mtu - hlen - sizeof(struct ip6_frag)) & ~7;
+   len = (mtu - unfragpartlen - sizeof(struct ip6_frag)) & ~7;
if (len < 8) {
error = EMSGSIZE;
in6_ifstat_inc(ifp, ifs6_out_fragfail);
@@ -1019,16 +1041,11 @@ passout:
 * fragmented packets, then do it here.
 * XXX-BZ handle the hw offloading case.  Need flags.
 */
-   if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA_IPV6) {
-   in6_delayed_cksum(

svn commit: r358567 - in head/sys/arm64: arm64 include

2020-03-03 Thread Andrew Turner
Author: andrew
Date: Tue Mar  3 08:28:16 2020
New Revision: 358567
URL: https://svnweb.freebsd.org/changeset/base/358567

Log:
  Store the boot exception level on arm64 so it can be queried later
  
  A hypervisor, e.g. bhyve, will need to know what exception levelthe kernel
  was in when it started booting. If it was EL2 we can then enable said
  hypervisor.
  
  Store the boot exception level and allow the kernel to later query it.
  
  Obtained from:https://github.com/FreeBSD-UPB/freebsd (earlier version)
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/locore.S
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/include/machdep.h

Modified: head/sys/arm64/arm64/genassym.c
==
--- head/sys/arm64/arm64/genassym.c Tue Mar  3 08:24:09 2020
(r358566)
+++ head/sys/arm64/arm64/genassym.c Tue Mar  3 08:28:16 2020
(r358567)
@@ -45,6 +45,7 @@ ASSYM(BP_KERN_L1PT, offsetof(struct arm64_bootparams, 
 ASSYM(BP_KERN_DELTA, offsetof(struct arm64_bootparams, kern_delta));
 ASSYM(BP_KERN_STACK, offsetof(struct arm64_bootparams, kern_stack));
 ASSYM(BP_KERN_L0PT, offsetof(struct arm64_bootparams, kern_l0pt));
+ASSYM(BP_BOOT_EL, offsetof(struct arm64_bootparams, boot_el));
 
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);

Modified: head/sys/arm64/arm64/locore.S
==
--- head/sys/arm64/arm64/locore.S   Tue Mar  3 08:24:09 2020
(r358566)
+++ head/sys/arm64/arm64/locore.S   Tue Mar  3 08:28:16 2020
(r358567)
@@ -165,6 +165,7 @@ virtdone:
adr x25, initstack
str x25, [x0, #BP_KERN_STACK]
str x24, [x0, #BP_KERN_L0PT]
+   str x23, [x0, #BP_BOOT_EL]
 
/* trace back starts here */
mov fp, #0
@@ -227,9 +228,9 @@ END(mpentry)
  * registers and drop to EL1.
  */
 drop_to_el1:
-   mrs x1, CurrentEL
-   lsr x1, x1, #2
-   cmp x1, #0x2
+   mrs x23, CurrentEL
+   lsr x23, x23, #2
+   cmp x23, #0x2
b.eq1f
ret
 1:

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Tue Mar  3 08:24:09 2020
(r358566)
+++ head/sys/arm64/arm64/machdep.c  Tue Mar  3 08:28:16 2020
(r358567)
@@ -109,6 +109,7 @@ static struct trapframe proc0_tf;
 
 int early_boot = 1;
 int cold = 1;
+static int boot_el;
 
 struct kva_md_info kmi;
 
@@ -162,6 +163,13 @@ pan_enable(void)
}
 }
 
+bool
+has_hyp(void)
+{
+
+   return (boot_el == 2);
+}
+
 static void
 cpu_startup(void *dummy)
 {
@@ -1089,6 +1097,8 @@ initarm(struct arm64_bootparams *abp)
vm_offset_t lastaddr;
caddr_t kmdp;
bool valid;
+
+   boot_el = abp->boot_el;
 
/* Parse loader or FDT boot parametes. Determine last used address. */
lastaddr = parse_boot_param(abp);

Modified: head/sys/arm64/include/machdep.h
==
--- head/sys/arm64/include/machdep.hTue Mar  3 08:24:09 2020
(r358566)
+++ head/sys/arm64/include/machdep.hTue Mar  3 08:28:16 2020
(r358567)
@@ -35,6 +35,8 @@ struct arm64_bootparams {
uint64_tkern_delta;
vm_offset_t kern_stack;
vm_offset_t kern_l0pt;  /* L1 page table for the kernel */
+   int boot_el;/* EL the kernel booted from */
+   int pad;
 };
 
 enum arm64_bus {
@@ -46,6 +48,7 @@ enum arm64_bus {
 extern enum arm64_bus arm64_bus_method;
 
 void dbg_init(void);
+bool has_hyp(void);
 void initarm(struct arm64_bootparams *);
 vm_offset_t parse_boot_param(struct arm64_bootparams *abp);
 #ifdef FDT
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358568 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 09:45:16 2020
New Revision: 358568
URL: https://svnweb.freebsd.org/changeset/base/358568

Log:
  fib6_rte_to_nh_*: return a link-local gw address with scope embedded
  
  In fib6_rte_to_nh_* when returning a link-local gateway address
  currently we do clear the scope. That could be recovered using
  the ifp returned as well, but the code in general seems to
  expect a link-local address with scope embeedded as otherwise
  the "dst" (gw) passed to the output routines will not include
  scope and not send the packet out (the right interface).
  
  Do not clear the scope when returning a link-local address and
  allow packets to go out (the right interface).
  
  Remove the (now) extra scope recovery in the IPv6 fast-fwd code.
  
  Sponsored by: Netflix
  Reviewed by:  melifaro, ae
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D23872

Modified:
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/ip6_fastfwd.c

Modified: head/sys/netinet6/in6_fib.c
==
--- head/sys/netinet6/in6_fib.c Tue Mar  3 08:28:16 2020(r358567)
+++ head/sys/netinet6/in6_fib.c Tue Mar  3 09:45:16 2020(r358568)
@@ -115,9 +115,9 @@ fib6_rte_to_nh_basic(struct rtentry *rte, const struct
 
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
+   /* Return address with embedded scope. */
gw = (struct sockaddr_in6 *)rte->rt_gateway;
pnh6->nh_addr = gw->sin6_addr;
-   in6_clearscope(&pnh6->nh_addr);
} else
pnh6->nh_addr = *dst;
/* Set flags */
@@ -143,9 +143,9 @@ fib6_rte_to_nh_extended(struct rtentry *rte, const str
 
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
+   /* Return address with embedded scope. */
gw = (struct sockaddr_in6 *)rte->rt_gateway;
pnh6->nh_addr = gw->sin6_addr;
-   in6_clearscope(&pnh6->nh_addr);
} else
pnh6->nh_addr = *dst;
/* Set flags */

Modified: head/sys/netinet6/ip6_fastfwd.c
==
--- head/sys/netinet6/ip6_fastfwd.c Tue Mar  3 08:28:16 2020
(r358567)
+++ head/sys/netinet6/ip6_fastfwd.c Tue Mar  3 09:45:16 2020
(r358568)
@@ -274,14 +274,7 @@ passout:
m_clrprotoflags(m); /* Avoid confusing lower layers. */
IP_PROBE(send, NULL, NULL, ip6, nh.nh_ifp, NULL, ip6);
 
-   /*
-* XXX: we need to use destination address with embedded scope
-* zone id, because LLTABLE uses such form of addresses for lookup.
-*/
dst.sin6_addr = nh.nh_addr;
-   if (IN6_IS_SCOPE_LINKLOCAL(&dst.sin6_addr))
-   dst.sin6_addr.s6_addr16[1] = htons(nh.nh_ifp->if_index & 
0x);
-
error = (*nh.nh_ifp->if_output)(nh.nh_ifp, m,
(struct sockaddr *)&dst, NULL);
if (error != 0) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358569 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 09:50:33 2020
New Revision: 358569
URL: https://svnweb.freebsd.org/changeset/base/358569

Log:
  in6_fib: return nh_ia in the ext interface as we do for IPv4
  
  Like for IPv4 add nh_ia to the ext interface and return rt_ifa
  in order to be used for, e.g., packet/octets accounting purposes.
  
  Reviewed by:  melifaro
  MFC after:1 week
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D23873

Modified:
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/in6_fib.h

Modified: head/sys/netinet6/in6_fib.c
==
--- head/sys/netinet6/in6_fib.c Tue Mar  3 09:45:16 2020(r358568)
+++ head/sys/netinet6/in6_fib.c Tue Mar  3 09:50:33 2020(r358569)
@@ -75,6 +75,8 @@ static void fib6_rte_to_nh_basic(struct rtentry *rte, 
 static struct ifnet *fib6_get_ifaifp(struct rtentry *rte);
 #define RNTORT(p)  ((struct rtentry *)(p))
 
+#defineifatoia6(ifa)   ((struct in6_ifaddr *)(ifa))
+
 CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst);
 
 /*
@@ -153,6 +155,7 @@ fib6_rte_to_nh_extended(struct rtentry *rte, const str
gw = (struct sockaddr_in6 *)rt_key(rte);
if (IN6_IS_ADDR_UNSPECIFIED(&gw->sin6_addr))
pnh6->nh_flags |= NHF_DEFAULT;
+   pnh6->nh_ia = ifatoia6(rte->rt_ifa);
 }
 
 /*

Modified: head/sys/netinet6/in6_fib.h
==
--- head/sys/netinet6/in6_fib.h Tue Mar  3 09:45:16 2020(r358568)
+++ head/sys/netinet6/in6_fib.h Tue Mar  3 09:50:33 2020(r358569)
@@ -41,14 +41,15 @@ struct nhop6_basic {
struct in6_addr nh_addr;/* GW/DST IPv4 address */
 };
 
-/* Does not differ from nhop6_basic */
+/* Extended nexthop info used for control protocols. */
 struct nhop6_extended {
struct ifnet*nh_ifp;/* Logical egress interface */
+   struct in6_ifaddr *nh_ia;   /* Associated address. */
uint16_tnh_mtu; /* nexthop mtu */
uint16_tnh_flags;   /* nhop flags */
uint8_t spare[4];
struct in6_addr nh_addr;/* GW/DST IPv6 address */
-   uint64_tspare2[2];
+   uint64_tspare2[1];
 };
 
 int fib6_lookup_nh_basic(uint32_t fibnum, const struct in6_addr *dst,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358570 - head/lib/libc/sys

2020-03-03 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Mar  3 09:51:53 2020
New Revision: 358570
URL: https://svnweb.freebsd.org/changeset/base/358570

Log:
  thr_self.2: Fix some typos in the thread identifier range
  
  Reported by:  kaktus
  Approved by:  bcr (mentor)
  Differential Revision:https://reviews.freebsd.org/D23936

Modified:
  head/lib/libc/sys/thr_self.2

Modified: head/lib/libc/sys/thr_self.2
==
--- head/lib/libc/sys/thr_self.2Tue Mar  3 09:50:33 2020
(r358569)
+++ head/lib/libc/sys/thr_self.2Tue Mar  3 09:51:53 2020
(r358570)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 1, 2016
+.Dd March 3, 2020
 .Dt THR_SELF 2
 .Os
 .Sh NAME
@@ -49,7 +49,7 @@ kernel-scheduled thread in the variable pointed by the
 .Pp
 The thread identifier is an integer in the range from
 .Dv PID_MAX + 2
-(10002) to
+(11) to
 .Dv INT_MAX .
 The thread identifier is guaranteed to be unique at any given time,
 for each running thread in the system.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358572 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 11:32:47 2020
New Revision: 358572
URL: https://svnweb.freebsd.org/changeset/base/358572

Log:
  ip6_output: use new routing KPI when not passed a cached route
  
  Implement the equivalent of r347375 (IPv4) for the IPv6 output path.
  In IPv6 we get passed a cached route (and inp) by udp6_output()
  depending on whether we acquired a write lock on the INP.
  In case we neither bind nor connect a first UDP packet would come in
  with a cached route (wlocked) and all further packets would not.
  In case we bind and do not connect we never write-lock the inp.
  
  When we do not pass in a cached route, rather than providing the
  storage for a route locally and pass it over the old lookup code
  and down the stack, use the new route lookup KPI and acquire all
  details we need to send the packet.
  
  Compared to the IPv4 code the IPv6 code has a couple of possible
  complications: given an option with a routing hdr/caching route there,
  and path mtu (ro_pmtu) case which now equally has to deal with the
  possibility of having a route which is NULL passed in, and the
  fwd_tag in case a firewall changes the next hop (something to
  factor out in the future).
  
  Sponsored by: Netflix
  Reviewed by:  glebius
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D23886

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Mar  3 10:02:58 2020
(r358571)
+++ head/sys/netinet6/ip6_output.c  Tue Mar  3 11:32:47 2020
(r358572)
@@ -424,12 +424,12 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ifnet *ifp, *origifp;
struct mbuf *m = m0;
struct mbuf *mprev;
-   int tlen, len;
-   struct route_in6 ip6route;
-   struct rtentry *rt = NULL;
-   struct sockaddr_in6 *dst, src_sa, dst_sa;
+   struct route_in6 *ro_pmtu;
+   struct rtentry *rt;
+   struct sockaddr_in6 *dst, sin6, src_sa, dst_sa;
struct in6_addr odst;
u_char *nexthdrp;
+   int tlen, len;
int error = 0;
struct in6_ifaddr *ia = NULL;
u_long mtu;
@@ -438,7 +438,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ip6_exthdrs exthdrs;
struct in6_addr src0, dst0;
u_int32_t zone;
-   struct route_in6 *ro_pmtu = NULL;
bool hdrsplit;
int sw_csum, tso;
int needfiblookup;
@@ -631,15 +630,15 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
IP6STAT_INC(ip6s_localout);
 
/* Route packet. */
-   if (ro == NULL) {
-   ro = &ip6route;
-   bzero((caddr_t)ro, sizeof(*ro));
-   }
ro_pmtu = ro;
if (opt && opt->ip6po_rthdr)
ro = &opt->ip6po_route;
-   dst = (struct sockaddr_in6 *)&ro->ro_dst;
+   if (ro != NULL)
+   dst = (struct sockaddr_in6 *)&ro->ro_dst;
+   else
+   dst = &sin6;
fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m);
+
 again:
/*
 * If specified, try to fill in the traffic class field.
@@ -666,55 +665,127 @@ again:
else
ip6->ip6_hlim = V_ip6_defmcasthlim;
}
+
+   if (ro == NULL || ro->ro_rt == NULL) {
+   bzero(dst, sizeof(*dst));
+   dst->sin6_family = AF_INET6;
+   dst->sin6_len = sizeof(*dst);
+   dst->sin6_addr = ip6->ip6_dst;
+   } 
/*
-* Validate route against routing table additions;
-* a better/more specific route might have been added.
+* Validate route against routing table changes.
 * Make sure that the address family is set in route.
 */
-   if (inp) {
-   ro->ro_dst.sin6_family = AF_INET6;
-   RT_VALIDATE((struct route *)ro, &inp->inp_rt_cookie, fibnum);
-   }
-   if (ro->ro_rt && fwd_tag == NULL && (ro->ro_rt->rt_flags & RTF_UP) &&
-   ro->ro_dst.sin6_family == AF_INET6 &&
-   IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, &ip6->ip6_dst)) {
-   rt = ro->ro_rt;
-   ifp = ro->ro_rt->rt_ifp;
+   rt = NULL;
+   ifp = NULL;
+   mtu = 0;
+   if (ro != NULL) {
+   if (ro->ro_rt != NULL && inp != NULL) {
+   ro->ro_dst.sin6_family = AF_INET6; /* XXX KASSERT? */
+   RT_VALIDATE((struct route *)ro, &inp->inp_rt_cookie,
+   fibnum);
+   }
+   if (ro->ro_rt != NULL && fwd_tag == NULL &&
+   ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
+   ro->ro_rt->rt_ifp == NULL ||
+   !RT_LINK_IS_UP(ro->ro_rt->rt_ifp) ||
+   ro->ro_dst.sin6_family != AF_INET6 ||
+   !IN6_ARE_ADDR_EQUAL(&ro->ro_dst.sin6_addr, &ip6

svn commit: r358573 - in head/sys/arm64: arm64 include

2020-03-03 Thread Andrew Turner
Author: andrew
Date: Tue Mar  3 12:50:45 2020
New Revision: 358573
URL: https://svnweb.freebsd.org/changeset/base/358573

Log:
  Fix the spelling of the VIPT cache type field
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/include/armreg.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Tue Mar  3 11:32:47 2020
(r358572)
+++ head/sys/arm64/arm64/identcpu.c Tue Mar  3 12:50:45 2020
(r358573)
@@ -1105,8 +1105,8 @@ print_ctr_fields(struct sbuf *sb, uint64_t reg, void *
case CTR_L1IP_AIVIVT:
sbuf_printf(sb, "AIVIVT");
break;
-   case CTR_L1IP_VIVT:
-   sbuf_printf(sb, "VIVT");
+   case CTR_L1IP_VIPT:
+   sbuf_printf(sb, "VIPT");
break;
case CTR_L1IP_PIPT:
sbuf_printf(sb, "PIPT");

Modified: head/sys/arm64/include/armreg.h
==
--- head/sys/arm64/include/armreg.h Tue Mar  3 11:32:47 2020
(r358572)
+++ head/sys/arm64/include/armreg.h Tue Mar  3 12:50:45 2020
(r358573)
@@ -109,7 +109,7 @@
 #defineCTR_L1IP_VAL(reg)   ((reg) & CTR_L1IP_MASK)
 #define CTR_L1IP_VPIPT (0 << CTR_L1IP_SHIFT)
 #define CTR_L1IP_AIVIVT(1 << CTR_L1IP_SHIFT)
-#define CTR_L1IP_VIVT  (2 << CTR_L1IP_SHIFT)
+#define CTR_L1IP_VIPT  (2 << CTR_L1IP_SHIFT)
 #define CTR_L1IP_PIPT  (3 << CTR_L1IP_SHIFT)
 #defineCTR_ILINE_SHIFT 0
 #defineCTR_ILINE_MASK  (0xf << CTR_ILINE_SHIFT)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358574 - head/usr.sbin/powerd

2020-03-03 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Tue Mar  3 13:25:08 2020
New Revision: 358574
URL: https://svnweb.freebsd.org/changeset/base/358574

Log:
  powerd.8: Improve style & fix typos
  
  - Sort options.
  - Do not use macros (like .Ar) to specify width for Bl (macros within that
string are not expanded).
  - Use Cm instead of Ar for mode names.
  - Fix some typos reported by mandoc.
  - Move the documentation of the PID file from the -P flag description to
the FILES section.
  
  Approved by:  bcr (mentor)
  Differential Revision:https://reviews.freebsd.org/D23941

Modified:
  head/usr.sbin/powerd/powerd.8

Modified: head/usr.sbin/powerd/powerd.8
==
--- head/usr.sbin/powerd/powerd.8   Tue Mar  3 12:50:45 2020
(r358573)
+++ head/usr.sbin/powerd/powerd.8   Tue Mar  3 13:25:08 2020
(r358574)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 6, 2019
+.Dd March 3, 2020
 .Dt POWERD 8
 .Os
 .Sh NAME
@@ -35,12 +35,12 @@
 .Op Fl a Ar mode
 .Op Fl b Ar mode
 .Op Fl i Ar percent
-.Op Fl m Ar freq
 .Op Fl M Ar freq
+.Op Fl m Ar freq
 .Op Fl N
 .Op Fl n Ar mode
-.Op Fl p Ar ival
 .Op Fl P Ar pidfile
+.Op Fl p Ar ival
 .Op Fl r Ar percent
 .Op Fl s Ar source
 .Op Fl v
@@ -51,42 +51,42 @@ utility monitors the system state and sets various pow
 accordingly.
 It offers power-saving modes that can be
 individually selected for operation on AC power or batteries.
-.Bl -tag -width ".Ar hiadaptive"
-.It Ar maximum
+.Bl -tag -width "hiadaptive"
+.It Cm maximum
 Choose the highest performance values.
 May be abbreviated as
-.Ar max .
-.It Ar minimum
+.Cm max .
+.It Cm minimum
 Choose the lowest performance values to get the most power savings.
 May be abbreviated as
-.Ar min .
-.It Ar adaptive
+.Cm min .
+.It Cm adaptive
 Attempt to strike a balance by degrading performance when the system
 appears idle and increasing it when the system is busy.
 It offers a good balance between a small performance loss for greatly
 increased power savings.
 May be abbreviated as
-.Ar adp .
-.It Ar hiadaptive
+.Cm adp .
+.It Cm hiadaptive
 Like
-.Ar adaptive
+.Cm adaptive
 mode, but tuned for systems where performance and interactivity are
 more important than power consumption.
 It increases frequency faster, reduces frequency less aggressively, and
 will maintain full frequency for longer.
 May be abbreviated as
-.Ar hadp .
+.Cm hadp .
 .El
 .Pp
 The default mode is
-.Ar adaptive
+.Cm adaptive
 for battery power and
-.Ar hiadaptive
+.Cm hiadaptive
 for the rest.
 .Pp
 .Nm
 recognizes these runtime options:
-.Bl -tag -width ".Fl r Ar percent"
+.Bl -tag -width "-r percent"
 .It Fl a Ar mode
 Selects the
 .Ar mode
@@ -99,26 +99,24 @@ to use while on battery power.
 Specifies the CPU load percent level when adaptive
 mode should begin to degrade performance to save power.
 The default is 50% or lower.
-.It Fl m Ar freq
-Specifies the minimum frequency to throttle down to.
 .It Fl M Ar freq
 Specifies the maximum frequency to throttle up to.
+.It Fl m Ar freq
+Specifies the minimum frequency to throttle down to.
 .It Fl N
 Treat "nice" time as idle for the purpose of load calculation;
-i.e. do not increase the CPU frequency if the CPU is only busy
+i.e., do not increase the CPU frequency if the CPU is only busy
 with "nice" processes.
 .It Fl n Ar mode
 Selects the
 .Ar mode
 to use normally when the AC line state is unknown.
+.It Fl P Ar pidfile
+Specifies an alternative file in which the process ID should be stored.
 .It Fl p Ar ival
 Specifies a different polling interval (in milliseconds) for AC line state
 and system idle levels.
 The default is 250 ms.
-.It Fl P Ar pidfile
-Specifies an alternative file in which the process ID should be stored.
-The default is
-.Pa /var/run/powerd.pid .
 .It Fl r Ar percent
 Specifies the CPU load percent level where adaptive
 mode should consider the CPU running and increase performance.
@@ -136,6 +134,11 @@ Verbose mode.
 Messages about power changes will be printed to stdout and
 .Nm
 will operate in the foreground.
+.El
+.Sh FILES
+.Bl -tag -width "/var/run/powerd.pid"
+.It Pa /var/run/powerd.pid
+The default PID file.
 .El
 .Sh SEE ALSO
 .Xr acpi 4 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358575 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 13:48:12 2020
New Revision: 358575
URL: https://svnweb.freebsd.org/changeset/base/358575

Log:
  ip6: retire in6_selectroute_fib() as promised 8 years ago
  
  In r231852 I added in6_selectroute_fib() as a compat function with the
  fibnum as an extra argument compared to in6_selectroute() to keep the
  KPI stable.
  Way too late retire this function again and add the fib to in6_selectroute()
  which also only has a single consumer now and was an orphan function before.

Modified:
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/in6_src.c
==
--- head/sys/netinet6/in6_src.c Tue Mar  3 13:25:08 2020(r358574)
+++ head/sys/netinet6/in6_src.c Tue Mar  3 13:48:12 2020(r358575)
@@ -640,10 +640,10 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_p
if (dstsock->sin6_addr.s6_addr32[0] == 0 &&
dstsock->sin6_addr.s6_addr32[1] == 0 &&
!IN6_IS_ADDR_LOOPBACK(&dstsock->sin6_addr)) {
-   printf("in6_selectroute: strange destination %s\n",
+   printf("%s: strange destination %s\n", __func__,
   ip6_sprintf(ip6buf, &dstsock->sin6_addr));
} else {
-   printf("in6_selectroute: destination = %s%%%d\n",
+   printf("%s: destination = %s%%%d\n", __func__,
   ip6_sprintf(ip6buf, &dstsock->sin6_addr),
   dstsock->sin6_scope_id); /* for debug */
}
@@ -895,33 +895,16 @@ in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_
return (0);
 }
 
-/*
- * Public wrapper function to selectroute().
- *
- * XXX-BZ in6_selectroute() should and will grow the FIB argument. The
- * in6_selectroute_fib() function is only there for backward compat on stable.
- */
+/* Public wrapper function to selectroute(). */
 int
 in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
 struct ip6_moptions *mopts, struct route_in6 *ro,
-struct ifnet **retifp, struct rtentry **retrt)
-{
-
-   return (selectroute(dstsock, opts, mopts, ro, retifp,
-   retrt, 0, RT_DEFAULT_FIB));
-}
-
-#ifndef BURN_BRIDGES
-int
-in6_selectroute_fib(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
-struct ip6_moptions *mopts, struct route_in6 *ro,
 struct ifnet **retifp, struct rtentry **retrt, u_int fibnum)
 {
 
return (selectroute(dstsock, opts, mopts, ro, retifp,
retrt, 0, fibnum));
 }
-#endif
 
 /*
  * Default hop limit selection. The precedence is as follows:

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Mar  3 13:25:08 2020
(r358574)
+++ head/sys/netinet6/ip6_output.c  Tue Mar  3 13:48:12 2020
(r358575)
@@ -709,7 +709,7 @@ again:
dst_sa.sin6_len = sizeof(dst_sa);
dst_sa.sin6_addr = ip6->ip6_dst;
}
-   error = in6_selectroute_fib(&dst_sa, opt, im6o, ro, 
&ifp,
+   error = in6_selectroute(&dst_sa, opt, im6o, ro, &ifp,
&rt, fibnum);
if (error != 0) {
IP6STAT_INC(ip6s_noroute);

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Tue Mar  3 13:25:08 2020(r358574)
+++ head/sys/netinet6/ip6_var.h Tue Mar  3 13:48:12 2020(r358575)
@@ -416,10 +416,7 @@ intin6_selectsrc_addr(uint32_t, const struct 
in6_addr
 uint32_t, struct ifnet *, struct in6_addr *, int *);
 int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
struct ip6_moptions *, struct route_in6 *, struct ifnet **,
-   struct rtentry **);
-intin6_selectroute_fib(struct sockaddr_in6 *, struct ip6_pktopts *,
-   struct ip6_moptions *, struct route_in6 *, struct ifnet **,
-   struct rtentry **, u_int);
+   struct rtentry **, u_int);
 u_int32_t ip6_randomid(void);
 u_int32_t ip6_randomflowlabel(void);
 void in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358576 - head/sys/kern

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 14:07:44 2020
New Revision: 358576
URL: https://svnweb.freebsd.org/changeset/base/358576

Log:
  upic_ktrls: make RSS compile again here
  
  The results of ktls_get_cpu() are stored in u_int and NETISR_CPUID_NONE
  requires u_int.  Adjust uint16_t to uint_t in order to make RSS kernels
  compile some more again.
  
  HPTS still has to be fixed, which is a bit more complicated.
  
  Reviewed by:  jhb, gallatin, rrs
  Differential Revision:https://reviews.freebsd.org/D23726

Modified:
  head/sys/kern/uipc_ktls.c

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Tue Mar  3 13:48:12 2020(r358575)
+++ head/sys/kern/uipc_ktls.c   Tue Mar  3 14:07:44 2020(r358576)
@@ -299,11 +299,11 @@ ktls_crypto_backend_deregister(struct ktls_crypto_back
 }
 
 #if defined(INET) || defined(INET6)
-static uint16_t
+static u_int
 ktls_get_cpu(struct socket *so)
 {
struct inpcb *inp;
-   uint16_t cpuid;
+   u_int cpuid;
 
inp = sotoinpcb(so);
 #ifdef RSS
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358577 - head/sys/netinet

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 14:15:30 2020
New Revision: 358577
URL: https://svnweb.freebsd.org/changeset/base/358577

Log:
  tcp_hpts: make RSS kernel compile again.
  
  Add proper #includes, and #ifdefs and some style fixes to make RSS
  kernels compile again.  There are still possible issues with uin16_t
  vs. uint_t cpuid which I am not going near.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D23726

Modified:
  head/sys/netinet/tcp_hpts.c

Modified: head/sys/netinet/tcp_hpts.c
==
--- head/sys/netinet/tcp_hpts.c Tue Mar  3 14:07:44 2020(r358576)
+++ head/sys/netinet/tcp_hpts.c Tue Mar  3 14:15:30 2020(r358577)
@@ -28,7 +28,9 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
+#include "opt_rss.h"
 #include "opt_tcpdebug.h"
+
 /**
  * Some notes about usage.
  *
@@ -151,6 +153,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef RSS
+#include 
+#include 
+#endif
+
 #define TCPSTATES  /* for logging */
 
 #include 
@@ -180,7 +187,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#include "opt_rss.h"
 
 MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts");
 #ifdef RSS
@@ -1151,9 +1157,10 @@ hpts_random_cpu(struct inpcb *inp){
 }
 
 static uint16_t
-hpts_cpuid(struct inpcb *inp){
+hpts_cpuid(struct inpcb *inp)
+{
u_int cpuid;
-#ifdef NUMA
+#if !defined(RSS) && defined(NUMA)
struct hpts_domain_info *di;
 #endif
 
@@ -1167,7 +1174,7 @@ hpts_cpuid(struct inpcb *inp){
return (inp->inp_hpts_cpu);
}
/* If one is set the other must be the same */
-#ifdef RSS
+#ifdef RSS
cpuid = rss_hash2cpuid(inp->inp_flowid, inp->inp_flowtype);
if (cpuid == NETISR_CPUID_NONE)
return (hpts_random_cpu(inp));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358578 - stable/12/sys/fs/ext2fs

2020-03-03 Thread Fedor Uporov
Author: fsu
Date: Tue Mar  3 14:58:53 2020
New Revision: 358578
URL: https://svnweb.freebsd.org/changeset/base/358578

Log:
  MFC r358073:
  
  Add a EXT2FS-specific implementation for lseek(SEEK_DATA).
  
  Reviewed by:pfg
  MFC after:  1 week
  
  Differential Revision:https://reviews.freebsd.org/D23605

Modified:
  stable/12/sys/fs/ext2fs/ext2_bmap.c
  stable/12/sys/fs/ext2fs/ext2_extern.h
  stable/12/sys/fs/ext2fs/ext2_vnops.c

Modified: stable/12/sys/fs/ext2fs/ext2_bmap.c
==
--- stable/12/sys/fs/ext2fs/ext2_bmap.c Tue Mar  3 14:15:30 2020
(r358577)
+++ stable/12/sys/fs/ext2fs/ext2_bmap.c Tue Mar  3 14:58:53 2020
(r358578)
@@ -139,6 +139,47 @@ ext4_bmapext(struct vnode *vp, int32_t bn, int64_t *bn
return (error);
 }
 
+static int
+readindir(struct vnode *vp, e2fs_lbn_t lbn, e2fs_daddr_t daddr, struct buf 
**bpp)
+{
+   struct buf *bp;
+   struct mount *mp;
+   struct ext2mount *ump;
+   int error;
+
+   mp = vp->v_mount;
+   ump = VFSTOEXT2(mp);
+
+   bp = getblk(vp, lbn, mp->mnt_stat.f_iosize, 0, 0, 0);
+   if ((bp->b_flags & B_CACHE) == 0) {
+   KASSERT(daddr != 0,
+   ("readindir: indirect block not in cache"));
+
+   bp->b_blkno = blkptrtodb(ump, daddr);
+   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
+   curthread->td_ru.ru_inblock++;
+   error = bufwait(bp);
+   if (error != 0) {
+   brelse(bp);
+   return (error);
+   }
+   }
+   *bpp = bp;
+   return (0);
+}
+
 /*
  * Indirect blocks are now on the vnode for the file.  They are given negative
  * logical block numbers.  Indirect blocks are addressed by the negative
@@ -228,35 +269,10 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *
 */
if (bp)
bqrelse(bp);
+   error = readindir(vp, metalbn, daddr, &bp);
+   if (error != 0)
+   return (error);
 
-   bp = getblk(vp, metalbn, bsize, 0, 0, 0);
-   if ((bp->b_flags & B_CACHE) == 0) {
-#ifdef INVARIANTS
-   if (!daddr)
-   panic("ext2_bmaparray: indirect block not in 
cache");
-#endif
-   bp->b_blkno = blkptrtodb(ump, daddr);
-   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
-   curthread->td_ru.ru_inblock++;
-   error = bufwait(bp);
-   if (error) {
-   brelse(bp);
-   return (error);
-   }
-   }
-
daddr = ((e2fs_daddr_t *)bp->b_data)[ap->in_off];
if (num == 1 && daddr && runp) {
for (bn = ap->in_off + 1;
@@ -294,6 +310,107 @@ ext2_bmaparray(struct vnode *vp, daddr_t bn, daddr_t *
*bnp = -1;
}
return (0);
+}
+
+static e2fs_lbn_t
+lbn_count(struct ext2mount *ump, int level)
+
+{
+   e2fs_lbn_t blockcnt;
+
+   for (blockcnt = 1; level > 0; level--)
+   blockcnt *= MNINDIR(ump);
+   return (blockcnt);
+}
+
+int
+ext2_bmap_seekdata(struct vnode *vp, off_t *offp)
+{
+   struct buf *bp;
+   struct indir a[EXT2_NIADDR + 1], *ap;
+   struct inode *ip;
+   struct mount *mp;
+   struct ext2mount *ump;
+   e2fs_daddr_t bn, daddr, nextbn;
+   uint64_t bsize;
+   off_t numblks;
+   int error, num, num1, off;
+
+   bp = NULL;
+   error = 0;
+   ip = VTOI(vp);
+   mp = vp->v_mount;
+   ump = VFSTOEXT2(mp);
+
+   if (vp->v_type != VREG || (ip->i_flags & SF_SNAPSHOT) != 0)
+   return (EINVAL);
+   if (*offp < 0 || *offp >= ip->i_size)
+   return (ENXIO);
+
+   bsize = mp->mnt_stat.f_iosize;
+   for (bn = *offp / bsize, numblks = howmany(ip->i_size, bsize);
+   bn < numblk

svn commit: r358579 - in stable/12/sys: amd64/amd64 dev/cpuctl i386/i386 x86/acpica x86/include x86/x86

2020-03-03 Thread Konstantin Belousov
Author: kib
Date: Tue Mar  3 15:02:07 2020
New Revision: 358579
URL: https://svnweb.freebsd.org/changeset/base/358579

Log:
  MFC r358315:
  Fix IBRS for machines with IBRS_ALL capability.

Modified:
  stable/12/sys/amd64/amd64/initcpu.c
  stable/12/sys/amd64/amd64/support.S
  stable/12/sys/dev/cpuctl/cpuctl.c
  stable/12/sys/i386/i386/support.s
  stable/12/sys/x86/acpica/acpi_wakeup.c
  stable/12/sys/x86/include/x86_var.h
  stable/12/sys/x86/x86/cpu_machdep.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/amd64/amd64/initcpu.c
==
--- stable/12/sys/amd64/amd64/initcpu.c Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/amd64/amd64/initcpu.c Tue Mar  3 15:02:07 2020
(r358579)
@@ -255,7 +255,7 @@ initializecpu(void)
wrmsr(MSR_EFER, msr);
pg_nx = PG_NX;
}
-   hw_ibrs_recalculate();
+   hw_ibrs_recalculate(false);
hw_ssb_recalculate(false);
amd64_syscall_ret_flush_l1d_recalc();
switch (cpu_vendor_id) {

Modified: stable/12/sys/amd64/amd64/support.S
==
--- stable/12/sys/amd64/amd64/support.S Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/amd64/amd64/support.S Tue Mar  3 15:02:07 2020
(r358579)
@@ -1547,7 +1547,7 @@ handle_ibrs_\l:
 
 /* all callers already saved %rax, %rdx, and %rcx */
 ENTRY(handle_ibrs_entry)
-   cmpb$0,hw_ibrs_active(%rip)
+   cmpb$0,hw_ibrs_ibpb_active(%rip)
je  1f
movl$MSR_IA32_SPEC_CTRL,%ecx
rdmsr

Modified: stable/12/sys/dev/cpuctl/cpuctl.c
==
--- stable/12/sys/dev/cpuctl/cpuctl.c   Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/dev/cpuctl/cpuctl.c   Tue Mar  3 15:02:07 2020
(r358579)
@@ -538,8 +538,8 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td
set_cpu(cpu, td);
identify_cpu1();
identify_cpu2();
-   hw_ibrs_recalculate();
restore_cpu(oldcpu, is_bound, td);
+   hw_ibrs_recalculate(true);
hw_ssb_recalculate(true);
 #ifdef __amd64__
amd64_syscall_ret_flush_l1d_recalc();

Modified: stable/12/sys/i386/i386/support.s
==
--- stable/12/sys/i386/i386/support.s   Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/i386/i386/support.s   Tue Mar  3 15:02:07 2020
(r358579)
@@ -446,7 +446,7 @@ msr_onfault:
ret
 
 ENTRY(handle_ibrs_entry)
-   cmpb$0,hw_ibrs_active
+   cmpb$0,hw_ibrs_ibpb_active
je  1f
movl$MSR_IA32_SPEC_CTRL,%ecx
rdmsr

Modified: stable/12/sys/x86/acpica/acpi_wakeup.c
==
--- stable/12/sys/x86/acpica/acpi_wakeup.c  Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/x86/acpica/acpi_wakeup.c  Tue Mar  3 15:02:07 2020
(r358579)
@@ -245,7 +245,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
}
 #endif
 #ifdef __amd64__
-   hw_ibrs_active = 0;
+   hw_ibrs_ibpb_active = 0;
hw_ssb_active = 0;
cpu_stdext_feature3 = 0;
CPU_FOREACH(i) {

Modified: stable/12/sys/x86/include/x86_var.h
==
--- stable/12/sys/x86/include/x86_var.h Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/x86/include/x86_var.h Tue Mar  3 15:02:07 2020
(r358579)
@@ -84,7 +84,7 @@ externint use_xsave;
 extern uint64_t xsave_mask;
 extern u_int   max_apic_id;
 extern int pti;
-extern int hw_ibrs_active;
+extern int hw_ibrs_ibpb_active;
 extern int hw_mds_disable;
 extern int hw_ssb_active;
 extern int x86_taa_enable;
@@ -141,7 +141,7 @@ int is_physical_memory(vm_paddr_t addr);
 intisa_nmi(int cd);
 void   handle_ibrs_entry(void);
 void   handle_ibrs_exit(void);
-void   hw_ibrs_recalculate(void);
+void   hw_ibrs_recalculate(bool all_cpus);
 void   hw_mds_recalculate(void);
 void   hw_ssb_recalculate(bool all_cpus);
 void   x86_taa_recalculate(void);

Modified: stable/12/sys/x86/x86/cpu_machdep.c
==
--- stable/12/sys/x86/x86/cpu_machdep.c Tue Mar  3 14:58:53 2020
(r358578)
+++ stable/12/sys/x86/x86/cpu_machdep.c Tue Mar  3 15:02:07 2020
(r358579)
@@ -855,23 +855,27 @@ nmi_handle_intr(u_int type, struct trapframe *frame)
nmi_call_kdb(PCPU_GET(cpuid), type, frame);
 }
 
-int hw_ibrs_active;
+static int hw_ibrs_active;
+int hw_ibrs_ibpb_active;
 int hw_ibrs_disable = 1;
 
 SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0,
 "Indirect Bran

svn commit: r358580 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Tue Mar  3 15:05:13 2020
New Revision: 358580
URL: https://svnweb.freebsd.org/changeset/base/358580

Log:
  Increase number of write completion threads, matching ZoL.
  
  Our iSCSI benchmarks on a large 80-core system show that previous limit
  of 8 threads can be a bottleneck.  At some points this change increases
  write IOPS by as much as 50%.  I am still not sure that so many threads
  is really required, but we tested lower amounts and got no significant
  benefits, while latencies were a bit worse, so decided to not diverge.
  
  MFC after:1 week
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Tue Mar  3 
15:02:07 2020(r358579)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c   Tue Mar  3 
15:05:13 2020(r358580)
@@ -157,7 +157,7 @@ const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ
/* ISSUEISSUE_HIGH  INTRINTR_HIGH */
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* NULL */
{ ZTI_N(8), ZTI_NULL,   ZTI_P(12, 8),   ZTI_NULL }, /* READ */
-   { ZTI_BATCH,ZTI_N(5),   ZTI_N(8),   ZTI_N(5) }, /* WRITE */
+   { ZTI_BATCH,ZTI_N(5),   ZTI_P(12, 8),   ZTI_N(5) }, /* WRITE */
{ ZTI_P(12, 8), ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* FREE */
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* CLAIM */
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* IOCTL */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358581 - in stable/12: lib/libkvm sys/vm

2020-03-03 Thread Mark Johnston
Author: markj
Date: Tue Mar  3 15:07:48 2020
New Revision: 358581
URL: https://svnweb.freebsd.org/changeset/base/358581

Log:
  MFC r358026:
  Remove swblk_t.

Modified:
  stable/12/lib/libkvm/kvm_getswapinfo.c
  stable/12/sys/vm/swap_pager.c
  stable/12/sys/vm/swap_pager.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libkvm/kvm_getswapinfo.c
==
--- stable/12/lib/libkvm/kvm_getswapinfo.c  Tue Mar  3 15:05:13 2020
(r358580)
+++ stable/12/lib/libkvm/kvm_getswapinfo.c  Tue Mar  3 15:07:48 2020
(r358581)
@@ -115,8 +115,7 @@ int
 kvm_getswapinfo_kvm(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max,
 int flags)
 {
-   int i;
-   swblk_t ttl;
+   int i, ttl;
TAILQ_HEAD(, swdevt) swtailq;
struct swdevt *sp, swinfo;
struct kvm_swap tot;
@@ -167,8 +166,7 @@ int
 kvm_getswapinfo_sysctl(kvm_t *kd, struct kvm_swap *swap_ary, int swap_max,
 int flags)
 {
-   int ti;
-   swblk_t ttl;
+   int ti, ttl;
size_t mibi, len;
int soid[SWI_MAXMIB];
struct xswdev xsd;

Modified: stable/12/sys/vm/swap_pager.c
==
--- stable/12/sys/vm/swap_pager.c   Tue Mar  3 15:05:13 2020
(r358580)
+++ stable/12/sys/vm/swap_pager.c   Tue Mar  3 15:07:48 2020
(r358581)
@@ -2284,7 +2284,7 @@ swaponsomething(struct vnode *vp, void *id, u_long nbl
 sw_strategy_t *strategy, sw_close_t *close, dev_t dev, int flags)
 {
struct swdevt *sp, *tsp;
-   swblk_t dvbase;
+   daddr_t dvbase;
u_long mblocks;
 
/*

Modified: stable/12/sys/vm/swap_pager.h
==
--- stable/12/sys/vm/swap_pager.h   Tue Mar  3 15:05:13 2020
(r358580)
+++ stable/12/sys/vm/swap_pager.h   Tue Mar  3 15:07:48 2020
(r358581)
@@ -38,14 +38,9 @@
  */
 
 #ifndef_VM_SWAP_PAGER_H_
-#define_VM_SWAP_PAGER_H_ 1
+#define_VM_SWAP_PAGER_H_
 
-typedefint32_t swblk_t;/*
-* swap offset.  This is the type used to
-* address the "virtual swap device" and
-* therefore the maximum swap space is
-* 2^32 pages.
-*/
+#include 
 
 struct buf;
 struct swdevt;
@@ -62,8 +57,8 @@ struct swdevt {
dev_t   sw_dev;
struct vnode *sw_vp;
void*sw_id;
-   swblk_t sw_first;
-   swblk_t sw_end;
+   __daddr_t sw_first;
+   __daddr_t sw_end;
struct blist *sw_blist;
TAILQ_ENTRY(swdevt) sw_list;
sw_strategy_t   *sw_strategy;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358582 - in stable/11/sys: amd64/amd64 dev/cpuctl x86/acpica x86/include x86/x86

2020-03-03 Thread Konstantin Belousov
Author: kib
Date: Tue Mar  3 15:12:00 2020
New Revision: 358582
URL: https://svnweb.freebsd.org/changeset/base/358582

Log:
  MFC r358315:
  Fix IBRS for machines with IBRS_ALL capability.

Modified:
  stable/11/sys/amd64/amd64/initcpu.c
  stable/11/sys/amd64/amd64/support.S
  stable/11/sys/dev/cpuctl/cpuctl.c
  stable/11/sys/x86/acpica/acpi_wakeup.c
  stable/11/sys/x86/include/x86_var.h
  stable/11/sys/x86/x86/cpu_machdep.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/amd64/amd64/initcpu.c
==
--- stable/11/sys/amd64/amd64/initcpu.c Tue Mar  3 15:07:48 2020
(r358581)
+++ stable/11/sys/amd64/amd64/initcpu.c Tue Mar  3 15:12:00 2020
(r358582)
@@ -245,7 +245,7 @@ initializecpu(void)
wrmsr(MSR_EFER, msr);
pg_nx = PG_NX;
}
-   hw_ibrs_recalculate();
+   hw_ibrs_recalculate(false);
hw_ssb_recalculate(false);
switch (cpu_vendor_id) {
case CPU_VENDOR_AMD:

Modified: stable/11/sys/amd64/amd64/support.S
==
--- stable/11/sys/amd64/amd64/support.S Tue Mar  3 15:07:48 2020
(r358581)
+++ stable/11/sys/amd64/amd64/support.S Tue Mar  3 15:12:00 2020
(r358582)
@@ -851,7 +851,7 @@ handle_ibrs_\l:
 
 /* all callers already saved %rax, %rdx, and %rcx */
 ENTRY(handle_ibrs_entry)
-   cmpb$0,hw_ibrs_active(%rip)
+   cmpb$0,hw_ibrs_ibpb_active(%rip)
je  1f
movl$MSR_IA32_SPEC_CTRL,%ecx
rdmsr

Modified: stable/11/sys/dev/cpuctl/cpuctl.c
==
--- stable/11/sys/dev/cpuctl/cpuctl.c   Tue Mar  3 15:07:48 2020
(r358581)
+++ stable/11/sys/dev/cpuctl/cpuctl.c   Tue Mar  3 15:12:00 2020
(r358582)
@@ -536,8 +536,8 @@ cpuctl_do_eval_cpu_features(int cpu, struct thread *td
set_cpu(cpu, td);
identify_cpu1();
identify_cpu2();
-   hw_ibrs_recalculate();
restore_cpu(oldcpu, is_bound, td);
+   hw_ibrs_recalculate(true);
hw_ssb_recalculate(true);
 #ifdef __amd64__
pmap_allow_2m_x_ept_recalculate();

Modified: stable/11/sys/x86/acpica/acpi_wakeup.c
==
--- stable/11/sys/x86/acpica/acpi_wakeup.c  Tue Mar  3 15:07:48 2020
(r358581)
+++ stable/11/sys/x86/acpica/acpi_wakeup.c  Tue Mar  3 15:12:00 2020
(r358582)
@@ -227,7 +227,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
}
 #endif
 #ifdef __amd64__
-   hw_ibrs_active = 0;
+   hw_ibrs_ibpb_active = 0;
hw_ssb_active = 0;
cpu_stdext_feature3 = 0;
CPU_FOREACH(i) {

Modified: stable/11/sys/x86/include/x86_var.h
==
--- stable/11/sys/x86/include/x86_var.h Tue Mar  3 15:07:48 2020
(r358581)
+++ stable/11/sys/x86/include/x86_var.h Tue Mar  3 15:12:00 2020
(r358582)
@@ -82,7 +82,7 @@ externint _ugssel;
 extern int use_xsave;
 extern uint64_t xsave_mask;
 extern int pti;
-extern int hw_ibrs_active;
+extern int hw_ibrs_ibpb_active;
 extern int hw_mds_disable;
 extern int hw_ssb_active;
 extern int x86_taa_enable;
@@ -135,7 +135,7 @@ int is_physical_memory(vm_paddr_t addr);
 intisa_nmi(int cd);
 void   handle_ibrs_entry(void);
 void   handle_ibrs_exit(void);
-void   hw_ibrs_recalculate(void);
+void   hw_ibrs_recalculate(bool all_cpus);
 void   hw_mds_recalculate(void);
 void   hw_ssb_recalculate(bool all_cpus);
 void   x86_taa_recalculate(void);

Modified: stable/11/sys/x86/x86/cpu_machdep.c
==
--- stable/11/sys/x86/x86/cpu_machdep.c Tue Mar  3 15:07:48 2020
(r358581)
+++ stable/11/sys/x86/x86/cpu_machdep.c Tue Mar  3 15:12:00 2020
(r358582)
@@ -885,23 +885,27 @@ nmi_handle_intr(u_int type, struct trapframe *frame)
nmi_call_kdb(PCPU_GET(cpuid), type, frame);
 }
 
-int hw_ibrs_active;
+static int hw_ibrs_active;
+int hw_ibrs_ibpb_active;
 int hw_ibrs_disable = 1;
 
 SYSCTL_INT(_hw, OID_AUTO, ibrs_active, CTLFLAG_RD, &hw_ibrs_active, 0,
 "Indirect Branch Restricted Speculation active");
 
 void
-hw_ibrs_recalculate(void)
+hw_ibrs_recalculate(bool for_all_cpus)
 {
if ((cpu_ia32_arch_caps & IA32_ARCH_CAP_IBRS_ALL) != 0) {
-   x86_msr_op(MSR_IA32_SPEC_CTRL, MSR_OP_LOCAL |
-   (hw_ibrs_disable ? MSR_OP_ANDNOT : MSR_OP_OR),
+   x86_msr_op(MSR_IA32_SPEC_CTRL, (for_all_cpus ?
+   MSR_OP_RENDEZVOUS : MSR_OP_LOCAL) |
+   (hw_ibrs_disable != 0 ? MSR_OP_ANDNOT : MSR_OP_OR),
IA32_SPEC_CTRL_IBRS);
-   return;
+ 

svn commit: r358583 - in head/sys/arm64: arm64 include

2020-03-03 Thread Andrew Turner
Author: andrew
Date: Tue Mar  3 15:25:01 2020
New Revision: 358583
URL: https://svnweb.freebsd.org/changeset/base/358583

Log:
  Move the arm64 cache identification to identcpu.c
  
  This allows us to call it on a per-CPU basis and to warn if the details
  are different across CPUs.
  
  While here read the L1 I-Cache type and store this for use later by pmap.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/arm64/machdep.c
  head/sys/arm64/include/cpu.h
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Tue Mar  3 15:12:00 2020
(r358582)
+++ head/sys/arm64/arm64/identcpu.c Tue Mar  3 15:25:01 2020
(r358583)
@@ -965,6 +965,13 @@ update_user_regs(u_int cpu)
 extern u_long elf_hwcap;
 bool __read_frequently lse_supported = false;
 
+bool __read_frequently icache_alising = false;
+bool __read_frequently icache_vmid = false;
+
+int64_t dcache_line_size;  /* The minimum D cache line size */
+int64_t icache_line_size;  /* The minimum I cache line size */
+int64_t idcache_line_size; /* The minimum cache line size */
+
 static void
 identify_cpu_sysinit(void *dummy __unused)
 {
@@ -1309,6 +1316,46 @@ print_cpu_features(u_int cpu)
 }
 
 void
+identify_cache(uint64_t ctr)
+{
+
+   /* Identify the L1 cache type */
+   switch (CTR_L1IP_VAL(ctr)) {
+   case CTR_L1IP_PIPT:
+   break;
+   case CTR_L1IP_VPIPT:
+   icache_vmid = true;
+   break;
+   default:
+   case CTR_L1IP_VIPT:
+   icache_alising = true;
+   break;
+   }
+
+   if (dcache_line_size == 0) {
+   KASSERT(icache_line_size == 0, ("%s: i-cacheline size set: %ld",
+   __func__, icache_line_size));
+
+   /* Get the D cache line size */
+   dcache_line_size = CTR_DLINE_SIZE(ctr);
+   /* And the same for the I cache */
+   icache_line_size = CTR_ILINE_SIZE(ctr);
+
+   idcache_line_size = MIN(dcache_line_size, icache_line_size);
+   }
+
+   if (dcache_line_size != CTR_DLINE_SIZE(ctr)) {
+   printf("WARNING: D-cacheline size mismatch %ld != %d\n",
+   dcache_line_size, CTR_DLINE_SIZE(ctr));
+   }
+
+   if (icache_line_size != CTR_ILINE_SIZE(ctr)) {
+   printf("WARNING: I-cacheline size mismatch %ld != %d\n",
+   icache_line_size, CTR_ILINE_SIZE(ctr));
+   }
+}
+
+void
 identify_cpu(void)
 {
u_int midr;
@@ -1429,8 +1476,14 @@ identify_cpu(void)
if (cpu_desc[cpu].id_aa64pfr1 != cpu_desc[0].id_aa64pfr1)
cpu_print_regs |= PRINT_ID_AA64_PFR1;
 
-   if (cpu_desc[cpu].ctr != cpu_desc[0].ctr)
+   if (cpu_desc[cpu].ctr != cpu_desc[0].ctr) {
+   /*
+* If the cache type register is different we may
+* have a different l1 cache type.
+*/
+   identify_cache(cpu_desc[cpu].ctr);
cpu_print_regs |= PRINT_CTR_EL0;
+   }
 
/* Wake up the other CPUs */
atomic_store_rel_int(&ident_lock, 0);

Modified: head/sys/arm64/arm64/machdep.c
==
--- head/sys/arm64/arm64/machdep.c  Tue Mar  3 15:12:00 2020
(r358582)
+++ head/sys/arm64/arm64/machdep.c  Tue Mar  3 15:25:01 2020
(r358583)
@@ -113,9 +113,6 @@ static int boot_el;
 
 struct kva_md_info kmi;
 
-int64_t dcache_line_size;  /* The minimum D cache line size */
-int64_t icache_line_size;  /* The minimum I cache line size */
-int64_t idcache_line_size; /* The minimum cache line size */
 int64_t dczva_line_size;   /* The size of cache line the dc zva zeroes */
 int has_pan;
 
@@ -1056,17 +1053,9 @@ static void
 cache_setup(void)
 {
int dczva_line_shift;
-   uint32_t ctr_el0;
uint32_t dczid_el0;
 
-   ctr_el0 = READ_SPECIALREG(ctr_el0);
-
-   /* Get the D cache line size */
-   dcache_line_size = CTR_DLINE_SIZE(ctr_el0);
-   /* And the same for the I cache */
-   icache_line_size = CTR_ILINE_SIZE(ctr_el0);
-
-   idcache_line_size = MIN(dcache_line_size, icache_line_size);
+   identify_cache(READ_SPECIALREG(ctr_el0));
 
dczid_el0 = READ_SPECIALREG(dczid_el0);
 

Modified: head/sys/arm64/include/cpu.h
==
--- head/sys/arm64/include/cpu.hTue Mar  3 15:12:00 2020
(r358582)
+++ head/sys/arm64/include/cpu.hTue Mar  3 15:25:01 2020
(r358583)
@@ -166,6 +166,7 @@ extern uint64_t __cpu_affinity[];
 void   cpu_halt(void) __dead2;
 void   cpu_reset(void) __dead2;
 vo

svn commit: r358584 - in head/sys/arm64: arm64 include

2020-03-03 Thread Andrew Turner
Author: andrew
Date: Tue Mar  3 15:31:40 2020
New Revision: 358584
URL: https://svnweb.freebsd.org/changeset/base/358584

Log:
  Fix the spelling of aliasing.
  
  Sponsored by: Innovate UK

Modified:
  head/sys/arm64/arm64/identcpu.c
  head/sys/arm64/include/cpufunc.h

Modified: head/sys/arm64/arm64/identcpu.c
==
--- head/sys/arm64/arm64/identcpu.c Tue Mar  3 15:25:01 2020
(r358583)
+++ head/sys/arm64/arm64/identcpu.c Tue Mar  3 15:31:40 2020
(r358584)
@@ -965,7 +965,7 @@ update_user_regs(u_int cpu)
 extern u_long elf_hwcap;
 bool __read_frequently lse_supported = false;
 
-bool __read_frequently icache_alising = false;
+bool __read_frequently icache_aliasing = false;
 bool __read_frequently icache_vmid = false;
 
 int64_t dcache_line_size;  /* The minimum D cache line size */
@@ -1328,7 +1328,7 @@ identify_cache(uint64_t ctr)
break;
default:
case CTR_L1IP_VIPT:
-   icache_alising = true;
+   icache_aliasing = true;
break;
}
 

Modified: head/sys/arm64/include/cpufunc.h
==
--- head/sys/arm64/include/cpufunc.hTue Mar  3 15:25:01 2020
(r358583)
+++ head/sys/arm64/include/cpufunc.hTue Mar  3 15:31:40 2020
(r358584)
@@ -199,7 +199,7 @@ invalidate_local_icache(void)
"isb   \n");
 }
 
-extern bool icache_alising;
+extern bool icache_aliasing;
 extern bool icache_vmid;
 
 extern int64_t dcache_line_size;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358585 - in head: sys/net tests/sys/netinet tests/sys/netinet6

2020-03-03 Thread Alexander V. Chernikov
Author: melifaro
Date: Tue Mar  3 15:33:43 2020
New Revision: 358585
URL: https://svnweb.freebsd.org/changeset/base/358585

Log:
  Fix dynamic redrects by adding forgotten RTF_HOST flag.
  Improve tests to verify the generated route flags.
  
  Reported by:  jtl
  MFC after:2 weeks

Modified:
  head/sys/net/route.c
  head/tests/sys/netinet/redirect.sh
  head/tests/sys/netinet6/redirect.sh

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cTue Mar  3 15:31:40 2020(r358584)
+++ head/sys/net/route.cTue Mar  3 15:33:43 2020(r358585)
@@ -632,7 +632,7 @@ rib_add_redirect(u_int fibnum, struct sockaddr *dst, s
info.rti_info[RTAX_GATEWAY] = gateway;
info.rti_ifa = ifa;
info.rti_ifp = ifp;
-   info.rti_flags = flags | RTF_DYNAMIC;
+   info.rti_flags = flags | RTF_HOST | RTF_DYNAMIC;
 
/* Setup route metrics to define expire time. */
bzero(&rti_rmx, sizeof(rti_rmx));

Modified: head/tests/sys/netinet/redirect.sh
==
--- head/tests/sys/netinet/redirect.sh  Tue Mar  3 15:31:40 2020
(r358584)
+++ head/tests/sys/netinet/redirect.sh  Tue Mar  3 15:33:43 2020
(r358585)
@@ -92,9 +92,8 @@ valid_redirect_body() {
--route ${dst_addr4} --gw ${new_rtr_ip}  \
--iface ${epair}a 

-   count=`jexec ${jname} route -n get -4 ${dst_addr4} | grep destination | 
grep -c ${dst_addr4}`
-   # Verify redirect got installed
-   atf_check_equal "1" "${count}"
+   atf_check -o match:"destination: ${dst_addr4}\$" jexec ${jname} route 
-n get -4 ${dst_addr4}
+   atf_check -o match:'flags: ' jexec 
${jname} route -n get -4 ${dst_addr4}
 }
 
 valid_redirect_cleanup() {

Modified: head/tests/sys/netinet6/redirect.sh
==
--- head/tests/sys/netinet6/redirect.sh Tue Mar  3 15:31:40 2020
(r358584)
+++ head/tests/sys/netinet6/redirect.sh Tue Mar  3 15:33:43 2020
(r358585)
@@ -94,9 +94,9 @@ valid_redirect_body() {
--route ${dst_addr6} --gw ${new_rtr_ll_ip}  \
--iface ${epair}a 

-   count=`jexec ${jname} route -n get -6 ${dst_addr6} | grep destination | 
grep -c ${dst_addr6}`
# Verify redirect got installed
-   atf_check_equal "1" "${count}"
+   atf_check -o match:"destination: ${dst_addr6}\$" jexec ${jname} route 
-n get -6 ${dst_addr6}
+   atf_check -o match:'flags: ' jexec 
${jname} route -n get -6 ${dst_addr6}
 }
 
 valid_redirect_cleanup() {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358586 - head/sys/compat/linuxkpi/common/src

2020-03-03 Thread Hans Petter Selasky
Author: hselasky
Date: Tue Mar  3 15:49:34 2020
New Revision: 358586
URL: https://svnweb.freebsd.org/changeset/base/358586

Log:
  When closing a LinuxKPI file always use the real release function to avoid
  resource leakage when destroying a LinuxKPI character device.
  
  Submitted by: Andrew Boyer 
  Reviewed by:  kib@
  PR:   244572
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/src/linux_compat.c

Modified: head/sys/compat/linuxkpi/common/src/linux_compat.c
==
--- head/sys/compat/linuxkpi/common/src/linux_compat.c  Tue Mar  3 15:33:43 
2020(r358585)
+++ head/sys/compat/linuxkpi/common/src/linux_compat.c  Tue Mar  3 15:49:34 
2020(r358586)
@@ -1490,6 +1490,7 @@ static int
 linux_file_close(struct file *file, struct thread *td)
 {
struct linux_file *filp;
+   int (*release)(struct inode *, struct linux_file *);
const struct file_operations *fop;
struct linux_cdev *ldev;
int error;
@@ -1507,8 +1508,13 @@ linux_file_close(struct file *file, struct thread *td)
linux_set_current(td);
linux_poll_wait_dequeue(filp);
linux_get_fop(filp, &fop, &ldev);
-   if (fop->release != NULL)
-   error = -OPW(file, td, fop->release(filp->f_vnode, filp));
+   /*
+* Always use the real release function, if any, to avoid
+* leaking device resources:
+*/
+   release = filp->f_op->release;
+   if (release != NULL)
+   error = -OPW(file, td, release(filp->f_vnode, filp));
funsetown(&filp->f_sigio);
if (filp->f_vnode != NULL)
vdrop(filp->f_vnode);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358587 - stable/12/contrib/elftoolchain/addr2line

2020-03-03 Thread Ed Maste
Author: emaste
Date: Tue Mar  3 16:25:28 2020
New Revision: 358587
URL: https://svnweb.freebsd.org/changeset/base/358587

Log:
  MFC r357844: addr2line: Handle DW_AT_ranges in compile units
  
  Based on original submission by Marat Radchenko in ELF Tool Chain
  ticket #545, rebased and updated by Tiger Gao.
  
  Also r357862, use stdbool.h header for bool
  
  PR:   217736
  Submitted by: Marat Radchenko 
  Submitted by: Tiger Gao 
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/contrib/elftoolchain/addr2line/addr2line.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/contrib/elftoolchain/addr2line/addr2line.c
==
--- stable/12/contrib/elftoolchain/addr2line/addr2line.cTue Mar  3 
15:49:34 2020(r358586)
+++ stable/12/contrib/elftoolchain/addr2line/addr2line.cTue Mar  3 
16:25:28 2020(r358587)
@@ -65,6 +65,7 @@ struct CU {
Dwarf_Signed nsrcfiles;
STAILQ_HEAD(, Func) funclist;
Dwarf_Die die;
+   Dwarf_Debug dbg;
 };
 
 static struct option longopts[] = {
@@ -345,7 +346,8 @@ cont_search:
collect_func(dbg, ret_die, parent, cu);
 
/* Cleanup */
-   dwarf_dealloc(dbg, die, DW_DLA_DIE);
+   if (die != cu->die)
+   dwarf_dealloc(dbg, die, DW_DLA_DIE);
 
if (abst_die != NULL)
dwarf_dealloc(dbg, abst_die, DW_DLA_DIE);
@@ -411,6 +413,102 @@ culookup(Dwarf_Unsigned addr)
return (NULL);
 }
 
+/*
+ * Check whether addr falls into range(s) of current CU, and save current CU
+ * to lookup tree if so.
+ */
+static int
+check_range(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsigned addr,
+struct CU **cu)
+{
+   Dwarf_Error de;
+   Dwarf_Unsigned addr_base, lopc, hipc;
+   Dwarf_Off ranges_off;
+   Dwarf_Signed ranges_cnt;
+   Dwarf_Ranges *ranges;
+   int i, ret;
+   bool in_range;
+
+   addr_base = 0;
+   ranges = NULL;
+   ranges_cnt = 0;
+   in_range = false;
+
+   ret = dwarf_attrval_unsigned(die, DW_AT_ranges, &ranges_off, &de);
+   if (ret == DW_DLV_NO_ENTRY) {
+   if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) ==
+   DW_DLV_OK) {
+   if (lopc == curlopc)
+   return (DW_DLV_ERROR);
+   if (dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc,
+   &de) == DW_DLV_OK) {
+   /*
+* Check if the address falls into the PC
+* range of this CU.
+*/
+   if (handle_high_pc(die, lopc, &hipc) !=
+   DW_DLV_OK)
+   return (DW_DLV_ERROR);
+   } else {
+   /* Assume ~0ULL if DW_AT_high_pc not present */
+   hipc = ~0ULL;
+   }
+
+   if (addr >= lopc && addr < hipc) {
+   in_range = true;
+   }
+   }
+   } else if (ret == DW_DLV_OK) {
+   ret = dwarf_get_ranges(dbg, ranges_off, &ranges,
+   &ranges_cnt, NULL, &de);
+   if (ret != DW_DLV_OK)
+   return (ret);
+
+   if (!ranges || ranges_cnt <= 0)
+   return (DW_DLV_ERROR);
+
+   for (i = 0; i < ranges_cnt; i++) {
+   if (ranges[i].dwr_type == DW_RANGES_END)
+   return (DW_DLV_NO_ENTRY);
+
+   if (ranges[i].dwr_type ==
+   DW_RANGES_ADDRESS_SELECTION) {
+   addr_base = ranges[i].dwr_addr2;
+   continue;
+   }
+
+   /* DW_RANGES_ENTRY */
+   lopc = ranges[i].dwr_addr1 + addr_base;
+   hipc = ranges[i].dwr_addr2 + addr_base;
+
+   if (lopc == curlopc)
+   return (DW_DLV_ERROR);
+
+   if (addr >= lopc && addr < hipc){
+   in_range = true;
+   break;
+   }
+   }
+   } else {
+   return (DW_DLV_ERROR);
+   }
+   
+   if (in_range) {
+   if ((*cu = calloc(1, sizeof(struct CU))) == NULL)
+   err(EXIT_FAILURE, "calloc");
+   (*cu)->lopc = lopc;
+   (*cu)->hipc = hipc;
+   (*cu)->die = die;
+   (*cu)->dbg = dbg;
+   STAILQ_INIT(&(*cu)->funclist);
+   RB_INSERT(cutree, &cuhead, *cu);
+   curlopc = lopc;
+   return (DW_DLV_OK);

svn commit: r358588 - stable/12/lib/libc/sys

2020-03-03 Thread Ed Maste
Author: emaste
Date: Tue Mar  3 17:30:13 2020
New Revision: 358588
URL: https://svnweb.freebsd.org/changeset/base/358588

Log:
  MFC r358344: mprotect.2: sort errors alphabetically

Modified:
  stable/12/lib/libc/sys/mprotect.2
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/sys/mprotect.2
==
--- stable/12/lib/libc/sys/mprotect.2   Tue Mar  3 16:25:28 2020
(r358587)
+++ stable/12/lib/libc/sys/mprotect.2   Tue Mar  3 17:30:13 2020
(r358588)
@@ -72,18 +72,18 @@ The
 .Fn mprotect
 system call will fail if:
 .Bl -tag -width Er
-.It Bq Er EINVAL
-The virtual address range specified by the
-.Fa addr
-and
-.Fa len
-arguments is not valid.
 .It Bq Er EACCES
 The calling process was not allowed to change
 the protection to the value specified by
 the
 .Fa prot
 argument.
+.It Bq Er EINVAL
+The virtual address range specified by the
+.Fa addr
+and
+.Fa len
+arguments is not valid.
 .El
 .Sh SEE ALSO
 .Xr madvise 2 ,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358589 - head/tests/sys/net

2020-03-03 Thread Olivier Cochard
Author: olivier (ports committer)
Date: Tue Mar  3 17:35:15 2020
New Revision: 358589
URL: https://svnweb.freebsd.org/changeset/base/358589

Log:
  Skip if_epair regression test if module doesn't exist
  
  Approved by:  kp
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D23876

Modified:
  head/tests/sys/net/Makefile
  head/tests/sys/net/if_epair.c

Modified: head/tests/sys/net/Makefile
==
--- head/tests/sys/net/Makefile Tue Mar  3 17:30:13 2020(r358588)
+++ head/tests/sys/net/Makefile Tue Mar  3 17:35:15 2020(r358589)
@@ -22,6 +22,8 @@ TEST_METADATA+=   is_exclusive=true
 MAN=
 PROGS+=randsleep
 
+CFLAGS+=-I${.CURDIR:H:H}
+
 WARNS?=6
 
 .include 

Modified: head/tests/sys/net/if_epair.c
==
--- head/tests/sys/net/if_epair.c   Tue Mar  3 17:30:13 2020
(r358588)
+++ head/tests/sys/net/if_epair.c   Tue Mar  3 17:35:15 2020
(r358589)
@@ -40,6 +40,7 @@
 #include 
 
 #include 
+#include "freebsd_test_suite/macros.h"
 
 ATF_TC(params);
 ATF_TC_HEAD(params, tc)
@@ -52,9 +53,8 @@ ATF_TC_BODY(params, tc)
struct ifreq ifr;
int s;
 
-   s = kldload("if_epair");
-   if (s == -1 && errno != EEXIST)
-   atf_tc_fail("Failed to load if_epair");
+   kldload("if_epair");
+   ATF_REQUIRE_KERNEL_MODULE("if_epair");
 
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358590 - head/sys/cam

2020-03-03 Thread Warner Losh
Author: imp
Date: Tue Mar  3 17:40:29 2020
New Revision: 358590
URL: https://svnweb.freebsd.org/changeset/base/358590

Log:
  Get rid of silly /* FALLTHROUGH */ lines
  
  Consistently omit /* FALLTHROUGH */ when we have a case statement that does
  nothing. Since compilers don't warn about stacked case statements, and we were
  inconsistent, resolve by removing extras.

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==
--- head/sys/cam/cam_xpt.c  Tue Mar  3 17:35:15 2020(r358589)
+++ head/sys/cam/cam_xpt.c  Tue Mar  3 17:40:29 2020(r358590)
@@ -2686,11 +2686,8 @@ xpt_action_default(union ccb *start_ccb)
start_ccb->ataio.resid = 0;
/* FALLTHROUGH */
case XPT_NVME_IO:
-   /* FALLTHROUGH */
case XPT_NVME_ADMIN:
-   /* FALLTHROUGH */
case XPT_MMC_IO:
-   /* FALLTHROUGH */
case XPT_RESET_DEV:
case XPT_ENG_EXEC:
case XPT_SMP_IO:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358591 - in stable: 11/sys/arm/arm 12/sys/arm/arm

2020-03-03 Thread Dimitry Andric
Author: dim
Date: Tue Mar  3 18:01:03 2020
New Revision: 358591
URL: https://svnweb.freebsd.org/changeset/base/358591

Log:
  MFC r358407:
  
  Merge r358406 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0:
  
  sys/arm/arm/identcpu-v6.c:227:5: error: misleading indentation; statement is 
not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (val & CPUV7_CT_CTYPE_RA)
  ^
  sys/arm/arm/identcpu-v6.c:225:4: note: previous statement is here
  if (val & CPUV7_CT_CTYPE_WB)
  ^
  
  This was due to an accidentally inserted tab before the if statement.

Modified:
  stable/12/sys/arm/arm/identcpu-v6.c
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/sys/arm/arm/identcpu-v6.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/12/sys/arm/arm/identcpu-v6.c
==
--- stable/12/sys/arm/arm/identcpu-v6.c Tue Mar  3 17:40:29 2020
(r358590)
+++ stable/12/sys/arm/arm/identcpu-v6.c Tue Mar  3 18:01:03 2020
(r358591)
@@ -224,7 +224,7 @@ print_v7_cache(void )
printf(" WT");
if (val & CPUV7_CT_CTYPE_WB)
printf(" WB");
-   if (val & CPUV7_CT_CTYPE_RA)
+   if (val & CPUV7_CT_CTYPE_RA)
printf(" Read-Alloc");
if (val & CPUV7_CT_CTYPE_WA)
printf(" Write-Alloc");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358591 - in stable: 11/sys/arm/arm 12/sys/arm/arm

2020-03-03 Thread Dimitry Andric
Author: dim
Date: Tue Mar  3 18:01:03 2020
New Revision: 358591
URL: https://svnweb.freebsd.org/changeset/base/358591

Log:
  MFC r358407:
  
  Merge r358406 from the clang1000-import branch:
  
  Fix the following -Werror warning from clang 10.0.0:
  
  sys/arm/arm/identcpu-v6.c:227:5: error: misleading indentation; statement is 
not part of the previous 'if' [-Werror,-Wmisleading-indentation]
  if (val & CPUV7_CT_CTYPE_RA)
  ^
  sys/arm/arm/identcpu-v6.c:225:4: note: previous statement is here
  if (val & CPUV7_CT_CTYPE_WB)
  ^
  
  This was due to an accidentally inserted tab before the if statement.

Modified:
  stable/11/sys/arm/arm/identcpu-v6.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/sys/arm/arm/identcpu-v6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/sys/arm/arm/identcpu-v6.c
==
--- stable/11/sys/arm/arm/identcpu-v6.c Tue Mar  3 17:40:29 2020
(r358590)
+++ stable/11/sys/arm/arm/identcpu-v6.c Tue Mar  3 18:01:03 2020
(r358591)
@@ -206,7 +206,7 @@ print_v7_cache(void )
printf(" WT");
if (val & CPUV7_CT_CTYPE_WB)
printf(" WB");
-   if (val & CPUV7_CT_CTYPE_RA)
+   if (val & CPUV7_CT_CTYPE_RA)
printf(" Read-Alloc");
if (val & CPUV7_CT_CTYPE_WA)
printf(" Write-Alloc");
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358592 - head/sys/net

2020-03-03 Thread Brooks Davis
Author: brooks
Date: Tue Mar  3 18:05:11 2020
New Revision: 358592
URL: https://svnweb.freebsd.org/changeset/base/358592

Log:
  Expose ifr_buffer_get_(buffer|length) outside if.c.
  
  This is a preparatory commit for D23933.
  
  Reviewed by:  jhb

Modified:
  head/sys/net/if.c
  head/sys/net/if_var.h

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Tue Mar  3 18:01:03 2020(r358591)
+++ head/sys/net/if.c   Tue Mar  3 18:05:11 2020(r358592)
@@ -2414,7 +2414,7 @@ ifunit(const char *name)
return (ifp);
 }
 
-static void *
+void *
 ifr_buffer_get_buffer(void *data)
 {
union ifreq_union *ifrup;
@@ -2442,7 +2442,7 @@ ifr_buffer_set_buffer_null(void *data)
ifrup->ifr.ifr_ifru.ifru_buffer.buffer = NULL;
 }
 
-static size_t
+size_t
 ifr_buffer_get_length(void *data)
 {
union ifreq_union *ifrup;

Modified: head/sys/net/if_var.h
==
--- head/sys/net/if_var.h   Tue Mar  3 18:01:03 2020(r358591)
+++ head/sys/net/if_var.h   Tue Mar  3 18:05:11 2020(r358592)
@@ -784,6 +784,8 @@ int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsom
 
 /* accessors for struct ifreq */
 void *ifr_data_get_ptr(void *ifrp);
+void *ifr_buffer_get_buffer(void *data);
+size_t ifr_buffer_get_length(void *data);
 
 int ifhwioctl(u_long, struct ifnet *, caddr_t, struct thread *);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358593 - head/sys/dev/mxge

2020-03-03 Thread Brooks Davis
Author: brooks
Date: Tue Mar  3 18:58:43 2020
New Revision: 358593
URL: https://svnweb.freebsd.org/changeset/base/358593

Log:
  Use ifr_data_get_ptr() consistently.

Modified:
  head/sys/dev/mxge/if_mxge.c

Modified: head/sys/dev/mxge/if_mxge.c
==
--- head/sys/dev/mxge/if_mxge.c Tue Mar  3 18:05:11 2020(r358592)
+++ head/sys/dev/mxge/if_mxge.c Tue Mar  3 18:58:43 2020(r358593)
@@ -4326,7 +4326,7 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t 
err = mxge_fetch_i2c(sc, &i2c);
mtx_unlock(&sc->driver_mtx);
if (err == 0)
-   err = copyout(&i2c, ifr->ifr_ifru.ifru_data,
+   err = copyout(&i2c, ifr_data_get_ptr(ifr),
sizeof(i2c));
break;
default:
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358594 - head/sbin/dumpon

2020-03-03 Thread Eric van Gyzen
Author: vangyzen
Date: Tue Mar  3 22:14:23 2020
New Revision: 358594
URL: https://svnweb.freebsd.org/changeset/base/358594

Log:
  dumpon: skip size check if using zstd
  
  As with gzip, let the dump device be smaller than physical memory
  when using zstd and full dumps.
  
  Also print the error message if the size check fails, even if -v
  is not specified.  Failing silently is not friendly.
  
  Reviewed by:  cem markj
  MFC after:2 weeks
  Sponsored by: Dell EMC Isilon
  Differential Revision:https://reviews.freebsd.org/D23923

Modified:
  head/sbin/dumpon/dumpon.c

Modified: head/sbin/dumpon/dumpon.c
==
--- head/sbin/dumpon/dumpon.c   Tue Mar  3 18:58:43 2020(r358593)
+++ head/sbin/dumpon/dumpon.c   Tue Mar  3 22:14:23 2020(r358594)
@@ -203,11 +203,8 @@ check_size(int fd, const char *fn)
err(EX_OSERR, "can't get memory size");
if (ioctl(fd, DIOCGMEDIASIZE, &mediasize) != 0)
err(EX_OSERR, "%s: can't get size", fn);
-   if ((uintmax_t)mediasize < (uintmax_t)physmem) {
-   if (verbose)
-   printf("%s is smaller than physical memory\n", fn);
-   exit(EX_IOERR);
-   }
+   if ((uintmax_t)mediasize < (uintmax_t)physmem)
+   errx(EX_IOERR, "%s is smaller than physical memory", fn);
 }
 
 #ifdef HAVE_CRYPTO
@@ -495,7 +492,7 @@ main(int argc, char *argv[])
usage();
 
fd = opendumpdev(dev, dumpdev);
-   if (!netdump && !gzip && !rflag)
+   if (!netdump && !gzip && !zstd && !rflag)
check_size(fd, dumpdev);
 
kdap = &ndconf;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358595 - head/sys/dev/ismt

2020-03-03 Thread Justin Hibbits
Author: jhibbits
Date: Tue Mar  3 22:23:56 2020
New Revision: 358595
URL: https://svnweb.freebsd.org/changeset/base/358595

Log:
  Add Atom C3000 (Denverton) SMT PCI ID
  
  MFC after:3 days
  Sponsored by: Juniper Networks, Inc

Modified:
  head/sys/dev/ismt/ismt.c

Modified: head/sys/dev/ismt/ismt.c
==
--- head/sys/dev/ismt/ismt.cTue Mar  3 22:14:23 2020(r358594)
+++ head/sys/dev/ismt/ismt.cTue Mar  3 22:23:56 2020(r358595)
@@ -717,6 +717,7 @@ fail:
 #define ID_INTEL_S1200_SMT00x0c598086
 #define ID_INTEL_S1200_SMT10x0c5a8086
 #define ID_INTEL_C2000_SMT 0x1f158086
+#define ID_INTEL_C3000_SMT 0x19ac8086
 
 static int
 ismt_probe(device_t dev)
@@ -732,6 +733,9 @@ ismt_probe(device_t dev)
break;
case ID_INTEL_C2000_SMT:
desc = "Atom Processor C2000 SMBus 2.0";
+   break;
+   case ID_INTEL_C3000_SMT:
+   desc = "Atom Processor C3000 SMBus 2.0";
break;
default:
return (ENXIO);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358596 - head/sys/sys

2020-03-03 Thread Conrad Meyer
Author: cem
Date: Tue Mar  3 23:15:30 2020
New Revision: 358596
URL: https://svnweb.freebsd.org/changeset/base/358596

Log:
  sys/signalvar.h: Fix opposite boolean sense in comment
  
  Correct the sense of the comment describing sigsetmasked() to match the
  code.  It was exactly backwards.
  
  While here, convert the type/values of the predicate from pre-C99 int/1/0 to
  bool/true/false.  No functional change.

Modified:
  head/sys/sys/signalvar.h

Modified: head/sys/sys/signalvar.h
==
--- head/sys/sys/signalvar.hTue Mar  3 22:23:56 2020(r358595)
+++ head/sys/sys/signalvar.hTue Mar  3 23:15:30 2020(r358596)
@@ -282,20 +282,20 @@ extern bool sigfastblock_fetch_always;
 (!SIGISEMPTY((td)->td_proc->p_siglist) &&  \
!sigsetmasked(&(td)->td_proc->p_siglist, &(td)->td_sigmask)))
 /*
- * Return the value of the pseudo-expression ((*set & ~*mask) != 0).  This
+ * Return the value of the pseudo-expression ((*set & ~*mask) == 0).  This
  * is an optimized version of SIGISEMPTY() on a temporary variable
  * containing SIGSETNAND(*set, *mask).
  */
-static __inline int
+static __inline bool
 sigsetmasked(sigset_t *set, sigset_t *mask)
 {
int i;
 
for (i = 0; i < _SIG_WORDS; i++) {
if (set->__bits[i] & ~mask->__bits[i])
-   return (0);
+   return (false);
}
-   return (1);
+   return (true);
 }
 
 #defineksiginfo_init(ksi)  \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358597 - head/sys/kern

2020-03-03 Thread Chuck Silvers
Author: chs
Date: Wed Mar  4 00:22:50 2020
New Revision: 358597
URL: https://svnweb.freebsd.org/changeset/base/358597

Log:
  if vm_pager_get_pages_async() returns an error, release the sfio->nios
  refcount that we took earlier that represents the I/O that ended up
  not being started.
  
  Reviewed by:  glebius
  Approved by:  imp (mentor)
  Sponsored by: Netflix

Modified:
  head/sys/kern/kern_sendfile.c

Modified: head/sys/kern/kern_sendfile.c
==
--- head/sys/kern/kern_sendfile.c   Tue Mar  3 23:15:30 2020
(r358596)
+++ head/sys/kern/kern_sendfile.c   Wed Mar  4 00:22:50 2020
(r358597)
@@ -454,6 +454,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, i
__func__, pa, j));
vm_page_unwire(pa[j], PQ_INACTIVE);
}
+   refcount_release(&sfio->nios);
return (EIO);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r358486 - head/sys/dev/bce

2020-03-03 Thread Warner Losh
On Mon, Mar 2, 2020 at 3:06 PM John Baldwin  wrote:

> On 3/1/20 9:27 AM, Warner Losh wrote:
> > Author: imp
> > Date: Sun Mar  1 17:27:30 2020
> > New Revision: 358486
> > URL: https://svnweb.freebsd.org/changeset/base/358486
> >
> > Log:
> >   Remove all the compatibility hacks for systems that predate FreeBSD 8.
> Some of
> >   these look to be cut and pasted from other drivers since this driver
> was
> >   committed to FreeBSD 7-current and MFC'd to FreeBSD 6. The ones for
> FreeBSD 4
> >   and 5 likely never were working...
>
> You'd be surprised.  I had to backport this to 4.x for Y!BSD, so I do
> suspect
> the 4.x bits worked fine.  Good to clean out the cruft regardless.
>

The more you know... the more you think a good stiff drink is in order :)

Warner
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358598 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:36:50 2020
New Revision: 358598
URL: https://svnweb.freebsd.org/changeset/base/358598

Log:
  MFC r358336: MFZoL: Fix txg_sync_thread hang in scan_exec_io()
  
  When scn->scn_maxinflight_bytes has not been initialized it's
  possible to hang on the condition variable in scan_exec_io().
  This issue was uncovered by ztest and is only possible when
  deduplication is enabled through the following call path.
  
txg_sync_thread()
  spa_sync()
ddt_sync_table()
  ddt_sync_entry()
dsl_scan_ddt_entry()
  dsl_scan_scrub_cb()
dsl_scan_enqueuei()
  scan_exec_io()
cv_wait()
  
  Resolve the issue by always initializing scn_maxinflight_bytes
  to a reasonable minimum value.  This value will be recalculated
  in dsl_scan_sync() to pick up changes to zfs_scan_vdev_limit
  and the addition/removal of vdevs.
  
  Reviewed-by: Tom Caputi 
  Reviewed by: George Melikov 
  Signed-off-by: Brian Behlendorf 
  Closes #7098
  zfsonlinux/zfs@f90a30ad1b32a971f62a540f8944e42f99b254ce

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 00:22:50 2020(r358597)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:36:50 2020(r358598)
@@ -125,6 +125,7 @@ static boolean_t scan_ds_queue_contains(dsl_scan_t *sc
 static void scan_ds_queue_insert(dsl_scan_t *scn, uint64_t dsobj, uint64_t 
txg);
 static void scan_ds_queue_remove(dsl_scan_t *scn, uint64_t dsobj);
 static void scan_ds_queue_sync(dsl_scan_t *scn, dmu_tx_t *tx);
+static uint64_t dsl_scan_count_leaves(vdev_t *vd);
 
 extern int zfs_vdev_async_write_active_min_dirty_percent;
 
@@ -439,6 +440,14 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
scn->scn_async_destroying = spa_feature_is_active(dp->dp_spa,
SPA_FEATURE_ASYNC_DESTROY);
 
+   /*
+* Calculate the max number of in-flight bytes for pool-wide
+* scanning operations (minimum 1MB). Limits for the issuing
+* phase are done per top-level vdev and are handled separately.
+*/
+   scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit *
+   dsl_scan_count_leaves(spa->spa_root_vdev), 1ULL << 20);
+
bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys));
avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t),
offsetof(scan_ds_t, sds_node));
@@ -2350,7 +2359,7 @@ dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum 
zbookmark_phys_t zb = { 0 };
int p;
 
-   if (scn->scn_phys.scn_state != DSS_SCANNING)
+   if (!dsl_scan_is_running(scn))
return;
 
for (p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
@@ -,7 +3342,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
uint64_t nr_leaves = dsl_scan_count_leaves(spa->spa_root_vdev);
 
/*
-* Calculate the max number of in-flight bytes for pool-wide
+* Recalculate the max number of in-flight bytes for pool-wide
 * scanning operations (minimum 1MB). Limits for the issuing
 * phase are done per top-level vdev and are handled separately.
 */
@@ -3652,6 +3661,8 @@ dsl_scan_scrub_done(zio_t *zio)
dsl_scan_io_queue_t *queue = zio->io_private;
 
abd_free(zio->io_abd);
+
+   ASSERT3U(scn->scn_maxinflight_bytes, >, 0);
 
if (queue == NULL) {
mutex_enter(&spa->spa_scrub_lock);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358599 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:38:30 2020
New Revision: 358599
URL: https://svnweb.freebsd.org/changeset/base/358599

Log:
  MFC r358340: Fix patch mismerge in r358336.

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:36:50 2020(r358598)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:38:30 2020(r358599)
@@ -3662,8 +3662,6 @@ dsl_scan_scrub_done(zio_t *zio)
 
abd_free(zio->io_abd);
 
-   ASSERT3U(scn->scn_maxinflight_bytes, >, 0);
-
if (queue == NULL) {
mutex_enter(&spa->spa_scrub_lock);
ASSERT3U(spa->spa_scrub_inflight, >=, BP_GET_PSIZE(bp));
@@ -3700,6 +3698,8 @@ scan_exec_io(dsl_pool_t *dp, const blkptr_t *bp, int z
size_t size = BP_GET_PSIZE(bp);
abd_t *data = abd_alloc_for_io(size, B_FALSE);
unsigned int scan_delay = 0;
+
+   ASSERT3U(scn->scn_maxinflight_bytes, >, 0);
 
if (queue == NULL) {
mutex_enter(&spa->spa_scrub_lock);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358600 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:39:34 2020
New Revision: 358600
URL: https://svnweb.freebsd.org/changeset/base/358600

Log:
  MFC r358336, r358340: MFZoL: Fix txg_sync_thread hang in scan_exec_io()
  
  When scn->scn_maxinflight_bytes has not been initialized it's
  possible to hang on the condition variable in scan_exec_io().
  This issue was uncovered by ztest and is only possible when
  deduplication is enabled through the following call path.
  
txg_sync_thread()
  spa_sync()
ddt_sync_table()
  ddt_sync_entry()
dsl_scan_ddt_entry()
  dsl_scan_scrub_cb()
dsl_scan_enqueuei()
  scan_exec_io()
cv_wait()
  
  Resolve the issue by always initializing scn_maxinflight_bytes
  to a reasonable minimum value.  This value will be recalculated
  in dsl_scan_sync() to pick up changes to zfs_scan_vdev_limit
  and the addition/removal of vdevs.
  
  Reviewed-by: Tom Caputi 
  Reviewed by: George Melikov 
  Signed-off-by: Brian Behlendorf 
  Closes #7098
  zfsonlinux/zfs@f90a30ad1b32a971f62a540f8944e42f99b254ce

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:38:30 2020(r358599)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:39:34 2020(r358600)
@@ -125,6 +125,7 @@ static boolean_t scan_ds_queue_contains(dsl_scan_t *sc
 static void scan_ds_queue_insert(dsl_scan_t *scn, uint64_t dsobj, uint64_t 
txg);
 static void scan_ds_queue_remove(dsl_scan_t *scn, uint64_t dsobj);
 static void scan_ds_queue_sync(dsl_scan_t *scn, dmu_tx_t *tx);
+static uint64_t dsl_scan_count_leaves(vdev_t *vd);
 
 extern int zfs_vdev_async_write_active_min_dirty_percent;
 
@@ -439,6 +440,14 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
scn->scn_async_destroying = spa_feature_is_active(dp->dp_spa,
SPA_FEATURE_ASYNC_DESTROY);
 
+   /*
+* Calculate the max number of in-flight bytes for pool-wide
+* scanning operations (minimum 1MB). Limits for the issuing
+* phase are done per top-level vdev and are handled separately.
+*/
+   scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit *
+   dsl_scan_count_leaves(spa->spa_root_vdev), 1ULL << 20);
+
bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys));
avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t),
offsetof(scan_ds_t, sds_node));
@@ -2346,7 +2355,7 @@ dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum 
zbookmark_phys_t zb = { 0 };
int p;
 
-   if (scn->scn_phys.scn_state != DSS_SCANNING)
+   if (!dsl_scan_is_running(scn))
return;
 
for (p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
@@ -3329,7 +3338,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
uint64_t nr_leaves = dsl_scan_count_leaves(spa->spa_root_vdev);
 
/*
-* Calculate the max number of in-flight bytes for pool-wide
+* Recalculate the max number of in-flight bytes for pool-wide
 * scanning operations (minimum 1MB). Limits for the issuing
 * phase are done per top-level vdev and are handled separately.
 */
@@ -3685,6 +3694,8 @@ scan_exec_io(dsl_pool_t *dp, const blkptr_t *bp, int z
size_t size = BP_GET_PSIZE(bp);
abd_t *data = abd_alloc_for_io(size, B_FALSE);
unsigned int scan_delay = 0;
+
+   ASSERT3U(scn->scn_maxinflight_bytes, >, 0);
 
if (queue == NULL) {
mutex_enter(&spa->spa_scrub_lock);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358601 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:40:35 2020
New Revision: 358601
URL: https://svnweb.freebsd.org/changeset/base/358601

Log:
  MFC r358337: MFZoL: Fix 2 small bugs with cached dsl_scan_phys_t
  
  This patch corrects 2 small bugs where scn->scn_phys_cached was
  not properly updated to match the primary copy when it needed to
  be. The first resulted in the pause state not being properly
  updated and the second resulted in the cached version being
  completely zeroed even if the primary was not.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Serapheim Dimitropoulos 
  Reviewed-by: Matthew Ahrens 
  Signed-off-by: Tom Caputi 
  Closes #8010
  zfsonlinux/zfs@8cb119e3dc0ac6c90b1517fbadc021b7e9741fc6

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:39:34 2020(r358600)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:40:35 2020(r358601)
@@ -448,7 +448,6 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit *
dsl_scan_count_leaves(spa->spa_root_vdev), 1ULL << 20);
 
-   bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys));
avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t),
offsetof(scan_ds_t, sds_node));
avl_create(&scn->scn_prefetch_queue, scan_prefetch_queue_compare,
@@ -506,6 +505,8 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
}
}
 
+   bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys));
+
/* reload the queue into the in-core state */
if (scn->scn_phys.scn_queue_obj != 0) {
zap_cursor_t zc;
@@ -928,6 +929,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx)
/* can't pause a scrub when there is no in-progress scrub */
spa->spa_scan_pass_scrub_pause = gethrestime_sec();
scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED;
+   scn->scn_phys_cached.scn_flags |= DSF_SCRUB_PAUSED;
dsl_scan_sync_state(scn, tx, SYNC_CACHED);
spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED);
} else {
@@ -942,6 +944,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx)
gethrestime_sec() - spa->spa_scan_pass_scrub_pause;
spa->spa_scan_pass_scrub_pause = 0;
scn->scn_phys.scn_flags &= ~DSF_SCRUB_PAUSED;
+   scn->scn_phys_cached.scn_flags &= ~DSF_SCRUB_PAUSED;
dsl_scan_sync_state(scn, tx, SYNC_CACHED);
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358602 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:40:54 2020
New Revision: 358602
URL: https://svnweb.freebsd.org/changeset/base/358602

Log:
  MFC r358337: MFZoL: Fix 2 small bugs with cached dsl_scan_phys_t
  
  This patch corrects 2 small bugs where scn->scn_phys_cached was
  not properly updated to match the primary copy when it needed to
  be. The first resulted in the pause state not being properly
  updated and the second resulted in the cached version being
  completely zeroed even if the primary was not.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Serapheim Dimitropoulos 
  Reviewed-by: Matthew Ahrens 
  Signed-off-by: Tom Caputi 
  Closes #8010
  zfsonlinux/zfs@8cb119e3dc0ac6c90b1517fbadc021b7e9741fc6

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:40:35 2020(r358601)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:40:54 2020(r358602)
@@ -448,7 +448,6 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
scn->scn_maxinflight_bytes = MAX(zfs_scan_vdev_limit *
dsl_scan_count_leaves(spa->spa_root_vdev), 1ULL << 20);
 
-   bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys));
avl_create(&scn->scn_queue, scan_ds_queue_compare, sizeof (scan_ds_t),
offsetof(scan_ds_t, sds_node));
avl_create(&scn->scn_prefetch_queue, scan_prefetch_queue_compare,
@@ -506,6 +505,8 @@ dsl_scan_init(dsl_pool_t *dp, uint64_t txg)
}
}
 
+   bcopy(&scn->scn_phys, &scn->scn_phys_cached, sizeof (scn->scn_phys));
+
/* reload the queue into the in-core state */
if (scn->scn_phys.scn_queue_obj != 0) {
zap_cursor_t zc;
@@ -928,6 +929,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx)
/* can't pause a scrub when there is no in-progress scrub */
spa->spa_scan_pass_scrub_pause = gethrestime_sec();
scn->scn_phys.scn_flags |= DSF_SCRUB_PAUSED;
+   scn->scn_phys_cached.scn_flags |= DSF_SCRUB_PAUSED;
dsl_scan_sync_state(scn, tx, SYNC_CACHED);
spa_event_notify(spa, NULL, NULL, ESC_ZFS_SCRUB_PAUSED);
} else {
@@ -942,6 +944,7 @@ dsl_scrub_pause_resume_sync(void *arg, dmu_tx_t *tx)
gethrestime_sec() - spa->spa_scan_pass_scrub_pause;
spa->spa_scan_pass_scrub_pause = 0;
scn->scn_phys.scn_flags &= ~DSF_SCRUB_PAUSED;
+   scn->scn_phys_cached.scn_flags &= ~DSF_SCRUB_PAUSED;
dsl_scan_sync_state(scn, tx, SYNC_CACHED);
}
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358603 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:41:49 2020
New Revision: 358603
URL: https://svnweb.freebsd.org/changeset/base/358603

Log:
  MFC r358339: MFZoL: Fix issue with scanning dedup blocks as scan ends
  
  This patch fixes an issue discovered by ztest where
  dsl_scan_ddt_entry() could add I/Os to the dsl scan queues
  between when the scan had finished all required work and
  when the scan was marked as complete. This caused the scan
  to spin indefinitely without ending.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Serapheim Dimitropoulos 
  Reviewed-by: Matthew Ahrens 
  Signed-off-by: Tom Caputi 
  Closes #8010
  zfsonlinux/zfs@5e0bd0ae056e26de36dee3c199c6fcff8f14ee15

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:40:54 2020(r358602)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:41:49 2020(r358603)
@@ -2365,6 +2365,20 @@ dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum 
if (!dsl_scan_is_running(scn))
return;
 
+   /*
+* This function is special because it is the only thing
+* that can add scan_io_t's to the vdev scan queues from
+* outside dsl_scan_sync(). For the most part this is ok
+* as long as it is called from within syncing context.
+* However, dsl_scan_sync() expects that no new sio's will
+* be added between when all the work for a scan is done
+* and the next txg when the scan is actually marked as
+* completed. This check ensures we do not issue new sio's
+* during this period.
+*/
+   if (scn->scn_done_txg != 0)
+   return;
+
for (p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
if (ddp->ddp_phys_birth == 0 ||
ddp->ddp_phys_birth > scn->scn_phys.scn_max_txg)
@@ -3416,6 +3430,8 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
   (longlong_t)tx->tx_txg);
}
} else if (scn->scn_is_sorted && scn->scn_bytes_pending != 0) {
+   ASSERT(scn->scn_clearing);
+
/* need to issue scrubbing IOs from per-vdev queues */
scn->scn_zio_root = zio_root(dp->dp_spa, NULL,
NULL, ZIO_FLAG_CANFAIL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358604 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:42:09 2020
New Revision: 358604
URL: https://svnweb.freebsd.org/changeset/base/358604

Log:
  MFC r358339: MFZoL: Fix issue with scanning dedup blocks as scan ends
  
  This patch fixes an issue discovered by ztest where
  dsl_scan_ddt_entry() could add I/Os to the dsl scan queues
  between when the scan had finished all required work and
  when the scan was marked as complete. This caused the scan
  to spin indefinitely without ending.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed-by: Serapheim Dimitropoulos 
  Reviewed-by: Matthew Ahrens 
  Signed-off-by: Tom Caputi 
  Closes #8010
  zfsonlinux/zfs@5e0bd0ae056e26de36dee3c199c6fcff8f14ee15

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:41:49 2020(r358603)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Mar 
 4 04:42:09 2020(r358604)
@@ -2361,6 +2361,20 @@ dsl_scan_ddt_entry(dsl_scan_t *scn, enum zio_checksum 
if (!dsl_scan_is_running(scn))
return;
 
+   /*
+* This function is special because it is the only thing
+* that can add scan_io_t's to the vdev scan queues from
+* outside dsl_scan_sync(). For the most part this is ok
+* as long as it is called from within syncing context.
+* However, dsl_scan_sync() expects that no new sio's will
+* be added between when all the work for a scan is done
+* and the next txg when the scan is actually marked as
+* completed. This check ensures we do not issue new sio's
+* during this period.
+*/
+   if (scn->scn_done_txg != 0)
+   return;
+
for (p = 0; p < DDT_PHYS_TYPES; p++, ddp++) {
if (ddp->ddp_phys_birth == 0 ||
ddp->ddp_phys_birth > scn->scn_phys.scn_max_txg)
@@ -3412,6 +3426,8 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
   (longlong_t)tx->tx_txg);
}
} else if (scn->scn_is_sorted && scn->scn_bytes_pending != 0) {
+   ASSERT(scn->scn_clearing);
+
/* need to issue scrubbing IOs from per-vdev queues */
scn->scn_zio_root = zio_root(dp->dp_spa, NULL,
NULL, ZIO_FLAG_CANFAIL);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358605 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:42:56 2020
New Revision: 358605
URL: https://svnweb.freebsd.org/changeset/base/358605

Log:
  MFC r358342: MFZoL: Fix resilver writes in vdev_indirect_io_start
  
  This patch addresses an issue found in ztest where resilver
  write zios that were passed to an indirect vdev would end up
  being handled as though they were resilver read zios. This
  caused issues where the zio->io_abd would be both read to
  and written from at the same time, causing asserts to fail.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed by: Matt Ahrens 
  Reviewed-by: Serapheim Dimitropoulos 
  Signed-off-by: Tom Caputi 
  Closes #8193
  zfsonlinux/zfs@5aa95ba0d3502779695341b5f55fa5ba1d3330ff

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Directory Properties:
  stable/12/   (props changed)

Modified: 
stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Wed Mar  4 04:42:09 2020(r358604)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Wed Mar  4 04:42:56 2020(r358605)
@@ -1246,6 +1246,8 @@ vdev_indirect_read_all(zio_t *zio)
 {
indirect_vsd_t *iv = zio->io_vsd;
 
+   ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ);
+
for (indirect_split_t *is = list_head(&iv->iv_splits);
is != NULL; is = list_next(&iv->iv_splits, is)) {
for (int i = 0; i < is->is_children; i++) {
@@ -1335,7 +1337,8 @@ vdev_indirect_io_start(zio_t *zio)
vdev_indirect_child_io_done, zio));
} else {
iv->iv_split_block = B_TRUE;
-   if (zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) {
+   if (zio->io_type == ZIO_TYPE_READ &&
+   zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) {
/*
 * Read all copies.  Note that for simplicity,
 * we don't bother consulting the DTL in the
@@ -1344,13 +1347,17 @@ vdev_indirect_io_start(zio_t *zio)
vdev_indirect_read_all(zio);
} else {
/*
-* Read one copy of each split segment, from the
-* top-level vdev.  Since we don't know the
-* checksum of each split individually, the child
-* zio can't ensure that we get the right data.
-* E.g. if it's a mirror, it will just read from a
-* random (healthy) leaf vdev.  We have to verify
-* the checksum in vdev_indirect_io_done().
+* If this is a read zio, we read one copy of each
+* split segment, from the top-level vdev.  Since
+* we don't know the checksum of each split
+* individually, the child zio can't ensure that
+* we get the right data. E.g. if it's a mirror,
+* it will just read from a random (healthy) leaf
+* vdev. We have to verify the checksum in
+* vdev_indirect_io_done().
+*
+* For write zios, the vdev code will ensure we write
+* to all children.
 */
for (indirect_split_t *is = list_head(&iv->iv_splits);
is != NULL; is = list_next(&iv->iv_splits, is)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358606 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:43:23 2020
New Revision: 358606
URL: https://svnweb.freebsd.org/changeset/base/358606

Log:
  MFC r358342: MFZoL: Fix resilver writes in vdev_indirect_io_start
  
  This patch addresses an issue found in ztest where resilver
  write zios that were passed to an indirect vdev would end up
  being handled as though they were resilver read zios. This
  caused issues where the zio->io_abd would be both read to
  and written from at the same time, causing asserts to fail.
  
  Reviewed-by: Brian Behlendorf 
  Reviewed by: Matt Ahrens 
  Reviewed-by: Serapheim Dimitropoulos 
  Signed-off-by: Tom Caputi 
  Closes #8193
  zfsonlinux/zfs@5aa95ba0d3502779695341b5f55fa5ba1d3330ff

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Directory Properties:
  stable/11/   (props changed)

Modified: 
stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Wed Mar  4 04:42:56 2020(r358605)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_indirect.c
Wed Mar  4 04:43:23 2020(r358606)
@@ -1222,6 +1222,8 @@ vdev_indirect_read_all(zio_t *zio)
 {
indirect_vsd_t *iv = zio->io_vsd;
 
+   ASSERT3U(zio->io_type, ==, ZIO_TYPE_READ);
+
for (indirect_split_t *is = list_head(&iv->iv_splits);
is != NULL; is = list_next(&iv->iv_splits, is)) {
for (int i = 0; i < is->is_children; i++) {
@@ -1310,7 +1312,8 @@ vdev_indirect_io_start(zio_t *zio)
vdev_indirect_child_io_done, zio));
} else {
iv->iv_split_block = B_TRUE;
-   if (zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) {
+   if (zio->io_type == ZIO_TYPE_READ &&
+   zio->io_flags & (ZIO_FLAG_SCRUB | ZIO_FLAG_RESILVER)) {
/*
 * Read all copies.  Note that for simplicity,
 * we don't bother consulting the DTL in the
@@ -1319,13 +1322,17 @@ vdev_indirect_io_start(zio_t *zio)
vdev_indirect_read_all(zio);
} else {
/*
-* Read one copy of each split segment, from the
-* top-level vdev.  Since we don't know the
-* checksum of each split individually, the child
-* zio can't ensure that we get the right data.
-* E.g. if it's a mirror, it will just read from a
-* random (healthy) leaf vdev.  We have to verify
-* the checksum in vdev_indirect_io_done().
+* If this is a read zio, we read one copy of each
+* split segment, from the top-level vdev.  Since
+* we don't know the checksum of each split
+* individually, the child zio can't ensure that
+* we get the right data. E.g. if it's a mirror,
+* it will just read from a random (healthy) leaf
+* vdev. We have to verify the checksum in
+* vdev_indirect_io_done().
+*
+* For write zios, the vdev code will ensure we write
+* to all children.
 */
for (indirect_split_t *is = list_head(&iv->iv_splits);
is != NULL; is = list_next(&iv->iv_splits, is)) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358607 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:44:08 2020
New Revision: 358607
URL: https://svnweb.freebsd.org/changeset/base/358607

Log:
  MFC r358357: MFZoL: Relax restriction on zfs_ioc_next_obj() iteration
  
  Per the documentation for dnode_next_offset in dnode.c, the "txg"
  parameter specifies a lower bound on which transaction the dnode can
  be found in. We are interested in all dnodes that are removed between
  the first and last transaction in the snapshot. It doesn't need to be
  created in that snapshot to correspond to a removed file.
  
  In fact, the behavior of zfs diff in the test case exactly matches
  this: the transaction that created the data that was deleted in snapshot
  "2" was produced before, in snapshot "1", definitely predating the first
  transaction in snapshot "2".
  
  Signed-off-by: Brian Behlendorf 
  Signed-off-by: Tim Chase 
  Closes #2081
  zfsonlinux/zfs@7290cd3c4ed19fb3f75b8133db2e36afcdd24beb

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/12/   (props changed)

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
Wed Mar  4 04:43:23 2020(r358606)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Wed Mar  4 04:44:08 2020(r358607)
@@ -5537,8 +5537,7 @@ zfs_ioc_next_obj(zfs_cmd_t *zc)
if (error != 0)
return (error);
 
-   error = dmu_object_next(os, &zc->zc_obj, B_FALSE,
-   dsl_dataset_phys(os->os_dsl_dataset)->ds_prev_snap_txg);
+   error = dmu_object_next(os, &zc->zc_obj, B_FALSE, 0);
 
dmu_objset_rele(os, FTAG);
return (error);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r358608 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2020-03-03 Thread Alexander Motin
Author: mav
Date: Wed Mar  4 04:44:33 2020
New Revision: 358608
URL: https://svnweb.freebsd.org/changeset/base/358608

Log:
  MFC r358357: MFZoL: Relax restriction on zfs_ioc_next_obj() iteration
  
  Per the documentation for dnode_next_offset in dnode.c, the "txg"
  parameter specifies a lower bound on which transaction the dnode can
  be found in. We are interested in all dnodes that are removed between
  the first and last transaction in the snapshot. It doesn't need to be
  created in that snapshot to correspond to a removed file.
  
  In fact, the behavior of zfs diff in the test case exactly matches
  this: the transaction that created the data that was deleted in snapshot
  "2" was produced before, in snapshot "1", definitely predating the first
  transaction in snapshot "2".
  
  Signed-off-by: Brian Behlendorf 
  Signed-off-by: Tim Chase 
  Closes #2081
  zfsonlinux/zfs@7290cd3c4ed19fb3f75b8133db2e36afcdd24beb

Modified:
  stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Wed Mar  4 04:44:08 2020(r358607)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Wed Mar  4 04:44:33 2020(r358608)
@@ -5481,8 +5481,7 @@ zfs_ioc_next_obj(zfs_cmd_t *zc)
if (error != 0)
return (error);
 
-   error = dmu_object_next(os, &zc->zc_obj, B_FALSE,
-   dsl_dataset_phys(os->os_dsl_dataset)->ds_prev_snap_txg);
+   error = dmu_object_next(os, &zc->zc_obj, B_FALSE, 0);
 
dmu_objset_rele(os, FTAG);
return (error);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"