From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 02:35:48 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AF048106566B; Sun, 3 Jun 2012 02:35:48 +0000 (UTC) (envelope-from andrew@fubar.geek.nz) Received: from mailfilter7.ihug.co.nz (mailfilter7.ihug.co.nz [203.109.136.7]) by mx1.freebsd.org (Postfix) with ESMTP id 2F6948FC08; Sun, 3 Jun 2012 02:35:48 +0000 (UTC) X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.0 c=1 a=rGYBl-LCTwoA:10 a=3+1yDqSmWr2WFEp97EHcqg==:17 a=PO7r1zJSAAAA:8 a=-UPDqFNAEabFX9p2fyoA:9 a=CjuIK1q_8ugA:10 a=eX4oHM6-uBM6bsFTGF0A:9 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAFTMyk/LbdT8/2dsb2JhbAA/BrQigQiCGAEBBAFWIwULCAMOCiMLOR4GE4gGBLVuixEmhWoDjjeGYwGJIIR8gVqCdQ X-IronPort-AV: E=Sophos;i="4.75,705,1330858800"; d="diff'?scan'208";a="194945272" Received: from 203-109-212-252.dsl.dyn.ihug.co.nz (HELO localhost) ([203.109.212.252]) by cust.filter7.content.vf.net.nz with SMTP; 03 Jun 2012 14:34:38 +1200 Date: Sun, 3 Jun 2012 14:34:05 +1200 From: Andrew Turner To: Bruce Evans Message-ID: <20120603143405.3b2fbcac@fubar.geek.nz> In-Reply-To: <20120520165107.D822@besplex.bde.org> References: <201205192351.q4JNpnAq053531@svn.freebsd.org> <20120520165107.D822@besplex.bde.org> X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.6; i386-portbld-freebsd8.0) X-Pirate: Arrrr Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/_AuLUcWMskKY0xPevRroGy0" Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r235672 - in projects/arm_eabi/sys: amd64/include i386/include ia64/include mips/include pc98/include powerpc/include sparc64/include x86/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 02:35:48 -0000 --MP_/_AuLUcWMskKY0xPevRroGy0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Sun, 20 May 2012 18:58:12 +1000 (EST) Bruce Evans wrote: > On Sat, 19 May 2012, Andrew Turner wrote: > > > Log: > > Fix wchar support in the not ARM case. > > > > * Add machine/_wchar.h to define WCHAR_{MIN,MAX} and include it > > from machine/_stdint.h, it is already in wchar.h. > > This adds 2 layers of include pessimizations to x86, though only 1 > layer to other arches. The pessimization is most noticeable over > nfs, where the RPCs for reopening include files can take 10-100 times > longer than actually reading and parsing of the files for small files. > > This has some style bugs. > > > * Add the typedef for __wchar_t to machine/_types.h. > > The limits should be defined (with leading underscores) here too, so > that no new includes are needed. How about the attached patch? It: * Removes machine/_wchar.h. * Moves the __wchar_t typedef to machine/_types.h. * Adds __WCHAR_MIN and __WCHAR_MAX to machine/_types.h and uses them where required. This is against head and only for sparc64. I will do the same on the other architectures. Andrew --MP_/_AuLUcWMskKY0xPevRroGy0 Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=sparc64_wchar.diff Index: include/wchar.h =================================================================== --- include/wchar.h (revision 234300) +++ include/wchar.h (working copy) @@ -89,8 +89,8 @@ #endif #ifndef WCHAR_MIN -#define WCHAR_MIN __INT_MIN -#define WCHAR_MAX __INT_MAX +#define WCHAR_MIN __WCHAR_MIN +#define WCHAR_MAX __WCHAR_MAX #endif #ifndef WEOF Index: sys/sparc64/include/_stdint.h =================================================================== --- sys/sparc64/include/_stdint.h (revision 234300) +++ sys/sparc64/include/_stdint.h (working copy) @@ -151,8 +151,8 @@ #ifndef WCHAR_MIN /* Also possibly defined in */ /* Limits of wchar_t. */ -#define WCHAR_MIN INT32_MIN -#define WCHAR_MAX INT32_MAX +#define WCHAR_MIN __WCHAR_MIN +#define WCHAR_MAX __WCHAR_MIN #endif /* Limits of wint_t. */ Index: sys/sparc64/include/_types.h =================================================================== --- sys/sparc64/include/_types.h (revision 234300) +++ sys/sparc64/include/_types.h (working copy) @@ -92,7 +92,11 @@ typedef __uint64_t __vm_paddr_t; typedef __uint64_t __vm_pindex_t; typedef __uint64_t __vm_size_t; +typedef int __wchar_t; +#define __WCHAR_MIN __INT_MIN +#define __WCHAR_MAX __INT_MAX + /* * Unusual type definitions. */ Index: sys/sys/_types.h =================================================================== --- sys/sys/_types.h (revision 234300) +++ sys/sys/_types.h (working copy) @@ -87,7 +87,6 @@ */ typedef int __ct_rune_t; /* arg type for ctype funcs */ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ -typedef __ct_rune_t __wchar_t; /* wchar_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ typedef __uint32_t __dev_t; /* device number */ --MP_/_AuLUcWMskKY0xPevRroGy0-- From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 05:47:43 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6EEE01065670; Sun, 3 Jun 2012 05:47:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 41AF28FC0A; Sun, 3 Jun 2012 05:47:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q535lhar037506; Sun, 3 Jun 2012 05:47:43 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q535lhc4037504; Sun, 3 Jun 2012 05:47:43 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206030547.q535lhc4037504@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 3 Jun 2012 05:47:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236499 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 05:47:43 -0000 Author: glebius Date: Sun Jun 3 05:47:42 2012 New Revision: 236499 URL: http://svn.freebsd.org/changeset/base/236499 Log: Fix !INET6 build. Modified: projects/pf/head/sys/contrib/pf/net/pf.c Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Sun Jun 3 05:36:25 2012 (r236498) +++ projects/pf/head/sys/contrib/pf/net/pf.c Sun Jun 3 05:47:42 2012 (r236499) @@ -220,6 +220,9 @@ static int pf_modulate_sack(struct mbu #ifdef INET6 static void pf_change_a6(struct pf_addr *, u_int16_t *, struct pf_addr *, u_int8_t); +static void pf_route6(struct mbuf **, struct pf_rule *, int, + struct ifnet *, struct pf_state *, + struct pf_pdesc *); #endif /* INET6 */ static void pf_change_icmp(struct pf_addr *, u_int16_t *, struct pf_addr *, struct pf_addr *, u_int16_t, @@ -275,9 +278,6 @@ static int pf_test_state_other(struct static void pf_route(struct mbuf **, struct pf_rule *, int, struct ifnet *, struct pf_state *, struct pf_pdesc *); -static void pf_route6(struct mbuf **, struct pf_rule *, int, - struct ifnet *, struct pf_state *, - struct pf_pdesc *); static u_int8_t pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); static u_int16_t pf_get_mss(struct mbuf *, int, u_int16_t, @@ -1266,21 +1266,25 @@ pf_intr(void *v) STAILQ_FOREACH_SAFE(pfse, &queue, pfse_next, next) { switch (pfse->pfse_type) { +#ifdef INET case PFSE_IP: ip_output(pfse->pfse_m, NULL, NULL, 0, NULL, NULL); break; - case PFSE_IP6: - ip6_output(pfse->pfse_m, NULL, NULL, 0, NULL, NULL, - NULL); - break; case PFSE_ICMP: icmp_error(pfse->pfse_m, pfse->pfse_icmp_type, pfse->pfse_icmp_code, 0, pfse->pfse_icmp_mtu); break; +#endif /* INET */ +#ifdef INET6 + case PFSE_IP6: + ip6_output(pfse->pfse_m, NULL, NULL, 0, NULL, NULL, + NULL); + break; case PFSE_ICMP6: icmp6_error(pfse->pfse_m, pfse->pfse_icmp_type, pfse->pfse_icmp_code, pfse->pfse_icmp_mtu); break; +#endif /* INET6 */ default: panic("%s: unknown type", __func__); } From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 11:57:06 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74D88106566C; Sun, 3 Jun 2012 11:57:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5F6638FC12; Sun, 3 Jun 2012 11:57:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53Bv6Do059652; Sun, 3 Jun 2012 11:57:06 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53Bv66A059650; Sun, 3 Jun 2012 11:57:06 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206031157.q53Bv66A059650@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 3 Jun 2012 11:57:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236512 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 11:57:06 -0000 Author: glebius Date: Sun Jun 3 11:57:05 2012 New Revision: 236512 URL: http://svn.freebsd.org/changeset/base/236512 Log: In pf_map_addr(): - Fix "rpool->cur" update in such way, that pointer never gets a NULL value, otherwise concurrent threads may try to deref NULL. - Add a large comment explaining problems with round-robin, why most cases work, and why complicated would not. - Make some local variables more local to the case blocks, where they are used. Modified: projects/pf/head/sys/contrib/pf/net/pf_lb.c Modified: projects/pf/head/sys/contrib/pf/net/pf_lb.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_lb.c Sun Jun 3 11:54:26 2012 (r236511) +++ projects/pf/head/sys/contrib/pf/net/pf_lb.c Sun Jun 3 11:57:05 2012 (r236512) @@ -350,11 +350,8 @@ int pf_map_addr(sa_family_t af, struct pf_rule *r, struct pf_addr *saddr, struct pf_addr *naddr, struct pf_addr *init_addr, struct pf_src_node **sn) { - unsigned char hash[16]; struct pf_pool *rpool = &r->rpool; - struct pf_addr *raddr = &rpool->cur->addr.v.a.addr; - struct pf_addr *rmask = &rpool->cur->addr.v.a.mask; - struct pf_pooladdr *acur = rpool->cur; + struct pf_addr *raddr = NULL, *rmask = NULL; if (*sn == NULL && r->rpool.opts & PF_POOL_STICKYADDR && (r->rpool.opts & PF_POOL_TYPEMASK) != PF_POOL_NONE) { @@ -452,10 +449,38 @@ pf_map_addr(sa_family_t af, struct pf_ru } break; case PF_POOL_SRCHASH: + { + unsigned char hash[16]; + pf_hash(saddr, (struct pf_addr *)&hash, &rpool->key, af); PF_POOLMASK(naddr, raddr, rmask, (struct pf_addr *)&hash, af); break; + } case PF_POOL_ROUNDROBIN: + { + struct pf_pooladdr *acur = rpool->cur; + + /* + * XXXGL: in the round-robin case we need to store + * the round-robin machine state in the rule, thus + * forwarding thread needs to modify rule. + * + * This is done w/o locking, because performance is assumed + * more importand than round-robin precision. + * + * In the simpliest case we just update the "rpool->cur" + * pointer. However, if pool contains tables or dynamic + * addresses, then "tblidx" is also used to store machine + * state. Since "tblidx" is int, concurrent access to it can't + * lead to inconsistence, only to lost of precision. + * + * Things get worse, if table contains not hosts, but + * prefixes. In this case counter also stores machine state, + * and for IPv6 address, counter can be updated atomically. + * Probably, using round-robin on a table containing IPv6 + * prefixes (or even IPv4) would cause a panic. + */ + if (rpool->cur->addr.type == PF_ADDR_TABLE) { if (!pfr_pool_get(rpool->cur->addr.p.tbl, &rpool->tblidx, &rpool->counter, af)) @@ -468,8 +493,10 @@ pf_map_addr(sa_family_t af, struct pf_ru goto get_addr; try_next: - if ((rpool->cur = TAILQ_NEXT(rpool->cur, entries)) == NULL) + if (TAILQ_NEXT(rpool->cur, entries) == NULL) rpool->cur = TAILQ_FIRST(&rpool->list); + else + rpool->cur = TAILQ_NEXT(rpool->cur, entries); if (rpool->cur->addr.type == PF_ADDR_TABLE) { rpool->tblidx = -1; if (pfr_pool_get(rpool->cur->addr.p.tbl, @@ -500,6 +527,7 @@ pf_map_addr(sa_family_t af, struct pf_ru PF_ACPY(init_addr, naddr, af); PF_AINC(&rpool->counter, af); break; + } } if (*sn != NULL) PF_ACPY(&(*sn)->raddr, naddr, af); From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 12:11:04 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9912B106564A; Sun, 3 Jun 2012 12:11:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 816EA8FC0A; Sun, 3 Jun 2012 12:11:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53CB4d1060351; Sun, 3 Jun 2012 12:11:04 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53CB48v060346; Sun, 3 Jun 2012 12:11:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206031211.q53CB48v060346@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 3 Jun 2012 12:11:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236513 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 12:11:04 -0000 Author: glebius Date: Sun Jun 3 12:11:03 2012 New Revision: 236513 URL: http://svn.freebsd.org/changeset/base/236513 Log: Good bye PF_LOCK(), or "the pf Giant" how I have called you. I hope, we can sustain without you. Bye! Details: - Remove PF_LOCK from forwarding paths. - Change PF_LOCK to PF_RULES_WLOCK to protect rest of data structures, that wasn't protected with separate locks before. Modified: projects/pf/head/sys/contrib/pf/net/if_pflog.c projects/pf/head/sys/contrib/pf/net/if_pfsync.c projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pfvar.h Modified: projects/pf/head/sys/contrib/pf/net/if_pflog.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pflog.c Sun Jun 3 11:57:05 2012 (r236512) +++ projects/pf/head/sys/contrib/pf/net/if_pflog.c Sun Jun 3 12:11:03 2012 (r236513) @@ -269,14 +269,14 @@ pflog_modevent(module_t mod, int type, v switch (type) { case MOD_LOAD: pflogattach(1); - PF_LOCK(); + PF_RULES_WLOCK(); pflog_packet_ptr = pflog_packet; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; case MOD_UNLOAD: - PF_LOCK(); + PF_RULES_WLOCK(); pflog_packet_ptr = NULL; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); if_clone_detach(&pflog_cloner); break; default: Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Sun Jun 3 11:57:05 2012 (r236512) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Sun Jun 3 12:11:03 2012 (r236513) @@ -629,7 +629,6 @@ pfsync_input(struct mbuf *m, __unused in pkt.src = ip->ip_src; pkt.flags = 0; - PF_LOCK(); /* * Trusting pf_chksum during packet processing, as well as seeking * in interface name tree, require holding PF_RULES_RLOCK(). @@ -646,7 +645,6 @@ pfsync_input(struct mbuf *m, __unused in if (subh.action >= PFSYNC_ACT_MAX) { V_pfsyncstats.pfsyncs_badact++; PF_RULES_RUNLOCK(); - PF_UNLOCK(); goto done; } @@ -655,14 +653,12 @@ pfsync_input(struct mbuf *m, __unused in rv = (*pfsync_acts[subh.action])(&pkt, m, offset, count); if (rv == -1) { PF_RULES_RUNLOCK(); - PF_UNLOCK(); return; } offset += rv; } PF_RULES_RUNLOCK(); - PF_UNLOCK(); done: m_freem(m); @@ -1290,12 +1286,10 @@ pfsyncioctl(struct ifnet *ifp, u_long cm ifr->ifr_mtu > sc->sc_sync_if->if_mtu) return (EINVAL); if (ifr->ifr_mtu < ifp->if_mtu) { - PF_LOCK(); PFSYNC_LOCK(sc); if (sc->sc_len > PFSYNC_MINPKT) pfsync_sendout(1); PFSYNC_UNLOCK(sc); - PF_UNLOCK(); } ifp->if_mtu = ifr->ifr_mtu; break; @@ -1336,7 +1330,6 @@ pfsyncioctl(struct ifnet *ifp, u_long cm mship = malloc((sizeof(struct in_multi *) * IP_MIN_MEMBERSHIPS), M_PFSYNC, M_WAITOK | M_ZERO); - PF_LOCK(); PFSYNC_LOCK(sc); if (pfsyncr.pfsyncr_syncpeer.s_addr == 0) sc->sc_sync_peer.s_addr = htonl(INADDR_PFSYNC_GROUP); @@ -1360,7 +1353,6 @@ pfsyncioctl(struct ifnet *ifp, u_long cm if (imo->imo_membership) pfsync_multicast_cleanup(sc); PFSYNC_UNLOCK(sc); - PF_UNLOCK(); free(mship, M_PFSYNC); break; } @@ -1408,7 +1400,6 @@ pfsyncioctl(struct ifnet *ifp, u_long cm printf("pfsync: requesting bulk update\n"); pfsync_request_update(0, 0); PFSYNC_UNLOCK(sc); - PF_UNLOCK(); PFSYNC_BLOCK(sc); sc->sc_ureq_sent = time_uptime; callout_reset(&sc->sc_bulkfail_tmo, 5 * hz, pfsync_bulk_fail, @@ -1919,8 +1910,6 @@ pfsync_delete_state(struct pf_state *st) struct pfsync_softc *sc = V_pfsyncif; int schedswi = 0; - PF_LOCK_ASSERT(); - PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_ACK) pfsync_undefer_state(st, 1); @@ -1968,8 +1957,6 @@ pfsync_clear_states(u_int32_t creatorid, struct pfsync_clr clr; } __packed r; - PF_LOCK_ASSERT(); - bzero(&r, sizeof(r)); r.subh.action = PFSYNC_ACT_CLR; @@ -2039,7 +2026,6 @@ pfsync_bulk_start(void) if (V_pf_status.debug >= PF_DEBUG_MISC) printf("pfsync: received bulk update request\n"); - PF_LOCK_ASSERT(); PFSYNC_BLOCK(sc); sc->sc_ureq_received = time_uptime; @@ -2057,7 +2043,6 @@ pfsync_bulk_update(void *arg) struct pf_state *s; int i, sent = 0; - PF_LOCK_ASSERT(); PFSYNC_BLOCK_ASSERT(sc); CURVNET_SET(sc->sc_ifp->if_vnet); @@ -2126,8 +2111,6 @@ pfsync_bulk_status(u_int8_t status) struct pfsync_softc *sc = V_pfsyncif; - PF_LOCK_ASSERT(); - bzero(&r, sizeof(r)); r.subh.action = PFSYNC_ACT_BUS; @@ -2181,7 +2164,6 @@ pfsync_send_plus(void *plus, size_t plus { struct pfsync_softc *sc = V_pfsyncif; - PF_LOCK_ASSERT(); PFSYNC_LOCK_ASSERT(sc); if (sc->sc_len + pluslen > sc->sc_ifp->if_mtu) @@ -2310,14 +2292,14 @@ pfsync_init() goto fail; } #endif - PF_LOCK(); + PF_RULES_WLOCK(); pfsync_state_import_ptr = pfsync_state_import; pfsync_insert_state_ptr = pfsync_insert_state; pfsync_update_state_ptr = pfsync_update_state; pfsync_delete_state_ptr = pfsync_delete_state; pfsync_clear_states_ptr = pfsync_clear_states; pfsync_defer_ptr = pfsync_defer; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); return (0); Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Sun Jun 3 11:57:05 2012 (r236512) +++ projects/pf/head/sys/contrib/pf/net/pf.c Sun Jun 3 12:11:03 2012 (r236513) @@ -1304,14 +1304,11 @@ pf_purge_thread(void *v) for (;;) { tsleep(pf_purge_thread, PWAIT, "pftm", hz / 10); - PF_LOCK(); - if (V_pf_end_threads) { pf_purge_expired_states(V_pf_hashmask + 1); pf_purge_expired_fragments(); pf_purge_expired_src_nodes(); V_pf_end_threads++; - PF_UNLOCK(); wakeup(pf_purge_thread); kproc_exit(0); } @@ -1332,8 +1329,6 @@ pf_purge_thread(void *v) pf_purge_unlinked_rules(); pfi_kif_purge(); } - - PF_UNLOCK(); } /* not reached */ CURVNET_RESTORE(); @@ -2635,7 +2630,6 @@ pf_socket_lookup(int direction, struct p saddr = pd->dst; daddr = pd->src; } - PF_UNLOCK(); switch (pd->af) { #ifdef INET case AF_INET: @@ -2679,7 +2673,7 @@ pf_socket_lookup(int direction, struct p pd->lookup.uid = inp->inp_cred->cr_uid; pd->lookup.gid = inp->inp_cred->cr_groups[0]; INP_RUNLOCK(inp); - PF_LOCK(); + return (1); } @@ -5101,14 +5095,12 @@ pf_route(struct mbuf **m, struct pf_rule if ((m0 = m_dup(*m, M_NOWAIT)) == NULL) { if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); return; } } else { if ((r->rt == PF_REPLYTO) == (r->direction == dir)) { if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); return; } m0 = *m; @@ -5126,7 +5118,6 @@ pf_route(struct mbuf **m, struct pf_rule if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); rt = rtalloc1_fib(sintosa(&dst), 0, 0, M_GETFIB(m0)); if (rt == NULL) { RTFREE_LOCKED(rt); @@ -5154,14 +5145,12 @@ pf_route(struct mbuf **m, struct pf_rule dst.sin_addr.s_addr = naddr.v4.s_addr; ifp = r->rpool.cur->kif ? r->rpool.cur->kif->pfik_ifp : NULL; - PF_UNLOCK(); } else { if (!PF_AZERO(&s->rt_addr, AF_INET)) dst.sin_addr.s_addr = s->rt_addr.v4.s_addr; ifp = s->rt_kif ? s->rt_kif->pfik_ifp : NULL; PF_STATE_UNLOCK(s); - PF_UNLOCK(); } } if (ifp == NULL) @@ -5256,7 +5245,6 @@ done: bad_locked: if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); bad: m_freem(m0); goto done; @@ -5289,14 +5277,12 @@ pf_route6(struct mbuf **m, struct pf_rul if ((m0 = m_dup(*m, M_NOWAIT)) == NULL) { if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); return; } } else { if ((r->rt == PF_REPLYTO) == (r->direction == dir)) { if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); return; } m0 = *m; @@ -5313,7 +5299,6 @@ pf_route6(struct mbuf **m, struct pf_rul if (r->rt == PF_FASTROUTE) { if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); m0->m_flags |= M_SKIP_FIREWALL; ip6_output(m0, NULL, NULL, 0, NULL, NULL, NULL); return; @@ -5340,7 +5325,6 @@ pf_route6(struct mbuf **m, struct pf_rul if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); if (ifp == NULL) goto bad; @@ -5386,7 +5370,6 @@ done: bad_locked: if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); bad: m_freem(m0); goto done; @@ -5571,11 +5554,9 @@ pf_test(int dir, struct ifnet *ifp, stru action = PF_DROP; REASON_SET(&reason, PFRES_SHORT); log = 1; - PF_LOCK(); goto done; } - PF_LOCK(); PF_RULES_RLOCK(); if (ip_divert_ptr != NULL && @@ -5786,7 +5767,6 @@ done: if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); m_tag_prepend(m, ipfwtag); if (m->m_flags & M_FASTFWD_OURS) { @@ -5884,7 +5864,6 @@ done: } if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); return (action); } @@ -5932,11 +5911,9 @@ pf_test6(int dir, struct ifnet *ifp, str action = PF_DROP; REASON_SET(&reason, PFRES_SHORT); log = 1; - PF_LOCK(); goto done; } - PF_LOCK(); PF_RULES_RLOCK(); /* We do IP header normalization and packet reassembly here */ @@ -6268,7 +6245,7 @@ done: if (s) PF_STATE_UNLOCK(s); - PF_UNLOCK(); + return (action); } #endif /* INET6 */ Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Sun Jun 3 11:57:05 2012 (r236512) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Sun Jun 3 12:11:03 2012 (r236513) @@ -212,7 +212,6 @@ static volatile VNET_DEFINE(int, pf_pfil #define V_pf_pfil_hooked VNET(pf_pfil_hooked) VNET_DEFINE(int, pf_end_threads); -struct mtx pf_mtx; struct rwlock pf_rules_lock; /* pfsync */ @@ -231,7 +230,6 @@ static void init_pf_mutex(void) { - mtx_init(&pf_mtx, "pf Giant", NULL, MTX_DEF); rw_init(&pf_rules_lock, "pf rulesets"); sx_init(&V_pf_consistency_lock, "pfioctl"); } @@ -240,7 +238,6 @@ static void destroy_pf_mutex(void) { - mtx_destroy(&pf_mtx); rw_destroy(&pf_rules_lock); sx_destroy(&V_pf_consistency_lock); } @@ -1121,21 +1118,20 @@ pfioctl(struct cdev *dev, u_long cmd, ca switch (cmd) { case DIOCSTART: - PF_LOCK(); + PF_RULES_WLOCK(); if (V_pf_status.running) error = EEXIST; else { int cpu; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); error = hook_pf(); - PF_LOCK(); if (error) { DPFPRINTF(PF_DEBUG_MISC, - ("pf: pfil registeration fail\n")); - PF_UNLOCK(); + ("pf: pfil registration failed\n")); break; } + PF_RULES_WLOCK(); V_pf_status.running = 1; V_pf_status.since = time_second; @@ -1144,27 +1140,27 @@ pfioctl(struct cdev *dev, u_long cmd, ca DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n")); } - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; case DIOCSTOP: - PF_LOCK(); + PF_RULES_WLOCK(); if (!V_pf_status.running) error = ENOENT; else { V_pf_status.running = 0; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); error = dehook_pf(); - PF_LOCK(); if (error) { V_pf_status.running = 1; DPFPRINTF(PF_DEBUG_MISC, - ("pf: pfil unregisteration failed\n")); + ("pf: pfil unregistration failed\n")); } + PF_RULES_WLOCK(); V_pf_status.since = time_second; DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; case DIOCADDRULE: { @@ -1633,7 +1629,6 @@ DIOCCHANGERULE_error: struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr; u_int i, killed = 0; - PF_LOCK(); for (i = 0; i <= V_pf_hashmask; i++) { struct pf_idhash *ih = &V_pf_idhash[i]; @@ -1657,7 +1652,6 @@ relock_DIOCCLRSTATES: psk->psk_killed = killed; if (pfsync_clear_states_ptr != NULL) pfsync_clear_states_ptr(V_pf_status.hostid, psk->psk_ifname); - PF_UNLOCK(); break; } @@ -1669,7 +1663,6 @@ relock_DIOCCLRSTATES: struct pfioc_state_kill *psk = (struct pfioc_state_kill *)addr; u_int i, killed = 0; - PF_LOCK(); if (psk->psk_pfcmp.id) { if (psk->psk_pfcmp.creatorid == 0) psk->psk_pfcmp.creatorid = V_pf_status.hostid; @@ -1678,7 +1671,6 @@ relock_DIOCCLRSTATES: pf_unlink_state(s, PF_ENTER_LOCKED); psk->psk_killed = 1; } - PF_UNLOCK(); break; } @@ -1734,7 +1726,6 @@ relock_DIOCKILLSTATES: } PF_HASHROW_UNLOCK(ih); } - PF_UNLOCK(); psk->psk_killed = killed; break; } @@ -1761,17 +1752,14 @@ relock_DIOCKILLSTATES: struct pfioc_state *ps = (struct pfioc_state *)addr; struct pf_state *s; - PF_LOCK(); s = pf_find_state_byid(ps->state.id, ps->state.creatorid); if (s == NULL) { - PF_UNLOCK(); error = ENOENT; break; } pfsync_state_export(&ps->state, s); PF_STATE_UNLOCK(s); - PF_UNLOCK(); break; } @@ -1824,36 +1812,35 @@ DIOCGETSTATES_full: case DIOCGETSTATUS: { struct pf_status *s = (struct pf_status *)addr; - PF_LOCK(); + PF_RULES_RLOCK(); bcopy(&V_pf_status, s, sizeof(struct pf_status)); pfi_update_status(s->ifname, s); - PF_UNLOCK(); + PF_RULES_RUNLOCK(); break; } case DIOCSETSTATUSIF: { struct pfioc_if *pi = (struct pfioc_if *)addr; - PF_LOCK(); if (pi->ifname[0] == 0) { bzero(V_pf_status.ifname, IFNAMSIZ); - PF_UNLOCK(); break; } + PF_RULES_WLOCK(); strlcpy(V_pf_status.ifname, pi->ifname, IFNAMSIZ); - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; } case DIOCCLRSTATUS: { - PF_LOCK(); + PF_RULES_WLOCK(); bzero(V_pf_status.counters, sizeof(V_pf_status.counters)); bzero(V_pf_status.fcounters, sizeof(V_pf_status.fcounters)); bzero(V_pf_status.scounters, sizeof(V_pf_status.scounters)); V_pf_status.since = time_second; if (*V_pf_status.ifname) pfi_update_status(V_pf_status.ifname, NULL); - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; } @@ -1865,7 +1852,6 @@ DIOCGETSTATES_full: int m = 0, direction = pnl->direction; int sidx, didx; - PF_LOCK(); /* NATLOOK src and dst are reversed, so reverse sidx/didx */ sidx = (direction == PF_IN) ? 1 : 0; didx = (direction == PF_IN) ? 0 : 1; @@ -1899,7 +1885,6 @@ DIOCGETSTATES_full: } else error = ENOENT; } - PF_UNLOCK(); break; } @@ -1912,7 +1897,7 @@ DIOCGETSTATES_full: error = EINVAL; break; } - PF_LOCK(); + PF_RULES_WLOCK(); old = V_pf_default_rule.timeout[pt->timeout]; if (pt->timeout == PFTM_INTERVAL && pt->seconds == 0) pt->seconds = 1; @@ -1920,7 +1905,7 @@ DIOCGETSTATES_full: if (pt->timeout == PFTM_INTERVAL && pt->seconds < old) wakeup(pf_purge_thread); pt->seconds = old; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; } @@ -1931,7 +1916,9 @@ DIOCGETSTATES_full: error = EINVAL; break; } + PF_RULES_RLOCK(); pt->seconds = V_pf_default_rule.timeout[pt->timeout]; + PF_RULES_RUNLOCK(); break; } @@ -1942,7 +1929,9 @@ DIOCGETSTATES_full: error = EINVAL; break; } + PF_RULES_RLOCK(); pl->limit = V_pf_limits[pl->index].limit; + PF_RULES_RUNLOCK(); break; } @@ -1950,10 +1939,10 @@ DIOCGETSTATES_full: struct pfioc_limit *pl = (struct pfioc_limit *)addr; int old_limit; - PF_LOCK(); + PF_RULES_WLOCK(); if (pl->index < 0 || pl->index >= PF_LIMIT_MAX || V_pf_limits[pl->index].zone == NULL) { - PF_UNLOCK(); + PF_RULES_WUNLOCK(); error = EINVAL; break; } @@ -1961,14 +1950,16 @@ DIOCGETSTATES_full: old_limit = V_pf_limits[pl->index].limit; V_pf_limits[pl->index].limit = pl->limit; pl->limit = old_limit; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; } case DIOCSETDEBUG: { u_int32_t *level = (u_int32_t *)addr; + PF_RULES_WLOCK(); V_pf_status.debug = *level; + PF_RULES_WUNLOCK(); break; } @@ -2874,17 +2865,17 @@ DIOCCHANGEADDR_error: case DIOCOSFPADD: { struct pf_osfp_ioctl *io = (struct pf_osfp_ioctl *)addr; - PF_LOCK(); + PF_RULES_WLOCK(); error = pf_osfp_add(io); - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; } case DIOCOSFPGET: { struct pf_osfp_ioctl *io = (struct pf_osfp_ioctl *)addr; - PF_LOCK(); + PF_RULES_RLOCK(); error = pf_osfp_get(io); - PF_UNLOCK(); + PF_RULES_RUNLOCK(); break; } @@ -3194,11 +3185,9 @@ DIOCCHANGEADDR_error: case DIOCCLRSRCNODES: { - PF_LOCK(); pf_clear_srcnodes(NULL); pf_purge_expired_src_nodes(); V_pf_status.src_nodes = 0; - PF_UNLOCK(); break; } @@ -3245,19 +3234,19 @@ DIOCCHANGEADDR_error: case DIOCSETHOSTID: { u_int32_t *hostid = (u_int32_t *)addr; - PF_LOCK(); + PF_RULES_WLOCK(); if (*hostid == 0) V_pf_status.hostid = arc4random(); else V_pf_status.hostid = *hostid; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; } case DIOCOSFPFLUSH: - PF_LOCK(); + PF_RULES_WLOCK(); pf_osfp_flush(); - PF_UNLOCK(); + PF_RULES_WUNLOCK(); break; case DIOCIGETIFACES: { @@ -3676,8 +3665,6 @@ hook_pf(void) struct pfil_head *pfh_inet6; #endif - PF_UNLOCK_ASSERT(); - if (V_pf_pfil_hooked) return (0); @@ -3717,8 +3704,6 @@ dehook_pf(void) struct pfil_head *pfh_inet6; #endif - PF_UNLOCK_ASSERT(); - if (V_pf_pfil_hooked == 0) return (0); @@ -3790,9 +3775,9 @@ pf_unload(void) { int error = 0; - PF_LOCK(); + PF_RULES_WLOCK(); V_pf_status.running = 0; - PF_UNLOCK(); + PF_RULES_WUNLOCK(); m_addr_chg_pf_p = NULL; swi_remove(V_pf_swi_cookie); error = dehook_pf(); @@ -3805,19 +3790,19 @@ pf_unload(void) printf("%s : pfil unregisteration fail\n", __FUNCTION__); return error; } - PF_LOCK(); + PF_RULES_WLOCK(); shutdown_pf(); V_pf_end_threads = 1; while (V_pf_end_threads < 2) { wakeup_one(pf_purge_thread); - msleep(pf_purge_thread, &pf_mtx, 0, "pftmo", hz); + tsleep(pf_purge_thread, PWAIT, "pftmo", hz); } pf_normalize_cleanup(); pfi_cleanup(); pf_osfp_flush(); pf_osfp_cleanup(); pf_cleanup(); - PF_UNLOCK(); + PF_RULES_WUNLOCK(); destroy_dev(pf_dev); destroy_pf_mutex(); Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Sun Jun 3 11:57:05 2012 (r236512) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Sun Jun 3 12:11:03 2012 (r236513) @@ -198,12 +198,6 @@ struct pfi_dynaddr { #define PF_NAME "pf" -extern struct mtx pf_mtx; -#define PF_LOCK_ASSERT() mtx_assert(&pf_mtx, MA_OWNED) -#define PF_UNLOCK_ASSERT() mtx_assert(&pf_mtx, MA_NOTOWNED) -#define PF_LOCK() mtx_lock(&pf_mtx) -#define PF_UNLOCK() mtx_unlock(&pf_mtx) - #define PF_HASHROW_ASSERT(h) mtx_assert(&(h)->lock, MA_OWNED) #define PF_HASHROW_LOCK(h) mtx_lock(&(h)->lock) #define PF_HASHROW_UNLOCK(h) mtx_unlock(&(h)->lock) From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 12:24:15 2012 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFE4C1065670; Sun, 3 Jun 2012 12:24:15 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail07.syd.optusnet.com.au (mail07.syd.optusnet.com.au [211.29.132.188]) by mx1.freebsd.org (Postfix) with ESMTP id E94628FC12; Sun, 3 Jun 2012 12:24:14 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail07.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q53COB7B001596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 3 Jun 2012 22:24:12 +1000 Date: Sun, 3 Jun 2012 22:24:11 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andrew Turner In-Reply-To: <20120603143405.3b2fbcac@fubar.geek.nz> Message-ID: <20120603211449.B856@besplex.bde.org> References: <201205192351.q4JNpnAq053531@svn.freebsd.org> <20120520165107.D822@besplex.bde.org> <20120603143405.3b2fbcac@fubar.geek.nz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org, Bruce Evans Subject: Re: svn commit: r235672 - in projects/arm_eabi/sys: amd64/include i386/include ia64/include mips/include pc98/include powerpc/include sparc64/include x86/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 12:24:15 -0000 On Sun, 3 Jun 2012, Andrew Turner wrote: > On Sun, 20 May 2012 18:58:12 +1000 (EST) > Bruce Evans wrote: > >> On Sat, 19 May 2012, Andrew Turner wrote: >> >>> Log: >>> Fix wchar support in the not ARM case. >>> >>> * Add machine/_wchar.h to define WCHAR_{MIN,MAX} and include it >>> from machine/_stdint.h, it is already in wchar.h. >> >> This adds 2 layers of include pessimizations to x86, though only 1 >> layer to other arches. The pessimization is most noticeable over >> nfs, where the RPCs for reopening include files can take 10-100 times >> longer than actually reading and parsing of the files for small files. >> >> This has some style bugs. >> >>> * Add the typedef for __wchar_t to machine/_types.h. >> >> The limits should be defined (with leading underscores) here too, so >> that no new includes are needed. > > How about the attached patch? It: > * Removes machine/_wchar.h. I think this is for the non-project version that doesn't have machine/_wchar.h. I forget some of the details of that. > * Moves the __wchar_t typedef to machine/_types.h. > * Adds __WCHAR_MIN and __WCHAR_MAX to machine/_types.h and uses them where required. > > This is against head and only for sparc64. I will do the same on the > other architectures. % Index: include/wchar.h % ... OK. % Index: sys/sparc64/include/_stdint.h % =================================================================== % --- sys/sparc64/include/_stdint.h (revision 234300) % +++ sys/sparc64/include/_stdint.h (working copy) % @@ -151,8 +151,8 @@ % % #ifndef WCHAR_MIN /* Also possibly defined in */ % /* Limits of wchar_t. */ % -#define WCHAR_MIN INT32_MIN % -#define WCHAR_MAX INT32_MAX % +#define WCHAR_MIN __WCHAR_MIN % +#define WCHAR_MAX __WCHAR_MIN % #endif I hope this can be moved up to sys/stdint.h. The ifdef is bogus, since it only breaks detection of bugs if the macros are defined (lexically) differently. Its comment is not quite right, since the macros are always defined in . What it is trying to say is that both definitions would be visible if and are both included and we didn't bogusly ifdef them. In fact, we are hiding bugs with the ifdefs. The macros are defined as INT_MIN/MAX in but as INT32_MIN/MAX in all versions of FreeBSD that I checked. It's interesting that FreeBSD didn't have them anywhere until 2003, so they weren't in FreeBSD[3-4]. % % /* Limits of wint_t. */ WINT_* doesn't need the same treatment eventually like I said in my previous reply, since it is not required in . There is no benefit to moving it like the above. There is on a similar, but smaller problem for wint_t. % Index: sys/sparc64/include/_types.h % =================================================================== % --- sys/sparc64/include/_types.h (revision 234300) % +++ sys/sparc64/include/_types.h (working copy) % @@ -92,7 +92,11 @@ % typedef __uint64_t __vm_paddr_t; % typedef __uint64_t __vm_pindex_t; % typedef __uint64_t __vm_size_t; % +typedef int __wchar_t; Shouldn't it be __ct_rune_t? Oops, that is not in scope. I think you should declare it as __int32_t, and similarly for the macros. I don't really like that, and originally I tried to use basic types wherever possibly in , but now almost everything in at least is declared using a derived integral type. The main exception is clock_t, and it is extremely broken. I changed it long ago on i386 from u_int to u_long to prepare for natural expansion with 64-bit longs, but it has rotted to become even smaller than u_int on most arches: - arm: __uint32_t - ia32: __int32_t - mips: __int32_t - powerpc: __uint32_t - sparc64: __int32_t - x86::amd64: __int32_t (requires an ifdef tangle to properly break it) - x86::i386: unsigned long (causes minor ABI problems; not rotted) % % +#define __WCHAR_MIN __INT_MIN % +#define __WCHAR_MAX __INT_MAX % + There are no macros for the limits of rune_t, and they might not apply anyway (see below), so rawer type-related info like this is correct here. % /* % * Unusual type definitions. % */ % Index: sys/sys/_types.h % =================================================================== % --- sys/sys/_types.h (revision 234300) % +++ sys/sys/_types.h (working copy) % @@ -87,7 +87,6 @@ % */ % typedef int __ct_rune_t; /* arg type for ctype funcs */ % typedef __ct_rune_t __rune_t; /* rune_t (see above) */ % -typedef __ct_rune_t __wchar_t; /* wchar_t (see above) */ "above" still describes wchar_t and has a strict requirement: @ * NOTE: rune_t is not covered by ANSI nor other standards, and should not @ * be instantiated outside of lib/libc/locale. Use wchar_t. wchar_t and @ * rune_t must be the same type. Also, wint_t must be no narrower than ^^^^ @ * wchar_t, and should be able to hold all members of the largest @ * character set plus one extra value (WEOF), and must be at least 16 bits. If you are changing wchar_t to either larger or smaller, then you need to at least fix the comment. Changing wchar_t seems to be hard, since apart from ABI problems, someone may have actually read this comment and used wchar_t where they really want rune_t. If this comment is correct, wchar_t can't be made much smaller without breaking rune_t for other uses, and if it is enlarged then rune_t must be enlarged to match, giving more ABI problems. C99 requires WCHAR_MIN/MAX to be the min/max values representable by wchar_t, but doesn't require wchar_t to be as small as possible. % typedef __ct_rune_t __wint_t; /* wint_t (see above) */ % % typedef __uint32_t __dev_t; /* device number */ Bruce From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 19:25:49 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 348031065751; Sun, 3 Jun 2012 19:25:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F12D8FC0A; Sun, 3 Jun 2012 19:25:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53JPmOi080063; Sun, 3 Jun 2012 19:25:48 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53JPms8080061; Sun, 3 Jun 2012 19:25:48 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206031925.q53JPms8080061@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 3 Jun 2012 19:25:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236525 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 19:25:49 -0000 Author: glebius Date: Sun Jun 3 19:25:48 2012 New Revision: 236525 URL: http://svn.freebsd.org/changeset/base/236525 Log: Return back pfsync_timeout(), that I've removed in r234056. pfsync_timeout() is needed to perform a delayed swi_sched(). Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Sun Jun 3 18:34:32 2012 (r236524) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Sun Jun 3 19:25:48 2012 (r236525) @@ -205,6 +205,7 @@ struct pfsync_softc { #define PFSYNCF_DEFER 0x00000002 uint8_t sc_maxupdates; struct ip sc_template; + struct callout sc_tmo; struct mtx sc_mtx; /* Queued data */ @@ -246,6 +247,7 @@ static VNET_DEFINE(struct pfsyncstats, p static VNET_DEFINE(int, pfsync_carp_adj) = CARP_MAXSKEW; #define V_pfsync_carp_adj VNET(pfsync_carp_adj) +static void pfsync_timeout(void *); static void pfsyncintr(void *); static int pfsync_multicast_setup(struct pfsync_softc *, struct ifnet *, void *); @@ -334,6 +336,7 @@ pfsync_clone_create(struct if_clone *ifc ifp->if_mtu = ETHERMTU; mtx_init(&sc->sc_mtx, "pfsync", NULL, MTX_DEF); mtx_init(&sc->sc_bulk_mtx, "pfsync bulk", NULL, MTX_DEF); + callout_init(&sc->sc_tmo, CALLOUT_MPSAFE); callout_init_mtx(&sc->sc_bulk_tmo, &sc->sc_bulk_mtx, 0); callout_init_mtx(&sc->sc_bulkfail_tmo, &sc->sc_bulk_mtx, 0); @@ -376,6 +379,7 @@ relock: } } + callout_drain(&sc->sc_tmo); callout_drain(&sc->sc_bulkfail_tmo); callout_drain(&sc->sc_bulk_tmo); @@ -1662,7 +1666,7 @@ pfsync_insert_state(struct pf_state *st) PFSYNC_LOCK(sc); if (sc->sc_len == PFSYNC_MINPKT) - swi_sched(V_pfsync_swi_cookie, 0); + callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); pfsync_q_ins(st, PFSYNC_S_INS); PFSYNC_UNLOCK(sc); @@ -1800,7 +1804,7 @@ pfsync_update_state(struct pf_state *st) } if (sc->sc_len == PFSYNC_MINPKT) - sync = 1; + callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); switch (st->sync_state) { case PFSYNC_S_UPD_C: @@ -1908,7 +1912,6 @@ static void pfsync_delete_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; - int schedswi = 0; PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_ACK) @@ -1921,7 +1924,7 @@ pfsync_delete_state(struct pf_state *st) } if (sc->sc_len == PFSYNC_MINPKT) - schedswi = 1; + callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); switch (st->sync_state) { case PFSYNC_S_INS: @@ -1943,9 +1946,6 @@ pfsync_delete_state(struct pf_state *st) panic("%s: unexpected sync state %d", __func__, st->sync_state); } PFSYNC_UNLOCK(sc); - - if (schedswi) - swi_sched(V_pfsync_swi_cookie, 0); } static void @@ -2175,6 +2175,18 @@ pfsync_send_plus(void *plus, size_t plus pfsync_sendout(1); } +static void +pfsync_timeout(void *arg) +{ +#ifdef VIMAGE + struct pfsync_softc *sc = arg; +#endif + + CURVNET_SET(sc->sc_ifp->if_vnet); + swi_sched(V_pfsync_swi_cookie, 0); + CURVNET_RESTORE(); +} + /* this is a softnet/netisr handler */ static void pfsyncintr(void *arg) @@ -2338,8 +2350,8 @@ pfsync_uninit() VNET_LIST_RLOCK(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - swi_remove(V_pfsync_swi_cookie); if_clone_detach(&V_pfsync_cloner); + swi_remove(V_pfsync_swi_cookie); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK(); From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 20:07:38 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 852021065672; Sun, 3 Jun 2012 20:07:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 703D48FC12; Sun, 3 Jun 2012 20:07:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53K7caR081954; Sun, 3 Jun 2012 20:07:38 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53K7cok081952; Sun, 3 Jun 2012 20:07:38 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206032007.q53K7cok081952@svn.freebsd.org> From: Gleb Smirnoff Date: Sun, 3 Jun 2012 20:07:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236526 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 20:07:38 -0000 Author: glebius Date: Sun Jun 3 20:07:37 2012 New Revision: 236526 URL: http://svn.freebsd.org/changeset/base/236526 Log: pfsync_sendout() is usually called when softc has accumulated enough data to send a packet, and now is being requested to add data that would overflow a packet. Thus, swi scheduled at the end of pfsync_sendout() is going to service not a single packet, but a couple of them, and the second one is containg only one piece of pfsync data. This leads to coupling of pfsync pps: every odd packet is full-sized and every even is undersized. To fix this, a flag is added to softc - PFSYNCF_PUSH, which indicates, whether we swi handler needs to sqeeze data from the softc prior to sending packets. In all cases when we need to send data immidiately, this flags is raised prioir to swi_sched(). But in case of usual sc_len overflow, it isn't raised. Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Sun Jun 3 19:25:48 2012 (r236525) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Sun Jun 3 20:07:37 2012 (r236526) @@ -203,6 +203,7 @@ struct pfsync_softc { uint32_t sc_flags; #define PFSYNCF_OK 0x00000001 #define PFSYNCF_DEFER 0x00000002 +#define PFSYNCF_PUSH 0x00000004 uint8_t sc_maxupdates; struct ip sc_template; struct callout sc_tmo; @@ -248,6 +249,7 @@ static VNET_DEFINE(int, pfsync_carp_adj) #define V_pfsync_carp_adj VNET(pfsync_carp_adj) static void pfsync_timeout(void *); +static void pfsync_push(struct pfsync_softc *); static void pfsyncintr(void *); static int pfsync_multicast_setup(struct pfsync_softc *, struct ifnet *, void *); @@ -417,6 +419,7 @@ pfsync_alloc_scrub_memory(struct pfsync_ static int pfsync_state_import(struct pfsync_state *sp, u_int8_t flags) { + struct pfsync_softc *sc = V_pfsyncif; struct pf_state *st = NULL; struct pf_state_key *skw = NULL, *sks = NULL; struct pf_rule *r = NULL; @@ -546,7 +549,7 @@ pfsync_state_import(struct pfsync_state st->state_flags &= ~PFSTATE_NOSYNC; if (st->state_flags & PFSTATE_ACK) { pfsync_q_ins(st, PFSYNC_S_IACK); - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); } } st->state_flags &= ~PFSTATE_ACK; @@ -826,6 +829,7 @@ pfsync_upd_tcp(struct pf_state *st, stru static int pfsync_in_upd(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { + struct pfsync_softc *sc = V_pfsyncif; struct pfsync_state *sa, *sp; struct pf_state_key *sk; struct pf_state *st; @@ -866,9 +870,9 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st } if (st->state_flags & PFSTATE_ACK) { - PFSYNC_LOCK(V_pfsyncif); + PFSYNC_LOCK(sc); pfsync_undefer_state(st, 1); - PFSYNC_UNLOCK(V_pfsyncif); + PFSYNC_UNLOCK(sc); } sk = st->key[PF_SK_WIRE]; /* XXX right one? */ @@ -898,7 +902,9 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st pfsync_update_state(st); PF_STATE_UNLOCK(st); - swi_sched(V_pfsync_swi_cookie, 0); + PFSYNC_LOCK(sc); + pfsync_push(sc); + PFSYNC_UNLOCK(sc); continue; } pfsync_alloc_scrub_memory(&sp->dst, &st->dst); @@ -916,6 +922,7 @@ pfsync_in_upd(struct pfsync_pkt *pkt, st static int pfsync_in_upd_c(struct pfsync_pkt *pkt, struct mbuf *m, int offset, int count) { + struct pfsync_softc *sc = V_pfsyncif; struct pfsync_upd_c *ua, *up; struct pf_state_key *sk; struct pf_state *st; @@ -952,16 +959,16 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, st = pf_find_state_byid(up->id, up->creatorid); if (st == NULL) { /* We don't have this state. Ask for it. */ - PFSYNC_LOCK(V_pfsyncif); + PFSYNC_LOCK(sc); pfsync_request_update(up->creatorid, up->id); - PFSYNC_UNLOCK(V_pfsyncif); + PFSYNC_UNLOCK(sc); continue; } if (st->state_flags & PFSTATE_ACK) { - PFSYNC_LOCK(V_pfsyncif); + PFSYNC_LOCK(sc); pfsync_undefer_state(st, 1); - PFSYNC_UNLOCK(V_pfsyncif); + PFSYNC_UNLOCK(sc); } sk = st->key[PF_SK_WIRE]; /* XXX right one? */ @@ -990,7 +997,9 @@ pfsync_in_upd_c(struct pfsync_pkt *pkt, pfsync_update_state(st); PF_STATE_UNLOCK(st); - swi_sched(V_pfsync_swi_cookie, 0); + PFSYNC_LOCK(sc); + pfsync_push(sc); + PFSYNC_UNLOCK(sc); continue; } pfsync_alloc_scrub_memory(&up->dst, &st->dst); @@ -1712,7 +1721,7 @@ pfsync_defer(struct pf_state *st, struct callout_init_mtx(&pd->pd_tmo, &sc->sc_mtx, CALLOUT_RETURNUNLOCKED); callout_reset(&pd->pd_tmo, 10, pfsync_defer_tmo, pd); - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); return (1); } @@ -1736,7 +1745,7 @@ pfsync_undefer(struct pfsync_deferral *p m_freem(m); else { _IF_ENQUEUE(&sc->sc_ifp->if_snd, m); - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); } } @@ -1829,10 +1838,11 @@ pfsync_update_state(struct pf_state *st) default: panic("%s: unexpected sync state %d", __func__, st->sync_state); } - PFSYNC_UNLOCK(sc); if (sync || (time_uptime - st->pfsync_time) < 2) - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); + + PFSYNC_UNLOCK(sc); } static void @@ -1868,7 +1878,7 @@ pfsync_request_update(u_int32_t creatori TAILQ_INSERT_TAIL(&sc->sc_upd_req_list, item, ur_entry); sc->sc_len += nlen; - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); } static void @@ -1892,7 +1902,7 @@ pfsync_update_state_req(struct pf_state pfsync_q_del(st); case PFSYNC_S_NONE: pfsync_q_ins(st, PFSYNC_S_UPD); - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); break; case PFSYNC_S_INS: @@ -2178,16 +2188,23 @@ pfsync_send_plus(void *plus, size_t plus static void pfsync_timeout(void *arg) { -#ifdef VIMAGE struct pfsync_softc *sc = arg; -#endif CURVNET_SET(sc->sc_ifp->if_vnet); - swi_sched(V_pfsync_swi_cookie, 0); + pfsync_push(sc); CURVNET_RESTORE(); } -/* this is a softnet/netisr handler */ +static void +pfsync_push(struct pfsync_softc *sc) +{ + + PFSYNC_LOCK_ASSERT(sc); + + sc->sc_flags |= PFSYNCF_PUSH; + swi_sched(V_pfsync_swi_cookie, 0); +} + static void pfsyncintr(void *arg) { @@ -2197,8 +2214,10 @@ pfsyncintr(void *arg) CURVNET_SET(sc->sc_ifp->if_vnet); PFSYNC_LOCK(sc); - if (sc->sc_len > PFSYNC_MINPKT) + if ((sc->sc_flags & PFSYNCF_PUSH) && sc->sc_len > PFSYNC_MINPKT) { pfsync_sendout(0); + sc->sc_flags &= ~PFSYNCF_PUSH; + } _IF_DEQUEUE_ALL(&sc->sc_ifp->if_snd, m); PFSYNC_UNLOCK(sc); From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 20:29:28 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B1D9D106564A; Sun, 3 Jun 2012 20:29:28 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DD948FC14; Sun, 3 Jun 2012 20:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53KTS44082832; Sun, 3 Jun 2012 20:29:28 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53KTS8E082830; Sun, 3 Jun 2012 20:29:28 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201206032029.q53KTS8E082830@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Sun, 3 Jun 2012 20:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236527 - projects/armv6/lib/libc/arm/gen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 20:29:28 -0000 Author: gonzo Date: Sun Jun 3 20:29:28 2012 New Revision: 236527 URL: http://svn.freebsd.org/changeset/base/236527 Log: Use ARM_TP_ADDRESS only if it's defined Modified: projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.S Modified: projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.S ============================================================================== --- projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.S Sun Jun 3 20:07:37 2012 (r236526) +++ projects/armv6/lib/libc/arm/gen/__aeabi_read_tp.S Sun Jun 3 20:29:28 2012 (r236527) @@ -39,6 +39,8 @@ ENTRY(__aeabi_read_tp) #endif RET +#ifdef ARM_TP_ADDRESS .Larm_tp_address: .word ARM_TP_ADDRESS +#endif From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 22:27:17 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BD237106574D; Sun, 3 Jun 2012 22:27:17 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A6F538FC15; Sun, 3 Jun 2012 22:27:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53MRHKu087728; Sun, 3 Jun 2012 22:27:17 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53MRHN8087724; Sun, 3 Jun 2012 22:27:17 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206032227.q53MRHN8087724@svn.freebsd.org> From: Davide Italiano Date: Sun, 3 Jun 2012 22:27:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236530 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 22:27:17 -0000 Author: davide Date: Sun Jun 3 22:27:17 2012 New Revision: 236530 URL: http://svn.freebsd.org/changeset/base/236530 Log: - Everytime callout_tick() is called it looks for the nearest future event and communicate it to eventtimers subsystem via via callout_new_inserted(). So, we don't need anymore to call callout_tickstofirst() when we're in getnextcpuevent(), and we can get rid of it. - Completely refactor the cpu_new_callout() function (many thanks to Alexander Motin that helped me there with this code). - Switch back from getbinuptime() to binuptime() to measure present time in callout_tick(). Pointed out by: mav, bde Modified: projects/calloutng/sys/kern/kern_clocksource.c projects/calloutng/sys/kern/kern_timeout.c projects/calloutng/sys/sys/callout.h Modified: projects/calloutng/sys/kern/kern_clocksource.c ============================================================================== --- projects/calloutng/sys/kern/kern_clocksource.c Sun Jun 3 21:03:16 2012 (r236529) +++ projects/calloutng/sys/kern/kern_clocksource.c Sun Jun 3 22:27:17 2012 (r236530) @@ -72,9 +72,7 @@ static int round_freq(struct eventtimer static void getnextcpuevent(struct bintime *event, int idle); static void getnextevent(struct bintime *event); static int handleevents(struct bintime *now, int fake); -#ifdef SMP static void cpu_new_callout(int cpu, struct bintime bt); -#endif static struct mtx et_hw_mtx; @@ -274,24 +272,28 @@ handleevents(struct bintime *now, int fa static void getnextcpuevent(struct bintime *event, int idle) { - struct bintime tmp; struct pcpu_state *state; - + struct bintime tmp; + int hardfreq; + state = DPCPU_PTR(timerstate); - /* Handle hardclock() events. */ + /* Handle hardclock() events, skipping some is CPU is idle. */ *event = state->nexthard; + if (idle || (!activetick && !profiling && + (timer->et_flags & ET_FLAGS_PERCPU) == 0)) { + hardfreq = idle ? 4 : (stathz / 2); + if (curcpu == CPU_FIRST() && tc_min_ticktock_freq > hardfreq) + hardfreq = tc_min_ticktock_freq; + if (hz > hardfreq) { + tmp = hardperiod; + bintime_mul(&tmp, hz / hardfreq - 1); + bintime_add(event, &tmp); + } + } /* Handle callout events. */ - tmp = callout_tickstofirst(); - if (state->nextcall.sec == -1) - state->nextcall = tmp; - if (bintime_cmp(&tmp, &state->nextcall, <) && - (tmp.sec != -1)) { - state->nextcall = tmp; - } - if (bintime_cmp(event, &state->nextcall, >) && - (state->nextcall.sec != -1)) { + if (state->nextcall.sec != -1 && + bintime_cmp(event, &state->nextcall, >)) *event = state->nextcall; - } if (!idle) { /* If CPU is active - handle other types of events. */ if (bintime_cmp(event, &state->nextstat, >)) *event = state->nextstat; @@ -634,9 +636,7 @@ cpu_initclocks_bsp(void) #endif state->nextcall.sec = -1; } -#ifdef SMP callout_new_inserted = cpu_new_callout; -#endif periodic = want_periodic; /* Grab requested timer or the best of present. */ if (timername[0]) @@ -864,74 +864,48 @@ clocksource_cyc_set(const struct bintime } #endif -#ifdef SMP static void cpu_new_callout(int cpu, struct bintime bt) { struct bintime now; struct pcpu_state *state; - CTR3(KTR_SPARE2, "new co at %d: on %d in %d", - curcpu, cpu, ticks); + CTR4(KTR_SPARE2, "new co at %d: on %d at %d.%08x%08x", + curcpu, cpu, (unsigned int)(bt.frac >> 32), + (unsigned int)(bt.frac & 0xffffffff)); state = DPCPU_ID_PTR(cpu, timerstate); ET_HW_LOCK(state); - if (state->idle == 0 || busy) { + + /* If there is callout time already set earlier -- do nothing. */ + if (state->nextcall.sec != -1 && + bintime_cmp(&bt, &state->nextcall, >=)) { ET_HW_UNLOCK(state); return; } - /* - * If timer is periodic - just update next event time for target CPU. - * If timer is global - there is chance it is already programmed. - */ - if (periodic || (timer->et_flags & ET_FLAGS_PERCPU) == 0) { - /* - * Update next callout time. We can do this only if - * this one on which we're running is the target CPU. - */ - if (!periodic) { - if (bintime_cmp(&bt, &state->nextcall, ==)) { - ET_HW_UNLOCK(state); - return; - } - if (state->nextcall.sec == -1 || - bintime_cmp(&bt, &state->nextcall, <)) - state->nextcall = bt; - if (bintime_cmp(&state->nextcall, &state->nextevent, >=)) { - ET_HW_UNLOCK(state); - return; - } - state->nextevent = state->nextcall; - if (cpu == curcpu) { - loadtimer(&now, 0); - ET_HW_UNLOCK(state); - } - else - goto out; - } - if (bintime_cmp(&state->nexthard, &state->nextevent, <)) - state->nextevent = state->nexthard; - if (periodic || - bintime_cmp(&state->nextevent, &nexttick, >=)) { - ET_HW_UNLOCK(state); - return; - } + state->nextcall = bt; + /* If there is some some other event set earlier -- do nothing. */ + if (bintime_cmp(&state->nextcall, &state->nextevent, >=)) { + ET_HW_UNLOCK(state); + return; } -out: - /* - * Otherwise we have to wake that CPU up, as we can't get present - * bintime to reprogram global timer from here. If timer is per-CPU, - * we by definition can't do it from here. - */ - ET_HW_UNLOCK(state); - if (timer->et_flags & ET_FLAGS_PERCPU) { - state->handle = 1; - ipi_cpu(cpu, IPI_HARDCLOCK); - } else { - if (!cpu_idle_wakeup(cpu)) - ipi_cpu(cpu, IPI_AST); + state->nextevent = state->nextcall; + /* If timer is periodic -- there is nothing to reprogram. */ + if (periodic) { + ET_HW_UNLOCK(state); + return; } + /* If timer is global or of the current CPU -- reprogram it. */ + if ((timer->et_flags & ET_FLAGS_PERCPU) == 0 || cpu == curcpu) { + binuptime(&now); + loadtimer(&now, 0); + ET_HW_UNLOCK(state); + return; + } + /* Otherwise make other CPU to reprogram it. */ + state->handle = 1; + ET_HW_UNLOCK(state); + ipi_cpu(cpu, IPI_HARDCLOCK); } -#endif /* * Report or change the active event timers hardware. Modified: projects/calloutng/sys/kern/kern_timeout.c ============================================================================== --- projects/calloutng/sys/kern/kern_timeout.c Sun Jun 3 21:03:16 2012 (r236529) +++ projects/calloutng/sys/kern/kern_timeout.c Sun Jun 3 22:27:17 2012 (r236530) @@ -364,7 +364,9 @@ callout_tick(void) struct callout_tailq *sc; struct bintime now; struct bintime bt; - int need_softclock, first, last; + struct bintime limit; + struct bintime next; + int cpu, first, flag, future, last, need_softclock; /* * Process callouts at a very low cpu priority, so we don't keep the @@ -373,7 +375,7 @@ callout_tick(void) need_softclock = 0; cc = CC_SELF(); mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET); - getbinuptime(&now); + binuptime(&now); /* * getbinuptime() may be inaccurate and return time up to 1/HZ in the past. * In order to avoid the possible loss of one or more events look back 1/HZ @@ -395,20 +397,46 @@ callout_tick(void) first &= callwheelmask; last &= callwheelmask; } + cpu = curcpu; + next.sec = -1; + next .frac = -1; + limit.sec = 0; + limit.frac = 4611686018427250000; /* 1/4 sec */ + bintime_add(&limit,&now); + future = get_bucket(&limit); + flag = 0; for (;;) { sc = &cc->cc_callwheel[first]; TAILQ_FOREACH(tmp, sc, c_links.tqe) { - if (bintime_cmp(&tmp->c_time,&now, <=)) { + if ((!flag || flag == 1) && + bintime_cmp(&tmp->c_time, &now, <=)) { TAILQ_INSERT_TAIL(cc->cc_localexp,tmp,c_staiter); TAILQ_REMOVE(sc, tmp, c_links.tqe); tmp->c_flags |= CALLOUT_PROCESSED; need_softclock = 1; } + if ((flag == 1 || flag == 2) && + bintime_cmp(&tmp->c_time, &now, >)) { + if (next.sec == -1 || + bintime_cmp(&tmp->c_time, &next, <)) { + next = tmp->c_time; + cpu = tmp->c_cpu; + } + } } + if (first == ((last - 1) & callwheelmask)) + flag = 1; if (first == last) + flag = 2; + if (first == future || next.sec != -1) break; first = (first + 1) & callwheelmask; } + if (next.sec == -1) + next = limit; + if (callout_new_inserted != NULL) + (*callout_new_inserted)(cpu, + next); cc->cc_softticks = now; mtx_unlock_spin_flags(&cc->cc_lock, MTX_QUIET); /* @@ -420,43 +448,6 @@ callout_tick(void) } } -struct bintime -callout_tickstofirst(void) -{ - struct callout_cpu *cc; - struct callout *c; - struct callout_tailq *sc; - struct bintime tmp; - struct bintime now; - int bucket; - - tmp.sec = 0; - tmp.frac = 0; - cc = CC_SELF(); - mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET); - binuptime(&now); - for (bucket = 0; bucket < callwheelsize; ++bucket) { - sc = &cc->cc_callwheel[bucket]; - TAILQ_FOREACH( c, sc, c_links.tqe ) { - if (tmp.sec == 0 && tmp.frac == 0) - tmp = c->c_time; - if (bintime_cmp(&c->c_time, &now, <)) - tmp = now; - if (bintime_cmp(&c->c_time, &tmp, <=)) - tmp = c->c_time; - - } - } - if (tmp.sec == 0 && tmp.frac == 0) { - cc->cc_firsttick.sec = -1; - cc->cc_firsttick.frac = -1; - } - else - cc->cc_firsttick = tmp; - mtx_unlock_spin_flags(&cc->cc_lock, MTX_QUIET); - return (cc->cc_firsttick); -} - static struct callout_cpu * callout_lock(struct callout *c) { @@ -854,7 +845,7 @@ callout_reset_on(struct callout *c, int */ FREQ2BT(hz,&bt); - binuptime(&now); + getbinuptime(&now); bintime_mul(&bt,to_ticks); bintime_add(&bt,&now); /* Modified: projects/calloutng/sys/sys/callout.h ============================================================================== --- projects/calloutng/sys/sys/callout.h Sun Jun 3 21:03:16 2012 (r236529) +++ projects/calloutng/sys/sys/callout.h Sun Jun 3 22:27:17 2012 (r236530) @@ -80,7 +80,6 @@ int callout_schedule_on(struct callout * #define callout_stop(c) _callout_stop_safe(c, 0) int _callout_stop_safe(struct callout *, int); void callout_tick(void); -struct bintime callout_tickstofirst(void); extern void (*callout_new_inserted)(int cpu, struct bintime bt); #endif From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 22:40:32 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5F0D106564A; Sun, 3 Jun 2012 22:40:32 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 880B18FC08; Sun, 3 Jun 2012 22:40:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53MeWaF089073; Sun, 3 Jun 2012 22:40:32 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53MeWPb089072; Sun, 3 Jun 2012 22:40:32 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206032240.q53MeWPb089072@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 3 Jun 2012 22:40:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236531 - projects/altix2/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 22:40:32 -0000 Author: marcel Date: Sun Jun 3 22:40:32 2012 New Revision: 236531 URL: http://svn.freebsd.org/changeset/base/236531 Log: First quick sketch of the busdma I/O MMU interface. Added: projects/altix2/sys/kern/busdma_if.m (contents, props changed) Added: projects/altix2/sys/kern/busdma_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/altix2/sys/kern/busdma_if.m Sun Jun 3 22:40:32 2012 (r236531) @@ -0,0 +1,58 @@ +#- +# Copyright (c) 2012 Marcel Moolenaar +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +#include +#include + +INTERFACE busdma; + +busdma_mmu_t { + void * cookie; + vm_paddr_t minaddr; + vm_paddr_t maxaddr; + vm_size_t maxsz; + vm_paddr_t align; + vm_paddr_t bndry; +} + +METHOD int iommu_alloc { + device_t dev; + busdma_md_t md; + busdma_mmu_t *mmu; +}; + +METHOD int iommu_map { + device_t dev; + busdma_md_t md; + busdma_mmu_t *mmu; +}; + +METHOD int iommu_unmap { + device_t dev; + busdma_md_t md; +}; From owner-svn-src-projects@FreeBSD.ORG Sun Jun 3 23:48:04 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE982106564A; Sun, 3 Jun 2012 23:48:04 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFD2E8FC0C; Sun, 3 Jun 2012 23:48:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q53Nm47R092635; Sun, 3 Jun 2012 23:48:04 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q53Nm4Ci092630; Sun, 3 Jun 2012 23:48:04 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206032348.q53Nm4Ci092630@svn.freebsd.org> From: Marcel Moolenaar Date: Sun, 3 Jun 2012 23:48:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236532 - in projects/altix2/sys: conf kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Jun 2012 23:48:05 -0000 Author: marcel Date: Sun Jun 3 23:48:04 2012 New Revision: 236532 URL: http://svn.freebsd.org/changeset/base/236532 Log: Hook-up and respin the busdma/mi IOMMU interface. In particular, rename busdma_mmu_t to busdma_mtag_t, because its use is for deriving the proper memory allocation restrictions based on the device DMA restrictions and the I/O MMUs involved when doing DMA. Modified: projects/altix2/sys/conf/files projects/altix2/sys/kern/busdma_if.m projects/altix2/sys/kern/subr_busdma.c projects/altix2/sys/sys/busdma.h Modified: projects/altix2/sys/conf/files ============================================================================== --- projects/altix2/sys/conf/files Sun Jun 3 22:40:32 2012 (r236531) +++ projects/altix2/sys/conf/files Sun Jun 3 23:48:04 2012 (r236532) @@ -2505,6 +2505,7 @@ fs/cd9660/cd9660_vfsops.c optional cd966 fs/cd9660/cd9660_vnops.c optional cd9660 fs/cd9660/cd9660_iconv.c optional cd9660_iconv kern/bus_if.m standard +kern/busdma_if.m standard kern/clock_if.m standard kern/cpufreq_if.m standard kern/device_if.m standard Modified: projects/altix2/sys/kern/busdma_if.m ============================================================================== --- projects/altix2/sys/kern/busdma_if.m Sun Jun 3 22:40:32 2012 (r236531) +++ projects/altix2/sys/kern/busdma_if.m Sun Jun 3 23:48:04 2012 (r236532) @@ -31,25 +31,14 @@ INTERFACE busdma; -busdma_mmu_t { - void * cookie; - vm_paddr_t minaddr; - vm_paddr_t maxaddr; - vm_size_t maxsz; - vm_paddr_t align; - vm_paddr_t bndry; -} - -METHOD int iommu_alloc { +METHOD int iommu_xlate { device_t dev; - busdma_md_t md; - busdma_mmu_t *mmu; + busdma_mtag_t mtag; }; METHOD int iommu_map { device_t dev; busdma_md_t md; - busdma_mmu_t *mmu; }; METHOD int iommu_unmap { Modified: projects/altix2/sys/kern/subr_busdma.c ============================================================================== --- projects/altix2/sys/kern/subr_busdma.c Sun Jun 3 22:40:32 2012 (r236531) +++ projects/altix2/sys/kern/subr_busdma.c Sun Jun 3 23:48:04 2012 (r236532) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "busdma_if.h" + struct busdma_tag { struct busdma_tag *dt_chain; struct busdma_tag *dt_child; @@ -357,21 +359,35 @@ busdma_mem_alloc(struct busdma_tag *tag, { struct busdma_md *md; struct busdma_md_seg *seg; + struct busdma_mtag mtag; + device_t bus; vm_size_t maxsz; u_int idx; + int error; md = _busdma_md_create(tag, BUSDMA_MD_FLAG_ALLOCATED); if (md == NULL) return (ENOMEM); + mtag.dmt_minaddr = tag->dt_minaddr; + mtag.dmt_maxaddr = tag->dt_maxaddr; + mtag.dmt_maxsz = tag->dt_maxsegsz; + mtag.dmt_align = tag->dt_align; + mtag.dmt_bndry = tag->dt_bndry; + + bus = device_get_parent(tag->dt_device); + error = BUSDMA_IOMMU_XLATE(bus, &mtag); + if (error) + printf("BUSDMA_IOMMU_XLATE: error=%d\n", error); + idx = 0; maxsz = tag->dt_maxsz; while (maxsz > 0 && idx < tag->dt_nsegs) { seg = &md->md_seg[idx]; - seg->mds_size = MIN(maxsz, tag->dt_maxsegsz); + seg->mds_size = MIN(maxsz, mtag.dmt_maxsz); seg->mds_vaddr = kmem_alloc_contig(kernel_map, seg->mds_size, - 0, tag->dt_minaddr, tag->dt_maxaddr, tag->dt_align, - tag->dt_bndry, VM_MEMATTR_DEFAULT); + 0, mtag.dmt_minaddr, mtag.dmt_maxaddr, mtag.dmt_align, + mtag.dmt_bndry, VM_MEMATTR_DEFAULT); if (seg->mds_vaddr == 0) { /* TODO: try a smaller segment size */ goto fail; @@ -383,6 +399,9 @@ busdma_mem_alloc(struct busdma_tag *tag, } if (maxsz == 0) { md->md_nsegs = idx; + error = BUSDMA_IOMMU_MAP(bus, md); + if (error) + printf("BUSDMA_IOMMU_MAP: error=%d\n", error); _busdma_md_dump(__func__, md); *md_p = md; return (0); @@ -401,11 +420,18 @@ busdma_mem_alloc(struct busdma_tag *tag, int busdma_mem_free(struct busdma_md *md) { + device_t bus; u_int idx; + int error; if ((md->md_flags & BUSDMA_MD_FLAG_ALLOCATED) == 0) return (EINVAL); + bus = device_get_parent(md->md_tag->dt_device); + error = BUSDMA_IOMMU_UNMAP(bus, md); + if (error) + printf("BUSDMA_IOMMU_UNMAP: error=%d\n", error); + for (idx = 0; idx < md->md_nsegs; idx++) kmem_free(kernel_map, md->md_seg[idx].mds_vaddr, md->md_seg[idx].mds_size); Modified: projects/altix2/sys/sys/busdma.h ============================================================================== --- projects/altix2/sys/sys/busdma.h Sun Jun 3 22:40:32 2012 (r236531) +++ projects/altix2/sys/sys/busdma.h Sun Jun 3 23:48:04 2012 (r236532) @@ -37,6 +37,15 @@ typedef struct busdma_tag *busdma_tag_t; struct busdma_md; typedef struct busdma_md *busdma_md_t; +struct busdma_mtag { + vm_paddr_t dmt_minaddr; + vm_paddr_t dmt_maxaddr; + vm_size_t dmt_maxsz; + vm_paddr_t dmt_align; + vm_paddr_t dmt_bndry; +}; +typedef struct busdma_mtag *busdma_mtag_t; + /* * busdma_tag_create * returns: errno value From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 02:25:12 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64F94106566C; Mon, 4 Jun 2012 02:25:12 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3693D8FC17; Mon, 4 Jun 2012 02:25:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q542PCGk098980; Mon, 4 Jun 2012 02:25:12 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q542PBna098977; Mon, 4 Jun 2012 02:25:11 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206040225.q542PBna098977@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 02:25:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236533 - in projects/altix2/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 02:25:12 -0000 Author: marcel Date: Mon Jun 4 02:25:11 2012 New Revision: 236533 URL: http://svn.freebsd.org/changeset/base/236533 Log: o Add busdma_md_load_phys for supporting CAM's physical addressing. o Fix prototypes for _load_mbuf & _load_uio. o Dummy-implement _load_phys & _load_uio, like _load_linear. Modified: projects/altix2/sys/kern/subr_busdma.c projects/altix2/sys/sys/busdma.h Modified: projects/altix2/sys/kern/subr_busdma.c ============================================================================== --- projects/altix2/sys/kern/subr_busdma.c Sun Jun 3 23:48:04 2012 (r236532) +++ projects/altix2/sys/kern/subr_busdma.c Mon Jun 4 02:25:11 2012 (r236533) @@ -341,8 +341,29 @@ busdma_md_load_linear(struct busdma_md * busdma_callback_f cb, void *arg, u_int flags) { - printf("XXX: %s: md=%p, buf=%p, len=%lx\n", __func__, - md, buf, (u_long)len); + printf("XXX: %s: md=%p, buf=%p, len=%lx\n", __func__, md, + buf, (u_long)len); + (*cb)(arg, md, ENOSYS); + return (0); +} + +int +busdma_md_load_phys(struct busdma_md *md, vm_paddr_t buf, size_t len, + busdma_callback_f cb, void *arg, u_int flags) +{ + + printf("XXX: %s: md=%p, buf=%#jx, len=%lx\n", __func__, md, + (uintmax_t)buf, (u_long)len); + (*cb)(arg, md, ENOSYS); + return (0); +} + +int +busdma_md_load_uio(struct busdma_md *md, struct uio *uio, + busdma_callback_f cb, void *arg, u_int flags) +{ + + printf("XXX: %s: md=%p, uio=%p\n", __func__, md, uio); (*cb)(arg, md, ENOSYS); return (0); } Modified: projects/altix2/sys/sys/busdma.h ============================================================================== --- projects/altix2/sys/sys/busdma.h Sun Jun 3 23:48:04 2012 (r236532) +++ projects/altix2/sys/sys/busdma.h Mon Jun 4 02:25:11 2012 (r236533) @@ -93,14 +93,21 @@ int busdma_tag_destroy(busdma_tag_t tag) /* * */ +struct mbuf; +struct uio; + typedef void (*busdma_callback_f)(void *, busdma_md_t, int); int busdma_md_create(busdma_tag_t tag, u_int flags, busdma_md_t *md_p); int busdma_md_destroy(busdma_md_t md); int busdma_md_load_linear(busdma_md_t md, void *buf, size_t size, busdma_callback_f cb, void *arg, u_int flags); -int busdma_md_load_mbuf(busdma_md_t md, void *buf, size_t size); -int busdma_md_load_uio(busdma_md_t md, void *buf, size_t size); +int busdma_md_load_mbuf(busdma_md_t md, struct mbuf *mbuf, + busdma_callback_f cb, void *arg, u_int flags); +int busdma_md_load_phys(busdma_md_t md, vm_paddr_t buf, size_t size, + busdma_callback_f cb, void *arg, u_int flags); +int busdma_md_load_uio(busdma_md_t md, struct uio *uio, + busdma_callback_f cb, void *arg, u_int flags); int busdma_md_unload(busdma_md_t md); u_int busdma_md_get_nsegs(busdma_md_t md); bus_addr_t busdma_md_get_busaddr(busdma_md_t md, u_int idx); From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 06:00:58 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2C30A106564A; Mon, 4 Jun 2012 06:00:58 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 177048FC19; Mon, 4 Jun 2012 06:00:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5460vc7008250; Mon, 4 Jun 2012 06:00:57 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5460vuB008247; Mon, 4 Jun 2012 06:00:57 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206040600.q5460vuB008247@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 06:00:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236536 - projects/altix2/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 06:00:58 -0000 Author: marcel Date: Mon Jun 4 06:00:57 2012 New Revision: 236536 URL: http://svn.freebsd.org/changeset/base/236536 Log: o Add a default implementation of busdma_iommu_xlate that yields an identify mapping (i.e. does not change the mtag and returns 0). o Add _busdma_iommu_xlate that walks the device hierarchy until it reaches the root. This allows all devices on the path from leaf to root to contribute to the final mtag. Modified: projects/altix2/sys/kern/busdma_if.m projects/altix2/sys/kern/subr_busdma.c Modified: projects/altix2/sys/kern/busdma_if.m ============================================================================== --- projects/altix2/sys/kern/busdma_if.m Mon Jun 4 04:24:59 2012 (r236535) +++ projects/altix2/sys/kern/busdma_if.m Mon Jun 4 06:00:57 2012 (r236536) @@ -31,10 +31,19 @@ INTERFACE busdma; +# Default implementations +CODE { + static int + default_iommu_xlate(device_t dev, busdma_mtag_t mtag) + { + return (0); + } +}; + METHOD int iommu_xlate { device_t dev; busdma_mtag_t mtag; -}; +} DEFAULT default_iommu_xlate; METHOD int iommu_map { device_t dev; Modified: projects/altix2/sys/kern/subr_busdma.c ============================================================================== --- projects/altix2/sys/kern/subr_busdma.c Mon Jun 4 04:24:59 2012 (r236535) +++ projects/altix2/sys/kern/subr_busdma.c Mon Jun 4 06:00:57 2012 (r236536) @@ -107,6 +107,17 @@ static MALLOC_DEFINE(M_BUSDMA_MD, "busdm static MALLOC_DEFINE(M_BUSDMA_TAG, "busdma_tag", "DMA tags"); static void +_busdma_mtag_dump(const char *func, device_t dev, struct busdma_mtag *mtag) +{ + + printf("[%s: %s: min=%#lx, max=%#lx, size=%#lx, align=%#lx, " + "bndry=%#lx]\n", __func__, + (dev != NULL) ? device_get_nameunit(dev) : "*", + mtag->dmt_minaddr, mtag->dmt_maxaddr, mtag->dmt_maxsz, + mtag->dmt_align, mtag->dmt_bndry); +} + +static void _busdma_tag_dump(const char *func, device_t dev, struct busdma_tag *tag) { @@ -209,6 +220,22 @@ _busdma_md_create(struct busdma_tag *tag return (md); } +static int +_busdma_iommu_xlate(device_t dev, struct busdma_mtag *mtag) +{ + int error; + + error = 0; + while (!error && dev != NULL) { + _busdma_mtag_dump(__func__, dev, mtag); + error = BUSDMA_IOMMU_XLATE(dev, mtag); + if (!error) + dev = device_get_parent(dev); + } + _busdma_mtag_dump(__func__, dev, mtag); + return (error); +} + int busdma_tag_create(device_t dev, bus_addr_t align, bus_addr_t bndry, bus_addr_t maxaddr, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, @@ -381,7 +408,6 @@ busdma_mem_alloc(struct busdma_tag *tag, struct busdma_md *md; struct busdma_md_seg *seg; struct busdma_mtag mtag; - device_t bus; vm_size_t maxsz; u_int idx; int error; @@ -390,18 +416,20 @@ busdma_mem_alloc(struct busdma_tag *tag, if (md == NULL) return (ENOMEM); + idx = 0; + mtag.dmt_minaddr = tag->dt_minaddr; mtag.dmt_maxaddr = tag->dt_maxaddr; mtag.dmt_maxsz = tag->dt_maxsegsz; mtag.dmt_align = tag->dt_align; mtag.dmt_bndry = tag->dt_bndry; - bus = device_get_parent(tag->dt_device); - error = BUSDMA_IOMMU_XLATE(bus, &mtag); - if (error) - printf("BUSDMA_IOMMU_XLATE: error=%d\n", error); + error = _busdma_iommu_xlate(tag->dt_device, &mtag); + if (error) { + printf("_busdma_iommu_xlate: error=%d\n", error); + goto fail; + } - idx = 0; maxsz = tag->dt_maxsz; while (maxsz > 0 && idx < tag->dt_nsegs) { seg = &md->md_seg[idx]; @@ -420,7 +448,7 @@ busdma_mem_alloc(struct busdma_tag *tag, } if (maxsz == 0) { md->md_nsegs = idx; - error = BUSDMA_IOMMU_MAP(bus, md); + error = BUSDMA_IOMMU_MAP(tag->dt_device, md); if (error) printf("BUSDMA_IOMMU_MAP: error=%d\n", error); _busdma_md_dump(__func__, md); From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 06:06:11 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 24319106566B; Mon, 4 Jun 2012 06:06:11 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 010C78FC1D; Mon, 4 Jun 2012 06:06:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5466AAD008485; Mon, 4 Jun 2012 06:06:10 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5466Ap3008482; Mon, 4 Jun 2012 06:06:10 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206040606.q5466Ap3008482@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 06:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236537 - projects/altix2/sys/ia64/sgisn X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 06:06:11 -0000 Author: marcel Date: Mon Jun 4 06:06:10 2012 New Revision: 236537 URL: http://svn.freebsd.org/changeset/base/236537 Log: Implement the BUSDMA_IOMMU_XLATE method for the pcib and shub devices: o The pcib device selects between 32-bit or 64-bit direct mapped addresses. For 32-bit this means that the address is limited to 2G. o The shub device limits the addresses to be offsets within an address space and then transposes the range to lie within the cacheable memory space. In combination this guarantees that DMA memory will be allocated from memory local to the device and lie within the 2G translation window for 32-bit direct mapped DMA. Modified: projects/altix2/sys/ia64/sgisn/sgisn_pcib.c projects/altix2/sys/ia64/sgisn/sgisn_shub.c Modified: projects/altix2/sys/ia64/sgisn/sgisn_pcib.c ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_pcib.c Mon Jun 4 06:00:57 2012 (r236536) +++ projects/altix2/sys/ia64/sgisn/sgisn_pcib.c Mon Jun 4 06:06:10 2012 (r236537) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -40,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "busdma_if.h" #include "pcib_if.h" #include @@ -94,6 +96,8 @@ static uint32_t sgisn_pcib_cfgread(devic static void sgisn_pcib_cfgwrite(device_t, u_int, u_int, u_int, u_int, uint32_t, int); +static int sgisn_pcib_iommu_xlate(device_t, busdma_mtag_t); + /* * Bus interface definitions. */ @@ -123,6 +127,9 @@ static device_method_t sgisn_pcib_method DEVMETHOD(pcib_write_config, sgisn_pcib_cfgwrite), DEVMETHOD(pcib_route_interrupt, pcib_route_interrupt), + /* busdma interface */ + DEVMETHOD(busdma_iommu_xlate, sgisn_pcib_iommu_xlate), + { 0, 0 } }; @@ -425,3 +432,16 @@ sgisn_pcib_write_ivar(device_t dev, devi } return (ENOENT); } + +static int +sgisn_pcib_iommu_xlate(device_t dev, busdma_mtag_t mtag) +{ + + /* + * Use a 31-bit direct-mapped window for PCI devices that are not + * 64-bit capable. + */ + if (mtag->dmt_maxaddr < ~0UL) + mtag->dmt_maxaddr &= 0x7fffffffUL; + return (0); +} Modified: projects/altix2/sys/ia64/sgisn/sgisn_shub.c ============================================================================== --- projects/altix2/sys/ia64/sgisn/sgisn_shub.c Mon Jun 4 06:00:57 2012 (r236536) +++ projects/altix2/sys/ia64/sgisn/sgisn_shub.c Mon Jun 4 06:06:10 2012 (r236537) @@ -50,6 +50,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "busdma_if.h" + #include struct sgisn_shub_softc { @@ -60,7 +62,6 @@ struct sgisn_shub_softc { bus_addr_t sc_mmraddr; bus_space_tag_t sc_tag; bus_space_handle_t sc_hndl; - busdma_tag_t sc_dmatag; u_int sc_domain; u_int sc_hubtype; /* SHub type (0=SHub1, 1=SHub2) */ u_int sc_nasid_mask; @@ -86,6 +87,8 @@ static int sgisn_shub_set_resource(devic u_long); static int sgisn_shub_write_ivar(device_t, device_t, int, uintptr_t); +static int sgisn_shub_iommu_xlate(device_t, busdma_mtag_t); + /* * Bus interface definitions. */ @@ -109,6 +112,9 @@ static device_method_t sgisn_shub_method DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), + /* busdma interface */ + DEVMETHOD(busdma_iommu_xlate, sgisn_shub_iommu_xlate), + { 0, 0 } }; @@ -353,7 +359,6 @@ sgisn_shub_attach(device_t dev) void *ptr; u_long addr; u_int bus, seg, wdgt; - int error; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -398,15 +403,6 @@ sgisn_shub_attach(device_t dev) device_printf(dev, "NASID=%#x\n", sc->sc_nasid); /* - * Create a DMA tag to contribute constraints for our children. - */ - addr = 1UL << (sc->sc_nasid_shft - 2); - error = busdma_tag_create(dev, addr - 1UL, 1, 0, addr, ~0U, addr, 0, - &sc->sc_dmatag); - if (error) - return (error); - - /* * Allocate contiguous memory, local to the SHub, for collecting * SHub information from the PROM and for discovering the PCI * host controllers connected to the SHub. @@ -488,3 +484,28 @@ sgisn_shub_write_ivar(device_t dev, devi __func__, child, ev, value); return (0); } + +static int +sgisn_shub_iommu_xlate(device_t dev, busdma_mtag_t mtag) +{ + struct sgisn_shub_softc *sc; + vm_paddr_t maxaddr; + + sc = device_get_softc(dev); + + /* + * Always limit the maximum address to the maximum offset within + * this node's cacheable memory space. + */ + maxaddr = (1UL << (sc->sc_nasid_shft - 2)) - 1; + if (mtag->dmt_maxaddr > maxaddr) + mtag->dmt_maxaddr = maxaddr; + + /* + * Transpose the address range into the current node's cacheable + * memory space. + */ + mtag->dmt_minaddr += sc->sc_membase; + mtag->dmt_maxaddr += sc->sc_membase; + return (0); +} From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 07:12:12 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 31DDB1065670; Mon, 4 Jun 2012 07:12:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1BC348FC21; Mon, 4 Jun 2012 07:12:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q547CBUS011778; Mon, 4 Jun 2012 07:12:11 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q547CBu9011763; Mon, 4 Jun 2012 07:12:11 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206040712.q547CBu9011763@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 07:12:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236545 - in projects/pf/head/sys: contrib/pf/net netinet netinet6 netipsec sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:12:12 -0000 Author: glebius Date: Mon Jun 4 07:12:11 2012 New Revision: 236545 URL: http://svn.freebsd.org/changeset/base/236545 Log: Remove completely the m_addr_changed() hack, and support of reverse pointer in pf_state_ket, that ware 'if 0' since beginning of SMP-friendly pf project. In the new locking scheme we can't reference state keys from mbuf tags, nor a key can reference another key. Modified: projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pf_mtag.h projects/pf/head/sys/contrib/pf/net/pfvar.h projects/pf/head/sys/netinet/in_gif.c projects/pf/head/sys/netinet/ip_icmp.c projects/pf/head/sys/netinet/raw_ip.c projects/pf/head/sys/netinet/tcp_subr.c projects/pf/head/sys/netinet6/icmp6.c projects/pf/head/sys/netinet6/in6_gif.c projects/pf/head/sys/netipsec/ipsec_input.c projects/pf/head/sys/netipsec/ipsec_output.c projects/pf/head/sys/netipsec/xform_ipip.c projects/pf/head/sys/sys/mbuf.h Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 07:12:11 2012 (r236545) @@ -292,10 +292,6 @@ static void pf_print_state_parts(struc struct pf_state_key *, struct pf_state_key *); static int pf_addr_wrap_neq(struct pf_addr_wrap *, struct pf_addr_wrap *); -#if 0 -static int pf_compare_state_keys(struct pf_state_key *, - struct pf_state_key *, struct pfi_kif *, u_int); -#endif static struct pf_state *pf_find_state(struct pfi_kif *, struct pf_state_key_cmp *, u_int); static int pf_src_connlimit(struct pf_state **); @@ -955,10 +951,6 @@ pf_state_key_detach(struct pf_state *s, if (TAILQ_EMPTY(&sk->states[0]) && TAILQ_EMPTY(&sk->states[1])) { LIST_REMOVE(sk, entry); -#if 0 /* XXXGL: TODO */ - if (sk->reverse) - sk->reverse->reverse = NULL; -#endif uma_zfree(V_pf_state_key_z, sk); } } @@ -1089,39 +1081,6 @@ pf_find_state_byid(uint64_t id, uint32_t return (s); } -#if 0 -/* XXX debug function, intended to be removed one day */ -static int -pf_compare_state_keys(struct pf_state_key *a, struct pf_state_key *b, - struct pfi_kif *kif, u_int dir) -{ - /* a (from hdr) and b (new) must be exact opposites of each other */ - if (a->af == b->af && a->proto == b->proto && - PF_AEQ(&a->addr[0], &b->addr[1], a->af) && - PF_AEQ(&a->addr[1], &b->addr[0], a->af) && - a->port[0] == b->port[1] && - a->port[1] == b->port[0]) - return (0); - else { - /* mismatch. must not happen. */ - printf("pf: state key linking mismatch! dir=%s, " - "if=%s, stored af=%u, a0: ", - dir == PF_OUT ? "OUT" : "IN", kif->pfik_name, a->af); - pf_print_host(&a->addr[0], a->port[0], a->af); - printf(", a1: "); - pf_print_host(&a->addr[1], a->port[1], a->af); - printf(", proto=%u", a->proto); - printf(", found af=%u, a0: ", b->af); - pf_print_host(&b->addr[0], b->port[0], b->af); - printf(", a1: "); - pf_print_host(&b->addr[1], b->port[1], b->af); - printf(", proto=%u", b->proto); - printf(".\n"); - return (-1); - } -} -#endif - /* * Find state by key. * Returns with ID hash slot locked on success. @@ -1136,27 +1095,6 @@ pf_find_state(struct pfi_kif *kif, struc V_pf_status.fcounters[FCNT_STATE_SEARCH]++; -#if 0 /* XXXGL: to do reverse */ - if (dir == PF_OUT && pftag->statekey && - ((struct pf_state_key *)pftag->statekey)->reverse) - sk = ((struct pf_state_key *)pftag->statekey)->reverse; - else { - if ((sk = RB_FIND(pf_state_tree, &V_pf_statetbl, - (struct pf_state_key *)key)) == NULL) { - return (NULL); - } - if (dir == PF_OUT && pftag->statekey && - pf_compare_state_keys(pftag->statekey, sk, - kif, dir) == 0) { - ((struct pf_state_key *) - pftag->statekey)->reverse = sk; - sk->reverse = pftag->statekey; - } - } - - if (dir == PF_OUT) - pftag->statekey = NULL; -#endif kh = &V_pf_keyhash[pf_hashkey((struct pf_state_key *)key)]; PF_HASHROW_LOCK(kh); @@ -5726,11 +5664,6 @@ done: if ((s && s->tag) || r->rtableid >= 0) pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag); -#if 0 /* XXXGL: to do reverse */ - if (dir == PF_IN && s && s->key[PF_SK_STACK]) - pd.pf_mtag->statekey = s->key[PF_SK_STACK]; -#endif - #ifdef ALTQ if (action == PF_PASS && r->qid) { if (pqid || (pd.tos & IPTOS_LOWDELAY)) @@ -6142,11 +6075,6 @@ done: if ((s && s->tag) || r->rtableid >= 0) pf_tag_packet(m, s ? s->tag : 0, r->rtableid, pd.pf_mtag); -#if 0 /* XXXGL: to do reverse */ - if (dir == PF_IN && s && s->key[PF_SK_STACK]) - pd.pf_mtag->statekey = s->key[PF_SK_STACK]; -#endif - #ifdef ALTQ if (action == PF_PASS && r->qid) { if (pd.tos & IPTOS_LOWDELAY) Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 07:12:11 2012 (r236545) @@ -134,7 +134,6 @@ static int pf_commit_rules(u_int32_t, static int pf_addr_setup(struct pf_ruleset *, struct pf_addr_wrap *, sa_family_t); static void pf_addr_copyout(struct pf_addr_wrap *); -static void pf_pkt_addr_changed(struct mbuf *); VNET_DEFINE(struct pf_rule, pf_default_rule); VNET_DEFINE(struct sx, pf_consistency_lock); @@ -307,8 +306,6 @@ pfattach(void) /* XXXGL: leaked all above. */ return (error); - m_addr_chg_pf_p = pf_pkt_addr_changed; - return (0); } @@ -3730,20 +3727,6 @@ dehook_pf(void) return (0); } -/* - * Must be called whenever any addressing information such as - * address, port, protocol has changed. - */ -static void -pf_pkt_addr_changed(struct mbuf *m) -{ -#if 0 /* XXXGL */ - struct pf_mtag *pf_tag; - if ((pf_tag = pf_find_mtag(m)) != NULL) - pf_tag->statekey = NULL; -#endif -} - static int pf_load(void) { @@ -3778,7 +3761,6 @@ pf_unload(void) PF_RULES_WLOCK(); V_pf_status.running = 0; PF_RULES_WUNLOCK(); - m_addr_chg_pf_p = NULL; swi_remove(V_pf_swi_cookie); error = dehook_pf(); if (error) { Modified: projects/pf/head/sys/contrib/pf/net/pf_mtag.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_mtag.h Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/contrib/pf/net/pf_mtag.h Mon Jun 4 07:12:11 2012 (r236545) @@ -42,9 +42,6 @@ struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ -#if 0 - void *statekey; /* pf stackside statekey */ -#endif u_int32_t qid; /* queue id */ u_int rtableid; /* alternate routing table id */ u_int16_t tag; /* tag id */ Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 07:12:11 2012 (r236545) @@ -778,9 +778,6 @@ struct pf_state_key { LIST_ENTRY(pf_state_key) entry; TAILQ_HEAD(, pf_state) states[2]; -#if 0 /* XXXGL: TODO */ - struct pf_state_key *reverse; -#endif }; /* Keep synced with struct pf_state. */ Modified: projects/pf/head/sys/netinet/in_gif.c ============================================================================== --- projects/pf/head/sys/netinet/in_gif.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netinet/in_gif.c Mon Jun 4 07:12:11 2012 (r236545) @@ -256,8 +256,6 @@ in_gif_output(struct ifnet *ifp, int fam #endif } - m_addr_changed(m); - error = ip_output(m, NULL, &sc->gif_ro, 0, NULL, NULL); if (!(GIF2IFP(sc)->if_flags & IFF_LINK0) && Modified: projects/pf/head/sys/netinet/ip_icmp.c ============================================================================== --- projects/pf/head/sys/netinet/ip_icmp.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netinet/ip_icmp.c Mon Jun 4 07:12:11 2012 (r236545) @@ -675,8 +675,6 @@ icmp_reflect(struct mbuf *m) goto done; /* Ip_output() will check for broadcast */ } - m_addr_changed(m); - t = ip->ip_dst; ip->ip_dst = ip->ip_src; Modified: projects/pf/head/sys/netinet/raw_ip.c ============================================================================== --- projects/pf/head/sys/netinet/raw_ip.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netinet/raw_ip.c Mon Jun 4 07:12:11 2012 (r236545) @@ -100,9 +100,6 @@ void (*ip_divert_ptr)(struct mbuf *, int int (*ng_ipfw_input_p)(struct mbuf **, int, struct ip_fw_args *, int); -/* Hook for telling pf that the destination address changed */ -void (*m_addr_chg_pf_p)(struct mbuf *m); - #ifdef INET /* * Hooks for multicast routing. They all default to NULL, so leave them not Modified: projects/pf/head/sys/netinet/tcp_subr.c ============================================================================== --- projects/pf/head/sys/netinet/tcp_subr.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netinet/tcp_subr.c Mon Jun 4 07:12:11 2012 (r236545) @@ -542,7 +542,6 @@ tcp_respond(struct tcpcb *tp, void *ipge m_freem(m->m_next); m->m_next = NULL; m->m_data = (caddr_t)ipgen; - m_addr_changed(m); /* m_len is set later */ tlen = 0; #define xchg(a,b,type) { type t; t=a; a=b; b=t; } Modified: projects/pf/head/sys/netinet6/icmp6.c ============================================================================== --- projects/pf/head/sys/netinet6/icmp6.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netinet6/icmp6.c Mon Jun 4 07:12:11 2012 (r236545) @@ -1177,8 +1177,6 @@ icmp6_notify_error(struct mbuf **mp, int ip6cp.ip6c_src = &icmp6src; ip6cp.ip6c_nxt = nxt; - m_addr_changed(m); - if (icmp6type == ICMP6_PACKET_TOO_BIG) { notifymtu = ntohl(icmp6->icmp6_mtu); ip6cp.ip6c_cmdarg = (void *)¬ifymtu; @@ -2298,8 +2296,6 @@ icmp6_reflect(struct mbuf *m, size_t off m->m_flags &= ~(M_BCAST|M_MCAST); - m_addr_changed(m); - ip6_output(m, NULL, NULL, 0, NULL, &outif, NULL); if (outif) icmp6_ifoutstat_inc(outif, type, code); Modified: projects/pf/head/sys/netinet6/in6_gif.c ============================================================================== --- projects/pf/head/sys/netinet6/in6_gif.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netinet6/in6_gif.c Mon Jun 4 07:12:11 2012 (r236545) @@ -264,8 +264,6 @@ in6_gif_output(struct ifnet *ifp, #endif } - m_addr_changed(m); - #ifdef IPV6_MINMTU /* * force fragmentation to minimum MTU, to avoid path MTU discovery. Modified: projects/pf/head/sys/netipsec/ipsec_input.c ============================================================================== --- projects/pf/head/sys/netipsec/ipsec_input.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netipsec/ipsec_input.c Mon Jun 4 07:12:11 2012 (r236545) @@ -473,8 +473,6 @@ ipsec4_common_input_cb(struct mbuf *m, s key_sa_recordxfer(sav, m); /* record data transfer */ - m_addr_changed(m); - #ifdef DEV_ENC encif->if_ipackets++; encif->if_ibytes += m->m_pkthdr.len; Modified: projects/pf/head/sys/netipsec/ipsec_output.c ============================================================================== --- projects/pf/head/sys/netipsec/ipsec_output.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netipsec/ipsec_output.c Mon Jun 4 07:12:11 2012 (r236545) @@ -191,8 +191,6 @@ ipsec_process_done(struct mbuf *m, struc } key_sa_recordxfer(sav, m); /* record data transfer */ - m_addr_changed(m); - /* * We're done with IPsec processing, transmit the packet using the * appropriate network protocol (IP or IPv6). SPD lookup will be Modified: projects/pf/head/sys/netipsec/xform_ipip.c ============================================================================== --- projects/pf/head/sys/netipsec/xform_ipip.c Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/netipsec/xform_ipip.c Mon Jun 4 07:12:11 2012 (r236545) @@ -392,8 +392,6 @@ _ipip_input(struct mbuf *m, int iphlen, panic("%s: bogus ip version %u", __func__, v>>4); } - m_addr_changed(m); - if (netisr_queue(isr, m)) { /* (0) on success. */ V_ipipstat.ipips_qfull++; DPRINTF(("%s: packet dropped because of full queue\n", Modified: projects/pf/head/sys/sys/mbuf.h ============================================================================== --- projects/pf/head/sys/sys/mbuf.h Mon Jun 4 07:08:58 2012 (r236544) +++ projects/pf/head/sys/sys/mbuf.h Mon Jun 4 07:12:11 2012 (r236545) @@ -740,16 +740,6 @@ m_last(struct mbuf *m) return (m); } -extern void (*m_addr_chg_pf_p)(struct mbuf *m); - -static __inline void -m_addr_changed(struct mbuf *m) -{ - - if (m_addr_chg_pf_p) - m_addr_chg_pf_p(m); -} - /* * mbuf, cluster, and external object allocation macros (for compatibility * purposes). From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 07:54:54 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A1BEC106566B; Mon, 4 Jun 2012 07:54:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C2818FC0A; Mon, 4 Jun 2012 07:54:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q547ssmV013669; Mon, 4 Jun 2012 07:54:54 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q547ss5B013665; Mon, 4 Jun 2012 07:54:54 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206040754.q547ss5B013665@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 07:54:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236548 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 07:54:54 -0000 Author: glebius Date: Mon Jun 4 07:54:53 2012 New Revision: 236548 URL: http://svn.freebsd.org/changeset/base/236548 Log: Some cleanup of pf osfp: - We don't need separate uma(9) zones for things that are allocated very infrequently, use malloc(9). - Don't pretend that pf_ospf.c can be compiled as userland program. Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pf_osfp.c projects/pf/head/sys/contrib/pf/net/pfvar.h Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 07:16:12 2012 (r236547) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 07:54:53 2012 (r236548) @@ -249,7 +249,6 @@ pfattach(void) pf_initialize(); pfi_initialize(); - pf_osfp_initialize(); pf_normalize_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; @@ -3782,7 +3781,6 @@ pf_unload(void) pf_normalize_cleanup(); pfi_cleanup(); pf_osfp_flush(); - pf_osfp_cleanup(); pf_cleanup(); PF_RULES_WUNLOCK(); destroy_dev(pf_dev); Modified: projects/pf/head/sys/contrib/pf/net/pf_osfp.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_osfp.c Mon Jun 4 07:16:12 2012 (r236547) +++ projects/pf/head/sys/contrib/pf/net/pf_osfp.c Mon Jun 4 07:54:53 2012 (r236548) @@ -22,10 +22,10 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef _KERNEL #include -#endif /* _KERNEL */ +#include #include +#include #include #include @@ -36,49 +36,17 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef _KERNEL #include -#endif - -#ifdef _KERNEL +static MALLOC_DEFINE(M_PFOSFP, "pf(4) osfp", "pf(4) operating system fingerprints"); #define DPFPRINTF(format, x...) \ if (V_pf_status.debug >= PF_DEBUG_NOISY) \ printf(format , ##x) -typedef uma_zone_t pool_t; - -#else -/* Userland equivalents so we can lend code to tcpdump et al. */ - -#include -#include -#include -#include -#include -#include -#define pool_t int -#define pool_get(pool, flags) malloc(*(pool)) -#define pool_put(pool, item) free(item) -#define pool_init(pool, size, a, ao, f, m, p) (*(pool)) = (size) - -#define NTOHS(x) (x) = ntohs((u_int16_t)(x)) - -#ifdef PFDEBUG -#include -#define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) -#else -#define DPFPRINTF(format, x...) ((void)0) -#endif /* PFDEBUG */ -#endif /* _KERNEL */ - SLIST_HEAD(pf_osfp_list, pf_os_fingerprint); -VNET_DEFINE(struct pf_osfp_list, pf_osfp_list); +static VNET_DEFINE(struct pf_osfp_list, pf_osfp_list) = + SLIST_HEAD_INITIALIZER(); #define V_pf_osfp_list VNET(pf_osfp_list) -VNET_DEFINE(pool_t, pf_osfp_entry_z); -#define pf_osfp_entry_pl VNET(pf_osfp_entry_z) -VNET_DEFINE(pool_t, pf_osfp_z); -#define pf_osfp_pl VNET(pf_osfp_z) static struct pf_osfp_enlist *pf_osfp_fingerprint_hdr(const struct ip *, const struct ip6_hdr *, @@ -93,7 +61,6 @@ static void pf_osfp_insert(struct pf_ static struct pf_os_fingerprint *pf_osfp_validate(void); #endif -#ifdef _KERNEL /* * Passively fingerprint the OS of the host (IPv4 TCP SYN packets only) * Returns the list of possible OSes. @@ -122,7 +89,6 @@ pf_osfp_fingerprint(struct pf_pdesc *pd, return (pf_osfp_fingerprint_hdr(ip, ip6, (struct tcphdr *)hdr)); } -#endif /* _KERNEL */ static struct pf_osfp_enlist * pf_osfp_fingerprint_hdr(const struct ip *ip, const struct ip6_hdr *ip6, const struct tcphdr *tcp) @@ -130,11 +96,7 @@ pf_osfp_fingerprint_hdr(const struct ip struct pf_os_fingerprint fp, *fpresult; int cnt, optlen = 0; const u_int8_t *optp; -#ifdef _KERNEL char srcname[128]; -#else - char srcname[NI_MAXHOST]; -#endif if ((tcp->th_flags & (TH_SYN|TH_ACK)) != TH_SYN) return (NULL); @@ -146,49 +108,21 @@ pf_osfp_fingerprint_hdr(const struct ip memset(&fp, 0, sizeof(fp)); if (ip) { -#ifndef _KERNEL - struct sockaddr_in sin; -#endif - fp.fp_psize = ntohs(ip->ip_len); fp.fp_ttl = ip->ip_ttl; if (ip->ip_off & htons(IP_DF)) fp.fp_flags |= PF_OSFP_DF; -#ifdef _KERNEL strlcpy(srcname, inet_ntoa(ip->ip_src), sizeof(srcname)); -#else - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_len = sizeof(struct sockaddr_in); - sin.sin_addr = ip->ip_src; - (void)getnameinfo((struct sockaddr *)&sin, - sizeof(struct sockaddr_in), srcname, sizeof(srcname), - NULL, 0, NI_NUMERICHOST); -#endif } #ifdef INET6 else if (ip6) { -#ifndef _KERNEL - struct sockaddr_in6 sin6; -#endif - /* jumbo payload? */ fp.fp_psize = sizeof(struct ip6_hdr) + ntohs(ip6->ip6_plen); fp.fp_ttl = ip6->ip6_hlim; fp.fp_flags |= PF_OSFP_DF; fp.fp_flags |= PF_OSFP_INET6; -#ifdef _KERNEL strlcpy(srcname, ip6_sprintf((struct in6_addr *)&ip6->ip6_src), sizeof(srcname)); -#else - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr = ip6->ip6_src; - (void)getnameinfo((struct sockaddr *)&sin6, - sizeof(struct sockaddr_in6), srcname, sizeof(srcname), - NULL, 0, NI_NUMERICHOST); -#endif } #endif else @@ -302,28 +236,6 @@ pf_osfp_match(struct pf_osfp_enlist *lis return (0); } -#ifdef _KERNEL -/* Initialize the OS fingerprint system */ -void -pf_osfp_initialize(void) -{ - pf_osfp_entry_z = uma_zcreate("pfospfen", sizeof(struct pf_osfp_entry), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - pf_osfp_z = uma_zcreate("pfosfp", sizeof(struct pf_os_fingerprint), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - - SLIST_INIT(&V_pf_osfp_list); -} - -void -pf_osfp_cleanup(void) -{ - - uma_zdestroy(pf_osfp_entry_z); - uma_zdestroy(pf_osfp_z); -} -#endif - /* Flush the fingerprint list */ void pf_osfp_flush(void) @@ -335,9 +247,9 @@ pf_osfp_flush(void) SLIST_REMOVE_HEAD(&V_pf_osfp_list, fp_next); while ((entry = SLIST_FIRST(&fp->fp_oses))) { SLIST_REMOVE_HEAD(&fp->fp_oses, fp_entry); - uma_zfree(pf_osfp_entry_z, entry); + free(entry, M_PFOSFP); } - uma_zfree(pf_osfp_z, fp); + free(fp, M_PFOSFP); } } @@ -349,6 +261,8 @@ pf_osfp_add(struct pf_osfp_ioctl *fpioc) struct pf_os_fingerprint *fp, fpadd; struct pf_osfp_entry *entry; + PF_RULES_WASSERT(); + memset(&fpadd, 0, sizeof(fpadd)); fpadd.fp_tcpopts = fpioc->fp_tcpopts; fpadd.fp_wsize = fpioc->fp_wsize; @@ -390,14 +304,13 @@ pf_osfp_add(struct pf_osfp_ioctl *fpioc) if (PF_OSFP_ENTRY_EQ(entry, &fpioc->fp_os)) return (EEXIST); } - if ((entry = uma_zalloc(pf_osfp_entry_z, - M_NOWAIT)) == NULL) + if ((entry = malloc(sizeof(*entry), M_PFOSFP, M_NOWAIT)) + == NULL) return (ENOMEM); } else { - if ((fp = uma_zalloc(pf_osfp_z, - M_NOWAIT)) == NULL) + if ((fp = malloc(sizeof(*fp), M_PFOSFP, M_ZERO | M_NOWAIT)) + == NULL) return (ENOMEM); - memset(fp, 0, sizeof(*fp)); fp->fp_tcpopts = fpioc->fp_tcpopts; fp->fp_wsize = fpioc->fp_wsize; fp->fp_psize = fpioc->fp_psize; @@ -407,9 +320,9 @@ pf_osfp_add(struct pf_osfp_ioctl *fpioc) fp->fp_wscale = fpioc->fp_wscale; fp->fp_ttl = fpioc->fp_ttl; SLIST_INIT(&fp->fp_oses); - if ((entry = uma_zalloc(pf_osfp_entry_z, - M_NOWAIT)) == NULL) { - uma_zfree(pf_osfp_z, fp); + if ((entry = malloc(sizeof(*entry), M_PFOSFP, M_NOWAIT)) + == NULL) { + free(fp, M_PFOSFP); return (ENOMEM); } pf_osfp_insert(&V_pf_osfp_list, fp); Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 07:16:12 2012 (r236547) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 07:54:53 2012 (r236548) @@ -1962,8 +1962,6 @@ struct pf_osfp_enlist * #endif /* _KERNEL */ void pf_osfp_flush(void); int pf_osfp_get(struct pf_osfp_ioctl *); -void pf_osfp_initialize(void); -void pf_osfp_cleanup(void); int pf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t); #ifdef _KERNEL From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 09:55:48 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1118D1065670; Mon, 4 Jun 2012 09:55:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E63C48FC12; Mon, 4 Jun 2012 09:55:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q549tlPc018815; Mon, 4 Jun 2012 09:55:47 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q549tlpm018811; Mon, 4 Jun 2012 09:55:47 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206040955.q549tlpm018811@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 09:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236553 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 09:55:48 -0000 Author: glebius Date: Mon Jun 4 09:55:47 2012 New Revision: 236553 URL: http://svn.freebsd.org/changeset/base/236553 Log: struct pf_altq doesn't need a separate uma(9) zone, they are allocated only at configuration stage. Modified: projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pfvar.h Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 09:47:19 2012 (r236552) +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 09:55:47 2012 (r236553) @@ -195,7 +195,6 @@ VNET_DEFINE(uma_zone_t, pf_rule_z); VNET_DEFINE(uma_zone_t, pf_pooladdr_z); VNET_DEFINE(uma_zone_t, pf_state_z); VNET_DEFINE(uma_zone_t, pf_state_key_z); -VNET_DEFINE(uma_zone_t, pf_altq_z); #define V_pf_sources_z VNET(pf_sources_z) @@ -704,8 +703,6 @@ pf_initialize() mtx_init(&sh->lock, "pf_srchash", NULL, MTX_DEF); /* ALTQ */ - V_pf_altq_z = uma_zcreate("pf altq", sizeof(struct pf_altq), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); TAILQ_INIT(&V_pf_altqs[0]); TAILQ_INIT(&V_pf_altqs[1]); TAILQ_INIT(&V_pf_pabuf); @@ -776,7 +773,6 @@ pf_cleanup() uma_zdestroy(V_pf_rule_z); uma_zdestroy(V_pf_state_z); uma_zdestroy(V_pf_state_key_z); - uma_zdestroy(V_pf_altq_z); uma_zdestroy(V_pf_pooladdr_z); uma_zdestroy(V_pfr_ktable_z); uma_zdestroy(V_pfr_kentry_z); Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 09:47:19 2012 (r236552) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 09:55:47 2012 (r236553) @@ -158,6 +158,7 @@ VNET_DEFINE(struct pf_tags, pf_tags); #define V_pf_qids VNET(pf_qids) VNET_DEFINE(struct pf_tags, pf_qids); MALLOC_DEFINE(M_PFTAG, "pf tags", "pf tags"); +MALLOC_DEFINE(M_PFALTQ, "pf(4) altq", "pf(4) altq configuration db"); #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE @@ -538,7 +539,7 @@ pf_begin_altq(u_int32_t *ticket) error = altq_remove(altq); } else pf_qid_unref(altq->qid); - uma_zfree(V_pf_altq_z, altq); + free(altq, M_PFALTQ); } if (error) return (error); @@ -566,7 +567,7 @@ pf_rollback_altq(u_int32_t ticket) error = altq_remove(altq); } else pf_qid_unref(altq->qid); - uma_zfree(V_pf_altq_z, altq); + free(altq, M_PFALTQ); } V_altqs_inactive_open = 0; return (error); @@ -619,7 +620,7 @@ pf_commit_altq(u_int32_t ticket) error = err; } else pf_qid_unref(altq->qid); - uma_zfree(V_pf_altq_z, altq); + free(altq, M_PFALTQ); } V_altqs_inactive_open = 0; @@ -695,7 +696,7 @@ pf_altq_ifnet_event(struct ifnet *ifp, i /* Copy the current active set */ TAILQ_FOREACH(a1, V_pf_altqs_active, entries) { - a2 = uma_zalloc(V_pf_altq_z, M_NOWAIT); + a2 = malloc(sizeof(*a2), M_PFALTQ, M_NOWAIT); if (a2 == NULL) { error = ENOMEM; break; @@ -705,7 +706,7 @@ pf_altq_ifnet_event(struct ifnet *ifp, i if (a2->qname[0] != 0) { if ((a2->qid = pf_qname2qid(a2->qname)) == 0) { error = EBUSY; - uma_zfree(V_pf_altq_z, a2); + free(a2, M_PFALTQ); break; } a2->altq_disc = NULL; @@ -729,7 +730,7 @@ pf_altq_ifnet_event(struct ifnet *ifp, i error = EBUSY; if (error) { - uma_zfree(V_pf_altq_z, a2); + free(a2, M_PFALTQ); break; } } @@ -2039,14 +2040,14 @@ DIOCGETSTATES_full: struct pf_altq *altq, *a; struct ifnet *ifp; - altq = uma_zalloc(V_pf_altq_z, M_WAITOK); + altq = malloc(sizeof(*altq), M_PFALTQ, M_WAITOK); bcopy(&pa->altq, altq, sizeof(struct pf_altq)); altq->local_flags = 0; PF_RULES_WLOCK(); if (pa->ticket != V_ticket_altqs_inactive) { PF_RULES_WUNLOCK(); - uma_zfree(V_pf_altq_z, altq); + free(altq, M_PFALTQ); error = EBUSY; break; } @@ -2059,7 +2060,7 @@ DIOCGETSTATES_full: if ((altq->qid = pf_qname2qid(altq->qname)) == 0) { PF_RULES_WUNLOCK(); error = EBUSY; - uma_zfree(V_pf_altq_z, altq); + free(altq, M_PFALTQ); break; } altq->altq_disc = NULL; @@ -2079,7 +2080,7 @@ DIOCGETSTATES_full: if (error) { PF_RULES_WUNLOCK(); - uma_zfree(V_pf_altq_z, altq); + free(altq, M_PFALTQ); break; } Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 09:47:19 2012 (r236552) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 09:55:47 2012 (r236553) @@ -1734,8 +1734,6 @@ VNET_DECLARE(uma_zone_t, pf_state_z); #define V_pf_state_z VNET(pf_state_z) VNET_DECLARE(uma_zone_t, pf_state_key_z); #define V_pf_state_key_z VNET(pf_state_key_z) -VNET_DECLARE(uma_zone_t, pf_altq_z); -#define V_pf_altq_z VNET(pf_altq_z) VNET_DECLARE(uma_zone_t, pf_pooladdr_z); #define V_pf_pooladdr_z VNET(pf_pooladdr_z) VNET_DECLARE(uma_zone_t, pfr_ktable_z); From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 10:09:57 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E0F7D106564A; Mon, 4 Jun 2012 10:09:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CBEB08FC12; Mon, 4 Jun 2012 10:09:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54A9vlW019442; Mon, 4 Jun 2012 10:09:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54A9v4A019437; Mon, 4 Jun 2012 10:09:57 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206041009.q54A9v4A019437@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 10:09:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236554 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 10:09:58 -0000 Author: glebius Date: Mon Jun 4 10:09:57 2012 New Revision: 236554 URL: http://svn.freebsd.org/changeset/base/236554 Log: Consistent names for pf(4) malloc(9) types. Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_if.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Mon Jun 4 09:55:47 2012 (r236553) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Mon Jun 4 10:09:57 2012 (r236554) @@ -238,7 +238,7 @@ struct pfsync_softc { #define PFSYNC_BUNLOCK(sc) mtx_unlock(&(sc)->sc_bulk_mtx) #define PFSYNC_BLOCK_ASSERT(sc) mtx_assert(&(sc)->sc_bulk_mtx, MA_OWNED) -static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync data"); +static MALLOC_DEFINE(M_PFSYNC, "pfsync(4)", "pfsync(4) data"); static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) static VNET_DEFINE(void *, pfsync_swi_cookie) = NULL; Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 09:55:47 2012 (r236553) +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 10:09:57 2012 (r236554) @@ -155,7 +155,7 @@ VNET_DEFINE(struct pf_anchor_stackframe, /* * Queue for pf_intr() sends. */ -MALLOC_DEFINE(M_PFTEMP, "pf temp", "pf(4) temporary allocations"); +static MALLOC_DEFINE(M_PFTEMP, "pf(4) temp", "pf(4) temporary allocations"); struct pf_send_entry { STAILQ_ENTRY(pf_send_entry) pfse_next; struct mbuf *pfse_m; @@ -350,7 +350,7 @@ VNET_DEFINE(struct pf_limit, pf_limits[P s->rule.ptr->states_cur--; \ } while (0) -MALLOC_DEFINE(M_PFHASH, "pf hashes", "pf(4) hash header structures"); +static MALLOC_DEFINE(M_PFHASH, "pf(4) hash", "pf(4) hash header structures"); /* XXXGL: make static? */ VNET_DEFINE(struct pf_keyhash *, pf_keyhash); VNET_DEFINE(struct pf_idhash *, pf_idhash); Modified: projects/pf/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_if.c Mon Jun 4 09:55:47 2012 (r236553) +++ projects/pf/head/sys/contrib/pf/net/pf_if.c Mon Jun 4 10:09:57 2012 (r236554) @@ -110,7 +110,7 @@ static VNET_DEFINE(struct pfi_ifhead, pf #define V_pfi_ifs VNET(pfi_ifs) #define PFI_BUFFER_MAX 0x10000 -MALLOC_DEFINE(PFI_MTYPE, "pf ifnets", "pf interface database"); +MALLOC_DEFINE(PFI_MTYPE, "pf(4) ifnets", "pf(4) interface database"); LIST_HEAD(pfi_list, pfi_kif); static VNET_DEFINE(struct pfi_list, pfi_unlinked_kifs); Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 09:55:47 2012 (r236553) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 10:09:57 2012 (r236554) @@ -157,8 +157,8 @@ TAILQ_HEAD(pf_tags, pf_tagname); VNET_DEFINE(struct pf_tags, pf_tags); #define V_pf_qids VNET(pf_qids) VNET_DEFINE(struct pf_tags, pf_qids); -MALLOC_DEFINE(M_PFTAG, "pf tags", "pf tags"); -MALLOC_DEFINE(M_PFALTQ, "pf(4) altq", "pf(4) altq configuration db"); +static MALLOC_DEFINE(M_PFTAG, "pf(4) tag", "pf(4) tag names"); +static MALLOC_DEFINE(M_PFALTQ, "pf(4) altq", "pf(4) altq configuration db"); #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 11:24:04 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 740A0106567B; Mon, 4 Jun 2012 11:24:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E6DC8FC21; Mon, 4 Jun 2012 11:24:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54BO48S038418; Mon, 4 Jun 2012 11:24:04 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54BO4Wq038414; Mon, 4 Jun 2012 11:24:04 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206041124.q54BO4Wq038414@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 11:24:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236556 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 11:24:04 -0000 Author: glebius Date: Mon Jun 4 11:24:03 2012 New Revision: 236556 URL: http://svn.freebsd.org/changeset/base/236556 Log: Rules and pool addresses are allocated during configuration only, no reason for separate uma(9) zones. Modified: projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pfvar.h Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 10:42:09 2012 (r236555) +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 11:24:03 2012 (r236556) @@ -191,8 +191,6 @@ VNET_DEFINE(struct pf_rulequeue, pf_unli struct mtx pf_unlnkdrules_mtx; VNET_DEFINE(uma_zone_t, pf_sources_z); -VNET_DEFINE(uma_zone_t, pf_rule_z); -VNET_DEFINE(uma_zone_t, pf_pooladdr_z); VNET_DEFINE(uma_zone_t, pf_state_z); VNET_DEFINE(uma_zone_t, pf_state_key_z); @@ -718,11 +716,6 @@ pf_initialize() mtx_init(&pf_unlnkdrules_mtx, "pf unlinked rules", NULL, MTX_DEF); /* XXXGL: sort this out */ - V_pf_rule_z = uma_zcreate("pf rules", sizeof(struct pf_rule), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_pooladdr_z = uma_zcreate("pf pool addresses", - sizeof(struct pf_pooladdr), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, - 0); V_pfr_ktable_z = uma_zcreate("pf tables", sizeof(struct pfr_ktable), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -770,10 +763,8 @@ pf_cleanup() mtx_destroy(&pf_unlnkdrules_mtx); uma_zdestroy(V_pf_sources_z); - uma_zdestroy(V_pf_rule_z); uma_zdestroy(V_pf_state_z); uma_zdestroy(V_pf_state_key_z); - uma_zdestroy(V_pf_pooladdr_z); uma_zdestroy(V_pfr_ktable_z); uma_zdestroy(V_pfr_kentry_z); } Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 10:42:09 2012 (r236555) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 11:24:03 2012 (r236556) @@ -159,6 +159,7 @@ VNET_DEFINE(struct pf_tags, pf_tags); VNET_DEFINE(struct pf_tags, pf_qids); static MALLOC_DEFINE(M_PFTAG, "pf(4) tag", "pf(4) tag names"); static MALLOC_DEFINE(M_PFALTQ, "pf(4) altq", "pf(4) altq configuration db"); +static MALLOC_DEFINE(M_PFRULE, "pf(4) rules", "pf(4) rules"); #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE @@ -381,7 +382,7 @@ pf_empty_pool(struct pf_palist *poola) if (pa->kif) pfi_kif_unref(pa->kif); TAILQ_REMOVE(poola, pa, entries); - uma_zfree(V_pf_pooladdr_z, pa); + free(pa, M_PFRULE); } } @@ -436,7 +437,7 @@ pf_free_rule(struct pf_rule *rule) pfi_kif_unref(rule->kif); pf_anchor_remove(rule); pf_empty_pool(&rule->rpool.list); - uma_zfree(V_pf_rule_z, rule); + free(rule, M_PFRULE); } static u_int16_t @@ -1185,7 +1186,7 @@ pfioctl(struct cdev *dev, u_long cmd, ca } #endif /* INET6 */ - rule = uma_zalloc(V_pf_rule_z, M_WAITOK); + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); bcopy(&pr->rule, rule, sizeof(struct pf_rule)); if (rule->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); @@ -1307,7 +1308,7 @@ pfioctl(struct cdev *dev, u_long cmd, ca #undef ERROUT DIOCADDRULE_error: PF_RULES_WUNLOCK(); - uma_zfree(V_pf_rule_z, rule); + free(rule, M_PFRULE); if (kif) free(kif, PFI_MTYPE); break; @@ -1434,7 +1435,7 @@ DIOCADDRULE_error: break; } #endif /* INET6 */ - newrule = uma_zalloc(V_pf_rule_z, M_WAITOK); + newrule = malloc(sizeof(*newrule), M_PFRULE, M_WAITOK); bcopy(&pcr->rule, newrule, sizeof(struct pf_rule)); newrule->cuid = td->td_ucred->cr_ruid; newrule->cpid = td->td_proc ? td->td_proc->p_pid : 0; @@ -1615,7 +1616,7 @@ DIOCADDRULE_error: DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); if (newrule != NULL) - uma_zfree(V_pf_rule_z, newrule); + free(newrule, M_PFRULE); if (kif != NULL) free(kif, PFI_MTYPE); break; @@ -2208,16 +2209,16 @@ DIOCGETSTATES_full: error = EINVAL; break; } - pa = uma_zalloc(V_pf_pooladdr_z, M_WAITOK); + pa = malloc(sizeof(*pa), M_PFRULE, M_WAITOK); bcopy(&pp->addr, pa, sizeof(struct pf_pooladdr)); if (pa->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); PF_RULES_WLOCK(); if (pp->ticket != V_ticket_pabuf) { PF_RULES_WUNLOCK(); - uma_zfree(V_pf_pooladdr_z, pa); if (pa->ifname[0]) free(kif, PFI_MTYPE); + free(pa, M_PFRULE); error = EBUSY; break; } @@ -2231,7 +2232,7 @@ DIOCGETSTATES_full: if (pa->ifname[0]) pfi_kif_unref(pa->kif); PF_RULES_WUNLOCK(); - uma_zfree(V_pf_pooladdr_z, pa); + free(pa, M_PFRULE); break; } TAILQ_INSERT_TAIL(&V_pf_pabuf, pa, entries); @@ -2321,7 +2322,7 @@ DIOCGETSTATES_full: break; } #endif /* INET6 */ - newpa = uma_zalloc(V_pf_pooladdr_z, M_WAITOK); + newpa = malloc(sizeof(*newpa), M_PFRULE, M_WAITOK); bcopy(&pca->addr, newpa, sizeof(struct pf_pooladdr)); if (newpa->ifname[0]) kif = malloc(sizeof(*kif), PFI_MTYPE, M_WAITOK); @@ -2361,7 +2362,7 @@ DIOCGETSTATES_full: if (newpa->kif) pfi_kif_unref(newpa->kif); PF_RULES_WUNLOCK(); - uma_zfree(V_pf_pooladdr_z, newpa); + free(newpa, M_PFRULE); break; } } @@ -2397,7 +2398,7 @@ DIOCGETSTATES_full: } if (oldpa->kif) pfi_kif_unref(oldpa->kif); - uma_zfree(V_pf_pooladdr_z, oldpa); + free(oldpa, M_PFRULE); } else { if (oldpa == NULL) TAILQ_INSERT_TAIL(&pool->list, newpa, entries); @@ -2419,7 +2420,7 @@ DIOCGETSTATES_full: DIOCCHANGEADDR_error: PF_RULES_WUNLOCK(); if (newpa != NULL) - uma_zfree(V_pf_pooladdr_z, newpa); + free(newpa, M_PFRULE); if (kif != NULL) free(kif, PFI_MTYPE); break; Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 10:42:09 2012 (r236555) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 11:24:03 2012 (r236556) @@ -1728,14 +1728,10 @@ extern void pf_calc_skip_steps(struct #ifdef ALTQ extern void pf_altq_ifnet_event(struct ifnet *, int); #endif -VNET_DECLARE(uma_zone_t, pf_rule_z); -#define V_pf_rule_z VNET(pf_rule_z) VNET_DECLARE(uma_zone_t, pf_state_z); #define V_pf_state_z VNET(pf_state_z) VNET_DECLARE(uma_zone_t, pf_state_key_z); #define V_pf_state_key_z VNET(pf_state_key_z) -VNET_DECLARE(uma_zone_t, pf_pooladdr_z); -#define V_pf_pooladdr_z VNET(pf_pooladdr_z) VNET_DECLARE(uma_zone_t, pfr_ktable_z); #define V_pfr_ktable_z VNET(pfr_ktable_z) VNET_DECLARE(uma_zone_t, pfr_kentry_z); From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 11:30:01 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA21B106566C; Mon, 4 Jun 2012 11:30:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id 48AA68FC0C; Mon, 4 Jun 2012 11:29:59 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q54BTkqg018554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 4 Jun 2012 21:29:48 +1000 Date: Mon, 4 Jun 2012 21:29:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff In-Reply-To: <201206041009.q54A9v4A019437@svn.freebsd.org> Message-ID: <20120604210548.Y1459@besplex.bde.org> References: <201206041009.q54A9v4A019437@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236554 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 11:30:01 -0000 On Mon, 4 Jun 2012, Gleb Smirnoff wrote: > Log: > Consistent names for pf(4) malloc(9) types. Many still have spaces in them. This breaks at least simple parsing of "vmstat -m" output using columns in awk (and postprocessing of vmstat -m output is more needed than orginally, since vmstat is now too stupid to even print the totals). A few bugs in this area have been fixed relatively recently. For example: file desc -> filedesc (matches original naming scheme -- no underscore) BIO buffer -> biobuf UFS mount -> ufs_mount (now just a style bug -- underscore) VM pgdata -> vm_pgdata * ihash -> [went away] struct cdev * -> [went away] cluster_save buffer -> [went away] (was also too long) [too many] -> [vmstat -z, with worse names and formatting] Now broken on ref10-i386: NFSCL diroffd NFS fh only. > Modified: projects/pf/head/sys/contrib/pf/net/pf.c > ============================================================================== > --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 09:55:47 2012 (r236553) > +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 10:09:57 2012 (r236554) > @@ -155,7 +155,7 @@ VNET_DEFINE(struct pf_anchor_stackframe, > /* > * Queue for pf_intr() sends. > */ > -MALLOC_DEFINE(M_PFTEMP, "pf temp", "pf(4) temporary allocations"); > +static MALLOC_DEFINE(M_PFTEMP, "pf(4) temp", "pf(4) temporary allocations"); > struct pf_send_entry { > STAILQ_ENTRY(pf_send_entry) pfse_next; > struct mbuf *pfse_m; > @@ -350,7 +350,7 @@ VNET_DEFINE(struct pf_limit, pf_limits[P > s->rule.ptr->states_cur--; \ > } while (0) > > -MALLOC_DEFINE(M_PFHASH, "pf hashes", "pf(4) hash header structures"); > +static MALLOC_DEFINE(M_PFHASH, "pf(4) hash", "pf(4) hash header structures"); > /* XXXGL: make static? */ > VNET_DEFINE(struct pf_keyhash *, pf_keyhash); > VNET_DEFINE(struct pf_idhash *, pf_idhash); Space after "pf(4)" The punctuation might be hard to parse too. The verbose descriptions made it reasonable for the short descriptions to be even shorter, but they are mostly longer. Others similarly. Bruce From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 11:51:18 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0390B106564A; Mon, 4 Jun 2012 11:51:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E22968FC15; Mon, 4 Jun 2012 11:51:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54BpHgb039540; Mon, 4 Jun 2012 11:51:17 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54BpHYs039537; Mon, 4 Jun 2012 11:51:17 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206041151.q54BpHYs039537@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 11:51:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236557 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 11:51:18 -0000 Author: glebius Date: Mon Jun 4 11:51:17 2012 New Revision: 236557 URL: http://svn.freebsd.org/changeset/base/236557 Log: Add missing locking to pfsync_timeout(). Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Mon Jun 4 11:24:03 2012 (r236556) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Mon Jun 4 11:51:17 2012 (r236557) @@ -2191,7 +2191,9 @@ pfsync_timeout(void *arg) struct pfsync_softc *sc = arg; CURVNET_SET(sc->sc_ifp->if_vnet); + PFSYNC_LOCK(sc); pfsync_push(sc); + PFSYNC_UNLOCK(sc); CURVNET_RESTORE(); } From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 12:28:58 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 28BCF1065672; Mon, 4 Jun 2012 12:28:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F4DC8FC1C; Mon, 4 Jun 2012 12:28:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54CSvst041168; Mon, 4 Jun 2012 12:28:57 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54CSvqX041144; Mon, 4 Jun 2012 12:28:57 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206041228.q54CSvqX041144@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 12:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236558 - in projects/pf/head: . contrib/bind9 contrib/bind9/bin/named contrib/bind9/bin/named/unix contrib/bind9/lib/bind9 contrib/bind9/lib/dns contrib/bind9/lib/dns/include/dns contr... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 12:28:58 -0000 Author: glebius Date: Mon Jun 4 12:28:56 2012 New Revision: 236558 URL: http://svn.freebsd.org/changeset/base/236558 Log: Merge head r233826 through r236557. Added: projects/pf/head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c - copied unchanged from r236557, head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c projects/pf/head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.h - copied unchanged from r236557, head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.h projects/pf/head/sys/kern/kern_rangelock.c - copied unchanged from r236557, head/sys/kern/kern_rangelock.c projects/pf/head/sys/modules/netmap/ - copied from r236557, head/sys/modules/netmap/ projects/pf/head/sys/powerpc/booke/machdep_e500.c - copied unchanged from r236557, head/sys/powerpc/booke/machdep_e500.c projects/pf/head/sys/powerpc/booke/machdep_ppc4xx.c - copied unchanged from r236557, head/sys/powerpc/booke/machdep_ppc4xx.c projects/pf/head/sys/powerpc/include/machdep.h - copied unchanged from r236557, head/sys/powerpc/include/machdep.h projects/pf/head/sys/sys/rangelock.h - copied unchanged from r236557, head/sys/sys/rangelock.h projects/pf/head/tools/build/make_check/check.mk - copied unchanged from r236557, head/tools/build/make_check/check.mk projects/pf/head/tools/regression/usr.bin/make/test-new.mk - copied unchanged from r236557, head/tools/regression/usr.bin/make/test-new.mk projects/pf/head/tools/regression/usr.bin/make/variables/opt_V/ - copied from r236557, head/tools/regression/usr.bin/make/variables/opt_V/ projects/pf/head/usr.sbin/pciconf/err.c - copied unchanged from r236557, head/usr.sbin/pciconf/err.c Deleted: projects/pf/head/etc/pam.d/kde Modified: projects/pf/head/Makefile.inc1 projects/pf/head/ObsoleteFiles.inc projects/pf/head/contrib/bind9/CHANGES projects/pf/head/contrib/bind9/README projects/pf/head/contrib/bind9/bin/named/builtin.c projects/pf/head/contrib/bind9/bin/named/query.c projects/pf/head/contrib/bind9/bin/named/server.c projects/pf/head/contrib/bind9/bin/named/unix/dlz_dlopen_driver.c projects/pf/head/contrib/bind9/lib/bind9/api projects/pf/head/contrib/bind9/lib/bind9/check.c projects/pf/head/contrib/bind9/lib/dns/api projects/pf/head/contrib/bind9/lib/dns/dnssec.c projects/pf/head/contrib/bind9/lib/dns/include/dns/ecdb.h projects/pf/head/contrib/bind9/lib/dns/include/dns/rpz.h projects/pf/head/contrib/bind9/lib/dns/include/dns/sdb.h projects/pf/head/contrib/bind9/lib/dns/include/dns/stats.h projects/pf/head/contrib/bind9/lib/dns/include/dns/tsec.h projects/pf/head/contrib/bind9/lib/dns/include/dns/view.h projects/pf/head/contrib/bind9/lib/dns/rbtdb.c projects/pf/head/contrib/bind9/lib/dns/resolver.c projects/pf/head/contrib/bind9/lib/dns/sdb.c projects/pf/head/contrib/bind9/lib/dns/tkey.c projects/pf/head/contrib/bind9/lib/dns/zone.c projects/pf/head/contrib/bind9/lib/isc/pthreads/mutex.c projects/pf/head/contrib/bind9/lib/isccfg/api projects/pf/head/contrib/bind9/lib/isccfg/parser.c projects/pf/head/contrib/bind9/version projects/pf/head/contrib/gcc/config/sparc/freebsd.h projects/pf/head/contrib/groff/tmac/doc-common projects/pf/head/contrib/libc++/include/__bit_reference projects/pf/head/contrib/llvm/include/llvm/Support/FileSystem.h projects/pf/head/contrib/llvm/lib/Support/Unix/PathV2.inc projects/pf/head/contrib/llvm/lib/Support/Windows/PathV2.inc projects/pf/head/contrib/llvm/tools/bugpoint/ToolRunner.cpp projects/pf/head/contrib/llvm/tools/clang/lib/Driver/Tools.cpp projects/pf/head/contrib/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp projects/pf/head/crypto/openssl/crypto/buffer/buffer.c projects/pf/head/crypto/openssl/ssl/s3_srvr.c projects/pf/head/etc/defaults/periodic.conf projects/pf/head/etc/pam.d/Makefile projects/pf/head/gnu/lib/libsupc++/Version.map projects/pf/head/kerberos5/Makefile.inc projects/pf/head/kerberos5/lib/libasn1/Makefile projects/pf/head/kerberos5/lib/libgssapi_krb5/Makefile projects/pf/head/kerberos5/lib/libgssapi_ntlm/Makefile projects/pf/head/kerberos5/lib/libgssapi_spnego/Makefile projects/pf/head/kerberos5/lib/libhdb/Makefile projects/pf/head/kerberos5/lib/libheimbase/Makefile projects/pf/head/kerberos5/lib/libheimipcc/Makefile projects/pf/head/kerberos5/lib/libheimipcs/Makefile projects/pf/head/kerberos5/lib/libhx509/Makefile projects/pf/head/kerberos5/lib/libkadm5clnt/Makefile projects/pf/head/kerberos5/lib/libkadm5srv/Makefile projects/pf/head/kerberos5/lib/libkafs5/Makefile projects/pf/head/kerberos5/lib/libkdc/Makefile projects/pf/head/kerberos5/lib/libkrb5/Makefile projects/pf/head/kerberos5/lib/libroken/Makefile projects/pf/head/kerberos5/lib/libvers/Makefile projects/pf/head/kerberos5/libexec/hprop/Makefile projects/pf/head/kerberos5/libexec/kadmind/Makefile projects/pf/head/kerberos5/libexec/kcm/Makefile projects/pf/head/kerberos5/libexec/kdigest/Makefile projects/pf/head/kerberos5/libexec/kfd/Makefile projects/pf/head/kerberos5/tools/asn1_compile/Makefile projects/pf/head/kerberos5/tools/slc/Makefile projects/pf/head/kerberos5/usr.bin/hxtool/Makefile projects/pf/head/kerberos5/usr.bin/kadmin/Makefile projects/pf/head/kerberos5/usr.bin/kcc/Makefile projects/pf/head/kerberos5/usr.bin/kf/Makefile projects/pf/head/kerberos5/usr.bin/string2key/Makefile projects/pf/head/kerberos5/usr.sbin/iprop-log/Makefile projects/pf/head/kerberos5/usr.sbin/ktutil/Makefile projects/pf/head/lib/bind/dns/code.h projects/pf/head/lib/bind/dns/dns/enumtype.h projects/pf/head/lib/bind/dns/dns/rdatastruct.h projects/pf/head/lib/libc++/Makefile projects/pf/head/lib/libc/gen/getnetgrent.c projects/pf/head/lib/libc/gen/posix_spawnattr_getflags.3 projects/pf/head/lib/libc/stdio/fpurge.c projects/pf/head/lib/libc/sys/stat.2 projects/pf/head/lib/libcrypt/crypt.3 projects/pf/head/lib/libcxxrt/Makefile projects/pf/head/lib/libelf/elf.3 projects/pf/head/lib/libelf/gelf.3 projects/pf/head/lib/libfetch/common.c projects/pf/head/lib/libgpib/gpib.3 projects/pf/head/lib/libkiconv/Makefile projects/pf/head/lib/libncp/ncpl_nls.c projects/pf/head/lib/libpmc/pmc.3 projects/pf/head/lib/libusb/libusb20.3 projects/pf/head/sbin/camcontrol/camcontrol.8 projects/pf/head/sbin/camcontrol/camcontrol.c projects/pf/head/sbin/devd/devd.cc projects/pf/head/sbin/fsck_msdosfs/main.c projects/pf/head/sbin/hastd/primary.c projects/pf/head/sbin/ifconfig/ifconfig.8 projects/pf/head/sbin/ifconfig/ifconfig.c projects/pf/head/sbin/ifconfig/iflagg.c projects/pf/head/sbin/mca/Makefile projects/pf/head/sbin/mca/mca.c projects/pf/head/sbin/restore/utilities.c projects/pf/head/sbin/setkey/setkey.8 projects/pf/head/secure/lib/libcrypt/crypt-des.c projects/pf/head/share/man/man4/Makefile projects/pf/head/share/man/man4/acpi_panasonic.4 projects/pf/head/share/man/man4/ahci.4 projects/pf/head/share/man/man4/ata.4 projects/pf/head/share/man/man4/bce.4 projects/pf/head/share/man/man4/carp.4 projects/pf/head/share/man/man4/firewire.4 projects/pf/head/share/man/man4/man4.i386/sbni.4 projects/pf/head/share/man/man4/mps.4 projects/pf/head/share/man/man4/mvs.4 projects/pf/head/share/man/man4/siis.4 projects/pf/head/share/man/man4/snd_hda.4 projects/pf/head/share/man/man4/usb.4 projects/pf/head/share/man/man4/witness.4 projects/pf/head/share/man/man5/devfs.conf.5 projects/pf/head/share/man/man5/devfs.rules.5 projects/pf/head/share/man/man5/periodic.conf.5 projects/pf/head/share/man/man5/src.conf.5 projects/pf/head/share/man/man7/release.7 projects/pf/head/share/man/man9/locking.9 projects/pf/head/share/misc/committers-ports.dot projects/pf/head/share/mk/bsd.sys.mk projects/pf/head/sys/amd64/acpica/acpi_wakeup.c projects/pf/head/sys/amd64/amd64/minidump_machdep.c projects/pf/head/sys/amd64/amd64/pmap.c projects/pf/head/sys/amd64/include/atomic.h projects/pf/head/sys/arm/arm/db_trace.c projects/pf/head/sys/arm/arm/locore.S projects/pf/head/sys/arm/at91/at91.c projects/pf/head/sys/arm/at91/at91_machdep.c projects/pf/head/sys/arm/at91/at91_pmc.c projects/pf/head/sys/arm/at91/at91_reset.S projects/pf/head/sys/arm/at91/at91_spi.c projects/pf/head/sys/arm/at91/at91_spireg.h projects/pf/head/sys/arm/at91/at91rm92reg.h projects/pf/head/sys/arm/at91/at91sam9260reg.h projects/pf/head/sys/arm/at91/at91sam9g20reg.h projects/pf/head/sys/arm/at91/at91var.h projects/pf/head/sys/arm/at91/std.ethernut5 projects/pf/head/sys/arm/at91/std.hl200 projects/pf/head/sys/arm/at91/std.hl201 projects/pf/head/sys/arm/at91/std.kb920x projects/pf/head/sys/arm/at91/std.qila9g20 projects/pf/head/sys/arm/at91/std.sam9g20ek projects/pf/head/sys/arm/conf/ETHERNUT5 projects/pf/head/sys/arm/conf/ETHERNUT5.hints projects/pf/head/sys/arm/econa/econa_machdep.c projects/pf/head/sys/arm/include/cpu.h projects/pf/head/sys/arm/include/kdb.h projects/pf/head/sys/arm/mv/mv_machdep.c projects/pf/head/sys/arm/s3c2xx0/s3c24x0_machdep.c projects/pf/head/sys/arm/sa11x0/assabet_machdep.c projects/pf/head/sys/arm/xscale/i80321/ep80219_machdep.c projects/pf/head/sys/arm/xscale/i80321/iq31244_machdep.c projects/pf/head/sys/arm/xscale/i8134x/crb_machdep.c projects/pf/head/sys/arm/xscale/ixp425/avila_machdep.c projects/pf/head/sys/arm/xscale/pxa/pxa_machdep.c projects/pf/head/sys/boot/i386/boot2/boot2.c projects/pf/head/sys/boot/i386/libi386/biospnp.c projects/pf/head/sys/cam/ata/ata_da.c projects/pf/head/sys/cam/ata/ata_xpt.c projects/pf/head/sys/cam/cam_ccb.h projects/pf/head/sys/cam/cam_xpt.c projects/pf/head/sys/cam/ctl/scsi_ctl.c projects/pf/head/sys/cam/scsi/scsi_xpt.c projects/pf/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c projects/pf/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c projects/pf/head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c projects/pf/head/sys/compat/ndis/subr_ntoskrnl.c projects/pf/head/sys/conf/NOTES projects/pf/head/sys/conf/files projects/pf/head/sys/conf/files.powerpc projects/pf/head/sys/conf/options.arm projects/pf/head/sys/dev/acpica/Osd/OsdSynch.c projects/pf/head/sys/dev/acpica/acpi.c projects/pf/head/sys/dev/acpica/acpi_ec.c projects/pf/head/sys/dev/acpica/acpivar.h projects/pf/head/sys/dev/ahci/ahci.c projects/pf/head/sys/dev/ata/ata-all.c projects/pf/head/sys/dev/bge/if_bge.c projects/pf/head/sys/dev/drm2/i915/i915_gem.c projects/pf/head/sys/dev/drm2/i915/i915_gem_execbuffer.c projects/pf/head/sys/dev/e1000/if_igb.c projects/pf/head/sys/dev/flash/at45d.c projects/pf/head/sys/dev/hptiop/hptiop.c projects/pf/head/sys/dev/hptmv/entry.c projects/pf/head/sys/dev/isp/isp.c projects/pf/head/sys/dev/isp/isp_freebsd.c projects/pf/head/sys/dev/isp/isp_freebsd.h projects/pf/head/sys/dev/isp/isp_pci.c projects/pf/head/sys/dev/isp/isp_sbus.c projects/pf/head/sys/dev/isp/ispvar.h projects/pf/head/sys/dev/iwn/if_iwn.c projects/pf/head/sys/dev/mfi/mfi_disk.c projects/pf/head/sys/dev/mmc/mmc.c projects/pf/head/sys/dev/mmc/mmcsd.c projects/pf/head/sys/dev/mxge/eth_z8e.h projects/pf/head/sys/dev/mxge/ethp_z8e.h projects/pf/head/sys/dev/mxge/rss_eth_z8e.h projects/pf/head/sys/dev/mxge/rss_ethp_z8e.h projects/pf/head/sys/dev/puc/pucdata.c projects/pf/head/sys/dev/sym/sym_hipd.c projects/pf/head/sys/dev/usb/usb_device.c projects/pf/head/sys/dev/usb/usb_generic.c projects/pf/head/sys/dev/usb/wlan/if_rum.c projects/pf/head/sys/dev/usb/wlan/if_run.c projects/pf/head/sys/dev/usb/wlan/if_ural.c projects/pf/head/sys/dev/vxge/vxgehal/vxgehal-channel.h projects/pf/head/sys/dev/wbwd/wbwd.c projects/pf/head/sys/dev/wpi/if_wpi.c projects/pf/head/sys/fs/nandfs/nandfs_cleaner.c projects/pf/head/sys/fs/nfsclient/nfs_clbio.c projects/pf/head/sys/i386/acpica/acpi_wakeup.c projects/pf/head/sys/i386/i386/bios.c projects/pf/head/sys/i386/i386/minidump_machdep.c projects/pf/head/sys/i386/i386/pmap.c projects/pf/head/sys/i386/include/atomic.h projects/pf/head/sys/i386/xen/pmap.c projects/pf/head/sys/ia64/acpica/acpi_wakeup.c projects/pf/head/sys/ia64/ia64/pmap.c projects/pf/head/sys/kern/capabilities.conf projects/pf/head/sys/kern/init_main.c projects/pf/head/sys/kern/init_sysent.c projects/pf/head/sys/kern/kern_shutdown.c projects/pf/head/sys/kern/kern_thread.c projects/pf/head/sys/kern/subr_rman.c projects/pf/head/sys/kern/subr_syscall.c projects/pf/head/sys/kern/vfs_bio.c projects/pf/head/sys/kern/vfs_subr.c projects/pf/head/sys/kern/vfs_vnops.c projects/pf/head/sys/modules/Makefile projects/pf/head/sys/modules/cxgb/cxgb/Makefile projects/pf/head/sys/modules/ixgbe/Makefile projects/pf/head/sys/modules/wpi/Makefile projects/pf/head/sys/net/bpf.c projects/pf/head/sys/net/if.h projects/pf/head/sys/net/if_lagg.c projects/pf/head/sys/net/if_loop.c projects/pf/head/sys/netinet/ip_carp.c projects/pf/head/sys/netinet/sctp_asconf.c projects/pf/head/sys/netinet/sctp_input.c projects/pf/head/sys/netinet/sctp_output.c projects/pf/head/sys/netinet/sctp_pcb.c projects/pf/head/sys/netinet/sctputil.c projects/pf/head/sys/netinet/sctputil.h projects/pf/head/sys/netinet/tcp_input.c projects/pf/head/sys/netinet/tcp_lro.c projects/pf/head/sys/netinet/tcp_output.c projects/pf/head/sys/netinet/tcp_subr.c projects/pf/head/sys/netinet/tcp_syncache.c projects/pf/head/sys/netinet/tcp_timewait.c projects/pf/head/sys/netinet6/in6.c projects/pf/head/sys/netinet6/ip6_forward.c projects/pf/head/sys/netinet6/ip6_input.c projects/pf/head/sys/netinet6/ip6_ipsec.c projects/pf/head/sys/netinet6/ip6_output.c projects/pf/head/sys/netinet6/udp6_usrreq.c projects/pf/head/sys/netncp/ncp_nls.h projects/pf/head/sys/powerpc/booke/machdep.c projects/pf/head/sys/powerpc/booke/platform_bare.c projects/pf/head/sys/sparc64/include/pmap.h projects/pf/head/sys/sparc64/sparc64/pmap.c projects/pf/head/sys/sparc64/sparc64/tsb.c projects/pf/head/sys/sys/buf.h projects/pf/head/sys/sys/mbuf.h projects/pf/head/sys/sys/mount.h projects/pf/head/sys/sys/param.h projects/pf/head/sys/sys/proc.h projects/pf/head/sys/sys/vnode.h projects/pf/head/sys/ufs/ffs/ffs_vfsops.c projects/pf/head/sys/ufs/ffs/ffs_vnops.c projects/pf/head/sys/x86/x86/dump_machdep.c projects/pf/head/tools/build/options/makeman projects/pf/head/usr.bin/calendar/calendars/calendar.freebsd projects/pf/head/usr.bin/chat/chat.c projects/pf/head/usr.bin/find/find.1 projects/pf/head/usr.bin/ktrace/ktrace.1 projects/pf/head/usr.bin/ktrace/ktrace.h projects/pf/head/usr.bin/mail/popen.c projects/pf/head/usr.bin/make/Makefile projects/pf/head/usr.bin/make/make.1 projects/pf/head/usr.bin/make/var.c projects/pf/head/usr.bin/man/man.conf.5 projects/pf/head/usr.bin/unzip/unzip.c projects/pf/head/usr.sbin/adduser/rmuser.8 projects/pf/head/usr.sbin/arp/arp.4 projects/pf/head/usr.sbin/bluetooth/bthidcontrol/bthidcontrol.8 projects/pf/head/usr.sbin/bluetooth/btpand/btpand.8 projects/pf/head/usr.sbin/bluetooth/hccontrol/hccontrol.8 projects/pf/head/usr.sbin/bluetooth/l2control/l2control.8 projects/pf/head/usr.sbin/bluetooth/sdpcontrol/sdpcontrol.8 projects/pf/head/usr.sbin/cpucontrol/amd.c projects/pf/head/usr.sbin/ctladm/ctladm.8 projects/pf/head/usr.sbin/daemon/daemon.8 projects/pf/head/usr.sbin/daemon/daemon.c projects/pf/head/usr.sbin/digictl/digictl.8 projects/pf/head/usr.sbin/fwcontrol/fwcontrol.8 projects/pf/head/usr.sbin/gssd/gssd.8 projects/pf/head/usr.sbin/jail/command.c projects/pf/head/usr.sbin/jail/jail.8 projects/pf/head/usr.sbin/jail/jail.c projects/pf/head/usr.sbin/jail/jail.conf.5 projects/pf/head/usr.sbin/jail/jailp.h projects/pf/head/usr.sbin/lpr/lpr/lpr.c projects/pf/head/usr.sbin/mptutil/mpt_show.c projects/pf/head/usr.sbin/ndiscvt/ndiscvt.8 projects/pf/head/usr.sbin/newsyslog/newsyslog.8 projects/pf/head/usr.sbin/pc-sysinstall/backend/functions-localize.sh projects/pf/head/usr.sbin/pc-sysinstall/backend/functions.sh projects/pf/head/usr.sbin/pciconf/Makefile projects/pf/head/usr.sbin/pciconf/cap.c projects/pf/head/usr.sbin/pciconf/pciconf.8 projects/pf/head/usr.sbin/pciconf/pciconf.c projects/pf/head/usr.sbin/pciconf/pciconf.h projects/pf/head/usr.sbin/pkg_install/add/main.c projects/pf/head/usr.sbin/pkg_install/add/perform.c projects/pf/head/usr.sbin/pkg_install/add/pkg_add.1 projects/pf/head/usr.sbin/pkg_install/lib/exec.c projects/pf/head/usr.sbin/pkg_install/lib/file.c projects/pf/head/usr.sbin/pkg_install/lib/lib.h projects/pf/head/usr.sbin/pkg_install/lib/msg.c projects/pf/head/usr.sbin/pkg_install/lib/url.c projects/pf/head/usr.sbin/pmcstat/pmcstat.8 projects/pf/head/usr.sbin/setfib/setfib.1 projects/pf/head/usr.sbin/syslogd/syslogd.8 Directory Properties: projects/pf/head/ (props changed) projects/pf/head/contrib/bind9/ (props changed) projects/pf/head/contrib/gcc/ (props changed) projects/pf/head/contrib/groff/ (props changed) projects/pf/head/contrib/libc++/ (props changed) projects/pf/head/contrib/llvm/ (props changed) projects/pf/head/contrib/llvm/tools/clang/ (props changed) projects/pf/head/crypto/openssl/ (props changed) projects/pf/head/gnu/lib/ (props changed) projects/pf/head/lib/libc/ (props changed) projects/pf/head/sbin/ (props changed) projects/pf/head/share/man/man4/ (props changed) projects/pf/head/sys/ (props changed) projects/pf/head/sys/boot/ (props changed) projects/pf/head/sys/cddl/contrib/opensolaris/ (props changed) projects/pf/head/sys/conf/ (props changed) projects/pf/head/sys/contrib/pf/ (props changed) projects/pf/head/tools/regression/usr.bin/make/all.sh (props changed) projects/pf/head/usr.bin/calendar/ (props changed) projects/pf/head/usr.sbin/jail/ (props changed) projects/pf/head/usr.sbin/ndiscvt/ (props changed) Modified: projects/pf/head/Makefile.inc1 ============================================================================== --- projects/pf/head/Makefile.inc1 Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/Makefile.inc1 Mon Jun 4 12:28:56 2012 (r236558) @@ -242,7 +242,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ SSP_CFLAGS= \ -DWITHOUT_HTML -DWITHOUT_INFO -DNO_LINT -DWITHOUT_MAN \ -DNO_PIC -DNO_PROFILE -DNO_SHARED \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ @@ -252,7 +252,7 @@ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ -DNO_LINT \ - -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF + -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF -DEARLY_BUILD # cross-tools stage XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE} \ @@ -487,7 +487,8 @@ build32: .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw lib/libmagic cd ${.CURDIR}/${_dir}; \ MAKEOBJDIRPREFIX=${OBJTREE}/lib32 ${MAKE} SSP_CFLAGS= DESTDIR= \ - DIRPRFX=${_dir}/ build-tools + DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS -DNO_WARNS -DNO_CTF \ + -DEARLY_BUILD build-tools .endfor cd ${.CURDIR}; \ ${LIB32WMAKE} -f Makefile.inc1 libraries @@ -829,7 +830,7 @@ buildkernel: cd ${KRNLOBJDIR}/${_kernel}; \ PATH=${BPATH}:${PATH} \ MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \ - ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \ + ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD \ -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules) @@ -837,7 +838,7 @@ buildkernel: cd ${KERNSRCDIR}/modules/aic7xxx/aicasm; \ PATH=${BPATH}:${PATH} \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ - ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF ${target} + ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF -DEARLY_BUILD ${target} .endfor .endif .if !defined(NO_KERNELDEPEND) Modified: projects/pf/head/ObsoleteFiles.inc ============================================================================== --- projects/pf/head/ObsoleteFiles.inc Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/ObsoleteFiles.inc Mon Jun 4 12:28:56 2012 (r236558) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20120530: kde pam lives now in ports +OLD_FILES+=/etc/pam.d/kde # 20120505: new clang import installed a redundant internal header OLD_FILES+=usr/include/clang/3.1/stdalign.h # 20120428: MD2 removed from libmd Modified: projects/pf/head/contrib/bind9/CHANGES ============================================================================== --- projects/pf/head/contrib/bind9/CHANGES Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/CHANGES Mon Jun 4 12:28:56 2012 (r236558) @@ -1,3 +1,56 @@ + --- 9.8.3 released --- + +3318. [tuning] Reduce the amount of work performed while holding a + bucket lock when finshed with a fetch context. + [RT #29239] + +3314. [bug] The masters list could be updated while refesh_callback + and stub_callback were using it. [RT #26732] + +3313. [protocol] Add TLSA record type. [RT #28989] + +3312. [bug] named-checkconf didn't detect a bad dns64 clients acl. + [RT #27631] + +3311. [bug] Abort the zone dump if zone->db is NULL in + zone.c:zone_gotwritehandle. [RT #29028] + +3310. [test] Increase table size for mutex profiling. [RT #28809] + +3309. [bug] resolver.c:fctx_finddone() was not threadsafe. + [RT #27995] + +3307. [bug] Add missing ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS. + [RT #28956] + +3306. [bug] Improve DNS64 reverse zone performance. [RT #28563] + +3305. [func] Add wire format lookup method to sdb. [RT #28563] + +3304. [bug] Use hmctx, not mctx when freeing rbtdb->heaps. + [RT #28571] + +3302. [bug] dns_dnssec_findmatchingkeys could fail to find + keys if the zone name contained character that + required special mappings. [RT #28600] + +3301. [contrib] Update queryperf to build on darwin. Add -R flag + for non-recursive queries. [RT #28565] + +3300. [bug] Named could die if gssapi was enabled in named.conf + but was not compiled in. [RT #28338] + +3299. [bug] Make SDB handle errors from database drivers better. + [RT #28534] + +3232. [bug] Zero zone->curmaster before return in + dns_zone_setmasterswithkeys(). [RT #26732] + +3183. [bug] Added RTLD_GLOBAL flag to dlopen call. [RT #26301] + +3197. [bug] Don't try to log the filename and line number when + the config parser can't open a file. [RT #22263] + --- 9.8.2 released --- 3298. [bug] Named could dereference a NULL pointer in @@ -58,9 +111,9 @@ 3274. [bug] Log when a zone is not reusable. Only set loadtime on successful loads. [RT #27650] -3273. [bug] AAAA responses could be returned in the additional - section even when filter-aaaa-on-v4 was in use. - [RT #27292] +3273. [bug] AAAA responses could be returned in the additional + section even when filter-aaaa-on-v4 was in use. + [RT #27292] 3271. [port] darwin: mksymtbl is not always stable, loop several times before giving up. mksymtbl was using non Modified: projects/pf/head/contrib/bind9/README ============================================================================== --- projects/pf/head/contrib/bind9/README Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/README Mon Jun 4 12:28:56 2012 (r236558) @@ -51,6 +51,10 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes +BIND 9.8.3 + + BIND 9.8.3 is a maintenance release. + BIND 9.8.2 BIND 9.8.2 includes a number of bug fixes and prevents a security Modified: projects/pf/head/contrib/bind9/bin/named/builtin.c ============================================================================== --- projects/pf/head/contrib/bind9/bin/named/builtin.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/bin/named/builtin.c Mon Jun 4 12:28:56 2012 (r236558) @@ -69,35 +69,79 @@ static builtin_t empty_builtin = { do_em static builtin_t dns64_builtin = { do_dns64_lookup, NULL, NULL }; static dns_sdbimplementation_t *builtin_impl; +static dns_sdbimplementation_t *dns64_impl; -static const char hex[] = "0123456789abcdef"; -static const char HEX[] = "0123456789ABCDEF"; +/* + * Pre computed HEX * 16 or 1 table. + */ +static const unsigned char hex16[256] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*00*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*10*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*20*/ + 0, 16, 32, 48, 64, 80, 96,112,128,144, 1, 1, 1, 1, 1, 1, /*30*/ + 1,160,176,192,208,224,240, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*40*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*50*/ + 1,160,176,192,208,224,240, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*60*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*70*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*80*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*90*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*A0*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*B0*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*C0*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*D0*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /*E0*/ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 /*F0*/ +}; + +const unsigned char decimal[] = "0123456789"; + +static size_t +dns64_rdata(unsigned char *v, size_t start, unsigned char *rdata) { + size_t i, j = 0; + + for (i = 0; i < 4; i++) { + unsigned char c = v[start++]; + if (start == 7) + start++; + if (c > 99) { + rdata[j++] = 3; + rdata[j++] = decimal[c/100]; c = c % 100; + rdata[j++] = decimal[c/10]; c = c % 10; + rdata[j++] = decimal[c]; + } else if (c > 9) { + rdata[j++] = 2; + rdata[j++] = decimal[c/10]; c = c % 10; + rdata[j++] = decimal[c]; + } else { + rdata[j++] = 1; + rdata[j++] = decimal[c]; + } + } + memcpy(&rdata[j], "\07in-addr\04arpa", 14); + return (j + 14); +} static isc_result_t -dns64_cname(const char *zone, const char *name, dns_sdblookup_t *lookup) { - size_t zlen, nlen, j; - const char *s; - unsigned char v[16]; +dns64_cname(const dns_name_t *zone, const dns_name_t *name, + dns_sdblookup_t *lookup) +{ + size_t zlen, nlen, j, len; + unsigned char v[16], n; unsigned int i; - char reverse[sizeof("123.123.123.123.in-addr.arpa.")]; + unsigned char rdata[sizeof("123.123.123.123.in-addr.arpa.")]; + unsigned char *ndata; /* - * The sum the length of the relative name and the length of the zone - * name for a IPv6 reverse lookup comes to 71. - * - * The reverse of 2001::10.0.0.1 (dns64 2001::/96) has a zone of - * "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1.0.0.2.ip6.arpa" - * and a name of "1.0.0.0.0.0.a.0". The sum of the lengths of these - * two strings is 71. + * The combined length of the zone and name is 74. * - * The minimum length for a ip6.arpa zone name is 8. + * The minimum zone length is 10 ((3)ip6(4)arpa(0)). * - * The length of name should always be odd as we are expecting + * The length of name should always be even as we are expecting * a series of nibbles. */ - zlen = strlen(zone); - nlen = strlen(name); - if ((zlen + nlen) > 71U || zlen < 8U || (nlen % 2) != 1U) + zlen = zone->length; + nlen = name->length; + if ((zlen + nlen) > 74U || zlen < 10U || (nlen % 2) != 0U) return (ISC_R_NOTFOUND); /* @@ -116,25 +160,20 @@ dns64_cname(const char *zone, const char * are byte aligned and we correctly return ISC_R_NOTFOUND or * ISC_R_SUCCESS. We will not generate a CNAME in this case. */ - i = (nlen % 4) == 1U ? 1 : 0; + ndata = name->ndata; + i = (nlen % 4) == 2U ? 1 : 0; j = nlen; memset(v, 0, sizeof(v)); - while (j >= 1U) { + while (j != 0) { INSIST((i/2) < sizeof(v)); - if (j > 1U && name[1] != '.') + if (ndata[0] != 1) return (ISC_R_NOTFOUND); - v[i/2] >>= 4; - if ((s = strchr(hex, name[0])) != NULL) - v[i/2] |= (s - hex) << 4; - else if ((s = strchr(HEX, name[0])) != NULL) - v[i/2] |= (s - HEX) << 4; - else + n = hex16[ndata[1]&0xff]; + if (n == 1) return (ISC_R_NOTFOUND); - if (j > 1U) - j -= 2; - else - j -= 1; - name += 2; + v[i/2] = n | (v[i/2]>>4); + j -= 2; + ndata += 2; i++; } @@ -144,90 +183,91 @@ dns64_cname(const char *zone, const char * it corresponds to a empty node in the zone or there should be * a CNAME. */ +#define ZLEN(x) (10 + (x)/2) switch (zlen) { - case 24: /* prefix len 32 */ + case ZLEN(32): /* prefix len 32 */ + /* + * The nibbles that map to this byte must be zero for 'name' + * to exist in the zone. + */ + if (nlen > 16U && v[(nlen-1)/4 - 4] != 0) + return (ISC_R_NOTFOUND); /* - * If the total length is not 71 then this is a empty node + * If the total length is not 74 then this is a empty node * so return success. */ - if (nlen + zlen != 71U) + if (nlen + zlen != 74U) return (ISC_R_SUCCESS); - snprintf(reverse, sizeof(reverse), "%u.%u.%u.%u.in-addr.arpa.", - v[8], v[9], v[10], v[11]); + len = dns64_rdata(v, 8, rdata); break; - case 28: /* prefix len 40 */ + case ZLEN(40): /* prefix len 40 */ /* * The nibbles that map to this byte must be zero for 'name' * to exist in the zone. */ - if (nlen > 11U && v[nlen/4 - 3] != 0) + if (nlen > 12U && v[(nlen-1)/4 - 3] != 0) return (ISC_R_NOTFOUND); /* - * If the total length is not 71 then this is a empty node + * If the total length is not 74 then this is a empty node * so return success. */ - if (nlen + zlen != 71U) + if (nlen + zlen != 74U) return (ISC_R_SUCCESS); - snprintf(reverse, sizeof(reverse), "%u.%u.%u.%u.in-addr.arpa.", - v[6], v[8], v[9], v[10]); + len = dns64_rdata(v, 6, rdata); break; - case 32: /* prefix len 48 */ + case ZLEN(48): /* prefix len 48 */ /* * The nibbles that map to this byte must be zero for 'name' * to exist in the zone. */ - if (nlen > 7U && v[nlen/4 - 2] != 0) + if (nlen > 8U && v[(nlen-1)/4 - 2] != 0) return (ISC_R_NOTFOUND); /* - * If the total length is not 71 then this is a empty node + * If the total length is not 74 then this is a empty node * so return success. */ - if (nlen + zlen != 71U) + if (nlen + zlen != 74U) return (ISC_R_SUCCESS); - snprintf(reverse, sizeof(reverse), "%u.%u.%u.%u.in-addr.arpa.", - v[5], v[6], v[8], v[9]); + len = dns64_rdata(v, 5, rdata); break; - case 36: /* prefix len 56 */ + case ZLEN(56): /* prefix len 56 */ /* * The nibbles that map to this byte must be zero for 'name' * to exist in the zone. */ - if (nlen > 3U && v[nlen/4 - 1] != 0) + if (nlen > 4U && v[(nlen-1)/4 - 1] != 0) return (ISC_R_NOTFOUND); /* - * If the total length is not 71 then this is a empty node + * If the total length is not 74 then this is a empty node * so return success. */ - if (nlen + zlen != 71U) + if (nlen + zlen != 74U) return (ISC_R_SUCCESS); - snprintf(reverse, sizeof(reverse), "%u.%u.%u.%u.in-addr.arpa.", - v[4], v[5], v[6], v[8]); + len = dns64_rdata(v, 4, rdata); break; - case 40: /* prefix len 64 */ + case ZLEN(64): /* prefix len 64 */ /* * The nibbles that map to this byte must be zero for 'name' * to exist in the zone. */ - if (v[nlen/4] != 0) + if (v[(nlen-1)/4] != 0) return (ISC_R_NOTFOUND); /* - * If the total length is not 71 then this is a empty node + * If the total length is not 74 then this is a empty node * so return success. */ - if (nlen + zlen != 71U) + if (nlen + zlen != 74U) return (ISC_R_SUCCESS); - snprintf(reverse, sizeof(reverse), "%u.%u.%u.%u.in-addr.arpa.", - v[3], v[4], v[5], v[6]); + len = dns64_rdata(v, 3, rdata); break; - case 56: /* prefix len 96 */ + case ZLEN(96): /* prefix len 96 */ /* - * If the total length is not 71 then this is a empty node + * If the total length is not 74 then this is a empty node * so return success. */ - if (nlen + zlen != 71U) + if (nlen + zlen != 74U) return (ISC_R_SUCCESS); - snprintf(reverse, sizeof(reverse), "%u.%u.%u.%u.in-addr.arpa.", - v[0], v[1], v[2], v[3]); + len = dns64_rdata(v, 0, rdata); break; default: /* @@ -236,7 +276,7 @@ dns64_cname(const char *zone, const char */ return (ISC_R_NOTFOUND); } - return (dns_sdb_putrr(lookup, "CNAME", 600, reverse)); + return (dns_sdb_putrdata(lookup, dns_rdatatype_cname, 600, rdata, len)); } static isc_result_t @@ -249,13 +289,23 @@ builtin_lookup(const char *zone, const c if (strcmp(name, "@") == 0) return (b->do_lookup(lookup)); - else if (b->do_lookup == do_dns64_lookup) - return (dns64_cname(zone, name, lookup)); else return (ISC_R_NOTFOUND); } static isc_result_t +dns64_lookup(const dns_name_t *zone, const dns_name_t *name, void *dbdata, + dns_sdblookup_t *lookup) +{ + builtin_t *b = (builtin_t *) dbdata; + + if (name->labels == 0 && name->length == 0) + return (b->do_lookup(lookup)); + else + return (dns64_cname(zone, name, lookup)); +} + +static isc_result_t put_txt(dns_sdblookup_t *lookup, const char *text) { unsigned char buf[256]; unsigned int len = strlen(text); @@ -481,7 +531,17 @@ static dns_sdbmethods_t builtin_methods builtin_authority, NULL, /* allnodes */ builtin_create, - builtin_destroy + builtin_destroy, + NULL +}; + +static dns_sdbmethods_t dns64_methods = { + NULL, + builtin_authority, + NULL, /* allnodes */ + builtin_create, + builtin_destroy, + dns64_lookup, }; isc_result_t @@ -491,11 +551,17 @@ ns_builtin_init(void) { DNS_SDBFLAG_RELATIVERDATA, ns_g_mctx, &builtin_impl) == ISC_R_SUCCESS); + RUNTIME_CHECK(dns_sdb_register("_dns64", &dns64_methods, NULL, + DNS_SDBFLAG_RELATIVEOWNER | + DNS_SDBFLAG_RELATIVERDATA | + DNS_SDBFLAG_DNS64, + ns_g_mctx, &dns64_impl) + == ISC_R_SUCCESS); return (ISC_R_SUCCESS); } void ns_builtin_deinit(void) { dns_sdb_unregister(&builtin_impl); + dns_sdb_unregister(&dns64_impl); } - Modified: projects/pf/head/contrib/bind9/bin/named/query.c ============================================================================== --- projects/pf/head/contrib/bind9/bin/named/query.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/bin/named/query.c Mon Jun 4 12:28:56 2012 (r236558) @@ -3354,6 +3354,11 @@ query_addwildcardproof(ns_client_t *clie dns_name_copy(name, cname, NULL); while (result == DNS_R_NXDOMAIN) { labels = dns_name_countlabels(cname) - 1; + /* + * Sanity check. + */ + if (labels == 0U) + goto cleanup; dns_name_split(cname, labels, NULL, cname); result = dns_db_find(db, cname, version, dns_rdatatype_nsec, Modified: projects/pf/head/contrib/bind9/bin/named/server.c ============================================================================== --- projects/pf/head/contrib/bind9/bin/named/server.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/bin/named/server.c Mon Jun 4 12:28:56 2012 (r236558) @@ -1358,7 +1358,7 @@ dns64_reverse(dns_view_t *view, isc_mem_ { char *cp; char reverse[48+sizeof("ip6.arpa.")]; - const char *dns64_dbtype[4] = { "_builtin", "dns64", ".", "." }; + const char *dns64_dbtype[4] = { "_dns64", "dns64", ".", "." }; const char *sep = ": view "; const char *viewname = view->name; const unsigned char *s6; Modified: projects/pf/head/contrib/bind9/bin/named/unix/dlz_dlopen_driver.c ============================================================================== --- projects/pf/head/contrib/bind9/bin/named/unix/dlz_dlopen_driver.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/bin/named/unix/dlz_dlopen_driver.c Mon Jun 4 12:28:56 2012 (r236558) @@ -250,7 +250,7 @@ dlopen_dlz_create(const char *dlzname, u isc_mutex_init(&cd->lock); /* Open the library */ - dlopen_flags = RTLD_NOW; + dlopen_flags = RTLD_NOW|RTLD_GLOBAL; #ifdef RTLD_DEEPBIND /* Modified: projects/pf/head/contrib/bind9/lib/bind9/api ============================================================================== --- projects/pf/head/contrib/bind9/lib/bind9/api Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/bind9/api Mon Jun 4 12:28:56 2012 (r236558) @@ -4,5 +4,5 @@ # 9.8: 80-89 # 9.9: 90-109 LIBINTERFACE = 80 -LIBREVISION = 4 +LIBREVISION = 5 LIBAGE = 0 Modified: projects/pf/head/contrib/bind9/lib/bind9/check.c ============================================================================== --- projects/pf/head/contrib/bind9/lib/bind9/check.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/bind9/check.c Mon Jun 4 12:28:56 2012 (r236558) @@ -434,7 +434,7 @@ check_dns64(cfg_aclconfctx_t *actx, cons int nbytes; int i; - static const char *acls[] = { "client", "exclude", "mapped", NULL}; + static const char *acls[] = { "clients", "exclude", "mapped", NULL}; if (voptions != NULL) cfg_map_get(voptions, "dns64", &dns64); Modified: projects/pf/head/contrib/bind9/lib/dns/api ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/api Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/api Mon Jun 4 12:28:56 2012 (r236558) @@ -4,5 +4,5 @@ # 9.8: 80-89 # 9.9: 90-109 LIBINTERFACE = 87 -LIBREVISION = 0 +LIBREVISION = 1 LIBAGE = 6 Modified: projects/pf/head/contrib/bind9/lib/dns/dnssec.c ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/dnssec.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/dnssec.c Mon Jun 4 12:28:56 2012 (r236558) @@ -1246,7 +1246,7 @@ dns_dnssec_findmatchingkeys(dns_name_t * isc_dir_init(&dir); isc_buffer_init(&b, namebuf, sizeof(namebuf) - 1); - RETERR(dns_name_totext(origin, ISC_FALSE, &b)); + RETERR(dns_name_tofilenametext(origin, ISC_FALSE, &b)); len = isc_buffer_usedlength(&b); namebuf[len] = '\0'; Modified: projects/pf/head/contrib/bind9/lib/dns/include/dns/ecdb.h ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/include/dns/ecdb.h Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/include/dns/ecdb.h Mon Jun 4 12:28:56 2012 (r236558) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -39,6 +39,8 @@ *** Functions ***/ +ISC_LANG_BEGINDECLS + /* TBD: describe those */ isc_result_t Modified: projects/pf/head/contrib/bind9/lib/dns/include/dns/rpz.h ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/include/dns/rpz.h Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/include/dns/rpz.h Mon Jun 4 12:28:56 2012 (r236558) @@ -194,5 +194,7 @@ dns_rpz_cidr_find(dns_rpz_cidr_t *cidr, dns_rpz_policy_t dns_rpz_decode_cname(dns_rdataset_t *, dns_name_t *selfname); +ISC_LANG_ENDDECLS + #endif /* DNS_RPZ_H */ Modified: projects/pf/head/contrib/bind9/lib/dns/include/dns/sdb.h ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/include/dns/sdb.h Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/include/dns/sdb.h Mon Jun 4 12:28:56 2012 (r236558) @@ -59,6 +59,9 @@ typedef struct dns_sdballnodes dns_sdbal typedef isc_result_t (*dns_sdblookupfunc_t)(const char *zone, const char *name, void *dbdata, dns_sdblookup_t *); +typedef isc_result_t +(*dns_sdblookup2func_t)(const dns_name_t *zone, const dns_name_t *name, + void *dbdata, dns_sdblookup_t *lookup); typedef isc_result_t (*dns_sdbauthorityfunc_t)(const char *zone, void *dbdata, dns_sdblookup_t *); @@ -81,6 +84,7 @@ typedef struct dns_sdbmethods { dns_sdballnodesfunc_t allnodes; dns_sdbcreatefunc_t create; dns_sdbdestroyfunc_t destroy; + dns_sdblookup2func_t lookup2; } dns_sdbmethods_t; /*** @@ -92,6 +96,7 @@ ISC_LANG_BEGINDECLS #define DNS_SDBFLAG_RELATIVEOWNER 0x00000001U #define DNS_SDBFLAG_RELATIVERDATA 0x00000002U #define DNS_SDBFLAG_THREADSAFE 0x00000004U +#define DNS_SDBFLAG_DNS64 0x00000008U isc_result_t dns_sdb_register(const char *drivername, const dns_sdbmethods_t *methods, Modified: projects/pf/head/contrib/bind9/lib/dns/include/dns/stats.h ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/include/dns/stats.h Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/include/dns/stats.h Mon Jun 4 12:28:56 2012 (r236558) @@ -147,6 +147,8 @@ typedef void (*dns_rdatatypestats_dumper void *); typedef void (*dns_opcodestats_dumper_t)(dns_opcode_t, isc_uint64_t, void *); +ISC_LANG_BEGINDECLS + isc_result_t dns_generalstats_create(isc_mem_t *mctx, dns_stats_t **statsp, int ncounters); /*%< Modified: projects/pf/head/contrib/bind9/lib/dns/include/dns/tsec.h ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/include/dns/tsec.h Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/include/dns/tsec.h Mon Jun 4 12:28:56 2012 (r236558) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009, 2010 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2009, 2010, 2012 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -132,4 +132,6 @@ dns_tsec_getkey(dns_tsec_t *tsec, void * *\li *tsecp points to a valid key structure depending on the TSEC type. */ +ISC_LANG_ENDDECLS + #endif /* DNS_TSEC_H */ Modified: projects/pf/head/contrib/bind9/lib/dns/include/dns/view.h ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/include/dns/view.h Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/include/dns/view.h Mon Jun 4 12:28:56 2012 (r236558) @@ -1075,4 +1075,6 @@ dns_view_setnewzones(dns_view_t *view, i void dns_view_restorekeyring(dns_view_t *view); +ISC_LANG_ENDDECLS + #endif /* DNS_VIEW_H */ Modified: projects/pf/head/contrib/bind9/lib/dns/rbtdb.c ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/rbtdb.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/rbtdb.c Mon Jun 4 12:28:56 2012 (r236558) @@ -7814,7 +7814,7 @@ dns_rbtdb_create for (i = 0 ; i < (int)rbtdb->node_lock_count ; i++) if (rbtdb->heaps[i] != NULL) isc_heap_destroy(&rbtdb->heaps[i]); - isc_mem_put(mctx, rbtdb->heaps, + isc_mem_put(hmctx, rbtdb->heaps, rbtdb->node_lock_count * sizeof(isc_heap_t *)); } Copied: projects/pf/head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c (from r236557, head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pf/head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c Mon Jun 4 12:28:56 2012 (r236558, copy of r236557, head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.c) @@ -0,0 +1,290 @@ +/* + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id$ */ + +/* draft-ietf-dane-protocol-19.txt */ + +#ifndef RDATA_GENERIC_TLSA_52_C +#define RDATA_GENERIC_TLSA_52_C + +#define RRTYPE_TLSA_ATTRIBUTES 0 + +static inline isc_result_t +fromtext_tlsa(ARGS_FROMTEXT) { + isc_token_t token; + + REQUIRE(type == 52); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(origin); + UNUSED(options); + UNUSED(callbacks); + + /* + * Certificate Usage. + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + + /* + * Selector. + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + + /* + * Matching type. + */ + RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number, + ISC_FALSE)); + if (token.value.as_ulong > 0xffU) + RETTOK(ISC_R_RANGE); + RETERR(uint8_tobuffer(token.value.as_ulong, target)); + + /* + * Certificate Association Data. + */ + return (isc_hex_tobuffer(lexer, target, -1)); +} + +static inline isc_result_t +totext_tlsa(ARGS_TOTEXT) { + isc_region_t sr; + char buf[sizeof("64000 ")]; + unsigned int n; + + REQUIRE(rdata->type == 52); + REQUIRE(rdata->length != 0); + + UNUSED(tctx); + + dns_rdata_toregion(rdata, &sr); + + /* + * Certificate Usage. + */ + n = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + sprintf(buf, "%u ", n); + RETERR(str_totext(buf, target)); + + /* + * Selector. + */ + n = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + sprintf(buf, "%u ", n); + RETERR(str_totext(buf, target)); + + /* + * Matching type. + */ + n = uint8_fromregion(&sr); + isc_region_consume(&sr, 1); + sprintf(buf, "%u", n); + RETERR(str_totext(buf, target)); + + /* + * Certificate Association Data. + */ + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" (", target)); + RETERR(str_totext(tctx->linebreak, target)); + if (tctx->width == 0) /* No splitting */ + RETERR(isc_hex_totext(&sr, 0, "", target)); + else + RETERR(isc_hex_totext(&sr, tctx->width - 2, + tctx->linebreak, target)); + if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) + RETERR(str_totext(" )", target)); + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +fromwire_tlsa(ARGS_FROMWIRE) { + isc_region_t sr; + + REQUIRE(type == 52); + + UNUSED(type); + UNUSED(rdclass); + UNUSED(dctx); + UNUSED(options); + + isc_buffer_activeregion(source, &sr); + + if (sr.length < 3) + return (ISC_R_UNEXPECTEDEND); + + isc_buffer_forward(source, sr.length); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline isc_result_t +towire_tlsa(ARGS_TOWIRE) { + isc_region_t sr; + + REQUIRE(rdata->type == 52); + REQUIRE(rdata->length != 0); + + UNUSED(cctx); + + dns_rdata_toregion(rdata, &sr); + return (mem_tobuffer(target, sr.base, sr.length)); +} + +static inline int +compare_tlsa(ARGS_COMPARE) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->rdclass == rdata2->rdclass); + REQUIRE(rdata1->type == 52); + REQUIRE(rdata1->length != 0); + REQUIRE(rdata2->length != 0); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (isc_region_compare(&r1, &r2)); +} + +static inline isc_result_t +fromstruct_tlsa(ARGS_FROMSTRUCT) { + dns_rdata_tlsa_t *tlsa = source; + + REQUIRE(type == 52); + REQUIRE(source != NULL); + REQUIRE(tlsa->common.rdtype == type); + REQUIRE(tlsa->common.rdclass == rdclass); + + UNUSED(type); + UNUSED(rdclass); + + RETERR(uint8_tobuffer(tlsa->usage, target)); + RETERR(uint8_tobuffer(tlsa->selector, target)); + RETERR(uint8_tobuffer(tlsa->match, target)); + + return (mem_tobuffer(target, tlsa->data, tlsa->length)); +} + +static inline isc_result_t +tostruct_tlsa(ARGS_TOSTRUCT) { + dns_rdata_tlsa_t *tlsa = target; + isc_region_t region; + + REQUIRE(rdata->type == 52); + REQUIRE(target != NULL); + REQUIRE(rdata->length != 0); + + tlsa->common.rdclass = rdata->rdclass; + tlsa->common.rdtype = rdata->type; + ISC_LINK_INIT(&tlsa->common, link); + + dns_rdata_toregion(rdata, ®ion); + + tlsa->usage = uint8_fromregion(®ion); + isc_region_consume(®ion, 1); + tlsa->selector = uint8_fromregion(®ion); + isc_region_consume(®ion, 1); + tlsa->match = uint8_fromregion(®ion); + isc_region_consume(®ion, 1); + tlsa->length = region.length; + + tlsa->data = mem_maybedup(mctx, region.base, region.length); + if (tlsa->data == NULL) + return (ISC_R_NOMEMORY); + + tlsa->mctx = mctx; + return (ISC_R_SUCCESS); +} + +static inline void +freestruct_tlsa(ARGS_FREESTRUCT) { + dns_rdata_tlsa_t *tlsa = source; + + REQUIRE(tlsa != NULL); + REQUIRE(tlsa->common.rdtype == 52); + + if (tlsa->mctx == NULL) + return; + + if (tlsa->data != NULL) + isc_mem_free(tlsa->mctx, tlsa->data); + tlsa->mctx = NULL; +} + +static inline isc_result_t +additionaldata_tlsa(ARGS_ADDLDATA) { + REQUIRE(rdata->type == 52); + + UNUSED(rdata); + UNUSED(add); + UNUSED(arg); + + return (ISC_R_SUCCESS); +} + +static inline isc_result_t +digest_tlsa(ARGS_DIGEST) { + isc_region_t r; + + REQUIRE(rdata->type == 52); + + dns_rdata_toregion(rdata, &r); + + return ((digest)(arg, &r)); +} + +static inline isc_boolean_t +checkowner_tlsa(ARGS_CHECKOWNER) { + + REQUIRE(type == 52); + + UNUSED(name); + UNUSED(type); + UNUSED(rdclass); + UNUSED(wildcard); + + return (ISC_TRUE); +} + +static inline isc_boolean_t +checknames_tlsa(ARGS_CHECKNAMES) { + + REQUIRE(rdata->type == 52); + + UNUSED(rdata); + UNUSED(owner); + UNUSED(bad); + + return (ISC_TRUE); +} + +static inline int +casecompare_tlsa(ARGS_COMPARE) { + return (compare_tlsa(rdata1, rdata2)); +} + +#endif /* RDATA_GENERIC_TLSA_52_C */ Copied: projects/pf/head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.h (from r236557, head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pf/head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.h Mon Jun 4 12:28:56 2012 (r236558, copy of r236557, head/contrib/bind9/lib/dns/rdata/generic/tlsa_52.h) @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/* $Id$ */ + +#ifndef GENERIC_TLSA_52_H +#define GENERIC_TLSA_52_H 1 + +/*! + * \brief per draft-ietf-dane-protocol-19.txt + */ +typedef struct dns_rdata_tlsa { + dns_rdatacommon_t common; + isc_mem_t *mctx; + isc_uint8_t usage; + isc_uint8_t selector; + isc_uint8_t match; + isc_uint16_t length; + unsigned char *data; +} dns_rdata_tlsa_t; + +#endif /* GENERIC_TLSA_52_H */ Modified: projects/pf/head/contrib/bind9/lib/dns/resolver.c ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/resolver.c Mon Jun 4 11:51:17 2012 (r236557) +++ projects/pf/head/contrib/bind9/lib/dns/resolver.c Mon Jun 4 12:28:56 2012 (r236558) @@ -180,7 +180,9 @@ struct fetchctx { dns_rdatatype_t type; unsigned int options; unsigned int bucketnum; - char * info; + char * info; + isc_mem_t * mctx; + /*% Locked by appropriate bucket lock. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 13:34:00 2012 Return-Path: Delivered-To: svn-src-projects@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC4B61065670; Mon, 4 Jun 2012 13:34:00 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.64.117]) by mx1.freebsd.org (Postfix) with ESMTP id 6E9168FC15; Mon, 4 Jun 2012 13:34:00 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.5/8.14.5) with ESMTP id q54DXwfJ086990; Mon, 4 Jun 2012 17:33:58 +0400 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.5/8.14.5/Submit) id q54DXw8Y086989; Mon, 4 Jun 2012 17:33:58 +0400 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Mon, 4 Jun 2012 17:33:58 +0400 From: Gleb Smirnoff To: Bruce Evans Message-ID: <20120604133358.GO44607@FreeBSD.org> References: <201206041009.q54A9v4A019437@svn.freebsd.org> <20120604210548.Y1459@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <20120604210548.Y1459@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-projects@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r236554 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 13:34:01 -0000 On Mon, Jun 04, 2012 at 09:29:46PM +1000, Bruce Evans wrote: B> > Log: B> > Consistent names for pf(4) malloc(9) types. B> B> Many still have spaces in them. This breaks at least simple parsing B> of "vmstat -m" output using columns in awk (and postprocessing of B> vmstat -m output is more needed than orginally, since vmstat is now B> too stupid to even print the totals). A few bugs in this area have B> been fixed relatively recently. For example: B> B> file desc -> filedesc (matches original naming scheme -- no underscore) B> BIO buffer -> biobuf B> UFS mount -> ufs_mount (now just a style bug -- underscore) B> VM pgdata -> vm_pgdata B> * ihash -> [went away] B> struct cdev * -> [went away] B> cluster_save buffer -> [went away] (was also too long) B> [too many] -> [vmstat -z, with worse names and formatting] Should only the shortdesc not contain spaces? Well, there is conflict between parseability and understandability :) B> Now broken on ref10-i386: B> B> NFSCL diroffd B> NFS fh B> B> only. Also a lot of "CAM foo". -- Totus tuus, Glebius. From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 13:41:23 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 27FE1106566C; Mon, 4 Jun 2012 13:41:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 128FE8FC19; Mon, 4 Jun 2012 13:41:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54DfM9r044250; Mon, 4 Jun 2012 13:41:22 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54DfMxR044243; Mon, 4 Jun 2012 13:41:22 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206041341.q54DfMxR044243@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 13:41:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236561 - in projects/pf/head: contrib/pf/man contrib/pf/pfctl sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 13:41:23 -0000 Author: glebius Date: Mon Jun 4 13:41:22 2012 New Revision: 236561 URL: http://svn.freebsd.org/changeset/base/236561 Log: - Remove table zone and assiciated limit, tables are created only when user configures pf(4), no reason for separate zone and limit. - Catch up with r236364 to head: initialize kcounters zone. - Make kentry and kcounters zone private to pf_table.c Modified: projects/pf/head/contrib/pf/man/pf.4 projects/pf/head/contrib/pf/pfctl/pfctl.c projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pf_table.c projects/pf/head/sys/contrib/pf/net/pfvar.h Modified: projects/pf/head/contrib/pf/man/pf.4 ============================================================================== --- projects/pf/head/contrib/pf/man/pf.4 Mon Jun 4 12:49:21 2012 (r236560) +++ projects/pf/head/contrib/pf/man/pf.4 Mon Jun 4 13:41:22 2012 (r236561) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 29 2012 +.Dd June 4 2012 .Dt PF 4 .Os .Sh NAME @@ -492,7 +492,7 @@ struct pfioc_limit { }; enum { PF_LIMIT_STATES, PF_LIMIT_SRC_NODES, PF_LIMIT_FRAGS, - PF_LIMIT_TABLES, PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX }; + PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX }; .Ed .It Dv DIOCGETLIMIT Fa "struct pfioc_limit *pl" Get the hard Modified: projects/pf/head/contrib/pf/pfctl/pfctl.c ============================================================================== --- projects/pf/head/contrib/pf/pfctl/pfctl.c Mon Jun 4 12:49:21 2012 (r236560) +++ projects/pf/head/contrib/pf/pfctl/pfctl.c Mon Jun 4 13:41:22 2012 (r236561) @@ -144,7 +144,6 @@ static const struct { { "states", PF_LIMIT_STATES }, { "src-nodes", PF_LIMIT_SRC_NODES }, { "frags", PF_LIMIT_FRAGS }, - { "tables", PF_LIMIT_TABLES }, { "table-entries", PF_LIMIT_TABLE_ENTRIES }, { NULL, 0 } }; @@ -1581,7 +1580,6 @@ pfctl_init_options(struct pfctl *pf) pf->limit[PF_LIMIT_STATES] = PFSTATE_HIWAT; pf->limit[PF_LIMIT_FRAGS] = PFFRAG_FRENT_HIWAT; pf->limit[PF_LIMIT_SRC_NODES] = PFSNODE_HIWAT; - pf->limit[PF_LIMIT_TABLES] = PFR_KTABLE_HIWAT; pf->limit[PF_LIMIT_TABLE_ENTRIES] = PFR_KENTRY_HIWAT; mib[0] = CTL_HW; Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 12:49:21 2012 (r236560) +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 13:41:22 2012 (r236561) @@ -714,16 +714,6 @@ pf_initialize() /* Unlinked, but may be referenced rules. */ TAILQ_INIT(&V_pf_unlinked_rules); mtx_init(&pf_unlnkdrules_mtx, "pf unlinked rules", NULL, MTX_DEF); - - /* XXXGL: sort this out */ - V_pfr_ktable_z = uma_zcreate("pf tables", - sizeof(struct pfr_ktable), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, - 0); - V_pf_limits[PF_LIMIT_TABLES].zone = V_pfr_ktable_z; - V_pfr_kentry_z = uma_zcreate("pf table entries", - sizeof(struct pfr_kentry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, - 0); - V_pf_limits[PF_LIMIT_TABLE_ENTRIES].zone = V_pfr_kentry_z; } void @@ -765,8 +755,6 @@ pf_cleanup() uma_zdestroy(V_pf_sources_z); uma_zdestroy(V_pf_state_z); uma_zdestroy(V_pf_state_key_z); - uma_zdestroy(V_pfr_ktable_z); - uma_zdestroy(V_pfr_kentry_z); } static int Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 12:49:21 2012 (r236560) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 13:41:22 2012 (r236561) @@ -250,14 +250,12 @@ pfattach(void) int error; pf_initialize(); + pfr_initialize(); pfi_initialize(); pf_normalize_init(); V_pf_limits[PF_LIMIT_STATES].limit = PFSTATE_HIWAT; V_pf_limits[PF_LIMIT_SRC_NODES].limit = PFSNODE_HIWAT; - V_pf_limits[PF_LIMIT_TABLES].limit = PFR_KTABLE_HIWAT; - V_pf_limits[PF_LIMIT_TABLE_ENTRIES].zone = V_pfr_kentry_z; - V_pf_limits[PF_LIMIT_TABLE_ENTRIES].limit = PFR_KENTRY_HIWAT; RB_INIT(&V_pf_anchors); pf_init_ruleset(&pf_main_ruleset); @@ -3782,6 +3780,7 @@ pf_unload(void) } pf_normalize_cleanup(); pfi_cleanup(); + pfr_cleanup(); pf_osfp_flush(); pf_cleanup(); PF_RULES_WUNLOCK(); Modified: projects/pf/head/sys/contrib/pf/net/pf_table.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_table.c Mon Jun 4 12:49:21 2012 (r236560) +++ projects/pf/head/sys/contrib/pf/net/pf_table.c Mon Jun 4 13:41:22 2012 (r236561) @@ -118,10 +118,11 @@ struct pfr_walktree { #define senderr(e) do { rv = (e); goto _bad; } while (0) -VNET_DEFINE(uma_zone_t, pfr_ktable_z); -VNET_DEFINE(uma_zone_t, pfr_kentry_z); -VNET_DEFINE(uma_zone_t, pfr_kcounters_z); -#define V_pfr_kcounters_z VNET(pfr_kcounters_z) +static MALLOC_DEFINE(M_PFTABLE, "pf(4) table", "pf(4) tables structures"); +static VNET_DEFINE(uma_zone_t, pfr_kentry_z); +#define V_pfr_kentry_z VNET(pfr_kentry_z) +static VNET_DEFINE(uma_zone_t, pfr_kcounters_z); +#define V_pfr_kcounters_z VNET(pfr_kcounters_z) static struct pf_addr pfr_ffaddr = { .addr32 = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff } @@ -185,6 +186,28 @@ struct pfr_ktablehead pfr_ktables; struct pfr_table pfr_nulltable; int pfr_ktable_cnt; +void +pfr_initialize(void) +{ + + V_pfr_kentry_z = uma_zcreate("pf table entries", + sizeof(struct pfr_kentry), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, + 0); + V_pfr_kcounters_z = uma_zcreate("pf table counters", + sizeof(struct pfr_kcounters), NULL, NULL, NULL, NULL, + UMA_ALIGN_PTR, 0); + V_pf_limits[PF_LIMIT_TABLE_ENTRIES].zone = V_pfr_kentry_z; + V_pf_limits[PF_LIMIT_TABLE_ENTRIES].limit = PFR_KENTRY_HIWAT; +} + +void +pfr_cleanup(void) +{ + + uma_zdestroy(V_pfr_kentry_z); + uma_zdestroy(V_pfr_kcounters_z); +} + int pfr_clr_addrs(struct pfr_table *tbl, int *ndel, int flags) { @@ -1776,7 +1799,7 @@ pfr_create_ktable(struct pfr_table *tbl, PF_RULES_WASSERT(); - kt = uma_zalloc(V_pfr_ktable_z, M_NOWAIT|M_ZERO); + kt = malloc(sizeof(*kt), M_PFTABLE, M_NOWAIT|M_ZERO); if (kt == NULL) return (NULL); kt->pfrkt_t = *tbl; @@ -1838,7 +1861,7 @@ pfr_destroy_ktable(struct pfr_ktable *kt kt->pfrkt_rs->tables--; pf_remove_if_empty_ruleset(kt->pfrkt_rs); } - uma_zfree(V_pfr_ktable_z, kt); + free(kt, M_PFTABLE); } static int Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 12:49:21 2012 (r236560) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Mon Jun 4 13:41:22 2012 (r236561) @@ -113,7 +113,7 @@ enum { PFTM_TCP_FIRST_PACKET, PFTM_TCP_O enum { PF_NOPFROUTE, PF_FASTROUTE, PF_ROUTETO, PF_DUPTO, PF_REPLYTO }; enum { PF_LIMIT_STATES, PF_LIMIT_SRC_NODES, PF_LIMIT_FRAGS, - PF_LIMIT_TABLES, PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX }; + PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX }; #define PF_POOL_IDMASK 0x0f enum { PF_POOL_NONE, PF_POOL_BITMASK, PF_POOL_RANDOM, PF_POOL_SRCHASH, PF_POOL_ROUNDROBIN }; @@ -1412,7 +1412,6 @@ struct pf_divert { #define PFFRAG_FRCENT_HIWAT 50000 /* Number of fragment cache entries */ #define PFFRAG_FRCACHE_HIWAT 10000 /* Number of fragment descriptors */ -#define PFR_KTABLE_HIWAT 1000 /* Number of tables */ #define PFR_KENTRY_HIWAT 200000 /* Number of table entries */ #define PFR_KENTRY_HIWAT_SMALL 100000 /* Number of table entries (tiny hosts) */ @@ -1732,10 +1731,6 @@ VNET_DECLARE(uma_zone_t, pf_state_z); #define V_pf_state_z VNET(pf_state_z) VNET_DECLARE(uma_zone_t, pf_state_key_z); #define V_pf_state_key_z VNET(pf_state_key_z) -VNET_DECLARE(uma_zone_t, pfr_ktable_z); -#define V_pfr_ktable_z VNET(pfr_ktable_z) -VNET_DECLARE(uma_zone_t, pfr_kentry_z); -#define V_pfr_kentry_z VNET(pfr_kentry_z) VNET_DECLARE(uma_zone_t, pf_state_scrub_z); #define V_pf_state_scrub_z VNET(pf_state_scrub_z) @@ -1852,6 +1847,8 @@ int pf_routable(struct pf_addr *addr, sa int); int pf_socket_lookup(int, struct pf_pdesc *); struct pf_state_key *pf_alloc_state_key(int); +void pfr_initialize(void); +void pfr_cleanup(void); int pfr_match_addr(struct pfr_ktable *, struct pf_addr *, sa_family_t); void pfr_update_stats(struct pfr_ktable *, struct pf_addr *, sa_family_t, u_int64_t, int, int, int); From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 15:06:02 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5CC791065673; Mon, 4 Jun 2012 15:06:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail12.syd.optusnet.com.au (mail12.syd.optusnet.com.au [211.29.132.193]) by mx1.freebsd.org (Postfix) with ESMTP id E3A318FC0C; Mon, 4 Jun 2012 15:06:01 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail12.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q54F5rnZ015774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 5 Jun 2012 01:05:54 +1000 Date: Tue, 5 Jun 2012 01:05:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff In-Reply-To: <20120604133358.GO44607@FreeBSD.org> Message-ID: <20120605000211.R1992@besplex.bde.org> References: <201206041009.q54A9v4A019437@svn.freebsd.org> <20120604210548.Y1459@besplex.bde.org> <20120604133358.GO44607@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org, Bruce Evans Subject: Re: svn commit: r236554 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 15:06:02 -0000 On Mon, 4 Jun 2012, Gleb Smirnoff wrote: > On Mon, Jun 04, 2012 at 09:29:46PM +1000, Bruce Evans wrote: > B> > Log: > B> > Consistent names for pf(4) malloc(9) types. > B> > B> Many still have spaces in them. This breaks at least simple parsing > B> of "vmstat -m" output using columns in awk (and postprocessing of > B> vmstat -m output is more needed than orginally, since vmstat is now > B> too stupid to even print the totals). A few bugs in this area have > B> been fixed relatively recently. For example: > B> > B> file desc -> filedesc (matches original naming scheme -- no underscore) > B> BIO buffer -> biobuf > B> UFS mount -> ufs_mount (now just a style bug -- underscore) > B> VM pgdata -> vm_pgdata > B> * ihash -> [went away] > B> struct cdev * -> [went away] > B> cluster_save buffer -> [went away] (was also too long) > B> [too many] -> [vmstat -z, with worse names and formatting] > > Should only the shortdesc not contain spaces? Well, there is conflict between > parseability and understandability :) Of course the longdesc should contain spaces. Especially since it is not used, so it only bloats the source code :-). The shortdesc could even use M_FOO (if the longdesc could be looked up more easily). But in 4.4BSD, there was a separate (hard-coded) string table with names, with lots of spaces in it too, but apparently only for newer (in 1993) names, since entries 1-21 had no spaces, no underscores, many abbreviations and no upper case, while entries 22-61 are quite different. > B> Now broken on ref10-i386: > B> > B> NFSCL diroffd Actually "NFSCL diroffdiroff". This is a strange name, apart from being too long (see below). NFS names are poor. Another one bad one is "newnfsclient_req". This one is apparently the current extension of the first one with a space in it in 4.4BSD (#22 was "NFS req"). It was still "NFS req" in FreeBSD-5. But the space in it is fixed in the old nfs client -- there it is now "nfsclient_req": % RCS file: /home/ncvs/src/sys/nfsclient/nfs_vfsops.c,v % Working file: nfs_vfsops.c % head: 1.259 % ---------------------------- % revision 1.178 % date: 2005/10/31 15:41:27; author: rwatson; state: Exp; lines: +5 -5 % Normalize a significant number of kernel malloc type names: % % - Prefer '_' to ' ', as it results in more easily parsed results in % memory monitoring tools such as vmstat. % % - Remove punctuation that is incompatible with using memory type names % as file names, such as '/' characters. So your "(4)" shouldn't be used. It works in file names but has shell metacharacters. % % - Disambiguate some collisions by adding subsystem prefixes to some % memory types. % % - Generally prefer lower case to upper case. % % - If the same type is defined in multiple architecture directories, % attempt to use the same name in additional cases. % % Not all instances were caught in this change, so more work is required to % finish this conversion. Similar changes are required for UMA zone names. % ---------------------------- I don't like verbosifying "NFS" to "nfsclient" or the underscore. In general there is not enough space for such verbose names. In vmstat -m output, there are 13 columns for the name. That is a larger than normal number for a tabular format, but "nfsclient_" uses 9 for just the subsystem name, leaving only 4 for the details. The details remain abbreviated to "req". > B> NFS fh This is older-style, and abbreviates everything (fh is less well known than NFS). It is for the new fs client and/or server (it is mostly used by the client but it is defined in a common part). This was renamed to nfsclient_bigfh in the old nfsclient, and its macro name has a BIG in it too, and its verbose description says "version 3" instead of "big". In FreeBSD-5, its short description was "NFSV3 bigfh" and its other details were the same as now. "NFSCL diroffdiroff" seems to be just an editing error in the new nfs client. In the old nfs client, this only ever had 1 diroff, and it was renamed from "NFSV3 diroff" in 4.4BSD..FreeBSD-5 to "nfsclient_diroff" in the old nfs client now. The verbose prefix in it makes it too long even with only one diroff in it. The new and old nfs clients can be compiled into the same kernel and give many potential naming conflicts and bad names to avoid the conflicts and worse names in the new version because the best names are taken. "CL" is better than "client" for anti-verboseness, but you might still need new/old and V2/V3/V4 or shorter. > B> > B> only. > > Also a lot of "CAM foo". These didn't show up for me. Nor did most nfs ones. Apparently vmstat -m doesn't show everything, and I couldn't find an option to change this. Grepping in cam showed: - no subsystem prefix for ctl* or ramdisk - scsi subsystem mostly uses scsi_foo, but some places use "SCSI FOO" - use of private malloc types exploded from 1 in 2004 to 22 now. There were about 5 at the time of rwatson's sweep described above. These were mostly "SCSI FOO" and were not touched by the sweep. Bruce From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 16:28:57 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 64AD01065672; Mon, 4 Jun 2012 16:28:57 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5068D8FC18; Mon, 4 Jun 2012 16:28:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54GSv5C052436; Mon, 4 Jun 2012 16:28:57 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54GSvxf052434; Mon, 4 Jun 2012 16:28:57 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206041628.q54GSvxf052434@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 16:28:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236568 - projects/altix2/sys/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 16:28:57 -0000 Author: marcel Date: Mon Jun 4 16:28:56 2012 New Revision: 236568 URL: http://svn.freebsd.org/changeset/base/236568 Log: Remove options ISP_USE_BUSDMA & MPT_USE_BUSDMA. I'm simply rewriting the drivers unconditionally. Modified: projects/altix2/sys/conf/options Modified: projects/altix2/sys/conf/options ============================================================================== --- projects/altix2/sys/conf/options Mon Jun 4 16:15:40 2012 (r236567) +++ projects/altix2/sys/conf/options Mon Jun 4 16:28:56 2012 (r236568) @@ -912,7 +912,3 @@ AR71XX_REALMEM opt_ar71xx.h AR71XX_ENV_UBOOT opt_ar71xx.h AR71XX_ENV_REDBOOT opt_ar71xx.h AR71XX_ATH_EEPROM opt_ar71xx.h - -# busdma/mi -ISP_USE_BUSDMA opt_global.h -MPT_USE_BUSDMA opt_global.h From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 17:10:03 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4D4F1106564A; Mon, 4 Jun 2012 17:10:03 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 195D98FC0A; Mon, 4 Jun 2012 17:10:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54HA251054335; Mon, 4 Jun 2012 17:10:02 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54HA2Wx054333; Mon, 4 Jun 2012 17:10:02 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206041710.q54HA2Wx054333@svn.freebsd.org> From: Davide Italiano Date: Mon, 4 Jun 2012 17:10:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236569 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 17:10:03 -0000 Author: davide Date: Mon Jun 4 17:10:02 2012 New Revision: 236569 URL: http://svn.freebsd.org/changeset/base/236569 Log: - Start to experiment an extension of the current KPI adding the callout_reset_bt_on() in which we specify timeouts in terms of struct bintime rather than ticks. - Make the old callout_reset_on() just a wrapper to the new function. Modified: projects/calloutng/sys/kern/kern_timeout.c projects/calloutng/sys/sys/callout.h Modified: projects/calloutng/sys/kern/kern_timeout.c ============================================================================== --- projects/calloutng/sys/kern/kern_timeout.c Mon Jun 4 16:28:56 2012 (r236568) +++ projects/calloutng/sys/kern/kern_timeout.c Mon Jun 4 17:10:02 2012 (r236569) @@ -830,24 +830,14 @@ callout_handle_init(struct callout_handl * callout_pending() - returns truth if callout is still waiting for timeout * callout_deactivate() - marks the callout as having been serviced */ -int -callout_reset_on(struct callout *c, int to_ticks, void (*ftn)(void *), +int +callout_reset_bt_on(struct callout *c, struct bintime bt, void (*ftn)(void *), void *arg, int cpu) { struct callout_cpu *cc; - struct bintime bt; - struct bintime now; int cancelled = 0; - int bucket; - - /* - * Convert ticks to struct bintime. - */ + int bucket; - FREQ2BT(hz,&bt); - getbinuptime(&now); - bintime_mul(&bt,to_ticks); - bintime_add(&bt,&now); /* * Don't allow migration of pre-allocated callouts lest they * become unbalanced. @@ -924,6 +914,19 @@ callout_reset_on(struct callout *c, int return (cancelled); } +int +callout_reset_on(struct callout *c, int to_ticks, void (*ftn)(void *), + void *arg, int cpu) +{ + struct bintime bt, now; + + FREQ2BT(hz,&bt); + getbinuptime(&now); + bintime_mul(&bt,to_ticks); + bintime_add(&bt,&now); + return (callout_reset_bt_on(c, bt, ftn, arg, cpu)); +} + /* * Common idioms that can be optimized in the future. */ Modified: projects/calloutng/sys/sys/callout.h ============================================================================== --- projects/calloutng/sys/sys/callout.h Mon Jun 4 16:28:56 2012 (r236568) +++ projects/calloutng/sys/sys/callout.h Mon Jun 4 17:10:02 2012 (r236569) @@ -68,6 +68,8 @@ void _callout_init_lock(struct callout * _callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object : \ NULL, (flags)) #define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING) +int callout_reset_bt_on(struct callout *, struct bintime, void(*)(void *), + void *, int); int callout_reset_on(struct callout *, int, void (*)(void *), void *, int); #define callout_reset(c, on_tick, fn, arg) \ callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu) From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 17:13:33 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7C7D41065672; Mon, 4 Jun 2012 17:13:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E1C48FC14; Mon, 4 Jun 2012 17:13:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54HDXpw054540; Mon, 4 Jun 2012 17:13:33 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54HDXvn054532; Mon, 4 Jun 2012 17:13:33 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206041713.q54HDXvn054532@svn.freebsd.org> From: Gleb Smirnoff Date: Mon, 4 Jun 2012 17:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236570 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 17:13:33 -0000 Author: glebius Date: Mon Jun 4 17:13:32 2012 New Revision: 236570 URL: http://svn.freebsd.org/changeset/base/236570 Log: Rename malloc(9) shortdescs so that they don't contain spaces. Suggested by: bde Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_if.c projects/pf/head/sys/contrib/pf/net/pf_ioctl.c projects/pf/head/sys/contrib/pf/net/pf_osfp.c projects/pf/head/sys/contrib/pf/net/pf_table.c Modified: projects/pf/head/sys/contrib/pf/net/if_pfsync.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/if_pfsync.c Mon Jun 4 17:10:02 2012 (r236569) +++ projects/pf/head/sys/contrib/pf/net/if_pfsync.c Mon Jun 4 17:13:32 2012 (r236570) @@ -238,7 +238,7 @@ struct pfsync_softc { #define PFSYNC_BUNLOCK(sc) mtx_unlock(&(sc)->sc_bulk_mtx) #define PFSYNC_BLOCK_ASSERT(sc) mtx_assert(&(sc)->sc_bulk_mtx, MA_OWNED) -static MALLOC_DEFINE(M_PFSYNC, "pfsync(4)", "pfsync(4) data"); +static MALLOC_DEFINE(M_PFSYNC, "pfsync", "pfsync(4) data"); static VNET_DEFINE(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) static VNET_DEFINE(void *, pfsync_swi_cookie) = NULL; Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 17:10:02 2012 (r236569) +++ projects/pf/head/sys/contrib/pf/net/pf.c Mon Jun 4 17:13:32 2012 (r236570) @@ -155,7 +155,7 @@ VNET_DEFINE(struct pf_anchor_stackframe, /* * Queue for pf_intr() sends. */ -static MALLOC_DEFINE(M_PFTEMP, "pf(4) temp", "pf(4) temporary allocations"); +static MALLOC_DEFINE(M_PFTEMP, "pf_temp", "pf(4) temporary allocations"); struct pf_send_entry { STAILQ_ENTRY(pf_send_entry) pfse_next; struct mbuf *pfse_m; @@ -348,7 +348,7 @@ VNET_DEFINE(struct pf_limit, pf_limits[P s->rule.ptr->states_cur--; \ } while (0) -static MALLOC_DEFINE(M_PFHASH, "pf(4) hash", "pf(4) hash header structures"); +static MALLOC_DEFINE(M_PFHASH, "pf_hash", "pf(4) hash header structures"); /* XXXGL: make static? */ VNET_DEFINE(struct pf_keyhash *, pf_keyhash); VNET_DEFINE(struct pf_idhash *, pf_idhash); Modified: projects/pf/head/sys/contrib/pf/net/pf_if.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_if.c Mon Jun 4 17:10:02 2012 (r236569) +++ projects/pf/head/sys/contrib/pf/net/pf_if.c Mon Jun 4 17:13:32 2012 (r236570) @@ -110,7 +110,7 @@ static VNET_DEFINE(struct pfi_ifhead, pf #define V_pfi_ifs VNET(pfi_ifs) #define PFI_BUFFER_MAX 0x10000 -MALLOC_DEFINE(PFI_MTYPE, "pf(4) ifnets", "pf(4) interface database"); +MALLOC_DEFINE(PFI_MTYPE, "pf_ifnet", "pf(4) interface database"); LIST_HEAD(pfi_list, pfi_kif); static VNET_DEFINE(struct pfi_list, pfi_unlinked_kifs); Modified: projects/pf/head/sys/contrib/pf/net/pf_ioctl.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 17:10:02 2012 (r236569) +++ projects/pf/head/sys/contrib/pf/net/pf_ioctl.c Mon Jun 4 17:13:32 2012 (r236570) @@ -157,9 +157,9 @@ TAILQ_HEAD(pf_tags, pf_tagname); VNET_DEFINE(struct pf_tags, pf_tags); #define V_pf_qids VNET(pf_qids) VNET_DEFINE(struct pf_tags, pf_qids); -static MALLOC_DEFINE(M_PFTAG, "pf(4) tag", "pf(4) tag names"); -static MALLOC_DEFINE(M_PFALTQ, "pf(4) altq", "pf(4) altq configuration db"); -static MALLOC_DEFINE(M_PFRULE, "pf(4) rules", "pf(4) rules"); +static MALLOC_DEFINE(M_PFTAG, "pf_tag", "pf(4) tag names"); +static MALLOC_DEFINE(M_PFALTQ, "pf_altq", "pf(4) altq configuration db"); +static MALLOC_DEFINE(M_PFRULE, "pf_rule", "pf(4) rules"); #if (PF_QNAME_SIZE != PF_TAG_NAME_SIZE) #error PF_QNAME_SIZE must be equal to PF_TAG_NAME_SIZE Modified: projects/pf/head/sys/contrib/pf/net/pf_osfp.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_osfp.c Mon Jun 4 17:10:02 2012 (r236569) +++ projects/pf/head/sys/contrib/pf/net/pf_osfp.c Mon Jun 4 17:13:32 2012 (r236570) @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include -static MALLOC_DEFINE(M_PFOSFP, "pf(4) osfp", "pf(4) operating system fingerprints"); +static MALLOC_DEFINE(M_PFOSFP, "pf_osfp", "pf(4) operating system fingerprints"); #define DPFPRINTF(format, x...) \ if (V_pf_status.debug >= PF_DEBUG_NOISY) \ printf(format , ##x) Modified: projects/pf/head/sys/contrib/pf/net/pf_table.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_table.c Mon Jun 4 17:10:02 2012 (r236569) +++ projects/pf/head/sys/contrib/pf/net/pf_table.c Mon Jun 4 17:13:32 2012 (r236570) @@ -118,7 +118,7 @@ struct pfr_walktree { #define senderr(e) do { rv = (e); goto _bad; } while (0) -static MALLOC_DEFINE(M_PFTABLE, "pf(4) table", "pf(4) tables structures"); +static MALLOC_DEFINE(M_PFTABLE, "pf_table", "pf(4) tables structures"); static VNET_DEFINE(uma_zone_t, pfr_kentry_z); #define V_pfr_kentry_z VNET(pfr_kentry_z) static VNET_DEFINE(uma_zone_t, pfr_kcounters_z); From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 18:16:19 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3883106564A; Mon, 4 Jun 2012 18:16:19 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9DB988FC15; Mon, 4 Jun 2012 18:16:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54IGJEQ057568; Mon, 4 Jun 2012 18:16:19 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54IGJKR057562; Mon, 4 Jun 2012 18:16:19 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206041816.q54IGJKR057562@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 18:16:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236573 - projects/altix2/sys/dev/isp X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 18:16:19 -0000 Author: marcel Date: Mon Jun 4 18:16:19 2012 New Revision: 236573 URL: http://svn.freebsd.org/changeset/base/236573 Log: Rewrite using busdma/mi. Things tend to become simpler... Note that isp_sbus.c has not been converted yet. Modified: projects/altix2/sys/dev/isp/isp_freebsd.c projects/altix2/sys/dev/isp/isp_freebsd.h projects/altix2/sys/dev/isp/isp_library.c projects/altix2/sys/dev/isp/isp_library.h projects/altix2/sys/dev/isp/isp_pci.c Modified: projects/altix2/sys/dev/isp/isp_freebsd.c ============================================================================== --- projects/altix2/sys/dev/isp/isp_freebsd.c Mon Jun 4 18:02:09 2012 (r236572) +++ projects/altix2/sys/dev/isp/isp_freebsd.c Mon Jun 4 18:16:19 2012 (r236573) @@ -5795,11 +5795,11 @@ void isp_common_dmateardown(ispsoftc_t *isp, struct ccb_scsiio *csio, uint32_t hdl) { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_POSTREAD); + busdma_sync(PISP_PCMD(csio)->dmap, BUSDMA_SYNC_POSTREAD); } else { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_POSTWRITE); + busdma_sync(PISP_PCMD(csio)->dmap, BUSDMA_SYNC_POSTWRITE); } - bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); + busdma_md_unload(PISP_PCMD(csio)->dmap); } void Modified: projects/altix2/sys/dev/isp/isp_freebsd.h ============================================================================== --- projects/altix2/sys/dev/isp/isp_freebsd.h Mon Jun 4 18:02:09 2012 (r236572) +++ projects/altix2/sys/dev/isp/isp_freebsd.h Mon Jun 4 18:16:19 2012 (r236573) @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -150,7 +151,7 @@ typedef struct tstate { */ struct isp_pcmd { struct isp_pcmd * next; - bus_dmamap_t dmap; /* dma map for this command */ + busdma_md_t dmap; /* dma map for this command */ struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ }; @@ -167,8 +168,8 @@ struct isp_fc { struct cam_path *path; struct ispsoftc *isp; struct proc *kproc; - bus_dma_tag_t tdmat; - bus_dmamap_t tdmap; + busdma_tag_t tdmat; + busdma_md_t tdmd; uint64_t def_wwpn; uint64_t def_wwnn; uint32_t loop_down_time; @@ -245,10 +246,10 @@ struct isposinfo { * DMA related sdtuff */ bus_space_tag_t bus_tag; - bus_dma_tag_t dmat; bus_space_handle_t bus_handle; - bus_dma_tag_t cdmat; - bus_dmamap_t cdmap; + busdma_tag_t dmat; + busdma_tag_t cdmat; + busdma_md_t cdmd; /* * Command and transaction related related stuff @@ -358,25 +359,21 @@ switch (type) { \ case SYNC_SFORDEV: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ - bus_dmamap_sync(fc->tdmat, fc->tdmap, \ - BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ + busdma_sync(fc->tdmd, BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE); \ break; \ } \ case SYNC_REQUEST: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, \ + busdma_sync(isp->isp_osinfo.cdmd, \ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ break; \ case SYNC_SFORCPU: \ { \ struct isp_fc *fc = ISP_FC_PC(isp, chan); \ - bus_dmamap_sync(fc->tdmat, fc->tdmap, \ - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ + busdma_sync(fc->tdmd, BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE); \ break; \ } \ case SYNC_RESULT: \ - bus_dmamap_sync(isp->isp_osinfo.cdmat, \ - isp->isp_osinfo.cdmap, \ + busdma_sync(isp->isp_osinfo.cdmd, \ BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ break; \ case SYNC_REG: \ @@ -411,24 +408,22 @@ default: \ #define XS_T struct ccb_scsiio #define XS_DMA_ADDR_T bus_addr_t -#define XS_GET_DMA64_SEG(a, b, c) \ -{ \ - ispds64_t *d = a; \ - bus_dma_segment_t *e = b; \ - uint32_t f = c; \ - e += f; \ - d->ds_base = DMA_LO32(e->ds_addr); \ - d->ds_basehi = DMA_HI32(e->ds_addr); \ - d->ds_count = e->ds_len; \ +#define XS_GET_DMA64_SEG(a, md, c) \ +{ \ + ispds64_t *_d = a; \ + u_int _n = c; \ + bus_addr_t _a = busdma_md_get_busaddr(md, _n); \ + _d->ds_base = DMA_LO32(_a); \ + _d->ds_basehi = DMA_HI32(_a); \ + _d->ds_count = busdma_md_get_size(md, _n); \ } -#define XS_GET_DMA_SEG(a, b, c) \ -{ \ - ispds_t *d = a; \ - bus_dma_segment_t *e = b; \ - uint32_t f = c; \ - e += f; \ - d->ds_base = DMA_LO32(e->ds_addr); \ - d->ds_count = e->ds_len; \ +#define XS_GET_DMA_SEG(a, md, c) \ +{ \ + ispds_t *_d = a; \ + u_int _n = c; \ + bus_addr_t _a = busdma_md_get_busaddr(md, _n); \ + _d->ds_base = DMA_LO32(_a); \ + _d->ds_count = busdma_md_get_size(md, _n); \ } #define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path)) #define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) @@ -660,27 +655,8 @@ void isp_common_dmateardown(ispsoftc_t * /* * Platform Version specific defines */ -#ifdef ISP_USE_BUSDMA #include -#define BUS_DMA_ROOTARG(x) x -#define isp_dma_tag_create(dev, align, bndry, lowaddr, hiaddr, filter, \ - f_arg, maxsize, nsegs, maxsegsz, flags, tag_p) \ - busdma_tag_create(dev, lowaddr, align, bndry, maxsize, nsegs, \ - maxsegsz, flags, (busdma_tag_t *)tag_p) - -#define isp_dma_tag_derive(parent, align, bndry, lowaddr, highaddr, \ - filter, f_arg, maxsize, nsegs, maxsegsz, flags, tag_p) \ - busdma_tag_derive((busdma_tag_t)parent, lowaddr, align, bndry, \ - maxsize, nsegs, maxsegsz, flags, (busdma_tag_t *)tag_p) -#else -#define BUS_DMA_ROOTARG(x) bus_get_dma_tag(x) -#define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ - bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ - busdma_lock_mutex, &isp->isp_osinfo.lock, z) -#define isp_dma_tag_derive isp_dma_tag_create -#endif /* ISP_USE_BUSDMA */ - #define isp_setup_intr bus_setup_intr #define isp_sim_alloc(a, b, c, d, e, f, g, h) \ Modified: projects/altix2/sys/dev/isp/isp_library.c ============================================================================== --- projects/altix2/sys/dev/isp/isp_library.c Mon Jun 4 18:02:09 2012 (r236572) +++ projects/altix2/sys/dev/isp/isp_library.c Mon Jun 4 18:16:19 2012 (r236573) @@ -58,7 +58,8 @@ const char *isp_class3_roles[4] = { * Called with the first queue entry at least partially filled out. */ int -isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir) +isp_send_cmd(ispsoftc_t *isp, void *fqe, busdma_md_t md, uint32_t totalcnt, + isp_ddir_t ddir) { uint8_t storage[QENTRY_LEN]; uint8_t type, nqe; @@ -66,6 +67,7 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, ispds_t *dsp = NULL; ispds64_t *dsp64 = NULL; void *qe0, *qe1; + u_int nsegs; qe0 = isp_getrqentry(isp); if (qe0 == NULL) { @@ -75,6 +77,7 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, type = ((isphdr_t *)fqe)->rqs_entry_type; nqe = 1; + nsegs = busdma_md_get_nsegs(md); /* * If we have no data to transmit, just copy the first IOCB and start it up. @@ -131,9 +134,9 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, for (seg = curseg = 0; curseg < seglim; curseg++) { if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); + XS_GET_DMA64_SEG(dsp64++, md, seg++); } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); + XS_GET_DMA_SEG(dsp++, md, seg++); } } @@ -167,9 +170,9 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, } for (curseg = 0; curseg < seglim; curseg++) { if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); + XS_GET_DMA64_SEG(dsp64++, md, seg++); } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); + XS_GET_DMA_SEG(dsp++, md, seg++); } } if (dsp64) { @@ -2007,7 +2010,8 @@ isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t * Called with the first queue entry at least partially filled out. */ int -isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen) +isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, busdma_md_t md, uint32_t totalcnt, + isp_ddir_t ddir, void *snsptr, uint32_t snslen) { uint8_t storage[QENTRY_LEN], storage2[QENTRY_LEN]; uint8_t type, nqe; @@ -2015,6 +2019,7 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void * ispds_t *dsp = NULL; ispds64_t *dsp64 = NULL; void *qe0, *qe1, *sqe = NULL; + u_int nsegs; qe0 = isp_getrqentry(isp); if (qe0 == NULL) { @@ -2025,6 +2030,7 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void * type = ((isphdr_t *)fqe)->rqs_entry_type; nqe = 1; seglim = 0; + nsegs = busdma_md_get_nsegs(md); /* * If we have no data to transmit, just copy the first IOCB and start it up. @@ -2140,9 +2146,9 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void * for (seg = curseg = 0; curseg < seglim; curseg++) { if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); + XS_GET_DMA64_SEG(dsp64++, md, seg++); } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); + XS_GET_DMA_SEG(dsp++, md, seg++); } } @@ -2181,9 +2187,9 @@ isp_send_tgt_cmd(ispsoftc_t *isp, void * } for (curseg = 0; curseg < seglim; curseg++) { if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); + XS_GET_DMA64_SEG(dsp64++, md, seg++); } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); + XS_GET_DMA_SEG(dsp++, md, seg++); } } if (dsp64) { Modified: projects/altix2/sys/dev/isp/isp_library.h ============================================================================== --- projects/altix2/sys/dev/isp/isp_library.h Mon Jun 4 18:02:09 2012 (r236572) +++ projects/altix2/sys/dev/isp/isp_library.h Mon Jun 4 18:16:19 2012 (r236573) @@ -36,7 +36,7 @@ * stuff figured out, you can make all the code in one spot. */ typedef enum { ISP_TO_DEVICE, ISP_FROM_DEVICE, ISP_NOXFR} isp_ddir_t; -int isp_send_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t); +int isp_send_cmd(ispsoftc_t *, void *, busdma_md_t, uint32_t, isp_ddir_t); /* * Handle management functions. @@ -155,7 +155,7 @@ void isp_put_ct_hdr(ispsoftc_t *isp, ct_ #include "isp_target.h" #endif -int isp_send_tgt_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t, void *, uint32_t); +int isp_send_tgt_cmd(ispsoftc_t *, void *, busdma_md_t, uint32_t, isp_ddir_t, void *, uint32_t); int isp_allocate_xs_tgt(ispsoftc_t *, void *, uint32_t *); void *isp_find_xs_tgt(ispsoftc_t *, uint32_t); Modified: projects/altix2/sys/dev/isp/isp_pci.c ============================================================================== --- projects/altix2/sys/dev/isp/isp_pci.c Mon Jun 4 18:02:09 2012 (r236572) +++ projects/altix2/sys/dev/isp/isp_pci.c Mon Jun 4 18:16:19 2012 (r236573) @@ -354,7 +354,7 @@ struct isp_pcisoftc { int rgd; void * ih; int16_t pci_poff[_NREG_BLKS]; - bus_dma_tag_t dmat; + busdma_tag_t dmat; int msicount; }; @@ -1436,75 +1436,14 @@ isp_pci_wr_reg_2400(ispsoftc_t *isp, int } } - -struct imush { - ispsoftc_t *isp; - caddr_t vbase; - int chan; - int error; -}; - -static void imc(void *, bus_dma_segment_t *, int, int); -static void imc1(void *, bus_dma_segment_t *, int, int); - -static void -imc(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct imush *imushp = (struct imush *) arg; - - if (error) { - imushp->error = error; - return; - } - if (nseg != 1) { - imushp->error = EINVAL; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "request/result area @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); - imushp->isp->isp_rquest = imushp->vbase; - imushp->isp->isp_rquest_dma = segs->ds_addr; - segs->ds_addr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); - imushp->vbase += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(imushp->isp)); - imushp->isp->isp_result_dma = segs->ds_addr; - imushp->isp->isp_result = imushp->vbase; - -#ifdef ISP_TARGET_MODE - if (IS_24XX(imushp->isp)) { - segs->ds_addr += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - imushp->vbase += ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(imushp->isp)); - imushp->isp->isp_atioq_dma = segs->ds_addr; - imushp->isp->isp_atioq = imushp->vbase; - } -#endif -} - -static void -imc1(void *arg, bus_dma_segment_t *segs, int nseg, int error) -{ - struct imush *imushp = (struct imush *) arg; - if (error) { - imushp->error = error; - return; - } - if (nseg != 1) { - imushp->error = EINVAL; - return; - } - isp_prt(imushp->isp, ISP_LOGDEBUG0, "scdma @ 0x%jx/0x%jx", (uintmax_t) segs->ds_addr, (uintmax_t) segs->ds_len); - FCPARAM(imushp->isp, imushp->chan)->isp_scdma = segs->ds_addr; - FCPARAM(imushp->isp, imushp->chan)->isp_scratch = imushp->vbase; -} - static int isp_pci_mbxdma(ispsoftc_t *isp) { - caddr_t base; uint32_t len; int i, error, ns, cmap = 0; bus_size_t slim; /* segment size */ bus_addr_t llim; /* low limit of unavailable dma */ bus_addr_t hlim; /* high limit of unavailable dma */ - struct imush im; /* * Already been here? If so, leave... @@ -1553,11 +1492,13 @@ isp_pci_mbxdma(ispsoftc_t *isp) } #endif - if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &isp->isp_osinfo.dmat)) { + error = busdma_tag_create(ISP_PCD(isp), 1, slim, llim, + BUS_SPACE_MAXSIZE, ISP_NSEGS, slim, 0, &isp->isp_osinfo.dmat); + if (error) { free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); ISP_LOCK(isp); isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); - return (1); + return (error); } len = sizeof (isp_hdl_t) * isp->isp_maxcmds; @@ -1606,7 +1547,9 @@ isp_pci_mbxdma(ispsoftc_t *isp) * Create a tag for the control spaces. We don't always need this * to be 32 bits, but we do this for simplicity and speed's sake. */ - if (isp_dma_tag_derive(isp->isp_osinfo.dmat, QENTRY_LEN, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, len, ns, slim, 0, &isp->isp_osinfo.cdmat)) { + error = busdma_tag_derive(isp->isp_osinfo.dmat, QENTRY_LEN, slim, + BUS_SPACE_MAXADDR_32BIT, len, ns, slim, 0, &isp->isp_osinfo.cdmat); + if (error) { isp_prt(isp, ISP_LOGERR, "cannot create a dma tag for control spaces"); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); free(isp->isp_xflist, M_DEVBUF); @@ -1614,62 +1557,65 @@ isp_pci_mbxdma(ispsoftc_t *isp) free(isp->isp_tgtlist, M_DEVBUF); #endif ISP_LOCK(isp); - return (1); + return (error); } - if (bus_dmamem_alloc(isp->isp_osinfo.cdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &isp->isp_osinfo.cdmap) != 0) { + error = busdma_mem_alloc(isp->isp_osinfo.cdmat, 0, + &isp->isp_osinfo.cdmd); + if (error != 0) { isp_prt(isp, ISP_LOGERR, "cannot allocate %d bytes of CCB memory", len); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); + busdma_tag_destroy(isp->isp_osinfo.cdmat); free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); free(isp->isp_xflist, M_DEVBUF); #ifdef ISP_TARGET_MODE free(isp->isp_tgtlist, M_DEVBUF); #endif ISP_LOCK(isp); - return (1); + return (error); } - im.isp = isp; - im.chan = 0; - im.vbase = base; - im.error = 0; - - bus_dmamap_load(isp->isp_osinfo.cdmat, isp->isp_osinfo.cdmap, base, len, imc, &im, 0); - if (im.error) { - isp_prt(isp, ISP_LOGERR, "error %d loading dma map for control areas", im.error); - goto bad; + isp->isp_rquest = (void *)busdma_md_get_vaddr(isp->isp_osinfo.cdmd, 0); + isp->isp_rquest_dma = busdma_md_get_busaddr(isp->isp_osinfo.cdmd, 0); + isp->isp_result_dma = isp->isp_rquest_dma + ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); + isp->isp_result = (char *)isp->isp_rquest + ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); + +#ifdef ISP_TARGET_MODE + if (IS_24XX(isp)) { + isp->isp_atioq_dma = isp->isp_result_dma + ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); + isp->isp_atioq = (char *)isp->isp_result + ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); } +#endif if (IS_FC(isp)) { for (cmap = 0; cmap < isp->isp_nchan; cmap++) { struct isp_fc *fc = ISP_FC_PC(isp, cmap); - if (isp_dma_tag_derive(isp->isp_osinfo.dmat, 64, slim, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, ISP_FC_SCRLEN, 1, slim, 0, &fc->tdmat)) { + error = busdma_tag_derive(isp->isp_osinfo.dmat, 64, + slim, BUS_SPACE_MAXADDR_32BIT, ISP_FC_SCRLEN, 1, + slim, 0, &fc->tdmat); + if (error) goto bad; - } - if (bus_dmamem_alloc(fc->tdmat, (void **)&base, BUS_DMA_NOWAIT | BUS_DMA_COHERENT, &fc->tdmap) != 0) { - bus_dma_tag_destroy(fc->tdmat); - goto bad; - } - im.isp = isp; - im.chan = cmap; - im.vbase = base; - im.error = 0; - bus_dmamap_load(fc->tdmat, fc->tdmap, base, ISP_FC_SCRLEN, imc1, &im, 0); - if (im.error) { - bus_dmamem_free(fc->tdmat, base, fc->tdmap); - bus_dma_tag_destroy(fc->tdmat); + error = busdma_mem_alloc(fc->tdmat, 0, &fc->tdmd); + if (error) { + busdma_tag_destroy(fc->tdmat); goto bad; } + isp_prt(isp, ISP_LOGDEBUG0, "scdma @ 0x%jx/0x%jx", + (uintmax_t)busdma_md_get_busaddr(fc->tdmd, 0), + (uintmax_t)busdma_md_get_size(fc->tdmd, 0)); + FCPARAM(isp, cmap)->isp_scdma = + busdma_md_get_busaddr(fc->tdmd, 0); + FCPARAM(isp, cmap)->isp_scratch = + (void *)busdma_md_get_vaddr(fc->tdmd, 0); } } for (i = 0; i < isp->isp_maxcmds; i++) { struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; - error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); + error = busdma_md_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); if (error) { isp_prt(isp, ISP_LOGERR, "error %d creating per-cmd DMA maps", error); while (--i >= 0) { - bus_dmamap_destroy(isp->isp_osinfo.dmat, isp->isp_osinfo.pcmd_pool[i].dmap); + busdma_md_destroy(isp->isp_osinfo.pcmd_pool[i].dmap); } goto bad; } @@ -1687,11 +1633,11 @@ isp_pci_mbxdma(ispsoftc_t *isp) bad: while (--cmap >= 0) { struct isp_fc *fc = ISP_FC_PC(isp, cmap); - bus_dmamem_free(fc->tdmat, base, fc->tdmap); - bus_dma_tag_destroy(fc->tdmat); + busdma_mem_free(fc->tdmd); + busdma_tag_destroy(fc->tdmat); } - bus_dmamem_free(isp->isp_osinfo.cdmat, base, isp->isp_osinfo.cdmap); - bus_dma_tag_destroy(isp->isp_osinfo.cdmat); + busdma_mem_free(isp->isp_osinfo.cdmd); + busdma_tag_destroy(isp->isp_osinfo.cdmat); free(isp->isp_xflist, M_DEVBUF); #ifdef ISP_TARGET_MODE free(isp->isp_tgtlist, M_DEVBUF); @@ -1713,26 +1659,16 @@ typedef struct { #define MUSHERR_NOQENTRIES -2 #ifdef ISP_TARGET_MODE -static void tdma2_2(void *, bus_dma_segment_t *, int, bus_size_t, int); -static void tdma2(void *, bus_dma_segment_t *, int, int); - -static void -tdma2_2(void *arg, bus_dma_segment_t *dm_segs, int nseg, bus_size_t mapsize, int error) -{ - mush_t *mp; - mp = (mush_t *)arg; - mp->mapsize = mapsize; - tdma2(arg, dm_segs, nseg, error); -} static void -tdma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) +tdma_cb(void *arg, busdma_md_t md, int error) { mush_t *mp; ispsoftc_t *isp; struct ccb_scsiio *csio; isp_ddir_t ddir; ispreq_t *rq; + u_int nseg; mp = (mush_t *) arg; if (error) { @@ -1742,6 +1678,8 @@ tdma2(void *arg, bus_dma_segment_t *dm_s csio = mp->cmd_token; isp = mp->isp; rq = mp->rq; + ddir = ISP_NOXFR; + nseg = busdma_md_get_nsegs(md); if (nseg) { if (sizeof (bus_addr_t) > 4) { if (nseg >= ISP_NSEG64_MAX) { @@ -1760,48 +1698,30 @@ tdma2(void *arg, bus_dma_segment_t *dm_s } } if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + busdma_sync(PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); ddir = ISP_TO_DEVICE; } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); + busdma_sync(PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; } - if (isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len) != CMD_QUEUED) { + if (isp_send_tgt_cmd(isp, rq, md, XS_XFRLEN(csio), ddir, + &csio->sense_data, csio->sense_len) != CMD_QUEUED) { mp->error = MUSHERR_NOQENTRIES; } } #endif -static void dma2_2(void *, bus_dma_segment_t *, int, bus_size_t, int); -static void dma2(void *, bus_dma_segment_t *, int, int); - -static void -dma2_2(void *arg, bus_dma_segment_t *dm_segs, int nseg, bus_size_t mapsize, int error) -{ - mush_t *mp; - mp = (mush_t *)arg; - mp->mapsize = mapsize; - dma2(arg, dm_segs, nseg, error); -} - static void -dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) +dma_cb(void *arg, busdma_md_t md, int error) { mush_t *mp; ispsoftc_t *isp; struct ccb_scsiio *csio; isp_ddir_t ddir; ispreq_t *rq; + u_int nseg; mp = (mush_t *) arg; if (error) { @@ -1811,6 +1731,8 @@ dma2(void *arg, bus_dma_segment_t *dm_se csio = mp->cmd_token; isp = mp->isp; rq = mp->rq; + ddir = ISP_NOXFR; + nseg = busdma_md_get_nsegs(md); if (nseg) { if (sizeof (bus_addr_t) > 4) { if (nseg >= ISP_NSEG64_MAX) { @@ -1831,21 +1753,15 @@ dma2(void *arg, bus_dma_segment_t *dm_se } } if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); + busdma_sync(PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + busdma_sync(PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); ddir = ISP_TO_DEVICE; - } else { - ddir = ISP_NOXFR; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; } - if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir) != CMD_QUEUED) { + if (isp_send_cmd(isp, rq, md, XS_XFRLEN(csio), ddir) != CMD_QUEUED) { mp->error = MUSHERR_NOQENTRIES; } } @@ -1854,8 +1770,7 @@ static int isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) { mush_t mush, *mp; - void (*eptr)(void *, bus_dma_segment_t *, int, int); - void (*eptr2)(void *, bus_dma_segment_t *, int, bus_size_t, int); + busdma_callback_f cbf; mp = &mush; mp->isp = isp; @@ -1865,47 +1780,43 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct mp->mapsize = 0; #ifdef ISP_TARGET_MODE - if (csio->ccb_h.func_code == XPT_CONT_TARGET_IO) { - eptr = tdma2; - eptr2 = tdma2_2; - } else + if (csio->ccb_h.func_code == XPT_CONT_TARGET_IO) + cbf = tdma_cb; + else #endif - { - eptr = dma2; - eptr2 = dma2_2; - } - + cbf = dma_cb; - if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE || (csio->dxfer_len == 0)) { - (*eptr)(mp, NULL, 0, 0); + if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_NONE || + (csio->dxfer_len == 0)) { + (*cbf)(mp, NULL, 0); } else if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) { + int error; if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) { - int error; - error = bus_dmamap_load(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, csio->data_ptr, csio->dxfer_len, eptr, mp, 0); + error = busdma_md_load_linear(PISP_PCMD(csio)->dmap, + csio->data_ptr, csio->dxfer_len, cbf, mp, 0); + } else { + error = busdma_md_load_phys(PISP_PCMD(csio)->dmap, + (uintptr_t)csio->data_ptr, csio->dxfer_len, cbf, + mp, 0); + } #if 0 - xpt_print(csio->ccb_h.path, "%s: bus_dmamap_load " "ptr %p len %d returned %d\n", __func__, csio->data_ptr, csio->dxfer_len, error); + xpt_print(csio->ccb_h.path, "%s: busdma_md_load ptr %p len %d " + "returned %d\n", __func__, csio->data_ptr, csio->dxfer_len, + error); #endif - - if (error == EINPROGRESS) { - bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); - mp->error = EINVAL; - isp_prt(isp, ISP_LOGERR, "deferred dma allocation not supported"); - } else if (error && mp->error == 0) { + if (error == EINPROGRESS) { + busdma_md_unload(PISP_PCMD(csio)->dmap); + mp->error = EINVAL; + isp_prt(isp, ISP_LOGERR, + "deferred dma allocation not supported"); + } else if (error && mp->error == 0) { #ifdef DIAGNOSTIC - isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error); + isp_prt(isp, ISP_LOGERR, + "error %d in dma mapping code", error); #endif - mp->error = error; - } - } else { - /* Pointer to physical buffer */ - struct bus_dma_segment seg; - seg.ds_addr = (bus_addr_t)(vm_offset_t)csio->data_ptr; - seg.ds_len = csio->dxfer_len; - (*eptr)(mp, &seg, 1, 0); + mp->error = error; } } else { - struct bus_dma_segment *segs; - if ((csio->ccb_h.flags & CAM_DATA_PHYS) != 0) { isp_prt(isp, ISP_LOGERR, "Physical segment pointers unsupported"); mp->error = EINVAL; @@ -1929,16 +1840,16 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct sguio.uio_resid = csio->dxfer_len; sguio.uio_segflg = UIO_SYSSPACE; - error = bus_dmamap_load_uio(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, &sguio, eptr2, mp, 0); + error = busdma_md_load_uio(PISP_PCMD(csio)->dmap, + &sguio, cbf, mp, 0); if (error != 0 && mp->error == 0) { isp_prt(isp, ISP_LOGERR, "error %d in dma mapping code", error); mp->error = error; } } else { - /* Just use the segments provided */ - segs = (struct bus_dma_segment *) csio->data_ptr; - (*eptr)(mp, segs, csio->sglist_cnt, 0); + isp_prt(isp, ISP_LOGERR, "Physical segment pointers unsupported"); + mp->error = EINVAL; } } if (mp->error) { From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 18:17:10 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 071A9106566C; Mon, 4 Jun 2012 18:17:10 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C713F8FC16; Mon, 4 Jun 2012 18:17:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54IH97S057643; Mon, 4 Jun 2012 18:17:09 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54IH9H9057641; Mon, 4 Jun 2012 18:17:09 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206041817.q54IH9H9057641@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 18:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236574 - projects/altix2/sys/ia64/conf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 18:17:10 -0000 Author: marcel Date: Mon Jun 4 18:17:09 2012 New Revision: 236574 URL: http://svn.freebsd.org/changeset/base/236574 Log: Remove ISP_USE_BUSDMA. Modified: projects/altix2/sys/ia64/conf/ALTIX Modified: projects/altix2/sys/ia64/conf/ALTIX ============================================================================== --- projects/altix2/sys/ia64/conf/ALTIX Mon Jun 4 18:16:19 2012 (r236573) +++ projects/altix2/sys/ia64/conf/ALTIX Mon Jun 4 18:17:09 2012 (r236574) @@ -3,8 +3,6 @@ cpu ITANIUM2 ident ALTIX -options ISP_USE_BUSDMA - makeoptions DEBUG=-g makeoptions MODULES_OVERRIDE="" From owner-svn-src-projects@FreeBSD.ORG Mon Jun 4 18:45:18 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A5E03106564A; Mon, 4 Jun 2012 18:45:18 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90CF38FC17; Mon, 4 Jun 2012 18:45:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q54IjIv4058988; Mon, 4 Jun 2012 18:45:18 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q54IjI1S058985; Mon, 4 Jun 2012 18:45:18 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201206041845.q54IjI1S058985@svn.freebsd.org> From: Marcel Moolenaar Date: Mon, 4 Jun 2012 18:45:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236576 - projects/altix2/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2012 18:45:18 -0000 Author: marcel Date: Mon Jun 4 18:45:18 2012 New Revision: 236576 URL: http://svn.freebsd.org/changeset/base/236576 Log: Implement BUSDMA_IOMMU_MAP. We want to map starting with the root and ending with the leaf. In other words, we want to map top-down (root to leaf) and not bottom-up (learfd to root). Given that we have a fairly shallow device tree, use recursion to walk up to the root first and then call the BUSDMA_IOMMU_MAP on the device on the way back down (i.e. while unwinding from the recursion. At the root, bus addresses are the same as CPU (physical addresses), so we assign the CPU address to the bus address. Modified: projects/altix2/sys/kern/busdma_if.m projects/altix2/sys/kern/subr_busdma.c Modified: projects/altix2/sys/kern/busdma_if.m ============================================================================== --- projects/altix2/sys/kern/busdma_if.m Mon Jun 4 18:43:51 2012 (r236575) +++ projects/altix2/sys/kern/busdma_if.m Mon Jun 4 18:45:18 2012 (r236576) @@ -38,6 +38,12 @@ CODE { { return (0); } + + static int + default_iommu_map_unmap(device_t dev, busdma_md_t md) + { + return (0); + } }; METHOD int iommu_xlate { @@ -48,9 +54,9 @@ METHOD int iommu_xlate { METHOD int iommu_map { device_t dev; busdma_md_t md; -}; +} DEFAULT default_iommu_map_unmap; METHOD int iommu_unmap { device_t dev; busdma_md_t md; -}; +} DEFAULT default_iommu_map_unmap; Modified: projects/altix2/sys/kern/subr_busdma.c ============================================================================== --- projects/altix2/sys/kern/subr_busdma.c Mon Jun 4 18:43:51 2012 (r236575) +++ projects/altix2/sys/kern/subr_busdma.c Mon Jun 4 18:45:18 2012 (r236576) @@ -131,15 +131,17 @@ _busdma_tag_dump(const char *func, devic } static void -_busdma_md_dump(const char *func, struct busdma_md *md) +_busdma_md_dump(const char *func, device_t dev, struct busdma_md *md) { struct busdma_tag *tag; struct busdma_md_seg *seg; int idx; tag = md->md_tag; + if (dev == NULL) + dev = tag->dt_device; printf("[%s: %s: md=%p (tag=%p, flags=%x, nsegs=%u)", func, - device_get_nameunit(tag->dt_device), md, tag, md->md_flags, + device_get_nameunit(dev), md, tag, md->md_flags, md->md_nsegs); if (md->md_nsegs == 0) { printf(" -- UNUSED]\n"); @@ -221,12 +223,14 @@ _busdma_md_create(struct busdma_tag *tag } static int -_busdma_iommu_xlate(device_t dev, struct busdma_mtag *mtag) +_busdma_iommu_xlate(device_t leaf, struct busdma_mtag *mtag) { + device_t dev; int error; error = 0; - while (!error && dev != NULL) { + dev = device_get_parent(leaf); + while (!error && dev != root_bus) { _busdma_mtag_dump(__func__, dev, mtag); error = BUSDMA_IOMMU_XLATE(dev, mtag); if (!error) @@ -236,6 +240,44 @@ _busdma_iommu_xlate(device_t dev, struct return (error); } +static int +_busdma_iommu_map_r(device_t dev, struct busdma_md *md) +{ + struct busdma_md_seg *seg; + u_int idx; + int error; + + if (dev == root_bus) { + /* + * A bus address and a physical address are one and the same + * at this level. + */ + for (idx = 0; idx < md->md_nsegs; idx++) { + seg = &md->md_seg[idx]; + seg->mds_busaddr = seg->mds_paddr; + } + _busdma_md_dump(__func__, dev, md); + return (0); + } + + error = _busdma_iommu_map_r(device_get_parent(dev), md); + if (!error) { + error = BUSDMA_IOMMU_MAP(dev, md); + _busdma_md_dump(__func__, dev, md); + } + return (error); +} + +static int +_busdma_iommu_map(device_t leaf, struct busdma_md *md) +{ + int error; + + _busdma_md_dump(__func__, leaf, md); + error = _busdma_iommu_map_r(device_get_parent(leaf), md); + return (error); +} + int busdma_tag_create(device_t dev, bus_addr_t align, bus_addr_t bndry, bus_addr_t maxaddr, bus_size_t maxsz, u_int nsegs, bus_size_t maxsegsz, @@ -298,7 +340,7 @@ busdma_md_create(struct busdma_tag *tag, if (md == NULL) return (ENOMEM); - _busdma_md_dump(__func__, md); + _busdma_md_dump(__func__, NULL, md); *md_p = md; return (0); } @@ -442,16 +484,14 @@ busdma_mem_alloc(struct busdma_tag *tag, goto fail; } seg->mds_paddr = pmap_kextract(seg->mds_vaddr); - seg->mds_busaddr = seg->mds_paddr; maxsz -= seg->mds_size; idx++; } if (maxsz == 0) { md->md_nsegs = idx; - error = BUSDMA_IOMMU_MAP(tag->dt_device, md); + error = _busdma_iommu_map(tag->dt_device, md); if (error) - printf("BUSDMA_IOMMU_MAP: error=%d\n", error); - _busdma_md_dump(__func__, md); + printf("_busdma_iommu_map: error=%d\n", error); *md_p = md; return (0); } From owner-svn-src-projects@FreeBSD.ORG Tue Jun 5 09:49:32 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 661991065673; Tue, 5 Jun 2012 09:49:32 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 517938FC22; Tue, 5 Jun 2012 09:49:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q559nV94002790; Tue, 5 Jun 2012 09:49:31 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q559nV63002787; Tue, 5 Jun 2012 09:49:31 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201206050949.q559nV63002787@svn.freebsd.org> From: "Cherry G. Mathew" Date: Tue, 5 Jun 2012 09:49:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236603 - projects/amd64_xen_pv/sys/amd64/xen X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 09:49:32 -0000 Author: cherry Date: Tue Jun 5 09:49:31 2012 New Revision: 236603 URL: http://svn.freebsd.org/changeset/base/236603 Log: Enable the event channel callback code. Events are now routed via the xen/evtchn/evtchn.c:evtchn_do_upcall() callback. Also initialise the "failsafe" callback. Approved by: gibbs (implicit) Modified: projects/amd64_xen_pv/sys/amd64/xen/exception.S projects/amd64_xen_pv/sys/amd64/xen/machdep.c Modified: projects/amd64_xen_pv/sys/amd64/xen/exception.S ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/exception.S Tue Jun 5 09:45:42 2012 (r236602) +++ projects/amd64_xen_pv/sys/amd64/xen/exception.S Tue Jun 5 09:49:31 2012 (r236603) @@ -40,6 +40,8 @@ #include "assym.s" +#define T_EVENT T_RESERVED /* XXX: */ + /* * We're guaranteed that sizeof(struct vcpu_info) == 64 bytes. * log2(64) == 6; @@ -143,6 +145,11 @@ movq %rsp, %rdi ; \ call trap +#define EVENT_UPCALL \ + cld ; \ + movq %rsp, %rdi ; \ + call evtchn_do_upcall + #define DO_AST_MAYBE \ testb $SEL_RPL_MASK, TF_CS(%rsp) /* are we returning to user mode? */ ; \ jz 2f /* can't handle ASTs now if not */ ; \ @@ -473,3 +480,20 @@ ENTRY(fork_trampoline) INTR_EXIT ; /* XXX: more work required - %rsp offset calc etc. */ +IDTVEC(hypervisor_callback) /* Xen only */ + TRAP_FRAME_ENTER_NOERR ; + TRAP_PROLOGUE(T_EVENT) ; + SAVE_SEGMENT_REGS ; + SAVE_GENERAL_REGS ; + DO_STI_MAYBE ; + EVENT_UPCALL ; + DO_AST_MAYBE ; + RESTORE_GENERAL_REGS ; + RESTORE_SEGMENT_REGS ; + TRAP_FRAME_EXIT_NOERR ; + INTR_EXIT ; + +ENTRY(failsafe_callback) + movq msgfailsafe, %rdi ; + call panic ; /* panic("..."); */ +msgfailsafe: .asciz "Failsafe upcall triggered\n" Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c ============================================================================== --- projects/amd64_xen_pv/sys/amd64/xen/machdep.c Tue Jun 5 09:45:42 2012 (r236602) +++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c Tue Jun 5 09:49:31 2012 (r236603) @@ -104,7 +104,7 @@ xen_pfn_t *xen_phys_machine; #define PHYSMAP_SIZE (2 * VM_PHYSSEG_MAX) vm_offset_t pa_index = 0; vm_paddr_t phys_avail[PHYSMAP_SIZE + 2]; -vm_paddr_t dump_avail[0]; /* XXX: todo */ +vm_paddr_t dump_avail[2] = {0, 0}; /* XXX: todo */ struct pcpu __pcpu[MAXCPU]; @@ -114,6 +114,10 @@ __aligned(PAGE_SIZE); /* vcpu0 global de struct mtx icu_lock; struct mtx dt_lock; /* lock for GDT and LDT */ /* XXX : please review its use */ +/* Event callback prototypes */ +void Xhypervisor_callback(void); +void failsafe_callback(void); + vm_paddr_t initxen(struct start_info *); extern void identify_cpu(void); @@ -255,6 +259,25 @@ init_exception_table(void) } +static void init_event_callbacks(void) +{ + struct callback_register event = { + .type = CALLBACKTYPE_event, + .address = (unsigned long)Xhypervisor_callback + }; + + struct callback_register failsafe = { + .type = CALLBACKTYPE_failsafe, + .address = (unsigned long)failsafe_callback + }; + + PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &event)); + + PANIC_IF(HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe)); + + /* XXX: syscall */ +} + #define XEN_CPUID_LEAF_HYPERCALL XEN_CPUID_LEAF(3 - 1) void xen_set_hypercall_page(vm_paddr_t); @@ -406,6 +429,9 @@ initxen(struct start_info *si) /* exception handling */ init_exception_table(); + /* Event handling */ + init_event_callbacks(); + identify_cpu(); /* Final stage of CPU initialization */ //msgbufinit(msgbufp, msgbufsize); From owner-svn-src-projects@FreeBSD.ORG Tue Jun 5 19:51:38 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 59D231065673; Tue, 5 Jun 2012 19:51:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3A7248FC12; Tue, 5 Jun 2012 19:51:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q55JpcNk040268; Tue, 5 Jun 2012 19:51:38 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q55Jpc0n040265; Tue, 5 Jun 2012 19:51:38 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206051951.q55Jpc0n040265@svn.freebsd.org> From: Gleb Smirnoff Date: Tue, 5 Jun 2012 19:51:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236630 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jun 2012 19:51:38 -0000 Author: glebius Date: Tue Jun 5 19:51:37 2012 New Revision: 236630 URL: http://svn.freebsd.org/changeset/base/236630 Log: - Join "frag reassembly entry" and "frag cache entry" into one union. Allocate union item from single zone, and assign the frag limit to that zone. - Allocate both kinds of fragments from one zone. - Remove global counters, use uma_zone_get_cur() isntead. Minor nits: - M_ZERO instead of bzero() - Reduce lock coverage in pf_normalize_ip(). Modified: projects/pf/head/sys/contrib/pf/net/pf_norm.c projects/pf/head/sys/contrib/pf/net/pfvar.h Modified: projects/pf/head/sys/contrib/pf/net/pf_norm.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_norm.c Tue Jun 5 19:42:57 2012 (r236629) +++ projects/pf/head/sys/contrib/pf/net/pf_norm.c Tue Jun 5 19:51:37 2012 (r236630) @@ -70,15 +70,21 @@ __FBSDID("$FreeBSD$"); struct pf_frent { LIST_ENTRY(pf_frent) fr_next; - struct ip *fr_ip; - struct mbuf *fr_m; -}; - -struct pf_frcache { - LIST_ENTRY(pf_frcache) fr_next; - uint16_t fr_off; - uint16_t fr_end; + union { + struct { + struct ip *_fr_ip; + struct mbuf *_fr_m; + } _frag; + struct { + uint16_t _fr_off; + uint16_t _fr_end; + } _cache; + } _u; }; +#define fr_ip _u._frag._fr_ip +#define fr_m _u._frag._fr_m +#define fr_off _u._cache._fr_off +#define fr_end _u._cache._fr_end struct pf_fragment { RB_ENTRY(pf_fragment) fr_entry; @@ -94,12 +100,7 @@ struct pf_fragment { u_int16_t fr_id; /* fragment id for reassemble */ u_int16_t fr_max; /* fragment data max */ u_int32_t fr_timeout; -#define fr_queue fr_u.fru_queue -#define fr_cache fr_u.fru_cache - union { - LIST_HEAD(pf_fragq, pf_frent) fru_queue; /* buffering */ - LIST_HEAD(pf_cacheq, pf_frcache) fru_cache; /* non-buf */ - } fr_u; + LIST_HEAD(, pf_frent) fr_queue; }; static struct mtx pf_frag_mtx; @@ -113,14 +114,6 @@ static VNET_DEFINE(uma_zone_t, pf_frent_ #define V_pf_frent_z VNET(pf_frent_z) static VNET_DEFINE(uma_zone_t, pf_frag_z); #define V_pf_frag_z VNET(pf_frag_z) -static VNET_DEFINE(uma_zone_t, pf_cache_z); -#define V_pf_cache_z VNET(pf_cache_z) -static VNET_DEFINE(uma_zone_t, pf_cent_z); -#define V_pf_cent_z VNET(pf_cent_z) -static VNET_DEFINE(int, pf_nfrents); -#define V_pf_nfrents VNET(pf_nfrents) -static VNET_DEFINE(int, pf_ncache); -#define V_pf_ncache VNET(pf_ncache) TAILQ_HEAD(pf_fragqueue, pf_fragment); TAILQ_HEAD(pf_cachequeue, pf_fragment); @@ -166,30 +159,17 @@ void pf_normalize_init(void) { - V_pf_frent_z = uma_zcreate("pffrent", sizeof(struct pf_frent), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - /* XXXGL: two zones of struct pf_fragment */ - V_pf_frag_z = uma_zcreate("pffrag", sizeof(struct pf_fragment), + V_pf_frag_z = uma_zcreate("pf frags", sizeof(struct pf_fragment), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_cache_z = uma_zcreate("pffrcache", sizeof(struct pf_fragment), + V_pf_frent_z = uma_zcreate("pf frag entries", sizeof(struct pf_frent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_cent_z = uma_zcreate("pffrcent", sizeof(struct pf_frcache), - NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - V_pf_state_scrub_z = uma_zcreate("pfstatescrub", + V_pf_state_scrub_z = uma_zcreate("pf state scrubs", sizeof(struct pf_state_scrub), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); - /* - * XXX - * No high water mark support(It's hint not hard limit). - * uma_zone_set_max(pf_frag_z, PFFRAG_FRAG_HIWAT); - */ - uma_zone_set_max(V_pf_frent_z, PFFRAG_FRENT_HIWAT); - uma_zone_set_max(V_pf_cache_z, PFFRAG_FRCACHE_HIWAT); - uma_zone_set_max(V_pf_cent_z, PFFRAG_FRCENT_HIWAT); - V_pf_limits[PF_LIMIT_FRAGS].zone = V_pf_frent_z; V_pf_limits[PF_LIMIT_FRAGS].limit = PFFRAG_FRENT_HIWAT; + uma_zone_set_max(V_pf_frent_z, PFFRAG_FRENT_HIWAT); mtx_init(&pf_frag_mtx, "pf fragments", NULL, MTX_DEF); @@ -201,11 +181,9 @@ void pf_normalize_cleanup(void) { + uma_zdestroy(V_pf_state_scrub_z); uma_zdestroy(V_pf_frent_z); uma_zdestroy(V_pf_frag_z); - uma_zdestroy(V_pf_cache_z); - uma_zdestroy(V_pf_cent_z); - uma_zdestroy(V_pf_state_scrub_z); mtx_destroy(&pf_frag_mtx); } @@ -271,30 +249,22 @@ pf_purge_expired_fragments(void) static void pf_flush_fragments(void) { - struct pf_fragment *frag; + struct pf_fragment *frag, *cache; int goal; PF_FRAG_ASSERT(); - goal = V_pf_nfrents * 9 / 10; - DPFPRINTF(("trying to free > %d frents\n", - V_pf_nfrents - goal)); - while (goal < V_pf_nfrents) { + goal = uma_zone_get_cur(V_pf_frent_z) * 9 / 10; + DPFPRINTF(("trying to free %d frag entriess\n", goal)); + while (goal < uma_zone_get_cur(V_pf_frent_z)) { frag = TAILQ_LAST(&V_pf_fragqueue, pf_fragqueue); - if (frag == NULL) + if (frag) + pf_free_fragment(frag); + cache = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue); + if (cache) + pf_free_fragment(cache); + if (frag == NULL && cache == NULL) break; - pf_free_fragment(frag); - } - - - goal = V_pf_ncache * 9 / 10; - DPFPRINTF(("trying to free > %d cache entries\n", - V_pf_ncache - goal)); - while (goal < V_pf_ncache) { - frag = TAILQ_LAST(&V_pf_cachequeue, pf_cachequeue); - if (frag == NULL) - break; - pf_free_fragment(frag); } } @@ -304,7 +274,6 @@ static void pf_free_fragment(struct pf_fragment *frag) { struct pf_frent *frent; - struct pf_frcache *frcache; PF_FRAG_ASSERT(); @@ -316,21 +285,19 @@ pf_free_fragment(struct pf_fragment *fra m_freem(frent->fr_m); uma_zfree(V_pf_frent_z, frent); - V_pf_nfrents--; } } else { - for (frcache = LIST_FIRST(&frag->fr_cache); frcache; - frcache = LIST_FIRST(&frag->fr_cache)) { - LIST_REMOVE(frcache, fr_next); - - KASSERT((LIST_EMPTY(&frag->fr_cache) || - LIST_FIRST(&frag->fr_cache)->fr_off > - frcache->fr_end), + for (frent = LIST_FIRST(&frag->fr_queue); frent; + frent = LIST_FIRST(&frag->fr_queue)) { + LIST_REMOVE(frent, fr_next); + + KASSERT((LIST_EMPTY(&frag->fr_queue) || + LIST_FIRST(&frag->fr_queue)->fr_off > + frent->fr_end), ("! (LIST_EMPTY() || LIST_FIRST()->fr_off >" - " frcache->fr_end): %s", __FUNCTION__)); + " frent->fr_end): %s", __func__)); - uma_zfree(V_pf_cent_z, frcache); - V_pf_ncache--; + uma_zfree(V_pf_frent_z, frent); } } @@ -387,7 +354,7 @@ pf_remove_fragment(struct pf_fragment *f } else { RB_REMOVE(pf_frag_tree, &V_pf_cache_tree, frag); TAILQ_REMOVE(&V_pf_cachequeue, frag, frag_next); - uma_zfree(V_pf_cache_z, frag); + uma_zfree(V_pf_frag_z, frag); } } @@ -495,7 +462,6 @@ pf_reassemble(struct mbuf **m0, struct p m_freem(frea->fr_m); LIST_REMOVE(frea, fr_next); uma_zfree(V_pf_frent_z, frea); - V_pf_nfrents--; } insert: @@ -552,13 +518,11 @@ pf_reassemble(struct mbuf **m0, struct p m->m_next = NULL; m_cat(m, m2); uma_zfree(V_pf_frent_z, frent); - V_pf_nfrents--; for (frent = next; frent != NULL; frent = next) { next = LIST_NEXT(frent, fr_next); m2 = frent->fr_m; uma_zfree(V_pf_frent_z, frent); - V_pf_nfrents--; m->m_pkthdr.csum_flags &= m2->m_pkthdr.csum_flags; m->m_pkthdr.csum_data += m2->m_pkthdr.csum_data; m_cat(m, m2); @@ -594,7 +558,6 @@ pf_reassemble(struct mbuf **m0, struct p drop_fragment: /* Oops - fail safe - drop packet */ uma_zfree(V_pf_frent_z, frent); - V_pf_nfrents--; m_freem(m); return (NULL); } @@ -604,7 +567,7 @@ pf_fragcache(struct mbuf **m0, struct ip int drop, int *nomem) { struct mbuf *m = *m0; - struct pf_frcache *frp, *fra, *cur = NULL; + struct pf_frent *frp, *fra, *cur = NULL; int ip_len = ntohs(h->ip_len) - (h->ip_hl << 2); u_int16_t off = ntohs(h->ip_off) << 3; u_int16_t max = ip_len + off; @@ -616,22 +579,21 @@ pf_fragcache(struct mbuf **m0, struct ip /* Create a new range queue for this packet */ if (*frag == NULL) { - *frag = uma_zalloc(V_pf_cache_z, M_NOWAIT); + *frag = uma_zalloc(V_pf_frag_z, M_NOWAIT); if (*frag == NULL) { pf_flush_fragments(); - *frag = uma_zalloc(V_pf_cache_z, M_NOWAIT); + *frag = uma_zalloc(V_pf_frag_z, M_NOWAIT); if (*frag == NULL) goto no_mem; } /* Get an entry for the queue */ - cur = uma_zalloc(V_pf_cent_z, M_NOWAIT); + cur = uma_zalloc(V_pf_frent_z, M_NOWAIT); if (cur == NULL) { - uma_zfree(V_pf_cache_z, *frag); + uma_zfree(V_pf_frag_z, *frag); *frag = NULL; goto no_mem; } - V_pf_ncache++; (*frag)->fr_flags = PFFRAG_NOBUFFER; (*frag)->fr_max = 0; @@ -643,8 +605,8 @@ pf_fragcache(struct mbuf **m0, struct ip cur->fr_off = off; cur->fr_end = max; - LIST_INIT(&(*frag)->fr_cache); - LIST_INSERT_HEAD(&(*frag)->fr_cache, cur, fr_next); + LIST_INIT(&(*frag)->fr_queue); + LIST_INSERT_HEAD(&(*frag)->fr_queue, cur, fr_next); RB_INSERT(pf_frag_tree, &V_pf_cache_tree, *frag); TAILQ_INSERT_HEAD(&V_pf_cachequeue, *frag, frag_next); @@ -659,7 +621,7 @@ pf_fragcache(struct mbuf **m0, struct ip * - off contains the real shifted offset. */ frp = NULL; - LIST_FOREACH(fra, &(*frag)->fr_cache, fr_next) { + LIST_FOREACH(fra, &(*frag)->fr_queue, fr_next) { if (fra->fr_off > off) break; frp = fra; @@ -749,10 +711,9 @@ pf_fragcache(struct mbuf **m0, struct ip h->ip_id, -precut, frp->fr_off, frp->fr_end, off, max)); - cur = uma_zalloc(V_pf_cent_z, M_NOWAIT); + cur = uma_zalloc(V_pf_frent_z, M_NOWAIT); if (cur == NULL) goto no_mem; - V_pf_ncache++; cur->fr_off = off; cur->fr_end = max; @@ -804,10 +765,9 @@ pf_fragcache(struct mbuf **m0, struct ip h->ip_id, -aftercut, off, max, fra->fr_off, fra->fr_end)); - cur = uma_zalloc(V_pf_cent_z, M_NOWAIT); + cur = uma_zalloc(V_pf_frent_z, M_NOWAIT); if (cur == NULL) goto no_mem; - V_pf_ncache++; cur->fr_off = off; cur->fr_end = max; @@ -825,8 +785,7 @@ pf_fragcache(struct mbuf **m0, struct ip max, fra->fr_off, fra->fr_end)); fra->fr_off = cur->fr_off; LIST_REMOVE(cur, fr_next); - uma_zfree(V_pf_cent_z, cur); - V_pf_ncache--; + uma_zfree(V_pf_frent_z, cur); cur = NULL; } else if (frp && fra->fr_off <= frp->fr_end) { @@ -839,8 +798,7 @@ pf_fragcache(struct mbuf **m0, struct ip max, fra->fr_off, fra->fr_end)); fra->fr_off = frp->fr_off; LIST_REMOVE(frp, fr_next); - uma_zfree(V_pf_cent_z, frp); - V_pf_ncache--; + uma_zfree(V_pf_frent_z, frp); frp = NULL; } @@ -868,8 +826,8 @@ pf_fragcache(struct mbuf **m0, struct ip /* Check if we are completely reassembled */ if (((*frag)->fr_flags & PFFRAG_SEENLAST) && - LIST_FIRST(&(*frag)->fr_cache)->fr_off == 0 && - LIST_FIRST(&(*frag)->fr_cache)->fr_end == (*frag)->fr_max) { + LIST_FIRST(&(*frag)->fr_queue)->fr_off == 0 && + LIST_FIRST(&(*frag)->fr_queue)->fr_end == (*frag)->fr_max) { /* Remove from fragment queue */ DPFPRINTF(("fragcache[%d]: done 0-%d\n", h->ip_id, (*frag)->fr_max)); @@ -1021,22 +979,19 @@ pf_normalize_ip(struct mbuf **m0, int di REASON_SET(reason, PFRES_MEMORY); return (PF_DROP); } - V_pf_nfrents++; frent->fr_ip = h; frent->fr_m = m; /* Might return a completely reassembled mbuf, or NULL */ DPFPRINTF(("reass frag %d @ %d-%d\n", h->ip_id, fragoff, max)); *m0 = m = pf_reassemble(m0, &frag, frent, mff); + PF_FRAG_UNLOCK(); - if (m == NULL) { - PF_FRAG_UNLOCK(); + if (m == NULL) return (PF_DROP); - } /* use mtag from concatenated mbuf chain */ pd->pf_mtag = pf_find_mtag(m); - PF_FRAG_UNLOCK(); #ifdef DIAGNOSTIC if (pd->pf_mtag == NULL) { printf("%s: pf_find_mtag returned NULL(1)\n", __func__); @@ -1077,8 +1032,8 @@ pf_normalize_ip(struct mbuf **m0, int di *m0 = m = pf_fragcache(m0, h, &frag, mff, (r->rule_flag & PFRULE_FRAGDROP) ? 1 : 0, &nomem); + PF_FRAG_UNLOCK(); if (m == NULL) { - PF_FRAG_UNLOCK(); if (nomem) goto no_mem; goto drop; @@ -1086,7 +1041,6 @@ pf_normalize_ip(struct mbuf **m0, int di /* use mtag from copied and trimmed mbuf chain */ pd->pf_mtag = pf_find_mtag(m); - PF_FRAG_UNLOCK(); #ifdef DIAGNOSTIC if (pd->pf_mtag == NULL) { printf("%s: pf_find_mtag returned NULL(2)\n", __func__); @@ -1466,10 +1420,9 @@ pf_normalize_tcp_init(struct mbuf *m, in KASSERT((src->scrub == NULL), ("pf_normalize_tcp_init: src->scrub != NULL")); - src->scrub = uma_zalloc(V_pf_state_scrub_z, M_NOWAIT); + src->scrub = uma_zalloc(V_pf_state_scrub_z, M_ZERO | M_NOWAIT); if (src->scrub == NULL) return (1); - bzero(src->scrub, sizeof(*src->scrub)); switch (pd->af) { #ifdef INET Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Tue Jun 5 19:42:57 2012 (r236629) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Tue Jun 5 19:51:37 2012 (r236630) @@ -1408,12 +1408,7 @@ struct pf_divert { }; #define PFFRAG_FRENT_HIWAT 5000 /* Number of fragment entries */ -#define PFFRAG_FRAG_HIWAT 1000 /* Number of fragmented packets */ -#define PFFRAG_FRCENT_HIWAT 50000 /* Number of fragment cache entries */ -#define PFFRAG_FRCACHE_HIWAT 10000 /* Number of fragment descriptors */ - #define PFR_KENTRY_HIWAT 200000 /* Number of table entries */ -#define PFR_KENTRY_HIWAT_SMALL 100000 /* Number of table entries (tiny hosts) */ /* * ioctl parameter structures From owner-svn-src-projects@FreeBSD.ORG Wed Jun 6 00:20:14 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6ED8A106566B; Wed, 6 Jun 2012 00:20:14 +0000 (UTC) (envelope-from obrien@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57DDD8FC16; Wed, 6 Jun 2012 00:20:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q560KE3u055401; Wed, 6 Jun 2012 00:20:14 GMT (envelope-from obrien@svn.freebsd.org) Received: (from obrien@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q560KEtj055396; Wed, 6 Jun 2012 00:20:14 GMT (envelope-from obrien@svn.freebsd.org) Message-Id: <201206060020.q560KEtj055396@svn.freebsd.org> From: "David E. O'Brien" Date: Wed, 6 Jun 2012 00:20:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236647 - in projects/bmake: share/man/man4 sys/dev/filemon sys/modules sys/modules/filemon tools/regression/filemon X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 00:20:14 -0000 Author: obrien Date: Wed Jun 6 00:20:13 2012 New Revision: 236647 URL: http://svn.freebsd.org/changeset/base/236647 Log: MFC: r236422, r236592, r236593, r236594, r236620, r236621, r236622, & r236637 filemon(4) Added: projects/bmake/share/man/man4/filemon.4 - copied, changed from r236593, head/share/man/man4/filemon.4 projects/bmake/sys/dev/filemon/ - copied from r236592, head/sys/dev/filemon/ projects/bmake/sys/modules/filemon/ - copied from r236592, head/sys/modules/filemon/ projects/bmake/tools/regression/filemon/ - copied from r236594, head/tools/regression/filemon/ Modified: projects/bmake/share/man/man4/Makefile projects/bmake/sys/modules/Makefile projects/bmake/tools/regression/filemon/filemontest.c Directory Properties: projects/bmake/ (props changed) projects/bmake/share/man/man4/ (props changed) projects/bmake/sys/ (props changed) Modified: projects/bmake/share/man/man4/Makefile ============================================================================== --- projects/bmake/share/man/man4/Makefile Tue Jun 5 23:48:20 2012 (r236646) +++ projects/bmake/share/man/man4/Makefile Wed Jun 6 00:20:13 2012 (r236647) @@ -126,6 +126,7 @@ MAN= aac.4 \ fdt.4 \ fdtbus.4 \ ffclock.4 \ + filemon.4 \ firewire.4 \ fpa.4 \ fwe.4 \ Copied and modified: projects/bmake/share/man/man4/filemon.4 (from r236593, head/share/man/man4/filemon.4) ============================================================================== --- head/share/man/man4/filemon.4 Mon Jun 4 22:59:06 2012 (r236593, copy source) +++ projects/bmake/share/man/man4/filemon.4 Wed Jun 6 00:20:13 2012 (r236647) @@ -50,63 +50,74 @@ responds to two calls. .Pp System calls are denoted using the following single letters: +.Pp .Bl -tag -width indent -compact -.It Dq Li C +.It Ql C .Xr chdir 2 -.It Dq Li D +.It Ql D .Xr unlink 2 -.It Dq Li E +.It Ql E .Xr exec 2 -.It Dq Li F +.It Ql F .Xr fork 2 , .Xr vfork 2 -.It Dq Li L +.It Ql L .Xr link 2 , .Xr linkat 2 , .Xr symlink 2 , .Xr symlinkat 2 -.It Dq Li M +.It Ql M .Xr rename 2 -.It Dq Li R +.It Ql R .Xr open 2 for read -.It Dq Li S +.It Ql S .Xr stat 2 -.It Dq Li W +.It Ql W .Xr open 2 for write -.It Dq Li X +.It Ql X .Xr _exit 2 .El .Pp Note that -.Dq R +.Ql R following -.Dq W +.Ql W records can represent a single .Xr open 2 for R/W, or two seperate .Xr open 2 calls, one for -R +.Ql R and one for -W. +.Ql W . .Sh IOCTLS -User mode programs communicate with the filemon driver through a -number of ioctls which are described below. +User mode programs communicate with the +.Nm +driver through a number of ioctls which are described below. Each takes a single argument. -.Bl -tag -width FILEMON_SET_PID +.Bl -tag -width ".Dv FILEMON_SET_PID" .It Dv FILEMON_SET_FD Write the internal tracing buffer to the supplied open file descriptor. -.It Dv FILEMON_SET_PID . +.It Dv FILEMON_SET_PID Child process ID to trace. .El -.Pp .Sh RETURN VALUES -The ioctl returns zero on success and non-zero on failure. +.\" .Rv -std ioctl +The +.Fn ioctl +function returns the value 0 if successful; +otherwise the value \-1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh FILES +.Bl -tag -width ".Pa /dev/filemon" +.It Pa /dev/filemon +.El .Sh EXAMPLES -.Bd -literal -offset indent +.Bd -literal #include #include #include @@ -122,23 +133,24 @@ open_filemon(void) int fm_fd, fm_log; if ((fm_fd = open("/dev/filemon", O_RDWR)) == -1) - err(1, "open(\"/dev/filemon\", O_RDWR)"); + err(1, "open(\e"/dev/filemon\e", O_RDWR)"); if ((fm_log = open("filemon.out", O_CREAT | O_WRONLY | O_TRUNC, DEFFILEMODE)) == -1) err(1, "open(filemon.out)"); - if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) < 0) + if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) == -1) err(1, "Cannot set filemon log file descriptor"); /* Set up these two fd's to close on exec. */ (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC); (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC); if ((child = fork()) == 0) { + child = getpid(); + if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1) + err(1, "Cannot set filemon PID"); /* Do something here. */ return 0; } else { - if (ioctl(fm_fd, FILEMON_SET_PID, &child) < 0) - err(1, "Cannot set filemon PID"); wait(&child); close(fm_fd); } @@ -150,11 +162,9 @@ Creates a file named .Pa filemon.out and configures the .Nm -device to write the filemon buffer contents to it. -.Sh FILES -.Bl -tag -width /dev/zero -.It Pa /dev/filemon -.El +device to write the +.Nm +buffer contents to it. .Sh SEE ALSO .Xr dtrace 1 , .Xr ktrace 1 , Modified: projects/bmake/sys/modules/Makefile ============================================================================== --- projects/bmake/sys/modules/Makefile Tue Jun 5 23:48:20 2012 (r236646) +++ projects/bmake/sys/modules/Makefile Wed Jun 6 00:20:13 2012 (r236647) @@ -5,7 +5,8 @@ # Modules that include binary-only blobs of microcode should be selectable by # MK_SOURCELESS_UCODE option (see below). -SUBDIR= ${_3dfx} \ +SUBDIR= \ + ${_3dfx} \ ${_3dfx_linux} \ ${_aac} \ accf_data \ @@ -105,6 +106,7 @@ SUBDIR= ${_3dfx} \ fdc \ fdescfs \ ${_fe} \ + ${_filemon} \ firewire \ firmware \ ${_fxp} \ @@ -356,6 +358,10 @@ SUBDIR= ${_3dfx} \ ${_zfs} \ zlib \ +.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" +_filemon= filemon +.endif + .if ${MACHINE_CPUARCH} != "powerpc" && ${MACHINE_CPUARCH} != "arm" && \ ${MACHINE_CPUARCH} != "mips" _syscons= syscons Modified: projects/bmake/tools/regression/filemon/filemontest.c ============================================================================== --- head/tools/regression/filemon/filemontest.c Mon Jun 4 22:59:33 2012 (r236594) +++ projects/bmake/tools/regression/filemon/filemontest.c Wed Jun 6 00:20:13 2012 (r236647) @@ -54,22 +54,27 @@ main(void) { if ((fm_log = mkstemp(log_name)) == -1) err(1, "mkstemp(%s)", log_name); - if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) < 0) + if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) == -1) err(1, "Cannot set filemon log file descriptor"); /* Set up these two fd's to close on exec. */ (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC); (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC); - if ((child = fork()) == 0) { + switch (child = fork()) { + case 0: + child = getpid(); + if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1) + err(1, "Cannot set filemon PID to %d", child); system("./test_script.sh"); - return 0; - } else { - if (ioctl(fm_fd, FILEMON_SET_PID, &child) < 0) - err(1, "Cannot set filemon PID"); + break; + case -1: + err(1, "Cannot fork"); + default: wait(&child); close(fm_fd); // printf("Results in %s\n", log_name); + break; } return 0; } From owner-svn-src-projects@FreeBSD.ORG Wed Jun 6 09:44:58 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61F3E106564A; Wed, 6 Jun 2012 09:44:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4C58F8FC14; Wed, 6 Jun 2012 09:44:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q569iw3P083870; Wed, 6 Jun 2012 09:44:58 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q569iw0q083868; Wed, 6 Jun 2012 09:44:58 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206060944.q569iw0q083868@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 6 Jun 2012 09:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236672 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 09:44:58 -0000 Author: glebius Date: Wed Jun 6 09:44:57 2012 New Revision: 236672 URL: http://svn.freebsd.org/changeset/base/236672 Log: When "flush" rule triggers we need to run through the entire table and clean all matching states. First, in the current locking scheme this leads to duplicate acquiring of state hash lock, which isn't allowed. Second, this is extremely expensive task, and performing it right now in the forwarding path is a very bad idea. Thus, offload this task to a taskqueue(9). We allocate some temporary memory and place all needed for matching there, put it on queue, and schedule taskqueue run. Code is quite common to the one that emits packets from the pf_intr(). Also here: - Rename PF_QUEUE_LOCK() macro to PF_SENDQ_LOCK() in order get in one style with PF_FLUSHQ_LOCK(). - Take rev. 1.715 from OpenBSD, which fixes the "flush" functionality. Modified: projects/pf/head/sys/contrib/pf/net/pf.c Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Wed Jun 6 09:36:52 2012 (r236671) +++ projects/pf/head/sys/contrib/pf/net/pf.c Wed Jun 6 09:44:57 2012 (r236672) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -184,8 +185,29 @@ static VNET_DEFINE(struct pf_send_head, #define V_pf_sendqueue VNET(pf_sendqueue) static struct mtx pf_sendqueue_mtx; -#define PF_QUEUE_LOCK() mtx_lock(&pf_sendqueue_mtx) -#define PF_QUEUE_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) +#define PF_SENDQ_LOCK() mtx_lock(&pf_sendqueue_mtx) +#define PF_SENDQ_UNLOCK() mtx_unlock(&pf_sendqueue_mtx) + +/* + * Queue for pf_flush_task() tasks. + */ +struct pf_flush_entry { + SLIST_ENTRY(pf_flush_entry) next; + struct pf_addr addr; + sa_family_t af; + uint8_t dir; + struct pf_rule *rule; /* never dereferenced */ +}; + +SLIST_HEAD(pf_flush_head, pf_flush_entry); +static VNET_DEFINE(struct pf_flush_head, pf_flushqueue); +#define V_pf_flushqueue VNET(pf_flushqueue) +static VNET_DEFINE(struct task, pf_flushtask); +#define V_pf_flushtask VNET(pf_flushtask) + +static struct mtx pf_flushqueue_mtx; +#define PF_FLUSHQ_LOCK() mtx_lock(&pf_flushqueue_mtx) +#define PF_FLUSHQ_UNLOCK() mtx_unlock(&pf_flushqueue_mtx) VNET_DEFINE(struct pf_rulequeue, pf_unlinked_rules); struct mtx pf_unlnkdrules_mtx; @@ -292,6 +314,7 @@ static int pf_addr_wrap_neq(struct pf_ static struct pf_state *pf_find_state(struct pfi_kif *, struct pf_state_key_cmp *, u_int); static int pf_src_connlimit(struct pf_state **); +static void pf_flush_task(void *c, int pending); static int pf_insert_src_node(struct pf_src_node **, struct pf_rule *, struct pf_addr *, sa_family_t); static int pf_purge_expired_states(int); @@ -466,8 +489,12 @@ pf_check_threshold(struct pf_threshold * static int pf_src_connlimit(struct pf_state **state) { + struct pfr_addr p; + struct pf_flush_entry *pffe; int bad = 0; + PF_STATE_LOCK_ASSERT(*state); + (*state)->src_node->conn++; (*state)->src.tcp_est = 1; pf_add_threshold(&(*state)->src_node->conn_rate); @@ -488,86 +515,103 @@ pf_src_connlimit(struct pf_state **state if (!bad) return (0); - if ((*state)->rule.ptr->overload_tbl) { - struct pfr_addr p; - u_int32_t killed = 0; + /* Kill this state. */ + (*state)->timeout = PFTM_PURGE; + (*state)->src.state = (*state)->dst.state = TCPS_CLOSED; - V_pf_status.lcounters[LCNT_OVERLOAD_TABLE]++; - if (V_pf_status.debug >= PF_DEBUG_MISC) { - printf("pf_src_connlimit: blocking address "); - pf_print_host(&(*state)->src_node->addr, 0, - (*state)->key[PF_SK_WIRE]->af); - } + if ((*state)->rule.ptr->overload_tbl == NULL) + return (1); - bzero(&p, sizeof(p)); - p.pfra_af = (*state)->key[PF_SK_WIRE]->af; - switch ((*state)->key[PF_SK_WIRE]->af) { + V_pf_status.lcounters[LCNT_OVERLOAD_TABLE]++; + if (V_pf_status.debug >= PF_DEBUG_MISC) { + printf("%s: blocking address ", __func__); + pf_print_host(&(*state)->src_node->addr, 0, + (*state)->key[PF_SK_WIRE]->af); + printf("\n"); + } + + bzero(&p, sizeof(p)); + p.pfra_af = (*state)->key[PF_SK_WIRE]->af; + switch ((*state)->key[PF_SK_WIRE]->af) { #ifdef INET - case AF_INET: - p.pfra_net = 32; - p.pfra_ip4addr = (*state)->src_node->addr.v4; - break; + case AF_INET: + p.pfra_net = 32; + p.pfra_ip4addr = (*state)->src_node->addr.v4; + break; #endif /* INET */ #ifdef INET6 - case AF_INET6: - p.pfra_net = 128; - p.pfra_ip6addr = (*state)->src_node->addr.v6; - break; + case AF_INET6: + p.pfra_net = 128; + p.pfra_ip6addr = (*state)->src_node->addr.v6; + break; #endif /* INET6 */ - } + } - pfr_insert_kentry((*state)->rule.ptr->overload_tbl, - &p, time_second); + pfr_insert_kentry((*state)->rule.ptr->overload_tbl, &p, time_second); - /* kill existing states if that's required. */ - if ((*state)->rule.ptr->flush) { + if ((*state)->rule.ptr->flush == 0) + return (1); - V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++; - /* XXXGL: this cycle should go into a separate taskq */ - for (int i = 0; i <= V_pf_hashmask; i++) { - struct pf_idhash *ih = &V_pf_idhash[i]; - struct pf_state_key *sk; - struct pf_state *s; - - PF_HASHROW_LOCK(ih); - LIST_FOREACH(s, &ih->states, entry) { - sk = s->key[PF_SK_WIRE]; - /* - * Kill states from this source. - * (Only those from the same rule if - * PF_FLUSH_GLOBAL is not set) - */ - if (sk->af == - (*state)->key[PF_SK_WIRE]->af && - (((*state)->direction == PF_OUT && - PF_AEQ(&(*state)->src_node->addr, - &sk->addr[0], sk->af)) || - ((*state)->direction == PF_IN && - PF_AEQ(&(*state)->src_node->addr, - &sk->addr[1], sk->af))) && - ((*state)->rule.ptr->flush & - PF_FLUSH_GLOBAL || - (*state)->rule.ptr == s->rule.ptr)) - { - s->timeout = PFTM_PURGE; - s->src.state = s->dst.state = - TCPS_CLOSED; - killed++; - } - } - PF_HASHROW_UNLOCK(ih); + /* Schedule flushing task. */ + pffe = malloc(sizeof(*pffe), M_PFTEMP, M_NOWAIT); + if (pffe == NULL) + return (1); /* too bad :( */ + + bcopy(&(*state)->src_node->addr, &pffe->addr, sizeof(pffe->addr)); + pffe->af = (*state)->key[PF_SK_WIRE]->af; + pffe->dir = (*state)->direction; + if ((*state)->rule.ptr->flush & PF_FLUSH_GLOBAL) + pffe->rule = NULL; + else + pffe->rule = (*state)->rule.ptr; + PF_FLUSHQ_LOCK(); + SLIST_INSERT_HEAD(&V_pf_flushqueue, pffe, next); + PF_FLUSHQ_UNLOCK(); + taskqueue_enqueue(taskqueue_swi, &V_pf_flushtask); + + return (1); +} + +static void +pf_flush_task(void *c, int pending) +{ + struct pf_flush_head queue; + struct pf_flush_entry *pffe, *pffe1; + uint32_t killed = 0; + + PF_FLUSHQ_LOCK(); + queue = *(struct pf_flush_head *)c; + SLIST_INIT((struct pf_flush_head *)c); + PF_FLUSHQ_UNLOCK(); + + V_pf_status.lcounters[LCNT_OVERLOAD_FLUSH]++; + + for (int i = 0; i <= V_pf_hashmask; i++) { + struct pf_idhash *ih = &V_pf_idhash[i]; + struct pf_state_key *sk; + struct pf_state *s; + + PF_HASHROW_LOCK(ih); + LIST_FOREACH(s, &ih->states, entry) { + sk = s->key[PF_SK_WIRE]; + SLIST_FOREACH(pffe, &queue, next) + if (sk->af == pffe->af && (pffe->rule == NULL || + pffe->rule == s->rule.ptr) && + ((pffe->dir == PF_OUT && + PF_AEQ(&pffe->addr, &sk->addr[1], sk->af)) || + (pffe->dir == PF_IN && + PF_AEQ(&pffe->addr, &sk->addr[0], sk->af)))) { + s->timeout = PFTM_PURGE; + s->src.state = s->dst.state = TCPS_CLOSED; + killed++; } - if (V_pf_status.debug >= PF_DEBUG_MISC) - printf(", %u states killed", killed); } - if (V_pf_status.debug >= PF_DEBUG_MISC) - printf("\n"); + PF_HASHROW_UNLOCK(ih); } - - /* kill this state */ - (*state)->timeout = PFTM_PURGE; - (*state)->src.state = (*state)->dst.state = TCPS_CLOSED; - return (1); + SLIST_FOREACH_SAFE(pffe, &queue, next, pffe1) + free(pffe, M_PFTEMP); + if (V_pf_status.debug >= PF_DEBUG_MISC) + printf("%s: %u states killed", __func__, killed); } /* @@ -707,9 +751,12 @@ pf_initialize() V_pf_altqs_active = &V_pf_altqs[0]; V_pf_altqs_inactive = &V_pf_altqs[1]; - /* Send queue. */ + /* Send & flush queues. */ STAILQ_INIT(&V_pf_sendqueue); + SLIST_INIT(&V_pf_flushqueue); + TASK_INIT(&V_pf_flushtask, 0, pf_flush_task, &V_pf_flushqueue); mtx_init(&pf_sendqueue_mtx, "pf send queue", NULL, MTX_DEF); + mtx_init(&pf_flushqueue_mtx, "pf flush queue", NULL, MTX_DEF); /* Unlinked, but may be referenced rules. */ TAILQ_INIT(&V_pf_unlinked_rules); @@ -748,8 +795,9 @@ pf_cleanup() m_freem(pfse->pfse_m); free(pfse, M_PFTEMP); } - mtx_destroy(&pf_sendqueue_mtx); + mtx_destroy(&pf_sendqueue_mtx); + mtx_destroy(&pf_flushqueue_mtx); mtx_destroy(&pf_unlnkdrules_mtx); uma_zdestroy(V_pf_sources_z); @@ -1157,9 +1205,9 @@ static void pf_send(struct pf_send_entry *pfse) { - PF_QUEUE_LOCK(); + PF_SENDQ_LOCK(); STAILQ_INSERT_TAIL(&V_pf_sendqueue, pfse, pfse_next); - PF_QUEUE_UNLOCK(); + PF_SENDQ_UNLOCK(); swi_sched(V_pf_swi_cookie, 0); } @@ -1172,10 +1220,10 @@ pf_intr(void *v) CURVNET_SET((struct vnet *)v); - PF_QUEUE_LOCK(); + PF_SENDQ_LOCK(); queue = V_pf_sendqueue; STAILQ_INIT(&V_pf_sendqueue); - PF_QUEUE_UNLOCK(); + PF_SENDQ_UNLOCK(); STAILQ_FOREACH_SAFE(pfse, &queue, pfse_next, next) { switch (pfse->pfse_type) { From owner-svn-src-projects@FreeBSD.ORG Wed Jun 6 10:57:00 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D855106564A; Wed, 6 Jun 2012 10:57:00 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 08BC98FC0C; Wed, 6 Jun 2012 10:57:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56AuxQe008659; Wed, 6 Jun 2012 10:56:59 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56Auxa1008657; Wed, 6 Jun 2012 10:56:59 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206061056.q56Auxa1008657@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 6 Jun 2012 10:56:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236673 - projects/pf/head/contrib/pf/pfctl X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 10:57:00 -0000 Author: glebius Date: Wed Jun 6 10:56:59 2012 New Revision: 236673 URL: http://svn.freebsd.org/changeset/base/236673 Log: Remove undocumented auto-guessing based on physmem, better I later provide a paragraph in tuning(7). Modified: projects/pf/head/contrib/pf/pfctl/pfctl.c Modified: projects/pf/head/contrib/pf/pfctl/pfctl.c ============================================================================== --- projects/pf/head/contrib/pf/pfctl/pfctl.c Wed Jun 6 09:44:57 2012 (r236672) +++ projects/pf/head/contrib/pf/pfctl/pfctl.c Wed Jun 6 10:56:59 2012 (r236673) @@ -1552,9 +1552,6 @@ pfctl_fopen(const char *name, const char void pfctl_init_options(struct pfctl *pf) { - int64_t mem; - int mib[2]; - size_t size; pf->timeout[PFTM_TCP_FIRST_PACKET] = PFTM_TCP_FIRST_PACKET_VAL; pf->timeout[PFTM_TCP_OPENING] = PFTM_TCP_OPENING_VAL; @@ -1582,18 +1579,6 @@ pfctl_init_options(struct pfctl *pf) pf->limit[PF_LIMIT_SRC_NODES] = PFSNODE_HIWAT; pf->limit[PF_LIMIT_TABLE_ENTRIES] = PFR_KENTRY_HIWAT; - mib[0] = CTL_HW; -#ifdef __FreeBSD__ - mib[1] = HW_PHYSMEM; -#else - mib[1] = HW_PHYSMEM64; -#endif - size = sizeof(mem); - if (sysctl(mib, 2, &mem, &size, NULL, 0) == -1) - err(1, "sysctl"); - if (mem <= 100*1024*1024) - pf->limit[PF_LIMIT_TABLE_ENTRIES] = PFR_KENTRY_HIWAT_SMALL; - pf->debug = PF_DEBUG_URGENT; } From owner-svn-src-projects@FreeBSD.ORG Wed Jun 6 12:13:21 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 384BD106566B; Wed, 6 Jun 2012 12:13:21 +0000 (UTC) (envelope-from gber@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23D278FC08; Wed, 6 Jun 2012 12:13:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56CDKHg013195; Wed, 6 Jun 2012 12:13:20 GMT (envelope-from gber@svn.freebsd.org) Received: (from gber@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56CDK02013193; Wed, 6 Jun 2012 12:13:20 GMT (envelope-from gber@svn.freebsd.org) Message-Id: <201206061213.q56CDK02013193@svn.freebsd.org> From: Grzegorz Bernacki Date: Wed, 6 Jun 2012 12:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236676 - projects/armv6/sys/arm/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 12:13:21 -0000 Author: gber Date: Wed Jun 6 12:13:20 2012 New Revision: 236676 URL: http://svn.freebsd.org/changeset/base/236676 Log: Flush cache before downgrade page to WT mode. Cache should be flushed before downgrading to avoid situation when cache controller flushes dirty cache line to page which is not WB anymore. Modified: projects/armv6/sys/arm/arm/pmap-v6.c Modified: projects/armv6/sys/arm/arm/pmap-v6.c ============================================================================== --- projects/armv6/sys/arm/arm/pmap-v6.c Wed Jun 6 11:46:37 2012 (r236675) +++ projects/armv6/sys/arm/arm/pmap-v6.c Wed Jun 6 12:13:20 2012 (r236676) @@ -809,6 +809,12 @@ pmap_l2ptp_ctor(void *mem, int size, voi ptep = &l2b->l2b_kva[l2pte_index(va)]; pte = *ptep; + cpu_idcache_wbinv_range(va, PAGE_SIZE); +#ifdef ARM_L2_PIPT + cpu_l2cache_wbinv_range(pte & L2_S_FRAME, PAGE_SIZE); +#else + cpu_l2cache_wbinv_range(va, PAGE_SIZE); +#endif if ((pte & L2_S_CACHE_MASK) != pte_l2_s_cache_mode_pt) { /* * Page tables must have the cache-mode set to From owner-svn-src-projects@FreeBSD.ORG Wed Jun 6 12:45:49 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97479106564A; Wed, 6 Jun 2012 12:45:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82B038FC14; Wed, 6 Jun 2012 12:45:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56Cjnlv014932; Wed, 6 Jun 2012 12:45:49 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56CjnCM014929; Wed, 6 Jun 2012 12:45:49 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206061245.q56CjnCM014929@svn.freebsd.org> From: Gleb Smirnoff Date: Wed, 6 Jun 2012 12:45:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236679 - projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 12:45:49 -0000 Author: glebius Date: Wed Jun 6 12:45:48 2012 New Revision: 236679 URL: http://svn.freebsd.org/changeset/base/236679 Log: Revert r236181 in such way that OID numbers doesn't shift, use a placeholder with syntax of NULL in place of no longer supported value. Modified: projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/BEGEMOT-PF-MIB.txt projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.def Modified: projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/BEGEMOT-PF-MIB.txt ============================================================================== --- projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/BEGEMOT-PF-MIB.txt Wed Jun 6 12:36:40 2012 (r236678) +++ projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/BEGEMOT-PF-MIB.txt Wed Jun 6 12:45:48 2012 (r236679) @@ -585,6 +585,7 @@ PfInterfacesIfEntry ::= SEQUENCE { pfInterfacesIfDescr OCTET STRING, pfInterfacesIfType INTEGER, pfInterfacesIfTZero TimeTicks, + pfInterfacesIfRefsState Null, pfInterfacesIfRefsRule Unsigned32, pfInterfacesIf4BytesInPass Counter64, pfInterfacesIf4BytesInBlock Counter64, Modified: projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.def ============================================================================== --- projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.def Wed Jun 6 12:36:40 2012 (r236678) +++ projects/pf/head/usr.sbin/bsnmpd/modules/snmp_pf/pf_tree.def Wed Jun 6 12:45:48 2012 (r236679) @@ -108,23 +108,24 @@ (2 pfInterfacesIfDescr OCTETSTRING GET) (3 pfInterfacesIfType ENUM ( 0 group 1 instance 2 detached ) GET) (4 pfInterfacesIfTZero TIMETICKS GET) - (5 pfInterfacesIfRefsRule UNSIGNED32 GET) - (6 pfInterfacesIf4BytesInPass COUNTER64 GET) - (7 pfInterfacesIf4BytesInBlock COUNTER64 GET) - (8 pfInterfacesIf4BytesOutPass COUNTER64 GET) - (9 pfInterfacesIf4BytesOutBlock COUNTER64 GET) - (10 pfInterfacesIf4PktsInPass COUNTER64 GET) - (11 pfInterfacesIf4PktsInBlock COUNTER64 GET) - (12 pfInterfacesIf4PktsOutPass COUNTER64 GET) - (13 pfInterfacesIf4PktsOutBlock COUNTER64 GET) - (14 pfInterfacesIf6BytesInPass COUNTER64 GET) - (15 pfInterfacesIf6BytesInBlock COUNTER64 GET) - (16 pfInterfacesIf6BytesOutPass COUNTER64 GET) - (17 pfInterfacesIf6BytesOutBlock COUNTER64 GET) - (18 pfInterfacesIf6PktsInPass COUNTER64 GET) - (19 pfInterfacesIf6PktsInBlock COUNTER64 GET) - (20 pfInterfacesIf6PktsOutPass COUNTER64 GET) - (21 pfInterfacesIf6PktsOutBlock COUNTER64 GET) + (5 pfInterfacesIfRefsState NULL GET) + (6 pfInterfacesIfRefsRule UNSIGNED32 GET) + (7 pfInterfacesIf4BytesInPass COUNTER64 GET) + (8 pfInterfacesIf4BytesInBlock COUNTER64 GET) + (9 pfInterfacesIf4BytesOutPass COUNTER64 GET) + (10 pfInterfacesIf4BytesOutBlock COUNTER64 GET) + (11 pfInterfacesIf4PktsInPass COUNTER64 GET) + (12 pfInterfacesIf4PktsInBlock COUNTER64 GET) + (13 pfInterfacesIf4PktsOutPass COUNTER64 GET) + (14 pfInterfacesIf4PktsOutBlock COUNTER64 GET) + (15 pfInterfacesIf6BytesInPass COUNTER64 GET) + (16 pfInterfacesIf6BytesInBlock COUNTER64 GET) + (17 pfInterfacesIf6BytesOutPass COUNTER64 GET) + (18 pfInterfacesIf6BytesOutBlock COUNTER64 GET) + (19 pfInterfacesIf6PktsInPass COUNTER64 GET) + (20 pfInterfacesIf6PktsInBlock COUNTER64 GET) + (21 pfInterfacesIf6PktsOutPass COUNTER64 GET) + (22 pfInterfacesIf6PktsOutBlock COUNTER64 GET) ) ) ) From owner-svn-src-projects@FreeBSD.ORG Wed Jun 6 15:29:27 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C4408106567F; Wed, 6 Jun 2012 15:29:27 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 96BFB8FC08; Wed, 6 Jun 2012 15:29:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q56FTRnH022442; Wed, 6 Jun 2012 15:29:27 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q56FTRRF022440; Wed, 6 Jun 2012 15:29:27 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206061529.q56FTRRF022440@svn.freebsd.org> From: Davide Italiano Date: Wed, 6 Jun 2012 15:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236682 - projects/calloutng/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jun 2012 15:29:27 -0000 Author: davide Date: Wed Jun 6 15:29:27 2012 New Revision: 236682 URL: http://svn.freebsd.org/changeset/base/236682 Log: There's no need to add one second to the event time in callout_cc_add() if this one is scheduled in the past. This was a braino derived from my previous experiments. Moreover, there's no need to call binuptime(), but, in turn, event times in the past may be silently converted to cc_softticks, avoiding the bintime() overhead. As an added bonus, we can avoid to start our scan of the wheel 1/HZ backward in the past, gaining in terms of performances. Reported by: mav Modified: projects/calloutng/sys/kern/kern_timeout.c Modified: projects/calloutng/sys/kern/kern_timeout.c ============================================================================== --- projects/calloutng/sys/kern/kern_timeout.c Wed Jun 6 14:31:14 2012 (r236681) +++ projects/calloutng/sys/kern/kern_timeout.c Wed Jun 6 15:29:27 2012 (r236682) @@ -363,7 +363,6 @@ callout_tick(void) struct callout_cpu *cc; struct callout_tailq *sc; struct bintime now; - struct bintime bt; struct bintime limit; struct bintime next; int cpu, first, flag, future, last, need_softclock; @@ -376,13 +375,6 @@ callout_tick(void) cc = CC_SELF(); mtx_lock_spin_flags(&cc->cc_lock, MTX_QUIET); binuptime(&now); - /* - * getbinuptime() may be inaccurate and return time up to 1/HZ in the past. - * In order to avoid the possible loss of one or more events look back 1/HZ - * in the past from the time we last checked. - */ - FREQ2BT(hz,&bt); - bintime_sub(&cc->cc_softticks,&bt); first = callout_hash(&cc->cc_softticks); last = callout_hash(&now); /* @@ -477,16 +469,10 @@ callout_cc_add(struct callout *c, struct struct bintime to_bintime, void (*func)(void *), void *arg, int cpu) { int bucket; - struct bintime now; - struct bintime tmp; - tmp.sec = 1; - tmp.frac = 0; CC_LOCK_ASSERT(cc); - binuptime(&now); - if (bintime_cmp(&to_bintime, &now, <)) { - bintime_add(&now, &tmp); - to_bintime = now; + if (bintime_cmp(&to_bintime, &cc->cc_softticks, <)) { + to_bintime = cc->cc_softticks; } c->c_arg = arg; c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING); From owner-svn-src-projects@FreeBSD.ORG Thu Jun 7 08:38:41 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7E29C106564A; Thu, 7 Jun 2012 08:38:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 694E98FC15; Thu, 7 Jun 2012 08:38:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q578cfFt071002; Thu, 7 Jun 2012 08:38:41 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q578cfOG070999; Thu, 7 Jun 2012 08:38:41 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206070838.q578cfOG070999@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 7 Jun 2012 08:38:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236706 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 08:38:41 -0000 Author: glebius Date: Thu Jun 7 08:38:40 2012 New Revision: 236706 URL: http://svn.freebsd.org/changeset/base/236706 Log: rtableid is set in the mbuf hdr in FreeBSD, not in pf_mtag. Modified: projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_mtag.h Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Thu Jun 7 08:32:53 2012 (r236705) +++ projects/pf/head/sys/contrib/pf/net/pf.c Thu Jun 7 08:38:40 2012 (r236706) @@ -2088,10 +2088,7 @@ pf_send_tcp(struct mbuf *replyto, const pf_mtag->tag = rtag; if (r != NULL && r->rtableid >= 0) - { M_SETFIB(m, r->rtableid); - pf_mtag->rtableid = r->rtableid; - } #ifdef ALTQ if (r != NULL && r->qid) { @@ -2212,10 +2209,7 @@ pf_send_icmp(struct mbuf *m, u_int8_t ty m0->m_flags |= M_SKIP_FIREWALL; if (r->rtableid >= 0) - { M_SETFIB(m0, r->rtableid); - pf_mtag->rtableid = r->rtableid; - } #ifdef ALTQ if (r->qid) { Modified: projects/pf/head/sys/contrib/pf/net/pf_mtag.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_mtag.h Thu Jun 7 08:32:53 2012 (r236705) +++ projects/pf/head/sys/contrib/pf/net/pf_mtag.h Thu Jun 7 08:38:40 2012 (r236706) @@ -43,7 +43,6 @@ struct pf_mtag { void *hdr; /* saved hdr pos in mbuf, for ECN */ u_int32_t qid; /* queue id */ - u_int rtableid; /* alternate routing table id */ u_int16_t tag; /* tag id */ u_int8_t flags; u_int8_t routed; From owner-svn-src-projects@FreeBSD.ORG Thu Jun 7 09:47:37 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 639EF1065670; Thu, 7 Jun 2012 09:47:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 441868FC12; Thu, 7 Jun 2012 09:47:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q579lbGe074752; Thu, 7 Jun 2012 09:47:37 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q579lbkC074747; Thu, 7 Jun 2012 09:47:37 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206070947.q579lbkC074747@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 7 Jun 2012 09:47:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236710 - in projects/pf/head/sys: contrib/pf/net netinet/ipfw X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 09:47:37 -0000 Author: glebius Date: Thu Jun 7 09:47:36 2012 New Revision: 236710 URL: http://svn.freebsd.org/changeset/base/236710 Log: - Use a separate zone with init method for pf mbuf tags. - The pf_mtag.h is reduced to pf_mtag_find(). - ipfw(4) allocates pf-compatible mtag manually. Modified: projects/pf/head/sys/contrib/pf/net/pf.c projects/pf/head/sys/contrib/pf/net/pf_mtag.h projects/pf/head/sys/contrib/pf/net/pfvar.h projects/pf/head/sys/netinet/ipfw/ip_fw2.c Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Thu Jun 7 09:22:41 2012 (r236709) +++ projects/pf/head/sys/contrib/pf/net/pf.c Thu Jun 7 09:47:36 2012 (r236710) @@ -212,12 +212,13 @@ static struct mtx pf_flushqueue_mtx; VNET_DEFINE(struct pf_rulequeue, pf_unlinked_rules); struct mtx pf_unlnkdrules_mtx; -VNET_DEFINE(uma_zone_t, pf_sources_z); +static VNET_DEFINE(uma_zone_t, pf_sources_z); +#define V_pf_sources_z VNET(pf_sources_z) +static VNET_DEFINE(uma_zone_t, pf_mtag_z); +#define V_pf_mtag_z VNET(pf_mtag_z) VNET_DEFINE(uma_zone_t, pf_state_z); VNET_DEFINE(uma_zone_t, pf_state_key_z); -#define V_pf_sources_z VNET(pf_sources_z) - VNET_DEFINE(uint64_t, pf_stateid[MAXCPU]); #define PFID_CPUBITS 8 #define PFID_CPUSHIFT (sizeof(uint64_t) * NBBY - PFID_CPUBITS) @@ -319,6 +320,8 @@ static int pf_insert_src_node(struct p struct pf_rule *, struct pf_addr *, sa_family_t); static int pf_purge_expired_states(int); static void pf_purge_unlinked_rules(void); +static int pf_mtag_init(void *, int, int); +static void pf_mtag_free(struct m_tag *); int in4_cksum(struct mbuf *m, u_int8_t nxt, int off, int len); @@ -751,6 +754,11 @@ pf_initialize() V_pf_altqs_active = &V_pf_altqs[0]; V_pf_altqs_inactive = &V_pf_altqs[1]; + /* Mbuf tags */ + V_pf_mtag_z = uma_zcreate("pf mtags", sizeof(struct m_tag) + + sizeof(struct pf_mtag), NULL, NULL, pf_mtag_init, NULL, + UMA_ALIGN_PTR, 0); + /* Send & flush queues. */ STAILQ_INIT(&V_pf_sendqueue); SLIST_INIT(&V_pf_flushqueue); @@ -800,12 +808,51 @@ pf_cleanup() mtx_destroy(&pf_flushqueue_mtx); mtx_destroy(&pf_unlnkdrules_mtx); + uma_zdestroy(V_pf_mtag_z); uma_zdestroy(V_pf_sources_z); uma_zdestroy(V_pf_state_z); uma_zdestroy(V_pf_state_key_z); } static int +pf_mtag_init(void *mem, int size, int how) +{ + struct m_tag *t; + + t = (struct m_tag *)mem; + t->m_tag_cookie = MTAG_ABI_COMPAT; + t->m_tag_id = PACKET_TAG_PF; + t->m_tag_len = sizeof(struct pf_mtag); + t->m_tag_free = pf_mtag_free; + + return (0); +} + +static void +pf_mtag_free(struct m_tag *t) +{ + + uma_zfree(V_pf_mtag_z, t); +} + +struct pf_mtag * +pf_get_mtag(struct mbuf *m) +{ + struct m_tag *mtag; + + if ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) != NULL) + return ((struct pf_mtag *)(mtag + 1)); + + mtag = uma_zalloc(V_pf_mtag_z, M_NOWAIT); + if (mtag == NULL) + return (NULL); + bzero(mtag + 1, sizeof(struct pf_mtag)); + m_tag_prepend(m, mtag); + + return ((struct pf_mtag *)(mtag + 1)); +} + +static int pf_state_key_attach(struct pf_state_key *skw, struct pf_state_key *sks, struct pf_state *s) { Modified: projects/pf/head/sys/contrib/pf/net/pf_mtag.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf_mtag.h Thu Jun 7 09:22:41 2012 (r236709) +++ projects/pf/head/sys/contrib/pf/net/pf_mtag.h Thu Jun 7 09:47:36 2012 (r236710) @@ -48,9 +48,6 @@ struct pf_mtag { u_int8_t routed; }; -static __inline struct pf_mtag *pf_find_mtag(struct mbuf *); -static __inline struct pf_mtag *pf_get_mtag(struct mbuf *); - static __inline struct pf_mtag * pf_find_mtag(struct mbuf *m) { @@ -61,22 +58,5 @@ pf_find_mtag(struct mbuf *m) return ((struct pf_mtag *)(mtag + 1)); } - -static __inline struct pf_mtag * -pf_get_mtag(struct mbuf *m) -{ - struct m_tag *mtag; - - if ((mtag = m_tag_find(m, PACKET_TAG_PF, NULL)) == NULL) { - mtag = m_tag_get(PACKET_TAG_PF, sizeof(struct pf_mtag), - M_NOWAIT); - if (mtag == NULL) - return (NULL); - bzero(mtag + 1, sizeof(struct pf_mtag)); - m_tag_prepend(m, mtag); - } - - return ((struct pf_mtag *)(mtag + 1)); -} #endif /* _KERNEL */ #endif /* _NET_PF_MTAG_H_ */ Modified: projects/pf/head/sys/contrib/pf/net/pfvar.h ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pfvar.h Thu Jun 7 09:22:41 2012 (r236709) +++ projects/pf/head/sys/contrib/pf/net/pfvar.h Thu Jun 7 09:47:36 2012 (r236710) @@ -1718,6 +1718,8 @@ VNET_DECLARE(struct pf_rulequeue, pf_unl void pf_initialize(void); void pf_cleanup(void); +struct pf_mtag *pf_get_mtag(struct mbuf *); + extern void pf_calc_skip_steps(struct pf_rulequeue *); #ifdef ALTQ extern void pf_altq_ifnet_event(struct ifnet *, int); Modified: projects/pf/head/sys/netinet/ipfw/ip_fw2.c ============================================================================== --- projects/pf/head/sys/netinet/ipfw/ip_fw2.c Thu Jun 7 09:22:41 2012 (r236709) +++ projects/pf/head/sys/netinet/ipfw/ip_fw2.c Thu Jun 7 09:47:36 2012 (r236710) @@ -1698,20 +1698,30 @@ do { \ case O_ALTQ: { struct pf_mtag *at; + struct m_tag *mtag; ipfw_insn_altq *altq = (ipfw_insn_altq *)cmd; + /* + * ALTQ uses mbuf tags from another + * packet filtering system - pf(4). + * We allocate a tag in its format + * and fill it in, pretending to be pf(4). + */ match = 1; at = pf_find_mtag(m); if (at != NULL && at->qid != 0) break; - at = pf_get_mtag(m); - if (at == NULL) { + mtag = m_tag_get(PACKET_TAG_PF, + sizeof(struct pf_mtag), M_NOWAIT | M_ZERO); + if (mtag == NULL) { /* * Let the packet fall back to the * default ALTQ. */ break; } + m_tag_prepend(m, mtag); + at = (struct pf_mtag *)(mtag + 1); at->qid = altq->qid; at->hdr = ip; break; From owner-svn-src-projects@FreeBSD.ORG Thu Jun 7 09:52:49 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E95B510656A8; Thu, 7 Jun 2012 09:52:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D13698FC1A; Thu, 7 Jun 2012 09:52:49 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q579qnqV075154; Thu, 7 Jun 2012 09:52:49 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q579qnZR075114; Thu, 7 Jun 2012 09:52:49 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206070952.q579qnZR075114@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 7 Jun 2012 09:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236711 - in projects/pf/head: cddl/contrib/opensolaris/lib/libzfs/common cddl/lib/libdtrace contrib/bind9 contrib/bind9/lib/dns contrib/bsnmp/snmp_mibII gnu/lib/libsupc++ include lib/l... X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 09:52:50 -0000 Author: glebius Date: Thu Jun 7 09:52:48 2012 New Revision: 236711 URL: http://svn.freebsd.org/changeset/base/236711 Log: Merge head r233826 through r236710. Added: projects/pf/head/cddl/lib/libdtrace/io.d - copied unchanged from r236710, head/cddl/lib/libdtrace/io.d projects/pf/head/share/man/man4/filemon.4 - copied unchanged from r236710, head/share/man/man4/filemon.4 projects/pf/head/sys/dev/filemon/ - copied from r236710, head/sys/dev/filemon/ projects/pf/head/sys/modules/filemon/ - copied from r236710, head/sys/modules/filemon/ projects/pf/head/tools/regression/filemon/ - copied from r236710, head/tools/regression/filemon/ projects/pf/head/tools/tools/ifpifa/ - copied from r236710, head/tools/tools/ifpifa/ Modified: projects/pf/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c projects/pf/head/contrib/bind9/CHANGES projects/pf/head/contrib/bind9/lib/dns/rdata.c projects/pf/head/contrib/bind9/lib/dns/rdataslab.c projects/pf/head/contrib/bind9/version projects/pf/head/contrib/bsnmp/snmp_mibII/mibII_tcp.c projects/pf/head/gnu/lib/libsupc++/Version.map projects/pf/head/include/fmtmsg.h projects/pf/head/lib/libc/include/port_before.h projects/pf/head/lib/libc/net/getaddrinfo.c projects/pf/head/lib/libc/stdlib/realpath.c projects/pf/head/lib/libelf/elf_begin.3 projects/pf/head/lib/libgssapi/gss_unwrap.3 projects/pf/head/lib/libgssapi/gss_wrap.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_get_error.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_get_mech_info.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_get_principal_name.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_get_versions.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_getcred.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_is_installed.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_max_data_length.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_qop_to_num.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_seccreate.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_set_callback.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_set_defaults.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_set_svc_name.3 projects/pf/head/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 projects/pf/head/sbin/camcontrol/camcontrol.8 projects/pf/head/sbin/ifconfig/ifconfig.8 projects/pf/head/share/man/man4/Makefile projects/pf/head/share/man/man4/bce.4 projects/pf/head/share/man/man4/io.4 projects/pf/head/share/man/man4/ip.4 projects/pf/head/share/man/man4/mpt.4 projects/pf/head/share/man/man4/ng_ksocket.4 projects/pf/head/share/man/man4/vlan.4 projects/pf/head/share/man/man5/make.conf.5 projects/pf/head/share/man/man5/rc.conf.5 projects/pf/head/share/man/man7/development.7 projects/pf/head/share/man/man9/rwlock.9 projects/pf/head/share/misc/committers-src.dot projects/pf/head/sys/arm/at91/at91.c projects/pf/head/sys/arm/at91/at91_machdep.c projects/pf/head/sys/arm/at91/at91_mci.c projects/pf/head/sys/arm/at91/at91_pmc.c projects/pf/head/sys/arm/at91/at91reg.h projects/pf/head/sys/arm/at91/at91rm9200.c projects/pf/head/sys/arm/at91/at91rm92reg.h projects/pf/head/sys/arm/at91/at91sam9260.c projects/pf/head/sys/arm/at91/at91sam9g20.c projects/pf/head/sys/arm/at91/at91var.h projects/pf/head/sys/boot/ofw/libofw/ofw_disk.c projects/pf/head/sys/boot/sparc64/loader/main.c projects/pf/head/sys/cam/ata/ata_da.c projects/pf/head/sys/cam/ata/ata_pmp.c projects/pf/head/sys/cam/ata/ata_xpt.c projects/pf/head/sys/cam/cam_xpt.c projects/pf/head/sys/cam/scsi/scsi_all.c projects/pf/head/sys/cam/scsi/scsi_all.h projects/pf/head/sys/cam/scsi/scsi_cd.c projects/pf/head/sys/cam/scsi/scsi_da.c projects/pf/head/sys/cam/scsi/scsi_pt.c projects/pf/head/sys/cam/scsi/scsi_xpt.c projects/pf/head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c projects/pf/head/sys/cddl/dev/dtrace/i386/dtrace_subr.c projects/pf/head/sys/dev/ae/if_ae.c projects/pf/head/sys/dev/ahci/ahci.c projects/pf/head/sys/dev/aic7xxx/aicasm/Makefile projects/pf/head/sys/dev/aic7xxx/aicasm/aicasm.c projects/pf/head/sys/dev/ata/ata-all.c projects/pf/head/sys/dev/ath/if_ath.c projects/pf/head/sys/dev/ath/if_ath_misc.h projects/pf/head/sys/dev/ath/if_ath_rx.c projects/pf/head/sys/dev/bge/if_bgereg.h projects/pf/head/sys/dev/ixgbe/ixgbe.c projects/pf/head/sys/dev/jme/if_jme.c projects/pf/head/sys/dev/mvs/mvs.c projects/pf/head/sys/dev/siis/siis.c projects/pf/head/sys/fs/nfsclient/nfs_clbio.c projects/pf/head/sys/geom/multipath/g_multipath.c projects/pf/head/sys/kern/uipc_syscalls.c projects/pf/head/sys/modules/Makefile projects/pf/head/sys/net/bpf.c projects/pf/head/sys/netinet/libalias/libalias.3 projects/pf/head/sys/netinet/tcp_input.c projects/pf/head/sys/netinet6/in6.c projects/pf/head/tools/tools/syscall_timing/syscall_timing.c projects/pf/head/tools/tools/tinybsd/README projects/pf/head/usr.bin/find/find.1 projects/pf/head/usr.bin/gzip/zmore.1 projects/pf/head/usr.bin/kdump/kdump.1 projects/pf/head/usr.bin/kdump/kdump.c projects/pf/head/usr.bin/usbhidctl/usbhidctl.1 projects/pf/head/usr.sbin/inetd/inetd.c projects/pf/head/usr.sbin/inetd/inetd.h projects/pf/head/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: projects/pf/head/ (props changed) projects/pf/head/cddl/contrib/opensolaris/ (props changed) projects/pf/head/contrib/bind9/ (props changed) projects/pf/head/gnu/lib/ (props changed) projects/pf/head/lib/libc/ (props changed) projects/pf/head/sbin/ (props changed) projects/pf/head/share/man/man4/ (props changed) projects/pf/head/sys/ (props changed) projects/pf/head/sys/boot/ (props changed) projects/pf/head/sys/contrib/pf/ (props changed) Modified: projects/pf/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- projects/pf/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Thu Jun 7 09:52:48 2012 (r236711) @@ -23,6 +23,7 @@ * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2010 Nexenta Systems, Inc. All rights reserved. * Copyright (c) 2011 by Delphix. All rights reserved. + * Copyright (c) 2012 DEY Storage Systems, Inc. All rights reserved. * Copyright (c) 2011-2012 Pawel Jakub Dawidek . * All rights reserved. * Copyright (c) 2012 Martin Matuska . All rights reserved. @@ -2321,6 +2322,17 @@ zfs_prop_get(zfs_handle_t *zhp, zfs_prop } break; + case ZFS_PROP_GUID: + /* + * GUIDs are stored as numbers, but they are identifiers. + * We don't want them to be pretty printed, because pretty + * printing mangles the ID into a truncated and useless value. + */ + if (get_numeric_property(zhp, prop, src, &source, &val) != 0) + return (-1); + (void) snprintf(propbuf, proplen, "%llu", (u_longlong_t)val); + break; + default: switch (zfs_prop_get_type(prop)) { case PROP_TYPE_NUMBER: Copied: projects/pf/head/cddl/lib/libdtrace/io.d (from r236710, head/cddl/lib/libdtrace/io.d) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pf/head/cddl/lib/libdtrace/io.d Thu Jun 7 09:52:48 2012 (r236711, copy of r236710, head/cddl/lib/libdtrace/io.d) @@ -0,0 +1,220 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * $FreeBSD$ + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#pragma D depends_on module unix +#pragma D depends_on provider io + +inline int B_BUSY = B_BUSY; +#pragma D binding "1.0" B_BUSY +inline int B_DONE = 0x00000200; +#pragma D binding "1.0" B_DONE +inline int B_ERROR = B_ERROR; +#pragma D binding "1.0" B_ERROR +inline int B_PAGEIO = B_PAGEIO; +#pragma D binding "1.0" B_PAGEIO +inline int B_PHYS = B_PHYS; +#pragma D binding "1.0" B_PHYS +inline int B_READ = B_READ; +#pragma D binding "1.0" B_READ +inline int B_WRITE = B_WRITE; +#pragma D binding "1.0" B_WRITE +inline int B_ASYNC = 0x00000004; +#pragma D binding "1.0" B_ASYNC + +typedef struct bufinfo { + int b_flags; /* buffer status */ + size_t b_bcount; /* number of bytes */ + caddr_t b_addr; /* buffer address */ + uint64_t b_lblkno; /* block # on device */ + uint64_t b_blkno; /* expanded block # on device */ + size_t b_resid; /* # of bytes not transferred */ + size_t b_bufsize; /* size of allocated buffer */ + caddr_t b_iodone; /* I/O completion routine */ + int b_error; /* expanded error field */ + dev_t b_edev; /* extended device */ +} bufinfo_t; + +#pragma D binding "1.0" translator +translator bufinfo_t < struct buf *B > { + b_flags = B->b_flags; + b_addr = B->b_un.b_addr; + b_bcount = B->b_bcount; + b_lblkno = B->_b_blkno._f; + b_blkno = sizeof (long) == 8 ? B->_b_blkno._f : B->_b_blkno._p._l; + b_resid = B->b_resid; + b_bufsize = B->b_bufsize; + b_iodone = (caddr_t)B->b_iodone; + b_error = B->b_error; + b_edev = B->b_edev; +}; + +typedef struct devinfo { + int dev_major; /* major number */ + int dev_minor; /* minor number */ + int dev_instance; /* instance number */ + string dev_name; /* name of device */ + string dev_statname; /* name of device + instance/minor */ + string dev_pathname; /* pathname of device */ +} devinfo_t; + +#pragma D binding "1.0" translator +translator devinfo_t < struct buf *B > { + dev_major = B->b_dip != NULL ? getmajor(B->b_edev) : + getmajor(B->b_file->v_vfsp->vfs_dev); + dev_minor = B->b_dip != NULL ? getminor(B->b_edev) : + getminor(B->b_file->v_vfsp->vfs_dev); + dev_instance = B->b_dip == NULL ? + getminor(B->b_file->v_vfsp->vfs_dev) : + ((struct dev_info *)B->b_dip)->devi_instance; + dev_name = B->b_dip == NULL ? "nfs" : + stringof(`devnamesp[getmajor(B->b_edev)].dn_name); + dev_statname = strjoin(B->b_dip == NULL ? "nfs" : + stringof(`devnamesp[getmajor(B->b_edev)].dn_name), + lltostr(B->b_dip == NULL ? getminor(B->b_file->v_vfsp->vfs_dev) : + ((struct dev_info *)B->b_dip)->devi_instance == 0 && + ((struct dev_info *)B->b_dip)->devi_parent != NULL && + ((struct dev_info *)B->b_dip)->devi_parent->devi_node_name == + "pseudo" ? getminor(B->b_edev) : + ((struct dev_info *)B->b_dip)->devi_instance)); + dev_pathname = B->b_dip == NULL ? "" : + ddi_pathname(B->b_dip, getminor(B->b_edev)); +}; + +typedef struct fileinfo { + string fi_name; /* name (basename of fi_pathname) */ + string fi_dirname; /* directory (dirname of fi_pathname) */ + string fi_pathname; /* full pathname */ + offset_t fi_offset; /* offset within file */ + string fi_fs; /* filesystem */ + string fi_mount; /* mount point of file system */ + int fi_oflags; /* open(2) flags for file descriptor */ +} fileinfo_t; + +#pragma D binding "1.0" translator +translator fileinfo_t < struct buf *B > { + fi_name = B->b_file == NULL ? "" : + B->b_file->v_path == NULL ? "" : + basename(cleanpath(B->b_file->v_path)); + fi_dirname = B->b_file == NULL ? "" : + B->b_file->v_path == NULL ? "" : + dirname(cleanpath(B->b_file->v_path)); + fi_pathname = B->b_file == NULL ? "" : + B->b_file->v_path == NULL ? "" : + cleanpath(B->b_file->v_path); + fi_offset = B->b_offset; + fi_fs = B->b_file == NULL ? "" : + stringof(B->b_file->v_op->vnop_name); + fi_mount = B->b_file == NULL ? "" : + B->b_file->v_vfsp->vfs_vnodecovered == NULL ? "/" : + B->b_file->v_vfsp->vfs_vnodecovered->v_path == NULL ? "" : + cleanpath(B->b_file->v_vfsp->vfs_vnodecovered->v_path); + fi_oflags = 0; +}; + +/* + * The following inline constants can be used to examine fi_oflags when using + * the fds[] array or a translated fileinfo_t. Note that the various open + * flags behave as a bit-field *except* for O_RDONLY, O_WRONLY, and O_RDWR. + * To test the open mode, you write code similar to that used with the fcntl(2) + * F_GET[X]FL command, such as: if ((fi_oflags & O_ACCMODE) == O_WRONLY). + */ +inline int O_ACCMODE = 0x0003; +#pragma D binding "1.1" O_ACCMODE + +inline int O_RDONLY = 0x0000; +#pragma D binding "1.1" O_RDONLY +inline int O_WRONLY = 0x0001; +#pragma D binding "1.1" O_WRONLY +inline int O_RDWR = 0x0002; +#pragma D binding "1.1" O_RDWR + +inline int O_APPEND = 0x0008; +#pragma D binding "1.1" O_APPEND +inline int O_CREAT = 0x0200; +#pragma D binding "1.1" O_CREAT +inline int O_DSYNC = O_DSYNC; +#pragma D binding "1.1" O_DSYNC +inline int O_EXCL = 0x0800; +#pragma D binding "1.1" O_EXCL +inline int O_LARGEFILE = O_LARGEFILE; +#pragma D binding "1.1" O_LARGEFILE +inline int O_NOCTTY = 0x8000; +#pragma D binding "1.1" O_NOCTTY +inline int O_NONBLOCK = 0x0004; +#pragma D binding "1.1" O_NONBLOCK +inline int O_NDELAY = 0x0004; +#pragma D binding "1.1" O_NDELAY +inline int O_RSYNC = O_RSYNC; +#pragma D binding "1.1" O_RSYNC +inline int O_SYNC = 0x0080; +#pragma D binding "1.1" O_SYNC +inline int O_TRUNC = 0x0400; +#pragma D binding "1.1" O_TRUNC +inline int O_XATTR = O_XATTR; +#pragma D binding "1.1" O_XATTR + +#pragma D binding "1.1" translator +translator fileinfo_t < struct file *F > { + fi_name = F == NULL ? "" : + F->f_vnode->v_path == NULL ? "" : + basename(cleanpath(F->f_vnode->v_path)); + fi_dirname = F == NULL ? "" : + F->f_vnode->v_path == NULL ? "" : + dirname(cleanpath(F->f_vnode->v_path)); + fi_pathname = F == NULL ? "" : + F->f_vnode->v_path == NULL ? "" : + cleanpath(F->f_vnode->v_path); + fi_offset = F == NULL ? 0 : F->f_offset; + fi_fs = F == NULL ? "" : stringof(F->f_vnode->v_op->vnop_name); + fi_mount = F == NULL ? "" : + F->f_vnode->v_vfsp->vfs_vnodecovered == NULL ? "/" : + F->f_vnode->v_vfsp->vfs_vnodecovered->v_path == NULL ? "" : + cleanpath(F->f_vnode->v_vfsp->vfs_vnodecovered->v_path); + fi_oflags = F == NULL ? 0 : F->f_flag + (int)FOPEN; +}; + +inline fileinfo_t fds[int fd] = xlate ( + fd >= 0 && fd < curthread->t_procp->p_user.u_finfo.fi_nfiles ? + curthread->t_procp->p_user.u_finfo.fi_list[fd].uf_file : NULL); + +#pragma D attributes Stable/Stable/Common fds +#pragma D binding "1.1" fds + +#pragma D binding "1.2" translator +translator fileinfo_t < struct vnode *V > { + fi_name = V->v_path == NULL ? "" : + basename(cleanpath(V->v_path)); + fi_dirname = V->v_path == NULL ? "" : + dirname(cleanpath(V->v_path)); + fi_pathname = V->v_path == NULL ? "" : cleanpath(V->v_path); + fi_fs = stringof(V->v_op->vnop_name); + fi_mount = V->v_vfsp->vfs_vnodecovered == NULL ? "/" : + V->v_vfsp->vfs_vnodecovered->v_path == NULL ? "" : + cleanpath(V->v_vfsp->vfs_vnodecovered->v_path); +}; Modified: projects/pf/head/contrib/bind9/CHANGES ============================================================================== --- projects/pf/head/contrib/bind9/CHANGES Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/contrib/bind9/CHANGES Thu Jun 7 09:52:48 2012 (r236711) @@ -1,3 +1,8 @@ + --- 9.8.3-P1 released --- + +3331. [security] dns_rdataslab_fromrdataset could produce bad + rdataslabs. [RT #29644] + --- 9.8.3 released --- 3318. [tuning] Reduce the amount of work performed while holding a Modified: projects/pf/head/contrib/bind9/lib/dns/rdata.c ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/rdata.c Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/contrib/bind9/lib/dns/rdata.c Thu Jun 7 09:52:48 2012 (r236711) @@ -329,8 +329,8 @@ dns_rdata_compare(const dns_rdata_t *rda REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); @@ -360,8 +360,8 @@ dns_rdata_casecompare(const dns_rdata_t REQUIRE(rdata1 != NULL); REQUIRE(rdata2 != NULL); - REQUIRE(rdata1->data != NULL); - REQUIRE(rdata2->data != NULL); + REQUIRE(rdata1->length == 0 || rdata1->data != NULL); + REQUIRE(rdata2->length == 0 || rdata2->data != NULL); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata1)); REQUIRE(DNS_RDATA_VALIDFLAGS(rdata2)); Modified: projects/pf/head/contrib/bind9/lib/dns/rdataslab.c ============================================================================== --- projects/pf/head/contrib/bind9/lib/dns/rdataslab.c Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/contrib/bind9/lib/dns/rdataslab.c Thu Jun 7 09:52:48 2012 (r236711) @@ -126,6 +126,11 @@ isc_result_t dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx, isc_region_t *region, unsigned int reservelen) { + /* + * Use &removed as a sentinal pointer for duplicate + * rdata as rdata.data == NULL is valid. + */ + static unsigned char removed; struct xrdata *x; unsigned char *rawbuf; #if DNS_RDATASET_FIXED @@ -169,6 +174,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ INSIST(result == ISC_R_SUCCESS); dns_rdata_init(&x[i].rdata); dns_rdataset_current(rdataset, &x[i].rdata); + INSIST(x[i].rdata.data != &removed); #if DNS_RDATASET_FIXED x[i].order = i; #endif @@ -201,8 +207,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ */ for (i = 1; i < nalloc; i++) { if (compare_rdata(&x[i-1].rdata, &x[i].rdata) == 0) { - x[i-1].rdata.data = NULL; - x[i-1].rdata.length = 0; + x[i-1].rdata.data = &removed; #if DNS_RDATASET_FIXED /* * Preserve the least order so A, B, A -> A, B @@ -292,7 +297,7 @@ dns_rdataslab_fromrdataset(dns_rdataset_ #endif for (i = 0; i < nalloc; i++) { - if (x[i].rdata.data == NULL) + if (x[i].rdata.data == &removed) continue; #if DNS_RDATASET_FIXED offsettable[x[i].order] = rawbuf - offsetbase; Modified: projects/pf/head/contrib/bind9/version ============================================================================== --- projects/pf/head/contrib/bind9/version Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/contrib/bind9/version Thu Jun 7 09:52:48 2012 (r236711) @@ -6,5 +6,5 @@ MAJORVER=9 MINORVER=8 PATCHVER=3 -RELEASETYPE= -RELEASEVER= +RELEASETYPE=-P +RELEASEVER=1 Modified: projects/pf/head/contrib/bsnmp/snmp_mibII/mibII_tcp.c ============================================================================== --- projects/pf/head/contrib/bsnmp/snmp_mibII/mibII_tcp.c Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/contrib/bsnmp/snmp_mibII/mibII_tcp.c Thu Jun 7 09:52:48 2012 (r236711) @@ -109,10 +109,12 @@ fetch_tcp(void) ptr = (struct xinpgen *)(void *)((char *)ptr + ptr->xig_len)) { tp = (struct xtcpcb *)ptr; if (tp->xt_inp.inp_gencnt > xinpgen->xig_gen || - (tp->xt_inp.inp_vflag & INP_IPV4) == 0) + (tp->xt_inp.inp_vflag & (INP_IPV4|INP_IPV6)) == 0) continue; - tcp_total++; + if (tp->xt_inp.inp_vflag & INP_IPV4) + tcp_total++; + if (tp->xt_tp.t_state == TCPS_ESTABLISHED || tp->xt_tp.t_state == TCPS_CLOSE_WAIT) tcp_count++; Modified: projects/pf/head/gnu/lib/libsupc++/Version.map ============================================================================== --- projects/pf/head/gnu/lib/libsupc++/Version.map Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/gnu/lib/libsupc++/Version.map Thu Jun 7 09:52:48 2012 (r236711) @@ -126,11 +126,19 @@ CXXABI_1.3 { # __gnu_cxx::_verbose_terminate_handler() _ZN9__gnu_cxx27__verbose_terminate_handlerEv; - # new / delete operators + # operator new and new[], 32-bit size_t _Znaj; _ZnajRKSt9nothrow_t; _Znwj; _ZnwjRKSt9nothrow_t; + + # operator new and new[], 64-bit size_t + _Znam; + _ZnamRKSt9nothrow_t; + _Znwm; + _ZnwmRKSt9nothrow_t; + + # operator delete and delete[] _ZdaPv; _ZdaPvRKSt9nothrow_t; _ZdlPv; Modified: projects/pf/head/include/fmtmsg.h ============================================================================== --- projects/pf/head/include/fmtmsg.h Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/include/fmtmsg.h Thu Jun 7 09:52:48 2012 (r236711) @@ -32,7 +32,7 @@ /* Source of condition is... */ #define MM_HARD 0x0001 /* ...hardware. */ #define MM_SOFT 0x0002 /* ...software. */ -#define MM_FIRM 0x0004 /* ...fireware. */ +#define MM_FIRM 0x0004 /* ...firmware. */ /* Condition detected by... */ #define MM_APPL 0x0010 /* ...application. */ Modified: projects/pf/head/lib/libc/include/port_before.h ============================================================================== --- projects/pf/head/lib/libc/include/port_before.h Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/libc/include/port_before.h Thu Jun 7 09:52:48 2012 (r236711) @@ -17,6 +17,6 @@ var = _u.v; \ } while (0) -#define UNUSED(x) (x) = (x) +#define UNUSED(x) (void)(x) #endif /* _PORT_BEFORE_H_ */ Modified: projects/pf/head/lib/libc/net/getaddrinfo.c ============================================================================== --- projects/pf/head/lib/libc/net/getaddrinfo.c Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/libc/net/getaddrinfo.c Thu Jun 7 09:52:48 2012 (r236711) @@ -464,7 +464,7 @@ getaddrinfo(const char *hostname, const } error = get_portmatch(pai, servname); if (error) - ERR(error); + goto bad; *pai = ai0; } Modified: projects/pf/head/lib/libc/stdlib/realpath.c ============================================================================== --- projects/pf/head/lib/libc/stdlib/realpath.c Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/libc/stdlib/realpath.c Thu Jun 7 09:52:48 2012 (r236711) @@ -54,7 +54,7 @@ realpath(const char * __restrict path, c char *p, *q, *s; size_t left_len, resolved_len; unsigned symlinks; - int m, serrno, slen; + int m, slen; char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX]; if (path == NULL) { @@ -65,7 +65,6 @@ realpath(const char * __restrict path, c errno = ENOENT; return (NULL); } - serrno = errno; if (resolved == NULL) { resolved = malloc(PATH_MAX); if (resolved == NULL) Modified: projects/pf/head/lib/libelf/elf_begin.3 ============================================================================== --- projects/pf/head/lib/libelf/elf_begin.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/libelf/elf_begin.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -252,7 +252,7 @@ was created. .It Bq Er ELF_E_ARGUMENT An .Xr ar 1 -archive was opened with with +archive was opened with .Ar cmd set to .Dv ELF_C_RDWR . Modified: projects/pf/head/lib/libgssapi/gss_unwrap.3 ============================================================================== --- projects/pf/head/lib/libgssapi/gss_unwrap.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/libgssapi/gss_unwrap.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -100,7 +100,7 @@ Protected message. .It output_message_buffer Buffer to receive unwrapped message. Storage associated with this buffer must -be freed by the application after use use +be freed by the application after use with a call to .Xr gss_release_buffer 3 . .It conf_state Modified: projects/pf/head/lib/libgssapi/gss_wrap.3 ============================================================================== --- projects/pf/head/lib/libgssapi/gss_wrap.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/libgssapi/gss_wrap.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -118,7 +118,7 @@ Integrity and data origin services only .It output_message_buffer Buffer to receive protected message. Storage associated with this buffer must -be freed by the application after use use +be freed by the application after use with a call to .Xr gss_release_buffer 3 . .El Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_get_error.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_get_error.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_get_error.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -39,7 +39,7 @@ .Sh DESCRIPTION Get details of the last RPCSEC_GSS error. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It error" .It error A pointer to a structure where the error details will be returned .El Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_get_mech_info.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_get_mech_info.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_get_mech_info.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -40,7 +40,7 @@ This function looks up a mechanism by name by reading the file /etc/gss/mech and queries it for its capabilities. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It service" .It mech The mechanism to search for .It service Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_get_principal_name.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_get_principal_name.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_get_principal_name.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -46,7 +46,7 @@ This function can be used to generate a client principal name from various strings. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It principal" .It principal If the principal is created successfully, .Fa *principal Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_get_versions.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_get_versions.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_get_versions.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -39,7 +39,7 @@ .Sh DESCRIPTION Return the highest and lowest supported versions of the RPCSEC_GSS protocol. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It vers_lo" .It vers_hi The value of .Fa *vers_hi Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_getcred.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_getcred.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_getcred.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -45,7 +45,7 @@ This function returns the RPCSEC_GSS authenticated credentials associated with an RPC request. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It cookie" .It req The RPC request to query .It rcred Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_is_installed.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_is_installed.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_is_installed.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -40,7 +40,7 @@ This function looks up a mechanism by name by reading the file /etc/gss/mech. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It mech" .It mech The mechanism to search for .El Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_max_data_length.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_max_data_length.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_max_data_length.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -41,7 +41,7 @@ Calculate the maximum message size that .Fa max_tp_unit_len , given the current service and QoP setting. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It max_tp_unit_len" .It auth A handle to a RPCSEC_GSS security context .It max_tp_unit_len Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_mech_to_oid.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -40,7 +40,7 @@ This function looks up a mechanism by name by reading the file /etc/gss/mech. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It oid_ret" .It mech The mechanism name to search for .It oid_ret Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_oid_to_mech.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -40,7 +40,7 @@ This function looks up a mechanism by oid by reading the file /etc/gss/mech. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It mech_ret" .It oid The mechanism oid to search for .It mech_ret Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_qop_to_num.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_qop_to_num.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_qop_to_num.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -40,7 +40,7 @@ This function looks up a quality of protection by name by reading the file /etc/gss/qop. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It number_ret" .It qop The quality of protection to search for .It mech Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_seccreate.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_seccreate.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_seccreate.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -48,7 +48,7 @@ This function is used to establish a security context between an application and a remote peer using the RPSEC_GSS protocol. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width "options_req" .It clnt An RPC handle which is connected to the remote peer .It principal @@ -62,7 +62,7 @@ The value of mechanism should be the nam mechanisms listed in /etc/gss/mech. .It service Type of service requested. -.Bl -tag +.Bl -tag -width "rpc_gss_svc_integrity" .It rpc_gss_svc_default The default - typically the same as .Dv rpc_gss_svc_none . Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_set_callback.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_set_callback.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_set_callback.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -62,7 +62,7 @@ protection used by the context. If a context is locked, any subsequent requests which use different values for service and quality of protection will be rejected. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It gss_context" .It cb A structure containing the RPC program and version for this callback and a function which will be called when new contexts are created for Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_set_defaults.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_set_defaults.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_set_defaults.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -45,7 +45,7 @@ Set the service and quality of protectio The new values apply for the rest of the lifetime of the context (unless changed again with this function). .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It service" .It service The service type to use for subsequent RPC requests .It qop Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_set_svc_name.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_set_svc_name.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_set_svc_name.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -47,7 +47,7 @@ This function registers a service princi authenticate RPCSEC_GSS security contexts for a given RPC program and version. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It mechanism" .It principal A string representing the service principal in the form .Qq service@hostname Modified: projects/pf/head/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 ============================================================================== --- projects/pf/head/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/lib/librpcsec_gss/rpc_gss_svc_max_data_length.3 Thu Jun 7 09:52:48 2012 (r236711) @@ -41,7 +41,7 @@ Calculate the maximum message size that .Fa max_tp_unit_len , given the current service and QoP setting. .Sh PARAMETERS -.Bl -tag +.Bl -tag -width ".It max_tp_unit_len" .It req An RPC request .It max_tp_unit_len Modified: projects/pf/head/sbin/camcontrol/camcontrol.8 ============================================================================== --- projects/pf/head/sbin/camcontrol/camcontrol.8 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/sbin/camcontrol/camcontrol.8 Thu Jun 7 09:52:48 2012 (r236711) @@ -738,7 +738,7 @@ Set the partial pathway timeout value, i See the .Tn ANSI .Tn SAS -Protcol Layer (SPL) +Protocol Layer (SPL) specification for more information on this field. .It Fl a Ar enable|disable Enable or disable SATA slumber phy power conditions. @@ -1109,7 +1109,7 @@ Do not ask for confirmation. Run in simulation mode. Packet sizes that will be sent are shown, but no actual packet is sent to the device. -No confimation is asked in simulation mode. +No confirmation is asked in simulation mode. .It Fl v Besides showing sense information in case of a failure, the verbose option causes Modified: projects/pf/head/sbin/ifconfig/ifconfig.8 ============================================================================== --- projects/pf/head/sbin/ifconfig/ifconfig.8 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/sbin/ifconfig/ifconfig.8 Thu Jun 7 09:52:48 2012 (r236711) @@ -2051,7 +2051,7 @@ Send broadcast path requests every two s Nodes on the mesh without a path to this root mesh station with try to discover a path to us. .It Cm PROACTIVE -Send broadcast path requests every two seconds and every node must reply with +Send broadcast path requests every two seconds and every node must reply with a path reply even if it already has a path to this root mesh station. .It Cm RANN Send broadcast root announcement (RANN) frames. Modified: projects/pf/head/share/man/man4/Makefile ============================================================================== --- projects/pf/head/share/man/man4/Makefile Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/share/man/man4/Makefile Thu Jun 7 09:52:48 2012 (r236711) @@ -126,6 +126,7 @@ MAN= aac.4 \ fdt.4 \ fdtbus.4 \ ffclock.4 \ + filemon.4 \ firewire.4 \ fpa.4 \ fwe.4 \ Modified: projects/pf/head/share/man/man4/bce.4 ============================================================================== --- projects/pf/head/share/man/man4/bce.4 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/share/man/man4/bce.4 Thu Jun 7 09:52:48 2012 (r236711) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 1, 2012 +.Dd June 4, 2012 .Dt BCE 4 .Os .Sh NAME @@ -213,45 +213,58 @@ Enable/Disable strict RX frame size chec Enable/Disable frame header/payload splitting (default 1). .It Va hw.bce.rx_pages Set the number of memory pages assigned to recieve packets by the driver. -Due to alignment issues, this value can only be of the set 1, 2, 4 or 8 (default 2). +Due to alignment issues, this value can only be of the set +1, 2, 4 or 8 (default 2). .It Va hw.bce.tx_pages -Set the number of memory pages assigned to transmit packets by the driver. -Due to alignment issues, this value can only be of the set 1, 2, 4 or 8 (default 2). +Set the number of memory pages assigned to transmit packets +by the driver. +Due to alignment issues, this value can only be of the set +1, 2, 4 or 8 (default 2). .It Va hw.bce.rx_ticks -Time in microsecond ticks to wait before generating a status block updates due to RX processing activity. +Time in microsecond ticks to wait before generating a status +block updates due to RX processing activity. Values from 0-100 are valid. A value of 0 disables this status block update. -Cannot be set to 0 if hw.bce.rx_quick_cons_trip is also 0 (default 18). +Cannot be set to 0 if hw.bce.rx_quick_cons_trip is also 0 +(default 18). .It Va hw.bce.rx_ticks_int -Time in microsecond ticks to wait during RX interrupt processing before generating a status block update. +Time in microsecond ticks to wait during RX interrupt +processing before generating a status block update. Values from 0-100 are valid. Valid values are in the range from 0-100. A value of 0 disables this status block update (default 18). .It Va hw.bce.rx_quick_cons_trip -Number of RX Quick BD Chain entries that must be completed before a status block is generated. +Number of RX Quick BD Chain entries that must be completed +before a status block is generated. Values from 0-256 are valid. A value of 0 disables this status block update. Cannot be set to 0 if hw.bce.rx_ticks is also 0 (default 6). .It Va hw.bce.rx_quick_cons_trip_int -Number of RX quick BD entries that must be completed before a status block is generated duing interrupt processing. +Number of RX quick BD entries that must be completed before +a status block is generated duing interrupt processing. Values from 0-256 are valid. A value of 0 disables this status block update (default 6). .It Va hw.bce.tx_ticks -Time in microsecond ticks to wait before a status block update is generated due to TX activitiy. +Time in microsecond ticks to wait before a status block +update is generated due to TX activitiy. Values from 0-100 are valid. A value of 0 disables this status block update. -Cannot be set to 0 if hw.bce.tx_quick_cons_trip is also 0 (default 80). +Cannot be set to 0 if hw.bce.tx_quick_cons_trip is also 0 +(default 80). .It Va hw.bce.tx_ticks_int -Time in microsecond ticks to wait in interrupt processing before a status block update is generated due to TX activity +Time in microsecond ticks to wait in interrupt processing +before a status block update is generated due to TX activity Values from 0-100 are valid. A value of 0 disables this status block update (default 80). .It Va hw.bce.tx_cons_trip -How many TX Quick BD Chain entries that must be completed before a status block is generated. +How many TX Quick BD Chain entries that must be completed +before a status block is generated. Values from 0-100 are valid. A value of 0 disables this status block update. Cannot be set to 0 if hw.bce.tx_ticks is also 0 (default 20). .It Va hw.bce.tx_cons_trip_int -How many TX Quick BD Chain entries that must be completed before a status block is generated during an interrupt. +How many TX Quick BD Chain entries that must be completed +before a status block is generated during an interrupt. Values from 0-100 are valid. A value of 0 disables this status block update (default 20). .El Copied: projects/pf/head/share/man/man4/filemon.4 (from r236710, head/share/man/man4/filemon.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ projects/pf/head/share/man/man4/filemon.4 Thu Jun 7 09:52:48 2012 (r236711, copy of r236710, head/share/man/man4/filemon.4) @@ -0,0 +1,178 @@ +.\" Copyright (c) 2012 +.\" David E. O'Brien . All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgment: +.\" This product includes software developed by David E. O'Brien and +.\" contributors. +.\" 4. Neither the name of the author nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANT ABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 30, 2012 +.Dt FILEMON 4 +.Os +.Sh NAME +.Nm filemon +.Nd the filemon device +.Sh SYNOPSIS +.In dev/filemon/filemon.h +.Sh DESCRIPTION +The +.Nm +device allows a process to collect file operations data of its children. +The device +.Pa /dev/filemon +responds to two +.Xr ioctl 2 +calls. +.Pp +System calls are denoted using the following single letters: +.Pp +.Bl -tag -width indent -compact +.It Ql C +.Xr chdir 2 +.It Ql D +.Xr unlink 2 +.It Ql E +.Xr exec 2 +.It Ql F +.Xr fork 2 , +.Xr vfork 2 +.It Ql L +.Xr link 2 , +.Xr linkat 2 , +.Xr symlink 2 , +.Xr symlinkat 2 +.It Ql M +.Xr rename 2 +.It Ql R +.Xr open 2 +for read +.It Ql S +.Xr stat 2 +.It Ql W +.Xr open 2 +for write +.It Ql X +.Xr _exit 2 +.El +.Pp +Note that +.Ql R +following +.Ql W +records can represent a single +.Xr open 2 +for R/W, +or two separate +.Xr open 2 +calls, one for +.Ql R +and one for +.Ql W . +Note that only successful system calls are captured. +.Sh IOCTLS +User mode programs communicate with the +.Nm +driver through a number of ioctls which are described below. +Each takes a single argument. +.Bl -tag -width ".Dv FILEMON_SET_PID" +.It Dv FILEMON_SET_FD +Write the internal tracing buffer to the supplied open file descriptor. +.It Dv FILEMON_SET_PID +Child process ID to trace. +.El +.Sh RETURN VALUES +.\" .Rv -std ioctl +The +.Fn ioctl +function returns the value 0 if successful; +otherwise the value \-1 is returned and the global variable +.Va errno +is set to indicate the error. +.Sh FILES +.Bl -tag -width ".Pa /dev/filemon" +.It Pa /dev/filemon +.El +.Sh EXAMPLES +.Bd -literal +#include +#include +#include +#include +#include +#include +#include + +static void +open_filemon(void) +{ + pid_t child; + int fm_fd, fm_log; + + if ((fm_fd = open("/dev/filemon", O_RDWR)) == -1) + err(1, "open(\e"/dev/filemon\e", O_RDWR)"); + if ((fm_log = open("filemon.out", + O_CREAT | O_WRONLY | O_TRUNC, DEFFILEMODE)) == -1) + err(1, "open(filemon.out)"); + + if (ioctl(fm_fd, FILEMON_SET_FD, &fm_log) == -1) + err(1, "Cannot set filemon log file descriptor"); + /* Set up these two fd's to close on exec. */ + (void)fcntl(fm_fd, F_SETFD, FD_CLOEXEC); + (void)fcntl(fm_log, F_SETFD, FD_CLOEXEC); + + if ((child = fork()) == 0) { + child = getpid(); + if (ioctl(fm_fd, FILEMON_SET_PID, &child) == -1) + err(1, "Cannot set filemon PID"); + /* Do something here. */ + return 0; + } else { + wait(&child); + close(fm_fd); + } + return 0; +} +.Ed +.Pp +Creates a file named +.Pa filemon.out +and configures the +.Nm +device to write the +.Nm +buffer contents to it. +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr ktrace 1 , +.Xr truss 1 , +.Xr ioctl 2 +.Sh HISTORY +A +.Nm +device appeared in +.Fx 9.1 . Modified: projects/pf/head/share/man/man4/io.4 ============================================================================== --- projects/pf/head/share/man/man4/io.4 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/share/man/man4/io.4 Thu Jun 7 09:52:48 2012 (r236711) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 01, 2010 +.Dd June 1, 2010 .Dt IO 4 .Os .Sh NAME Modified: projects/pf/head/share/man/man4/ip.4 ============================================================================== --- projects/pf/head/share/man/man4/ip.4 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/share/man/man4/ip.4 Thu Jun 7 09:52:48 2012 (r236711) @@ -165,7 +165,7 @@ The .Vt cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVDSTADDR .Ed @@ -184,7 +184,7 @@ structure followed by the address. The cmsghdr fields should have the following values: .Bd -literal -cmsg_len = sizeof(struct in_addr) +cmsg_len = CMSG_LEN(sizeof(struct in_addr)) cmsg_level = IPPROTO_IP cmsg_type = IP_SENDSRCADDR .Ed @@ -279,7 +279,7 @@ that contains a cmsghdr structure follow .Tn TTL . The cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(u_char) +cmsg_len = CMSG_LEN(sizeof(u_char)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVTTL .Ed @@ -307,7 +307,7 @@ The .Vt cmsghdr fields have the following values: .Bd -literal -cmsg_len = sizeof(struct sockaddr_dl) +cmsg_len = CMSG_LEN(sizeof(struct sockaddr_dl)) cmsg_level = IPPROTO_IP cmsg_type = IP_RECVIF .Ed Modified: projects/pf/head/share/man/man4/mpt.4 ============================================================================== --- projects/pf/head/share/man/man4/mpt.4 Thu Jun 7 09:47:36 2012 (r236710) +++ projects/pf/head/share/man/man4/mpt.4 Thu Jun 7 09:52:48 2012 (r236711) @@ -124,15 +124,15 @@ Dell PowerEdge 1750 thru 2850 IBM eServer xSeries 335 .El .Pp -These systems also contain Integrated Raid Mirroring and Integrated -Raid Mirroring Enhanced which this driver also supports. +These systems also contain Integrated RAID Mirroring and Integrated +RAID Mirroring Enhanced which this driver also supports. .Pp *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-projects@FreeBSD.ORG Thu Jun 7 15:57:31 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6336E106566C; Thu, 7 Jun 2012 15:57:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F5568FC0A; Thu, 7 Jun 2012 15:57:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q57FvVLv097440; Thu, 7 Jun 2012 15:57:31 GMT (envelope-from glebius@svn.freebsd.org) Received: (from glebius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q57FvVUD097438; Thu, 7 Jun 2012 15:57:31 GMT (envelope-from glebius@svn.freebsd.org) Message-Id: <201206071557.q57FvVUD097438@svn.freebsd.org> From: Gleb Smirnoff Date: Thu, 7 Jun 2012 15:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236718 - projects/pf/head/sys/contrib/pf/net X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jun 2012 15:57:31 -0000 Author: glebius Date: Thu Jun 7 15:57:30 2012 New Revision: 236718 URL: http://svn.freebsd.org/changeset/base/236718 Log: o Close a race on state unlink. Although a state is already removed from the id hash, it still can be located via key hash. To avoid this, check for the PFTM_UNLINKED value in the pf_find_state(). o Call into pfsync_delete_state() after state had been removed from both hashes. Modified: projects/pf/head/sys/contrib/pf/net/pf.c Modified: projects/pf/head/sys/contrib/pf/net/pf.c ============================================================================== --- projects/pf/head/sys/contrib/pf/net/pf.c Thu Jun 7 15:54:52 2012 (r236717) +++ projects/pf/head/sys/contrib/pf/net/pf.c Thu Jun 7 15:57:30 2012 (r236718) @@ -1183,6 +1183,15 @@ pf_find_state(struct pfi_kif *kif, struc if (s->kif == V_pfi_all || s->kif == kif) { PF_STATE_LOCK(s); PF_HASHROW_UNLOCK(kh); + if (s->timeout == PFTM_UNLINKED) { + /* + * State is being processed + * by pf_unlink_state() in + * an other thread. + */ + PF_STATE_UNLOCK(s); + return (NULL); + } return (s); } PF_HASHROW_UNLOCK(kh); @@ -1464,8 +1473,6 @@ pf_unlink_state(struct pf_state *s, u_in if (export_pflow_ptr != NULL) export_pflow_ptr(s); #endif - if (pfsync_delete_state_ptr != NULL) - pfsync_delete_state_ptr(s); s->timeout = PFTM_UNLINKED; pf_src_tree_remove_state(s); PF_HASHROW_UNLOCK(ih); @@ -1473,6 +1480,9 @@ pf_unlink_state(struct pf_state *s, u_in pf_detach_state(s); refcount_release(&s->refs); + if (pfsync_delete_state_ptr != NULL) + pfsync_delete_state_ptr(s); + return (pf_release_state(s)); } From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 09:51:58 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 96102106564A; Fri, 8 Jun 2012 09:51:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 815AF8FC12; Fri, 8 Jun 2012 09:51:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q589pwC7047017; Fri, 8 Jun 2012 09:51:58 GMT (envelope-from bapt@svn.freebsd.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q589pwnr047015; Fri, 8 Jun 2012 09:51:58 GMT (envelope-from bapt@svn.freebsd.org) Message-Id: <201206080951.q589pwnr047015@svn.freebsd.org> From: Baptiste Daroussin Date: Fri, 8 Jun 2012 09:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236741 - projects/portbuild/scripts X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 09:51:58 -0000 Author: bapt Date: Fri Jun 8 09:51:57 2012 New Revision: 236741 URL: http://svn.freebsd.org/changeset/base/236741 Log: Jails should allow chflags (fixes japanese/man) Modified: projects/portbuild/scripts/portbuild Modified: projects/portbuild/scripts/portbuild ============================================================================== --- projects/portbuild/scripts/portbuild Fri Jun 8 08:26:52 2012 (r236740) +++ projects/portbuild/scripts/portbuild Fri Jun 8 09:51:57 2012 (r236741) @@ -296,7 +296,7 @@ done # XXX bapt: the network 127.0.0.1 allows ports like postfix do not fail querying a network # device jail -c persist name=${jname} ip4.addr=127.0.0.1 ip6=disable path=${chroot} \ - host.hostname=${jname} allow.sysvipc allow.socket_af allow.raw_sockets + host.hostname=${jname} allow.sysvipc allow.socket_af allow.raw_sockets allow.chflags jexec -U root ${jname} /usr/sbin/service ldconfig start @@ -339,11 +339,11 @@ if [ "${error}" = 0 ]; then # restart the jail with network for the fetch part jail -r ${jname} jail -c persist name=${jname} ip4=inherit ip6=inherit path=${chroot} \ - host.hostname=${jname} allow.sysvipc allow.socket_af allow.raw_sockets + host.hostname=${jname} allow.sysvipc allow.socket_af allow.raw_sockets allow.chflags jexec -U root ${jname} /buildscript ${dirname} 1 "$ED" "$PD" "$FD" "$BD" "$RD" "$PKGD" 2>&1 | tee -a ${chroot}/tmp/${pkgname}.log jail -r ${jname} jail -c persist name=${jname} ip4.addr=127.0.0.1 ip6=disable path=${chroot} \ - host.hostname=${jname} allow.sysvipc allow.socket_af allow.raw_sockets + host.hostname=${jname} allow.sysvipc allow.socket_af allow.raw_sockets allow.chflags if [ -f ${chroot}/tmp/status ]; then error=$(cat ${chroot}/tmp/status) else From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 11:53:52 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 99FE01065677; Fri, 8 Jun 2012 11:53:52 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 855EB8FC17; Fri, 8 Jun 2012 11:53:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q58Brq16056775; Fri, 8 Jun 2012 11:53:52 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58BrqG2056771; Fri, 8 Jun 2012 11:53:52 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206081153.q58BrqG2056771@svn.freebsd.org> From: Davide Italiano Date: Fri, 8 Jun 2012 11:53:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 11:53:52 -0000 Author: davide Date: Fri Jun 8 11:53:51 2012 New Revision: 236744 URL: http://svn.freebsd.org/changeset/base/236744 Log: Add (experimentally) a function to the sleepqueue(9) KPI sleepq_set_timeout_bt() in which the timeout may be specified in terms of bintime rather than ticks, and which takes advantage of the new precision capabilities of the callout subsystem. Modify the kern_nanosleep() function so that it may rely on sleepq_set_timeout_bt() rather than tsleep(). Modified: projects/calloutng/sys/kern/kern_time.c projects/calloutng/sys/kern/subr_sleepqueue.c projects/calloutng/sys/sys/sleepqueue.h Modified: projects/calloutng/sys/kern/kern_time.c ============================================================================== --- projects/calloutng/sys/kern/kern_time.c Fri Jun 8 11:40:30 2012 (r236743) +++ projects/calloutng/sys/kern/kern_time.c Fri Jun 8 11:53:51 2012 (r236744) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -352,37 +353,40 @@ static int nanowait; int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) { - struct timespec ts, ts2, ts3; - struct timeval tv; - int error; + struct timespec ts; + struct bintime bt, bt2, tmp; + int catch = 0, error; if (rqt->tv_nsec < 0 || rqt->tv_nsec >= 1000000000) return (EINVAL); if (rqt->tv_sec < 0 || (rqt->tv_sec == 0 && rqt->tv_nsec == 0)) return (0); - getnanouptime(&ts); - timespecadd(&ts, rqt); - TIMESPEC_TO_TIMEVAL(&tv, rqt); + binuptime(&bt); + timespec2bintime(rqt, &tmp); + bintime_add(&bt,&tmp); for (;;) { - error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", - tvtohz(&tv)); - getnanouptime(&ts2); - if (error != EWOULDBLOCK) { - if (error == ERESTART) - error = EINTR; - if (rmt != NULL) { - timespecsub(&ts, &ts2); - if (ts.tv_sec < 0) - timespecclear(&ts); - *rmt = ts; - } + sleepq_lock(&nanowait); + sleepq_add(&nanowait, NULL, "nanslp", PWAIT | PCATCH, 0); + sleepq_set_timeout_bt(&nanowait,bt); + error = sleepq_timedwait_sig(&nanowait,catch); + binuptime(&bt2); + if (catch) { + if (error != EWOULDBLOCK) { + if (error == ERESTART) + error = EINTR; + if (rmt != NULL) { + tmp = bt; + bintime_sub(&tmp, &bt2); + bintime2timespec(&tmp,&ts); + if (ts.tv_sec < 0) + timespecclear(&ts); + *rmt = ts; + } return (error); + } } - if (timespeccmp(&ts2, &ts, >=)) + if (bintime_cmp(&bt2, &bt, >=)) return (0); - ts3 = ts; - timespecsub(&ts3, &ts2); - TIMESPEC_TO_TIMEVAL(&tv, &ts3); } } Modified: projects/calloutng/sys/kern/subr_sleepqueue.c ============================================================================== --- projects/calloutng/sys/kern/subr_sleepqueue.c Fri Jun 8 11:40:30 2012 (r236743) +++ projects/calloutng/sys/kern/subr_sleepqueue.c Fri Jun 8 11:53:51 2012 (r236744) @@ -361,6 +361,22 @@ sleepq_add(void *wchan, struct lock_obje * Sets a timeout that will remove the current thread from the specified * sleep queue after timo ticks if the thread has not already been awakened. */ +void +sleepq_set_timeout_bt(void *wchan, struct bintime bt) +{ + + struct sleepqueue_chain *sc; + struct thread *td; + + td = curthread; + sc = SC_LOOKUP(wchan); + mtx_assert(&sc->sc_lock, MA_OWNED); + MPASS(TD_ON_SLEEPQ(td)); + MPASS(td->td_sleepqueue == NULL); + MPASS(wchan != NULL); + callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout, td, PCPU_GET(cpuid)); +} + void sleepq_set_timeout(void *wchan, int timo) { Modified: projects/calloutng/sys/sys/sleepqueue.h ============================================================================== --- projects/calloutng/sys/sys/sleepqueue.h Fri Jun 8 11:40:30 2012 (r236743) +++ projects/calloutng/sys/sys/sleepqueue.h Fri Jun 8 11:53:51 2012 (r236744) @@ -108,6 +108,7 @@ struct sleepqueue *sleepq_lookup(void *w void sleepq_release(void *wchan); void sleepq_remove(struct thread *td, void *wchan); int sleepq_signal(void *wchan, int flags, int pri, int queue); +void sleepq_set_timeout_bt(void *wchan, struct bintime bt); void sleepq_set_timeout(void *wchan, int timo); u_int sleepq_sleepcnt(void *wchan, int queue); int sleepq_timedwait(void *wchan, int pri); From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 12:53:00 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4AC8F106566B; Fri, 8 Jun 2012 12:53:00 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 4F7478FC1A; Fri, 8 Jun 2012 12:52:59 +0000 (UTC) Received: by laai10 with SMTP id i10so1487963laa.13 for ; Fri, 08 Jun 2012 05:52:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6rvY77Venj1ngYyBno1hMzYdRiM4sX6YuYR2ZGuoxXg=; b=i7g3wvz4IAMACU1joIcPOuvOXj+Qnk40a2Irsl8FQRpyPW1twQBZN9bCtDgzy7KFHv UCo1twnxSE7qOPnTiGHFWYVHX7dij0pfQhYigUXHRhlyLZgJxZyn9zvfFn0THagsNUyc zUTR2RET+5vJxBQVgMdi9ABQW/8KJWmPfyYU+I2UzljAFDFEFPUWjTAQtDI0Fe8zaORE 6FTjY+Djr4KKpLsDt5Ptc8Z37ILww/LNAvS/u+D2M6oV11Q8p07MWOCU0T8AKaJq8VSb vkn39u4LSyPNtkCqhchwwNOBI1tz+onXhh3HPTJ3eprxq6eivj+95oELg5MCwzmwssyk B7KA== MIME-Version: 1.0 Received: by 10.152.106.12 with SMTP id gq12mr8284185lab.17.1339159977986; Fri, 08 Jun 2012 05:52:57 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Fri, 8 Jun 2012 05:52:57 -0700 (PDT) In-Reply-To: <201206081153.q58BrqG2056771@svn.freebsd.org> References: <201206081153.q58BrqG2056771@svn.freebsd.org> Date: Fri, 8 Jun 2012 13:52:57 +0100 X-Google-Sender-Auth: qJEkyfTj5jrzyK4z51Py3y93a7k Message-ID: From: Attilio Rao To: Davide Italiano Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 12:53:01 -0000 MjAxMi82LzggRGF2aWRlIEl0YWxpYW5vIDxkYXZpZGVAZnJlZWJzZC5vcmc+Ogo+IEF1dGhvcjog ZGF2aWRlCj4gRGF0ZTogRnJpIEp1biDCoDggMTE6NTM6NTEgMjAxMgo+IE5ldyBSZXZpc2lvbjog MjM2NzQ0Cj4gVVJMOiBodHRwOi8vc3ZuLmZyZWVic2Qub3JnL2NoYW5nZXNldC9iYXNlLzIzNjc0 NAo+Cj4gTG9nOgo+IMKgQWRkIChleHBlcmltZW50YWxseSkgYSBmdW5jdGlvbiB0byB0aGUgc2xl ZXBxdWV1ZSg5KSBLUEkKPiDCoHNsZWVwcV9zZXRfdGltZW91dF9idCgpIGluIHdoaWNoIHRoZSB0 aW1lb3V0IG1heSBiZSBzcGVjaWZpZWQgaW4gdGVybXMKPiDCoG9mIGJpbnRpbWUgcmF0aGVyIHRo YW4gdGlja3MsIGFuZCB3aGljaCB0YWtlcyBhZHZhbnRhZ2Ugb2YgdGhlIG5ldwo+IMKgcHJlY2lz aW9uIGNhcGFiaWxpdGllcyBvZiB0aGUgY2FsbG91dCBzdWJzeXN0ZW0uCj4KPiDCoE1vZGlmeSB0 aGUga2Vybl9uYW5vc2xlZXAoKSBmdW5jdGlvbiBzbyB0aGF0IGl0IG1heSByZWx5IG9uCj4gwqBz bGVlcHFfc2V0X3RpbWVvdXRfYnQoKSByYXRoZXIgdGhhbiB0c2xlZXAoKS4KPgo+IE1vZGlmaWVk Ogo+IMKgcHJvamVjdHMvY2FsbG91dG5nL3N5cy9rZXJuL2tlcm5fdGltZS5jCj4gwqBwcm9qZWN0 cy9jYWxsb3V0bmcvc3lzL2tlcm4vc3Vicl9zbGVlcHF1ZXVlLmMKPiDCoHByb2plY3RzL2NhbGxv dXRuZy9zeXMvc3lzL3NsZWVwcXVldWUuaAo+Cj4gTW9kaWZpZWQ6IHByb2plY3RzL2NhbGxvdXRu Zy9zeXMva2Vybi9rZXJuX3RpbWUuYwo+ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQo+IC0tLSBwcm9q ZWN0cy9jYWxsb3V0bmcvc3lzL2tlcm4va2Vybl90aW1lLmMgwqAgwqAgRnJpIEp1biDCoDggMTE6 NDA6MzAgMjAxMiDCoCDCoCDCoCDCoChyMjM2NzQzKQo+ICsrKyBwcm9qZWN0cy9jYWxsb3V0bmcv c3lzL2tlcm4va2Vybl90aW1lLmMgwqAgwqAgRnJpIEp1biDCoDggMTE6NTM6NTEgMjAxMiDCoCDC oCDCoCDCoChyMjM2NzQ0KQo+IEBAIC00Myw2ICs0Myw3IEBAIF9fRkJTRElEKCIkRnJlZUJTRCQi KTsKPiDCoCNpbmNsdWRlIDxzeXMvcmVzb3VyY2V2YXIuaD4KPiDCoCNpbmNsdWRlIDxzeXMvc2ln bmFsdmFyLmg+Cj4gwqAjaW5jbHVkZSA8c3lzL2tlcm5lbC5oPgo+ICsjaW5jbHVkZSA8c3lzL3Ns ZWVwcXVldWUuaD4KPiDCoCNpbmNsdWRlIDxzeXMvc3lzY2FsbHN1YnIuaD4KPiDCoCNpbmNsdWRl IDxzeXMvc3lzY3RsLmg+Cj4gwqAjaW5jbHVkZSA8c3lzL3N5c2VudC5oPgo+IEBAIC0zNTIsMzcg KzM1Myw0MCBAQCBzdGF0aWMgaW50IG5hbm93YWl0Owo+IMKgaW50Cj4gwqBrZXJuX25hbm9zbGVl cChzdHJ1Y3QgdGhyZWFkICp0ZCwgc3RydWN0IHRpbWVzcGVjICpycXQsIHN0cnVjdCB0aW1lc3Bl YyAqcm10KQo+IMKgewo+IC0gwqAgwqAgwqAgc3RydWN0IHRpbWVzcGVjIHRzLCB0czIsIHRzMzsK PiAtIMKgIMKgIMKgIHN0cnVjdCB0aW1ldmFsIHR2Owo+IC0gwqAgwqAgwqAgaW50IGVycm9yOwo+ ICsgwqAgwqAgwqAgc3RydWN0IHRpbWVzcGVjIHRzOwo+ICsgwqAgwqAgwqAgc3RydWN0IGJpbnRp bWUgYnQsIGJ0MiwgdG1wOwo+ICsgwqAgwqAgwqAgaW50IGNhdGNoID0gMCwgZXJyb3I7Cj4KPiDC oCDCoCDCoCDCoGlmIChycXQtPnR2X25zZWMgPCAwIHx8IHJxdC0+dHZfbnNlYyA+PSAxMDAwMDAw MDAwKQo+IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgcmV0dXJuIChFSU5WQUwpOwo+IMKgIMKgIMKg IMKgaWYgKHJxdC0+dHZfc2VjIDwgMCB8fCAocnF0LT50dl9zZWMgPT0gMCAmJiBycXQtPnR2X25z ZWMgPT0gMCkpCj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqByZXR1cm4gKDApOwo+IC0gwqAgwqAg wqAgZ2V0bmFub3VwdGltZSgmdHMpOwo+IC0gwqAgwqAgwqAgdGltZXNwZWNhZGQoJnRzLCBycXQp Owo+IC0gwqAgwqAgwqAgVElNRVNQRUNfVE9fVElNRVZBTCgmdHYsIHJxdCk7Cj4gKyDCoCDCoCDC oCBiaW51cHRpbWUoJmJ0KTsKPiArIMKgIMKgIMKgIHRpbWVzcGVjMmJpbnRpbWUocnF0LCAmdG1w KTsKPiArIMKgIMKgIMKgIGJpbnRpbWVfYWRkKCZidCwmdG1wKTsKPiDCoCDCoCDCoCDCoGZvciAo OzspIHsKPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGVycm9yID0gdHNsZWVwKCZuYW5vd2FpdCwg UFdBSVQgfCBQQ0FUQ0gsICJuYW5zbHAiLAo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg dHZ0b2h6KCZ0dikpOwo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgZ2V0bmFub3VwdGltZSgmdHMy KTsKPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChlcnJvciAhPSBFV09VTERCTE9DSykgewo+ IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGVycm9yID09IEVSRVNUQVJU KQo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgZXJyb3Ig PSBFSU5UUjsKPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChybXQgIT0g TlVMTCkgewo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg dGltZXNwZWNzdWIoJnRzLCAmdHMyKTsKPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIGlmICh0cy50dl9zZWMgPCAwKQo+IC0gwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgdGltZXNwZWNjbGVhcigmdHMp Owo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgKnJtdCA9 IHRzOwo+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgfQo+ICsgwqAgwqAgwqAg wqAgwqAgwqAgwqAgc2xlZXBxX2xvY2soJm5hbm93YWl0KTsKPiArIMKgIMKgIMKgIMKgIMKgIMKg IMKgIHNsZWVwcV9hZGQoJm5hbm93YWl0LCBOVUxMLCAibmFuc2xwIiwgUFdBSVQgfCBQQ0FUQ0gs IDApOwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgc2xlZXBxX3NldF90aW1lb3V0X2J0KCZuYW5v d2FpdCxidCk7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBlcnJvciA9IHNsZWVwcV90aW1lZHdh aXRfc2lnKCZuYW5vd2FpdCxjYXRjaCk7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBiaW51cHRp bWUoJmJ0Mik7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBpZiAoY2F0Y2gpIHsKPiArIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChlcnJvciAhPSBFV09VTERCTE9DSykgewo+ ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGVycm9y ID09IEVSRVNUQVJUKQo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgZXJyb3IgPSBFSU5UUjsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChybXQgIT0gTlVMTCkgewo+ICsgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgdG1wID0gYnQ7 Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCBiaW50aW1lX3N1YigmdG1wLCAmYnQyKTsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGJpbnRpbWUydGltZXNwZWMoJnRtcCwm dHMpOwo+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgaWYgKHRzLnR2X3NlYyA8IDApCj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0aW1lc3BlY2NsZWFy KCZ0cyk7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCAqcm10ID0gdHM7Cj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCB9Cj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqByZXR1 cm4gKGVycm9yKTsKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIH0KPiDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoH0KPiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmICh0aW1lc3Bl Y2NtcCgmdHMyLCAmdHMsID49KSkKPiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChiaW50aW1l X2NtcCgmYnQyLCAmYnQsID49KSkKPiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oHJldHVybiAoMCk7Cj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0czMgPSB0czsKPiAtIMKgIMKg IMKgIMKgIMKgIMKgIMKgIHRpbWVzcGVjc3ViKCZ0czMsICZ0czIpOwo+IC0gwqAgwqAgwqAgwqAg wqAgwqAgwqAgVElNRVNQRUNfVE9fVElNRVZBTCgmdHYsICZ0czMpOwo+IMKgIMKgIMKgIMKgfQo+ IMKgfQo+Cj4KPiBNb2RpZmllZDogcHJvamVjdHMvY2FsbG91dG5nL3N5cy9rZXJuL3N1YnJfc2xl ZXBxdWV1ZS5jCj4gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Cj4gLS0tIHByb2plY3RzL2NhbGxvdXRu Zy9zeXMva2Vybi9zdWJyX3NsZWVwcXVldWUuYyDCoCDCoCDCoCBGcmkgSnVuIMKgOCAxMTo0MDoz MCAyMDEyIMKgIMKgIMKgIMKgKHIyMzY3NDMpCj4gKysrIHByb2plY3RzL2NhbGxvdXRuZy9zeXMv a2Vybi9zdWJyX3NsZWVwcXVldWUuYyDCoCDCoCDCoCBGcmkgSnVuIMKgOCAxMTo1Mzo1MSAyMDEy IMKgIMKgIMKgIMKgKHIyMzY3NDQpCj4gQEAgLTM2MSw2ICszNjEsMjIgQEAgc2xlZXBxX2FkZCh2 b2lkICp3Y2hhbiwgc3RydWN0IGxvY2tfb2JqZQo+IMKgKiBTZXRzIGEgdGltZW91dCB0aGF0IHdp bGwgcmVtb3ZlIHRoZSBjdXJyZW50IHRocmVhZCBmcm9tIHRoZSBzcGVjaWZpZWQKPiDCoCogc2xl ZXAgcXVldWUgYWZ0ZXIgdGltbyB0aWNrcyBpZiB0aGUgdGhyZWFkIGhhcyBub3QgYWxyZWFkeSBi ZWVuIGF3YWtlbmVkLgo+IMKgKi8KPiArdm9pZAo+ICtzbGVlcHFfc2V0X3RpbWVvdXRfYnQodm9p ZCAqd2NoYW4sIHN0cnVjdCBiaW50aW1lIGJ0KQo+ICt7Cj4gKwo+ICsgwqAgwqAgwqAgc3RydWN0 IHNsZWVwcXVldWVfY2hhaW4gKnNjOwo+ICsgwqAgwqAgwqAgc3RydWN0IHRocmVhZCAqdGQ7Cj4g Kwo+ICsgwqAgwqAgwqAgdGQgPSBjdXJ0aHJlYWQ7Cj4gKyDCoCDCoCDCoCBzYyA9IFNDX0xPT0tV UCh3Y2hhbik7Cj4gKyDCoCDCoCDCoCBtdHhfYXNzZXJ0KCZzYy0+c2NfbG9jaywgTUFfT1dORUQp Owo+ICsgwqAgwqAgwqAgTVBBU1MoVERfT05fU0xFRVBRKHRkKSk7Cj4gKyDCoCDCoCDCoCBNUEFT Uyh0ZC0+dGRfc2xlZXBxdWV1ZSA9PSBOVUxMKTsKPiArIMKgIMKgIMKgIE1QQVNTKHdjaGFuICE9 IE5VTEwpOwo+ICsgwqAgwqAgwqAgY2FsbG91dF9yZXNldF9idF9vbigmdGQtPnRkX3NscGNhbGxv dXQsIGJ0LCBzbGVlcHFfdGltZW91dCwgdGQsIFBDUFVfR0VUKGNwdWlkKSk7Cj4gK30KPiArCgpG b3IgdGhpcywgSSdkIHJhdGhlciBwcmVmZXIgdGhhdCB5b3UgcGF0Y2ggc2xlZXBxX3NldF90aW1l b3V0KCkgZGlyZWN0bHkgdG8gYmU6CnZvaWQgc2xlZXBxX3NldF90aW1lb3V0KHZvaWQgKndjaGFu LCBpbnQgdGltbywgc3RydWN0IGJpbnRpbWUgKmJ0KTsKClRoZW4sIGlmIHlvdSBwYXNzIGEgTlVM TCBwdHIgdG8gYnQgdGhlICd0aW1vJyBpcyB1c2VkLCBvdGhlcndpc2UgYnQgaXMKZ2l2ZW4gcHJl ZmVyZW5jZSBpbiB0aGUgbG9naWMuIFlvdSB3aWxsIG5lZWQgdG8gcGF0Y2ggdGhlIGN1cnJlbnQg ZmV3CmNhbGxlcnMgb2Ygc2xlZXBxX3NldF90aW1vKCkgdG8gZ2V0IE5VTEwsIGJ1dCBpdCBpcyBh IHNtYWxsIHBhdGNoLgpJIHdvdWxkIHJlYWxseSBsaWtlIHRoYXQgeW91IGRvIHRoZSBzYW1lIGFs c28gaW4gdGhlIGNhbGxvdXQgS1BJLApwb3NzaWJseSwgYmVjYXVzZSB0aGlzIGF2b2lkcyBhIGxv dCBvZiBjb2RlIGR1cGxpY2F0aW9uLgoKQXR0aWxpbwoKCi0tIApQZWFjZSBjYW4gb25seSBiZSBh Y2hpZXZlZCBieSB1bmRlcnN0YW5kaW5nIC0gQS4gRWluc3RlaW4K From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 13:08:25 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A03D2106566C; Fri, 8 Jun 2012 13:08:25 +0000 (UTC) (envelope-from davide.italiano@gmail.com) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2BCE88FC1E; Fri, 8 Jun 2012 13:08:24 +0000 (UTC) Received: by vcbfy7 with SMTP id fy7so1125442vcb.13 for ; Fri, 08 Jun 2012 06:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=k4ArWHdRuHfxeRof61OcWZ95YcZs1/gJZL3ny3cifkk=; b=P3Bb9r9rhq+Jc1yCNp3arU77tuZocIzNENTdwHsQAPFBMaTJ40grIKdWZNGoz86XIB nU6WzH5jNv5P4uR2Im/fnViLFLsNvxFECuhcfIj5L8E75XAoczW2dE+QG8nfnvHHSCsK NQjiFEDu9deKSgJ2MQPij41VZMo+f1LjWbLgyTsnLqg4dxtGaPl3R/C16RDh+4fbX9YE OZM7VGH8klPViJeHsAqOLNbcIa0vhAGkHJLs06cDfsEe9RBq6pSvROqtNBU3wUaI2sJF lsHK/J0Re+PgYUm6yhhk0FQeWDsyi+5MhO5bHgQbEkgSCPcSEwGXCNCETPOQaMsb8ys+ hd/A== MIME-Version: 1.0 Received: by 10.52.174.99 with SMTP id br3mr5227211vdc.85.1339160904440; Fri, 08 Jun 2012 06:08:24 -0700 (PDT) Sender: davide.italiano@gmail.com Received: by 10.52.28.132 with HTTP; Fri, 8 Jun 2012 06:08:24 -0700 (PDT) In-Reply-To: References: <201206081153.q58BrqG2056771@svn.freebsd.org> Date: Fri, 8 Jun 2012 15:08:24 +0200 X-Google-Sender-Auth: CF3lrQLuzhVfTzpVy2hu0JAAtKQ Message-ID: From: Davide Italiano To: Attilio Rao Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 13:08:25 -0000 On Fri, Jun 8, 2012 at 2:52 PM, Attilio Rao wrote: > 2012/6/8 Davide Italiano : >> Author: davide >> Date: Fri Jun =A08 11:53:51 2012 >> New Revision: 236744 >> URL: http://svn.freebsd.org/changeset/base/236744 >> >> Log: >> =A0Add (experimentally) a function to the sleepqueue(9) KPI >> =A0sleepq_set_timeout_bt() in which the timeout may be specified in term= s >> =A0of bintime rather than ticks, and which takes advantage of the new >> =A0precision capabilities of the callout subsystem. >> >> =A0Modify the kern_nanosleep() function so that it may rely on >> =A0sleepq_set_timeout_bt() rather than tsleep(). >> >> Modified: >> =A0projects/calloutng/sys/kern/kern_time.c >> =A0projects/calloutng/sys/kern/subr_sleepqueue.c >> =A0projects/calloutng/sys/sys/sleepqueue.h >> >> Modified: projects/calloutng/sys/kern/kern_time.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- projects/calloutng/sys/kern/kern_time.c =A0 =A0 Fri Jun =A08 11:40:3= 0 2012 =A0 =A0 =A0 =A0(r236743) >> +++ projects/calloutng/sys/kern/kern_time.c =A0 =A0 Fri Jun =A08 11:53:5= 1 2012 =A0 =A0 =A0 =A0(r236744) >> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); >> =A0#include >> =A0#include >> =A0#include >> +#include >> =A0#include >> =A0#include >> =A0#include >> @@ -352,37 +353,40 @@ static int nanowait; >> =A0int >> =A0kern_nanosleep(struct thread *td, struct timespec *rqt, struct timesp= ec *rmt) >> =A0{ >> - =A0 =A0 =A0 struct timespec ts, ts2, ts3; >> - =A0 =A0 =A0 struct timeval tv; >> - =A0 =A0 =A0 int error; >> + =A0 =A0 =A0 struct timespec ts; >> + =A0 =A0 =A0 struct bintime bt, bt2, tmp; >> + =A0 =A0 =A0 int catch =3D 0, error; >> >> =A0 =A0 =A0 =A0if (rqt->tv_nsec < 0 || rqt->tv_nsec >=3D 1000000000) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (EINVAL); >> =A0 =A0 =A0 =A0if (rqt->tv_sec < 0 || (rqt->tv_sec =3D=3D 0 && rqt->tv_n= sec =3D=3D 0)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); >> - =A0 =A0 =A0 getnanouptime(&ts); >> - =A0 =A0 =A0 timespecadd(&ts, rqt); >> - =A0 =A0 =A0 TIMESPEC_TO_TIMEVAL(&tv, rqt); >> + =A0 =A0 =A0 binuptime(&bt); >> + =A0 =A0 =A0 timespec2bintime(rqt, &tmp); >> + =A0 =A0 =A0 bintime_add(&bt,&tmp); >> =A0 =A0 =A0 =A0for (;;) { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D tsleep(&nanowait, PWAIT | PCATCH= , "nanslp", >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tvtohz(&tv)); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 getnanouptime(&ts2); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error !=3D EWOULDBLOCK) { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error =3D=3D ERESTART) >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D = EINTR; >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rmt !=3D NULL) { >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 timespecsu= b(&ts, &ts2); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (ts.tv_= sec < 0) >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 timespecclear(&ts); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 *rmt =3D t= s; >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sleepq_lock(&nanowait); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sleepq_add(&nanowait, NULL, "nanslp", PWAI= T | PCATCH, 0); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 sleepq_set_timeout_bt(&nanowait,bt); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 error =3D sleepq_timedwait_sig(&nanowait,c= atch); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 binuptime(&bt2); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (catch) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error !=3D EWOULDBLOCK= ) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (error = =3D=3D ERESTART) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 error =3D EINTR; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (rmt != =3D NULL) { >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 tmp =3D bt; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 bintime_sub(&tmp, &bt2); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 bintime2timespec(&tmp,&ts); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 if (ts.tv_sec < 0) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 timespecclear(&ts); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 *rmt =3D ts; >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (error); >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (timespeccmp(&ts2, &ts, >=3D)) >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (bintime_cmp(&bt2, &bt, >=3D)) >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (0); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 ts3 =3D ts; >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 timespecsub(&ts3, &ts2); >> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 TIMESPEC_TO_TIMEVAL(&tv, &ts3); >> =A0 =A0 =A0 =A0} >> =A0} >> >> >> Modified: projects/calloutng/sys/kern/subr_sleepqueue.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- projects/calloutng/sys/kern/subr_sleepqueue.c =A0 =A0 =A0 Fri Jun = =A08 11:40:30 2012 =A0 =A0 =A0 =A0(r236743) >> +++ projects/calloutng/sys/kern/subr_sleepqueue.c =A0 =A0 =A0 Fri Jun = =A08 11:53:51 2012 =A0 =A0 =A0 =A0(r236744) >> @@ -361,6 +361,22 @@ sleepq_add(void *wchan, struct lock_obje >> =A0* Sets a timeout that will remove the current thread from the specifi= ed >> =A0* sleep queue after timo ticks if the thread has not already been awa= kened. >> =A0*/ >> +void >> +sleepq_set_timeout_bt(void *wchan, struct bintime bt) >> +{ >> + >> + =A0 =A0 =A0 struct sleepqueue_chain *sc; >> + =A0 =A0 =A0 struct thread *td; >> + >> + =A0 =A0 =A0 td =3D curthread; >> + =A0 =A0 =A0 sc =3D SC_LOOKUP(wchan); >> + =A0 =A0 =A0 mtx_assert(&sc->sc_lock, MA_OWNED); >> + =A0 =A0 =A0 MPASS(TD_ON_SLEEPQ(td)); >> + =A0 =A0 =A0 MPASS(td->td_sleepqueue =3D=3D NULL); >> + =A0 =A0 =A0 MPASS(wchan !=3D NULL); >> + =A0 =A0 =A0 callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout= , td, PCPU_GET(cpuid)); >> +} >> + > > For this, I'd rather prefer that you patch sleepq_set_timeout() directly = to be: > void sleepq_set_timeout(void *wchan, int timo, struct bintime *bt);u > > Then, if you pass a NULL ptr to bt the 'timo' is used, otherwise bt is > given preference in the logic. You will need to patch the current few > callers of sleepq_set_timo() to get NULL, but it is a small patch. > I would really like that you do the same also in the callout KPI, > possibly, because this avoids a lot of code duplication. > > Attilio > > > -- > Peace can only be achieved by understanding - A. Einstein Attilio, I agree with you about the few clients of sleepq_set_timeout(), and I may change it easily. About the callout_* KPI, if you refer to the recently added callout_reset_bt_on() function, I have some concerns. Right now, the number of consumers of callout_reset() or callout_reset_on() is a lot bigger than the one of sleepq_set_timeout() to consider a change, at least from my point of view. Moreover, differently from previous case, callout_reset_bt_on() doesn't duplicate code because I've moved the old code there and made callout_reset_on() a wrapper in which conversion is made and callout_reset_bt_on() is called. Davide From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 13:13:24 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9FBCC106568A; Fri, 8 Jun 2012 13:13:24 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id A41808FC1B; Fri, 8 Jun 2012 13:13:23 +0000 (UTC) Received: by lbon10 with SMTP id n10so1638030lbo.13 for ; Fri, 08 Jun 2012 06:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=CW5ZLn4af+syV8AWyrhNW4uuM09LyijF/WIZYWXivWc=; b=QiuXkuBUHItUlzOlBN1wQn3rW18QW1izlMeF1QhdtjMQNXn+a8WTOADFyGu3RWfbmh WmC5IKf8vy+/VTVg2tuUhw5Spgqv1KXlZ1X1EKtJeLV4kKCdtmdb18JMDO3bmnK4iOkC YMZQc9czgHN07/YG/6bxmdKp90oifA4T7YEW8Ezv2FGlzwDjkXmh/G99MhsS2BndCb1u CA2SmK/7hdpK1SkChFyFOF7GP93o3vjw0hxZ3rYRYZuAjJOmaq8LtMow61Y66W95zvyA HuPv1JpzpU0DwPjSUU+qR/wGFHyR94KEQk9oNuVYHuRFTHZep7GHUfXZsWLUjU7h8U/J 5HFA== MIME-Version: 1.0 Received: by 10.152.46.6 with SMTP id r6mr8490241lam.7.1339161202318; Fri, 08 Jun 2012 06:13:22 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Fri, 8 Jun 2012 06:13:22 -0700 (PDT) In-Reply-To: References: <201206081153.q58BrqG2056771@svn.freebsd.org> Date: Fri, 8 Jun 2012 14:13:22 +0100 X-Google-Sender-Auth: KCZajd2saPXdhV2p3IXYTE1MMC8 Message-ID: From: Attilio Rao To: Davide Italiano Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 13:13:24 -0000 MjAxMi82LzggRGF2aWRlIEl0YWxpYW5vIDxkYXZpZGVAZnJlZWJzZC5vcmc+Ogo+IE9uIEZyaSwg SnVuIDgsIDIwMTIgYXQgMjo1MiBQTSwgQXR0aWxpbyBSYW8gPGF0dGlsaW9AZnJlZWJzZC5vcmc+ IHdyb3RlOgo+PiAyMDEyLzYvOCBEYXZpZGUgSXRhbGlhbm8gPGRhdmlkZUBmcmVlYnNkLm9yZz46 Cj4+PiBBdXRob3I6IGRhdmlkZQo+Pj4gRGF0ZTogRnJpIEp1biDCoDggMTE6NTM6NTEgMjAxMgo+ Pj4gTmV3IFJldmlzaW9uOiAyMzY3NDQKPj4+IFVSTDogaHR0cDovL3N2bi5mcmVlYnNkLm9yZy9j aGFuZ2VzZXQvYmFzZS8yMzY3NDQKPj4+Cj4+PiBMb2c6Cj4+PiDCoEFkZCAoZXhwZXJpbWVudGFs bHkpIGEgZnVuY3Rpb24gdG8gdGhlIHNsZWVwcXVldWUoOSkgS1BJCj4+PiDCoHNsZWVwcV9zZXRf dGltZW91dF9idCgpIGluIHdoaWNoIHRoZSB0aW1lb3V0IG1heSBiZSBzcGVjaWZpZWQgaW4gdGVy bXMKPj4+IMKgb2YgYmludGltZSByYXRoZXIgdGhhbiB0aWNrcywgYW5kIHdoaWNoIHRha2VzIGFk dmFudGFnZSBvZiB0aGUgbmV3Cj4+PiDCoHByZWNpc2lvbiBjYXBhYmlsaXRpZXMgb2YgdGhlIGNh bGxvdXQgc3Vic3lzdGVtLgo+Pj4KPj4+IMKgTW9kaWZ5IHRoZSBrZXJuX25hbm9zbGVlcCgpIGZ1 bmN0aW9uIHNvIHRoYXQgaXQgbWF5IHJlbHkgb24KPj4+IMKgc2xlZXBxX3NldF90aW1lb3V0X2J0 KCkgcmF0aGVyIHRoYW4gdHNsZWVwKCkuCj4+Pgo+Pj4gTW9kaWZpZWQ6Cj4+PiDCoHByb2plY3Rz L2NhbGxvdXRuZy9zeXMva2Vybi9rZXJuX3RpbWUuYwo+Pj4gwqBwcm9qZWN0cy9jYWxsb3V0bmcv c3lzL2tlcm4vc3Vicl9zbGVlcHF1ZXVlLmMKPj4+IMKgcHJvamVjdHMvY2FsbG91dG5nL3N5cy9z eXMvc2xlZXBxdWV1ZS5oCj4+Pgo+Pj4gTW9kaWZpZWQ6IHByb2plY3RzL2NhbGxvdXRuZy9zeXMv a2Vybi9rZXJuX3RpbWUuYwo+Pj4gPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Cj4+PiAtLS0gcHJvamVj dHMvY2FsbG91dG5nL3N5cy9rZXJuL2tlcm5fdGltZS5jIMKgIMKgIEZyaSBKdW4gwqA4IDExOjQw OjMwIDIwMTIgwqAgwqAgwqAgwqAocjIzNjc0MykKPj4+ICsrKyBwcm9qZWN0cy9jYWxsb3V0bmcv c3lzL2tlcm4va2Vybl90aW1lLmMgwqAgwqAgRnJpIEp1biDCoDggMTE6NTM6NTEgMjAxMiDCoCDC oCDCoCDCoChyMjM2NzQ0KQo+Pj4gQEAgLTQzLDYgKzQzLDcgQEAgX19GQlNESUQoIiRGcmVlQlNE JCIpOwo+Pj4gwqAjaW5jbHVkZSA8c3lzL3Jlc291cmNldmFyLmg+Cj4+PiDCoCNpbmNsdWRlIDxz eXMvc2lnbmFsdmFyLmg+Cj4+PiDCoCNpbmNsdWRlIDxzeXMva2VybmVsLmg+Cj4+PiArI2luY2x1 ZGUgPHN5cy9zbGVlcHF1ZXVlLmg+Cj4+PiDCoCNpbmNsdWRlIDxzeXMvc3lzY2FsbHN1YnIuaD4K Pj4+IMKgI2luY2x1ZGUgPHN5cy9zeXNjdGwuaD4KPj4+IMKgI2luY2x1ZGUgPHN5cy9zeXNlbnQu aD4KPj4+IEBAIC0zNTIsMzcgKzM1Myw0MCBAQCBzdGF0aWMgaW50IG5hbm93YWl0Owo+Pj4gwqBp bnQKPj4+IMKga2Vybl9uYW5vc2xlZXAoc3RydWN0IHRocmVhZCAqdGQsIHN0cnVjdCB0aW1lc3Bl YyAqcnF0LCBzdHJ1Y3QgdGltZXNwZWMgKnJtdCkKPj4+IMKgewo+Pj4gLSDCoCDCoCDCoCBzdHJ1 Y3QgdGltZXNwZWMgdHMsIHRzMiwgdHMzOwo+Pj4gLSDCoCDCoCDCoCBzdHJ1Y3QgdGltZXZhbCB0 djsKPj4+IC0gwqAgwqAgwqAgaW50IGVycm9yOwo+Pj4gKyDCoCDCoCDCoCBzdHJ1Y3QgdGltZXNw ZWMgdHM7Cj4+PiArIMKgIMKgIMKgIHN0cnVjdCBiaW50aW1lIGJ0LCBidDIsIHRtcDsKPj4+ICsg wqAgwqAgwqAgaW50IGNhdGNoID0gMCwgZXJyb3I7Cj4+Pgo+Pj4gwqAgwqAgwqAgwqBpZiAocnF0 LT50dl9uc2VjIDwgMCB8fCBycXQtPnR2X25zZWMgPj0gMTAwMDAwMDAwMCkKPj4+IMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgcmV0dXJuIChFSU5WQUwpOwo+Pj4gwqAgwqAgwqAgwqBpZiAocnF0LT50 dl9zZWMgPCAwIHx8IChycXQtPnR2X3NlYyA9PSAwICYmIHJxdC0+dHZfbnNlYyA9PSAwKSkKPj4+ IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgcmV0dXJuICgwKTsKPj4+IC0gwqAgwqAgwqAgZ2V0bmFu b3VwdGltZSgmdHMpOwo+Pj4gLSDCoCDCoCDCoCB0aW1lc3BlY2FkZCgmdHMsIHJxdCk7Cj4+PiAt IMKgIMKgIMKgIFRJTUVTUEVDX1RPX1RJTUVWQUwoJnR2LCBycXQpOwo+Pj4gKyDCoCDCoCDCoCBi aW51cHRpbWUoJmJ0KTsKPj4+ICsgwqAgwqAgwqAgdGltZXNwZWMyYmludGltZShycXQsICZ0bXAp Owo+Pj4gKyDCoCDCoCDCoCBiaW50aW1lX2FkZCgmYnQsJnRtcCk7Cj4+PiDCoCDCoCDCoCDCoGZv ciAoOzspIHsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgZXJyb3IgPSB0c2xlZXAoJm5hbm93 YWl0LCBQV0FJVCB8IFBDQVRDSCwgIm5hbnNscCIsCj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIHR2dG9oeigmdHYpKTsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgZ2V0bmFub3Vw dGltZSgmdHMyKTsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGVycm9yICE9IEVXT1VM REJMT0NLKSB7Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChlcnJv ciA9PSBFUkVTVEFSVCkKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgZXJyb3IgPSBFSU5UUjsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgaWYgKHJtdCAhPSBOVUxMKSB7Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIHRpbWVzcGVjc3ViKCZ0cywgJnRzMik7Cj4+PiAtIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmICh0cy50dl9zZWMgPCAwKQo+ Pj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCB0aW1lc3BlY2NsZWFyKCZ0cyk7Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgICpybXQgPSB0czsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgfQo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBzbGVlcHFfbG9jaygmbmFu b3dhaXQpOwo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBzbGVlcHFfYWRkKCZuYW5vd2FpdCwg TlVMTCwgIm5hbnNscCIsIFBXQUlUIHwgUENBVENILCAwKTsKPj4+ICsgwqAgwqAgwqAgwqAgwqAg wqAgwqAgc2xlZXBxX3NldF90aW1lb3V0X2J0KCZuYW5vd2FpdCxidCk7Cj4+PiArIMKgIMKgIMKg IMKgIMKgIMKgIMKgIGVycm9yID0gc2xlZXBxX3RpbWVkd2FpdF9zaWcoJm5hbm93YWl0LGNhdGNo KTsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgYmludXB0aW1lKCZidDIpOwo+Pj4gKyDCoCDC oCDCoCDCoCDCoCDCoCDCoCBpZiAoY2F0Y2gpIHsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgaWYgKGVycm9yICE9IEVXT1VMREJMT0NLKSB7Cj4+PiArIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChlcnJvciA9PSBFUkVTVEFSVCkK Pj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgZXJyb3IgPSBFSU5UUjsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgaWYgKHJtdCAhPSBOVUxMKSB7Cj4+PiArIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHRtcCA9IGJ0Owo+Pj4gKyDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBi aW50aW1lX3N1YigmdG1wLCAmYnQyKTsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgYmludGltZTJ0aW1lc3BlYygmdG1wLCZ0cyk7 Cj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIGlmICh0cy50dl9zZWMgPCAwKQo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0aW1lc3BlY2NsZWFy KCZ0cyk7Cj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgICpybXQgPSB0czsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgfQo+Pj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqByZXR1cm4gKGVycm9yKTsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg fQo+Pj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqB9Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKg IGlmICh0aW1lc3BlY2NtcCgmdHMyLCAmdHMsID49KSkKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAg wqAgaWYgKGJpbnRpbWVfY21wKCZidDIsICZidCwgPj0pKQo+Pj4gwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqByZXR1cm4gKDApOwo+Pj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0 czMgPSB0czsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgdGltZXNwZWNzdWIoJnRzMywgJnRz Mik7Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIFRJTUVTUEVDX1RPX1RJTUVWQUwoJnR2LCAm dHMzKTsKPj4+IMKgIMKgIMKgIMKgfQo+Pj4gwqB9Cj4+Pgo+Pj4KPj4+IE1vZGlmaWVkOiBwcm9q ZWN0cy9jYWxsb3V0bmcvc3lzL2tlcm4vc3Vicl9zbGVlcHF1ZXVlLmMKPj4+ID09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PQo+Pj4gLS0tIHByb2plY3RzL2NhbGxvdXRuZy9zeXMva2Vybi9zdWJyX3NsZWVw cXVldWUuYyDCoCDCoCDCoCBGcmkgSnVuIMKgOCAxMTo0MDozMCAyMDEyIMKgIMKgIMKgIMKgKHIy MzY3NDMpCj4+PiArKysgcHJvamVjdHMvY2FsbG91dG5nL3N5cy9rZXJuL3N1YnJfc2xlZXBxdWV1 ZS5jIMKgIMKgIMKgIEZyaSBKdW4gwqA4IDExOjUzOjUxIDIwMTIgwqAgwqAgwqAgwqAocjIzNjc0 NCkKPj4+IEBAIC0zNjEsNiArMzYxLDIyIEBAIHNsZWVwcV9hZGQodm9pZCAqd2NoYW4sIHN0cnVj dCBsb2NrX29iamUKPj4+IMKgKiBTZXRzIGEgdGltZW91dCB0aGF0IHdpbGwgcmVtb3ZlIHRoZSBj dXJyZW50IHRocmVhZCBmcm9tIHRoZSBzcGVjaWZpZWQKPj4+IMKgKiBzbGVlcCBxdWV1ZSBhZnRl ciB0aW1vIHRpY2tzIGlmIHRoZSB0aHJlYWQgaGFzIG5vdCBhbHJlYWR5IGJlZW4gYXdha2VuZWQu Cj4+PiDCoCovCj4+PiArdm9pZAo+Pj4gK3NsZWVwcV9zZXRfdGltZW91dF9idCh2b2lkICp3Y2hh biwgc3RydWN0IGJpbnRpbWUgYnQpCj4+PiArewo+Pj4gKwo+Pj4gKyDCoCDCoCDCoCBzdHJ1Y3Qg c2xlZXBxdWV1ZV9jaGFpbiAqc2M7Cj4+PiArIMKgIMKgIMKgIHN0cnVjdCB0aHJlYWQgKnRkOwo+ Pj4gKwo+Pj4gKyDCoCDCoCDCoCB0ZCA9IGN1cnRocmVhZDsKPj4+ICsgwqAgwqAgwqAgc2MgPSBT Q19MT09LVVAod2NoYW4pOwo+Pj4gKyDCoCDCoCDCoCBtdHhfYXNzZXJ0KCZzYy0+c2NfbG9jaywg TUFfT1dORUQpOwo+Pj4gKyDCoCDCoCDCoCBNUEFTUyhURF9PTl9TTEVFUFEodGQpKTsKPj4+ICsg wqAgwqAgwqAgTVBBU1ModGQtPnRkX3NsZWVwcXVldWUgPT0gTlVMTCk7Cj4+PiArIMKgIMKgIMKg IE1QQVNTKHdjaGFuICE9IE5VTEwpOwo+Pj4gKyDCoCDCoCDCoCBjYWxsb3V0X3Jlc2V0X2J0X29u KCZ0ZC0+dGRfc2xwY2FsbG91dCwgYnQsIHNsZWVwcV90aW1lb3V0LCB0ZCwgUENQVV9HRVQoY3B1 aWQpKTsKPj4+ICt9Cj4+PiArCj4+Cj4+IEZvciB0aGlzLCBJJ2QgcmF0aGVyIHByZWZlciB0aGF0 IHlvdSBwYXRjaCBzbGVlcHFfc2V0X3RpbWVvdXQoKSBkaXJlY3RseSB0byBiZToKPj4gdm9pZCBz bGVlcHFfc2V0X3RpbWVvdXQodm9pZCAqd2NoYW4sIGludCB0aW1vLCBzdHJ1Y3QgYmludGltZSAq YnQpO3UKPj4KPj4gVGhlbiwgaWYgeW91IHBhc3MgYSBOVUxMIHB0ciB0byBidCB0aGUgJ3RpbW8n IGlzIHVzZWQsIG90aGVyd2lzZSBidCBpcwo+PiBnaXZlbiBwcmVmZXJlbmNlIGluIHRoZSBsb2dp Yy4gWW91IHdpbGwgbmVlZCB0byBwYXRjaCB0aGUgY3VycmVudCBmZXcKPj4gY2FsbGVycyBvZiBz bGVlcHFfc2V0X3RpbW8oKSB0byBnZXQgTlVMTCwgYnV0IGl0IGlzIGEgc21hbGwgcGF0Y2guCj4+ IEkgd291bGQgcmVhbGx5IGxpa2UgdGhhdCB5b3UgZG8gdGhlIHNhbWUgYWxzbyBpbiB0aGUgY2Fs bG91dCBLUEksCj4+IHBvc3NpYmx5LCBiZWNhdXNlIHRoaXMgYXZvaWRzIGEgbG90IG9mIGNvZGUg ZHVwbGljYXRpb24uCj4+Cj4+IEF0dGlsaW8KPj4KPj4KPj4gLS0KPj4gUGVhY2UgY2FuIG9ubHkg YmUgYWNoaWV2ZWQgYnkgdW5kZXJzdGFuZGluZyAtIEEuIEVpbnN0ZWluCj4KPiBBdHRpbGlvLAo+ IEkgYWdyZWUgd2l0aCB5b3UgYWJvdXQgdGhlIGZldyBjbGllbnRzIG9mIHNsZWVwcV9zZXRfdGlt ZW91dCgpLCBhbmQgSQo+IG1heSBjaGFuZ2UgaXQgZWFzaWx5Lgo+IEFib3V0IHRoZSBjYWxsb3V0 XyogS1BJLCBpZiB5b3UgcmVmZXIgdG8gdGhlIHJlY2VudGx5IGFkZGVkCj4gY2FsbG91dF9yZXNl dF9idF9vbigpIGZ1bmN0aW9uLCBJIGhhdmUgc29tZSBjb25jZXJucy4KPiBSaWdodCBub3csIHRo ZSBudW1iZXIgb2YgY29uc3VtZXJzIG9mIGNhbGxvdXRfcmVzZXQoKSBvcgo+IGNhbGxvdXRfcmVz ZXRfb24oKSBpcyBhIGxvdCBiaWdnZXIgdGhhbiB0aGUgb25lIG9mCj4gc2xlZXBxX3NldF90aW1l b3V0KCkgdG8gY29uc2lkZXIgYSBjaGFuZ2UsIGF0IGxlYXN0IGZyb20gbXkgcG9pbnQgb2YKPiB2 aWV3Lgo+IE1vcmVvdmVyLCBkaWZmZXJlbnRseSBmcm9tIHByZXZpb3VzIGNhc2UsIGNhbGxvdXRf cmVzZXRfYnRfb24oKQo+IGRvZXNuJ3QgZHVwbGljYXRlIGNvZGUgYmVjYXVzZSBJJ3ZlIG1vdmVk IHRoZSBvbGQgY29kZSB0aGVyZSBhbmQgbWFkZQo+IGNhbGxvdXRfcmVzZXRfb24oKSBhIHdyYXBw ZXIgaW4gd2hpY2ggY29udmVyc2lvbiBpcyBtYWRlIGFuZAo+IGNhbGxvdXRfcmVzZXRfYnRfb24o KSBpcyBjYWxsZWQuCgpPaywgZm9yIHRoZSBtb21lbnQganVzdCBzdGljayB3aXRoIHRoZSBzbGVl cHEgY2hhbmdlLgpBYm91dCB0aGUgY2FsbG91dCBLUEkgd2Ugd2lsbCBzZWUgbGF0ZXIgb24gb25j ZSB5b3UgaGF2ZSBhIGNvbW1pdCBjYW5kaWRhdGUuCgpBdHRpbGlvCgoKLS0gClBlYWNlIGNhbiBv bmx5IGJlIGFjaGlldmVkIGJ5IHVuZGVyc3RhbmRpbmcgLSBBLiBFaW5zdGVpbgo= From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 16:12:59 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49248106566C; Fri, 8 Jun 2012 16:12:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3297C8FC1D; Fri, 8 Jun 2012 16:12:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q58GCxKt069684; Fri, 8 Jun 2012 16:12:59 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58GCwPN069674; Fri, 8 Jun 2012 16:12:58 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206081612.q58GCwPN069674@svn.freebsd.org> From: Rick Macklem Date: Fri, 8 Jun 2012 16:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236757 - in projects/nfsv4.1-client/sys/fs: nfs nfsclient X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 16:12:59 -0000 Author: rmacklem Date: Fri Jun 8 16:12:58 2012 New Revision: 236757 URL: http://svn.freebsd.org/changeset/base/236757 Log: Assored fixes found at the Ann Arbor NFSv4.1 Bakeathon testing event. - Handle LayoutCommit not supported - Handle 0 length server owner names in EXCHANGEID replies - Fix LayoutGet so that it doesn't ask for too large a layout - Fix LayoutGet so that it accepts RW layouts when a Read layout was requested - Add some code for doing Commit through the DS (not yet enabled) - Assorted fixes for DS sessions - Fix CreateSession so that it uses the correct ClientID for DS sessions - Add Renew support for DS sessions - Configure a backchannel on DS sessions Plus a few fixes that were simply typos/wrong arguments to functions. Modified: projects/nfsv4.1-client/sys/fs/nfs/nfs_commonkrpc.c projects/nfsv4.1-client/sys/fs/nfs/nfs_commonsubs.c projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h projects/nfsv4.1-client/sys/fs/nfs/nfsclstate.h projects/nfsv4.1-client/sys/fs/nfs/nfsport.h projects/nfsv4.1-client/sys/fs/nfs/nfsproto.h projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clcomsubs.c projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Modified: projects/nfsv4.1-client/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfs_commonkrpc.c Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfs/nfs_commonkrpc.c Fri Jun 8 16:12:58 2012 (r236757) @@ -837,39 +837,13 @@ if (nmp != NULL && i == NFSV4OP_SEQUENCE if (retseq != sep->nfsess_slotseq[slot]) printf("retseq diff 0x%x\n", retseq); retval = fxdr_unsigned(uint32_t, *++tl); -#ifdef notyet if ((retval + 1) < sep->nfsess_foreslots) sep->nfsess_foreslots = (retval + 1); else if ((retval + 1) > sep->nfsess_foreslots) sep->nfsess_foreslots = (retval < 64) ? (retval + 1) : 64; -#else - /* - * There seems to be some confusion with - * respect to whether this value is the - * largest slot number to be used, numbered - * 0<->N-1 or the size of the slot table. - * In other words, is it N or N-1? - * For now, play it safe and assume the - * worst cases of the above, such that - * nfsess_foreslots might be one less than the - * server specified. This is safe, whereas - * setting nfsess_foreslots one greater than - * the server intended could cause grief. - */ - if (retval < sep->nfsess_foreslots) -{ -printf("foreslots shrinking %d\n", retval); - sep->nfsess_foreslots = retval; -} - else if (retval > sep->nfsess_foreslots) -{ -printf("foreslots growing %d\n", retval); - sep->nfsess_foreslots = (retval < 64) ? - retval : 64; -} -#endif /* notyet */ mtx_unlock(&sep->nfsess_mtx); +{ static int yyuuii = 0; int yuiop; yuiop = fxdr_unsigned(int, *++tl); if (yuiop != yyuuii) { yyuuii = yuiop; printf("seqfl=0x%x\n", yuiop); } } /* Grab the op and status for the next one. */ if (opcnt > 1) { Modified: projects/nfsv4.1-client/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfs_commonsubs.c Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfs/nfs_commonsubs.c Fri Jun 8 16:12:58 2012 (r236757) @@ -168,7 +168,7 @@ static struct nfsuserlruhead nfsuserlruh */ int nfs_bigreply[NFSV41_NPROCS] = { 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }; /* local functions */ static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep); Modified: projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h Fri Jun 8 16:12:58 2012 (r236757) @@ -426,7 +426,7 @@ int nfsrpc_fsinfo(vnode_t, struct nfsfsi NFSPROC_T *, struct nfsvattr *, int *, void *); int nfsrpc_pathconf(vnode_t, struct nfsv3_pathconf *, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, void *); -int nfsrpc_renew(struct nfsclclient *, struct ucred *, +int nfsrpc_renew(struct nfsclclient *, struct nfsclds *, struct ucred *, NFSPROC_T *); int nfsrpc_rellockown(struct nfsmount *, struct nfscllockowner *, uint8_t *, int, struct ucred *, NFSPROC_T *); @@ -440,13 +440,13 @@ int nfsrpc_exchangeid(struct nfsmount *, struct nfssockreq *, uint32_t, struct nfsclds **, struct ucred *, NFSPROC_T *); int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *, - uint32_t, int, struct ucred *, NFSPROC_T *); + struct nfssockreq *, uint32_t, int, struct ucred *, NFSPROC_T *); int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *, struct ucred *, NFSPROC_T *); int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *, struct ucred *, NFSPROC_T *); int nfsrpc_layoutget(struct nfsmount *, uint8_t *, int, int, uint64_t, uint64_t, - uint64_t, nfsv4stateid_t *, int *, struct nfsclflayouthead *, + uint64_t, int, nfsv4stateid_t *, int *, struct nfsclflayouthead *, struct ucred *, NFSPROC_T *, void *); int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *, struct nfscldevinfo **, struct ucred *, NFSPROC_T *); Modified: projects/nfsv4.1-client/sys/fs/nfs/nfsclstate.h ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfsclstate.h Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfs/nfsclstate.h Fri Jun 8 16:12:58 2012 (r236757) @@ -60,6 +60,7 @@ struct nfsclsession { uint32_t nfsess_slotseq[64]; /* Max for 64bit nm_slots */ uint64_t nfsess_slots; uint32_t nfsess_sequenceid; + uint32_t nfsess_maxcache; /* Max size for cached reply. */ uint16_t nfsess_foreslots; uint16_t nfsess_backslots; uint8_t nfsess_sessionid[NFSX_V4SESSIONID]; @@ -75,6 +76,7 @@ struct nfsclds { struct nfsclsession nfsclds_sess; struct mtx nfsclds_mtx; struct nfssockreq *nfsclds_sockp; + time_t nfsclds_expire; uint16_t nfsclds_flags; uint16_t nfsclds_servownlen; uint8_t nfsclds_verf[NFSX_VERF]; Modified: projects/nfsv4.1-client/sys/fs/nfs/nfsport.h ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfsport.h Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfs/nfsport.h Fri Jun 8 16:12:58 2012 (r236757) @@ -349,11 +349,12 @@ #define NFSPROC_RECLAIMCOMPL 50 #define NFSPROC_WRITEDS 51 #define NFSPROC_READDS 52 +#define NFSPROC_COMMITDS 53 /* * Must be defined as one higher than the last NFSv4.1 Proc# above. */ -#define NFSV41_NPROCS 53 +#define NFSV41_NPROCS 54 #endif /* NFS_V3NPROCS */ @@ -835,6 +836,7 @@ void newnfs_realign(struct mbuf **); */ #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier */ #define NFSSTA_GOTFSINFO 0x00100000 /* Got the fsinfo */ +#define NFSSTA_NOLAYOUTCOMMIT 0x04000000 /* Don't do LayoutCommit */ #define NFSSTA_SESSPERSIST 0x08000000 /* Has a persistent session */ #define NFSSTA_TIMEO 0x10000000 /* Experiencing a timeout */ #define NFSSTA_LOCKTIMEO 0x20000000 /* Experiencing a lockd timeout */ @@ -861,6 +863,7 @@ void newnfs_realign(struct mbuf **); #define NFSSETWRITEVERF(n) ((n)->nm_state |= NFSSTA_HASWRITEVERF) #define NFSSETHASSETFSID(n) ((n)->nm_state |= NFSSTA_HASSETFSID) #define NFSHASPNFSOPT(n) ((n)->nm_flag & NFSMNT_PNFS) +#define NFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT) #define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST) #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS) Modified: projects/nfsv4.1-client/sys/fs/nfs/nfsproto.h ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfsproto.h Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfs/nfsproto.h Fri Jun 8 16:12:58 2012 (r236757) @@ -316,11 +316,12 @@ #define NFSPROC_RECLAIMCOMPL 50 #define NFSPROC_WRITEDS 51 #define NFSPROC_READDS 52 +#define NFSPROC_COMMITDS 53 /* * Must be defined as one higher than the last NFSv4.1 Proc# above. */ -#define NFSV41_NPROCS 53 +#define NFSV41_NPROCS 54 #endif /* NFS_V3NPROCS */ Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clcomsubs.c Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clcomsubs.c Fri Jun 8 16:12:58 2012 (r236757) @@ -111,6 +111,7 @@ static struct { { NFSV4OP_RECLAIMCOMPL, 1, "ReclaimComplete", 15, }, { NFSV4OP_WRITE, 1, "WriteDS", 7, }, { NFSV4OP_READ, 1, "ReadDS", 6, }, + { NFSV4OP_COMMIT, 1, "CommitDS", 8, }, }; /* @@ -119,7 +120,7 @@ static struct { static int nfs_bigrequest[NFSV41_NPROCS] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0 + 0, 0, 0, 0, 0, 0, 1, 0, 0 }; /* @@ -175,10 +176,12 @@ nfscl_reqstart(struct nfsrv_descript *nd * Sequence Op. */ opcnt = 1; - else if (procnum == NFSPROC_WRITEDS) + else if (procnum == NFSPROC_WRITEDS || + procnum == NFSPROC_COMMITDS) /* - * For the special case of a Write to a DS, - * the opcnt == 3, for Sequence, PutFH, Write. + * For the special case of a Writeor Commit to + * a DS, the opcnt == 3, for Sequence, PutFH, + * Write/Commit. */ opcnt = 3; } @@ -211,7 +214,8 @@ nfscl_reqstart(struct nfsrv_descript *nd *tl = txdr_unsigned(NFSV4OP_PUTFH); (void) nfsm_fhtom(nd, nfhp, fhlen, 0); if (nfsv4_opflag[nfsv4_opmap[procnum].op].needscfh - == 2 && procnum != NFSPROC_WRITEDS) { + == 2 && procnum != NFSPROC_WRITEDS && + procnum != NFSPROC_COMMITDS) { NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_GETATTR); NFSWCCATTR_ATTRBIT(&attrbits); Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Fri Jun 8 16:12:58 2012 (r236757) @@ -117,6 +117,10 @@ static int nfsrpc_writeds(vnode_t, struc struct nfsfh *, int, struct ucred *, NFSPROC_T *); static enum nfsclds_state nfscl_getsameserver(struct nfsmount *, struct nfsclds *, struct nfsclds **); +#ifdef notyet +static int nfsrpc_commitds(vnode_t, uint64_t, int, struct nfsclds *, + struct nfsfh *, struct ucred *, NFSPROC_T *, void *); +#endif /* * nfs null call from vfs. @@ -816,7 +820,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfsquad_t confirm; u_int32_t lease; static u_int32_t rev = 0; - struct nfsclds *dsp; + struct nfsclds *dsp, *ndsp, *tdsp; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); @@ -827,11 +831,14 @@ nfsrpc_setclient(struct nfsmount *nmp, s if (error) printf("exch=%d\n",error); if (error == 0) { error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, + &nmp->nm_sockreq, dsp->nfsclds_sess.nfsess_sequenceid, 1, cred, p); if (error == 0) { - KASSERT(TAILQ_FIRST(&nmp->nm_sess) == NULL, - ("nfscl session non-NULL")); NFSLOCKMNT(nmp); + TAILQ_FOREACH_SAFE(tdsp, &nmp->nm_sess, + nfsclds_list, ndsp) + nfscl_freenfsclds(tdsp); + TAILQ_INIT(&nmp->nm_sess); TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, nfsclds_list); NFSUNLOCKMNT(nmp); @@ -842,7 +849,8 @@ if (error) printf("aft crs=%d\n",error); if (error == 0 && reclaim == 0) { error = nfsrpc_reclaimcomplete(nmp, cred, p); if (error) printf("aft reclcom=%d\n",error); - if (error == NFSERR_COMPLETEALREADY) + if (error == NFSERR_COMPLETEALREADY || + error == NFSERR_NOTSUPP) /* Ignore this error. */ error = 0; } @@ -4159,27 +4167,34 @@ nfsmout: * This function performs the Renew RPC. */ APPLESTATIC int -nfsrpc_renew(struct nfsclclient *clp, struct ucred *cred, NFSPROC_T *p) +nfsrpc_renew(struct nfsclclient *clp, struct nfsclds *dsp, struct ucred *cred, + NFSPROC_T *p) { u_int32_t *tl; struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; struct nfsmount *nmp; int error; + struct nfssockreq *nrp; nmp = clp->nfsc_nmp; if (nmp == NULL) return (0); - nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL); + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, + &dsp->nfsclds_sess); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; } + nrp = dsp->nfsclds_sockp; + if (nrp == NULL) + /* If NULL, use the MDS socket. */ + nrp = &nmp->nm_sockreq; nd->nd_flag |= ND_USEGSSNAME; - error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, - NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); if (error) return (error); error = nd->nd_repstat; @@ -4441,20 +4456,24 @@ printf("exch err=%d reps=%d\n",error,nd- if (error != 0) return (error); if (nd->nd_repstat == 0) { +printf("x1\n"); NFSM_DISSECT(tl, uint32_t *, 6 * NFSX_UNSIGNED + NFSX_HYPER); len = fxdr_unsigned(int, *(tl + 7)); printf("servlen=%d\n", len); - if (len < 1 || len > NFSV4_OPAQUELIMIT) { + if (len < 0 || len > NFSV4_OPAQUELIMIT) { error = NFSERR_BADXDR; goto nfsmout; } dsp = malloc(sizeof(struct nfsclds) + len, M_NFSCLDS, M_WAITOK | M_ZERO); + dsp->nfsclds_expire = NFSD_MONOSEC + clp->nfsc_renew; dsp->nfsclds_servownlen = len; dsp->nfsclds_sess.nfsess_clientid.lval[0] = *tl++; dsp->nfsclds_sess.nfsess_clientid.lval[1] = *tl++; +printf("sess 0x%x 0x%x\n",dsp->nfsclds_sess.nfsess_clientid.lval[0],dsp->nfsclds_sess.nfsess_clientid.lval[1]); dsp->nfsclds_sess.nfsess_sequenceid = fxdr_unsigned(uint32_t, *tl++); +printf("sess seq=%d\n",dsp->nfsclds_sess.nfsess_sequenceid); v41flags = fxdr_unsigned(uint32_t, *tl); printf("v41fl=0x%x nmfl=0x%x\n", v41flags, nmp->nm_flag); if ((v41flags & NFSV4EXCH_USEPNFSMDS) != 0 && @@ -4467,7 +4486,10 @@ printf("set PNFS\n"); } if ((v41flags & NFSV4EXCH_USEPNFSDS) != 0) dsp->nfsclds_flags |= NFSCLDS_DS; - nd->nd_repstat = nfsrv_mtostr(nd, dsp->nfsclds_serverown, len); + if (len > 0) + nd->nd_repstat = nfsrv_mtostr(nd, + dsp->nfsclds_serverown, len); +{ int xxxx; for (xxxx=0; xxxx < len; xxxx++) printf("0x%x ", dsp->nfsclds_serverown[xxxx]); printf("\n"); } if (nd->nd_repstat == 0) { mtx_init(&dsp->nfsclds_mtx, "nfsds", NULL, MTX_DEF); mtx_init(&dsp->nfsclds_sess.nfsess_mtx, "nfssession", @@ -4488,7 +4510,8 @@ nfsmout: */ int nfsrpc_createsession(struct nfsmount *nmp, struct nfsclsession *sep, - uint32_t sequenceid, int mds, struct ucred *cred, NFSPROC_T *p) + struct nfssockreq *nrp, uint32_t sequenceid, int mds, struct ucred *cred, + NFSPROC_T *p) { uint32_t crflags, *tl; struct nfsrv_descript nfsd; @@ -4499,10 +4522,11 @@ nfsrpc_createsession(struct nfsmount *nm NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED); *tl++ = sep->nfsess_clientid.lval[0]; *tl++ = sep->nfsess_clientid.lval[1]; +printf("crs clid 0x%x 0x%x\n",sep->nfsess_clientid.lval[0],sep->nfsess_clientid.lval[1]); *tl++ = txdr_unsigned(sequenceid); printf("clseq0=0x%x\n",sequenceid); crflags = (NFSMNT_RDONLY(nmp->nm_mountp) ? 0 : NFSV4CRSESS_PERSIST); - if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0 && mds != 0) + if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0) crflags |= NFSV4CRSESS_CONNBACKCHAN; *tl = txdr_unsigned(crflags); @@ -4538,8 +4562,8 @@ printf("clseq0=0x%x\n",sequenceid); *tl++ = 0; /* Gid == 0 */ *tl = 0; /* No additional gids */ nd->nd_flag |= ND_USEGSSNAME; - error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, - NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, NFS_PROG, + NFS_VER4, NULL, 1, NULL, NULL); if (error != 0) return (error); if (nd->nd_repstat == 0) { @@ -4560,7 +4584,9 @@ printf("crfl=0x%x\n",crflags); /* Get the fore channel slot count. */ NFSM_DISSECT(tl, uint32_t *, 7 * NFSX_UNSIGNED); printf("cr %d %d %d %d %d\n",fxdr_unsigned(uint32_t, *tl),fxdr_unsigned(uint32_t, *(tl+1)),fxdr_unsigned(uint32_t, *(tl+2)),fxdr_unsigned(uint32_t, *(tl+3)),fxdr_unsigned(uint32_t, *(tl+4))); - tl += 5; /* Skip the other counts. */ + tl += 3; /* Skip the other counts. */ + sep->nfsess_maxcache = fxdr_unsigned(int, *tl++); + tl++; sep->nfsess_foreslots = fxdr_unsigned(uint16_t, *tl++); printf("fore slots=%d\n", sep->nfsess_foreslots); irdcnt = fxdr_unsigned(int, *tl); @@ -4637,19 +4663,20 @@ nfsrpc_destroyclient(struct nfsmount *nm */ int nfsrpc_layoutget(struct nfsmount *nmp, uint8_t *fhp, int fhlen, int iomode, - uint64_t offset, uint64_t len, uint64_t minlen, nfsv4stateid_t *stateidp, - int *retonclosep, struct nfsclflayouthead *flhp, struct ucred *cred, - NFSPROC_T *p, void *stuff) + uint64_t offset, uint64_t len, uint64_t minlen, int layoutlen, + nfsv4stateid_t *stateidp, int *retonclosep, struct nfsclflayouthead *flhp, + struct ucred *cred, NFSPROC_T *p, void *stuff) { uint32_t *tl; struct nfsrv_descript nfsd, *nd = &nfsd; struct nfsfh *nfhp; struct nfsclflayout *flp, *prevflp, *tflp; - int cnt, error, fhcnt, nfhlen, i, j; + int cnt, error, gotiomode, fhcnt, nfhlen, i, j; uint8_t *cp; uint64_t retlen; flp = NULL; + gotiomode = -1; nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED + 3 * NFSX_HYPER + NFSX_STATEID); @@ -4667,7 +4694,7 @@ printf("layget seq=%d\n", stateidp->seqi *tl++ = stateidp->other[0]; *tl++ = stateidp->other[1]; *tl++ = stateidp->other[2]; - *tl = txdr_unsigned(100000); /* take a large layout list */ + *tl = txdr_unsigned(layoutlen); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -4712,6 +4739,7 @@ printf("fhcnt=%d\n", fhcnt); M_NFSFLAYOUT, M_WAITOK); flp->nfsfl_flags = 0; flp->nfsfl_fhcnt = 0; + flp->nfsfl_devp = NULL; flp->nfsfl_off = fxdr_hyper(tl); tl += 2; retlen = fxdr_hyper(tl); tl += 2; if (flp->nfsfl_off + retlen < flp->nfsfl_off) @@ -4719,7 +4747,9 @@ printf("fhcnt=%d\n", fhcnt); else flp->nfsfl_end = flp->nfsfl_off + retlen; flp->nfsfl_iomode = fxdr_unsigned(int, *tl++); -printf("layg iom=%d\n", iomode); + if (gotiomode == -1) + gotiomode = flp->nfsfl_iomode; +printf("layg reqiom=%d retiom=%d\n", iomode, flp->nfsfl_iomode); if (fxdr_unsigned(int, *tl++) != NFSLAYOUT_NFSV4_1_FILES) { printf("NFSv4.1: got non-files layout\n"); @@ -4751,7 +4781,7 @@ printf("layg iom=%d\n", iomode); NFSM_DISSECT(cp, uint8_t *, NFSM_RNDUP(nfhlen)); NFSBCOPY(cp, nfhp->nfh_fh, nfhlen); } - if (flp->nfsfl_iomode == iomode) { + if (flp->nfsfl_iomode == gotiomode) { /* Keep the list in increasing offset order. */ tflp = LIST_FIRST(flhp); prevflp = NULL; @@ -5082,7 +5112,8 @@ nfsrpc_getlayout(struct nfsmount *nmp, v struct nfsclflayout *flp; struct nfscldevinfo *dip; struct nfsclflayouthead flh; - int error = 0, recalled, retonclose; + int error = 0, layoutlen, recalled, retonclose; + nfsv4stateid_t stateid; *lypp = NULL; lyp = nfscl_getlayout(nmp->nm_clp, nfhp->nfh_fh, nfhp->nfh_len, @@ -5091,9 +5122,16 @@ nfsrpc_getlayout(struct nfsmount *nmp, v if (recalled != 0) return (EIO); LIST_INIT(&flh); + layoutlen = NFSMNT_MDSSESSION(nmp)->nfsess_maxcache - + (NFSX_STATEID + 3 * NFSX_UNSIGNED); +printf("layoutlen=%d\n", layoutlen); + stateid.seqid = 0; + stateid.other[0] = stateidp->other[0]; + stateid.other[1] = stateidp->other[1]; + stateid.other[2] = stateidp->other[2]; error = nfsrpc_layoutget(nmp, nfhp->nfh_fh, nfhp->nfh_len, - iomode, (uint64_t)0, INT64_MAX, (uint64_t)0, - stateidp, &retonclose, &flh, cred, p, NULL); + iomode, (uint64_t)0, INT64_MAX, (uint64_t)0, layoutlen, + &stateid, &retonclose, &flh, cred, p, NULL); if (error == 0) LIST_FOREACH(flp, &flh, nfsfl_list) { error = nfscl_adddevinfo(nmp, NULL, flp); @@ -5112,7 +5150,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, v } if (error == 0) error = nfscl_layout(nmp, vp, nfhp->nfh_fh, - nfhp->nfh_len, stateidp, retonclose, &flh, &lyp, + nfhp->nfh_len, &stateid, retonclose, &flh, &lyp, cred, p); } if (lyp != NULL) { @@ -5138,7 +5176,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru struct nfsclclient *clp; struct nfssockreq *nrp; struct nfsclds *dsp, *tdsp; - int error, same_as_mds; + int error; enum nfsclds_state retv; uint32_t sequenceid; @@ -5149,52 +5187,90 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru NFSUNLOCKCLSTATE(); if (clp == NULL) return (EPERM); - same_as_mds = 0; - nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); if (ssp->ss_family == AF_INET) { ssd = (struct sockaddr_in *)ssp; +printf("ds addr=0x%x ", ssd->sin_addr.s_addr); + NFSLOCKMNT(nmp); + + /* + * Check to see if we already have a session for this + * address that is usable for a DS. + * Note that the MDS's address is in a different place + * than the sessions already acquired for DS's. + */ + msad = (struct sockaddr_in *)nmp->nm_sockreq.nr_nam; +if (msad != NULL) printf("maddr=0x%x", msad->sin_addr.s_addr); +printf("\n"); + tdsp = TAILQ_FIRST(&nmp->nm_sess); + while (tdsp != NULL) { + if (msad != NULL && msad->sin_family == AF_INET && + ssd->sin_addr.s_addr == msad->sin_addr.s_addr && + ssd->sin_port == msad->sin_port && + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + *dspp = tdsp; + NFSUNLOCKMNT(nmp); +printf("fnd same addr\n"); + return (0); + } + tdsp = TAILQ_NEXT(tdsp, nfsclds_list); + if (tdsp != NULL && tdsp->nfsclds_sockp != NULL) + msad = (struct sockaddr_in *) + tdsp->nfsclds_sockp->nr_nam; + else + msad = NULL; + } + NFSUNLOCKMNT(nmp); + + /* No IP address match, so look for new/trunked one. */ sad = malloc(sizeof(*sad), M_SONAME, M_WAITOK | M_ZERO); sad->sin_len = sizeof(*sad); sad->sin_family = AF_INET; sad->sin_port = ssd->sin_port; sad->sin_addr.s_addr = ssd->sin_addr.s_addr; + nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); nrp->nr_nam = (struct sockaddr *)sad; - /* Now check to see if this address is the same as the MDS. */ - msad = (struct sockaddr_in *)nmp->nm_sockreq.nr_nam; - if (msad != NULL && msad->sin_family == AF_INET && - sad->sin_addr.s_addr == msad->sin_addr.s_addr && - sad->sin_port == msad->sin_port) - same_as_mds = 1; } else if (ssp->ss_family == AF_INET6) { ssd6 = (struct sockaddr_in6 *)ssp; + NFSLOCKMNT(nmp); + + /* + * Check to see if we already have a session for this + * address that is usable for a DS. + * Note that the MDS's address is in a different place + * than the sessions already acquired for DS's. + */ + msad6 = (struct sockaddr_in6 *)nmp->nm_sockreq.nr_nam; + tdsp = TAILQ_FIRST(&nmp->nm_sess); + while (tdsp != NULL) { + if (msad6 != NULL && msad6->sin6_family == AF_INET6 && + IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr, + &msad6->sin6_addr) && + ssd6->sin6_port == msad6->sin6_port && + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + *dspp = tdsp; + NFSUNLOCKMNT(nmp); + return (0); + } + tdsp = TAILQ_NEXT(tdsp, nfsclds_list); + if (tdsp != NULL && tdsp->nfsclds_sockp != NULL) + msad6 = (struct sockaddr_in6 *) + tdsp->nfsclds_sockp->nr_nam; + else + msad6 = NULL; + } + NFSUNLOCKMNT(nmp); + + /* No IP address match, so look for new/trunked one. */ sad6 = malloc(sizeof(*sad6), M_SONAME, M_WAITOK | M_ZERO); sad6->sin6_len = sizeof(*sad6); sad6->sin6_family = AF_INET6; sad6->sin6_port = ssd6->sin6_port; NFSBCOPY(&ssd6->sin6_addr, &sad6->sin6_addr, sizeof(struct in6_addr)); + nrp = malloc(sizeof(*nrp), M_NFSSOCKREQ, M_WAITOK | M_ZERO); nrp->nr_nam = (struct sockaddr *)sad6; - /* Now check to see if this address is the same as the MDS. */ - msad6 = (struct sockaddr_in6 *)nmp->nm_sockreq.nr_nam; - if (msad6 != NULL && msad6->sin6_family == AF_INET6 && - IN6_ARE_ADDR_EQUAL(&sad6->sin6_addr, &msad6->sin6_addr) && - sad6->sin6_port == msad6->sin6_port) - same_as_mds = 1; - } else { - free(nrp, M_NFSSOCKREQ); + } else return (EPERM); - } - - /* - * If same address as the MDS and the MDS is a DS, use the MDS session. - */ - if (same_as_mds != 0 && - (TAILQ_FIRST(&nmp->nm_sess)->nfsclds_flags & NFSCLDS_DS) != 0) { - free(nrp->nr_nam, M_SONAME); - free(nrp, M_NFSSOCKREQ); - *dspp = TAILQ_FIRST(&nmp->nm_sess); - return (0); - } nrp->nr_sotype = SOCK_STREAM; mtx_init(&nrp->nr_mtx, "nfssock", NULL, MTX_DEF); @@ -5210,15 +5286,18 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru */ nrp->nr_cred = crhold(nmp->nm_sockreq.nr_cred); error = newnfs_connect(nmp, nrp, NULL, p, 0); +printf("ds conn=%d\n", error); /* Now, do the exchangeid and create session. */ if (error == 0) error = nfsrpc_exchangeid(nmp, clp, nrp, NFSV4EXCH_USEPNFSDS, &dsp, nrp->nr_cred, p); +printf("ds exch=%d\n", error); if (error == 0) { dsp->nfsclds_sockp = nrp; NFSLOCKMNT(nmp); retv = nfscl_getsameserver(nmp, dsp, &tdsp); +printf("getsame ret=%d\n", retv); if (retv == NFSDSP_USETHISSESSION) { NFSUNLOCKMNT(nmp); /* @@ -5230,14 +5309,14 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru *dspp = tdsp; return (0); } - if (retv == NFSDSP_SEQTHISSESSION) { - tdsp->nfsclds_sess.nfsess_sequenceid++; + if (retv == NFSDSP_SEQTHISSESSION) sequenceid = tdsp->nfsclds_sess.nfsess_sequenceid; - } else + else sequenceid = dsp->nfsclds_sess.nfsess_sequenceid; NFSUNLOCKMNT(nmp); error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, - sequenceid, 0, nrp->nr_cred, p); + nrp, sequenceid, 0, nrp->nr_cred, p); +printf("dscrsess=%d\n", error); } else { NFSFREECRED(nrp->nr_cred); NFSFREEMUTEX(&nrp->nr_mtx); @@ -5245,6 +5324,7 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru free(nrp, M_NFSSOCKREQ); } if (error == 0) { +printf("add dssess\n"); /* * Put it at the end of the list. That way the list * is ordered by when the entry was added. This matters @@ -5342,7 +5422,6 @@ if (error == 2) printf("rwacc=0x%x\n", r np->n_fhp->nfh_len, &recalled); if (layp == NULL) { /* Try and get a Layout, if it is supported. */ - stateid.seqid = 0; if (rwaccess == NFSV4OPEN_ACCESSWRITE || (np->n_flag & NWRITEOPENED) != 0) iolaymode = NFSLAYOUTIOMODE_RW; @@ -5710,8 +5789,9 @@ nfscl_getsameserver(struct nfsmount *nmp cur_dsp = NULL; TAILQ_FOREACH(dsp, &nmp->nm_sess, nfsclds_list) { if (dsp->nfsclds_servownlen == newdsp->nfsclds_servownlen && + dsp->nfsclds_servownlen != 0 && !NFSBCMP(dsp->nfsclds_serverown, newdsp->nfsclds_serverown, - dsp->nfsclds_servownlen)) { + dsp->nfsclds_servownlen)) { printf("fnd same fdsp=%p dsp=%p flg=0x%x\n", TAILQ_FIRST(&nmp->nm_sess), dsp, dsp->nfsclds_flags); /* Server major id matches. */ if ((dsp->nfsclds_flags & NFSCLDS_DS) != 0) { @@ -5734,3 +5814,48 @@ printf("fnd same fdsp=%p dsp=%p flg=0x%x return (NFSDSP_NOTFOUND); } +#ifdef notyet +/* + * NFS commit rpc to a DS. + */ +static int +nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, + struct nfsfh *fhp, struct ucred *cred, NFSPROC_T *p, void *stuff) +{ + uint32_t *tl; + struct nfsrv_descript nfsd, *nd = &nfsd; + struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); + struct nfssockreq *nrp; + int error; + + nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, + NULL, &dsp->nfsclds_sess); + NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); + txdr_hyper(offset, tl); + tl += 2; + *tl = txdr_unsigned(cnt); + nrp = dsp->nfsclds_sockp; + if (nrp == NULL) + /* If NULL, use the MDS socket. */ + nrp = &nmp->nm_sockreq; + error = newnfs_request(nd, nmp, NULL, nrp, vp, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); + if (error) + return (error); + if (nd->nd_repstat == 0) { + NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF); + NFSLOCKDS(dsp); + if (NFSBCMP(tl, dsp->nfsclds_verf, NFSX_VERF)) { + NFSBCOPY(tl, dsp->nfsclds_verf, NFSX_VERF); + error = NFSERR_STALEWRITEVERF; + } + NFSUNLOCKDS(dsp); + } +nfsmout: + if (error == 0 && nd->nd_repstat != 0) + error = nd->nd_repstat; + mbuf_freem(nd->nd_mrep); + return (error); +} +#endif + Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Fri Jun 8 13:27:30 2012 (r236756) +++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Fri Jun 8 16:12:58 2012 (r236757) @@ -1887,7 +1887,8 @@ nfscl_recover(struct nfsclclient *clp, s struct nfsreq *rep; u_int64_t len; u_int32_t delegtype = NFSV4OPEN_DELEGATEWRITE, mode; - int igotlock = 0, error, trycnt, firstlock, s; + int i, igotlock = 0, error, trycnt, firstlock, s; + struct nfscllayout *lyp, *nlyp; /* * First, lock the client structure, so everyone else will @@ -1904,6 +1905,17 @@ nfscl_recover(struct nfsclclient *clp, s nmp = clp->nfsc_nmp; if (nmp == NULL) panic("nfscl recover"); + + /* + * For now, just get rid of all layouts. There may be a need + * to do LayoutCommit Ops with reclaim == true later. + */ + TAILQ_FOREACH_SAFE(lyp, &clp->nfsc_layout, nfsly_list, nlyp) + nfscl_freelayout(lyp); + TAILQ_INIT(&clp->nfsc_layout); + for (i = 0; i < NFSCLLAYOUTHASHSIZE; i++) + LIST_INIT(&clp->nfsc_layouthash[i]); + trycnt = 5; do { error = nfsrpc_setclient(nmp, clp, 1, cred, p); @@ -2443,6 +2455,7 @@ nfscl_renewthread(struct nfsclclient *cl struct nfscldevinfo *dip, *ndip; struct nfscllayouthead rlh; struct nfsclrecalllayout *recallp; + struct nfsclds *dsp; cred = newnfs_getcred(); NFSLOCKCLSTATE(); @@ -2470,7 +2483,8 @@ nfscl_renewthread(struct nfsclclient *cl (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; clidrev = clp->nfsc_clientidrev; - error = nfsrpc_renew(clp, cred, p); + error = nfsrpc_renew(clp, + TAILQ_FIRST(&clp->nfsc_nmp->nm_sess), cred, p); if (error == NFSERR_CBPATHDOWN) cbpathdown = 1; else if (error == NFSERR_STALECLIENTID || @@ -2482,6 +2496,25 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } + /* Do renews for any DS sessions. */ +checkdsrenew: + NFSLOCKMNT(clp->nfsc_nmp); + /* Skip first entry, since the MDS is handled above. */ + dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); + if (dsp != NULL) + dsp = TAILQ_NEXT(dsp, nfsclds_list); + while (dsp != NULL) { + if (dsp->nfsclds_expire <= NFSD_MONOSEC) { + dsp->nfsclds_expire = NFSD_MONOSEC + + clp->nfsc_renew; + NFSUNLOCKMNT(clp->nfsc_nmp); + (void)nfsrpc_renew(clp, dsp, cred, p); + goto checkdsrenew; + } + dsp = TAILQ_NEXT(dsp, nfsclds_list); + } + NFSUNLOCKMNT(clp->nfsc_nmp); + TAILQ_INIT(&dh); NFSLOCKCLSTATE(); if (cbpathdown) @@ -2609,24 +2642,27 @@ printf("layrec io=%d\n", lyp->nfsly_refc } /* Handle any layout commits. */ - LIST_FOREACH(flp, &lyp->nfsly_flayrw, - nfsfl_list) { - if ((flp->nfsfl_flags & NFSFL_WRITTEN) - != 0) { - lyp->nfsly_refcnt++; - flp->nfsfl_flags &= - ~NFSFL_WRITTEN; - NFSUNLOCKCLSTATE(); + if (!NFSHASNOLAYOUTCOMMIT(clp->nfsc_nmp)) { + LIST_FOREACH(flp, &lyp->nfsly_flayrw, + nfsfl_list) { + if ((flp->nfsfl_flags & + NFSFL_WRITTEN) != 0) { + lyp->nfsly_refcnt++; + flp->nfsfl_flags &= + ~NFSFL_WRITTEN; + NFSUNLOCKCLSTATE(); printf("do layoutcommit\n"); - nfscl_dolayoutcommit( - clp->nfsc_nmp, lyp, flp, - cred, p); - NFSLOCKCLSTATE(); - lyp->nfsly_refcnt--; - if (lyp->nfsly_refcnt == 0) - wakeup( - &lyp->nfsly_refcnt); - goto tryagain2; + nfscl_dolayoutcommit( + clp->nfsc_nmp, lyp, + flp, cred, p); + NFSLOCKCLSTATE(); + lyp->nfsly_refcnt--; + if (lyp->nfsly_refcnt == + 0) + wakeup(&lyp-> + nfsly_refcnt); + goto tryagain2; + } } } @@ -5061,8 +5097,8 @@ static void nfscl_dolayoutcommit(struct nfsmount *nmp, struct nfscllayout *lyp, struct nfsclflayout *flp, struct ucred *cred, NFSPROC_T *p) { - int error; uint64_t len; + int error; if (flp->nfsfl_end == UINT64_MAX) len = UINT64_MAX; @@ -5071,6 +5107,12 @@ nfscl_dolayoutcommit(struct nfsmount *nm error = nfsrpc_layoutcommit(nmp, lyp->nfsly_fh, lyp->nfsly_fhlen, 0, flp->nfsfl_off, len, lyp->nfsly_lastbyte, &lyp->nfsly_stateid, NFSLAYOUT_NFSV4_1_FILES, 0, NULL, cred, p, NULL); + if (error == NFSERR_NOTSUPP) { + /* If the server doesn't want it, don't bother doing it. */ + NFSLOCKMNT(nmp); + nmp->nm_state |= NFSSTA_NOLAYOUTCOMMIT; + NFSUNLOCKMNT(nmp); + } } /* @@ -5083,9 +5125,12 @@ nfscl_layoutcommit(vnode_t vp, NFSPROC_T struct nfscllayout *lyp; struct nfsclflayout *flp; struct nfsnode *np = VTONFS(vp); + struct nfsmount *nmp = VFSTONFS(vnode_mount(vp)); + if (NFSHASNOLAYOUTCOMMIT(nmp)) + return (0); NFSLOCKCLSTATE(); - clp = VFSTONFS(vnode_mount(vp))->nm_clp; + clp = nmp->nm_clp; if (clp == NULL) { NFSUNLOCKCLSTATE(); return (EPERM); From owner-svn-src-projects@FreeBSD.ORG Fri Jun 8 16:16:04 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DE78106567B; Fri, 8 Jun 2012 16:16:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 793E38FC1A; Fri, 8 Jun 2012 16:16:04 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q58GG42X069858; Fri, 8 Jun 2012 16:16:04 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q58GG4Pv069856; Fri, 8 Jun 2012 16:16:04 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201206081616.q58GG4Pv069856@svn.freebsd.org> From: Rick Macklem Date: Fri, 8 Jun 2012 16:16:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236758 - projects/nfsv4.1-client/sys/fs/nfsclient X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jun 2012 16:16:04 -0000 Author: rmacklem Date: Fri Jun 8 16:16:03 2012 New Revision: 236758 URL: http://svn.freebsd.org/changeset/base/236758 Log: Fix the NFSv4.1 client so that it returns ENOENT instead of EIO for the case where a server replies NFSERR_BADNAME or NFSERR_BADCHAR. This works better for servers that reply NFSERR_BADNAME/NFSERR_BADCHAR for "*.sh" when there is nothing for the shell to expand. Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clport.c Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clport.c Fri Jun 8 16:12:58 2012 (r236757) +++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clport.c Fri Jun 8 16:16:03 2012 (r236758) @@ -1118,6 +1118,10 @@ nfscl_maperr(struct thread *td, int erro "No name and/or group mapping for uid,gid:(%d,%d)\n", uid, gid); return (EPERM); + case NFSERR_BADNAME: + case NFSERR_BADCHAR: + printf("nfsv4 char/name not handled by server\n"); + return (ENOENT); case NFSERR_STALECLIENTID: case NFSERR_STALESTATEID: case NFSERR_EXPIRED: @@ -1138,8 +1142,6 @@ nfscl_maperr(struct thread *td, int erro case NFSERR_LEASEMOVED: case NFSERR_RECLAIMBAD: case NFSERR_BADXDR: - case NFSERR_BADCHAR: - case NFSERR_BADNAME: case NFSERR_OPILLEGAL: printf("nfsv4 client/server protocol prob err=%d\n", error); From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 12:58:00 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1EBB1065670; Sat, 9 Jun 2012 12:58:00 +0000 (UTC) (envelope-from cherry@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DCCF98FC15; Sat, 9 Jun 2012 12:58:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q59Cw0LE033872; Sat, 9 Jun 2012 12:58:00 GMT (envelope-from cherry@svn.freebsd.org) Received: (from cherry@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59Cw0Kb033870; Sat, 9 Jun 2012 12:58:00 GMT (envelope-from cherry@svn.freebsd.org) Message-Id: <201206091258.q59Cw0Kb033870@svn.freebsd.org> From: "Cherry G. Mathew" Date: Sat, 9 Jun 2012 12:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236813 - projects/amd64_xen_pv/sys/amd64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 12:58:01 -0000 Author: cherry Date: Sat Jun 9 12:58:00 2012 New Revision: 236813 URL: http://svn.freebsd.org/changeset/base/236813 Log: Xen's "pseudo-physical" "ram" space is a fragmented by virtue of its bootstrap sequence. vm requires this #define to stitching up the pieces into the kva while booting up. See: vm_page.c:vm_page_startup() Approved by: gibbs (implicit) Modified: projects/amd64_xen_pv/sys/amd64/include/vmparam.h Modified: projects/amd64_xen_pv/sys/amd64/include/vmparam.h ============================================================================== --- projects/amd64_xen_pv/sys/amd64/include/vmparam.h Sat Jun 9 12:27:30 2012 (r236812) +++ projects/amd64_xen_pv/sys/amd64/include/vmparam.h Sat Jun 9 12:58:00 2012 (r236813) @@ -79,7 +79,11 @@ /* * The physical address space is densely populated. */ +#ifndef XEN #define VM_PHYSSEG_DENSE +#else /* XEN */ +#define VM_PHYSSEG_SPARSE +#endif /* * The number of PHYSSEG entries must be one greater than the number From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 14:13:43 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 2E6B61065673; Sat, 9 Jun 2012 14:13:43 +0000 (UTC) (envelope-from davide@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0DE948FC0C; Sat, 9 Jun 2012 14:13:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q59EDgbd037055; Sat, 9 Jun 2012 14:13:42 GMT (envelope-from davide@svn.freebsd.org) Received: (from davide@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59EDgGt037051; Sat, 9 Jun 2012 14:13:42 GMT (envelope-from davide@svn.freebsd.org) Message-Id: <201206091413.q59EDgGt037051@svn.freebsd.org> From: Davide Italiano Date: Sat, 9 Jun 2012 14:13:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236815 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 14:13:43 -0000 Author: davide Date: Sat Jun 9 14:13:42 2012 New Revision: 236815 URL: http://svn.freebsd.org/changeset/base/236815 Log: Implement support for SWI-less callouts, so that we can run callout directly from hardware interrupt context rather than from SWI context. In this way, under some conditions, there's no need to wake up another CPU from sleep and perfor a context switch, avoiding a waste of time. Discussed with: mav Modified: projects/calloutng/sys/kern/kern_timeout.c projects/calloutng/sys/kern/subr_sleepqueue.c projects/calloutng/sys/sys/callout.h Modified: projects/calloutng/sys/kern/kern_timeout.c ============================================================================== --- projects/calloutng/sys/kern/kern_timeout.c Sat Jun 9 13:07:44 2012 (r236814) +++ projects/calloutng/sys/kern/kern_timeout.c Sat Jun 9 14:13:42 2012 (r236815) @@ -402,10 +402,18 @@ callout_tick(void) TAILQ_FOREACH(tmp, sc, c_links.tqe) { if ((!flag || flag == 1) && bintime_cmp(&tmp->c_time, &now, <=)) { - TAILQ_INSERT_TAIL(cc->cc_localexp,tmp,c_staiter); - TAILQ_REMOVE(sc, tmp, c_links.tqe); - tmp->c_flags |= CALLOUT_PROCESSED; - need_softclock = 1; + if (tmp->c_flags & CALLOUT_DIRECT) { + tmp->c_func(tmp->c_arg); + TAILQ_REMOVE(sc, tmp, c_links.tqe); + tmp->c_flags &= ~CALLOUT_PENDING; + } + else { + TAILQ_INSERT_TAIL(cc->cc_localexp, + tmp,c_staiter); + TAILQ_REMOVE(sc, tmp, c_links.tqe); + tmp->c_flags |= CALLOUT_PROCESSED; + need_softclock = 1; + } } if ((flag == 1 || flag == 2) && bintime_cmp(&tmp->c_time, &now, >)) { @@ -466,7 +474,7 @@ callout_lock(struct callout *c) static void callout_cc_add(struct callout *c, struct callout_cpu *cc, - struct bintime to_bintime, void (*func)(void *), void *arg, int cpu) + struct bintime to_bintime, void (*func)(void *), void *arg, int cpu, int direct) { int bucket; @@ -476,6 +484,8 @@ callout_cc_add(struct callout *c, struct } c->c_arg = arg; c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING); + if (direct) + c->c_flags |= CALLOUT_DIRECT; c->c_flags &= ~CALLOUT_PROCESSED; c->c_func = func; c->c_time = to_bintime; @@ -654,7 +664,7 @@ skip: */ new_cc = callout_cpu_switch(c, cc, new_cpu); callout_cc_add(c, new_cc, new_time, new_func, new_arg, - new_cpu); + new_cpu, 0); CC_UNLOCK(new_cc); CC_LOCK(cc); #else @@ -818,7 +828,7 @@ callout_handle_init(struct callout_handl */ int callout_reset_bt_on(struct callout *c, struct bintime bt, void (*ftn)(void *), - void *arg, int cpu) + void *arg, int cpu, int direct) { struct callout_cpu *cc; int cancelled = 0; @@ -892,7 +902,7 @@ callout_reset_bt_on(struct callout *c, s } #endif - callout_cc_add(c, cc, bt, ftn, arg, cpu); + callout_cc_add(c, cc, bt, ftn, arg, cpu, direct); CTR6(KTR_CALLOUT, "%sscheduled %p func %p arg %p in %ld %ld", cancelled ? "re" : "", c, c->c_func, c->c_arg, bt.sec, bt.frac); CC_UNLOCK(cc); @@ -910,7 +920,7 @@ callout_reset_on(struct callout *c, int getbinuptime(&now); bintime_mul(&bt,to_ticks); bintime_add(&bt,&now); - return (callout_reset_bt_on(c, bt, ftn, arg, cpu)); + return (callout_reset_bt_on(c, bt, ftn, arg, cpu, 0)); } /* Modified: projects/calloutng/sys/kern/subr_sleepqueue.c ============================================================================== --- projects/calloutng/sys/kern/subr_sleepqueue.c Sat Jun 9 13:07:44 2012 (r236814) +++ projects/calloutng/sys/kern/subr_sleepqueue.c Sat Jun 9 14:13:42 2012 (r236815) @@ -374,7 +374,7 @@ sleepq_set_timeout_bt(void *wchan, struc MPASS(TD_ON_SLEEPQ(td)); MPASS(td->td_sleepqueue == NULL); MPASS(wchan != NULL); - callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout, td, PCPU_GET(cpuid)); + callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout, td, PCPU_GET(cpuid), 0); } void Modified: projects/calloutng/sys/sys/callout.h ============================================================================== --- projects/calloutng/sys/sys/callout.h Sat Jun 9 13:07:44 2012 (r236814) +++ projects/calloutng/sys/sys/callout.h Sat Jun 9 14:13:42 2012 (r236815) @@ -48,6 +48,7 @@ #define CALLOUT_SHAREDLOCK 0x0020 /* callout lock held in shared mode */ #define CALLOUT_DFRMIGRATION 0x0040 /* callout in deferred migration mode */ #define CALLOUT_PROCESSED 0x0080 /* callout in wheel or processing list? */ +#define CALLOUT_DIRECT 0x1000 /* allow exec from hw int context */ struct callout_handle { struct callout *callout; @@ -69,7 +70,7 @@ void _callout_init_lock(struct callout * NULL, (flags)) #define callout_pending(c) ((c)->c_flags & CALLOUT_PENDING) int callout_reset_bt_on(struct callout *, struct bintime, void(*)(void *), - void *, int); + void *, int, int); int callout_reset_on(struct callout *, int, void (*)(void *), void *, int); #define callout_reset(c, on_tick, fn, arg) \ callout_reset_on((c), (on_tick), (fn), (arg), (c)->c_cpu) From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 15:49:21 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72C341065672; Sat, 9 Jun 2012 15:49:21 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 717618FC17; Sat, 9 Jun 2012 15:49:20 +0000 (UTC) Received: by wgbds11 with SMTP id ds11so1817866wgb.31 for ; Sat, 09 Jun 2012 08:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=k5YJaJ3IlPH2pcKgM8pdZpFy7+DbKyUw/JW5MeYC9S4=; b=QGW70oyi9HlODEbuGBKw4ugVENNmDOFxiS5a26Py0dnxjx6SBsnPZdxrpNjkuurLT4 W33CYYg8ZVnbl5/OByiQ7vIUTn3cvJUcQcXVbqMFsi6bZz8or0yYgWAPQS58bdekSyW7 /n5h/fXh5GX/HWB9qjoGVZB82ve+xsgCeP12PfhGUdmDcaFj1tRwRPtAZQHv016tQeOe +Vg7ygcLyfZ/OeaWhHQZOxNPrxPTte5OeGNOR3wtbjIRXo+JIK/j5xL5762sE7pvI/4Q vPrlJ5rRE8TvVYBgPrW25XI3GcAH4Xrt7s33H3wd016SrgZE78Ko6t0Ts8k1TG02zEPc Ap6g== Received: by 10.216.214.82 with SMTP id b60mr3372950wep.38.1339256959267; Sat, 09 Jun 2012 08:49:19 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id e20sm10032949wiv.7.2012.06.09.08.49.17 (version=SSLv3 cipher=OTHER); Sat, 09 Jun 2012 08:49:18 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FD3707B.1050407@FreeBSD.org> Date: Sat, 09 Jun 2012 18:49:15 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 MIME-Version: 1.0 To: Attilio Rao References: <201206081153.q58BrqG2056771@svn.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Davide Italiano , svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 15:49:21 -0000 On 06/08/12 15:52, Attilio Rao wrote: > 2012/6/8 Davide Italiano: >> Author: davide >> Date: Fri Jun 8 11:53:51 2012 >> New Revision: 236744 >> URL: http://svn.freebsd.org/changeset/base/236744 >> >> Log: >> Add (experimentally) a function to the sleepqueue(9) KPI >> sleepq_set_timeout_bt() in which the timeout may be specified in terms >> of bintime rather than ticks, and which takes advantage of the new >> precision capabilities of the callout subsystem. >> >> Modify the kern_nanosleep() function so that it may rely on >> sleepq_set_timeout_bt() rather than tsleep(). >> >> Modified: >> projects/calloutng/sys/kern/kern_time.c >> projects/calloutng/sys/kern/subr_sleepqueue.c >> projects/calloutng/sys/sys/sleepqueue.h >> >> Modified: projects/calloutng/sys/kern/kern_time.c >> ============================================================================== >> --- projects/calloutng/sys/kern/kern_time.c Fri Jun 8 11:40:30 2012 (r236743) >> +++ projects/calloutng/sys/kern/kern_time.c Fri Jun 8 11:53:51 2012 (r236744) >> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -352,37 +353,40 @@ static int nanowait; >> int >> kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt) >> { >> - struct timespec ts, ts2, ts3; >> - struct timeval tv; >> - int error; >> + struct timespec ts; >> + struct bintime bt, bt2, tmp; >> + int catch = 0, error; >> >> if (rqt->tv_nsec< 0 || rqt->tv_nsec>= 1000000000) >> return (EINVAL); >> if (rqt->tv_sec< 0 || (rqt->tv_sec == 0&& rqt->tv_nsec == 0)) >> return (0); >> - getnanouptime(&ts); >> - timespecadd(&ts, rqt); >> - TIMESPEC_TO_TIMEVAL(&tv, rqt); >> + binuptime(&bt); >> + timespec2bintime(rqt,&tmp); >> + bintime_add(&bt,&tmp); >> for (;;) { >> - error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", >> - tvtohz(&tv)); >> - getnanouptime(&ts2); >> - if (error != EWOULDBLOCK) { >> - if (error == ERESTART) >> - error = EINTR; >> - if (rmt != NULL) { >> - timespecsub(&ts,&ts2); >> - if (ts.tv_sec< 0) >> - timespecclear(&ts); >> - *rmt = ts; >> - } >> + sleepq_lock(&nanowait); >> + sleepq_add(&nanowait, NULL, "nanslp", PWAIT | PCATCH, 0); >> + sleepq_set_timeout_bt(&nanowait,bt); >> + error = sleepq_timedwait_sig(&nanowait,catch); >> + binuptime(&bt2); >> + if (catch) { >> + if (error != EWOULDBLOCK) { >> + if (error == ERESTART) >> + error = EINTR; >> + if (rmt != NULL) { >> + tmp = bt; >> + bintime_sub(&tmp,&bt2); >> + bintime2timespec(&tmp,&ts); >> + if (ts.tv_sec< 0) >> + timespecclear(&ts); >> + *rmt = ts; >> + } >> return (error); >> + } >> } >> - if (timespeccmp(&ts2,&ts,>=)) >> + if (bintime_cmp(&bt2,&bt,>=)) >> return (0); >> - ts3 = ts; >> - timespecsub(&ts3,&ts2); >> - TIMESPEC_TO_TIMEVAL(&tv,&ts3); >> } >> } >> >> >> Modified: projects/calloutng/sys/kern/subr_sleepqueue.c >> ============================================================================== >> --- projects/calloutng/sys/kern/subr_sleepqueue.c Fri Jun 8 11:40:30 2012 (r236743) >> +++ projects/calloutng/sys/kern/subr_sleepqueue.c Fri Jun 8 11:53:51 2012 (r236744) >> @@ -361,6 +361,22 @@ sleepq_add(void *wchan, struct lock_obje >> * Sets a timeout that will remove the current thread from the specified >> * sleep queue after timo ticks if the thread has not already been awakened. >> */ >> +void >> +sleepq_set_timeout_bt(void *wchan, struct bintime bt) >> +{ >> + >> + struct sleepqueue_chain *sc; >> + struct thread *td; >> + >> + td = curthread; >> + sc = SC_LOOKUP(wchan); >> + mtx_assert(&sc->sc_lock, MA_OWNED); >> + MPASS(TD_ON_SLEEPQ(td)); >> + MPASS(td->td_sleepqueue == NULL); >> + MPASS(wchan != NULL); >> + callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout, td, PCPU_GET(cpuid)); >> +} >> + > > For this, I'd rather prefer that you patch sleepq_set_timeout() directly to be: > void sleepq_set_timeout(void *wchan, int timo, struct bintime *bt); > > Then, if you pass a NULL ptr to bt the 'timo' is used, otherwise bt is > given preference in the logic. You will need to patch the current few > callers of sleepq_set_timo() to get NULL, but it is a small patch. > I would really like that you do the same also in the callout KPI, > possibly, because this avoids a lot of code duplication. As opposite opinion, I don't like an idea of functions with both kinds of time arguments. It will break existing API/ABI (yes, rarely used, but already existing and documented) without giving any real benefits. Duplication of few code lines IMHO is not an argument at all if we are speaking about choosing API. Speaking about such a popular API as callout(9), I believe API breakage is just not an option. -- Alexander Motin From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 15:55:02 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 10A511065672; Sat, 9 Jun 2012 15:55:02 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id C7AEF8FC0C; Sat, 9 Jun 2012 15:55:00 +0000 (UTC) Received: by lbon10 with SMTP id n10so2442345lbo.13 for ; Sat, 09 Jun 2012 08:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=XXe5AhTTX3+hDrsdQksrQgEwZMC49xdocWNbIONCOaw=; b=wqrV8c3MxmSOzr6VLxUY3JlwXGluptlrqe6YjWglMSXlNl+sDGQROcSH4Bd0SHCy7D 90epnkyHHslYosyTBz8ID8KLjo40lxnWhwPfChepPO5OTLdRXAK2vBc9mJ/EMqo22wgW kTC3j7NN9he0QIONPKecd7e9xko0rasD43IlcP2BMuVk1Gl8hzycND9aLrd0UAFcjQ8A HjRhyJPtMk3tVypbMzH27ocN4XbmmUwlf6zaiSMLm8ecAqbyeKSDhW8qrfkwpXYdPbWv HG+nOGgt5j6L//4AEK11KFc5JOhC63Xw8xLjdhAz8KTGJh2dvJ/ZRXPkY+SRvIJ4ihdR 6mtw== MIME-Version: 1.0 Received: by 10.112.23.196 with SMTP id o4mr935252lbf.49.1339257299629; Sat, 09 Jun 2012 08:54:59 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Sat, 9 Jun 2012 08:54:59 -0700 (PDT) In-Reply-To: <4FD3707B.1050407@FreeBSD.org> References: <201206081153.q58BrqG2056771@svn.freebsd.org> <4FD3707B.1050407@FreeBSD.org> Date: Sat, 9 Jun 2012 16:54:59 +0100 X-Google-Sender-Auth: iwwE65tIAuOPxoieEbsXdiMT5eo Message-ID: From: Attilio Rao To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Cc: Davide Italiano , svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 15:55:02 -0000 MjAxMi82LzkgQWxleGFuZGVyIE1vdGluIDxtYXZAZnJlZWJzZC5vcmc+Ogo+IE9uIDA2LzA4LzEy IDE1OjUyLCBBdHRpbGlvIFJhbyB3cm90ZToKPj4KPj4gMjAxMi82LzggRGF2aWRlIEl0YWxpYW5v PGRhdmlkZUBmcmVlYnNkLm9yZz46Cj4+Pgo+Pj4gQXV0aG9yOiBkYXZpZGUKPj4+IERhdGU6IEZy aSBKdW4gwqA4IDExOjUzOjUxIDIwMTIKPj4+IE5ldyBSZXZpc2lvbjogMjM2NzQ0Cj4+PiBVUkw6 IGh0dHA6Ly9zdm4uZnJlZWJzZC5vcmcvY2hhbmdlc2V0L2Jhc2UvMjM2NzQ0Cj4+Pgo+Pj4gTG9n Ogo+Pj4gwqBBZGQgKGV4cGVyaW1lbnRhbGx5KSBhIGZ1bmN0aW9uIHRvIHRoZSBzbGVlcHF1ZXVl KDkpIEtQSQo+Pj4gwqBzbGVlcHFfc2V0X3RpbWVvdXRfYnQoKSBpbiB3aGljaCB0aGUgdGltZW91 dCBtYXkgYmUgc3BlY2lmaWVkIGluIHRlcm1zCj4+PiDCoG9mIGJpbnRpbWUgcmF0aGVyIHRoYW4g dGlja3MsIGFuZCB3aGljaCB0YWtlcyBhZHZhbnRhZ2Ugb2YgdGhlIG5ldwo+Pj4gwqBwcmVjaXNp b24gY2FwYWJpbGl0aWVzIG9mIHRoZSBjYWxsb3V0IHN1YnN5c3RlbS4KPj4+Cj4+PiDCoE1vZGlm eSB0aGUga2Vybl9uYW5vc2xlZXAoKSBmdW5jdGlvbiBzbyB0aGF0IGl0IG1heSByZWx5IG9uCj4+ PiDCoHNsZWVwcV9zZXRfdGltZW91dF9idCgpIHJhdGhlciB0aGFuIHRzbGVlcCgpLgo+Pj4KPj4+ IE1vZGlmaWVkOgo+Pj4gwqBwcm9qZWN0cy9jYWxsb3V0bmcvc3lzL2tlcm4va2Vybl90aW1lLmMK Pj4+IMKgcHJvamVjdHMvY2FsbG91dG5nL3N5cy9rZXJuL3N1YnJfc2xlZXBxdWV1ZS5jCj4+PiDC oHByb2plY3RzL2NhbGxvdXRuZy9zeXMvc3lzL3NsZWVwcXVldWUuaAo+Pj4KPj4+IE1vZGlmaWVk OiBwcm9qZWN0cy9jYWxsb3V0bmcvc3lzL2tlcm4va2Vybl90aW1lLmMKPj4+Cj4+PiA9PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT0KPj4+IC0tLSBwcm9qZWN0cy9jYWxsb3V0bmcvc3lzL2tlcm4va2Vybl90 aW1lLmMgwqAgwqAgRnJpIEp1biDCoDggMTE6NDA6MzAgMjAxMgo+Pj4gwqAgwqAgwqAgwqAocjIz Njc0MykKPj4+ICsrKyBwcm9qZWN0cy9jYWxsb3V0bmcvc3lzL2tlcm4va2Vybl90aW1lLmMgwqAg wqAgRnJpIEp1biDCoDggMTE6NTM6NTEgMjAxMgo+Pj4gwqAgwqAgwqAgwqAocjIzNjc0NCkKPj4+ IEBAIC00Myw2ICs0Myw3IEBAIF9fRkJTRElEKCIkRnJlZUJTRCQiKTsKPj4+IMKgI2luY2x1ZGU8 c3lzL3Jlc291cmNldmFyLmg+Cj4+PiDCoCNpbmNsdWRlPHN5cy9zaWduYWx2YXIuaD4KPj4+IMKg I2luY2x1ZGU8c3lzL2tlcm5lbC5oPgo+Pj4gKyNpbmNsdWRlPHN5cy9zbGVlcHF1ZXVlLmg+Cj4+ PiDCoCNpbmNsdWRlPHN5cy9zeXNjYWxsc3Vici5oPgo+Pj4gwqAjaW5jbHVkZTxzeXMvc3lzY3Rs Lmg+Cj4+PiDCoCNpbmNsdWRlPHN5cy9zeXNlbnQuaD4KPj4+IEBAIC0zNTIsMzcgKzM1Myw0MCBA QCBzdGF0aWMgaW50IG5hbm93YWl0Owo+Pj4gwqBpbnQKPj4+IMKga2Vybl9uYW5vc2xlZXAoc3Ry dWN0IHRocmVhZCAqdGQsIHN0cnVjdCB0aW1lc3BlYyAqcnF0LCBzdHJ1Y3QgdGltZXNwZWMKPj4+ ICpybXQpCj4+PiDCoHsKPj4+IC0gwqAgwqAgwqAgc3RydWN0IHRpbWVzcGVjIHRzLCB0czIsIHRz MzsKPj4+IC0gwqAgwqAgwqAgc3RydWN0IHRpbWV2YWwgdHY7Cj4+PiAtIMKgIMKgIMKgIGludCBl cnJvcjsKPj4+ICsgwqAgwqAgwqAgc3RydWN0IHRpbWVzcGVjIHRzOwo+Pj4gKyDCoCDCoCDCoCBz dHJ1Y3QgYmludGltZSBidCwgYnQyLCB0bXA7Cj4+PiArIMKgIMKgIMKgIGludCBjYXRjaCA9IDAs IGVycm9yOwo+Pj4KPj4+IMKgIMKgIMKgIMKgaWYgKHJxdC0+dHZfbnNlYzwgwqAwIHx8IHJxdC0+ dHZfbnNlYz49IDEwMDAwMDAwMDApCj4+PiDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoHJldHVybiAo RUlOVkFMKTsKPj4+IMKgIMKgIMKgIMKgaWYgKHJxdC0+dHZfc2VjPCDCoDAgfHwgKHJxdC0+dHZf c2VjID09IDAmJiDCoHJxdC0+dHZfbnNlYyA9PSAwKSkKPj4+Cj4+PiDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoHJldHVybiAoMCk7Cj4+PiAtIMKgIMKgIMKgIGdldG5hbm91cHRpbWUoJnRzKTsKPj4+ IC0gwqAgwqAgwqAgdGltZXNwZWNhZGQoJnRzLCBycXQpOwo+Pj4gLSDCoCDCoCDCoCBUSU1FU1BF Q19UT19USU1FVkFMKCZ0diwgcnF0KTsKPj4+ICsgwqAgwqAgwqAgYmludXB0aW1lKCZidCk7Cj4+ PiArIMKgIMKgIMKgIHRpbWVzcGVjMmJpbnRpbWUocnF0LCZ0bXApOwo+Pj4gKyDCoCDCoCDCoCBi aW50aW1lX2FkZCgmYnQsJnRtcCk7Cj4+PiDCoCDCoCDCoCDCoGZvciAoOzspIHsKPj4+IC0gwqAg wqAgwqAgwqAgwqAgwqAgwqAgZXJyb3IgPSB0c2xlZXAoJm5hbm93YWl0LCBQV0FJVCB8IFBDQVRD SCwgIm5hbnNscCIsCj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIHR2dG9oeigmdHYp KTsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgZ2V0bmFub3VwdGltZSgmdHMyKTsKPj4+IC0g wqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGVycm9yICE9IEVXT1VMREJMT0NLKSB7Cj4+PiAtIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChlcnJvciA9PSBFUkVTVEFSVCkKPj4+ IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgZXJyb3IgPSBF SU5UUjsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKHJtdCAhPSBO VUxMKSB7Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IHRpbWVzcGVjc3ViKCZ0cywmdHMyKTsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgaWYgKHRzLnR2X3NlYzwgwqAwKQo+Pj4gLSDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0aW1lc3BlY2NsZWFy KCZ0cyk7Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg ICpybXQgPSB0czsKPj4+IC0gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgfQo+Pj4g KyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBzbGVlcHFfbG9jaygmbmFub3dhaXQpOwo+Pj4gKyDCoCDC oCDCoCDCoCDCoCDCoCDCoCBzbGVlcHFfYWRkKCZuYW5vd2FpdCwgTlVMTCwgIm5hbnNscCIsIFBX QUlUIHwgUENBVENILCAwKTsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgc2xlZXBxX3NldF90 aW1lb3V0X2J0KCZuYW5vd2FpdCxidCk7Cj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGVycm9y ID0gc2xlZXBxX3RpbWVkd2FpdF9zaWcoJm5hbm93YWl0LGNhdGNoKTsKPj4+ICsgwqAgwqAgwqAg wqAgwqAgwqAgwqAgYmludXB0aW1lKCZidDIpOwo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCBp ZiAoY2F0Y2gpIHsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKGVy cm9yICE9IEVXT1VMREJMT0NLKSB7Cj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIGlmIChlcnJvciA9PSBFUkVTVEFSVCkKPj4+ICsgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgZXJyb3IgPSBFSU5U UjsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYg KHJtdCAhPSBOVUxMKSB7Cj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIHRtcCA9IGJ0Owo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCBiaW50aW1lX3N1YigmdG1wLCZi dDIpOwo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCBiaW50aW1lMnRpbWVzcGVjKCZ0bXAsJnRzKTsKPj4+ICsgwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgaWYgKHRzLnR2X3Nl YzwgwqAwKQo+Pj4gKyDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDC oCDCoCDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0aW1lc3BlY2NsZWFyKCZ0cyk7Cj4+PiArIMKgIMKg IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgICpybXQg PSB0czsKPj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg fQo+Pj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqByZXR1cm4gKGVycm9yKTsK Pj4+ICsgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgfQo+Pj4gwqAgwqAgwqAgwqAg wqAgwqAgwqAgwqB9Cj4+PiAtIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmICh0aW1lc3BlY2NtcCgm dHMyLCZ0cyw+PSkpCj4+PiArIMKgIMKgIMKgIMKgIMKgIMKgIMKgIGlmIChiaW50aW1lX2NtcCgm YnQyLCZidCw+PSkpCj4+Pgo+Pj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqBy ZXR1cm4gKDApOwo+Pj4gLSDCoCDCoCDCoCDCoCDCoCDCoCDCoCB0czMgPSB0czsKPj4+IC0gwqAg wqAgwqAgwqAgwqAgwqAgwqAgdGltZXNwZWNzdWIoJnRzMywmdHMyKTsKPj4+IC0gwqAgwqAgwqAg wqAgwqAgwqAgwqAgVElNRVNQRUNfVE9fVElNRVZBTCgmdHYsJnRzMyk7Cj4+PiDCoCDCoCDCoCDC oH0KPj4+IMKgfQo+Pj4KPj4+Cj4+PiBNb2RpZmllZDogcHJvamVjdHMvY2FsbG91dG5nL3N5cy9r ZXJuL3N1YnJfc2xlZXBxdWV1ZS5jCj4+Pgo+Pj4gPT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Cj4+PiAt LS0gcHJvamVjdHMvY2FsbG91dG5nL3N5cy9rZXJuL3N1YnJfc2xlZXBxdWV1ZS5jIMKgIMKgIMKg IEZyaSBKdW4gwqA4Cj4+PiAxMTo0MDozMCAyMDEyIMKgIMKgIMKgIMKgKHIyMzY3NDMpCj4+PiAr KysgcHJvamVjdHMvY2FsbG91dG5nL3N5cy9rZXJuL3N1YnJfc2xlZXBxdWV1ZS5jIMKgIMKgIMKg IEZyaSBKdW4gwqA4Cj4+PiAxMTo1Mzo1MSAyMDEyIMKgIMKgIMKgIMKgKHIyMzY3NDQpCj4+PiBA QCAtMzYxLDYgKzM2MSwyMiBAQCBzbGVlcHFfYWRkKHZvaWQgKndjaGFuLCBzdHJ1Y3QgbG9ja19v YmplCj4+PiDCoCogU2V0cyBhIHRpbWVvdXQgdGhhdCB3aWxsIHJlbW92ZSB0aGUgY3VycmVudCB0 aHJlYWQgZnJvbSB0aGUgc3BlY2lmaWVkCj4+PiDCoCogc2xlZXAgcXVldWUgYWZ0ZXIgdGltbyB0 aWNrcyBpZiB0aGUgdGhyZWFkIGhhcyBub3QgYWxyZWFkeSBiZWVuCj4+PiBhd2FrZW5lZC4KPj4+ IMKgKi8KPj4+ICt2b2lkCj4+PiArc2xlZXBxX3NldF90aW1lb3V0X2J0KHZvaWQgKndjaGFuLCBz dHJ1Y3QgYmludGltZSBidCkKPj4+ICt7Cj4+PiArCj4+PiArIMKgIMKgIMKgIHN0cnVjdCBzbGVl cHF1ZXVlX2NoYWluICpzYzsKPj4+ICsgwqAgwqAgwqAgc3RydWN0IHRocmVhZCAqdGQ7Cj4+PiAr Cj4+PiArIMKgIMKgIMKgIHRkID0gY3VydGhyZWFkOwo+Pj4gKyDCoCDCoCDCoCBzYyA9IFNDX0xP T0tVUCh3Y2hhbik7Cj4+PiArIMKgIMKgIMKgIG10eF9hc3NlcnQoJnNjLT5zY19sb2NrLCBNQV9P V05FRCk7Cj4+PiArIMKgIMKgIMKgIE1QQVNTKFREX09OX1NMRUVQUSh0ZCkpOwo+Pj4gKyDCoCDC oCDCoCBNUEFTUyh0ZC0+dGRfc2xlZXBxdWV1ZSA9PSBOVUxMKTsKPj4+ICsgwqAgwqAgwqAgTVBB U1Mod2NoYW4gIT0gTlVMTCk7Cj4+PiArIMKgIMKgIMKgIGNhbGxvdXRfcmVzZXRfYnRfb24oJnRk LT50ZF9zbHBjYWxsb3V0LCBidCwgc2xlZXBxX3RpbWVvdXQsIHRkLAo+Pj4gUENQVV9HRVQoY3B1 aWQpKTsKPj4+ICt9Cj4+PiArCj4+Cj4+Cj4+IEZvciB0aGlzLCBJJ2QgcmF0aGVyIHByZWZlciB0 aGF0IHlvdSBwYXRjaCBzbGVlcHFfc2V0X3RpbWVvdXQoKSBkaXJlY3RseQo+PiB0byBiZToKPj4g dm9pZCBzbGVlcHFfc2V0X3RpbWVvdXQodm9pZCAqd2NoYW4sIGludCB0aW1vLCBzdHJ1Y3QgYmlu dGltZSAqYnQpOwo+Pgo+PiBUaGVuLCBpZiB5b3UgcGFzcyBhIE5VTEwgcHRyIHRvIGJ0IHRoZSAn dGltbycgaXMgdXNlZCwgb3RoZXJ3aXNlIGJ0IGlzCj4+IGdpdmVuIHByZWZlcmVuY2UgaW4gdGhl IGxvZ2ljLiBZb3Ugd2lsbCBuZWVkIHRvIHBhdGNoIHRoZSBjdXJyZW50IGZldwo+PiBjYWxsZXJz IG9mIHNsZWVwcV9zZXRfdGltbygpIHRvIGdldCBOVUxMLCBidXQgaXQgaXMgYSBzbWFsbCBwYXRj aC4KPj4gSSB3b3VsZCByZWFsbHkgbGlrZSB0aGF0IHlvdSBkbyB0aGUgc2FtZSBhbHNvIGluIHRo ZSBjYWxsb3V0IEtQSSwKPj4gcG9zc2libHksIGJlY2F1c2UgdGhpcyBhdm9pZHMgYSBsb3Qgb2Yg Y29kZSBkdXBsaWNhdGlvbi4KPgo+Cj4gQXMgb3Bwb3NpdGUgb3BpbmlvbiwgSSBkb24ndCBsaWtl IGFuIGlkZWEgb2YgZnVuY3Rpb25zIHdpdGggYm90aCBraW5kcyBvZgo+IHRpbWUgYXJndW1lbnRz LiBJdCB3aWxsIGJyZWFrIGV4aXN0aW5nIEFQSS9BQkkgKHllcywgcmFyZWx5IHVzZWQsIGJ1dAo+ IGFscmVhZHkgZXhpc3RpbmcgYW5kIGRvY3VtZW50ZWQpIHdpdGhvdXQgZ2l2aW5nIGFueSByZWFs IGJlbmVmaXRzLgo+IER1cGxpY2F0aW9uIG9mIGZldyBjb2RlIGxpbmVzIElNSE8gaXMgbm90IGFu IGFyZ3VtZW50IGF0IGFsbCBpZiB3ZSBhcmUKPiBzcGVha2luZyBhYm91dCBjaG9vc2luZyBBUEku IFNwZWFraW5nIGFib3V0IHN1Y2ggYSBwb3B1bGFyIEFQSSBhcwo+IGNhbGxvdXQoOSksIEkgYmVs aWV2ZSBBUEkgYnJlYWthZ2UgaXMganVzdCBub3QgYW4gb3B0aW9uLgoKSSByZXNwZWN0ZnVsbHkg ZGlzYWdyZWUuCldlIGNhbiBicmVhayBLUEkgYmV0d2VlbiBtYWpvciB2ZXJzaW9uIGFuZCB0aGlz IGlzIG5vdCBhIHByb2JsZW0uIFlvdQpjYW4gY29uc2lkZXIgdG8gYWRkIHNvbWUgY29tcGF0aWJp bGl0eSBjaHVybiBsaWtlIHRoaXMgb25lIGZvciBNRkMsIGlmCnlvdSBuZWVkLCBidXQgZm9yIEhF QUQgd2Ugc2hvdWxkIHJlYWxseSBoYXZlIGNsZWFuZXIgY29kZSByYXRoZXIgdGhhbgpjb2RlIGR1 cGxpY2F0aW9uIHdoaWNoIGJyaW5ncyB0byBsZXNzIG1haW50ZW5lYWJpbGl0eS4gRm9yIG90aGVy CmV4YW1wbGUgb2YgZG91YmxlLWxvYWRlZCBhcmd1bWVudHMsIHBsZWFzZSBsb29rIGF0IHRoZSBp bnRlcnJ1cHQKZmlsdGVyL2ludGVycnVwdCB0aHJlYWRzIGludGVyZmFjZS4KSSByZWFsbHkgdGhp bmsgaGF2aW5nIGEgc3BlY2lmaWMgZnVuY3Rpb24ganVzdCBmb3IgcGFzc2luZyB0aW1vL2J0IGlz Cm92ZXJraWxsLiBBbmQgeW91IGFyZSByZWFsbHkgbWFraW5nIGEgbWFqb3IgY2hhbmdlIHdoaWNo IGlzIGV4cGVjdGVkCnRvIGJyaW5nIHRvIGNoYW5nZWQgS1BJLgoKQXR0aWxpbwoKCi0tIApQZWFj ZSBjYW4gb25seSBiZSBhY2hpZXZlZCBieSB1bmRlcnN0YW5kaW5nIC0gQS4gRWluc3RlaW4K From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 16:10:59 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C180B1065670; Sat, 9 Jun 2012 16:10:59 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-bk0-f54.google.com (mail-bk0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 9D2F18FC19; Sat, 9 Jun 2012 16:10:58 +0000 (UTC) Received: by bkvi18 with SMTP id i18so3163646bkv.13 for ; Sat, 09 Jun 2012 09:10:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=1jB80tkS80bLQmj/TAb7q6fRDZlk/KbBfhAQKdco4fk=; b=OBauBWB956Bs4pyiwzL7hC6Hx7+Mmm/TIDrpKsc+c9+YE41c0DBVG1gdD1gpbL63sB h6K9ASb5CB3Dn2zs8h/P0YFzhLZmJDz55kJdD/tjWJGHzT2MYKjV8Uy1ywB+WAIguUxl XhWET4u9V4gv6zhkt+U4m5xVjC6VphfIsBe87w6Kert/D2+3IeGSd8A5d9Tv7S8u1pZm FfAGncYkgYyoxQ0Mo/pGP5IvZoA2TEcgO9bCX1C6X3EZ63UG6vaHew0Z2Y2LfchTO0fG Yf0ul3ZxfdWxLbokKuj9j/ujrOEifaZHqblCEzRuFKEOc9kFcRXQfK6nOM/RC43oMnPj oitQ== Received: by 10.204.157.151 with SMTP id b23mr7740938bkx.44.1339258257281; Sat, 09 Jun 2012 09:10:57 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua. [212.86.226.226]) by mx.google.com with ESMTPS id n17sm10786757bkw.5.2012.06.09.09.10.55 (version=SSLv3 cipher=OTHER); Sat, 09 Jun 2012 09:10:56 -0700 (PDT) Sender: Alexander Motin Message-ID: <4FD3758E.4030702@FreeBSD.org> Date: Sat, 09 Jun 2012 19:10:54 +0300 From: Alexander Motin User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120506 Thunderbird/12.0.1 MIME-Version: 1.0 To: Attilio Rao References: <201206081153.q58BrqG2056771@svn.freebsd.org> <4FD3707B.1050407@FreeBSD.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Davide Italiano , svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 16:10:59 -0000 On 06/09/12 18:54, Attilio Rao wrote: > 2012/6/9 Alexander Motin: >> On 06/08/12 15:52, Attilio Rao wrote: >>> >>> 2012/6/8 Davide Italiano: >>>> >>>> Author: davide >>>> Date: Fri Jun 8 11:53:51 2012 >>>> New Revision: 236744 >>>> URL: http://svn.freebsd.org/changeset/base/236744 >>>> >>>> Log: >>>> Add (experimentally) a function to the sleepqueue(9) KPI >>>> sleepq_set_timeout_bt() in which the timeout may be specified in terms >>>> of bintime rather than ticks, and which takes advantage of the new >>>> precision capabilities of the callout subsystem. >>>> >>>> Modify the kern_nanosleep() function so that it may rely on >>>> sleepq_set_timeout_bt() rather than tsleep(). >>>> >>>> Modified: >>>> projects/calloutng/sys/kern/kern_time.c >>>> projects/calloutng/sys/kern/subr_sleepqueue.c >>>> projects/calloutng/sys/sys/sleepqueue.h >>>> >>>> Modified: projects/calloutng/sys/kern/kern_time.c >>>> >>>> ============================================================================== >>>> --- projects/calloutng/sys/kern/kern_time.c Fri Jun 8 11:40:30 2012 >>>> (r236743) >>>> +++ projects/calloutng/sys/kern/kern_time.c Fri Jun 8 11:53:51 2012 >>>> (r236744) >>>> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); >>>> #include >>>> #include >>>> #include >>>> +#include >>>> #include >>>> #include >>>> #include >>>> @@ -352,37 +353,40 @@ static int nanowait; >>>> int >>>> kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec >>>> *rmt) >>>> { >>>> - struct timespec ts, ts2, ts3; >>>> - struct timeval tv; >>>> - int error; >>>> + struct timespec ts; >>>> + struct bintime bt, bt2, tmp; >>>> + int catch = 0, error; >>>> >>>> if (rqt->tv_nsec< 0 || rqt->tv_nsec>= 1000000000) >>>> return (EINVAL); >>>> if (rqt->tv_sec< 0 || (rqt->tv_sec == 0&& rqt->tv_nsec == 0)) >>>> >>>> return (0); >>>> - getnanouptime(&ts); >>>> - timespecadd(&ts, rqt); >>>> - TIMESPEC_TO_TIMEVAL(&tv, rqt); >>>> + binuptime(&bt); >>>> + timespec2bintime(rqt,&tmp); >>>> + bintime_add(&bt,&tmp); >>>> for (;;) { >>>> - error = tsleep(&nanowait, PWAIT | PCATCH, "nanslp", >>>> - tvtohz(&tv)); >>>> - getnanouptime(&ts2); >>>> - if (error != EWOULDBLOCK) { >>>> - if (error == ERESTART) >>>> - error = EINTR; >>>> - if (rmt != NULL) { >>>> - timespecsub(&ts,&ts2); >>>> - if (ts.tv_sec< 0) >>>> - timespecclear(&ts); >>>> - *rmt = ts; >>>> - } >>>> + sleepq_lock(&nanowait); >>>> + sleepq_add(&nanowait, NULL, "nanslp", PWAIT | PCATCH, 0); >>>> + sleepq_set_timeout_bt(&nanowait,bt); >>>> + error = sleepq_timedwait_sig(&nanowait,catch); >>>> + binuptime(&bt2); >>>> + if (catch) { >>>> + if (error != EWOULDBLOCK) { >>>> + if (error == ERESTART) >>>> + error = EINTR; >>>> + if (rmt != NULL) { >>>> + tmp = bt; >>>> + bintime_sub(&tmp,&bt2); >>>> + bintime2timespec(&tmp,&ts); >>>> + if (ts.tv_sec< 0) >>>> + timespecclear(&ts); >>>> + *rmt = ts; >>>> + } >>>> return (error); >>>> + } >>>> } >>>> - if (timespeccmp(&ts2,&ts,>=)) >>>> + if (bintime_cmp(&bt2,&bt,>=)) >>>> >>>> return (0); >>>> - ts3 = ts; >>>> - timespecsub(&ts3,&ts2); >>>> - TIMESPEC_TO_TIMEVAL(&tv,&ts3); >>>> } >>>> } >>>> >>>> >>>> Modified: projects/calloutng/sys/kern/subr_sleepqueue.c >>>> >>>> ============================================================================== >>>> --- projects/calloutng/sys/kern/subr_sleepqueue.c Fri Jun 8 >>>> 11:40:30 2012 (r236743) >>>> +++ projects/calloutng/sys/kern/subr_sleepqueue.c Fri Jun 8 >>>> 11:53:51 2012 (r236744) >>>> @@ -361,6 +361,22 @@ sleepq_add(void *wchan, struct lock_obje >>>> * Sets a timeout that will remove the current thread from the specified >>>> * sleep queue after timo ticks if the thread has not already been >>>> awakened. >>>> */ >>>> +void >>>> +sleepq_set_timeout_bt(void *wchan, struct bintime bt) >>>> +{ >>>> + >>>> + struct sleepqueue_chain *sc; >>>> + struct thread *td; >>>> + >>>> + td = curthread; >>>> + sc = SC_LOOKUP(wchan); >>>> + mtx_assert(&sc->sc_lock, MA_OWNED); >>>> + MPASS(TD_ON_SLEEPQ(td)); >>>> + MPASS(td->td_sleepqueue == NULL); >>>> + MPASS(wchan != NULL); >>>> + callout_reset_bt_on(&td->td_slpcallout, bt, sleepq_timeout, td, >>>> PCPU_GET(cpuid)); >>>> +} >>>> + >>> >>> >>> For this, I'd rather prefer that you patch sleepq_set_timeout() directly >>> to be: >>> void sleepq_set_timeout(void *wchan, int timo, struct bintime *bt); >>> >>> Then, if you pass a NULL ptr to bt the 'timo' is used, otherwise bt is >>> given preference in the logic. You will need to patch the current few >>> callers of sleepq_set_timo() to get NULL, but it is a small patch. >>> I would really like that you do the same also in the callout KPI, >>> possibly, because this avoids a lot of code duplication. >> >> >> As opposite opinion, I don't like an idea of functions with both kinds of >> time arguments. It will break existing API/ABI (yes, rarely used, but >> already existing and documented) without giving any real benefits. >> Duplication of few code lines IMHO is not an argument at all if we are >> speaking about choosing API. Speaking about such a popular API as >> callout(9), I believe API breakage is just not an option. > > I respectfully disagree. > We can break KPI between major version and this is not a problem. You > can consider to add some compatibility churn like this one for MFC, if > you need, but for HEAD we should really have cleaner code rather than > code duplication which brings to less mainteneability. For other > example of double-loaded arguments, please look at the interrupt > filter/interrupt threads interface. > I really think having a specific function just for passing timo/bt is > overkill. And you are really making a major change which is expected > to bring to changed KPI. That is a question of comparing prices. In my opinion, the fact that we can change KPI between major releases does not mean that we should do it without really strong reason. IMO open source world too often tends to change the rules and APIs. That may work for in-tree code, when person changing API will catch up all consequences. But each change of that kind can make sad some vendor you never heard about, when his code will no longer compile and he will have to either add some more #ifdef's or drop FreeBSD support. If keeping compatibility would cost us some performance or hundreds lines of extra code, I would agree, but IMHO this case with few lines of code is different. -- Alexander Motin From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 16:22:53 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 036C4106566B; Sat, 9 Jun 2012 16:22:53 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E37698FC0C; Sat, 9 Jun 2012 16:22:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q59GMqxr042431; Sat, 9 Jun 2012 16:22:52 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q59GMq5w042429; Sat, 9 Jun 2012 16:22:52 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <201206091622.q59GMq5w042429@svn.freebsd.org> From: Tim Kientzle Date: Sat, 9 Jun 2012 16:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r236817 - projects/armv6/lib/libc/arm X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 16:22:53 -0000 Author: kientzle Date: Sat Jun 9 16:22:52 2012 New Revision: 236817 URL: http://svn.freebsd.org/changeset/base/236817 Log: Merge: publish __flt_rounds in libc on arm. Modified: projects/armv6/lib/libc/arm/Symbol.map Directory Properties: projects/armv6/lib/libc/ (props changed) Modified: projects/armv6/lib/libc/arm/Symbol.map ============================================================================== --- projects/armv6/lib/libc/arm/Symbol.map Sat Jun 9 16:09:53 2012 (r236816) +++ projects/armv6/lib/libc/arm/Symbol.map Sat Jun 9 16:22:52 2012 (r236817) @@ -70,6 +70,7 @@ FBSDprivate_1.0 { __divdf3; __floatsisf; __floatsidf; + __flt_rounds; __fixsfsi; __fixdfsi; __fixunssfsi; From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 16:38:09 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 09CB91065673; Sat, 9 Jun 2012 16:38:09 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id C920B8FC17; Sat, 9 Jun 2012 16:38:07 +0000 (UTC) Received: by laai10 with SMTP id i10so2337101laa.13 for ; Sat, 09 Jun 2012 09:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=RBRm0RF5RPEFRk3Pc8dUBWAte0x7KyjxbJ+w86XlM0g=; b=Mw2hZF/Xb0slyqUkShfWAAAl/t7kYXdYYTUJ0HxO0r39JF92UWIgZ2eXijtINPjp8m UPrsrazwv+EDLj+0IJKrfaKN7+nHLYbGBb3JONyTa6lXaJ3kkhrX9KS48P+73T+JwaRT M01bARK2D3+dXndkgEROSrrJAjIoDl2q6dIMUR9yIrnOkRMjJADKFnrNeXUfSGg7qbZy bJLKVeidfJOsN6EOq5QbrK+PABOb205DxaaDf5AfuXJ2IPrylVL2Rxg4G6iVhNScvA5q bqoXHEjM954UMiaD4YNexyCJ4rsO5g/KgM5yzyh5ZY8Hpwx0D4j4+E2PdyFmZA0AZKA5 2ljQ== MIME-Version: 1.0 Received: by 10.152.48.6 with SMTP id h6mr12197829lan.30.1339259886317; Sat, 09 Jun 2012 09:38:06 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.27.65 with HTTP; Sat, 9 Jun 2012 09:38:06 -0700 (PDT) In-Reply-To: <4FD3758E.4030702@FreeBSD.org> References: <201206081153.q58BrqG2056771@svn.freebsd.org> <4FD3707B.1050407@FreeBSD.org> <4FD3758E.4030702@FreeBSD.org> Date: Sat, 9 Jun 2012 17:38:06 +0100 X-Google-Sender-Auth: gUU-muPn6u2q4-okl-62bIUzzv8 Message-ID: From: Attilio Rao To: Alexander Motin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Davide Italiano , svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 16:38:09 -0000 2012/6/9 Alexander Motin : > On 06/09/12 18:54, Attilio Rao wrote: >> >> 2012/6/9 Alexander Motin: >>> >>> On 06/08/12 15:52, Attilio Rao wrote: >>>> >>>> >>>> 2012/6/8 Davide Italiano: >>>>> >>>>> >>>>> Author: davide >>>>> Date: Fri Jun =C2=A08 11:53:51 2012 >>>>> New Revision: 236744 >>>>> URL: http://svn.freebsd.org/changeset/base/236744 >>>>> >>>>> Log: >>>>> =C2=A0Add (experimentally) a function to the sleepqueue(9) KPI >>>>> =C2=A0sleepq_set_timeout_bt() in which the timeout may be specified i= n terms >>>>> =C2=A0of bintime rather than ticks, and which takes advantage of the = new >>>>> =C2=A0precision capabilities of the callout subsystem. >>>>> >>>>> =C2=A0Modify the kern_nanosleep() function so that it may rely on >>>>> =C2=A0sleepq_set_timeout_bt() rather than tsleep(). >>>>> >>>>> Modified: >>>>> =C2=A0projects/calloutng/sys/kern/kern_time.c >>>>> =C2=A0projects/calloutng/sys/kern/subr_sleepqueue.c >>>>> =C2=A0projects/calloutng/sys/sys/sleepqueue.h >>>>> >>>>> Modified: projects/calloutng/sys/kern/kern_time.c >>>>> >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- projects/calloutng/sys/kern/kern_time.c =C2=A0 =C2=A0 Fri Jun =C2= =A08 11:40:30 >>>>> 2012 >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0(r236743) >>>>> +++ projects/calloutng/sys/kern/kern_time.c =C2=A0 =C2=A0 Fri Jun =C2= =A08 11:53:51 >>>>> 2012 >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0(r236744) >>>>> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); >>>>> =C2=A0#include >>>>> =C2=A0#include >>>>> =C2=A0#include >>>>> +#include >>>>> =C2=A0#include >>>>> =C2=A0#include >>>>> =C2=A0#include >>>>> @@ -352,37 +353,40 @@ static int nanowait; >>>>> =C2=A0int >>>>> =C2=A0kern_nanosleep(struct thread *td, struct timespec *rqt, struct >>>>> timespec >>>>> *rmt) >>>>> =C2=A0{ >>>>> - =C2=A0 =C2=A0 =C2=A0 struct timespec ts, ts2, ts3; >>>>> - =C2=A0 =C2=A0 =C2=A0 struct timeval tv; >>>>> - =C2=A0 =C2=A0 =C2=A0 int error; >>>>> + =C2=A0 =C2=A0 =C2=A0 struct timespec ts; >>>>> + =C2=A0 =C2=A0 =C2=A0 struct bintime bt, bt2, tmp; >>>>> + =C2=A0 =C2=A0 =C2=A0 int catch =3D 0, error; >>>>> >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (rqt->tv_nsec< =C2=A0 =C2=A00 || rqt->t= v_nsec>=3D 1000000000) >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (EINVAL= ); >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0if (rqt->tv_sec< =C2=A0 =C2=A00 || (rqt->t= v_sec =3D=3D 0&& =C2=A0 =C2=A0rqt->tv_nsec =3D=3D >>>>> 0)) >>>>> >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return (0); >>>>> - =C2=A0 =C2=A0 =C2=A0 getnanouptime(&ts); >>>>> - =C2=A0 =C2=A0 =C2=A0 timespecadd(&ts, rqt); >>>>> - =C2=A0 =C2=A0 =C2=A0 TIMESPEC_TO_TIMEVAL(&tv, rqt); >>>>> + =C2=A0 =C2=A0 =C2=A0 binuptime(&bt); >>>>> + =C2=A0 =C2=A0 =C2=A0 timespec2bintime(rqt,&tmp); >>>>> + =C2=A0 =C2=A0 =C2=A0 bintime_add(&bt,&tmp); >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0for (;;) { >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D tsleep(&= nanowait, PWAIT | PCATCH, "nanslp", >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tvto= hz(&tv)); >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 getnanouptime(&ts2= ); >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (error !=3D EWO= ULDBLOCK) { >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (error =3D=3D ERESTART) >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D EINTR; >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (rmt !=3D NULL) { >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timespecsub(&ts,&ts2); >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ts.tv_sec< =C2=A0 =C2=A00) >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timespec= clear(&ts); >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *rmt =3D ts; >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 } >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sleepq_lock(&nanow= ait); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sleepq_add(&nanowa= it, NULL, "nanslp", PWAIT | PCATCH, >>>>> 0); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sleepq_set_timeout= _bt(&nanowait,bt); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error =3D sleepq_t= imedwait_sig(&nanowait,catch); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 binuptime(&bt2); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (catch) { >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 if (error !=3D EWOULDBLOCK) { >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (error =3D=3D ERESTART) >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 error = =3D EINTR; >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (rmt !=3D NULL) { >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tmp =3D = bt; >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bintime_= sub(&tmp,&bt2); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 bintime2= timespec(&tmp,&ts); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ts.t= v_sec< =C2=A0 =C2=A00) >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 timespecclear(&ts); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *rmt =3D= ts; >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0return (error); >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 } >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (timespeccmp(&t= s2,&ts,>=3D)) >>>>> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (bintime_cmp(&b= t2,&bt,>=3D)) >>>>> >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0return (0); >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ts3 =3D ts; >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 timespecsub(&ts3,&= ts2); >>>>> - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 TIMESPEC_TO_TIMEVA= L(&tv,&ts3); >>>>> =C2=A0 =C2=A0 =C2=A0 =C2=A0} >>>>> =C2=A0} >>>>> >>>>> >>>>> Modified: projects/calloutng/sys/kern/subr_sleepqueue.c >>>>> >>>>> >>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D >>>>> --- projects/calloutng/sys/kern/subr_sleepqueue.c =C2=A0 =C2=A0 =C2= =A0 Fri Jun =C2=A08 >>>>> 11:40:30 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r236743) >>>>> +++ projects/calloutng/sys/kern/subr_sleepqueue.c =C2=A0 =C2=A0 =C2= =A0 Fri Jun =C2=A08 >>>>> 11:53:51 2012 =C2=A0 =C2=A0 =C2=A0 =C2=A0(r236744) >>>>> @@ -361,6 +361,22 @@ sleepq_add(void *wchan, struct lock_obje >>>>> =C2=A0* Sets a timeout that will remove the current thread from the >>>>> specified >>>>> =C2=A0* sleep queue after timo ticks if the thread has not already be= en >>>>> awakened. >>>>> =C2=A0*/ >>>>> +void >>>>> +sleepq_set_timeout_bt(void *wchan, struct bintime bt) >>>>> +{ >>>>> + >>>>> + =C2=A0 =C2=A0 =C2=A0 struct sleepqueue_chain *sc; >>>>> + =C2=A0 =C2=A0 =C2=A0 struct thread *td; >>>>> + >>>>> + =C2=A0 =C2=A0 =C2=A0 td =3D curthread; >>>>> + =C2=A0 =C2=A0 =C2=A0 sc =3D SC_LOOKUP(wchan); >>>>> + =C2=A0 =C2=A0 =C2=A0 mtx_assert(&sc->sc_lock, MA_OWNED); >>>>> + =C2=A0 =C2=A0 =C2=A0 MPASS(TD_ON_SLEEPQ(td)); >>>>> + =C2=A0 =C2=A0 =C2=A0 MPASS(td->td_sleepqueue =3D=3D NULL); >>>>> + =C2=A0 =C2=A0 =C2=A0 MPASS(wchan !=3D NULL); >>>>> + =C2=A0 =C2=A0 =C2=A0 callout_reset_bt_on(&td->td_slpcallout, bt, sl= eepq_timeout, td, >>>>> PCPU_GET(cpuid)); >>>>> +} >>>>> + >>>> >>>> >>>> >>>> For this, I'd rather prefer that you patch sleepq_set_timeout() direct= ly >>>> to be: >>>> void sleepq_set_timeout(void *wchan, int timo, struct bintime *bt); >>>> >>>> Then, if you pass a NULL ptr to bt the 'timo' is used, otherwise bt is >>>> given preference in the logic. You will need to patch the current few >>>> callers of sleepq_set_timo() to get NULL, but it is a small patch. >>>> I would really like that you do the same also in the callout KPI, >>>> possibly, because this avoids a lot of code duplication. >>> >>> >>> >>> As opposite opinion, I don't like an idea of functions with both kinds = of >>> time arguments. It will break existing API/ABI (yes, rarely used, but >>> already existing and documented) without giving any real benefits. >>> Duplication of few code lines IMHO is not an argument at all if we are >>> speaking about choosing API. Speaking about such a popular API as >>> callout(9), I believe API breakage is just not an option. >> >> >> I respectfully disagree. >> We can break KPI between major version and this is not a problem. You >> can consider to add some compatibility churn like this one for MFC, if >> you need, but for HEAD we should really have cleaner code rather than >> code duplication which brings to less mainteneability. For other >> example of double-loaded arguments, please look at the interrupt >> filter/interrupt threads interface. >> I really think having a specific function just for passing timo/bt is >> overkill. And you are really making a major change which is expected >> to bring to changed KPI. > > > That is a question of comparing prices. In my opinion, the fact that we c= an > change KPI between major releases does not mean that we should do it with= out > really strong reason. IMO open source world too often tends to change the > rules and APIs. That may work for in-tree code, when person changing API > will catch up all consequences. But each change of that kind can make sad > some vendor you never heard about, when his code will no longer compile a= nd > he will have to either add some more #ifdef's or drop FreeBSD support. If > keeping compatibility would cost us some performance or hundreds lines of > extra code, I would agree, but IMHO this case with few lines of code is > different. Well, I spoke privately about that with Davide too and already spent a lot of words for this too, which is an issue which just doesn't deserve that. I just wanted to show you that it is true that we already have code doing that (ifilter), that it doesn't violate any rule and that it keeps the KPI smaller and avoids code duplication. You are free to ignore my opinion, this is your project, but for an example of the "unmaintenability" please look at the newer Davide's code about adding direct dispatching of callouts on ISR directly. It patches correctly the _bt() variant of callout but completely leaves out the timo variant. While this is not a problem because of code committed to a project branch I think this perfectly explains what I mean. Please feel free to ignore the whole thread at you convenience, though. Attilio --=20 Peace can only be achieved by understanding - A. Einstein From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 23:26:02 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7BEF61065670; Sat, 9 Jun 2012 23:26:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id EDCA08FC0A; Sat, 9 Jun 2012 23:26:01 +0000 (UTC) Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q59NPqW7021650 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 Jun 2012 09:25:53 +1000 Date: Sun, 10 Jun 2012 09:25:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Attilio Rao In-Reply-To: Message-ID: <20120610074926.P952@besplex.bde.org> References: <201206081153.q58BrqG2056771@svn.freebsd.org> <4FD3707B.1050407@FreeBSD.org> <4FD3758E.4030702@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Davide Italiano , svn-src-projects@freebsd.org, Alexander Motin , src-committers@freebsd.org Subject: Re: svn commit: r236744 - in projects/calloutng/sys: kern sys X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 23:26:02 -0000 On Sat, 9 Jun 2012, Attilio Rao wrote: > 2012/6/9 Alexander Motin : >> On 06/09/12 18:54, Attilio Rao wrote: >>> >>> 2012/6/9 Alexander Motin: >>>> >>>> On 06/08/12 15:52, Attilio Rao wrote: >>>>> >>>>> 2012/6/8 Davide Italiano: >>>>>> > [... excessive quoting deleting] >>>>>> [... most lines with binary characters deleted] >>>>>> >>>>>> + \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 sleepq_s et_timeout_bt(&nanowait,bt); >>>>>> + \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 error = sleepq_timedwait_sig(&nanowait,catch); >>>>>> + \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 binuptim e(&bt2); >>>>>> + \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 if (catc h) { >>>>>> + \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 \xc2\xa0 if (error != EWOULDBLOCK) { Some lines with binary characters translated to ASCII by vi and vidcontrol. >>>>> For this, I'd rather prefer that you patch sleepq_set_timeout() directly >>>>> to be: >>>>> void sleepq_set_timeout(void *wchan, int timo, struct bintime *bt); >>>>> >>>>> Then, if you pass a NULL ptr to bt the 'timo' is used, otherwise bt is >>>>> given preference in the logic. You will need to patch the current few >>>>> callers of sleepq_set_timo() to get NULL, but it is a small patch. >>>>> I would really like that you do the same also in the callout KPI, >>>>> possibly, because this avoids a lot of code duplication. >>>> >>>> As opposite opinion, I don't like an idea of functions with both kinds of >>>> time arguments. It will break existing API/ABI (yes, rarely used, but >>>> already existing and documented) without giving any real benefits. >>>> Duplication of few code lines IMHO is not an argument at all if we are >>>> speaking about choosing API. Speaking about such a popular API as >>>> callout(9), I believe API breakage is just not an option. I strongly agree. However, ... >>> I respectfully disagree. >>> We can break KPI between major version and this is not a problem. You >>> can consider to add some compatibility churn like this one for MFC, if >>> you need, but for HEAD we should really have cleaner code rather than >>> code duplication which brings to less mainteneability. For other >>> example of double-loaded arguments, please look at the interrupt >>> filter/interrupt threads interface. >>> I really think having a specific function just for passing timo/bt is >>> overkill. And you are really making a major change which is expected >>> to bring to changed KPI. I like separate functions even without the API considerations. >> That is a question of comparing prices. In my opinion, the fact that we can >> change KPI between major releases does not mean that we should do it without >> really strong reason. IMO open source world too often tends to change the >> rules and APIs. That may work for in-tree code, when person changing API >> will catch up all consequences. But each change of that kind can make sad >> some vendor you never heard about, when his code will no longer compile and >> he will have to either add some more #ifdef's or drop FreeBSD support. If >> keeping compatibility would cost us some performance or hundreds lines of >> extra code, I would agree, but IMHO this case with few lines of code is >> different. > > Well, I spoke privately about that with Davide too and already spent a > lot of words for this too, which is an issue which just doesn't > deserve that. > I just wanted to show you that it is true that we already have code > doing that (ifilter), that it doesn't violate any rule and that it > keeps the KPI smaller and avoids code duplication. > You are free to ignore my opinion, this is your project, but for an > example of the "unmaintenability" please look at the newer Davide's > code about adding direct dispatching of callouts on ISR directly. It > patches correctly the _bt() variant of callout but completely leaves > out the timo variant. > While this is not a problem because of code committed to a project > branch I think this perfectly explains what I mean. > > Please feel free to ignore the whole thread at you convenience, though. ... however, both APIs seem to be inadequate. I started by pointing out some style bugs in this commit privately, and then noticed that it had some non-style bugs (mainly, breaking of signal handling by making its `catch' clause unreachable, and then in connection with old bugs in nanosleep(), I noticed that it seems to be necessary to be able to sleep on any clock id -- especially CLOCK_REALTIME and CLOCK_MONOTONIC. It seems to be necessary to pass the clock id to sleepq code (if not to callout code), and then you can easily handle the old ticks arg as a special clock id). One of the old bugs in nanosleep() is that it is specified to sleep on CLOCK_REALTIME, but in FreeBSD it sleeps on CLOCK_MONOTONIC. Bugs in CLOCK_MONOTONIC make this bug very large. POSIX specifies that CLOCK_MONOTONIC is the time since some fixed time in the past, but in FreeBSD it is the time since a highly variable time in the past (boottimebin). Sleeping on CLOCK_MONOTONIC is what is normally wanted, but sleep() and nanosleep() must sleep on CLOCK_REALTIME for compatibility. POSIX specifies clock_nanosleep() (which is like nanosleep() except it takes a clock id and a TIMER_ABSTIME flags argument which can be used to specify that the time is absolute instead of relative). FreeBSD doesn't implement this. Timeouts and their APIs have related bugs. They only support relative times on a monotonic clock that is similar to CLOCK_MONOTONIC (ticks++ is stopped during deep sleeps, while CLOCK_MONOTONIC may be stopped or broken during deep sleeps, depending on whether the hardware behind CLOCK_MONOTONIC was stopped or wrapped around during deep sleeps). Fixing nanosleep() using old APIs seems to require something like the following: - break up long sleeps to short sleeps, to give more chance of not sleeping for much longer than necessary. E.g., if the ticks counter loses 8 hours per night, then the error for sleep(7 * 86400) (7 days) would be 56 hours for a single sleep. By sleeping for 1 day at a time, this error can be reduced to only 8 hours. By sleeping for 1 hour at a time, this error can be reduced to only 1 hour, with large errors occurring only during the the hour after the system wakes up (when timeouts are bogusly extended acrors this hour). This is also needed to fix some overflow bugs (when userlands asks for sleeps of almost TIME_T_MAX seconds). This is also needed to fix cases where hardclock has a large calibration error. Most x86 FreeBSD cluster machines had a calibration error of +-10% when they used the lapic timecounter. - after each wakeup, check the time using CLOCK_REALTIME (nanotime()) instead of using CLOCK_MONOTONIC_FAST_N_BROKEN (getnanouptime()). With the new API, the above can still be done, but requires heavier semantic fudging: - still break up long sleeps. Now the sleepq_set_timeout_bt() takes an absolute uptime where sleepq_set_timeout() takes a relative tick count. We still want a relative realtime, so the semantic mismatch is larger. But we can fudge it to essentially the same as before. We break up the relative realtime so that the absolute uptime is not very far in the future. Now we get errors from CLOCK_MONOTONIC being stopped instead of the ticks counter being stopped. - after each wakeup, check the time using CLOCK_REALTIME (bintime()) not quite as before instead of using CLOCK_MONOTONIC_FAST (binuptime()) not quite as before. Note that the new code has already switched from CLOCK_MONOTONIC_FAST_N_BROKEN to CLOCK_MONOTONIC. This seems to be because the new timeout code uses CLOCK_MONOTONIC internally since CLOCK_MONOTONIC_FAST_N_BROKEN is not accurate enough for some cases, and all external uses should use the same clock. nanosleep() should use a precise clock for the check, but it can use an imprecise one for setting up the timeout except for very short timeouts. Suppose that the timeout hasn't expired, so that we sleep again. With the old API, we had to calculate the new sleep in ticks. The code for this has been removed, and any new sleep would be to the same absolute uptime that was calculated for the first sleep. This completed turning the whole loop into nonsense -- the check and possible re-sleep used to be needed because the ticks clock is not precisely calibrated relative to the CLOCK_MONOTONIC_FAST_N_BROKEN clock, but now CLOCK_MONOTONIC is used for everything. CLOCK_MONOTONIC is consistently wrong, so sleepq_timewait_sig() shouldn't have returned unless the timeout has expired (or a signal). However, we are supposed to sleep on CLOCK_REALTIME, and have broken up long sleeps, so we much calculate a new absolute uptime using the correct clocks (new relative realtime fudged to absolute uptime) and loop. For both: - wait for someone to fix CLOCK_MONOTONIC and timeouts so that we get woken up as soon as possible after the system wakes up. Some of the above CLOCK_MONOTONICs should be CLOCK_UPTIME to match "uptime" in function names and descriptions, but I wanted to use a standard clock to get POSIX's specification of its non-brokenness (it must count deep sleep times). CLOCK_UPTIME can remain broken and become different from CLOCK_MONOTONIC when the latter is fixed, but this isn't very useful. CLOCK_UPTIME doesn't actually give uptimes when the boottime is moved. Bruce From owner-svn-src-projects@FreeBSD.ORG Sat Jun 9 23:51:26 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C994E1065670; Sat, 9 Jun 2012 23:51:26 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx06.syd.optusnet.com.au (fallbackmx06.syd.optusnet.com.au [211.29.132.8]) by mx1.freebsd.org (Postfix) with ESMTP id 369F98FC08; Sat, 9 Jun 2012 23:51:26 +0000 (UTC) Received: from mail28.syd.optusnet.com.au (mail28.syd.optusnet.com.au [211.29.133.169]) by fallbackmx06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q59Nk2YI014834; Sun, 10 Jun 2012 09:46:02 +1000 Received: from c122-106-171-232.carlnfd1.nsw.optusnet.com.au (c122-106-171-232.carlnfd1.nsw.optusnet.com.au [122.106.171.232]) by mail28.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id q59NjrFt013126 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 10 Jun 2012 09:45:54 +1000 Date: Sun, 10 Jun 2012 09:45:53 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Cherry G. Mathew" In-Reply-To: <201206091258.q59Cw0Kb033870@svn.freebsd.org> Message-ID: <20120610094048.Y1188@besplex.bde.org> References: <201206091258.q59Cw0Kb033870@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r236813 - projects/amd64_xen_pv/sys/amd64/include X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Jun 2012 23:51:26 -0000 On Sat, 9 Jun 2012, Cherry G. Mathew wrote: > Log: > Xen's "pseudo-physical" "ram" space is a fragmented by virtue of its bootstrap > sequence. vm requires this #define to stitching up the pieces into the > kva while booting up. See: vm_page.c:vm_page_startup() > > Approved by: gibbs (implicit) > > Modified: > projects/amd64_xen_pv/sys/amd64/include/vmparam.h > > Modified: projects/amd64_xen_pv/sys/amd64/include/vmparam.h > ============================================================================== > --- projects/amd64_xen_pv/sys/amd64/include/vmparam.h Sat Jun 9 12:27:30 2012 (r236812) > +++ projects/amd64_xen_pv/sys/amd64/include/vmparam.h Sat Jun 9 12:58:00 2012 (r236813) > @@ -79,7 +79,11 @@ > /* > * The physical address space is densely populated. > */ > +#ifndef XEN > #define VM_PHYSSEG_DENSE > +#else /* XEN */ > +#define VM_PHYSSEG_SPARSE > +#endif See style(9). The style bugs here are: - comment on #else for a short #ifdef - #ifndef instead of #ifdef when there is an #else - comment no longer matches code (or the log message). It applies to the whole ifdef, but the ifdef is manifestly for handling address spaces that are _not_ densely populated. Bruce