FreeBSD Bugzilla – Attachment 194064 Details for
Bug 228802
[aarch64] network throughput regression in 12.0-CURRENT
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
The patch agains 12.0-CURRENT r320599
patches (text/plain), 6.73 KB, created by
Henri Hennebert
on 2018-06-07 12:05:26 UTC
(
hide
)
Description:
The patch agains 12.0-CURRENT r320599
Filename:
MIME Type:
Creator:
Henri Hennebert
Created:
2018-06-07 12:05:26 UTC
Size:
6.73 KB
patch
obsolete
>Index: sys/net/if_stf.c >=================================================================== >--- sys/net/if_stf.c (revision 320599) >+++ sys/net/if_stf.c (working copy) >@@ -378,6 +378,7 @@ > static int > stf_getsrcifa6(struct ifnet *ifp, struct in6_addr *addr, struct in6_addr *mask) > { >+ struct rm_priotracker in_ifa_tracker; > struct ifaddr *ia; > struct in_ifaddr *ia4; > struct in6_ifaddr *ia6; >@@ -393,9 +394,11 @@ > continue; > > bcopy(GET_V4(&sin6->sin6_addr), &in, sizeof(in)); >+ IN_IFADDR_RLOCK(&in_ifa_tracker); > LIST_FOREACH(ia4, INADDR_HASH(in.s_addr), ia_hash) > if (ia4->ia_addr.sin_addr.s_addr == in.s_addr) > break; >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); > if (ia4 == NULL) > continue; > >Index: sys/netgraph/ng_iface.c >=================================================================== >--- sys/netgraph/ng_iface.c (revision 320599) >+++ sys/netgraph/ng_iface.c (working copy) >@@ -64,6 +64,7 @@ > #include <sys/errno.h> > #include <sys/proc.h> > #include <sys/random.h> >+#include <sys/rmlock.h> > #include <sys/sockio.h> > #include <sys/socket.h> > #include <sys/syslog.h> >@@ -112,9 +113,15 @@ > int unit; /* Interface unit number */ > node_p node; /* Our netgraph node */ > hook_p hooks[NUM_FAMILIES]; /* Hook for each address family */ >+ struct rmlock lock; /* Protect private data changes */ > }; > typedef struct ng_iface_private *priv_p; > >+#define PRIV_RLOCK(priv, t) rm_rlock(&priv->lock, t) >+#define PRIV_RUNLOCK(priv, t) rm_runlock(&priv->lock, t) >+#define PRIV_WLOCK(priv) rm_wlock(&priv->lock) >+#define PRIV_WUNLOCK(priv) rm_wunlock(&priv->lock) >+ > /* Interface methods */ > static void ng_iface_start(struct ifnet *ifp); > static int ng_iface_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data); >@@ -431,6 +438,7 @@ > static int > ng_iface_send(struct ifnet *ifp, struct mbuf *m, sa_family_t sa) > { >+ struct rm_priotracker priv_tracker; > const priv_p priv = (priv_p) ifp->if_softc; > const iffam_p iffam = get_iffam_from_af(sa); > int error; >@@ -448,7 +456,9 @@ > > /* Send packet. If hook is not connected, mbuf will get freed. */ > NG_OUTBOUND_THREAD_REF(); >+ PRIV_RLOCK(priv, &priv_tracker); > NG_SEND_DATA_ONLY(error, *get_hook_from_iffam(priv, iffam), m); >+ PRIV_RUNLOCK(priv, &priv_tracker); > NG_OUTBOUND_THREAD_UNREF(); > > /* Update stats. */ >@@ -516,6 +526,8 @@ > return (ENOMEM); > } > >+ rm_init(&priv->lock, "ng_iface private rmlock"); >+ > /* Link them together */ > ifp->if_softc = priv; > priv->ifp = ifp; >@@ -562,16 +574,21 @@ > ng_iface_newhook(node_p node, hook_p hook, const char *name) > { > const iffam_p iffam = get_iffam_from_name(name); >+ const priv_p priv = NG_NODE_PRIVATE(node); > hook_p *hookptr; > > if (iffam == NULL) > return (EPFNOSUPPORT); >- hookptr = get_hook_from_iffam(NG_NODE_PRIVATE(node), iffam); >- if (*hookptr != NULL) >+ PRIV_WLOCK(priv); >+ hookptr = get_hook_from_iffam(priv, iffam); >+ if (*hookptr != NULL) { >+ PRIV_WUNLOCK(priv); > return (EISCONN); >+ } > *hookptr = hook; > NG_HOOK_HI_STACK(hook); > NG_HOOK_SET_TO_INBOUND(hook); >+ PRIV_WUNLOCK(priv); > return (0); > } > >@@ -730,6 +747,7 @@ > CURVNET_RESTORE(); > priv->ifp = NULL; > free_unr(V_ng_iface_unit, priv->unit); >+ rm_destroy(&priv->lock); > free(priv, M_NETGRAPH_IFACE); > NG_NODE_SET_PRIVATE(node, NULL); > NG_NODE_UNREF(node); >@@ -748,7 +766,9 @@ > > if (iffam == NULL) > panic("%s", __func__); >+ PRIV_WLOCK(priv); > *get_hook_from_iffam(priv, iffam) = NULL; >+ PRIV_WUNLOCK(priv); > return (0); > } > >Index: sys/netinet/in_mcast.c >=================================================================== >--- sys/netinet/in_mcast.c (revision 320599) >+++ sys/netinet/in_mcast.c (working copy) >@@ -1339,6 +1339,7 @@ > inp_block_unblock_source(struct inpcb *inp, struct sockopt *sopt) > { > struct group_source_req gsr; >+ struct rm_priotracker in_ifa_tracker; > sockunion_t *gsa, *ssa; > struct ifnet *ifp; > struct in_mfilter *imf; >@@ -1376,9 +1377,11 @@ > ssa->sin.sin_len = sizeof(struct sockaddr_in); > ssa->sin.sin_addr = mreqs.imr_sourceaddr; > >- if (!in_nullhost(mreqs.imr_interface)) >+ if (!in_nullhost(mreqs.imr_interface)) { >+ IN_IFADDR_RLOCK(&in_ifa_tracker); > INADDR_TO_IFP(mreqs.imr_interface, ifp); >- >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); >+ } > if (sopt->sopt_name == IP_BLOCK_SOURCE) > doblock = 1; > >@@ -1874,7 +1877,6 @@ > * > * Returns NULL if no ifp could be found. > * >- * SMPng: TODO: Acquire the appropriate locks for INADDR_TO_IFP. > * FUTURE: Implement IPv4 source-address selection. > */ > static struct ifnet * >@@ -1892,7 +1894,9 @@ > > ifp = NULL; > if (!in_nullhost(ina)) { >+ IN_IFADDR_RLOCK(&in_ifa_tracker); > INADDR_TO_IFP(ina, ifp); >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); > } else { > fibnum = inp ? inp->inp_inc.inc_fibnum : 0; > if (fib4_lookup_nh_basic(fibnum, gsin->sin_addr, 0, 0, &nh4)==0) >@@ -2224,6 +2228,7 @@ > { > struct group_source_req gsr; > struct ip_mreq_source mreqs; >+ struct rm_priotracker in_ifa_tracker; > sockunion_t *gsa, *ssa; > struct ifnet *ifp; > struct in_mfilter *imf; >@@ -2282,9 +2287,11 @@ > * XXX NOTE WELL: The RFC 3678 API is preferred because > * using an IPv4 address as a key is racy. > */ >- if (!in_nullhost(mreqs.imr_interface)) >+ if (!in_nullhost(mreqs.imr_interface)) { >+ IN_IFADDR_RLOCK(&in_ifa_tracker); > INADDR_TO_IFP(mreqs.imr_interface, ifp); >- >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); >+ } > CTR3(KTR_IGMPV3, "%s: imr_interface = 0x%08x, ifp = %p", > __func__, ntohl(mreqs.imr_interface.s_addr), ifp); > >@@ -2444,6 +2451,7 @@ > static int > inp_set_multicast_if(struct inpcb *inp, struct sockopt *sopt) > { >+ struct rm_priotracker in_ifa_tracker; > struct in_addr addr; > struct ip_mreqn mreqn; > struct ifnet *ifp; >@@ -2482,7 +2490,9 @@ > if (in_nullhost(addr)) { > ifp = NULL; > } else { >+ IN_IFADDR_RLOCK(&in_ifa_tracker); > INADDR_TO_IFP(addr, ifp); >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); > if (ifp == NULL) > return (EADDRNOTAVAIL); > } >Index: sys/netinet/ip_input.c >=================================================================== >--- sys/netinet/ip_input.c (revision 320599) >+++ sys/netinet/ip_input.c (working copy) >@@ -446,6 +446,7 @@ > void > ip_input(struct mbuf *m) > { >+ struct rm_priotracker in_ifa_tracker; > struct ip *ip = NULL; > struct in_ifaddr *ia = NULL; > struct ifaddr *ifa; >@@ -677,7 +678,7 @@ > /* > * Check for exact addresses in the hash bucket. > */ >- /* IN_IFADDR_RLOCK(); */ >+ IN_IFADDR_RLOCK(&in_ifa_tracker); > LIST_FOREACH(ia, INADDR_HASH(ip->ip_dst.s_addr), ia_hash) { > /* > * If the address matches, verify that the packet >@@ -689,11 +690,11 @@ > counter_u64_add(ia->ia_ifa.ifa_ipackets, 1); > counter_u64_add(ia->ia_ifa.ifa_ibytes, > m->m_pkthdr.len); >- /* IN_IFADDR_RUNLOCK(); */ >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); > goto ours; > } > } >- /* IN_IFADDR_RUNLOCK(); */ >+ IN_IFADDR_RUNLOCK(&in_ifa_tracker); > > /* > * Check for broadcast addresses.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 228802
: 194064 |
194068
|
194150
|
194151
|
194152
|
194153
|
194156
|
194165
|
194166
|
194167