Re: biowaittime
Hi Ted, I really like the idea of gathering data about time spent waiting for a disk, but where do I find this data? Thank you, Navan On Apr 4, 2013, at 7:50 PM, Ted Unangst t...@tedunangst.com wrote: This is a stupid simple diff to see just how much time you spend waiting for your disk. If you're into measuring that kind of thing. Index: vfs_bio.c === RCS file: /cvs/src/sys/kern/vfs_bio.c,v retrieving revision 1.146 diff -u -p -r1.146 vfs_bio.c --- vfs_bio.c17 Feb 2013 17:39:29 -1.146 +++ vfs_bio.c5 Apr 2013 01:34:03 - @@ -1153,6 +1153,8 @@ buf_daemon(struct proc *p) } } +uint64_t biowaittime; + /* * Wait for operations on the buffer to complete. * When they do, extract and return the I/O's error value. @@ -1161,12 +1163,18 @@ int biowait(struct buf *bp) { int s; +struct timespec before, after, diff; KASSERT(!(bp-b_flags B_ASYNC)); s = splbio(); +nanotime(before); while (!ISSET(bp-b_flags, B_DONE)) tsleep(bp, PRIBIO + 1, biowait, 0); +nanotime(after); +timespecsub(after, before, diff); +biowaittime += diff.tv_nsec; +biowaittime += diff.tv_sec * 10L; splx(s); /* check for interruption of I/O (e.g. via NFS), then errors. */
include isa.h in sys/arch/i386/i386/trap.c
Hi, trap.c has a #if NISA 0 at line 504. But NISA is never defined, so the code in the #if clause never gets compiled in. This patch includes isa.h from the build directory in order to have the NISA definition. regards, chris Index: sys/arch/i386/i386/trap.c === RCS file: /cvs/src/sys/arch/i386/i386/trap.c,v retrieving revision 1.107 diff -u -r1.107 trap.c --- sys/arch/i386/i386/trap.c 31 Dec 2012 06:44:11 - 1.107 +++ sys/arch/i386/i386/trap.c 8 Apr 2013 09:38:49 - @@ -77,6 +77,7 @@ #endif #include npx.h +#include isa.h void trap(struct trapframe *); void syscall(struct trapframe *);
RSVP
Diff below removes code protected under RSVP_ISI that doesn't even compile. Anybody objecting to it's teduification? Any ok? Index: netinet/igmp.c === RCS file: /home/ncvs/src/sys/netinet/igmp.c,v retrieving revision 1.31 diff -u -p -r1.31 igmp.c --- netinet/igmp.c 20 Apr 2010 22:05:43 - 1.31 +++ netinet/igmp.c 8 Apr 2013 12:13:57 - @@ -603,9 +603,7 @@ igmp_sendpkt(struct in_multi *inm, int t imo.imo_multicast_ifp = inm-inm_ia-ia_ifp; imo.imo_multicast_ttl = 1; -#ifdef RSVP_ISI - imo.imo_multicast_vif = -1; -#endif + /* * Request loopback of the report if we are acting as a multicast * router, so that the process-level routing daemon can hear it. Index: netinet/ip_mroute.c === RCS file: /home/ncvs/src/sys/netinet/ip_mroute.c,v retrieving revision 1.60 diff -u -p -r1.60 ip_mroute.c --- netinet/ip_mroute.c 28 Mar 2013 16:45:16 - 1.60 +++ netinet/ip_mroute.c 8 Apr 2013 12:13:57 - @@ -130,12 +130,6 @@ u_int mrtdebug = 0; /* debug level * #defineVIFI_INVALID((vifi_t) -1) -#ifdef RSVP_ISI -u_int rsvpdebug = 0;/* rsvp debug level */ -extern struct socket *ip_rsvpd; -extern int rsvp_on; -#endif /* RSVP_ISI */ - #defineEXPIRE_TIMEOUT 250 /* 4x / second */ #defineUPCALL_EXPIRE 6 /* number of timeouts */ struct timeout expire_upcalls_ch; @@ -162,11 +156,7 @@ static int get_api_config(struct mbuf *) static int socket_send(struct socket *, struct mbuf *, struct sockaddr_in *); static void expire_upcalls(void *); -#ifdef RSVP_ISI -static int ip_mdq(struct mbuf *, struct ifnet *, struct mfc *, vifi_t); -#else static int ip_mdq(struct mbuf *, struct ifnet *, struct mfc *); -#endif static void phyint_send(struct ip *, struct vif *, struct mbuf *); static void encap_send(struct ip *, struct vif *, struct mbuf *); static void send_packet(struct vif *, struct mbuf *); @@ -879,11 +869,6 @@ add_vif(struct mbuf *m) timeout_del(vifp-v_repq_ch); -#ifdef RSVP_ISI - vifp-v_rsvp_on = 0; - vifp-v_rsvpd = NULL; -#endif /* RSVP_ISI */ - splx(s); /* Adjust numvifs up if the vifi is higher than numvifs. */ @@ -1138,11 +1123,7 @@ add_mfc(struct mbuf *m) for (; rte != NULL; rte = nrte) { nrte = rte-next; if (rte-ifp) { -#ifdef RSVP_ISI - ip_mdq(rte-m, rte-ifp, rt, -1); -#else ip_mdq(rte-m, rte-ifp, rt); -#endif /* RSVP_ISI */ } m_freem(rte-m); #ifdef UPCALL_TIMING @@ -1305,11 +1286,7 @@ socket_send(struct socket *s, struct mbu #define TUNNEL_LEN 12 /* # bytes of IP option for tunnel encapsulation */ int -#ifdef RSVP_ISI -ip_mforward(struct mbuf *m, struct ifnet *ifp, struct ip_moptions *imo) -#else ip_mforward(struct mbuf *m, struct ifnet *ifp) -#endif /* RSVP_ISI */ { struct ip *ip = mtod(m, struct ip *); struct mfc *rt; @@ -1340,28 +1317,6 @@ ip_mforward(struct mbuf *m, struct ifnet return (1); } -#ifdef RSVP_ISI - if (imo ((vifi = imo-imo_multicast_vif) numvifs)) { - if (ip-ip_ttl MAXTTL) { - /* compensate for -1 in *_send routines */ - ip-ip_ttl++; - } - if (rsvpdebug ip-ip_p == IPPROTO_RSVP) { - struct vif *vifp = viftable + vifi; - printf(Sending IPPROTO_RSVP from %x to %x on - vif %d (%s%s)\n, - ntohl(ip-ip_src), ntohl(ip-ip_dst), vifi, - (vifp-v_flags VIFF_TUNNEL) ? tunnel on : , - vifp-v_ifp-if_xname); - } - return (ip_mdq(m, ifp, (struct mfc *)NULL, vifi)); - } - if (rsvpdebug ip-ip_p == IPPROTO_RSVP) { - printf(Warning: IPPROTO_RSVP from %x to %x without - vif option\n, ntohl(ip-ip_src), ntohl(ip-ip_dst)); - } -#endif /* RSVP_ISI */ - /* * Don't forward a packet with time-to-live of zero or one, * or a packet destined to a local-only group. @@ -1379,11 +1334,7 @@ ip_mforward(struct mbuf *m, struct ifnet /* Entry exists, so forward if necessary */ if (rt != NULL) { splx(s); -#ifdef RSVP_ISI - return (ip_mdq(m, ifp, rt, -1)); -#else return (ip_mdq(m, ifp, rt)); -#endif /* RSVP_ISI */ } else { /* * If we don't have a route for packet's origin, @@ -1603,11 +1554,7 @@ expire_upcalls(void *v) *
amd64/identcpu.c: Missing #ifdef CRYPTO for amd64_has_aesni
Hi there, I think the check whether the CPU has AES builtin misses an #ifdef CRYPTO as it is there for the declaration of amd64_has_aesni. -- Matthias Index: identcpu.c === RCS file: /cvs/src/sys/arch/amd64/amd64/identcpu.c,v retrieving revision 1.45 diff -u -p -r1.45 identcpu.c --- arch/amd64/amd64/identcpu.c 21 Mar 2013 19:43:14 - 1.45 +++ arch/amd64/amd64/identcpu.c 8 Apr 2013 13:11:03 - @@ -497,8 +497,10 @@ identifycpu(struct cpu_info *ci) if (cpu_ecxfeature CPUIDECX_EST) setperf_setup = est_init; +#ifdef CRYPTO if (cpu_ecxfeature CPUIDECX_AES) amd64_has_aesni = 1; +#endif if (cpu_ecxfeature CPUIDECX_RDRAND) has_rdrand = 1;
add ut/nut indent flags
The following adds ut/nut flags to indent to enable/disable tabs which seems to have originated in gnu indent. -nut seems to have quite a bit of usage and is currently assumed in the Mesa3D build when generating code. Diff based on FreeBSD svn rev 131184. Unrelated to this diff there seems to be a problem with indent when run on code like { tabint a; } the result is: { tabint tabtaba; } This behaviour is present without the diff and isn't addressed here. Index: args.c === RCS file: /cvs/src/usr.bin/indent/args.c,v retrieving revision 1.15 diff -u -p -r1.15 args.c --- args.c 27 Oct 2009 23:59:39 - 1.15 +++ args.c 8 Apr 2013 13:27:58 - @@ -135,6 +135,7 @@ struct pro { {nps, PRO_BOOL, false, OFF, pointer_as_binop }, {nsc, PRO_BOOL, true, OFF, star_comment_cont }, {nsob, PRO_BOOL, false, OFF, swallow_optional_blanklines }, + {nut, PRO_BOOL, true, OFF, use_tabs}, {nv, PRO_BOOL, false, OFF, verbose }, {pcs, PRO_BOOL, false, ON, proc_calls_space }, {psl, PRO_BOOL, true, ON, procnames_start_line }, @@ -143,6 +144,7 @@ struct pro { {sob, PRO_BOOL, false, ON, swallow_optional_blanklines }, {st, PRO_SPECIAL, 0, STDIN, 0 }, {troff, PRO_BOOL, false, ON, troff }, + {ut, PRO_BOOL, true, ON, use_tabs}, {v, PRO_BOOL, false, ON, verbose }, /* whew! */ { 0, 0, 0, 0, 0 } Index: indent.1 === RCS file: /cvs/src/usr.bin/indent/indent.1,v retrieving revision 1.20 diff -u -p -r1.20 indent.1 --- indent.117 Jan 2013 21:29:14 - 1.20 +++ indent.18 Apr 2013 13:28:15 - @@ -71,6 +71,7 @@ .Op Fl \st .Op Fl T Ns Ar typename .Op Fl troff +.Op Fl ut | Fl nut .Op Fl v | \nv .Ek .Sh DESCRIPTION @@ -384,6 +385,11 @@ to format the program for processing by producing a fancy listing. If the output file is not specified, the default is standard output, rather than formatting in place. +.It Fl ut , nut +Enables (disables) the use of tab characters in the output. +Tabs are assumed to be aligned on columns divisible by 8. +The default is +.Fl ut . .It Fl v , \nv .Fl v turns on Index: indent.c === RCS file: /cvs/src/usr.bin/indent/indent.c,v retrieving revision 1.20 diff -u -p -r1.20 indent.c --- indent.c27 Oct 2009 23:59:39 - 1.20 +++ indent.c8 Apr 2013 13:31:06 - @@ -73,6 +73,7 @@ main(int argc, char **argv) * without the matching : in a c?s:s * construct */ char *t_ptr; /* used for copying tokens */ +int tabs_to_var; /* true if using tabs to indent to var name */ int type_code; /* the type of token, returned by lexi */ int last_else = 0; /* true iff last keyword was an else */ @@ -891,6 +892,7 @@ check_type: * : i); */ dec_ind = ps.decl_indent 0 ? ps.decl_indent : i; + tabs_to_var = (use_tabs ? ps.decl_indent 0 : 0); goto copy_id; case ident: /* got an identifier or constant */ @@ -907,12 +909,43 @@ check_type: ps.dumped_decl_indent = 1; e_code += strlen(e_code); CHECK_SIZE_CODE; - } - else - while ((e_code - s_code) dec_ind) { + } else { + int cur_dec_ind; + int pos, startpos; + + /* +* in order to get the tab math right for +* indentations that are not multiples of 8 we +* need to modify both startpos and dec_ind +* (cur_dec_ind) here by eight minus the +* remainder of the current starting column +* divided by eight. This seems to be a +* properly working fix +*/ + startpos = e_code - s_code; + cur_dec_ind = dec_ind; + pos = startpos; + if ((ps.ind_level * ps.ind_size) % 8 != 0) { + pos += (ps.ind_level * ps.ind_size) % 8; + cur_dec_ind += (ps.ind_level * ps.ind_size) % 8; + } + + if (tabs_to_var) { + while ((pos ~7) + 8 = cur_dec_ind) { + CHECK_SIZE_CODE; + *e_code++ = '\t'; + pos = (pos ~7) + 8; + } +
Re: external ip/tcp (sysctl) variables
RCS file: /home/ncvs/src/sys/netinet/ip_var.h,v retrieving revision 1.44 diff -u -p -r1.44 ip_var.h --- netinet/ip_var.h 16 Jul 2012 18:05:36 - 1.44 +++ netinet/ip_var.h 8 Apr 2013 13:23:23 - @@ -149,8 +149,20 @@ extern struct ipstat ipstat; extern LIST_HEAD(ipqhead, ipq) ipq; /* ip reass. queue */ extern int ip_defttl; /* default IP ttl */ +extern struct socket *ip_mrouter; /* multicast routing daemon */ + extern int ip_mtudisc; /* mtu discovery */ extern u_int ip_mtudisc_timeout; /* seconds to timeout mtu discovery */ + +extern int ipport_firstauto; /* min port for port allocation */ +extern int ipport_lastauto; /* max port for port allocation */ +extern int ipport_hifirstauto; /* min dynamic/private port number */ +extern int ipport_hilastauto; /* max dynamic/private port number */ +extern int encdebug; /* enable message reporting */ +extern int ipforwarding; /* enable IP forwarding */ +extern int ipmforwarding; /* enable multicast forwarding */ previously, ipmforwarding and ip_mrouter were under #ifdef MROUTING is it normal to have them outside mentioned #ifdef in your diff?
Re: biowaittime
On Sun, Apr 07, 2013 at 22:31, Navan Carson wrote: Hi Ted, I really like the idea of gathering data about time spent waiting for a disk, but where do I find this data? (as root) pstat -d lld biowaittime it's not exported anywhere, at least not as part of that diff.
Possible relayd memory leak analysis
hi tech@ tools used: * ps auxwww | grep relayd * httperf --hog --server=192.168.5.201 --wsess=25,1000,0.1 --rate=50 --timeout=5 target machine: OpenBSD 5.3-current (GENERIC.MP) #0: Sun Apr 7 15:14:10 EEST 2013 *@*:/usr/src/sys/arch/amd64/compile/GENERIC.MP /etc/relayd.conf: ext_addr=192.168.5.201 webhost1=192.168.5.202 webhost2=192.168.5.203 prefork 2 table web { $webhost1 $webhost2 } http protocol proto_pool_http { header append $REMOTE_ADDR to X-Forwarded-For header append $SERVER_ADDR:$SERVER_PORT to X-Forwarded-By header change Connection to close } relay cluster_pool_http { listen on $ext_addr port www protocol proto_pool_http forward to web port www mode roundrobin check http /index.html host test.local code 200 } cold ps auxwww: root 31403 0.0 0.1 1160 1916 ?? Ss12:21AM0:00.03 relayd: parent (relayd) _relayd 18684 0.0 0.1 1044 2056 ?? S 12:21AM0:00.01 relayd: pfe (relayd) _relayd 29554 0.0 0.1 912 1948 ?? S 12:21AM0:00.01 relayd: hce (relayd) _relayd 7937 0.0 0.1 1108 2020 ?? S 12:21AM0:00.02 relayd: relay (relayd) _relayd 28352 0.0 0.1 1108 2036 ?? S 12:21AM0:00.00 relayd: relay (relayd) ps auxwww after 1st httperf run: _relayd 28352 4.1 0.6 10280 11672 ?? S 12:21AM0:08.83 relayd: relay (relayd) _relayd 7937 4.8 0.6 10620 12004 ?? S 12:21AM0:09.17 relayd: relay (relayd) root 31403 0.0 0.1 1160 1916 ?? Is12:21AM0:00.03 relayd: parent (relayd) _relayd 18684 0.0 0.1 1044 2056 ?? S 12:21AM0:00.02 relayd: pfe (relayd) _relayd 29554 0.0 0.1 912 1948 ?? S 12:21AM0:00.03 relayd: hce (relayd) ps auxwww after 2nd httperf run: _relayd 28352 1.5 1.0 19424 20816 ?? S 12:21AM0:17.77 relayd: relay (relayd) _relayd 7937 1.4 1.0 19724 21108 ?? S 12:21AM0:18.11 relayd: relay (relayd) root 31403 0.0 0.1 1160 1916 ?? Is12:21AM0:00.03 relayd: parent (relayd) _relayd 18684 0.0 0.1 1044 2056 ?? S 12:21AM0:00.02 relayd: pfe (relayd) _relayd 29554 0.0 0.1 912 1952 ?? S 12:21AM0:00.05 relayd: hce (relayd) on busy production setup relayd continuously leaks and eventually crashes.
Re: external ip/tcp (sysctl) variables
On Mon, Apr 8, 2013 at 6:30 AM, Martin Pieuchot mpieuc...@nolizard.org wrote: Diff below remove various external variable declaration from sources files and move them to the corresponding header with an appropriate comment if necessary. ok? I like the idea. I agree with Alexey about copying forward the #ifdefs. ... --- netinet/ip_icmp.c 18 Sep 2012 12:35:51 - 1.96 +++ netinet/ip_icmp.c 8 Apr 2013 13:23:23 - @@ -125,6 +125,9 @@ void icmp_mtudisc_timeout(struct rtentry int icmp_ratelimit(const struct in_addr *, const int, const int); void icmp_redirect_timeout(struct rtentry *, struct rttimer *); +/* from ip_input.c */ +extern u_char ip_protox[]; + extern struct protosw inetsw[]; No header file love for ip_protox and inetsw? (Ideally, IMO, the end result would only have 'extern' in top-level declarations in .h files) Philip Guenther
Re: amd64/identcpu.c: Missing #ifdef CRYPTO for amd64_has_aesni
On Mon, Apr 8, 2013 at 6:17 AM, Silamael silam...@coronamundi.de wrote: I think the check whether the CPU has AES builtin misses an #ifdef CRYPTO as it is there for the declaration of amd64_has_aesni. Yep. Diff committed. Thanks! Philip Guenther
Re: include isa.h in sys/arch/i386/i386/trap.c
On Mon, Apr 8, 2013 at 2:43 AM, Christian Groessler ch...@groessler.org wrote: trap.c has a #if NISA 0 at line 504. But NISA is never defined, so the code in the #if clause never gets compiled in. This patch includes isa.h from the build directory in order to have the NISA definition. Yep. Diff committed. Thanks! Philip Guenther
Re: libc warnings
On Thu, Apr 4, 2013 at 6:49 PM, Ted Unangst t...@tedunangst.com wrote: To prevent the future recurrence of some rather serious libc build bugs, such as a macro like strong_alias suddenly turning into an implicit function prototype, I think we should add some warnings and use as much -Werror as possible. (I'm not entirely sure this would have caught the missing strong_alias macro, but it seems like a good idea anyway.) This adds a (very) few warnings and fixes some of the fallout. The diff is a bit of a mix of things, since I initially tried -Wall before I ran away screaming. Over time, maybe some brave pioneers can expand the frontier. ... +CFLAGS+=-Wimplicit -Wparentheses -Wbounded -Werror The make release process builds parts of libc with extra #defines to disable stuff; have you done that with these flags to verify there aren't warnings in those chunks? --- regex/regcomp.c 7 Nov 2011 09:58:27 - 1.21 +++ regex/regcomp.c 5 Apr 2013 01:22:39 - @@ -171,8 +171,7 @@ regcomp(regex_t *preg, const char *patte len = strlen((char *)pattern); /* do the mallocs early so failure handling is easy */ - g = (struct re_guts *)malloc(sizeof(struct re_guts) + - (NC-1)*sizeof(cat_t)); + g = (struct re_guts *)malloc(sizeof(struct re_guts)); ... --- regex/regex2.h 30 Nov 2004 17:04:23 - 1.7 +++ regex/regex2.h 5 Apr 2013 01:22:39 - @@ -149,7 +149,7 @@ struct re_guts { int backrefs; /* does it use back references? */ sopno nplus;/* how deep does it nest +s? */ /* catspace must be last */ - cat_t catspace[1]; /* actually [NC] */ + cat_t catspace[NC]; /* actually [NC] */ }; Please tell me that used to actually _use_ the struct hack and didn't always allocate the full size! --- regex/regexec.c 5 Aug 2005 13:03:00 - 1.11 +++ regex/regexec.c 5 Apr 2013 01:22:39 - @@ -140,6 +140,8 @@ regexec(const regex_t *preg, const char regmatch_t pmatch[], int eflags) { struct re_guts *g = preg-re_g; + char *s = (char *)string; /* XXX fucking gcc XXX */ What's the real problem? gcc loses the cast when it inlines smatcher/lmatcher? --- rpc/xdr_rec.c 1 Sep 2010 14:43:34 - 1.15 +++ rpc/xdr_rec.c 5 Apr 2013 01:22:39 - @@ -409,6 +409,7 @@ xdrrec_destroy(XDR *xdrs) mem_free(rstrm, sizeof(RECSTREAM)); } +bool_t __xdrrec_getrec(XDR *xdrs, enum xprt_stat *statp, bool_t expectdata); It can't be made static? I see no other references in base; check xenocara and ask sthen@ to run a grep of the ports source... --- stdio/fputws.c 9 Nov 2009 00:18:27 - 1.5 +++ stdio/fputws.c 5 Apr 2013 01:22:39 - @@ -35,6 +35,8 @@ #include wchar.h #include local.h +wint_t __fputwc_unlock(wchar_t wc, FILE *fp); Why not add that to stdio/local.h? Philip Guenther