svn commit: r297662 - head/sys/netinet
Author: rrs Date: Thu Apr 7 09:10:34 2016 New Revision: 297662 URL: https://svnweb.freebsd.org/changeset/base/297662 Log: This is work done by Michael Tuexen and myself at the IETF. This adds the new I-Data (Interleaved Data) message. This allows a user to be able to have complete freedom from Head Of Line blocking that was previously there due to the in-ability to send multiple large messages without the TSN's being in sequence. The code as been tested with Michaels various packet drill scripts as well as inter-networking between the IETF's location in Argentina and Germany. Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_dtrace_define.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_indata.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_os_bsd.h head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctp_var.h head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Thu Apr 7 08:32:37 2016(r297661) +++ head/sys/netinet/sctp.h Thu Apr 7 09:10:34 2016(r297662) @@ -196,6 +196,9 @@ struct sctp_paramhdr { #define SCTP_SS_VALUE 0x1204 #define SCTP_CC_OPTION 0x1205 /* Options for CC * modules */ +/* For I-DATA */ +#define SCTP_INTERLEAVING_SUPPORTED0x1206 + /* read only */ #define SCTP_GET_SNDBUF_USE0x1101 #define SCTP_GET_STAT_LOG 0x1103 @@ -452,6 +455,7 @@ struct sctp_error_auth_invalid_hmac { /* EY nr_sack chunk id*/ #define SCTP_NR_SELECTIVE_ACK 0x10 /0x40 series ***/ +#define SCTP_IDATA 0x40 /0x80 series ***/ /* RFC5061 */ #defineSCTP_ASCONF_ACK 0x80 @@ -467,7 +471,7 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_FORWARD_CUM_TSN 0xc0 /* RFC5061 */ #define SCTP_ASCONF0xc1 - +#define SCTP_IFORWARD_CUM_TSN 0xc2 /* ABORT and SHUTDOWN COMPLETE FLAG */ #define SCTP_HAD_NO_TCB0x01 Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_constants.h Thu Apr 7 09:10:34 2016 (r297662) @@ -386,8 +386,8 @@ __FBSDID("$FreeBSD$"); /* align to 32-bit sizes */ #define SCTP_SIZE32(x) x) + 3) >> 2) << 2) -#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA) -#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA) +#define IS_SCTP_CONTROL(a) (((a)->chunk_type != SCTP_DATA) && ((a)->chunk_type != SCTP_IDATA)) +#define IS_SCTP_DATA(a) (((a)->chunk_type == SCTP_DATA) || ((a)->chunk_type == SCTP_IDATA)) /* SCTP parameter types */ @@ -886,12 +886,19 @@ __FBSDID("$FreeBSD$"); /* modular comparison */ /* See RFC 1982 for details. */ -#define SCTP_SSN_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ - ((a > b) && ((uint16_t)(a - b) < (1U<<15 -#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b)) -#define SCTP_TSN_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ - ((a > b) && ((uint32_t)(a - b) < (1U<<31 -#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b)) +#define SCTP_UINT16_GT(a, b) (((a < b) && ((uint16_t)(b - a) > (1U<<15))) || \ + ((a > b) && ((uint16_t)(a - b) < (1U<<15 +#define SCTP_UINT16_GE(a, b) (SCTP_UINT16_GT(a, b) || (a == b)) +#define SCTP_UINT32_GT(a, b) (((a < b) && ((uint32_t)(b - a) > (1U<<31))) || \ + ((a > b) && ((uint32_t)(a - b) < (1U<<31 +#define SCTP_UINT32_GE(a, b) (SCTP_UINT32_GT(a, b) || (a == b)) + +#define SCTP_SSN_GT(a, b) SCTP_UINT16_GT(a, b) +#define SCTP_SSN_GE(a, b) SCTP_UINT16_GE(a, b) +#define SCTP_TSN_GT(a, b) SCTP_UINT32_GT(a, b) +#define SCTP_TSN_GE(a, b) SCTP_UINT32_GE(a, b) +#define SCTP_MSGID_GT(o, a, b) ((o == 1) ? SCTP_UINT16_GT((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GT(a, b)) +#define SCTP_MSGID_GE(o, a, b) ((o == 1) ? SCTP_UINT16_GE((uint16_t)a, (uint16_t)b) : SCTP_UINT32_GE(a, b)) /* Mapping array manipulation routines */ #define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01) Modified: head/sys/netinet/sctp_dtrace_define.h == --- head/sys/netinet/sctp_dtrace_define.h Thu Apr 7 08:32:37 2016 (r297661) +++ head/sys/netinet/sctp_dtrace_define.h Thu Apr 7 09:10:34 2016
svn commit: r296476 - head/sys/netinet/tcp_stacks
Author: rrs Date: Tue Mar 8 00:16:34 2016 New Revision: 296476 URL: https://svnweb.freebsd.org/changeset/base/296476 Log: Fix a sneaky bug where we were missing an extern to get the rxt threshold.. and thus created our own defaulted to 0 :-( Sponsored by: Netflix Inc Modified: head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/tcp_stacks/fastpath.c == --- head/sys/netinet/tcp_stacks/fastpath.c Tue Mar 8 00:14:14 2016 (r296475) +++ head/sys/netinet/tcp_stacks/fastpath.c Tue Mar 8 00:16:34 2016 (r296476) @@ -124,7 +124,7 @@ __FBSDID("$FreeBSD$"); #include -const int tcprexmtthresh; +extern const int tcprexmtthresh; VNET_DECLARE(int, tcp_autorcvbuf_inc); #defineV_tcp_autorcvbuf_incVNET(tcp_autorcvbuf_inc) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r295927 - in head/sys/netinet: . tcp_stacks
Author: rrs Date: Tue Feb 23 17:53:39 2016 New Revision: 295927 URL: https://svnweb.freebsd.org/changeset/base/295927 Log: This fixes the fastpath code to have a better module initialization sequence when included in loader.conf. It also fixes it so that no matter if some one incorrectly specifies a load order, the lists and such will be initialized on demand at that time so no one can make that mistake. Reviewed by: hiren Differential Revision:D5189 Modified: head/sys/netinet/tcp_stacks/fastpath.c head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_stacks/fastpath.c == --- head/sys/netinet/tcp_stacks/fastpath.c Tue Feb 23 16:01:34 2016 (r295926) +++ head/sys/netinet/tcp_stacks/fastpath.c Tue Feb 23 17:53:39 2016 (r295927) @@ -2453,4 +2453,4 @@ static moduledata_t new_tcp_fastpaths = }; MODULE_VERSION(kern_tcpfastpaths, 1); -DECLARE_MODULE(kern_tcpfastpaths, new_tcp_fastpaths, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(kern_tcpfastpaths, new_tcp_fastpaths, SI_SUB_PROTO_DOMAIN, SI_ORDER_ANY); Modified: head/sys/netinet/tcp_subr.c == --- head/sys/netinet/tcp_subr.c Tue Feb 23 16:01:34 2016(r295926) +++ head/sys/netinet/tcp_subr.c Tue Feb 23 17:53:39 2016(r295927) @@ -263,9 +263,20 @@ static struct tcp_function_block tcp_def 0 }; +int t_functions_inited = 0; struct tcp_funchead t_functions; static struct tcp_function_block *tcp_func_set_ptr = &tcp_def_funcblk; +static void +init_tcp_functions() +{ + if (t_functions_inited == 0) { + TAILQ_INIT(&t_functions); + rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0); + t_functions_inited = 1; + } +} + static struct tcp_function_block * find_tcp_functions_locked(struct tcp_function_set *fs) { @@ -503,6 +514,9 @@ register_tcp_functions(struct tcp_functi struct tcp_function *n; struct tcp_function_set fs; + if (t_functions_inited == 0) { + init_tcp_functions(); + } if ((blk->tfb_tcp_output == NULL) || (blk->tfb_tcp_do_segment == NULL) || (blk->tfb_tcp_ctloutput == NULL) || @@ -681,8 +695,7 @@ tcp_init(void) tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; tcp_tcbhashsize = hashsize; /* Setup the tcp function block list */ - TAILQ_INIT(&t_functions); - rw_init_flags(&tcp_function_lock, "tcp_func_lock" , 0); + init_tcp_functions(); register_tcp_functions(&tcp_def_funcblk, M_WAITOK); if (tcp_soreceive_stream) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r292336 - head/sys/netinet/tcp_stacks
Author: rrs Date: Wed Dec 16 15:16:44 2015 New Revision: 292336 URL: https://svnweb.freebsd.org/changeset/base/292336 Log: Remove redundant extern's that make the ppc compile fail. Thanks Ed Maste for the heads up. Modified: head/sys/netinet/tcp_stacks/fastpath.c Modified: head/sys/netinet/tcp_stacks/fastpath.c == --- head/sys/netinet/tcp_stacks/fastpath.c Wed Dec 16 14:22:00 2015 (r292335) +++ head/sys/netinet/tcp_stacks/fastpath.c Wed Dec 16 15:16:44 2015 (r292336) @@ -142,31 +142,6 @@ VNET_DECLARE(int, tcp_insecure_rst); VNET_DECLARE(int, tcp_insecure_syn); #defineV_tcp_insecure_syn VNET(tcp_insecure_syn) - - - -extern voidtcp_dooptions(struct tcpopt *, u_char *, int, int); -extern voidtcp_dropwithreset(struct mbuf *, struct tcphdr *, -struct tcpcb *, int, int); -extern voidtcp_pulloutofband(struct socket *, -struct tcphdr *, struct mbuf *, int); -extern voidtcp_xmit_timer(struct tcpcb *, int); -extern voidtcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *); -extern voidtcp_mss(struct tcpcb *tp, int offer); -extern voidcc_ack_received(struct tcpcb *tp, struct tcphdr *th, - uint16_t type); -extern void cc_conn_init(struct tcpcb *tp); -extern void cc_post_recovery(struct tcpcb *tp, struct tcphdr *th); -extern void cc_cong_signal(struct tcpcb *tp, struct tcphdr *th, uint32_t type); -extern void hhook_run_tcp_est_in(struct tcpcb *tp, -struct tcphdr *th, struct tcpopt *to); - -extern void kmod_tcpstat_inc(int statnum); -#ifdef TCP_SIGNATURE -extern int tcp_signature_verify_input(struct mbuf *m, int off0, int tlen, int optlen, -struct tcpopt *to, struct tcphdr *th, u_int tcpbflag); -#endif - static void tcp_do_segment_fastslow(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int, int, uint8_t, int); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r292309 - in head/sys: modules modules/tcp modules/tcp/fastpath netinet netinet/tcp_stacks
r292336 should take care of that let me know if it does not.. I am getting on a plane to head back from CA. to S.C. shortly but I will be online for a couple more hours :-) R On Dec 16, 2015, at 6:00 AM, Ed Maste wrote: > On 16 December 2015 at 00:56, Randall Stewart wrote: >> Author: rrs >> Date: Wed Dec 16 00:56:45 2015 >> New Revision: 292309 >> URL: https://svnweb.freebsd.org/changeset/base/292309 >> >> Log: >> First cut of the modularization of our TCP stack. Still >> to do is to clean up the timer handling using the async-drain. >> Other optimizations may be coming to go with this. Whats here >> will allow differnet tcp implementations (one included). >> Reviewed by: jtl, hiren, transports >> Sponsored by: Netflix Inc. >> Differential Revision:D4055 > > This broke at least powerpc builds: > > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:148: > warning: redundant redeclaration of 'tcp_dooptions' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:736: warning: > previous declaration of 'tcp_dooptions' was here > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:150: > warning: redundant redeclaration of 'tcp_dropwithreset' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:738: warning: > previous declaration of 'tcp_dropwithreset' was here > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:152: > warning: redundant redeclaration of 'tcp_pulloutofband' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:740: warning: > previous declaration of 'tcp_pulloutofband' was here > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:153: > warning: redundant redeclaration of 'tcp_xmit_timer' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:741: warning: > previous declaration of 'tcp_xmit_timer' was here > ... Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r292309 - in head/sys: modules modules/tcp modules/tcp/fastpath netinet netinet/tcp_stacks
Ahh I think I see this is a difference between our friend clang and gcc.. since I bet ppc uses gcc not clang :-o I will have something for you in a sec.. sorry about that Ed R This is the difference between On Dec 16, 2015, at 6:00 AM, Ed Maste wrote: > On 16 December 2015 at 00:56, Randall Stewart wrote: >> Author: rrs >> Date: Wed Dec 16 00:56:45 2015 >> New Revision: 292309 >> URL: https://svnweb.freebsd.org/changeset/base/292309 >> >> Log: >> First cut of the modularization of our TCP stack. Still >> to do is to clean up the timer handling using the async-drain. >> Other optimizations may be coming to go with this. Whats here >> will allow differnet tcp implementations (one included). >> Reviewed by: jtl, hiren, transports >> Sponsored by: Netflix Inc. >> Differential Revision:D4055 > > This broke at least powerpc builds: > > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:148: > warning: redundant redeclaration of 'tcp_dooptions' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:736: warning: > previous declaration of 'tcp_dooptions' was here > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:150: > warning: redundant redeclaration of 'tcp_dropwithreset' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:738: warning: > previous declaration of 'tcp_dropwithreset' was here > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:152: > warning: redundant redeclaration of 'tcp_pulloutofband' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:740: warning: > previous declaration of 'tcp_pulloutofband' was here > /scratch/tmp/emaste/freebsd/sys/modules/tcp/fastpath/../../../netinet/tcp_stacks/fastpath.c:153: > warning: redundant redeclaration of 'tcp_xmit_timer' > [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/netinet/tcp_var.h:741: warning: > previous declaration of 'tcp_xmit_timer' was here > ... Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r292309 - in head/sys: modules modules/tcp modules/tcp/fastpath netinet netinet/tcp_stacks
Author: rrs Date: Wed Dec 16 00:56:45 2015 New Revision: 292309 URL: https://svnweb.freebsd.org/changeset/base/292309 Log: First cut of the modularization of our TCP stack. Still to do is to clean up the timer handling using the async-drain. Other optimizations may be coming to go with this. Whats here will allow differnet tcp implementations (one included). Reviewed by: jtl, hiren, transports Sponsored by: Netflix Inc. Differential Revision:D4055 Added: head/sys/modules/tcp/ head/sys/modules/tcp/fastpath/ head/sys/modules/tcp/fastpath/Makefile (contents, props changed) head/sys/netinet/tcp_stacks/ head/sys/netinet/tcp_stacks/fastpath.c (contents, props changed) Modified: head/sys/modules/Makefile head/sys/netinet/tcp.h head/sys/netinet/tcp_input.c head/sys/netinet/tcp_sack.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/netinet/toecore.c Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Wed Dec 16 00:56:38 2015(r292308) +++ head/sys/modules/Makefile Wed Dec 16 00:56:45 2015(r292309) @@ -346,6 +346,7 @@ SUBDIR= \ ${_syscons} \ sysvipc \ ${_ti} \ + tcp/fastpath \ tests/framework \ tests/callout_test \ tl \ Added: head/sys/modules/tcp/fastpath/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/tcp/fastpath/Makefile Wed Dec 16 00:56:45 2015 (r292309) @@ -0,0 +1,15 @@ +# +# $FreeBSD$ +# + +.PATH: ${.CURDIR}/../../../netinet/tcp_stacks + +KMOD= fastpath +SRCS= fastpath.c + +# +# Enable full debugging +# +#CFLAGS += -g + +.include Modified: head/sys/netinet/tcp.h == --- head/sys/netinet/tcp.h Wed Dec 16 00:56:38 2015(r292308) +++ head/sys/netinet/tcp.h Wed Dec 16 00:56:45 2015(r292309) @@ -167,7 +167,7 @@ struct tcphdr { #defineTCP_KEEPCNT 1024/* L,N number of keepalives before close */ #defineTCP_PCAP_OUT2048/* number of output packets to keep */ #defineTCP_PCAP_IN 4096/* number of input packets to keep */ - +#define TCP_FUNCTION_BLK 8192 /* Set the tcp function pointers to the specified stack */ /* Start of reserved space for third-party user-settable options. */ #defineTCP_VENDOR SO_VENDOR @@ -245,5 +245,11 @@ struct tcp_info { u_int32_t __tcpi_pad[26]; /* Padding. */ }; #endif +#define TCP_FUNCTION_NAME_LEN_MAX 32 + +struct tcp_function_set { + char function_set_name[TCP_FUNCTION_NAME_LEN_MAX]; + uint32_t pcbcnt; +}; #endif /* !_NETINET_TCP_H_ */ Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cWed Dec 16 00:56:38 2015 (r292308) +++ head/sys/netinet/tcp_input.cWed Dec 16 00:56:45 2015 (r292309) @@ -230,23 +230,6 @@ VNET_DEFINE(struct inpcbhead, tcb); #definetcb6tcb /* for KAME src sync over BSD*'s */ VNET_DEFINE(struct inpcbinfo, tcbinfo); -static void tcp_dooptions(struct tcpopt *, u_char *, int, int); -static void tcp_do_segment(struct mbuf *, struct tcphdr *, -struct socket *, struct tcpcb *, int, int, uint8_t, -int); -static void tcp_dropwithreset(struct mbuf *, struct tcphdr *, -struct tcpcb *, int, int); -static void tcp_pulloutofband(struct socket *, -struct tcphdr *, struct mbuf *, int); -static void tcp_xmit_timer(struct tcpcb *, int); -static void tcp_newreno_partial_ack(struct tcpcb *, struct tcphdr *); -static void inline cc_ack_received(struct tcpcb *tp, struct tcphdr *th, - uint16_t type); -static void inline cc_conn_init(struct tcpcb *tp); -static void inline cc_post_recovery(struct tcpcb *tp, struct tcphdr *th); -static void inline hhook_run_tcp_est_in(struct tcpcb *tp, - struct tcphdr *th, struct tcpopt *to); - /* * TCP statistics are stored in an "array" of counter(9)s. */ @@ -272,7 +255,7 @@ kmod_tcpstat_inc(int statnum) /* * Wrapper for the TCP established input helper hook. */ -static void inline +void hhook_run_tcp_est_in(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) { struct tcp_hhook_data hhook_data; @@ -290,7 +273,7 @@ hhook_run_tcp_est_in(struct tcpcb *tp, s /* * CC wrapper hook functions */ -static void inline +void cc_ack_received(struct tcpcb *tp, struct tcphdr *th, uint16_t type) { INP_WLOCK_ASSERT(tp->t_inpcb); @@ -322,7 +305,7 @@
svn commit: r292070 - head/sys/dev/hwpmc
Author: rrs Date: Fri Dec 11 01:21:32 2015 New Revision: 292070 URL: https://svnweb.freebsd.org/changeset/base/292070 Log: More fixes in the various intel processors, fixing missing IAP_F_FM's as well as incorrect umask specifications for some of the new Broadwell/Skylake PMC's. Also silvermont had a *lot* of missing IAP_F_FM. Sponsored by: Netflix Inc. Modified: head/sys/dev/hwpmc/hwpmc_core.c Modified: head/sys/dev/hwpmc/hwpmc_core.c == --- head/sys/dev/hwpmc/hwpmc_core.c Fri Dec 11 00:04:13 2015 (r292069) +++ head/sys/dev/hwpmc/hwpmc_core.c Fri Dec 11 01:21:32 2015 (r292070) @@ -634,20 +634,20 @@ static struct iap_event_descr iap_events IAPDESCR(03H_10H, 0x03, 0x10, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_SB | IAP_F_SBX | IAP_F_CAS), IAPDESCR(03H_20H, 0x03, 0x20, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_CAS), -IAPDESCR(03H_40H, 0x03, 0x40, IAP_F_CAS), -IAPDESCR(03H_80H, 0x03, 0x80, IAP_F_CAS), +IAPDESCR(03H_40H, 0x03, 0x40, IAP_F_FM | IAP_F_CAS), +IAPDESCR(03H_80H, 0x03, 0x80, IAP_F_FM | IAP_F_CAS), IAPDESCR(04H_00H, 0x04, 0x00, IAP_F_FM | IAP_F_CC | IAP_F_CAS), IAPDESCR(04H_01H, 0x04, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O | IAP_F_CAS), IAPDESCR(04H_02H, 0x04, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_CAS), -IAPDESCR(04H_04H, 0x04, 0x04, IAP_F_CAS), +IAPDESCR(04H_04H, 0x04, 0x04, IAP_F_FM | IAP_F_CAS), IAPDESCR(04H_07H, 0x04, 0x07, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(04H_08H, 0x04, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_CAS), -IAPDESCR(04H_10H, 0x04, 0x10, IAP_F_CAS), -IAPDESCR(04H_20H, 0x04, 0x20, IAP_F_CAS), -IAPDESCR(04H_40H, 0x04, 0x40, IAP_F_CAS), -IAPDESCR(04H_80H, 0x04, 0x80, IAP_F_CAS), +IAPDESCR(04H_10H, 0x04, 0x10, IAP_F_FM | IAP_F_CAS), +IAPDESCR(04H_20H, 0x04, 0x20, IAP_F_FM | IAP_F_CAS), +IAPDESCR(04H_40H, 0x04, 0x40, IAP_F_FM | IAP_F_CAS), +IAPDESCR(04H_80H, 0x04, 0x80, IAP_F_FM | IAP_F_CAS), IAPDESCR(05H_00H, 0x05, 0x00, IAP_F_FM | IAP_F_CC), IAPDESCR(05H_01H, 0x05, 0x01, IAP_F_FM | IAP_F_I7O | IAP_F_SB | IAP_F_IB | @@ -690,7 +690,7 @@ static struct iap_event_descr iap_events IAPDESCR(08H_08H, 0x08, 0x08, IAP_F_FM | IAP_F_CA | IAP_F_CC2), IAPDESCR(08H_09H, 0x08, 0x09, IAP_F_FM | IAP_F_CA), IAPDESCR(08H_0EH, 0x08, 0x0E, IAP_F_FM | IAP_F_HW | IAP_F_HWX | IAP_F_SL), -IAPDESCR(08H_10H, 0x08, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | +IAPDESCR(08H_10H, 0x08, 0x10, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_SBX | IAP_F_HW | IAP_F_HWX | IAP_F_BW | IAP_F_BWX | IAP_F_SL), IAPDESCR(08H_20H, 0x08, 0x20, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_HW | IAP_F_HWX | IAP_F_BW | IAP_F_BWX | IAP_F_SL), @@ -700,7 +700,7 @@ static struct iap_event_descr iap_events IAPDESCR(08H_81H, 0x08, 0x81, IAP_F_FM | IAP_F_IB | IAP_F_IBX), IAPDESCR(08H_82H, 0x08, 0x82, IAP_F_FM | IAP_F_IB | IAP_F_IBX), IAPDESCR(08H_84H, 0x08, 0x84, IAP_F_FM | IAP_F_IB | IAP_F_IBX), -IAPDESCR(08H_88H, 0x08, 0x88, IAP_F_IB | IAP_F_IBX), +IAPDESCR(08H_88H, 0x08, 0x88, IAP_F_FM | IAP_F_IB | IAP_F_IBX), IAPDESCR(09H_01H, 0x09, 0x01, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O), IAPDESCR(09H_02H, 0x09, 0x02, IAP_F_FM | IAP_F_CA | IAP_F_CC2 | IAP_F_I7O), @@ -719,7 +719,7 @@ static struct iap_event_descr iap_events IAPDESCR(0DH_03H, 0x0D, 0x01, IAP_F_FM | IAP_F_SB | IAP_F_SBX | IAP_F_HW | IAP_F_IB | IAP_F_IBX | IAP_F_HWX | IAP_F_BW | IAP_F_BWX), IAPDESCR(0DH_40H, 0x0D, 0x40, IAP_F_FM | IAP_F_SB | IAP_F_SBX), -IAPDESCR(0DH_80H, 0x0D, 0x00, IAP_F_FM | IAP_F_SL), +IAPDESCR(0DH_80H, 0x0D, 0x80, IAP_F_FM | IAP_F_SL), IAPDESCR(0EH_01H, 0x0E, 0x01, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW | IAP_F_HWX | @@ -830,8 +830,8 @@ static struct iap_event_descr iap_events IAPDESCR(24H_30H, 0x24, 0x30, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX | IAP_F_HW | IAP_F_HWX | IAP_F_BW | IAP_F_BWX), -IAPDESCR(24H_38H, 0x24, 0x00, IAP_F_FM | IAP_F_SL), -IAPDESCR(24H_3FH, 0x24, 0x00, IAP_F_FM | IAP_F_HW | IAP_F_HWX | IAP_F_SL), +IAPDESCR(24H_38H, 0x24, 0x38, IAP_F_FM | IAP_F_SL), +IAPDESCR(24H_3FH, 0x24, 0x3F, IAP_F_FM | IAP_F_HW | IAP_F_HWX | IAP_F_SL), IAPDESCR(24H_40H, 0x24, 0x40, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX), IAPDESCR(24H_41H, 0x24, 0x41, IAP_F_FM | IAP_F_HW | IAP_F_HWX | @@ -845,7 +845,7 @@ static struct iap_event_descr iap_events IAPDESCR(24H_AAH, 0x24, 0xAA, IAP_F_FM | IAP_F_I7 | IAP_F_WM), IAPDESCR(24H_C0H, 0x24, 0xC0, IAP_F_FM | IAP_F_I7 | IAP_F_WM | IAP_F_SB | IAP_F_IB | IAP_F_SBX | IAP_F_IBX), -IAPDESCR(24H_D8H, 0x24, 0x00, IAP_F_FM | IAP_F_SL), +IAPDESCR(24H_D8H,
svn commit: r292043 - head/usr.sbin/pmcstudy
Author: rrs Date: Thu Dec 10 01:52:29 2015 New Revision: 292043 URL: https://svnweb.freebsd.org/changeset/base/292043 Log: Fix several typos and bugs within pmcstudy. Also highlight the one SB test that is failing (and is likely a problem in the actual PMC defintions). Add to this also the -A option to run all canned tests. Sponsored by: Netflix Inc. Modified: head/usr.sbin/pmcstudy/pmcstudy.8 head/usr.sbin/pmcstudy/pmcstudy.c Modified: head/usr.sbin/pmcstudy/pmcstudy.8 == --- head/usr.sbin/pmcstudy/pmcstudy.8 Thu Dec 10 01:41:05 2015 (r292042) +++ head/usr.sbin/pmcstudy/pmcstudy.8 Thu Dec 10 01:52:29 2015 (r292043) @@ -32,7 +32,7 @@ .Nd Perform various studies on a system's overall PMCs. .Sh SYNOPSIS .Nm -.Oo Fl i Ar inputfile | Fl T | Fl v | Fl m Ar max | Fl e exp | Fl Ar E | Fl h | fl H Oc +.Oo Fl i Ar inputfile | Fl A | Fl T | Fl v | Fl m Ar max | Fl e exp | Fl Ar E | Fl h | fl H Oc .Nm .Fl i Ar inputfile .Nm @@ -128,6 +128,8 @@ test like "UOPS_RETIRED.RETIRE_SLOTS / (4 * CPU_CLK_UNHALTED.THREAD_P)". .It Fl L This option will list all known PMCs and their abbreviation (%NNN). +.It Fl A +Run all canned tests. .El .Sh SEE ALSO .Xr pmc 3 , Modified: head/usr.sbin/pmcstudy/pmcstudy.c == --- head/usr.sbin/pmcstudy/pmcstudy.c Thu Dec 10 01:41:05 2015 (r292042) +++ head/usr.sbin/pmcstudy/pmcstudy.c Thu Dec 10 01:52:29 2015 (r292043) @@ -38,6 +38,9 @@ #include "eval_expr.h" __FBSDID("$FreeBSD$"); +static int max_pmc_counters = 1; +static int run_all = 0; + #define MAX_COUNTER_SLOTS 1024 #define MAX_NLEN 64 #define MAX_CPU 64 @@ -45,20 +48,20 @@ static int verbose = 0; extern char **environ; extern struct expression *master_exp; -struct expression *master_exp = NULL; +struct expression *master_exp=NULL; #define PMC_INITIAL_ALLOC 512 extern char **valid_pmcs; char **valid_pmcs = NULL; extern int valid_pmc_cnt; -int valid_pmc_cnt = 0; +int valid_pmc_cnt=0; extern int pmc_allocated_cnt; -int pmc_allocated_cnt = 0; +int pmc_allocated_cnt=0; /* * The following two varients on popen and pclose with * the cavet that they get you the PID so that you - * can supply it to pclose so it can send a SIGTERM + * can supply it to pclose so it can send a SIGTERM * to the process. */ static FILE * @@ -75,7 +78,7 @@ my_popen(const char *command, const char if ((strcmp(dir, "r") != 0) && (strcmp(dir, "w") != 0)) { errno = EINVAL; - return (NULL); + return(NULL); } if (pipe(pdesin) < 0) return (NULL); @@ -94,14 +97,14 @@ my_popen(const char *command, const char argv[3] = NULL; switch (pid = fork()) { - case -1:/* Error. */ + case -1:/* Error. */ (void)close(pdesin[0]); (void)close(pdesin[1]); (void)close(pdesout[0]); (void)close(pdesout[1]); return (NULL); /* NOTREACHED */ - case 0: /* Child. */ + case 0: /* Child. */ /* Close out un-used sides */ (void)close(pdesin[1]); (void)close(pdesout[0]); @@ -129,8 +132,8 @@ my_popen(const char *command, const char (void)close(pdesin[0]); (void)close(pdesout[0]); (void)close(pdesout[1]); - return (io_out); - } else { + return(io_out); + } else { /* Prepare the input stream */ io_in = fdopen(pdesout[0], "r"); (void)close(pdesout[1]); @@ -146,7 +149,7 @@ my_popen(const char *command, const char * if already `pclosed', or waitpid returns an error. */ static void -my_pclose(FILE * io, pid_t the_pid) +my_pclose(FILE *io, pid_t the_pid) { int pstat; pid_t pid; @@ -164,41 +167,41 @@ my_pclose(FILE * io, pid_t the_pid) struct counters { struct counters *next_cpu; - char counter_name[MAX_NLEN];/* Name of counter */ - int cpu;/* CPU we are on */ - int pos;/* Index we are filling to. */ + char counter_name[MAX_NLEN];/* Name of counter */ + int cpu;/* CPU we are on */ + int pos;/* Index we are filling to. */ uint64_t vals[MAX_COUNTER_SLOTS]; /* Last 64 entries */ - uint64_t sum; /* Summary of entries */ + uint64_t sum; /* Summary of entries */ }; extern struct counters *glob_cpu[MAX_CPU]; struct counters *glob_cpu[MAX_CPU]; extern struct counters *cnts; -struct counters *cnts = NULL; +struct counters *cnts=NULL; exte
svn commit: r292035 - head
Author: rrs Date: Wed Dec 9 23:02:20 2015 New Revision: 292035 URL: https://svnweb.freebsd.org/changeset/base/292035 Log: Add a couple of spots I tend to look at and Michael for SCTP as well :-) Modified: head/MAINTAINERS Modified: head/MAINTAINERS == --- head/MAINTAINERSWed Dec 9 22:52:37 2015(r292034) +++ head/MAINTAINERSWed Dec 9 23:02:20 2015(r292035) @@ -70,6 +70,9 @@ sys/dev/ixgbe erj Pre-commit phabricator sys/dev/ixlerj Pre-commit phabricator review requested. sys/netinet/ip_carp.c glebius Pre-commit review recommended. sys/netpfil/pf kp,glebius Pre-commit review recommended. +sctp rrs,tuexen Pre-commit review requested (changes need to be backported to github). +pmcstudy(8)rrs Pre-commit review requested. +callout_*(9) rrs Pre-commit review requested -- becareful its tricksy code :o. usr.sbin/pkg pkg@Please coordinate behavior or flag changes with pkg team. lprgad Pre-commit review requested, particularly for lpd/recvjob.c and lpd/printjob.c. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r292033 - head/sys/dev/hwpmc
Author: rrs Date: Wed Dec 9 22:46:40 2015 New Revision: 292033 URL: https://svnweb.freebsd.org/changeset/base/292033 Log: Fix the tunable in logging so that if its pre-11 we have the proper line so the tunable is present. Sponsored by: Netflix Inc. Modified: head/sys/dev/hwpmc/hwpmc_logging.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c == --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Dec 9 22:46:00 2015 (r292032) +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Dec 9 22:46:40 2015 (r292033) @@ -70,6 +70,9 @@ SYSCTL_DECL(_kern_hwpmc); */ static int pmclog_buffer_size = PMC_LOG_BUFFER_SIZE; +#if (__FreeBSD_version < 110) +TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "logbuffersize", &pmclog_buffer_size); +#endif SYSCTL_INT(_kern_hwpmc, OID_AUTO, logbuffersize, CTLFLAG_RDTUN, &pmclog_buffer_size, 0, "size of log buffers in kilobytes"); @@ -78,6 +81,9 @@ SYSCTL_INT(_kern_hwpmc, OID_AUTO, logbuf */ static int pmc_nlogbuffers = PMC_NLOGBUFFERS; +#if (__FreeBSD_version < 110) +TUNABLE_INT(PMC_SYSCTL_NAME_PREFIX "nbuffers", &pmc_nlogbuffers); +#endif SYSCTL_INT(_kern_hwpmc, OID_AUTO, nbuffers, CTLFLAG_RDTUN, &pmc_nlogbuffers, 0, "number of global log buffers"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r292029 - head/usr.sbin/pmcstudy
Author: rrs Date: Wed Dec 9 21:54:33 2015 New Revision: 292029 URL: https://svnweb.freebsd.org/changeset/base/292029 Log: Update the manual page to include Broadwell. Modified: head/usr.sbin/pmcstudy/pmcstudy.8 Modified: head/usr.sbin/pmcstudy/pmcstudy.8 == --- head/usr.sbin/pmcstudy/pmcstudy.8 Wed Dec 9 21:50:06 2015 (r292028) +++ head/usr.sbin/pmcstudy/pmcstudy.8 Wed Dec 9 21:54:33 2015 (r292029) @@ -59,8 +59,8 @@ PMCs and then run various formulas on th These formulas can be found in Intel documentation "Using Intel Vtune amplifier xe on NNN Generation Intel Core Processors". The NNN is either -2nd, 3rd or 4th generation i.e., Sandy Bridge, Ivy Bridge and Haswell. -Currently the program only works on these three Intel processor types. +2nd, 3rd, 4th or 5th generation i.e., Sandy Bridge, Ivy Bridge, Haswell and Broadwell. +Currently the program only works on these four Intel processor types. .Sh OPTIONS The following options are available: .Bl -tag -width indent ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r292028 - head/usr.sbin/pmcstudy
Author: rrs Date: Wed Dec 9 21:50:06 2015 New Revision: 292028 URL: https://svnweb.freebsd.org/changeset/base/292028 Log: White space changes. Modified: head/usr.sbin/pmcstudy/pmcstudy.c Modified: head/usr.sbin/pmcstudy/pmcstudy.c == --- head/usr.sbin/pmcstudy/pmcstudy.c Wed Dec 9 21:49:31 2015 (r292027) +++ head/usr.sbin/pmcstudy/pmcstudy.c Wed Dec 9 21:50:06 2015 (r292028) @@ -45,20 +45,20 @@ static int verbose = 0; extern char **environ; extern struct expression *master_exp; -struct expression *master_exp=NULL; +struct expression *master_exp = NULL; #define PMC_INITIAL_ALLOC 512 extern char **valid_pmcs; char **valid_pmcs = NULL; extern int valid_pmc_cnt; -int valid_pmc_cnt=0; +int valid_pmc_cnt = 0; extern int pmc_allocated_cnt; -int pmc_allocated_cnt=0; +int pmc_allocated_cnt = 0; /* * The following two varients on popen and pclose with * the cavet that they get you the PID so that you - * can supply it to pclose so it can send a SIGTERM + * can supply it to pclose so it can send a SIGTERM * to the process. */ static FILE * @@ -75,7 +75,7 @@ my_popen(const char *command, const char if ((strcmp(dir, "r") != 0) && (strcmp(dir, "w") != 0)) { errno = EINVAL; - return(NULL); + return (NULL); } if (pipe(pdesin) < 0) return (NULL); @@ -94,14 +94,14 @@ my_popen(const char *command, const char argv[3] = NULL; switch (pid = fork()) { - case -1:/* Error. */ + case -1:/* Error. */ (void)close(pdesin[0]); (void)close(pdesin[1]); (void)close(pdesout[0]); (void)close(pdesout[1]); return (NULL); /* NOTREACHED */ - case 0: /* Child. */ + case 0: /* Child. */ /* Close out un-used sides */ (void)close(pdesin[1]); (void)close(pdesout[0]); @@ -129,8 +129,8 @@ my_popen(const char *command, const char (void)close(pdesin[0]); (void)close(pdesout[0]); (void)close(pdesout[1]); - return(io_out); - } else { + return (io_out); + } else { /* Prepare the input stream */ io_in = fdopen(pdesout[0], "r"); (void)close(pdesout[1]); @@ -146,7 +146,7 @@ my_popen(const char *command, const char * if already `pclosed', or waitpid returns an error. */ static void -my_pclose(FILE *io, pid_t the_pid) +my_pclose(FILE * io, pid_t the_pid) { int pstat; pid_t pid; @@ -164,33 +164,33 @@ my_pclose(FILE *io, pid_t the_pid) struct counters { struct counters *next_cpu; - char counter_name[MAX_NLEN];/* Name of counter */ - int cpu;/* CPU we are on */ - int pos;/* Index we are filling to. */ + char counter_name[MAX_NLEN];/* Name of counter */ + int cpu;/* CPU we are on */ + int pos;/* Index we are filling to. */ uint64_t vals[MAX_COUNTER_SLOTS]; /* Last 64 entries */ - uint64_t sum; /* Summary of entries */ + uint64_t sum; /* Summary of entries */ }; extern struct counters *glob_cpu[MAX_CPU]; struct counters *glob_cpu[MAX_CPU]; extern struct counters *cnts; -struct counters *cnts=NULL; +struct counters *cnts = NULL; extern int ncnts; -int ncnts=0; +int ncnts = 0; -extern int (*expression)(struct counters *, int); -int (*expression)(struct counters *, int); +extern int (*expression) (struct counters *, int); +int (*expression) (struct counters *, int); -static const char *threshold=NULL; +static const char *threshold = NULL; static const char *command; struct cpu_entry { const char *name; const char *thresh; const char *command; - int (*func)(struct counters *, int); + int (*func) (struct counters *, int); }; @@ -198,7 +198,7 @@ struct cpu_type { char cputype[32]; int number; struct cpu_entry *ents; - void (*explain)(const char *name); + void (*explain) (const char *name); }; extern struct cpu_type the_cpu; struct cpu_type the_cpu; @@ -207,6 +207,7 @@ static void explain_name_sb(const char *name) { const char *mythresh; + if (strcmp(name, "allocstall1") == 0) { printf("Examine PARTIAL_RAT_STALLS.SLOW_LEA_WINDOW / CPU_CLK_UNHALTED.THREAD_P\n"); mythresh = "thresh > .05"; @@ -278,7 +279,7 @@ explain_name_sb(const char *name) } else { printf("Unknown name:%s\n", name); mythresh = "unknown entry"; -} + }
svn commit: r292027 - head/usr.sbin/pmcstudy
Author: rrs Date: Wed Dec 9 21:49:31 2015 New Revision: 292027 URL: https://svnweb.freebsd.org/changeset/base/292027 Log: Proper support of Broadwell tool by the pmc_study based on the Intel Itune guide for 5th generation processors. There is at least one formula missing in that guide, which I extrapolated and put a ? by in the help. Sponsored by: Netflix Inc Modified: head/usr.sbin/pmcstudy/pmcstudy.c Modified: head/usr.sbin/pmcstudy/pmcstudy.c == --- head/usr.sbin/pmcstudy/pmcstudy.c Wed Dec 9 21:38:26 2015 (r292026) +++ head/usr.sbin/pmcstudy/pmcstudy.c Wed Dec 9 21:49:31 2015 (r292027) @@ -443,7 +443,6 @@ explain_name_has(const char *name) printf("If the value printed is %s we may have the ability to improve performance\n", mythresh); } - static struct counters * find_counter(struct counters *base, const char *name) { @@ -590,6 +589,47 @@ br_mispredictib(struct counters *cpu, in } static int +br_mispredict_broad(struct counters *cpu, int pos) +{ + struct counters *brctr; + struct counters *unhalt; + struct counters *clear; + struct counters *uops; + struct counters *uops_ret; + struct counters *recv; + int ret; + double br, cl, uo, uo_r, re, con, un, res; + + con = 4.0; + + unhalt = find_counter(cpu, "CPU_CLK_UNHALTED.THREAD_P"); +brctr = find_counter(cpu, "BR_MISP_RETIRED.ALL_BRANCHES"); + clear = find_counter(cpu, "MACHINE_CLEARS.CYCLES"); + uops = find_counter(cpu, "UOPS_ISSUED.ANY"); + uops_ret = find_counter(cpu, "UOPS_RETIRED.RETIRE_SLOTS"); + recv = find_counter(cpu, "INT_MISC.RECOVERY_CYCLES"); + + if (pos != -1) { + un = unhalt->vals[pos] * 1.0; + br = brctr->vals[pos] * 1.0; + cl = clear->vals[pos] * 1.0; + uo = uops->vals[pos] * 1.0; + uo_r = uops_ret->vals[pos] * 1.0; + re = recv->vals[pos] * 1.0; + } else { + un = unhalt->sum * 1.0; + br = brctr->sum * 1.0; + cl = clear->sum * 1.0; + uo = uops->sum * 1.0; + uo_r = uops_ret->sum * 1.0; + re = recv->sum * 1.0; + } + res = br / (br + cl) * (uo - uo_r + con * re) / (un * con); + ret = printf("%1.3f", res); + return(ret); +} + +static int splitloadib(struct counters *cpu, int pos) { int ret; @@ -717,6 +757,35 @@ contested_has(struct counters *cpu, int return(ret); } +static int +contestedbroad(struct counters *cpu, int pos) +{ +/* 6 - (MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM * 84) / CPU_CLK_UNHALTED.THREAD_P (thresh >.05) */ + int ret; + struct counters *mem; + struct counters *mem2; + struct counters *unhalt; + double con, un, memd, memtoo, res; + + con = 84.0; + unhalt = find_counter(cpu, "CPU_CLK_UNHALTED.THREAD_P"); + mem = find_counter(cpu, "MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_HITM"); + mem2 = find_counter(cpu,"MEM_LOAD_UOPS_LLC_HIT_RETIRED.XSNP_MISS"); + + if (pos != -1) { + memd = mem->vals[pos] * 1.0; + memtoo = mem2->vals[pos] * 1.0; + un = unhalt->vals[pos] * 1.0; + } else { + memd = mem->sum * 1.0; + memtoo = mem2->sum * 1.0; + un = unhalt->sum * 1.0; + } + res = ((memd * con) + memtoo)/un; + ret = printf("%1.3f", res); + return(ret); +} + static int blockstoreforward(struct counters *cpu, int pos) @@ -898,6 +967,33 @@ cache2has(struct counters *cpu, int pos) } static int +cache2broad(struct counters *cpu, int pos) +{ +/* +* (29 * MEM_LOAD_UOPS_RETIRED.LLC_HIT / CPU_CLK_UNHALTED.THREAD_P (thresh >.2) +*/ + int ret; + struct counters *mem; + struct counters *unhalt; + double con, un, me, res; + + con = 36.0; + unhalt = find_counter(cpu, "CPU_CLK_UNHALTED.THREAD_P"); + mem = find_counter(cpu, "MEM_LOAD_UOPS_RETIRED.L3_HIT"); + if (pos != -1) { + me = mem->vals[pos] * 1.0; + un = unhalt->vals[pos] * 1.0; + } else { + me = mem->sum * 1.0; + un = unhalt->sum * 1.0; + } + res = (con * me)/un; + ret = printf("%1.3f", res); + return(ret); +} + + +static int cache1(struct counters *cpu, int pos) { /* 9 - (MEM_LOAD_UOPS_MISC_RETIRED.LLC_MISS * 180) / CPU_CLK_UNHALTED.THREAD_P (thresh >= .2) */ @@ -947,6 +1043,31 @@ cache1ib(struct counters *cpu, int pos) static int +cache1broad(struct counters *cpu, int pos) +{ + /* 9 - (MEM_LOAD_UOPS_L3_MISS_RETIRED.LCOAL_DRAM * 180) / CPU_CLK_UNHALTED.THREAD_P (thresh >= .2) */ + int ret; + struct counters *mem; + struct counters *unhalt; + double con, un, me,
svn commit: r291494 - in head: lib/libpmc sys/dev/hwpmc sys/sys
Author: rrs Date: Mon Nov 30 17:35:49 2015 New Revision: 291494 URL: https://svnweb.freebsd.org/changeset/base/291494 Log: Add support for Intel Skylake and Intel Broadwell PMC's. The Broadwell PMC's have been tested on the Broadwell-Xeon with a hacked up version of pmcstudy -T. I still need to circle back and add in to pmcstudy all the new tests from the Broadwell Vtune guide (for the hacked up version I just made it so I could run the -T option). The Skylake CPU is not yet available (even though Intel is advertising it .. imagine that). The Skylake PMC's will need to be tested once we can get a sample skylake CPU :-) Sponsored by: Netflix Inc. Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/pmc_events.h head/sys/sys/pmc.h Modified: head/lib/libpmc/libpmc.c == --- head/lib/libpmc/libpmc.cMon Nov 30 17:16:51 2015(r291493) +++ head/lib/libpmc/libpmc.cMon Nov 30 17:35:49 2015(r291494) @@ -217,6 +217,20 @@ static const struct pmc_event_descr hasw __PMC_EV_ALIAS_HASWELL_XEON() }; +static const struct pmc_event_descr broadwell_event_table[] = +{ + __PMC_EV_ALIAS_BROADWELL() +}; + +static const struct pmc_event_descr broadwell_xeon_event_table[] = +{ + __PMC_EV_ALIAS_BROADWELL_XEON() +}; + +static const struct pmc_event_descr skylake_event_table[] = +{ + __PMC_EV_ALIAS_SKYLAKE() +}; static const struct pmc_event_descr ivybridge_event_table[] = { @@ -258,6 +272,11 @@ static const struct pmc_event_descr hasw __PMC_EV_ALIAS_HASWELLUC() }; +static const struct pmc_event_descr broadwelluc_event_table[] = +{ + __PMC_EV_ALIAS_BROADWELLUC() +}; + static const struct pmc_event_descr sandybridgeuc_event_table[] = { __PMC_EV_ALIAS_SANDYBRIDGEUC() @@ -306,6 +325,9 @@ PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SO PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(haswell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(broadwell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(broadwell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(skylake, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); @@ -358,6 +380,9 @@ PMC_CLASS_TABLE_DESC(corei7, IAP, corei7 PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap); PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap); PMC_CLASS_TABLE_DESC(haswell_xeon, IAP, haswell_xeon, iap); +PMC_CLASS_TABLE_DESC(broadwell, IAP, broadwell, iap); +PMC_CLASS_TABLE_DESC(broadwell_xeon, IAP, broadwell_xeon, iap); +PMC_CLASS_TABLE_DESC(skylake, IAP, skylake, iap); PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap); PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap); PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); @@ -367,6 +392,7 @@ PMC_CLASS_TABLE_DESC(westmere_ex, IAP, w PMC_CLASS_TABLE_DESC(ucf, UCF, ucf, ucf); PMC_CLASS_TABLE_DESC(corei7uc, UCP, corei7uc, ucp); PMC_CLASS_TABLE_DESC(haswelluc, UCP, haswelluc, ucp); +PMC_CLASS_TABLE_DESC(broadwelluc, UCP, broadwelluc, ucp); PMC_CLASS_TABLE_DESC(sandybridgeuc, UCP, sandybridgeuc, ucp); PMC_CLASS_TABLE_DESC(westmereuc, UCP, westmereuc, ucp); #endif @@ -689,6 +715,12 @@ static struct pmc_event_alias core2_alia #define haswell_aliases_without_iafcore2_aliases_without_iaf #define haswell_xeon_aliases core2_aliases #define haswell_xeon_aliases_without_iaf core2_aliases_without_iaf +#define broadwell_aliases core2_aliases +#define broadwell_aliases_without_iaf core2_aliases_without_iaf +#define broadwell_xeon_aliases core2_aliases +#define broadwell_xeon_aliases_without_iaf core2_aliases_without_iaf +#define skylake_aliasescore2_aliases +#define skylake_aliases_without_iafcore2_aliases_without_iaf #define ivybridge_aliases core2_aliases #define ivybridge_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_xeon_aliases core2_aliases @@ -849,6 +881,7 @@ static struct pmc_masks iap_rsp_mask_sb_ NULLMASK }; +/* Broadwell is defined to use the same mask as Haswell */ static struct pmc_masks iap_rsp_mask_haswell[] = { PMCMASK(REQ_DMND_DATA_RD, (1ULL << 0)), PMCMASK(REQ_DMND_RFO, (1U
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
Done in 290805 R On Nov 13, 2015, at 4:51 PM, Alexander V. Chernikov wrote: > 14.11.2015, 00:41, "Randall Stewart" : >> Hmm >> >> callout_reset() returns either 0 or 1 >> >> It returns no other values and did not change.. maybe ti should say positive >> or one in the manual… >> >> I can add that to the fix patch. > It would be great :) > Also (just nitpicking) "return values" section of callout(9) still states > that callout_stop() returns non-zero value if the callout is pending. >> >> >> R >> On Nov 13, 2015, at 4:32 PM, Alexander V. Chernikov wrote: >> >>> >>> One small note on lltable: change in nd6_llinfo_settimer_locked() assumes >>> that callout_reset() returns >0 for stopped callout. The man page still >>> says "non-zero value" for that case. >>> (And that was the reason of writing comment to D4076 on inconsistent >>> callout_reset() return value). >>> >>> >>> >>> 14.11.2015, 00:19, "Randall Stewart" : >>>> So looking deeper something like the following (with Bryan’s patch) is in >>>> order. >>>> >>>> Though there is one place in the task code that looks funny since it was >>>> >>>> pending = !!callout_stop() >>>> >>>> I changed it to >>>> >>>> pending = !! (callout_stop > 0) >>>> >>>> But I wonder about the double !! that seems rather convoluted.. >>>> >>>> Unless someone objects I will commit this shortly >>>> R >>>> >>>> >>>> >>>> >>>> , >>>> >>>> On Nov 13, 2015, at 6:16 AM, Alexander V. Chernikov >>>> wrote: >>>> >>>>> >>>>> 10.11.2015, 17:49, "Randall Stewart" : >>>>>> >>>>>> Author: rrs >>>>>> Date: Tue Nov 10 14:49:32 2015 >>>>>> New Revision: 290664 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/290664 >>>>>> >>>>>> Log: >>>>>> Add new async_drain to the callout system. This is so-far not used but >>>>>> should be used by TCP for sure in its cleanup of the IN-PCB (will be >>>>>> coming shortly). >>>>> >>>>> Randall, this commit introduced change in callout_stop() which was not >>>>> mentioned in commit message. >>>>> This change has broken lltable arp/nd handling: deleting interface >>>>> address causes immediate panic. >>>>> I also see other other code/subsystems relying on callout_stop() return >>>>> value (netgraph, pfsync, iscsi). >>>>> I was not able to find any discussion/analysis/testing for these in D4076 >>>>> so this change does not look like being properly tested prior commiting.. >>>>> >>>>> >>>>> >>>>>> >>>>>> Sponsored by: Netflix Inc. >>>>>> Differential Revision: https://reviews.freebsd.org/D4076 >>>>>> >>>>>> Modified: >>>>>> head/share/man/man9/timeout.9 >>>>>> head/sys/kern/kern_timeout.c >>>>>> head/sys/sys/callout.h >>>>>> >>>>>> Modified: head/share/man/man9/timeout.9 >>>>>> == >>>>>> --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) >>>>>> +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) >>>>>> @@ -35,6 +35,7 @@ >>>>>> .Sh NAME >>>>>> .Nm callout_active , >>>>>> .Nm callout_deactivate , >>>>>> +.Nm callout_async_drain , >>>>>> .Nm callout_drain , >>>>>> .Nm callout_handle_init , >>>>>> .Nm callout_init , >>>>>> @@ -69,6 +70,8 @@ typedef void timeout_t (void *); >>>>>> .Ft void >>>>>> .Fn callout_deactivate "struct callout *c" >>>>>> .Ft int >>>>>> +.Fn callout_async_drain "struct callout *c" "timeout_t *drain" >>>>>> +.Ft int >>>>>> .Fn callout_drain "struct callout *c" >>>>>> .Ft void >>>>
svn commit: r290805 - in head: share/man/man9 sys/kern sys/net sys/netinet sys/netinet6 sys/netpfil/pf
Author: rrs Date: Fri Nov 13 22:51:35 2015 New Revision: 290805 URL: https://svnweb.freebsd.org/changeset/base/290805 Log: This fixes several places where callout_stops return is examined. The new return codes of -1 were mistakenly being considered "true". Callout_stop now returns -1 to indicate the callout had either already completed or was not running and 0 to indicate it could not be stopped. Also update the manual page to make it more consistent no non-zero in the callout_stop or callout_reset descriptions. MFC after:1 Month with associated callout change. Modified: head/share/man/man9/timeout.9 head/sys/kern/subr_taskqueue.c head/sys/net/if_llatbl.c head/sys/netinet/in.c head/sys/netinet/tcp_timer.c head/sys/netinet6/in6.c head/sys/netinet6/nd6.c head/sys/netpfil/pf/if_pfsync.c Modified: head/share/man/man9/timeout.9 == --- head/share/man/man9/timeout.9 Fri Nov 13 22:33:51 2015 (r290804) +++ head/share/man/man9/timeout.9 Fri Nov 13 22:51:35 2015 (r290805) @@ -302,7 +302,7 @@ If .Fa c already has a pending callout, it is cancelled before the new invocation is scheduled. -These functions return a non-zero value if a pending callout was cancelled +These functions return a value of one if a pending callout was cancelled and zero if there was no pending callout. If the callout has an associated lock, then that lock must be held when any of these functions are called. @@ -804,16 +804,16 @@ The .Fn callout_reset and .Fn callout_schedule -function families return non-zero if the callout was pending before the new +function families return a value of one if the callout was pending before the new function invocation was scheduled. .Pp The .Fn callout_stop and .Fn callout_drain -functions return non-zero if the callout was still pending when it was -called or zero otherwise. -The +functions return a value of one if the callout was still pending when it was +called, a zero if the callout could not be stopped and a negative one is it +was either not running or haas already completed. The .Fn timeout function returns a .Ft struct callout_handle Modified: head/sys/kern/subr_taskqueue.c == --- head/sys/kern/subr_taskqueue.c Fri Nov 13 22:33:51 2015 (r290804) +++ head/sys/kern/subr_taskqueue.c Fri Nov 13 22:51:35 2015 (r290805) @@ -496,7 +496,7 @@ taskqueue_cancel_timeout(struct taskqueu int error; TQ_LOCK(queue); - pending = !!callout_stop(&timeout_task->c); + pending = !!(callout_stop(&timeout_task->c) > 0); error = taskqueue_cancel_locked(queue, &timeout_task->t, &pending1); if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) { timeout_task->f &= ~DT_CALLOUT_ARMED; Modified: head/sys/net/if_llatbl.c == --- head/sys/net/if_llatbl.cFri Nov 13 22:33:51 2015(r290804) +++ head/sys/net/if_llatbl.cFri Nov 13 22:51:35 2015(r290805) @@ -394,7 +394,7 @@ lltable_free(struct lltable *llt) IF_AFDATA_WUNLOCK(llt->llt_ifp); LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) { - if (callout_stop(&lle->lle_timer)) + if (callout_stop(&lle->lle_timer) > 0) LLE_REMREF(lle); llentry_free(lle); } Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Fri Nov 13 22:33:51 2015(r290804) +++ head/sys/netinet/in.c Fri Nov 13 22:51:35 2015(r290805) @@ -1093,7 +1093,7 @@ in_lltable_free_entry(struct lltable *ll } /* cancel timer */ - if (callout_stop(&lle->lle_timer)) + if (callout_stop(&lle->lle_timer) > 0) LLE_REMREF(lle); /* Drop hold queue */ Modified: head/sys/netinet/tcp_timer.c == --- head/sys/netinet/tcp_timer.cFri Nov 13 22:33:51 2015 (r290804) +++ head/sys/netinet/tcp_timer.cFri Nov 13 22:51:35 2015 (r290805) @@ -862,7 +862,7 @@ tcp_timer_activate(struct tcpcb *tp, uin } if (delta == 0) { if ((tp->t_timers->tt_flags & timer_type) && - callout_stop(t_callout) && + (callout_stop(t_callout) > 0) && (tp->t_timers->tt_flags & f_reset)) { tp->t_timers->tt_flags &= ~(timer_type | f_reset); } @@ -949,7 +949,7 @@ tcp_timer_stop(struct tcpcb *tp, uint32_ } if (tp->t_timers->tt_flags & timer_type) { - if (callout_stop(t_callout) && + if ((callout_stop(t_callout) > 0) &&
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
let me fix that R On Nov 13, 2015, at 4:51 PM, Alexander V. Chernikov wrote: > 14.11.2015, 00:41, "Randall Stewart" : >> Hmm >> >> callout_reset() returns either 0 or 1 >> >> It returns no other values and did not change.. maybe ti should say positive >> or one in the manual… >> >> I can add that to the fix patch. > It would be great :) > Also (just nitpicking) "return values" section of callout(9) still states > that callout_stop() returns non-zero value if the callout is pending. >> >> >> R >> On Nov 13, 2015, at 4:32 PM, Alexander V. Chernikov wrote: >> >>> >>> One small note on lltable: change in nd6_llinfo_settimer_locked() assumes >>> that callout_reset() returns >0 for stopped callout. The man page still >>> says "non-zero value" for that case. >>> (And that was the reason of writing comment to D4076 on inconsistent >>> callout_reset() return value). >>> >>> >>> >>> 14.11.2015, 00:19, "Randall Stewart" : >>>> So looking deeper something like the following (with Bryan’s patch) is in >>>> order. >>>> >>>> Though there is one place in the task code that looks funny since it was >>>> >>>> pending = !!callout_stop() >>>> >>>> I changed it to >>>> >>>> pending = !! (callout_stop > 0) >>>> >>>> But I wonder about the double !! that seems rather convoluted.. >>>> >>>> Unless someone objects I will commit this shortly >>>> R >>>> >>>> >>>> >>>> >>>> , >>>> >>>> On Nov 13, 2015, at 6:16 AM, Alexander V. Chernikov >>>> wrote: >>>> >>>>> >>>>> 10.11.2015, 17:49, "Randall Stewart" : >>>>>> >>>>>> Author: rrs >>>>>> Date: Tue Nov 10 14:49:32 2015 >>>>>> New Revision: 290664 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/290664 >>>>>> >>>>>> Log: >>>>>> Add new async_drain to the callout system. This is so-far not used but >>>>>> should be used by TCP for sure in its cleanup of the IN-PCB (will be >>>>>> coming shortly). >>>>> >>>>> Randall, this commit introduced change in callout_stop() which was not >>>>> mentioned in commit message. >>>>> This change has broken lltable arp/nd handling: deleting interface >>>>> address causes immediate panic. >>>>> I also see other other code/subsystems relying on callout_stop() return >>>>> value (netgraph, pfsync, iscsi). >>>>> I was not able to find any discussion/analysis/testing for these in D4076 >>>>> so this change does not look like being properly tested prior commiting.. >>>>> >>>>> >>>>> >>>>>> >>>>>> Sponsored by: Netflix Inc. >>>>>> Differential Revision: https://reviews.freebsd.org/D4076 >>>>>> >>>>>> Modified: >>>>>> head/share/man/man9/timeout.9 >>>>>> head/sys/kern/kern_timeout.c >>>>>> head/sys/sys/callout.h >>>>>> >>>>>> Modified: head/share/man/man9/timeout.9 >>>>>> == >>>>>> --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) >>>>>> +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) >>>>>> @@ -35,6 +35,7 @@ >>>>>> .Sh NAME >>>>>> .Nm callout_active , >>>>>> .Nm callout_deactivate , >>>>>> +.Nm callout_async_drain , >>>>>> .Nm callout_drain , >>>>>> .Nm callout_handle_init , >>>>>> .Nm callout_init , >>>>>> @@ -69,6 +70,8 @@ typedef void timeout_t (void *); >>>>>> .Ft void >>>>>> .Fn callout_deactivate "struct callout *c" >>>>>> .Ft int >>>>>> +.Fn callout_async_drain "struct callout *c" "timeout_t *drain" >>>>>> +.Ft int >>>>>> .Fn callout_drain "struct callout *c" >>>>>> .Ft void >>>>
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
On Nov 13, 2015, at 4:43 PM, Bryan Drewery wrote: > On 11/13/2015 1:24 PM, Randall Stewart wrote: >> Looking at the patch, we need a define of your >> >> _callout_stop_safe >> >> and we need to switch >> >> callout_stop()’s define to use the new _callout_stop_safe() > > For both cases, there would be no reason to have new code call my > wrapper. The defines in my patch are fine for new code. The "new" > _callout_stop_safe function is just for existing modules. > > I think the historical consensus is to not commit my patch though as > people should recompile their modules when the kernel is updated, before > rebooting into the new kernel even. I did (as Han’s suggested) bump the FreeBSD version number.. So maybe thats good enough. R > > >> >> R >> On Nov 13, 2015, at 4:20 PM, Randall Stewart > <mailto:r...@netflix.com>> wrote: >> >>> No alexander’s panic’s are because the >>> LLREF >>> is done if (callout_stop()) >>> >>> But now if it was not running -1 is returned.. >>> >>> Try the patch I just sent.. >>> >>> R >>> On Nov 13, 2015, at 4:02 PM, Bryan Drewery >> <mailto:bdrew...@freebsd.org>> wrote: >>> >>>> On 11/13/2015 1:00 PM, Randall Stewart wrote: >>>>> Bryan: >>>>> >>>>> This looks like a decent thing to do.. >>>>> >>>>> Still wondering why changing the callout.h header file would not >>>>> have caused >>>>> things to recompile to pick up the new argument.. >>>>> >>>>> We can do it this way though it looks fine. >>>>> >>>>> You want to commit it or I? >>>> >>>> Well your change is totally safe for compiling. It's just not KBI >>>> backwards compat for older modules. This is not typically a problem but >>>> I think in this case it is worth doing to avoid random data coming into >>>> the 'drain' argument if loading an older module. >>>> >>>> I'll do a test build and commit it. Perhaps this is what was leading to >>>> Alexander's panics. >>>> >>>> I haven't analyzed the return value issue at all. >>>> >>>> > > > -- > Regards, > Bryan Drewery > Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
Hmm callout_reset() returns either 0 or 1 It returns no other values and did not change.. maybe ti should say positive or one in the manual… I can add that to the fix patch. R On Nov 13, 2015, at 4:32 PM, Alexander V. Chernikov wrote: > One small note on lltable: change in nd6_llinfo_settimer_locked() assumes > that callout_reset() returns >0 for stopped callout. The man page still says > "non-zero value" for that case. > (And that was the reason of writing comment to D4076 on inconsistent > callout_reset() return value). > > > > 14.11.2015, 00:19, "Randall Stewart" : >> So looking deeper something like the following (with Bryan’s patch) is in >> order. >> >> Though there is one place in the task code that looks funny since it was >> >> pending = !!callout_stop() >> >> I changed it to >> >> pending = !! (callout_stop > 0) >> >> But I wonder about the double !! that seems rather convoluted.. >> >> Unless someone objects I will commit this shortly >> R >> >> >> >> , >> On Nov 13, 2015, at 6:16 AM, Alexander V. Chernikov >> wrote: >> >>> 10.11.2015, 17:49, "Randall Stewart" : >>>> Author: rrs >>>> Date: Tue Nov 10 14:49:32 2015 >>>> New Revision: 290664 >>>> URL: https://svnweb.freebsd.org/changeset/base/290664 >>>> >>>> Log: >>>> Add new async_drain to the callout system. This is so-far not used but >>>> should be used by TCP for sure in its cleanup of the IN-PCB (will be >>>> coming shortly). >>> >>> Randall, this commit introduced change in callout_stop() which was not >>> mentioned in commit message. >>> This change has broken lltable arp/nd handling: deleting interface address >>> causes immediate panic. >>> I also see other other code/subsystems relying on callout_stop() return >>> value (netgraph, pfsync, iscsi). >>> I was not able to find any discussion/analysis/testing for these in D4076 >>> so this change does not look like being properly tested prior commiting.. >>> >>> >>>> >>>> Sponsored by: Netflix Inc. >>>> Differential Revision: https://reviews.freebsd.org/D4076 >>>> >>>> Modified: >>>> head/share/man/man9/timeout.9 >>>> head/sys/kern/kern_timeout.c >>>> head/sys/sys/callout.h >>>> >>>> Modified: head/share/man/man9/timeout.9 >>>> == >>>> --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) >>>> +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) >>>> @@ -35,6 +35,7 @@ >>>> .Sh NAME >>>> .Nm callout_active , >>>> .Nm callout_deactivate , >>>> +.Nm callout_async_drain , >>>> .Nm callout_drain , >>>> .Nm callout_handle_init , >>>> .Nm callout_init , >>>> @@ -69,6 +70,8 @@ typedef void timeout_t (void *); >>>> .Ft void >>>> .Fn callout_deactivate "struct callout *c" >>>> .Ft int >>>> +.Fn callout_async_drain "struct callout *c" "timeout_t *drain" >>>> +.Ft int >>>> .Fn callout_drain "struct callout *c" >>>> .Ft void >>>> .Fn callout_handle_init "struct callout_handle *handle" >>>> @@ -236,17 +239,42 @@ The function >>>> cancels a callout >>>> .Fa c >>>> if it is currently pending. >>>> -If the callout is pending, then >>>> +If the callout is pending and successfuly stopped, then >>>> .Fn callout_stop >>>> -returns a non-zero value. >>>> -If the callout is not set, >>>> -has already been serviced, >>>> -or is currently being serviced, >>>> +returns a value of one. >>>> +If the callout is not set, or >>>> +has already been serviced, then >>>> +negative one is returned. >>>> +If the callout is currently being serviced and cannot be stopped, >>>> then zero will be returned. >>>> If the callout has an associated lock, >>>> then that lock must be held when this function is called. >>>> .Pp >>>> The function >>>> +.Fn callout_async_drain >>>> +is identical to >>>> +.Fn callout_stop >>>> +with one difference. >>
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
My patch address the following: On Nov 13, 2015, at 4:13 PM, Alexander V. Chernikov wrote: > > > 13.11.2015, 23:59, "Randall Stewart" : >> Strange >> >> I went looking through all calls to callout stop with cscope and saw >> no one paying attention to the return value… (which I thought was not good). > > 23:49 [0] m@fhead5 grep -R callout_stop sys | egrep '(=|\)' > sys/netgraph/ng_base.c:rval = callout_stop(c); This one does not need changing. > sys/netpfil/pf/if_pfsync.c:if (callout_stop(&pd->pd_tmo)) { > sys/netpfil/pf/if_pfsync.c:if (callout_stop(&pd->pd_tmo)) The above two I changed to > 0 > sys/dev/isci/isci_timer.c:/* callout_stop() will *not* keep the time None of the ones in isci_timer.c check the return code or do anything different. > > sys/netinet6/nd6.c:canceled = callout_stop(&ln->lle_timer); > sys/netinet6/in6.c:if (callout_stop(&lle->lle_timer)) > sys/net/if_llatbl.c:if (callout_stop(&lle->lle_timer)) The above needed the same > sys/kern/subr_taskqueue.c:pending = !!callout_stop(&timeout_task->c); same as above.. only I think the !! is strange :-) > sys/kern/kern_exit.c:callout_stop(&p->p_itcallout) == 0) { Hmm I may have missed that one let me check Ok looking at that one it does not need to be changed.. in fact it is more correct. Since the 0 return on a already expired callout is now -1 which this if code is looking for. > sys/kern/subr_sleepqueue.c:else if (callout_stop(&td->td_slpcallout) == > 0) { This one again was causing extra work when the callout was already stopped and it returned 0.. it would do a synchronize on the other CPU.. but if -1 comes back it says the callout is already stopped.. so no synchronization is needed.. > sys/netinet/in.c:if (callout_stop(&lle->lle_timer)) > sys/netinet/tcp_timer.c:if (callout_stop(t_callout) && These two I made > 0 though the TCP one needs to change to use the new async_drain > > (not counting callout_drain() here) drain is different since it is done safe it should wait for the completion of the timeout. I don’t know if you could ever get a 0 return from it.. R > >> >> And yes I am running this in a lot of systems. > Try this: > 0:11 [0] fhead0# ifconfig vtnet0 alias 10.10.10.10/32 > 0:11 [0] fhead0# ifconfig vtnet0 -alias 10.10.10.10 > callout_stop() for lle 10.10.10.10 on vtnet0, lle_refcnt=1 > panic: bogus refcnt 0 on lle 0xf8001996c400 >> >> R >> >> >> On Nov 13, 2015, at 6:16 AM, Alexander V. Chernikov >> wrote: >> >>> >>> 10.11.2015, 17:49, "Randall Stewart" : >>>> >>>> Author: rrs >>>> Date: Tue Nov 10 14:49:32 2015 >>>> New Revision: 290664 >>>> URL: https://svnweb.freebsd.org/changeset/base/290664 >>>> >>>> Log: >>>> Add new async_drain to the callout system. This is so-far not used but >>>> should be used by TCP for sure in its cleanup of the IN-PCB (will be >>>> coming shortly). >>> >>> Randall, this commit introduced change in callout_stop() which was not >>> mentioned in commit message. >>> This change has broken lltable arp/nd handling: deleting interface address >>> causes immediate panic. >>> I also see other other code/subsystems relying on callout_stop() return >>> value (netgraph, pfsync, iscsi). >>> I was not able to find any discussion/analysis/testing for these in D4076 >>> so this change does not look like being properly tested prior commiting.. >>> >>> >>> >>>> >>>> Sponsored by: Netflix Inc. >>>> Differential Revision: https://reviews.freebsd.org/D4076 >>>> >>>> Modified: >>>> head/share/man/man9/timeout.9 >>>> head/sys/kern/kern_timeout.c >>>> head/sys/sys/callout.h >>>> >>>> Modified: head/share/man/man9/timeout.9 >>>> == >>>> --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) >>>> +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) >>>> @@ -35,6 +35,7 @@ >>>> .Sh NAME >>>> .Nm callout_active , >>>> .Nm callout_deactivate , >>>> +.Nm callout_async_drain , >>>> .Nm callout_drain , >>>> .Nm callout_handle_init , >>>> .Nm callout_init , >>>> @@ -69,6 +70,8 @@ typedef voi
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
Looking at the patch, we need a define of your _callout_stop_safe and we need to switch callout_stop()’s define to use the new _callout_stop_safe() R On Nov 13, 2015, at 4:20 PM, Randall Stewart wrote: > No alexander’s panic’s are because the > LLREF > is done if (callout_stop()) > > But now if it was not running -1 is returned.. > > Try the patch I just sent.. > > R > On Nov 13, 2015, at 4:02 PM, Bryan Drewery wrote: > >> On 11/13/2015 1:00 PM, Randall Stewart wrote: >>> Bryan: >>> >>> This looks like a decent thing to do.. >>> >>> Still wondering why changing the callout.h header file would not have caused >>> things to recompile to pick up the new argument.. >>> >>> We can do it this way though it looks fine. >>> >>> You want to commit it or I? >> >> Well your change is totally safe for compiling. It's just not KBI >> backwards compat for older modules. This is not typically a problem but >> I think in this case it is worth doing to avoid random data coming into >> the 'drain' argument if loading an older module. >> >> I'll do a test build and commit it. Perhaps this is what was leading to >> Alexander's panics. >> >> I haven't analyzed the return value issue at all. >> >> >> -- >> Regards, >> Bryan Drewery >> > > > Randall Stewart > r...@netflix.com > 803-317-4952 > > > > > Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
No alexander’s panic’s are because the LLREF is done if (callout_stop()) But now if it was not running -1 is returned.. Try the patch I just sent.. R On Nov 13, 2015, at 4:02 PM, Bryan Drewery wrote: > On 11/13/2015 1:00 PM, Randall Stewart wrote: >> Bryan: >> >> This looks like a decent thing to do.. >> >> Still wondering why changing the callout.h header file would not have caused >> things to recompile to pick up the new argument.. >> >> We can do it this way though it looks fine. >> >> You want to commit it or I? > > Well your change is totally safe for compiling. It's just not KBI > backwards compat for older modules. This is not typically a problem but > I think in this case it is worth doing to avoid random data coming into > the 'drain' argument if loading an older module. > > I'll do a test build and commit it. Perhaps this is what was leading to > Alexander's panics. > > I haven't analyzed the return value issue at all. > > > -- > Regards, > Bryan Drewery > Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
So looking deeper something like the following (with Bryan’s patch) is in order. Though there is one place in the task code that looks funny since it was pending = !!callout_stop() I changed it to pending = !! (callout_stop > 0) But I wonder about the double !! that seems rather convoluted.. Unless someone objects I will commit this shortly R On Nov 13, 2015, at 6:16 AM, Alexander V. Chernikov wrote: > 10.11.2015, 17:49, "Randall Stewart" : >> Author: rrs >> Date: Tue Nov 10 14:49:32 2015 >> New Revision: 290664 >> URL: https://svnweb.freebsd.org/changeset/base/290664 >> >> Log: >> Add new async_drain to the callout system. This is so-far not used but >> should be used by TCP for sure in its cleanup of the IN-PCB (will be >> coming shortly). > > Randall, this commit introduced change in callout_stop() which was not > mentioned in commit message. > This change has broken lltable arp/nd handling: deleting interface address > causes immediate panic. > I also see other other code/subsystems relying on callout_stop() return value > (netgraph, pfsync, iscsi). > I was not able to find any discussion/analysis/testing for these in D4076 so > this change does not look like being properly tested prior commiting.. > > >> >> Sponsored by: Netflix Inc. >> Differential Revision: https://reviews.freebsd.org/D4076 >> >> Modified: >> head/share/man/man9/timeout.9 >> head/sys/kern/kern_timeout.c >> head/sys/sys/callout.h >> >> Modified: head/share/man/man9/timeout.9 >> == >> --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) >> +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) >> @@ -35,6 +35,7 @@ >> .Sh NAME >> .Nm callout_active , >> .Nm callout_deactivate , >> +.Nm callout_async_drain , >> .Nm callout_drain , >> .Nm callout_handle_init , >> .Nm callout_init , >> @@ -69,6 +70,8 @@ typedef void timeout_t (void *); >> .Ft void >> .Fn callout_deactivate "struct callout *c" >> .Ft int >> +.Fn callout_async_drain "struct callout *c" "timeout_t *drain" >> +.Ft int >> .Fn callout_drain "struct callout *c" >> .Ft void >> .Fn callout_handle_init "struct callout_handle *handle" >> @@ -236,17 +239,42 @@ The function >> cancels a callout >> .Fa c >> if it is currently pending. >> -If the callout is pending, then >> +If the callout is pending and successfuly stopped, then >> .Fn callout_stop >> -returns a non-zero value. >> -If the callout is not set, >> -has already been serviced, >> -or is currently being serviced, >> +returns a value of one. >> +If the callout is not set, or >> +has already been serviced, then >> +negative one is returned. >> +If the callout is currently being serviced and cannot be stopped, >> then zero will be returned. >> If the callout has an associated lock, >> then that lock must be held when this function is called. >> .Pp >> The function >> +.Fn callout_async_drain >> +is identical to >> +.Fn callout_stop >> +with one difference. >> +When >> +.Fn callout_async_drain >> +returns zero it will arrange for the function >> +.Fa drain >> +to be called using the same argument given to the >> +.Fn callout_reset >> +function. >> +.Fn callout_async_drain >> +If the callout has an associated lock, >> +then that lock must be held when this function is called. >> +Note that when stopping multiple callouts that use the same lock it is >> possible >> +to get multiple return's of zero and multiple calls to the >> +.Fa drain >> +function, depending upon which CPU's the callouts are running. The >> +.Fa drain >> +function itself is called from the context of the completing callout >> +i.e. softclock or hardclock, just like a callout itself. >> +p >> +.Pp >> +The function >> .Fn callout_drain >> is identical to >> .Fn callout_stop >> >> Modified: head/sys/kern/kern_timeout.c >> == >> --- head/sys/kern/kern_timeout.c Tue Nov 10 14:14:41 2015 (r290663) >> +++ head/sys/kern/kern_timeout.c Tue Nov 10 14:49:32 2015 (r290664) >> @@ -136,6 +136,7 @@ u_int callwheelsize, callwheelmask; >> */ >> struct cc_exec { >> struct callout *cc_curr; >> + void (*cc_drain)(void *); >> #ifdef
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
Bryan: This looks like a decent thing to do.. Still wondering why changing the callout.h header file would not have caused things to recompile to pick up the new argument.. We can do it this way though it looks fine. You want to commit it or I? R On Nov 13, 2015, at 3:48 PM, Bryan Drewery wrote: > On 11/13/2015 12:39 PM, Bryan Drewery wrote: >> On 11/13/2015 3:16 AM, Alexander V. Chernikov wrote: >>> 10.11.2015, 17:49, "Randall Stewart" : >>>> Author: rrs >>>> Date: Tue Nov 10 14:49:32 2015 >>>> New Revision: 290664 >>>> URL: https://svnweb.freebsd.org/changeset/base/290664 >>>> >>>> Log: >>>> Add new async_drain to the callout system. This is so-far not used but >>>> should be used by TCP for sure in its cleanup of the IN-PCB (will be >>>> coming shortly). >>> >>> Randall, this commit introduced change in callout_stop() which was not >>> mentioned in commit message. >>> This change has broken lltable arp/nd handling: deleting interface address >>> causes immediate panic. >>> I also see other other code/subsystems relying on callout_stop() return >>> value (netgraph, pfsync, iscsi). >>> I was not able to find any discussion/analysis/testing for these in D4076 >>> so this change does not look like being properly tested prior commiting.. >>> >>> >> >> Fixing this is pretty easy. Keeping _callout_stop_safe() as a function >> wrapper around a new _callstop_stop_safe_drain() that takes the new >> argument. Then change callout_stop define to use >> _callstop_stop_safe_drain(). New code will avoid the wrapper function as >> it is recompiled. >> > > I was more speaking about hps@ point that the drain ptr is random for > old modules. > > This should fix that: > > https://people.freebsd.org/~bdrewery/patches/callout-abi-compat.diff > > I don't have any opinion or idea on the return value though. Perhaps a > revert is best for now until it can be discussed properly. > > -- > Regards, > Bryan Drewery Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
Strange I went looking through all calls to callout stop with cscope and saw no one paying attention to the return value… (which I thought was not good). And yes I am running this in a lot of systems. R On Nov 13, 2015, at 6:16 AM, Alexander V. Chernikov wrote: > 10.11.2015, 17:49, "Randall Stewart" : >> Author: rrs >> Date: Tue Nov 10 14:49:32 2015 >> New Revision: 290664 >> URL: https://svnweb.freebsd.org/changeset/base/290664 >> >> Log: >> Add new async_drain to the callout system. This is so-far not used but >> should be used by TCP for sure in its cleanup of the IN-PCB (will be >> coming shortly). > > Randall, this commit introduced change in callout_stop() which was not > mentioned in commit message. > This change has broken lltable arp/nd handling: deleting interface address > causes immediate panic. > I also see other other code/subsystems relying on callout_stop() return value > (netgraph, pfsync, iscsi). > I was not able to find any discussion/analysis/testing for these in D4076 so > this change does not look like being properly tested prior commiting.. > > >> >> Sponsored by: Netflix Inc. >> Differential Revision: https://reviews.freebsd.org/D4076 >> >> Modified: >> head/share/man/man9/timeout.9 >> head/sys/kern/kern_timeout.c >> head/sys/sys/callout.h >> >> Modified: head/share/man/man9/timeout.9 >> == >> --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) >> +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) >> @@ -35,6 +35,7 @@ >> .Sh NAME >> .Nm callout_active , >> .Nm callout_deactivate , >> +.Nm callout_async_drain , >> .Nm callout_drain , >> .Nm callout_handle_init , >> .Nm callout_init , >> @@ -69,6 +70,8 @@ typedef void timeout_t (void *); >> .Ft void >> .Fn callout_deactivate "struct callout *c" >> .Ft int >> +.Fn callout_async_drain "struct callout *c" "timeout_t *drain" >> +.Ft int >> .Fn callout_drain "struct callout *c" >> .Ft void >> .Fn callout_handle_init "struct callout_handle *handle" >> @@ -236,17 +239,42 @@ The function >> cancels a callout >> .Fa c >> if it is currently pending. >> -If the callout is pending, then >> +If the callout is pending and successfuly stopped, then >> .Fn callout_stop >> -returns a non-zero value. >> -If the callout is not set, >> -has already been serviced, >> -or is currently being serviced, >> +returns a value of one. >> +If the callout is not set, or >> +has already been serviced, then >> +negative one is returned. >> +If the callout is currently being serviced and cannot be stopped, >> then zero will be returned. >> If the callout has an associated lock, >> then that lock must be held when this function is called. >> .Pp >> The function >> +.Fn callout_async_drain >> +is identical to >> +.Fn callout_stop >> +with one difference. >> +When >> +.Fn callout_async_drain >> +returns zero it will arrange for the function >> +.Fa drain >> +to be called using the same argument given to the >> +.Fn callout_reset >> +function. >> +.Fn callout_async_drain >> +If the callout has an associated lock, >> +then that lock must be held when this function is called. >> +Note that when stopping multiple callouts that use the same lock it is >> possible >> +to get multiple return's of zero and multiple calls to the >> +.Fa drain >> +function, depending upon which CPU's the callouts are running. The >> +.Fa drain >> +function itself is called from the context of the completing callout >> +i.e. softclock or hardclock, just like a callout itself. >> +p >> +.Pp >> +The function >> .Fn callout_drain >> is identical to >> .Fn callout_stop >> >> Modified: head/sys/kern/kern_timeout.c >> == >> --- head/sys/kern/kern_timeout.c Tue Nov 10 14:14:41 2015 (r290663) >> +++ head/sys/kern/kern_timeout.c Tue Nov 10 14:49:32 2015 (r290664) >> @@ -136,6 +136,7 @@ u_int callwheelsize, callwheelmask; >> */ >> struct cc_exec { >> struct callout *cc_curr; >> + void (*cc_drain)(void *); >> #ifdef SMP >> void (*ce_migration_func)(void *); >> void *ce_migration_arg; >> @@ -170,6 +171,7 @@ struct callout_cpu { &g
Re: svn commit: r290714 - in head/sys/tests: callout_test framework
I thought Kib fixed that.. I was looking at it this AM and found he had beat me too it.. R On Nov 12, 2015, at 12:01 PM, Bjoern A. Zeeb wrote: > >> On 12 Nov 2015, at 10:31 , Randall Stewart wrote: >> >> Author: rrs >> Date: Thu Nov 12 10:31:14 2015 >> New Revision: 290714 >> URL: https://svnweb.freebsd.org/changeset/base/290714 >> >> Log: >> Style 9 changes. >> MFC after: 1 Month >> >> Modified: >> head/sys/tests/callout_test/callout_test.c >> head/sys/tests/framework/kern_testfrwk.c > > > I am just replying to the last commit given despite the efforts of people it > still fails on PC98: > > /scratch/tmp/bz/head.svn/sys/modules/tests/callout_test/../../../tests/callout_test/callout_test.c:52:9: > error: 'cpu_spinwait' macro redefined [-Werror,-Wmacro-redefined] > #define cpu_spinwait() >^ > ./i386/cpu.h:50:9: note: previous definition is here > #define cpu_spinwait() ia32_pause() >^ > 1 error generated. > --- callout_test.o --- > *** [callout_test.o] Error code 1 > > bmake: stopped in /scratch/tmp/bz/head.svn/sys/modules/tests/callout_test > > Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290716 - head/share/man/man9
ou registered, "callout_test" +in our example, in the +.Fa name +field. The user can also set the +number of threads to run by putting that in +.Fa num_threads. +.Pp +The framework will start that many kernel threads all running your test +at the same time. The user does not specify anything in +.Fa tot_threads_running +(the framework uses that). As the framework calls each one of +your tests it will set the +.Fa tot_threads_running +to the index +of the thread that your call is made from. So for example if the user +sets +.Fa num_threads +to two, then the function run_callout_test() will +be called once with +.Fa tot_threads_running +to 0, and a second time with +.Fa tot_threads_running +set to 1. +.Pp +The +.Fa test_options +field is a test-specific set of information that +is an opaque glob that is passed in from user space (a max of 256 bytes) +that you reshape to what input your test wants. +In the case of callout_test we reshape that to: +.Pp +.Bd -literal -offset indent +struct callout_test { + int number_of_callouts; + int test_number; +}; +.Ed +.Pp +So the first lines of +.Fn run_callout_test() +does the following to get at the user specific data: +.Pp +.Bd -literal -offset indent +{ + struct callout_test *u; + size_t sz; + int i; + struct callout_run *rn; + int index = test->tot_threads_running; + + u = (struct callout_test *)test->test_options; +.Ed +.Pp +That way it can access: +.Bd -literal + u->test_number (there are two types of tests provided with this test) +and + u->number_of_callouts (how many simultaneous callouts to run). +.Ed +.Pp +Your test can of course do anything it wants with these bytes, they +may not even use them (they are optional). So the callout_test in +question wants to create a situation where multiple callouts are +all run, thats the +.Fa number_of_callouts +, and it try's to cancel +the callout with the new +.Fn callout_async_drain +feature. The threads do +this by the test executor getting the lock in question, and then +starting each of the callouts waiting for the callouts to +all go off (the executor spins waits). This forces the situation that +the callout's have expired and are all waiting on the lock that +the executor holds. After the callouts are all +blocked, the executor then calls the new function +.Fn callout_async_drain +on each callout and then releases the lock. +.Pp +After all the callouts are done, a total status is printed +showing the results via printf. The human tester then can run dmesg +to see the results. In this case it is expected that if you are +running test 0, all the callouts expire on the same CPU so then +only one callout_drain function would have been called. And +the number of zero_returns should match the number of callout_drains +that were called i.e. 1. The one_returns should be the remainder of the +callouts. If the test number was 1, the callouts were spread +across all CPU's. So that the number of zero_returns will +again match the number of drain calls made which matches the number +of CPU's that were put in use. +.Pp +More than one thread can be used with this test, though in the +example case its probably not necessary. +.Pp +You should not need to change the framework +just add tests and register them after loading. +.Sh AUTHORS +The kernel test framework was written by Randall Stewart r...@freebsd.org +with help from John Mark Gurney j...@freebsd.org ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290715 - head/sys/sys
Author: rrs Date: Thu Nov 12 10:48:31 2015 New Revision: 290715 URL: https://svnweb.freebsd.org/changeset/base/290715 Log: Bump version number since callout_stop() macro now has new NULL arg. Thanks Hans for spotting this! Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h == --- head/sys/sys/param.hThu Nov 12 10:31:14 2015(r290714) +++ head/sys/sys/param.hThu Nov 12 10:48:31 2015(r290715) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1100089 /* Master, propagated to newvers */ +#define __FreeBSD_version 1100090 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290714 - in head/sys/tests: callout_test framework
Author: rrs Date: Thu Nov 12 10:31:14 2015 New Revision: 290714 URL: https://svnweb.freebsd.org/changeset/base/290714 Log: Style 9 changes. MFC after:1 Month Modified: head/sys/tests/callout_test/callout_test.c head/sys/tests/framework/kern_testfrwk.c Modified: head/sys/tests/callout_test/callout_test.c == --- head/sys/tests/callout_test/callout_test.c Thu Nov 12 10:20:36 2015 (r290713) +++ head/sys/tests/callout_test/callout_test.c Thu Nov 12 10:31:14 2015 (r290714) @@ -66,7 +66,7 @@ struct callout_run { static struct callout_run *comaster[MAXCPU]; -uint64_t callout_total=0; +uint64_t callout_total = 0; static void execute_the_co_test(struct callout_run *rn); @@ -74,18 +74,19 @@ static void co_saydone(void *arg) { struct callout_run *rn; + rn = (struct callout_run *)arg; printf("The callout test is now complete for thread %d\n", - rn->index); + rn->index); printf("number_callouts:%d\n", - rn->co_number_callouts); + rn->co_number_callouts); printf("Callouts that bailed (Not PENDING or ACTIVE cleared):%d\n", - rn->co_return_npa); + rn->co_return_npa); printf("Callouts that completed:%d\n", rn->co_completed); printf("Drain calls:%d\n", rn->drain_calls); printf("Zero returns:%d non-zero:%d\n", - rn->cnt_zero, - rn->cnt_one); + rn->cnt_zero, + rn->cnt_one); } @@ -93,6 +94,7 @@ static void drainit(void *arg) { struct callout_run *rn; + rn = (struct callout_run *)arg; mtx_lock(&rn->lock); rn->drain_calls++; @@ -104,7 +106,7 @@ test_callout(void *arg) { struct callout_run *rn; int cpu; - + critical_enter(); cpu = curcpu; critical_exit(); @@ -120,7 +122,7 @@ test_callout(void *arg) } callout_deactivate(&rn->co_array[cpu]); rn->co_completed++; - mtx_unlock(&rn->lock); + mtx_unlock(&rn->lock); atomic_subtract_int(&rn->callout_waiting, 1); } @@ -132,16 +134,16 @@ execute_the_co_test(struct callout_run * mtx_lock(&rn->lock); rn->callout_waiting = 0; - for(i=0; ico_number_callouts; i++) { + for (i = 0; i < rn->co_number_callouts; i++) { if (rn->co_test == 1) { /* start all on spread out cpu's */ cpu = i % mp_ncpus; - callout_reset_sbt_on(&rn->co_array[i], 3, 0, test_callout, rn, -cpu, 0); + callout_reset_sbt_on(&rn->co_array[i], 3, 0, test_callout, rn, + cpu, 0); } else { /* Start all on the same CPU */ - callout_reset_sbt_on(&rn->co_array[i], 3, 0, test_callout, rn, -rn->index, 0); + callout_reset_sbt_on(&rn->co_array[i], 3, 0, test_callout, rn, + rn->index, 0); } } tk_s = ticks; @@ -154,7 +156,7 @@ execute_the_co_test(struct callout_run * } } /* OK everyone is waiting and we have the lock */ - for(i=0; ico_number_callouts; i++) { + for (i = 0; i < rn->co_number_callouts; i++) { ret = callout_async_drain(&rn->co_array[i], drainit); if (ret) { rn->cnt_one++; @@ -191,7 +193,7 @@ run_callout_test(struct kern_test *test) if (comaster[index] == NULL) { rn = comaster[index] = malloc(sizeof(struct callout_run), M_CALLTMP, M_WAITOK); memset(comaster[index], 0, sizeof(struct callout_run)); - mtx_init(&rn->lock, "callouttest", NULL, MTX_DUPOK); + mtx_init(&rn->lock, "callouttest", NULL, MTX_DUPOK); rn->index = index; } else { rn = comaster[index]; @@ -207,19 +209,20 @@ run_callout_test(struct kern_test *test) rn->co_test = u->test_number; sz = sizeof(struct callout) * rn->co_number_callouts; rn->co_array = malloc(sz, M_CALLTMP, M_WAITOK); - for(i=0; ico_number_callouts; i++) { + for (i = 0; i < rn->co_number_callouts; i++) { callout_init(&rn->co_array[i], CALLOUT_MPSAFE); } execute_the_co_test(rn); } -int callout_test_is_loaded=0; +int callout_test_is_loaded = 0; static void cocleanup(void) { int i; - for(i=0; ico_array) { free(comaster[i]->co_array, M_CALLTMP); @@ -234,15 +237,15 @@ cocleanup(void) static int callout_test_modevent(module_t mod, int type, void *data) { - int err=0; + int err = 0; switch (type) { case MOD_LOAD: err = k
svn commit: r290690 - head/share/man/man9
Author: rrs Date: Wed Nov 11 23:10:09 2015 New Revision: 290690 URL: https://svnweb.freebsd.org/changeset/base/290690 Log: Add the MLINK for async_drain Thanks Edward for the pointer. MFC after:1 month Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile == --- head/share/man/man9/MakefileWed Nov 11 23:00:57 2015 (r290689) +++ head/share/man/man9/MakefileWed Nov 11 23:10:09 2015 (r290690) @@ -1714,6 +1714,7 @@ MLINKS+=time.9 boottime.9 \ time.9 time_uptime.9 MLINKS+=timeout.9 callout.9 \ timeout.9 callout_active.9 \ + timeout.9 callout_async_drain.9 \ timeout.9 callout_deactivate.9 \ timeout.9 callout_drain.9 \ timeout.9 callout_handle_init.9 \ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
And I disagree here Hans You don’t need that and it just adds more into the callout system that is not needed. R On Nov 10, 2015, at 9:59 AM, Hans Petter Selasky wrote: > On 11/10/15 15:49, Randall Stewart wrote: >> +#define callout_async_drain(c, d) \ >> +_callout_stop_safe(c, 0, d) > > Hi, > > Like commented in D4076, I think the callout_async_drain() function should > take a second void pointer argument, which is passed to the drain function, > instead of re-using the pointer argument passed to callout_reset(), because > that will make many to one, N:1, asynchronous drain possible. > > --HPS Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r290664 - in head: share/man/man9 sys/kern sys/sys
Author: rrs Date: Tue Nov 10 14:49:32 2015 New Revision: 290664 URL: https://svnweb.freebsd.org/changeset/base/290664 Log: Add new async_drain to the callout system. This is so-far not used but should be used by TCP for sure in its cleanup of the IN-PCB (will be coming shortly). Sponsored by: Netflix Inc. Differential Revision:https://reviews.freebsd.org/D4076 Modified: head/share/man/man9/timeout.9 head/sys/kern/kern_timeout.c head/sys/sys/callout.h Modified: head/share/man/man9/timeout.9 == --- head/share/man/man9/timeout.9 Tue Nov 10 14:14:41 2015 (r290663) +++ head/share/man/man9/timeout.9 Tue Nov 10 14:49:32 2015 (r290664) @@ -35,6 +35,7 @@ .Sh NAME .Nm callout_active , .Nm callout_deactivate , +.Nm callout_async_drain , .Nm callout_drain , .Nm callout_handle_init , .Nm callout_init , @@ -69,6 +70,8 @@ typedef void timeout_t (void *); .Ft void .Fn callout_deactivate "struct callout *c" .Ft int +.Fn callout_async_drain "struct callout *c" "timeout_t *drain" +.Ft int .Fn callout_drain "struct callout *c" .Ft void .Fn callout_handle_init "struct callout_handle *handle" @@ -236,17 +239,42 @@ The function cancels a callout .Fa c if it is currently pending. -If the callout is pending, then +If the callout is pending and successfuly stopped, then .Fn callout_stop -returns a non-zero value. -If the callout is not set, -has already been serviced, -or is currently being serviced, +returns a value of one. +If the callout is not set, or +has already been serviced, then +negative one is returned. +If the callout is currently being serviced and cannot be stopped, then zero will be returned. If the callout has an associated lock, then that lock must be held when this function is called. .Pp The function +.Fn callout_async_drain +is identical to +.Fn callout_stop +with one difference. +When +.Fn callout_async_drain +returns zero it will arrange for the function +.Fa drain +to be called using the same argument given to the +.Fn callout_reset +function. +.Fn callout_async_drain +If the callout has an associated lock, +then that lock must be held when this function is called. +Note that when stopping multiple callouts that use the same lock it is possible +to get multiple return's of zero and multiple calls to the +.Fa drain +function, depending upon which CPU's the callouts are running. The +.Fa drain +function itself is called from the context of the completing callout +i.e. softclock or hardclock, just like a callout itself. +p +.Pp +The function .Fn callout_drain is identical to .Fn callout_stop Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cTue Nov 10 14:14:41 2015 (r290663) +++ head/sys/kern/kern_timeout.cTue Nov 10 14:49:32 2015 (r290664) @@ -136,6 +136,7 @@ u_int callwheelsize, callwheelmask; */ struct cc_exec { struct callout *cc_curr; + void(*cc_drain)(void *); #ifdef SMP void(*ce_migration_func)(void *); void*ce_migration_arg; @@ -170,6 +171,7 @@ struct callout_cpu { #definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION) #definecc_exec_curr(cc, dir) cc->cc_exec_entity[dir].cc_curr +#definecc_exec_drain(cc, dir) cc->cc_exec_entity[dir].cc_drain #definecc_exec_next(cc)cc->cc_next #definecc_exec_cancel(cc, dir) cc->cc_exec_entity[dir].cc_cancel #definecc_exec_waiting(cc, dir) cc->cc_exec_entity[dir].cc_waiting @@ -679,6 +681,7 @@ softclock_call_cc(struct callout *c, str cc_exec_curr(cc, direct) = c; cc_exec_cancel(cc, direct) = false; + cc_exec_drain(cc, direct) = NULL; CC_UNLOCK(cc); if (c_lock != NULL) { class->lc_lock(c_lock, lock_status); @@ -744,6 +747,15 @@ skip: CC_LOCK(cc); KASSERT(cc_exec_curr(cc, direct) == c, ("mishandled cc_curr")); cc_exec_curr(cc, direct) = NULL; + if (cc_exec_drain(cc, direct)) { + void (*drain)(void *); + + drain = cc_exec_drain(cc, direct); + cc_exec_drain(cc, direct) = NULL; + CC_UNLOCK(cc); + drain(c_arg); + CC_LOCK(cc); + } if (cc_exec_waiting(cc, direct)) { /* * There is someone waiting for the @@ -1145,7 +1157,7 @@ callout_schedule(struct callout *c, int } int -_callout_stop_safe(struct callout *c, int safe) +_callout_stop_safe(struct callout *c, int safe, void (*drain)(void *)) { struct callout_cpu *cc, *old_cc; struct lock_class *class; @@ -1225,19 +1237,22 @@ again: * stop it by other means howeve
svn commit: r290663 - in head/sys: modules modules/tests modules/tests/callout_test modules/tests/framework tests tests/callout_test tests/framework
Author: rrs Date: Tue Nov 10 14:14:41 2015 New Revision: 290663 URL: https://svnweb.freebsd.org/changeset/base/290663 Log: Add a kernel test framework. The callout_test is a demonstration and will only work with the upcoming async-drain functionality. Tests can be added to the tests directory and then the framework can be used to launch those tests. MFC after:1 month Sponsored by: Netflix Inc. Differential Revision:https://reviews.freebsd.org/D1755 Added: head/sys/modules/tests/ head/sys/modules/tests/callout_test/ head/sys/modules/tests/callout_test/Makefile (contents, props changed) head/sys/modules/tests/framework/ head/sys/modules/tests/framework/Makefile (contents, props changed) head/sys/tests/ head/sys/tests/callout_test/ head/sys/tests/callout_test.h (contents, props changed) head/sys/tests/callout_test/callout_test.c (contents, props changed) head/sys/tests/framework/ head/sys/tests/framework/kern_testfrwk.c (contents, props changed) head/sys/tests/kern_testfrwk.h (contents, props changed) Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile == --- head/sys/modules/Makefile Tue Nov 10 14:14:32 2015(r290662) +++ head/sys/modules/Makefile Tue Nov 10 14:14:41 2015(r290663) @@ -343,6 +343,8 @@ SUBDIR= \ ${_syscons} \ sysvipc \ ${_ti} \ + tests/framework \ + tests/callout_test \ tl \ tmpfs \ ${_toecore} \ Added: head/sys/modules/tests/callout_test/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/tests/callout_test/MakefileTue Nov 10 14:14:41 2015(r290663) @@ -0,0 +1,15 @@ +# +# $FreeBSD$ +# + +.PATH: ${.CURDIR}/../../../tests/callout_test + +KMOD= callout_test +SRCS= callout_test.c + +# +# Enable full debugging +# +#CFLAGS += -g + +.include Added: head/sys/modules/tests/framework/Makefile == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/tests/framework/Makefile Tue Nov 10 14:14:41 2015 (r290663) @@ -0,0 +1,15 @@ +# +# $FreeBSD$ +# + +.PATH: ${.CURDIR}/../../../tests/framework + +KMOD= kern_testfrwk +SRCS= kern_testfrwk.c + +# +# Enable full debugging +# +#CFLAGS += -g + +.include Added: head/sys/tests/callout_test.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tests/callout_test.h Tue Nov 10 14:14:41 2015 (r290663) @@ -0,0 +1,34 @@ +#ifndef __callout_test_h__ +#define __callout_test_h__ +/*- + * Copyright (c) 2015 + * Netflix Incorporated, 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 REGENTS 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 REGENTS 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. + *__FBSDID("$FreeBSD$"); + * + */ +struct callout_test { + int number_of_callouts; + int test_number; +}; +#endif Added: head/sys/tests/callout_test/callout_test.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/tests/callout_test/callout_test.c Tue Nov 10 14:14:41 2015 (r290663) @@ -0,0 +1,284 @@ +/*- + * Copyright (c) 2015 Netflix Inc. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above cop
svn commit: r290276 - head/sys/net
Author: rrs Date: Mon Nov 2 21:21:00 2015 New Revision: 290276 URL: https://svnweb.freebsd.org/changeset/base/290276 Log: Fix three flowtable bugs, a) one lookup issue, b) a two cleaner issue. MFC after:3 days Sponsored by: Netflix Inc. Differential Revision:https://reviews.freebsd.org/D4014 Modified: head/sys/net/flowtable.c Modified: head/sys/net/flowtable.c == --- head/sys/net/flowtable.cMon Nov 2 20:03:59 2015(r290275) +++ head/sys/net/flowtable.cMon Nov 2 21:21:00 2015(r290276) @@ -435,8 +435,7 @@ static int flow_stale(struct flowtable *ft, struct flentry *fle, int maxidle) { - if (((fle->f_rt->rt_flags & RTF_HOST) && - ((fle->f_rt->rt_flags & (RTF_UP)) != (RTF_UP))) || + if (((fle->f_rt->rt_flags & RTF_UP) == 0) || (fle->f_rt->rt_ifp == NULL) || !RT_LINK_IS_UP(fle->f_rt->rt_ifp) || (fle->f_lle->la_flags & LLE_VALID) == 0) @@ -477,7 +476,7 @@ flow_matches(struct flentry *fle, uint32 CRITICAL_ASSERT(curthread); /* Microoptimization for IPv4: don't use bcmp(). */ - if (((keylen == sizeof(uint32_t) && (fle->f_key[0] != key[0])) || + if (((keylen == sizeof(uint32_t) && (fle->f_key[0] == key[0])) || (bcmp(fle->f_key, key, keylen) == 0)) && fibnum == fle->f_fibnum && #ifdef FLOWTABLE_HASH_ALL @@ -818,8 +817,6 @@ flowtable_free_stale(struct flowtable *f critical_exit(); bit_clear(tmpmask, curbit); - tmpmask += (curbit / 8); - tmpsize -= (curbit / 8) * 8; bit_ffs(tmpmask, tmpsize, &curbit); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r287780 - in head: share/man/man9 sys/kern sys/sys
gument immediately. > +.Pp > The > .Fn callout_reset > and > > Modified: head/sys/kern/kern_timeout.c > == > --- head/sys/kern/kern_timeout.c Mon Sep 14 10:28:47 2015 > (r287779) > +++ head/sys/kern/kern_timeout.c Mon Sep 14 10:52:26 2015 > (r287780) > @@ -1145,6 +1145,45 @@ callout_schedule(struct callout *c, int > } > > int > +callout_drain_async(struct callout *c, callout_func_t *func, void *arg) > +{ > + struct callout_cpu *cc; > + struct lock_class *class; > + int retval; > + int direct; > + > + /* stop callout */ > + callout_stop(c); > + > + /* check if callback is being called */ > + cc = callout_lock(c); > + if (c->c_iflags & CALLOUT_DIRECT) { > + direct = 1; > + } else { > + direct = 0; > + } > + retval = (cc_exec_curr(cc, direct) == c); > + > + /* drop locks, if any */ > + if (retval && c->c_lock != NULL && > + c->c_lock != &Giant.lock_object) { > + /* ensure we are properly locked */ > + class = LOCK_CLASS(c->c_lock); > + class->lc_assert(c->c_lock, LA_XLOCKED); > + /* the final callback should not be called locked */ > + c->c_lock = NULL; > + c->c_iflags |= CALLOUT_RETURNUNLOCKED; > + } > + CC_UNLOCK(cc); > + > + /* check if we should queue final callback */ > + if (retval) > + callout_reset(c, 1, func, arg); > + > + return (retval); > +} > + > +int > _callout_stop_safe(struct callout *c, int safe) > { > struct callout_cpu *cc, *old_cc; > > Modified: head/sys/sys/_callout.h > == > --- head/sys/sys/_callout.h Mon Sep 14 10:28:47 2015(r287779) > +++ head/sys/sys/_callout.h Mon Sep 14 10:52:26 2015(r287780) > @@ -46,6 +46,8 @@ LIST_HEAD(callout_list, callout); > SLIST_HEAD(callout_slist, callout); > TAILQ_HEAD(callout_tailq, callout); > > +typedef void callout_func_t(void *); > + > struct callout { > union { > LIST_ENTRY(callout) le; > > Modified: head/sys/sys/callout.h > == > --- head/sys/sys/callout.hMon Sep 14 10:28:47 2015(r287779) > +++ head/sys/sys/callout.hMon Sep 14 10:52:26 2015(r287780) > @@ -82,6 +82,7 @@ struct callout_handle { > #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) > #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) > #define callout_drain(c)_callout_stop_safe(c, 1) > +int callout_drain_async(struct callout *, callout_func_t *, void *); > void callout_init(struct callout *, int); > void _callout_init_lock(struct callout *, struct lock_object *, int); > #define callout_init_mtx(c, mtx, flags) > \ > Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285838 - head/sys/netinet
Author: rrs Date: Fri Jul 24 14:13:43 2015 New Revision: 285838 URL: https://svnweb.freebsd.org/changeset/base/285838 Log: Fix silly syntax error emacs chugged in for me.. gesh. MFC after:3 weeks Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Fri Jul 24 14:09:03 2015 (r285837) +++ head/sys/netinet/sctp_input.c Fri Jul 24 14:13:43 2015 (r285838) @@ -3957,7 +3957,6 @@ sctp_handle_str_reset_request_out(struct memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t)); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_IN_PROGRESS; - x } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); asoc->str_reset_seq_in++; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285837 - head/sys/netinet
Author: rrs Date: Fri Jul 24 14:09:03 2015 New Revision: 285837 URL: https://svnweb.freebsd.org/changeset/base/285837 Log: Fix an issue with MAC OS locking and also optimize the case where we are sending back a stream-reset and a sack timer is running, in that case we should just send the SACK. MFC after:3 weeks Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Fri Jul 24 09:20:02 2015 (r285836) +++ head/sys/netinet/sctp_input.c Fri Jul 24 14:09:03 2015 (r285837) @@ -3764,7 +3764,7 @@ sctp_handle_stream_reset_response(struct } } if (asoc->stream_reset_outstanding == 0) { - sctp_send_stream_reset_out_if_possible(stcb); + sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED); } return (0); } @@ -3832,7 +3832,7 @@ bad_boy: } else { sctp_add_stream_reset_result(chk, seq, SCTP_STREAM_RESET_RESULT_ERR_BAD_SEQNO); } - sctp_send_stream_reset_out_if_possible(stcb); + sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED); } static int @@ -3957,6 +3957,7 @@ sctp_handle_str_reset_request_out(struct memcpy(&liste->list_of_streams, req->list_of_streams, number_entries * sizeof(uint16_t)); TAILQ_INSERT_TAIL(&asoc->resetHead, liste, next_resp); asoc->last_reset_action[0] = SCTP_STREAM_RESET_RESULT_IN_PROGRESS; + x } sctp_add_stream_reset_result(chk, seq, asoc->last_reset_action[0]); asoc->str_reset_seq_in++; Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Fri Jul 24 09:20:02 2015 (r285836) +++ head/sys/netinet/sctp_output.c Fri Jul 24 14:09:03 2015 (r285837) @@ -10104,7 +10104,7 @@ do_it_again: sctp_fix_ecn_echo(asoc); if (stcb->asoc.trigger_reset) { - if (sctp_send_stream_reset_out_if_possible(stcb) == 0) { + if (sctp_send_stream_reset_out_if_possible(stcb, so_locked) == 0) { goto do_it_again; } } @@ -11839,7 +11839,7 @@ sctp_add_an_in_stream(struct sctp_tmit_c } int -sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb) +sctp_send_stream_reset_out_if_possible(struct sctp_tcb *stcb, int so_locked) { struct sctp_association *asoc; struct sctp_tmit_chunk *chk; @@ -11865,7 +11865,7 @@ sctp_send_stream_reset_out_if_possible(s chk->book_size_scale = 0; chk->data = sctp_get_mbuf_for_msg(MCLBYTES, 0, M_NOWAIT, 1, MT_DATA); if (chk->data == NULL) { - sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); + sctp_free_a_chunk(stcb, chk, so_locked); SCTP_LTRACE_ERR_RET(NULL, stcb, NULL, SCTP_FROM_SCTP_OUTPUT, ENOMEM); return (ENOMEM); } @@ -11892,7 +11892,7 @@ sctp_send_stream_reset_out_if_possible(s } else { m_freem(chk->data); chk->data = NULL; - sctp_free_a_chunk(stcb, chk, SCTP_SO_LOCKED); + sctp_free_a_chunk(stcb, chk, so_locked); return (ENOENT); } asoc->str_reset = chk; @@ -11901,6 +11901,10 @@ sctp_send_stream_reset_out_if_possible(s chk, sctp_next); asoc->ctrl_queue_cnt++; + + if (stcb->asoc.send_sack) { + sctp_send_sack(stcb, so_locked); + } sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo); return (0); } @@ -12101,6 +12105,9 @@ skip_stuff: chk, sctp_next); asoc->ctrl_queue_cnt++; + if (stcb->asoc.send_sack) { + sctp_send_sack(stcb, SCTP_SO_LOCKED); + } sctp_timer_start(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, chk->whoTo); return (0); } Modified: head/sys/netinet/sctp_output.h == --- head/sys/netinet/sctp_output.h Fri Jul 24 09:20:02 2015 (r285836) +++ head/sys/netinet/sctp_output.h Fri Jul 24 14:09:03 2015 (r285837) @@ -181,7 +181,7 @@ void sctp_add_stream_reset_result_tsn(struct sctp_tmit_chunk *, uint32_t, uint32_t, uint32_t, uint32_t); int -sctp_send_stream_reset_out_if_possible(struct sctp_tcb *); +sctp_send_stream_reset_out_if_possible(struct sctp_tcb *, int); int sctp_send_str_reset_req(struct sctp_tcb *, uint16_t, uint16_t *, Modified: head/sys/netinet/sctp_usrreq.c =
svn commit: r285792 - head/sys/netinet
Author: rrs Date: Wed Jul 22 11:30:37 2015 New Revision: 285792 URL: https://svnweb.freebsd.org/changeset/base/285792 Log: Fix several problems with Stream Reset. 1) We were not handling (or sending) the IN_PROGRESS case if the other side (or our side) was not able to reset (awaiting more data). 2) We would improperly send a stream-reset when we should not. Not waiting until the TSN had been assigned when data was inqueue. Reviewed by: tuexen Modified: head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_indata.c == --- head/sys/netinet/sctp_indata.c Wed Jul 22 10:05:46 2015 (r285791) +++ head/sys/netinet/sctp_indata.c Wed Jul 22 11:30:37 2015 (r285792) @@ -1886,6 +1886,7 @@ finish_express_del: sctp_reset_in_stream(stcb, liste->number_entries, liste->list_of_streams); TAILQ_REMOVE(&asoc->resetHead, liste, next_resp); + sctp_send_deferred_reset_response(stcb, liste, SCTP_STREAM_RESET_RESULT_PERFORMED); SCTP_FREE(liste, SCTP_M_STRESET); /* sa_ignore FREED_MEMORY */ liste = TAILQ_FIRST(&asoc->resetHead); Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Wed Jul 22 10:05:46 2015 (r285791) +++ head/sys/netinet/sctp_input.c Wed Jul 22 11:30:37 2015 (r285792) @@ -357,14 +357,17 @@ sctp_process_init(struct sctp_init_chunk sctp_free_a_strmoq(stcb, sp, SCTP_SO_NOT_LOCKED); /* sa_ignore FREED_MEMORY */ } + outs->state = SCTP_STREAM_CLOSED; } } /* cut back the count */ asoc->pre_open_streams = newcnt; } SCTP_TCB_SEND_UNLOCK(stcb); - asoc->strm_realoutsize = asoc->streamoutcnt = asoc->pre_open_streams; - + asoc->streamoutcnt = asoc->pre_open_streams; + for (i = 0; i < asoc->streamoutcnt; i++) { + asoc->strmout[i].state = SCTP_STREAM_OPEN; + } /* EY - nr_sack: initialize highest tsn in nr_mapping_array */ asoc->highest_tsn_inside_nr_map = asoc->highest_tsn_inside_map; if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_MAP_LOGGING_ENABLE) { @@ -3506,6 +3509,28 @@ sctp_reset_out_streams(struct sctp_tcb * sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_SEND, stcb, number_entries, (void *)list, SCTP_SO_NOT_LOCKED); } +static void +sctp_reset_clear_pending(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t * list) +{ + uint32_t i; + uint16_t temp; + + if (number_entries > 0) { + for (i = 0; i < number_entries; i++) { + temp = ntohs(list[i]); + if (temp >= stcb->asoc.streamoutcnt) { + /* no such stream */ + continue; + } + stcb->asoc.strmout[temp].state = SCTP_STREAM_OPEN; + } + } else { + for (i = 0; i < stcb->asoc.streamoutcnt; i++) { + stcb->asoc.strmout[i].state = SCTP_STREAM_OPEN; + } + } +} + struct sctp_stream_reset_request * sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) @@ -3604,6 +3629,8 @@ sctp_handle_stream_reset_response(struct type = ntohs(req_param->ph.param_type); lparm_len = ntohs(req_param->ph.param_length); if (type == SCTP_STR_RESET_OUT_REQUEST) { + int no_clear = 0; + req_out_param = (struct sctp_stream_reset_out_request *)req_param; number_entries = (lparm_len - sizeof(struct sctp_stream_reset_out_request)) / sizeof(uint16_t); asoc->stream_reset_out_is_outstanding = 0; @@ -3614,9 +3641,20 @@ sctp_handle_stream_reset_response(struct sctp_reset_out_streams(stcb, number_entries, req_out_param->list_of_streams); } else if (action == SCTP_STREAM_RESET_RESULT_DENIED) { sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_streams, SCTP_SO_NOT_LOCKED); + } else if (action == SCTP_STREAM_RESET_RESULT_IN_PROGRESS) { + /* +
svn commit: r285788 - head/sys/netinet6
Author: rrs Date: Wed Jul 22 09:29:50 2015 New Revision: 285788 URL: https://svnweb.freebsd.org/changeset/base/285788 Log: Fix inverted logic bug that David Wolfskill found (thanks David!) MFC after:3 Weeks Modified: head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet6/udp6_usrreq.c == --- head/sys/netinet6/udp6_usrreq.c Wed Jul 22 09:12:40 2015 (r285787) +++ head/sys/netinet6/udp6_usrreq.c Wed Jul 22 09:29:50 2015 (r285788) @@ -403,7 +403,7 @@ udp6_input(struct mbuf **mp, int *offp, INP_RLOCK(last); INP_INFO_RUNLOCK(pcbinfo); UDP_PROBE(receive, NULL, last, ip6, last, uh); - if (udp6_append(last, m, off, &fromsa)) + if (udp6_append(last, m, off, &fromsa) == 0) INP_RUNLOCK(last); inp_lost: return (IPPROTO_DONE); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r285740 - in head/sys: netinet netinet6
Author: rrs Date: Tue Jul 21 09:54:31 2015 New Revision: 285740 URL: https://svnweb.freebsd.org/changeset/base/285740 Log: When a tunneling protocol is being used with UDP we must release the lock on the INP before calling the tunnel protocol, else a LOR may occur (it does with SCTP for sure). Instead we must acquire a ref count and release the lock, taking care to allow for the case where the UDP socket has gone away and *not* unlocking since the refcnt decrement on the inp will do the unlock in that case. Reviewed by: tuexen MFC after:3 weeks Modified: head/sys/netinet/udp_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/udp_usrreq.c == --- head/sys/netinet/udp_usrreq.c Tue Jul 21 09:44:45 2015 (r285739) +++ head/sys/netinet/udp_usrreq.c Tue Jul 21 09:54:31 2015 (r285740) @@ -293,8 +293,17 @@ udplite_destroy(void) * contains the source address. If the socket ends up being an IPv6 socket, * udp_append() will convert to a sockaddr_in6 before passing the address * into the socket code. + * + * In the normal case udp_append() will return 0, indicating that you + * must unlock the inp. However if a tunneling protocol is in place we increment + * the inpcb refcnt and unlock the inp, on return from the tunneling protocol we + * then decrement the reference count. If the inp_rele returns 1, indicating the + * inp is gone, we return that to the caller to tell them *not* to unlock + * the inp. In the case of multi-cast this will cause the distribution + * to stop (though most tunneling protocols known currently do *not* use + * multicast). */ -static void +static int udp_append(struct inpcb *inp, struct ip *ip, struct mbuf *n, int off, struct sockaddr_in *udp_in) { @@ -313,9 +322,12 @@ udp_append(struct inpcb *inp, struct ip */ up = intoudpcb(inp); if (up->u_tun_func != NULL) { + in_pcbref(inp); + INP_RUNLOCK(inp); (*up->u_tun_func)(n, off, inp, (struct sockaddr *)udp_in, up->u_tun_ctx); - return; + INP_RLOCK(inp); + return (in_pcbrele_rlocked(inp)); } off += sizeof(struct udphdr); @@ -324,7 +336,7 @@ udp_append(struct inpcb *inp, struct ip /* Check AH/ESP integrity. */ if (ipsec4_in_reject(n, inp)) { m_freem(n); - return; + return (0); } #ifdef IPSEC_NAT_T up = intoudpcb(inp); @@ -332,14 +344,14 @@ udp_append(struct inpcb *inp, struct ip if (up->u_flags & UF_ESPINUDP_ALL) {/* IPSec UDP encaps. */ n = udp4_espdecap(inp, n, off); if (n == NULL) /* Consumed. */ - return; + return (0); } #endif /* IPSEC_NAT_T */ #endif /* IPSEC */ #ifdef MAC if (mac_inpcb_check_deliver(inp, n) != 0) { m_freem(n); - return; + return (0); } #endif /* MAC */ if (inp->inp_flags & INP_CONTROLOPTS || @@ -373,6 +385,7 @@ udp_append(struct inpcb *inp, struct ip UDPSTAT_INC(udps_fullsock); } else sorwakeup_locked(so); + return (0); } int @@ -579,8 +592,10 @@ udp_input(struct mbuf **mp, int *offp, i if ((n = m_copy(m, 0, M_COPYALL)) != NULL) { UDP_PROBE(receive, NULL, last, ip, last, uh); - udp_append(last, ip, n, iphlen, - &udp_in); + if (udp_append(last, ip, n, iphlen, + &udp_in)) { + goto inp_lost; + } } INP_RUNLOCK(last); } @@ -611,8 +626,9 @@ udp_input(struct mbuf **mp, int *offp, i goto badunlocked; } UDP_PROBE(receive, NULL, last, ip, last, uh); - udp_append(last, ip, m, iphlen, &udp_in); - INP_RUNLOCK(last); + if (udp_append(last, ip, m, iphlen, &udp_in) == 0) + INP_RUNLOCK(last); + inp_lost: INP_INFO_RUNLOCK(pcbinfo); return (IPPROTO_DONE); } @@ -700,8 +716,8 @@ udp_input(struct mbuf **mp, int *offp, i } UDP_PROBE(receive, NULL, inp, ip, inp, uh); - udp_append(inp, ip, m, iphlen, &udp_in); - INP_RUNLOCK(inp); + if (udp_append(inp, ip, m, iphlen, &udp_in) == 0) + INP_RUNLOCK(inp); return (IPPROTO_DONE); badunlocked: Modified: head/sy
svn commit: r281657 - in stable/10/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
Author: rrs Date: Fri Apr 17 15:39:42 2015 New Revision: 281657 URL: https://svnweb.freebsd.org/changeset/base/281657 Log: MFC of r280785, r280871, r280872, r281510, r218511 - callout fixes. Sponsored by: Netflix Inc. Modified: stable/10/sys/kern/kern_timeout.c stable/10/sys/netgraph/atm/sscop/ng_sscop_cust.h stable/10/sys/netgraph/atm/uni/ng_uni_cust.h stable/10/sys/sys/_callout.h stable/10/sys/sys/callout.h Modified: stable/10/sys/kern/kern_timeout.c == --- stable/10/sys/kern/kern_timeout.c Fri Apr 17 15:26:08 2015 (r281656) +++ stable/10/sys/kern/kern_timeout.c Fri Apr 17 15:39:42 2015 (r281657) @@ -150,9 +150,12 @@ struct callout_cpu { sbintime_t cc_lastscan; void*cc_cookie; u_int cc_bucket; + u_int cc_inited; charcc_ktr_event_name[20]; }; +#definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION) + #definecc_exec_curr(cc, dir) cc->cc_exec_entity[dir].cc_curr #definecc_exec_next(cc)cc->cc_next #definecc_exec_cancel(cc, dir) cc->cc_exec_entity[dir].cc_cancel @@ -253,6 +256,7 @@ callout_callwheel_init(void *dummy) * XXX: Clip callout to result of previous function of maxusers * maximum 384. This is still huge, but acceptable. */ + memset(cc_cpu, 0, sizeof(cc_cpu)); ncallout = imin(16 + maxproc + maxfiles, 18508); TUNABLE_INT_FETCH("kern.ncallout", &ncallout); @@ -288,6 +292,7 @@ callout_cpu_init(struct callout_cpu *cc, mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); + cc->cc_inited = 1; cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, M_CALLOUT, M_WAITOK); for (i = 0; i < callwheelsize; i++) @@ -303,7 +308,7 @@ callout_cpu_init(struct callout_cpu *cc, for (i = 0; i < ncallout; i++) { c = &cc->cc_callout[i]; callout_init(c, 0); - c->c_flags = CALLOUT_LOCAL_ALLOC; + c->c_iflags = CALLOUT_LOCAL_ALLOC; SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); } } @@ -440,7 +445,7 @@ callout_process(sbintime_t now) * Consumer told us the callout may be run * directly from hardware interrupt context. */ - if (tmp->c_flags & CALLOUT_DIRECT) { + if (tmp->c_iflags & CALLOUT_DIRECT) { #ifdef CALLOUT_PROFILING ++depth_dir; #endif @@ -460,7 +465,7 @@ callout_process(sbintime_t now) LIST_REMOVE(tmp, c_links.le); TAILQ_INSERT_TAIL(&cc->cc_expireq, tmp, c_links.tqe); - tmp->c_flags |= CALLOUT_PROCESSED; + tmp->c_iflags |= CALLOUT_PROCESSED; tmp = tmpn; } continue; @@ -546,8 +551,11 @@ callout_cc_add(struct callout *c, struct if (sbt < cc->cc_lastscan) sbt = cc->cc_lastscan; c->c_arg = arg; - c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING); - c->c_flags &= ~CALLOUT_PROCESSED; + c->c_iflags |= CALLOUT_PENDING; + c->c_iflags &= ~CALLOUT_PROCESSED; + c->c_flags |= CALLOUT_ACTIVE; + if (flags & C_DIRECT_EXEC) + c->c_iflags |= CALLOUT_DIRECT; c->c_func = func; c->c_time = sbt; c->c_precision = precision; @@ -577,7 +585,7 @@ static void callout_cc_del(struct callout *c, struct callout_cpu *cc) { - if ((c->c_flags & CALLOUT_LOCAL_ALLOC) == 0) + if ((c->c_iflags & CALLOUT_LOCAL_ALLOC) == 0) return; c->c_func = NULL; SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); @@ -596,7 +604,7 @@ softclock_call_cc(struct callout *c, str struct lock_class *class; struct lock_object *c_lock; uintptr_t lock_status; - int c_flags; + int c_iflags; #ifdef SMP struct callout_cpu *new_cc; void (*new_func)(void *); @@ -611,9 +619,10 @@ softclock_call_cc(struct callout *c, str static timeout_t *lastfunc; #endif - KASSERT((c->c_flags & (CALLOUT_PENDING | CALLOUT_ACTIVE)) == - (CALLOUT_PENDING | CALLOUT_ACTIVE), - ("softclock_call_cc: pend|act %p %x", c, c->c_flags)); + KASSERT((c->c_iflags & CALLOUT_PENDING) == CALLOUT_PENDING, + ("softclock_call_cc: pend %p %x", c, c->c_iflags)); + KASSERT((c->c_flags & CALLOUT_A
svn commit: r281511 - head/sys/kern
Author: rrs Date: Tue Apr 14 00:02:39 2015 New Revision: 281511 URL: https://svnweb.freebsd.org/changeset/base/281511 Log: Fix my stupid restoral of old code.. must be c_iflags now. Thanks jhb for catching my stupidity... MFC after:3 days Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cMon Apr 13 23:06:13 2015 (r281510) +++ head/sys/kern/kern_timeout.cTue Apr 14 00:02:39 2015 (r281511) @@ -592,7 +592,7 @@ callout_cc_add(struct callout *c, struct c->c_iflags &= ~CALLOUT_PROCESSED; c->c_flags |= CALLOUT_ACTIVE; if (flags & C_DIRECT_EXEC) - c->c_flags |= CALLOUT_DIRECT; + c->c_iflags |= CALLOUT_DIRECT; c->c_func = func; c->c_time = sbt; c->c_precision = precision; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r281510 - head/sys/kern
Crud Your right.. On Apr 13, 2015, at 7:23 PM, John Baldwin wrote: > On Monday, April 13, 2015 11:06:14 PM Randall Stewart wrote: >> Author: rrs >> Date: Mon Apr 13 23:06:13 2015 >> New Revision: 281510 >> URL: https://svnweb.freebsd.org/changeset/base/281510 >> >> Log: >> Restore the two lines accidentally deleted that allow CALLOUT_DIRECT to be >> specifed in the flags. >> >> Thanks Mark Johnston for noticing this ;-o > > Shouldn't this be an internal flag? I think CALLOUT_ACTIVE should be the only > non-internal flag, yes? > > -- > John Baldwin Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281510 - head/sys/kern
Author: rrs Date: Mon Apr 13 23:06:13 2015 New Revision: 281510 URL: https://svnweb.freebsd.org/changeset/base/281510 Log: Restore the two lines accidentally deleted that allow CALLOUT_DIRECT to be specifed in the flags. Thanks Mark Johnston for noticing this ;-o MFC after:3 days Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cMon Apr 13 22:51:09 2015 (r281509) +++ head/sys/kern/kern_timeout.cMon Apr 13 23:06:13 2015 (r281510) @@ -591,6 +591,8 @@ callout_cc_add(struct callout *c, struct c->c_iflags |= CALLOUT_PENDING; c->c_iflags &= ~CALLOUT_PROCESSED; c->c_flags |= CALLOUT_ACTIVE; + if (flags & C_DIRECT_EXEC) + c->c_flags |= CALLOUT_DIRECT; c->c_func = func; c->c_time = sbt; c->c_precision = precision; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r281235 - stable/10/usr.sbin/pmcstudy
Author: rrs Date: Tue Apr 7 21:05:52 2015 New Revision: 281235 URL: https://svnweb.freebsd.org/changeset/base/281235 Log: MFC of r280697 and r280698 Sponsored by: Netflix Inc. Added: stable/10/usr.sbin/pmcstudy/pmcstudy.8 - copied, changed from r280697, head/usr.sbin/pmcstudy/pmcstudy.8 Deleted: stable/10/usr.sbin/pmcstudy/pmcstudy.1 Modified: stable/10/usr.sbin/pmcstudy/Makefile stable/10/usr.sbin/pmcstudy/pmcstudy.c Modified: stable/10/usr.sbin/pmcstudy/Makefile == --- stable/10/usr.sbin/pmcstudy/MakefileTue Apr 7 20:29:03 2015 (r281234) +++ stable/10/usr.sbin/pmcstudy/MakefileTue Apr 7 21:05:52 2015 (r281235) @@ -2,6 +2,7 @@ # $FreeBSD$ PROG= pmcstudy +MAN= pmcstudy.8 SRCS= pmcstudy.c eval_expr.c CFLAGS+= -Wall -Werror Copied and modified: stable/10/usr.sbin/pmcstudy/pmcstudy.8 (from r280697, head/usr.sbin/pmcstudy/pmcstudy.8) == --- head/usr.sbin/pmcstudy/pmcstudy.8 Thu Mar 26 15:40:47 2015 (r280697, copy source) +++ stable/10/usr.sbin/pmcstudy/pmcstudy.8 Tue Apr 7 21:05:52 2015 (r281235) @@ -25,7 +25,7 @@ .\" $FreeBSD$ .\" .Dd Mar 26, 2015 -.Dt PMCSTUDY 1 +.Dt PMCSTUDY 8 .Os .Sh NAME .Nm pmcstudy Modified: stable/10/usr.sbin/pmcstudy/pmcstudy.c == --- stable/10/usr.sbin/pmcstudy/pmcstudy.c Tue Apr 7 20:29:03 2015 (r281234) +++ stable/10/usr.sbin/pmcstudy/pmcstudy.c Tue Apr 7 21:05:52 2015 (r281235) @@ -2130,7 +2130,11 @@ test_for_a_pmc(const char *pmc, int out_ printf(" "); } } - printf("%s", &line[j]); + if (len) { + printf("%s", &line[j]); + } else { + printf("\n"); + } goto out; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r280785 - in head/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
On Mar 30, 2015, at 9:16 AM, John Baldwin wrote: > On Saturday, March 28, 2015 12:50:24 PM Randall Stewart wrote: >> Author: rrs >> Date: Sat Mar 28 12:50:24 2015 >> New Revision: 280785 >> URL: https://svnweb.freebsd.org/changeset/base/280785 >> >> Log: >> Change the callout to supply -1 to indicate we are not changing >> CPU, also add protection against invalid CPU's as well as >> split c_flags and c_iflags so that if a user plays with the active >> flag (the one expected to be played with by callers in MPSAFE) without >> a lock, it won't adversely affect the callout system by causing a corrupt >> list. This also means that all callers need to use the macros and *not* >> play with the falgs directly (like netgraph used to). >> >> Differential Revision: htts://reviews.freebsd.org/D1894 >> Reviewed by: .. timed out but looked at by jhb, imp, adrian hselasky >> tested by hiren and netflix. >> Sponsored by: Netflix Inc. > > Please use NOCPU rather than -1 directly for the CPU field when not > moving a callout. > John: I have made *all* of your suggested changes, adopting the comments and moving migration to kern_timeout.c.. thanks.. Now as to the -1 -> NOCPU This is like pulling on a string on your sweater.. the only sensible solution that I could come up with after chatting with Lawrence is to add #include to everyone that uses the callout.h and does not have it already… (putting it into callout.h does not work) .. sigh.. Now for this cosmetic change I end up with the following changes (and as yet I have not built LINT or universe so there may be more).. I have spent about 2 hours on this so far and I can at least build a kernel with the change for amd64 :-0 Here is what has to change, do you really think that this is worth it? Note I did not look into moving NOCPU in proc.h it says it means no CPU is present which is sort of the meaning we want.. I am not sure if the define could be moved .. but that too may be yet another string... Is this worth it, or do you have another idea on how best to do this??? R --- M amd64/vmm/io/vatpit.c M amd64/vmm/io/vhpet.c M amd64/vmm/io/vlapic.c M amd64/vmm/io/vrtc.c M cam/ctl/ctl.c M cam/ctl/ctl_frontend_iscsi.c M cam/ctl/ctl_tpc.c M cam/scsi/scsi_cd.c M cam/scsi/scsi_enc.c M conf/kern.opts.mk M dev/aac/aac.c M dev/aacraid/aacraid.c M dev/advansys/advansys.c M dev/advansys/advlib.c M dev/advansys/adwcam.c M dev/ae/if_ae.c M dev/age/if_age.c M dev/aha/aha.c M dev/ahci/ahci.c M dev/aic/aic.c M dev/aic7xxx/ahc_isa.c M dev/aic7xxx/ahc_pci.c M dev/aic7xxx/aic7770.c M dev/aic7xxx/aic79xx_osm.h M dev/aic7xxx/aic7xxx.c M dev/aic7xxx/aic7xxx_93cx6.c M dev/aic7xxx/aic7xxx_osm.c M dev/aic7xxx/aic7xxx_pci.c M dev/aic7xxx/aic7xxx_reg_print.c M dev/alc/if_alc.c M dev/ale/if_ale.c M dev/ata/ata-all.c M dev/ata/ata-lowlevel.c M dev/ath/if_ath.c M dev/ath/if_ath_led.c M dev/atkbdc/psm.c M dev/bce/if_bce.c M dev/bfe/if_bfe.c M dev/bge/if_bge.c M dev/buslogic/bt.c M dev/bwn/if_bwn.c M dev/bxe/bxe.h M dev/cas/if_cas.c M dev/ciss/ciss.c M dev/cmx/cmx.c M dev/cs/if_cs.c M dev/cxgbe/t4_main.c M dev/cxgbe/t4_sge.c M dev/dc/if_dc.c M dev/de/if_de.c M dev/dpt/dpt_scsi.c M dev/e1000/if_em.c M dev/e1000/if_igb.c M dev/e1000/if_lem.c M dev/ed/if_ed.c M dev/ep/if_ep.c M dev/esp/ncr53c9x.c M dev/fatm/if_fatm.c M dev/fe/if_fe.c M dev/firewire/firewire.c M dev/firewire/sbp.c M dev/firewire/sbp_targ.c M dev/fxp/if_fxp.c M dev/gem/if_gem.c M dev/hme/if_hme.c M dev/hpt27xx/os_bsd.h M dev/hptiop/hptiop.c M dev/hptnr/os_bsd.h M dev/hptrr/os_bsd.h M dev/ida/ida.c M dev/iir/iir.c M dev/ips/ips.c M dev/ipw/if_ipw.c M dev/isci/isci.h M dev/iscsi/iscsi.c M dev/iwn/if_iwn.c M dev/le/lance.c M dev/led/led.c M dev/lge/if_lge.c M dev/lmc/if_lmc.c M dev/malo/if_malo.c M dev/mcd/mcd.c M dev/mlx/mlx.c M dev/mpr/mpr_sas.c M dev/mps/mps_sas.c M dev/mps/mps_sas_lsi.c M dev/msk/if_msk.c M dev/mvs/mvs.c M dev/mwl/if_mwl.c M dev/mxge/if_mxge.c M dev/my/if_my.c M dev/nfe/if_nfe.c M dev/nge/if_nge.c M dev/ntb/if_ntb/if_ntb.c M dev/ntb/ntb_hw/ntb_hw.c M dev/patm/if_patm_tx.c M dev/pcn/if_pcn.c M dev/ppbus/lpt.c M dev/ppbus/pps.c M dev/ral/rt2560.c M dev/ral/rt2661.c M dev/ral/rt2860.c M dev/re/if_re.c M
svn commit: r280872 - in head/sys: kern sys
Author: rrs Date: Tue Mar 31 00:18:00 2015 New Revision: 280872 URL: https://svnweb.freebsd.org/changeset/base/280872 Log: Adopt jhb's suggested changes, updated comments and callout_migration() moving to kern/kern_timeout.c This does *not* address his -1 -> NOCPU comment. Sponsored by: Netflix Inc. Modified: head/sys/kern/kern_timeout.c head/sys/sys/callout.h Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cTue Mar 31 00:15:27 2015 (r280871) +++ head/sys/kern/kern_timeout.cTue Mar 31 00:18:00 2015 (r280872) @@ -167,6 +167,8 @@ struct callout_cpu { charcc_ktr_event_name[20]; }; +#definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION) + #definecc_exec_curr(cc, dir) cc->cc_exec_entity[dir].cc_curr #definecc_exec_next(cc)cc->cc_next #definecc_exec_cancel(cc, dir) cc->cc_exec_entity[dir].cc_cancel Modified: head/sys/sys/callout.h == --- head/sys/sys/callout.h Tue Mar 31 00:15:27 2015(r280871) +++ head/sys/sys/callout.h Tue Mar 31 00:18:00 2015(r280872) @@ -68,18 +68,18 @@ struct callout_handle { * field is the one that caller operations that may, or may not have * a lock touches i.e. callout_deactivate(). The other, the c_iflags, * is the internal flags that *must* be kept correct on which the - * callout system depend on i.e. callout_migrating() & callout_pending(), - * these are used internally by the callout system to determine which - * list and other critical internal state. Callers *should not* use the - * c_flags field directly but should use the macros! + * callout system depend on e.g. callout_pending(). + * The c_iflag is used internally by the callout system to determine which + * list the callout is on and track internal state. Callers *should not* + * use the c_flags field directly but should use the macros provided. * - * If the caller wants to keep the c_flags field sane they - * should init with a mutex *or* if using the older - * mpsafe option, they *must* lock there own lock - * before calling callout_deactivate(). + * The c_iflags field holds internal flags that are protected by internal + * locks of the callout subsystem. The c_flags field holds external flags. + * The caller must hold its own lock while manipulating or reading external + * flags via callout_active(), callout_deactivate(), callout_reset*(), or + * callout_stop() to avoid races. */ #definecallout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) -#definecallout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION) #definecallout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) #definecallout_drain(c)_callout_stop_safe(c, 1) void callout_init(struct callout *, int); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r280871 - head/sys/sys
Author: rrs Date: Tue Mar 31 00:15:27 2015 New Revision: 280871 URL: https://svnweb.freebsd.org/changeset/base/280871 Log: Change the c_iflags and c_flags fields to short rather then int. This allows us to keep the KPI the same. Discussed and brain-stormed with imp (thanks for the help Warner!) Sponsored by: Netflix Inc. Modified: head/sys/sys/_callout.h Modified: head/sys/sys/_callout.h == --- head/sys/sys/_callout.h Tue Mar 31 00:00:47 2015(r280870) +++ head/sys/sys/_callout.h Tue Mar 31 00:15:27 2015(r280871) @@ -57,8 +57,8 @@ struct callout { void*c_arg; /* function argument */ void(*c_func)(void *); /* function to call */ struct lock_object *c_lock; /* lock to handle */ - int c_flags;/* User State */ - int c_iflags; /* Internal State */ + short c_flags;/* User State */ + short c_iflags; /* Internal State */ volatile int c_cpu; /* CPU we're scheduled on */ }; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r280785 - in head/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
John: FYI in getting this setup, NOCPU will mean callout.h will need to include sys/proc.h I hope thats ok.. either that or I need to do a #ifndef NOCPU #define NOCPU (-1) #endif.. Which seems ugly.. R On Mar 30, 2015, at 2:38 PM, John Baldwin wrote: > On Monday, March 30, 2015 11:16:20 AM John Baldwin wrote: >> The second sentence quite seem to be English ("have a lock touches" > > s/sentence quite/sentence doesn't quite/ *sigh* > > -- > John Baldwin Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r280785 - in head/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
John: Comments below.. On Mar 30, 2015, at 9:16 AM, John Baldwin wrote: > On Saturday, March 28, 2015 12:50:24 PM Randall Stewart wrote: >> Author: rrs >> Date: Sat Mar 28 12:50:24 2015 >> New Revision: 280785 >> URL: https://svnweb.freebsd.org/changeset/base/280785 >> >> Log: >> Change the callout to supply -1 to indicate we are not changing >> CPU, also add protection against invalid CPU's as well as >> split c_flags and c_iflags so that if a user plays with the active >> flag (the one expected to be played with by callers in MPSAFE) without >> a lock, it won't adversely affect the callout system by causing a corrupt >> list. This also means that all callers need to use the macros and *not* >> play with the falgs directly (like netgraph used to). >> >> Differential Revision: htts://reviews.freebsd.org/D1894 >> Reviewed by: .. timed out but looked at by jhb, imp, adrian hselasky >> tested by hiren and netflix. >> Sponsored by: Netflix Inc. > > Please use NOCPU rather than -1 directly for the CPU field when not > moving a callout. ok, did not no a “NOCPU” was defined .. thanks.. > >> Modified: head/sys/sys/callout.h >> == >> --- head/sys/sys/callout.h Sat Mar 28 12:23:15 2015(r280784) >> +++ head/sys/sys/callout.h Sat Mar 28 12:50:24 2015(r280785) >> @@ -63,8 +63,23 @@ struct callout_handle { >> }; >> >> #ifdef _KERNEL >> +/* >> + * Note the flags field is actually *two* fields. The c_flags >> + * field is the one that caller operations that may, or may not have >> + * a lock touches i.e. callout_deactivate(). The other, the c_iflags, >> + * is the internal flags that *must* be kept correct on which the >> + * callout system depend on i.e. callout_migrating() & callout_pending(), >> + * these are used internally by the callout system to determine which >> + * list and other critical internal state. Callers *should not* use the >> + * c_flags field directly but should use the macros! >> + * >> + * If the caller wants to keep the c_flags field sane they >> + * should init with a mutex *or* if using the older >> + * mpsafe option, they *must* lock there own lock >> + * before calling callout_deactivate(). > > Some wording suggestions: > > "is actually" -> "is split across" > > The second sentence quite seem to be English ("have a lock touches" > which I think means "hold a lock while touching" or some such), but > you can perhaps use this for the rest of the comment: > > "The c_iflags field holds internal flags that are protected by internal > locks of the callout subsystem. The c_flags field holds external flags. > The caller must hold its own lock while manipulating or reading external > flags via callout_active(), callout_deactivate(), callout_reset*(), or > callout_stop() to avoid races." > > (Also, please use double spaces after periods) ok I will commit that with my split to short/short. > >> + */ >> #define callout_active(c) ((c)->c_flags & CALLOUT_ACTIVE) >> -#define callout_migrating(c)((c)->c_flags & CALLOUT_DFRMIGRATION) >> +#define callout_migrating(c)((c)->c_iflags & CALLOUT_DFRMIGRATION) > > I would just move this into the C file. It isn't useful outside of the > implementation as far as I know. This then avoids having to explain to > users that they shouldn't see it in the block comment since it would no > longer be there. :) > Ok that sounds fine, I too doubt it would be used outside the kern_timeout.c file ;-) R >> #define callout_deactivate(c) ((c)->c_flags &= ~CALLOUT_ACTIVE) >> #define callout_drain(c)_callout_stop_safe(c, 1) >> void callout_init(struct callout *, int); > > -- > John Baldwin Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r280785 - in head/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
John: As I just said, Warner and I feel we can get by with making the int -> short/short so we preserver the KPI and at the same time achieve the objective .. My big concern was no intel platforms but Warner gave me a green light there ;-) R On Mar 30, 2015, at 10:10 AM, John Baldwin wrote: > On Saturday, March 28, 2015 01:48:49 PM Davide Italiano wrote: >> On Sat, Mar 28, 2015 at 12:04 PM, Randall Stewart wrote: >>> Hmm does the KPI include the size of the callout structure (which is >>> private)? >>> >> >> It's KBI, not KPI. >> >>> If so I suppose we could change the c_flags/c_iflags to >>> ushort … >>> >> >> I'm not familiar with your changes enough to suggest/propose a fix. >> As I previously mentioned, this looks suspicious KBI-wise to me, and I >> reported to you. > > The KBI issue makes it much harder to MFC. In particular, even though > you could move 'c_iflags' to the end to fix most things (though not > callout_pending()), many drivers have 'struct callout foo' inside their > softc, etc. and this would break existing modules. > > OTOH, the uglier hack of adding locking in callout_deactivate() would > preserve the KBI and be safe to merge. > > -- > John Baldwin Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r280785 - in head/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
Davide: I have had a long chat this weekend with imp, and both he and I feel the right fix is to *not* bump the version, but instead change the two fields to shorts. That way the length will still say the same so we can MFC this. I will be committing that shortly, I have it testing inside right now… :-) R On Mar 28, 2015, at 2:48 PM, Davide Italiano wrote: > On Sat, Mar 28, 2015 at 12:04 PM, Randall Stewart wrote: >> Hmm does the KPI include the size of the callout structure (which is >> private)? >> > > It's KBI, not KPI. > >> If so I suppose we could change the c_flags/c_iflags to >> ushort … >> > > I'm not familiar with your changes enough to suggest/propose a fix. > As I previously mentioned, this looks suspicious KBI-wise to me, and I > reported to you. > > -- > Davide > > "There are no solved problems; there are only problems that are more > or less solved" -- Henri Poincare Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r280785 - in head/sys: kern netgraph/atm/sscop netgraph/atm/uni sys
Author: rrs Date: Sat Mar 28 12:50:24 2015 New Revision: 280785 URL: https://svnweb.freebsd.org/changeset/base/280785 Log: Change the callout to supply -1 to indicate we are not changing CPU, also add protection against invalid CPU's as well as split c_flags and c_iflags so that if a user plays with the active flag (the one expected to be played with by callers in MPSAFE) without a lock, it won't adversely affect the callout system by causing a corrupt list. This also means that all callers need to use the macros and *not* play with the falgs directly (like netgraph used to). Differential Revision: htts://reviews.freebsd.org/D1894 Reviewed by: .. timed out but looked at by jhb, imp, adrian hselasky tested by hiren and netflix. Sponsored by: Netflix Inc. Modified: head/sys/kern/kern_timeout.c head/sys/netgraph/atm/sscop/ng_sscop_cust.h head/sys/netgraph/atm/uni/ng_uni_cust.h head/sys/sys/_callout.h head/sys/sys/callout.h Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cSat Mar 28 12:23:15 2015 (r280784) +++ head/sys/kern/kern_timeout.cSat Mar 28 12:50:24 2015 (r280785) @@ -163,6 +163,7 @@ struct callout_cpu { sbintime_t cc_lastscan; void*cc_cookie; u_int cc_bucket; + u_int cc_inited; charcc_ktr_event_name[20]; }; @@ -266,6 +267,7 @@ callout_callwheel_init(void *dummy) * XXX: Clip callout to result of previous function of maxusers * maximum 384. This is still huge, but acceptable. */ + memset(cc_cpu, 0, sizeof(cc_cpu)); ncallout = imin(16 + maxproc + maxfiles, 18508); TUNABLE_INT_FETCH("kern.ncallout", &ncallout); @@ -307,6 +309,7 @@ callout_cpu_init(struct callout_cpu *cc, mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); + cc->cc_inited = 1; cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, M_CALLOUT, M_WAITOK); for (i = 0; i < callwheelsize; i++) @@ -322,7 +325,7 @@ callout_cpu_init(struct callout_cpu *cc, for (i = 0; i < ncallout; i++) { c = &cc->cc_callout[i]; callout_init(c, 0); - c->c_flags = CALLOUT_LOCAL_ALLOC; + c->c_iflags = CALLOUT_LOCAL_ALLOC; SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); } } @@ -477,7 +480,7 @@ callout_process(sbintime_t now) * Consumer told us the callout may be run * directly from hardware interrupt context. */ - if (tmp->c_flags & CALLOUT_DIRECT) { + if (tmp->c_iflags & CALLOUT_DIRECT) { #ifdef CALLOUT_PROFILING ++depth_dir; #endif @@ -497,7 +500,7 @@ callout_process(sbintime_t now) LIST_REMOVE(tmp, c_links.le); TAILQ_INSERT_TAIL(&cc->cc_expireq, tmp, c_links.tqe); - tmp->c_flags |= CALLOUT_PROCESSED; + tmp->c_iflags |= CALLOUT_PROCESSED; tmp = tmpn; } continue; @@ -583,8 +586,9 @@ callout_cc_add(struct callout *c, struct if (sbt < cc->cc_lastscan) sbt = cc->cc_lastscan; c->c_arg = arg; - c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING); - c->c_flags &= ~CALLOUT_PROCESSED; + c->c_iflags |= CALLOUT_PENDING; + c->c_iflags &= ~CALLOUT_PROCESSED; + c->c_flags |= CALLOUT_ACTIVE; c->c_func = func; c->c_time = sbt; c->c_precision = precision; @@ -614,7 +618,7 @@ static void callout_cc_del(struct callout *c, struct callout_cpu *cc) { - if ((c->c_flags & CALLOUT_LOCAL_ALLOC) == 0) + if ((c->c_iflags & CALLOUT_LOCAL_ALLOC) == 0) return; c->c_func = NULL; SLIST_INSERT_HEAD(&cc->cc_callfree, c, c_links.sle); @@ -633,7 +637,7 @@ softclock_call_cc(struct callout *c, str struct lock_class *class; struct lock_object *c_lock; uintptr_t lock_status; - int c_flags; + int c_iflags; #ifdef SMP struct callout_cpu *new_cc; void (*new_func)(void *); @@ -648,9 +652,10 @@ softclock_call_cc(struct callout *c, str static timeout_t *lastfunc; #endif - KASSERT((c->c_flags & (CALLOUT_PENDING | CALLOUT_ACTIVE)) == - (CALLOUT_PENDING | CALLOUT_ACTIVE), - ("softclock_call_cc: pend|act %p %x", c, c->c_flags)); + KAS
svn commit: r280710 - head
Author: rrs Date: Thu Mar 26 20:08:25 2015 New Revision: 280710 URL: https://svnweb.freebsd.org/changeset/base/280710 Log: Per Gleb, add the pmcstudy.1.gz which was moved to pmcstudy.8.gz Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Thu Mar 26 19:33:07 2015(r280709) +++ head/ObsoleteFiles.inc Thu Mar 26 20:08:25 2015(r280710) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20150326 +OLD_FILES+=usr/share/man/man1/pmcstudy.1.gz # 20150315: new clang import which bumps version from 3.5.1 to 3.6.0. OLD_FILES+=usr/include/clang/3.5.1/__wmmintrin_aes.h OLD_FILES+=usr/include/clang/3.5.1/__wmmintrin_pclmul.h ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r280698 - head/usr.sbin/pmcstudy
Author: rrs Date: Thu Mar 26 15:43:57 2015 New Revision: 280698 URL: https://svnweb.freebsd.org/changeset/base/280698 Log: Opps its section 8 not 1 silly. MFC after:3 days Sponsored by: Netflix Modified: head/usr.sbin/pmcstudy/pmcstudy.8 Modified: head/usr.sbin/pmcstudy/pmcstudy.8 == --- head/usr.sbin/pmcstudy/pmcstudy.8 Thu Mar 26 15:40:47 2015 (r280697) +++ head/usr.sbin/pmcstudy/pmcstudy.8 Thu Mar 26 15:43:57 2015 (r280698) @@ -25,7 +25,7 @@ .\" $FreeBSD$ .\" .Dd Mar 26, 2015 -.Dt PMCSTUDY 1 +.Dt PMCSTUDY 8 .Os .Sh NAME .Nm pmcstudy ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r280697 - head/usr.sbin/pmcstudy
on what formulas that you want to run. The expression given to +the +.Fl E +option is a "formula". The formula can declare directly the PMC's by name +or you can use an abbreviation %NNN. To find out the abbreviations +on your system you may run the +.Fl L +option. +An example of a formula of your own might be +.Fl E +"FP_ASSIST.ANY / INST_RETIRED.ANY_P" or using the abbreviations on a +Haswell machine you would type +.Fl E +" %176 / %150". You must have spaces between each entry and +you may use paraenthisis to prioritize the operators. Add (+), Subtract (-), +Divide (/) and Multiplication (*) are supported. You may also introduce +constant numbers as well. So for example you can do a standard efficency +test like +.FL E +"UOPS_RETIRED.RETIRE_SLOTS / (4 * CPU_CLK_UNHALTED.THREAD_P)". + +.It Fl L +This option will list all known PMC's and there abbreviation (%NNN). +.Sh SEE ALSO +.Xr pmc 3 , +.Xr pmclog 3 , +.Xr hwpmc 4 , +.Xr pmcstat 8 , +.Sh HISTORY +The +.Nm +utility first appeared in +.Fx 11.0. +.Sh AUTHORS +.An Randall Stewart Aq Mt r...@freebsd.org Modified: head/usr.sbin/pmcstudy/pmcstudy.c == --- head/usr.sbin/pmcstudy/pmcstudy.c Thu Mar 26 15:27:38 2015 (r280696) +++ head/usr.sbin/pmcstudy/pmcstudy.c Thu Mar 26 15:40:47 2015 (r280697) @@ -2139,7 +2139,11 @@ test_for_a_pmc(const char *pmc, int out_ printf(" "); } } - printf("%s", &line[j]); + if (len) { + printf("%s", &line[j]); + } else { + printf("\n"); + } goto out; } } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r280455 - in stable/10: lib/libpmc sys/amd64/conf sys/dev/hwpmc sys/sys usr.sbin usr.sbin/pmcstudy
Author: rrs Date: Tue Mar 24 20:00:11 2015 New Revision: 280455 URL: https://svnweb.freebsd.org/changeset/base/280455 Log: MFC of r277177 and r279894 with the fixes for the PMC for Haswell. Sponsored by: Netflix Inc. Added: stable/10/usr.sbin/pmcstudy/ - copied from r277177, head/usr.sbin/pmcstudy/ Modified: stable/10/lib/libpmc/libpmc.c stable/10/sys/amd64/conf/GENERIC stable/10/sys/dev/hwpmc/hwpmc_core.c stable/10/sys/dev/hwpmc/hwpmc_intel.c stable/10/sys/dev/hwpmc/hwpmc_logging.c stable/10/sys/dev/hwpmc/hwpmc_mod.c stable/10/sys/dev/hwpmc/hwpmc_piv.c stable/10/sys/dev/hwpmc/hwpmc_uncore.c stable/10/sys/dev/hwpmc/hwpmc_x86.c stable/10/sys/dev/hwpmc/pmc_events.h stable/10/sys/sys/pmc.h stable/10/usr.sbin/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libpmc/libpmc.c == --- stable/10/lib/libpmc/libpmc.c Tue Mar 24 19:25:36 2015 (r280454) +++ stable/10/lib/libpmc/libpmc.c Tue Mar 24 20:00:11 2015 (r280455) @@ -200,6 +200,12 @@ static const struct pmc_event_descr hasw __PMC_EV_ALIAS_HASWELL() }; +static const struct pmc_event_descr haswell_xeon_event_table[] = +{ + __PMC_EV_ALIAS_HASWELL_XEON() +}; + + static const struct pmc_event_descr ivybridge_event_table[] = { __PMC_EV_ALIAS_IVYBRIDGE() @@ -267,6 +273,7 @@ PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOF PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(haswell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); @@ -312,6 +319,7 @@ PMC_CLASS_TABLE_DESC(core2, IAP, core2, PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap); PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap); +PMC_CLASS_TABLE_DESC(haswell_xeon, IAP, haswell, iap); PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap); PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap); PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); @@ -626,6 +634,8 @@ static struct pmc_event_alias core2_alia #define nehalem_ex_aliases_without_iaf core2_aliases_without_iaf #define haswell_aliasescore2_aliases #define haswell_aliases_without_iafcore2_aliases_without_iaf +#define haswell_xeon_aliases core2_aliases +#define haswell_xeon_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_aliases core2_aliases #define ivybridge_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_xeon_aliases core2_aliases @@ -896,7 +906,8 @@ iap_allocate_pmc(enum pmc_event pe, char n = pmc_parse_mask(iap_rsp_mask_sb_sbx_ib, p, &rsp); } else return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL) { + } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL || + cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL_XEON) { if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { n = pmc_parse_mask(iap_rsp_mask_haswell, p, &rsp); } else @@ -2788,6 +2799,10 @@ pmc_event_names_of_class(enum pmc_class ev = haswell_event_table; count = PMC_EVENT_TABLE_SIZE(haswell); break; + case PMC_CPU_INTEL_HASWELL_XEON: + ev = haswell_xeon_event_table; + count = PMC_EVENT_TABLE_SIZE(haswell_xeon); + break; case PMC_CPU_INTEL_IVYBRIDGE: ev = ivybridge_event_table; count = PMC_EVENT_TABLE_SIZE(ivybridge); @@ -3115,6 +3130,9 @@ pmc_init(void) pmc_class_table[n++] = &haswelluc_class_table_descr; PMC_MDEP_INIT_INTEL_V2(haswell); break; + case PMC_CPU_INTEL_HASWELL_XEON: + PMC_MDEP_INIT_INTEL_V2(haswell_xeon); + break; case PMC_CPU_INTEL_IVYBRIDGE: PMC_MDEP_INIT_INTEL_V2(ivybridge); break; @@ -3280,6 +3298,11 @@ _pmc_name_of_event(enum pmc_event pe, en ev = haswell_event_table; evfence = haswell_event_table + PMC_EVENT_TABLE_SIZE(haswell);
svn commit: r279894 - head/sys/dev/hwpmc
Author: rrs Date: Wed Mar 11 20:15:49 2015 New Revision: 279894 URL: https://svnweb.freebsd.org/changeset/base/279894 Log: You need to have the capabilities and not skip it if you are not on head.. otherwise the file pointer will be NULL and when you try to do something with it you will crash. Make the #else be the old capabilites, and then remove the erroneous ifdefs for 11. MFC after:1 week (with the other MFC I was going to do until the panic) Modified: head/sys/dev/hwpmc/hwpmc_logging.c Modified: head/sys/dev/hwpmc/hwpmc_logging.c == --- head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 11 19:04:01 2015 (r279893) +++ head/sys/dev/hwpmc/hwpmc_logging.c Wed Mar 11 20:15:49 2015 (r279894) @@ -39,6 +39,8 @@ __FBSDID("$FreeBSD$"); #include #if (__FreeBSD_version >= 110) #include +#else +#include #endif #include #include @@ -570,9 +572,7 @@ pmclog_configure_log(struct pmc_mdep *md { int error; struct proc *p; -#if (__FreeBSD_version >= 110) cap_rights_t rights; -#endif /* * As long as it is possible to get a LOR between pmc_sx lock and * proctree/allproc sx locks used for adding a new process, assure @@ -595,12 +595,11 @@ pmclog_configure_log(struct pmc_mdep *md po->po_file)); /* get a reference to the file state */ -#if (__FreeBSD_version >= 110) error = fget_write(curthread, logfd, cap_rights_init(&rights, CAP_WRITE), &po->po_file); if (error) goto error; -#endif + /* mark process as owning a log file */ po->po_flags |= PMC_PO_OWNS_LOGFILE; error = kproc_create(pmclog_loop, po, &po->po_kthread, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r278801 - in stable/10/sys: netinet netinet6
Author: rrs Date: Sun Feb 15 13:57:44 2015 New Revision: 278801 URL: https://svnweb.freebsd.org/changeset/base/278801 Log: MFC of r278472 This fixes a bug in the way that the LLE timers for nd6 and arp were being used. They basically would pass in the mutex to the callout_init. Because they used this method to the callout system, it was possible to "stop" the callout. When flushing the table and you stopped the running callout, the callout_stop code would return 1 indicating that it was going to stop the callout (that was about to run on the callout_wheel blocked by the function calling the stop). Now when 1 was returned, it would lower the reference count one extra time for the stopped timer, then a few lines later delete the memory. Of course the callout_wheel was stuck in the lock code and would then crash since it was accessing freed memory. By using callout_init(c, 1) we always get a 0 back and the reference counting bug does not rear its head. We do have to make a few adjustments to the callouts themselves though to make sure it does the proper thing if rescheduled as well as gets the lock. Sponsored by: Netflix Inc. Modified: stable/10/sys/netinet/if_ether.c stable/10/sys/netinet/in.c stable/10/sys/netinet6/in6.c stable/10/sys/netinet6/nd6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/if_ether.c == --- stable/10/sys/netinet/if_ether.cSun Feb 15 13:24:32 2015 (r278800) +++ stable/10/sys/netinet/if_ether.cSun Feb 15 13:57:44 2015 (r278801) @@ -170,10 +170,28 @@ arptimer(void *arg) struct ifnet *ifp; if (lle->la_flags & LLE_STATIC) { - LLE_WUNLOCK(lle); return; } - + LLE_WLOCK(lle); + if (callout_pending(&lle->la_timer)) { + /* +* Here we are a bit odd here in the treatment of +* active/pending. If the pending bit is set, it got +* rescheduled before I ran. The active +* bit we ignore, since if it was stopped +* in ll_tablefree() and was currently running +* it would have return 0 so the code would +* not have deleted it since the callout could +* not be stopped so we want to go through +* with the delete here now. If the callout +* was restarted, the pending bit will be back on and +* we just want to bail since the callout_reset would +* return 1 and our reference would have been removed +* by arpresolve() below. +*/ + LLE_WUNLOCK(lle); + return; + } ifp = lle->lle_tbl->llt_ifp; CURVNET_SET(ifp->if_vnet); Modified: stable/10/sys/netinet/in.c == --- stable/10/sys/netinet/in.c Sun Feb 15 13:24:32 2015(r278800) +++ stable/10/sys/netinet/in.c Sun Feb 15 13:57:44 2015(r278801) @@ -1263,8 +1263,7 @@ in_lltable_new(const struct sockaddr *l3 lle->base.lle_refcnt = 1; lle->base.lle_free = in_lltable_free; LLE_LOCK_INIT(&lle->base); - callout_init_rw(&lle->base.la_timer, &lle->base.lle_lock, - CALLOUT_RETURNUNLOCKED); + callout_init(&lle->base.la_timer, 1); return (&lle->base); } Modified: stable/10/sys/netinet6/in6.c == --- stable/10/sys/netinet6/in6.cSun Feb 15 13:24:32 2015 (r278800) +++ stable/10/sys/netinet6/in6.cSun Feb 15 13:57:44 2015 (r278801) @@ -2519,8 +2519,7 @@ in6_lltable_new(const struct sockaddr *l lle->base.lle_refcnt = 1; lle->base.lle_free = in6_lltable_free; LLE_LOCK_INIT(&lle->base); - callout_init_rw(&lle->base.ln_timer_ch, &lle->base.lle_lock, - CALLOUT_RETURNUNLOCKED); + callout_init(&lle->base.ln_timer_ch, 1); return (&lle->base); } Modified: stable/10/sys/netinet6/nd6.c == --- stable/10/sys/netinet6/nd6.cSun Feb 15 13:24:32 2015 (r278800) +++ stable/10/sys/netinet6/nd6.cSun Feb 15 13:57:44 2015 (r278801) @@ -466,9 +466,28 @@ nd6_llinfo_timer(void *arg) KASSERT(arg != NULL, ("%s: arg NULL", __func__)); ln = (struct llentry *)arg; - LLE_WLOCK_ASSERT(ln); + LLE_WLOCK(ln); + if (callout_pending(&ln->la_timer)) { + /* +* Here we are a bit odd here in the treatment of +* active/pending. If the pending bit is set, it got +* rescheduled before I ran. The active +* bit we ignore, since if it was stopped +* in
svn commit: r278800 - in stable/10/sys: kern sys
Author: rrs Date: Sun Feb 15 13:24:32 2015 New Revision: 278800 URL: https://svnweb.freebsd.org/changeset/base/278800 Log: MFC of r278469, r278623 278469: This fixes two conditions that can incur when migration is being done in the callout code and harmonizes the macro use.: 1) The callout_active() will lie. Basically if a migration is occuring and the callout is about to expire and the migration has been deferred, the callout_active will no longer return true until after the migration. This confuses and breaks callers that are doing callout_init(&c, 1); such as TCP. 2) The migration code had a bug in it where when migrating, if a two calls to callout_reset came in and they both collided with the callout on the wheel about to run, then the second call to callout_reset would corrupt the list the callout wheel uses putting the callout thread into a endless loop. 3) Per imp, I have fixed all the macro occurance in the code that were for the most part being ignored. 278623: This fixes a bug I in-advertantly inserted when I updated the callout code in my last commit. The cc_exec_next is used to track the next when a direct call is being made from callout. It is *never* used in the in-direct method. When macro-izing I made it so that it would separate out direct/vs/non-direct. This is incorrect and can cause panics as Peter Holm has found for me (Thanks so much Peter for all your help in this). What this change does is restore that behavior but also get rid of the cc_next from the array and instead make it be part of the base callout structure. This way no one else will get confused since we will never use it for non-direct. Sponsored by: Netflix Inc. Modified: stable/10/sys/kern/kern_timeout.c stable/10/sys/sys/callout.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_timeout.c == --- stable/10/sys/kern/kern_timeout.c Sun Feb 15 12:02:17 2015 (r278799) +++ stable/10/sys/kern/kern_timeout.c Sun Feb 15 13:24:32 2015 (r278800) @@ -122,7 +122,6 @@ u_int callwheelsize, callwheelmask; * the migrating callout is already running. */ struct cc_exec { - struct callout *cc_next; struct callout *cc_curr; #ifdef SMP void(*ce_migration_func)(void *); @@ -142,6 +141,7 @@ struct cc_exec { struct callout_cpu { struct mtx_padalign cc_lock; struct cc_exec cc_exec_entity[2]; + struct callout *cc_next; struct callout *cc_callout; struct callout_list *cc_callwheel; struct callout_tailqcc_expireq; @@ -153,26 +153,16 @@ struct callout_cpu { charcc_ktr_event_name[20]; }; -#definecc_exec_currcc_exec_entity[0].cc_curr -#definecc_exec_nextcc_exec_entity[0].cc_next -#definecc_exec_cancel cc_exec_entity[0].cc_cancel -#definecc_exec_waiting cc_exec_entity[0].cc_waiting -#definecc_exec_curr_dircc_exec_entity[1].cc_curr -#definecc_exec_next_dircc_exec_entity[1].cc_next -#definecc_exec_cancel_dir cc_exec_entity[1].cc_cancel -#definecc_exec_waiting_dir cc_exec_entity[1].cc_waiting - +#definecc_exec_curr(cc, dir) cc->cc_exec_entity[dir].cc_curr +#definecc_exec_next(cc)cc->cc_next +#definecc_exec_cancel(cc, dir) cc->cc_exec_entity[dir].cc_cancel +#definecc_exec_waiting(cc, dir) cc->cc_exec_entity[dir].cc_waiting #ifdef SMP -#definecc_migration_func cc_exec_entity[0].ce_migration_func -#definecc_migration_argcc_exec_entity[0].ce_migration_arg -#definecc_migration_cpucc_exec_entity[0].ce_migration_cpu -#definecc_migration_time cc_exec_entity[0].ce_migration_time -#definecc_migration_prec cc_exec_entity[0].ce_migration_prec -#definecc_migration_func_dir cc_exec_entity[1].ce_migration_func -#definecc_migration_arg_dircc_exec_entity[1].ce_migration_arg -#definecc_migration_cpu_dircc_exec_entity[1].ce_migration_cpu -#definecc_migration_time_dir cc_exec_entity[1].ce_migration_time -#definecc_migration_prec_dir cc_exec_entity[1].ce_migration_prec +#definecc_migration_func(cc, dir) cc->cc_exec_entity[dir].ce_migration_func +#definecc_migration_arg(cc, dir) cc->cc_exec_entity[dir].ce_migration_arg +#definecc_migration_cpu(cc, dir) cc->cc_exec_entity[dir].ce_migration_cpu +#definecc_migration_time(cc, dir) cc->cc_exec_entity[dir].ce_migration_time +#definecc_migration_prec(cc, dir) cc->cc_exec_entity[dir].ce_migration_prec struct callout_
Re: svn commit: r278472 - in head/sys: netinet netinet6
Gleb: Ok here is the diff of the arp timer function that this changed made (238990): arptimer(void *arg) { + struct llentry *lle = (struct llentry *)arg; struct ifnet *ifp; - struct llentry *lle; - int pkts_dropped; + size_t pkts_dropped; - KASSERT(arg != NULL, ("%s: arg NULL", __func__)); - lle = (struct llentry *)arg; + if (lle->la_flags & LLE_STATIC) { + LLE_WUNLOCK(lle); + return; + } + ifp = lle->lle_tbl->llt_ifp; CURVNET_SET(ifp->if_vnet); + + if (lle->la_flags != LLE_DELETED) { + int evt; + + if (lle->la_flags & LLE_VALID) + evt = LLENTRY_EXPIRED; + else + evt = LLENTRY_TIMEDOUT; + EVENTHANDLER_INVOKE(lle_event, lle, evt); + } + + callout_stop(&lle->la_timer); + + /* XXX: LOR avoidance. We still have ref on lle. */ + LLE_WUNLOCK(lle); IF_AFDATA_LOCK(ifp); LLE_WLOCK(lle); - if (lle->la_flags & LLE_STATIC) - LLE_WUNLOCK(lle); - else { - if (!callout_pending(&lle->la_timer) && - callout_active(&lle->la_timer)) { - callout_stop(&lle->la_timer); - LLE_REMREF(lle); - if (lle->la_flags != LLE_DELETED) { - int evt; - - if (lle->la_flags & LLE_VALID) - evt = LLENTRY_EXPIRED; - else - evt = LLENTRY_TIMEDOUT; - EVENTHANDLER_INVOKE(lle_event, lle, evt); - } - - pkts_dropped = llentry_free(lle); - ARPSTAT_ADD(dropped, pkts_dropped); - ARPSTAT_INC(timeouts); - } else { -#ifdef DIAGNOSTIC - struct sockaddr *l3addr = L3_ADDR(lle); - log(LOG_INFO, - "arptimer issue: %p, IPv4 address: \"%s\"\n", lle, - inet_ntoa( - ((const struct sockaddr_in *)l3addr)->sin_addr)); -#endif - LLE_WUNLOCK(lle); - } - } + LLE_REMREF(lle); + pkts_dropped = llentry_free(lle); IF_AFDATA_UNLOCK(ifp); + ARPSTAT_ADD(dropped, pkts_dropped); + ARPSTAT_INC(timeouts); CURVNET_RESTORE(); } ** And I can see *what* the problem was.. If you look at the lines: - if (!callout_pending(&lle->la_timer) && - callout_active(&lle->la_timer)) { This is the *incorrect* way to write this code it should have been: if (callout_pending(&lle->la_timer) && !callout_active(&lle->la_timer)) { To properly do the MPSAFE thing.. take a look at the callout manual.. So the original author just mixed up the test.. The idea is after you get the lock you check if its pending again, if so someone has restarted it.. and if its not active, then someone has stopped it. They check if it was *not* pending.. which is almost always the case since the callout code removes the pending flag and thats what you want to be there. So not pending would always be true.. I don’t see that this old code did the callout_deactive().. but I think the callout_stop() does that I guess.. I think the problem was that the original code was wrong and that the fix yes, avoided one race but put in another. I do think a callout_async_drain is the right thing, but that will take a while to get right. Peter Holm (thank you so much) has been pounding on this, if you could find another test to add.. that would be great. I think this will work the way it is.. R On Feb 13, 2015, at 4:21 PM, Gleb Smirnoff wrote: > 165863 Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r278472 - in head/sys: netinet netinet6
On Feb 13, 2015, at 4:21 PM, Gleb Smirnoff wrote: > On Mon, Feb 09, 2015 at 03:11:21PM -0500, John Baldwin wrote: > J> On Monday, February 09, 2015 07:28:12 PM Randall Stewart wrote: > J> > Author: rrs > J> > Date: Mon Feb 9 19:28:11 2015 > J> > New Revision: 278472 > J> > URL: https://svnweb.freebsd.org/changeset/base/278472 > J> > > J> > Log: > J> > This fixes a bug in the way that the LLE timers for nd6 > J> > and arp were being used. They basically would pass in the > J> > mutex to the callout_init. Because they used this method > J> > to the callout system, it was possible to "stop" the callout. > J> > When flushing the table and you stopped the running callout, the > J> > callout_stop code would return 1 indicating that it was going > J> > to stop the callout (that was about to run on the callout_wheel blocked > J> > by the function calling the stop). Now when 1 was returned, it would > J> > lower the reference count one extra time for the stopped timer, then > J> > a few lines later delete the memory. Of course the callout_wheel was > J> > stuck in the lock code and would then crash since it was accessing > J> > freed memory. By using callout_init(c, 1) we always get a 0 back > J> > and the reference counting bug does not rear its head. We do have > J> > to make a few adjustments to the callouts themselves though to make > J> > sure it does the proper thing if rescheduled as well as gets the lock. > J> > > J> > Commented upon by hiren and sbruno > J> > See Phabricator D1777 for more details. > J> > > J> > Commented upon by hiren and sbruno > J> > Reviewed by: adrian, jhb and bz > J> > Sponsored by: Netflix Inc. > J> > J> Eh, I looked at it, but I really, really don't like it. I think > J> callout_init_*() should be preferred to CALLOUT_MPSAFE whenever possible > as it > J> is less race-prone. I think this should probably be fixed by adding Hans' > J> callout_drain_async() instead, though this is fine as a temporary > workaround. > > I second concerns. Please look at kern/165863 and r238990 that fixed it. > Transition from CALLOUT_MPSAFE to callout_init_rw() was intentional > and fixed races. > > I added to Cc guys who helped to track down that races. May be someone still > has test scripts at hand. AFAIR, there were some that allowed to put a box > down quite quickly. Well without it we can also put a box down quickly.. at least Sbruno and Hiren seem to be able to.. you end up with deleted memory being accessed by the callout code. I can look at kern/165863 and 238990.. let me go see what I can see ;0 > > -- > Totus tuus, Glebius. Randall Stewart r...@netflix.com 803-317-4952 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r278623 - head/sys/kern
Author: rrs Date: Thu Feb 12 13:31:08 2015 New Revision: 278623 URL: https://svnweb.freebsd.org/changeset/base/278623 Log: This fixes a bug I in-advertantly inserted when I updated the callout code in my last commit. The cc_exec_next is used to track the next when a direct call is being made from callout. It is *never* used in the in-direct method. When macro-izing I made it so that it would separate out direct/vs/non-direct. This is incorrect and can cause panics as Peter Holm has found for me (Thanks so much Peter for all your help in this). What this change does is restore that behavior but also get rid of the cc_next from the array and instead make it be part of the base callout structure. This way no one else will get confused since we will never use it for non-direct. Reviewed by: Peter Holm and more importantly tested by him ;-) MFC after:3 days. Sponsored by: Netflix Inc. Modified: head/sys/kern/kern_timeout.c Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cThu Feb 12 11:57:31 2015 (r278622) +++ head/sys/kern/kern_timeout.cThu Feb 12 13:31:08 2015 (r278623) @@ -135,7 +135,6 @@ u_int callwheelsize, callwheelmask; * the migrating callout is already running. */ struct cc_exec { - struct callout *cc_next; struct callout *cc_curr; #ifdef SMP void(*ce_migration_func)(void *); @@ -155,6 +154,7 @@ struct cc_exec { struct callout_cpu { struct mtx_padalign cc_lock; struct cc_exec cc_exec_entity[2]; + struct callout *cc_next; struct callout *cc_callout; struct callout_list *cc_callwheel; struct callout_tailqcc_expireq; @@ -167,7 +167,7 @@ struct callout_cpu { }; #definecc_exec_curr(cc, dir) cc->cc_exec_entity[dir].cc_curr -#definecc_exec_next(cc, dir) cc->cc_exec_entity[dir].cc_next +#definecc_exec_next(cc)cc->cc_next #definecc_exec_cancel(cc, dir) cc->cc_exec_entity[dir].cc_cancel #definecc_exec_waiting(cc, dir) cc->cc_exec_entity[dir].cc_waiting #ifdef SMP @@ -226,7 +226,6 @@ cc_cce_cleanup(struct callout_cpu *cc, i { cc_exec_curr(cc, direct) = NULL; - cc_exec_next(cc, direct) = NULL; cc_exec_cancel(cc, direct) = false; cc_exec_waiting(cc, direct) = false; #ifdef SMP @@ -482,7 +481,7 @@ callout_process(sbintime_t now) #ifdef CALLOUT_PROFILING ++depth_dir; #endif - cc_exec_next(cc, 1) = + cc_exec_next(cc) = LIST_NEXT(tmp, c_links.le); cc->cc_bucket = firstb & callwheelmask; LIST_REMOVE(tmp, c_links.le); @@ -491,7 +490,8 @@ callout_process(sbintime_t now) &mpcalls_dir, &lockcalls_dir, NULL, #endif 1); - tmp = cc_exec_next(cc, 1); + tmp = cc_exec_next(cc); + cc_exec_next(cc) = NULL; } else { tmpn = LIST_NEXT(tmp, c_links.le); LIST_REMOVE(tmp, c_links.le); @@ -575,7 +575,7 @@ callout_lock(struct callout *c) static void callout_cc_add(struct callout *c, struct callout_cpu *cc, sbintime_t sbt, sbintime_t precision, void (*func)(void *), -void *arg, int cpu, int flags, int direct) +void *arg, int cpu, int flags) { int bucket; @@ -584,8 +584,6 @@ callout_cc_add(struct callout *c, struct sbt = cc->cc_lastscan; c->c_arg = arg; c->c_flags |= (CALLOUT_ACTIVE | CALLOUT_PENDING); - if (flags & C_DIRECT_EXEC) - c->c_flags |= CALLOUT_DIRECT; c->c_flags &= ~CALLOUT_PROCESSED; c->c_func = func; c->c_time = sbt; @@ -596,7 +594,7 @@ callout_cc_add(struct callout *c, struct (u_int)(c->c_precision & 0x)); LIST_INSERT_HEAD(&cc->cc_callwheel[bucket], c, c_links.le); if (cc->cc_bucket == bucket) - cc_exec_next(cc, direct) = c; + cc_exec_next(cc) = c; #ifndef NO_EVENTTIMERS /* * Inform the eventtimers(4) subsystem there's a new callout @@ -790,7 +788,7 @@ skip: new_cc = callout_cpu_switch(c, cc, new_cpu); flags = (direct) ? C_DIRECT_EXEC : 0; callout_cc_add(c, new_cc, new_time, new_prec, new_func, - new_arg, new_cpu, flags, direct); + new_arg, new_cpu, flags);
svn commit: r278472 - in head/sys: netinet netinet6
Author: rrs Date: Mon Feb 9 19:28:11 2015 New Revision: 278472 URL: https://svnweb.freebsd.org/changeset/base/278472 Log: This fixes a bug in the way that the LLE timers for nd6 and arp were being used. They basically would pass in the mutex to the callout_init. Because they used this method to the callout system, it was possible to "stop" the callout. When flushing the table and you stopped the running callout, the callout_stop code would return 1 indicating that it was going to stop the callout (that was about to run on the callout_wheel blocked by the function calling the stop). Now when 1 was returned, it would lower the reference count one extra time for the stopped timer, then a few lines later delete the memory. Of course the callout_wheel was stuck in the lock code and would then crash since it was accessing freed memory. By using callout_init(c, 1) we always get a 0 back and the reference counting bug does not rear its head. We do have to make a few adjustments to the callouts themselves though to make sure it does the proper thing if rescheduled as well as gets the lock. Commented upon by hiren and sbruno See Phabricator D1777 for more details. Commented upon by hiren and sbruno Reviewed by: adrian, jhb and bz Sponsored by: Netflix Inc. Modified: head/sys/netinet/if_ether.c head/sys/netinet/in.c head/sys/netinet6/in6.c head/sys/netinet6/nd6.c Modified: head/sys/netinet/if_ether.c == --- head/sys/netinet/if_ether.c Mon Feb 9 19:21:54 2015(r278471) +++ head/sys/netinet/if_ether.c Mon Feb 9 19:28:11 2015(r278472) @@ -166,10 +166,28 @@ arptimer(void *arg) struct ifnet *ifp; if (lle->la_flags & LLE_STATIC) { - LLE_WUNLOCK(lle); return; } - + LLE_WLOCK(lle); + if (callout_pending(&lle->la_timer)) { + /* +* Here we are a bit odd here in the treatment of +* active/pending. If the pending bit is set, it got +* rescheduled before I ran. The active +* bit we ignore, since if it was stopped +* in ll_tablefree() and was currently running +* it would have return 0 so the code would +* not have deleted it since the callout could +* not be stopped so we want to go through +* with the delete here now. If the callout +* was restarted, the pending bit will be back on and +* we just want to bail since the callout_reset would +* return 1 and our reference would have been removed +* by arpresolve() below. +*/ + LLE_WUNLOCK(lle); + return; + } ifp = lle->lle_tbl->llt_ifp; CURVNET_SET(ifp->if_vnet); Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Mon Feb 9 19:21:54 2015(r278471) +++ head/sys/netinet/in.c Mon Feb 9 19:28:11 2015(r278472) @@ -962,8 +962,7 @@ in_lltable_new(const struct sockaddr *l3 lle->base.lle_refcnt = 1; lle->base.lle_free = in_lltable_free; LLE_LOCK_INIT(&lle->base); - callout_init_rw(&lle->base.la_timer, &lle->base.lle_lock, - CALLOUT_RETURNUNLOCKED); + callout_init(&lle->base.la_timer, 1); return (&lle->base); } Modified: head/sys/netinet6/in6.c == --- head/sys/netinet6/in6.c Mon Feb 9 19:21:54 2015(r278471) +++ head/sys/netinet6/in6.c Mon Feb 9 19:28:11 2015(r278472) @@ -2047,8 +2047,7 @@ in6_lltable_new(const struct sockaddr *l lle->base.lle_refcnt = 1; lle->base.lle_free = in6_lltable_free; LLE_LOCK_INIT(&lle->base); - callout_init_rw(&lle->base.ln_timer_ch, &lle->base.lle_lock, - CALLOUT_RETURNUNLOCKED); + callout_init(&lle->base.ln_timer_ch, 1); return (&lle->base); } Modified: head/sys/netinet6/nd6.c == --- head/sys/netinet6/nd6.c Mon Feb 9 19:21:54 2015(r278471) +++ head/sys/netinet6/nd6.c Mon Feb 9 19:28:11 2015(r278472) @@ -473,9 +473,28 @@ nd6_llinfo_timer(void *arg) KASSERT(arg != NULL, ("%s: arg NULL", __func__)); ln = (struct llentry *)arg; - LLE_WLOCK_ASSERT(ln); + LLE_WLOCK(ln); + if (callout_pending(&ln->la_timer)) { + /* +* Here we are a bit odd here in the treatment of +* active/pending. If the pending bit is set, it got +* rescheduled before I ran. The active +* bit we ignore, since if it was stopped +* in ll_tablefree
svn commit: r278469 - in head/sys: kern sys
Author: rrs Date: Mon Feb 9 19:19:44 2015 New Revision: 278469 URL: https://svnweb.freebsd.org/changeset/base/278469 Log: This fixes two conditions that can incur when migration is being done in the callout code and harmonizes the macro use.: 1) The callout_active() will lie. Basically if a migration is occuring and the callout is about to expire and the migration has been deferred, the callout_active will no longer return true until after the migration. This confuses and breaks callers that are doing callout_init(&c, 1); such as TCP. 2) The migration code had a bug in it where when migrating, if a two calls to callout_reset came in and they both collided with the callout on the wheel about to run, then the second call to callout_reset would corrupt the list the callout wheel uses putting the callout thread into a endless loop. 3) Per imp, I have fixed all the macro occurance in the code that were for the most part being ignored. Phabricator D1711 and looked at by lstewart and jhb and sbruno. Reviewed by: kostikbel, imp, adrian, hselasky MFC after:3 days Sponsored by: Netflix Inc. Modified: head/sys/kern/kern_timeout.c head/sys/sys/callout.h Modified: head/sys/kern/kern_timeout.c == --- head/sys/kern/kern_timeout.cMon Feb 9 19:19:13 2015 (r278468) +++ head/sys/kern/kern_timeout.cMon Feb 9 19:19:44 2015 (r278469) @@ -166,26 +166,16 @@ struct callout_cpu { charcc_ktr_event_name[20]; }; -#definecc_exec_currcc_exec_entity[0].cc_curr -#definecc_exec_nextcc_exec_entity[0].cc_next -#definecc_exec_cancel cc_exec_entity[0].cc_cancel -#definecc_exec_waiting cc_exec_entity[0].cc_waiting -#definecc_exec_curr_dircc_exec_entity[1].cc_curr -#definecc_exec_next_dircc_exec_entity[1].cc_next -#definecc_exec_cancel_dir cc_exec_entity[1].cc_cancel -#definecc_exec_waiting_dir cc_exec_entity[1].cc_waiting - +#definecc_exec_curr(cc, dir) cc->cc_exec_entity[dir].cc_curr +#definecc_exec_next(cc, dir) cc->cc_exec_entity[dir].cc_next +#definecc_exec_cancel(cc, dir) cc->cc_exec_entity[dir].cc_cancel +#definecc_exec_waiting(cc, dir) cc->cc_exec_entity[dir].cc_waiting #ifdef SMP -#definecc_migration_func cc_exec_entity[0].ce_migration_func -#definecc_migration_argcc_exec_entity[0].ce_migration_arg -#definecc_migration_cpucc_exec_entity[0].ce_migration_cpu -#definecc_migration_time cc_exec_entity[0].ce_migration_time -#definecc_migration_prec cc_exec_entity[0].ce_migration_prec -#definecc_migration_func_dir cc_exec_entity[1].ce_migration_func -#definecc_migration_arg_dircc_exec_entity[1].ce_migration_arg -#definecc_migration_cpu_dircc_exec_entity[1].ce_migration_cpu -#definecc_migration_time_dir cc_exec_entity[1].ce_migration_time -#definecc_migration_prec_dir cc_exec_entity[1].ce_migration_prec +#definecc_migration_func(cc, dir) cc->cc_exec_entity[dir].ce_migration_func +#definecc_migration_arg(cc, dir) cc->cc_exec_entity[dir].ce_migration_arg +#definecc_migration_cpu(cc, dir) cc->cc_exec_entity[dir].ce_migration_cpu +#definecc_migration_time(cc, dir) cc->cc_exec_entity[dir].ce_migration_time +#definecc_migration_prec(cc, dir) cc->cc_exec_entity[dir].ce_migration_prec struct callout_cpu cc_cpu[MAXCPU]; #defineCPUBLOCKMAXCPU @@ -235,16 +225,16 @@ static void cc_cce_cleanup(struct callout_cpu *cc, int direct) { - cc->cc_exec_entity[direct].cc_curr = NULL; - cc->cc_exec_entity[direct].cc_next = NULL; - cc->cc_exec_entity[direct].cc_cancel = false; - cc->cc_exec_entity[direct].cc_waiting = false; + cc_exec_curr(cc, direct) = NULL; + cc_exec_next(cc, direct) = NULL; + cc_exec_cancel(cc, direct) = false; + cc_exec_waiting(cc, direct) = false; #ifdef SMP - cc->cc_exec_entity[direct].ce_migration_cpu = CPUBLOCK; - cc->cc_exec_entity[direct].ce_migration_time = 0; - cc->cc_exec_entity[direct].ce_migration_prec = 0; - cc->cc_exec_entity[direct].ce_migration_func = NULL; - cc->cc_exec_entity[direct].ce_migration_arg = NULL; + cc_migration_cpu(cc, direct) = CPUBLOCK; + cc_migration_time(cc, direct) = 0; + cc_migration_prec(cc, direct) = 0; + cc_migration_func(cc, direct) = NULL; + cc_migration_arg(cc, direct) = NULL; #endif } @@ -256,7 +246,7 @@ cc_cce_migrating(struct callout_cpu *cc, { #ifdef SMP - return (cc->cc_exec_entity[direct].ce_migration_cpu != CPUBLOCK); + return (cc_migr
svn commit: r277800 - head/usr.sbin/pmcstudy
Author: rrs Date: Tue Jan 27 18:56:22 2015 New Revision: 277800 URL: https://svnweb.freebsd.org/changeset/base/277800 Log: Fix yet another coverty warning (missing io is NULL check) and in examining that warning I see yet another issue where we should be pclosing the io in the event of the error and its a command (not fclose only). Modified: head/usr.sbin/pmcstudy/pmcstudy.c Modified: head/usr.sbin/pmcstudy/pmcstudy.c == --- head/usr.sbin/pmcstudy/pmcstudy.c Tue Jan 27 18:27:07 2015 (r277799) +++ head/usr.sbin/pmcstudy/pmcstudy.c Tue Jan 27 18:56:22 2015 (r277800) @@ -1796,6 +1796,10 @@ process_file(char *filename) if (filename == NULL) { io = my_popen(command, "r", &pid_of_command); + if (io == NULL) { + printf("Can't popen the command %s\n", command); + return; + } } else { io = fopen(filename, "r"); if (io == NULL) { @@ -1808,8 +1812,10 @@ process_file(char *filename) if (cnts == NULL) { /* Nothing we can do */ printf("Nothing to do -- no counters built\n"); - if (io) { - fclose(io); + if (filename) { + fclose(io); + } else { + my_pclose(io, pid_of_command); } return; } ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys
Let me re-send my email.. my silly mac sent my first try from the wrong address.. sigh (sorry moderator where ever you are ;-o) All: I have finally pulled my head out of the sands of TLS and had some time to look at this interesting long thread. I agree with Warner and Adrian on this.. Lets back it out and then in a branch chew this over piece by piece.. R As an addition I have decided to get my head back into this, I was one of the ones on Hann’s original email and I had asked him to wait until *after* the Holiday’s to do anything (thinking on continuing the discussion) I did *not* realize he planned on roto-tilling the callout system.. sigh > On Jan 21, 2015, at 7:10 PM, Adrian Chadd wrote: > > On 21 January 2015 at 16:07, K. Macy wrote: >>>> HPS: Your change failed to meet these guidelines. Some of us are upset >>>> because these guidelines are fairly fundamental for the on-going >>>> viability of FreeBSD. Due to linguistic / time zone / cultural >>>> differences these expectations have not been adequately communicated >>>> to you. You are not in the USB sandbox where others need for your >>>> support outweighs the inconvenience of random breakage. >>>> >>>> It sounds like you are making progress towards updating the concerns >>>> that have been voiced. If kib's observations are in fact comprehensive >>>> then adding a callout_init_cpu function and updating all clients so >>>> that their callouts continue to be scheduled on a CPU other than the >>>> BSP will suffice and we can all move on. >>> >>> Is there some reason that we can’t back things out, break things down into >>> smaller pieces and have everything pass through phabric with a wide >>> ranging review? Given the fundamental nature of these changes, they >>> really need better review and doing it after the fact seems to be to be >>> too risky. I’m not debating that this “fixes” some issues, but given the >>> performance regression, it sure seems like we may need a different >>> solution to be implemented and hashing that out in a branch might be >>> the best approach. >> >> Thank you. A more incremental approach would be appreciated by many of >> us. To avoid the bystander effect we can permit explicit timeouts for >> review-to-commit (72 hours?) so that we don't collectively end up >> sandbagging him. > > I'm +1 for this. > > > > -a -- Randall Stewart 803-317-4952 (cell) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r277213 - in head: share/man/man9 sys/kern sys/ofed/include/linux sys/sys
Hans Thats great, could you please open a project branch that we can look at it in too? I would very much appreciate that. Sometimes I like to look at the whole code with it all in place (not just patches) and a project branch really helps with that. R > On Jan 22, 2015, at 3:39 AM, Hans Petter Selasky wrote: > > On 01/22/15 09:10, Konstantin Belousov wrote: >> On Thu, Jan 22, 2015 at 08:14:26AM +0100, Hans Petter Selasky wrote: >>> On 01/22/15 06:26, Warner Losh wrote: >>> > >>>>> The code simply needs an update. It is not broken in any ways - right? If >>>>> it is not broken, fixing it is not that urgent. >>>> >>>> Radically changing the performance characteristics is breaking the code. >>>> Performance regression in the TCP stack is urgent to fix. >> >>> Not being able to enumerate what all the consumers are that use this and >>> provide an analysis about why they aren?t important to fix is a bug in >>> your process, and in your interaction with the project. We simply do not >>> operate that way. >> Right, I completely agree with this statement. >> >> >>> Hi, >>> >>> My plan is to work out a patch for the TCP stack today, which only >>> change the callout_init() call or its function. This should not need any >>> particular review. I'll let adrian test and review, because I think he >>> is closer to me timezone wise and you're standing on my head saying its >>> urgent. If he is still not happy, I can back my change out. Else it >>> remains in -current AS-IS. >> TCP regresssion was noted, so it is brought in front. There is nothing >> else which makes TCP issue different from other (hidden) issues. >> >> === >>> MFC to 10-stable I can delay for sure until >>> all issues you report to me are fixed. >> === >> >> Sigh, you still do not understand. It is your duty to identify all pieces >> which break after your change. After that, we can argue whether each of >> them is critical or not to allow the migration. But this must have been >> done before the KPI change hit the tree. >> > > Hi, > > Are you saying that pieces of code that runs completely unlocked using > "volatile" as only synchronization mechanism is better than what I would call > a temporary and hopefully short TCP stack performance loss? > > I don't understand? How frequently do you reboot your boxes? Maybe one every > day? And you don't care? > > --HPS > > > -- Randall Stewart 803-317-4952 (cell) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r277485 - head/usr.sbin/pmcstudy
Author: rrs Date: Wed Jan 21 13:03:18 2015 New Revision: 277485 URL: https://svnweb.freebsd.org/changeset/base/277485 Log: Fix minor errors found by coverity. Thanks Gleb for the pointers to the email! Modified: head/usr.sbin/pmcstudy/pmcstudy.c Modified: head/usr.sbin/pmcstudy/pmcstudy.c == --- head/usr.sbin/pmcstudy/pmcstudy.c Wed Jan 21 10:47:28 2015 (r277484) +++ head/usr.sbin/pmcstudy/pmcstudy.c Wed Jan 21 13:03:18 2015 (r277485) @@ -1808,6 +1808,9 @@ process_file(char *filename) if (cnts == NULL) { /* Nothing we can do */ printf("Nothing to do -- no counters built\n"); + if (io) { + fclose(io); + } return; } lace_cpus_together(); @@ -2044,7 +2047,7 @@ get_cpuid_set(void) printf("No memory3 allocation fails at startup?\n"); exit(-1); } - memset(more, sz, 0); + memset(more, 0, sz); memcpy(more, valid_pmcs, sz); pmc_allocated_cnt *= 2; free(valid_pmcs); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r277177 - in head: lib/libpmc sys/dev/hwpmc sys/sys usr.sbin usr.sbin/pmcstudy
Author: rrs Date: Wed Jan 14 12:46:58 2015 New Revision: 277177 URL: https://svnweb.freebsd.org/changeset/base/277177 Log: Update the hwpmc driver to have the new type HASWELL_XEON. Also go back through HASWELL, IVY_BRIDGE, IVY_BRIDGE_XEON and SANDY_BRIDGE to straighten out all the missing PMCs. We also add a new pmc tool pmcstudy, this allows one to run the various formulas from the documents "Using Intel Vtune Amplifier XE on XXX Generation platforms" for IB/SB and Haswell. The tool also allows one to postulate your own formulas with any of the various PMC's. At some point I will enahance this to work with Brendan Gregg's flame-graphs so we can flamegraph various PMC interactions. Note the manual page also needs some work (lots of work) but gnn has committed to help me with that ;-) Reviewed by: gnn MFC after:1 month Sponsored by: Netflix Inc. Added: head/usr.sbin/pmcstudy/ head/usr.sbin/pmcstudy/Makefile (contents, props changed) head/usr.sbin/pmcstudy/eval_expr.c (contents, props changed) head/usr.sbin/pmcstudy/eval_expr.h (contents, props changed) head/usr.sbin/pmcstudy/pmcstudy.1 (contents, props changed) head/usr.sbin/pmcstudy/pmcstudy.c (contents, props changed) Modified: head/lib/libpmc/libpmc.c head/sys/dev/hwpmc/hwpmc_core.c head/sys/dev/hwpmc/hwpmc_intel.c head/sys/dev/hwpmc/hwpmc_logging.c head/sys/dev/hwpmc/hwpmc_mod.c head/sys/dev/hwpmc/hwpmc_piv.c head/sys/dev/hwpmc/hwpmc_uncore.c head/sys/dev/hwpmc/hwpmc_x86.c head/sys/dev/hwpmc/pmc_events.h head/sys/sys/pmc.h head/usr.sbin/Makefile Modified: head/lib/libpmc/libpmc.c == --- head/lib/libpmc/libpmc.cWed Jan 14 12:46:38 2015(r277176) +++ head/lib/libpmc/libpmc.cWed Jan 14 12:46:58 2015(r277177) @@ -200,6 +200,12 @@ static const struct pmc_event_descr hasw __PMC_EV_ALIAS_HASWELL() }; +static const struct pmc_event_descr haswell_xeon_event_table[] = +{ + __PMC_EV_ALIAS_HASWELL_XEON() +}; + + static const struct pmc_event_descr ivybridge_event_table[] = { __PMC_EV_ALIAS_IVYBRIDGE() @@ -267,6 +273,7 @@ PMC_MDEP_TABLE(core2, IAP, PMC_CLASS_SOF PMC_MDEP_TABLE(corei7, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(nehalem_ex, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(haswell, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); +PMC_MDEP_TABLE(haswell_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); PMC_MDEP_TABLE(ivybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(ivybridge_xeon, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC); PMC_MDEP_TABLE(sandybridge, IAP, PMC_CLASS_SOFT, PMC_CLASS_IAF, PMC_CLASS_TSC, PMC_CLASS_UCF, PMC_CLASS_UCP); @@ -312,6 +319,7 @@ PMC_CLASS_TABLE_DESC(core2, IAP, core2, PMC_CLASS_TABLE_DESC(corei7, IAP, corei7, iap); PMC_CLASS_TABLE_DESC(nehalem_ex, IAP, nehalem_ex, iap); PMC_CLASS_TABLE_DESC(haswell, IAP, haswell, iap); +PMC_CLASS_TABLE_DESC(haswell_xeon, IAP, haswell, iap); PMC_CLASS_TABLE_DESC(ivybridge, IAP, ivybridge, iap); PMC_CLASS_TABLE_DESC(ivybridge_xeon, IAP, ivybridge_xeon, iap); PMC_CLASS_TABLE_DESC(sandybridge, IAP, sandybridge, iap); @@ -626,6 +634,8 @@ static struct pmc_event_alias core2_alia #define nehalem_ex_aliases_without_iaf core2_aliases_without_iaf #define haswell_aliasescore2_aliases #define haswell_aliases_without_iafcore2_aliases_without_iaf +#define haswell_xeon_aliases core2_aliases +#define haswell_xeon_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_aliases core2_aliases #define ivybridge_aliases_without_iaf core2_aliases_without_iaf #define ivybridge_xeon_aliases core2_aliases @@ -896,7 +906,8 @@ iap_allocate_pmc(enum pmc_event pe, char n = pmc_parse_mask(iap_rsp_mask_sb_sbx_ib, p, &rsp); } else return (-1); - } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL) { + } else if (cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL || + cpu_info.pm_cputype == PMC_CPU_INTEL_HASWELL_XEON) { if (KWPREFIXMATCH(p, IAP_KW_RSP "=")) { n = pmc_parse_mask(iap_rsp_mask_haswell, p, &rsp); } else @@ -2788,6 +2799,10 @@ pmc_event_names_of_class(enum pmc_class ev = haswell_event_table; count = PMC_EVENT_TABLE_SIZE(haswell); break; + case PMC_CPU_INTEL_HASWELL_XEON: + ev = haswell_xeon_event_table; + count = PMC_EVENT_TABLE_SIZE(haswell_xeon); + break; cas
svn commit: r257326 - head/sys/dev/cesa
Author: rrs Date: Tue Oct 29 11:28:11 2013 New Revision: 257326 URL: http://svnweb.freebsd.org/changeset/base/257326 Log: Opps, my kirkwood fix for the dreamplug missed this. Modified: head/sys/dev/cesa/cesa.c Modified: head/sys/dev/cesa/cesa.c == --- head/sys/dev/cesa/cesa.cTue Oct 29 11:21:31 2013(r257325) +++ head/sys/dev/cesa/cesa.cTue Oct 29 11:28:11 2013(r257326) @@ -995,11 +995,17 @@ cesa_attach(device_t dev) sc->sc_dev = dev; /* Check if CESA peripheral device has power turned on */ +#if defined(SOC_MV_KIRKWOOD) + if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) == CPU_PM_CTRL_CRYPTO) { + device_printf(dev, "not powered on\n"); + return (ENXIO); + } +#else if (soc_power_ctrl_get(CPU_PM_CTRL_CRYPTO) != CPU_PM_CTRL_CRYPTO) { device_printf(dev, "not powered on\n"); return (ENXIO); } - +#endif soc_id(&d, &r); switch (d) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r256760 - head/sys/arm/mv
Author: rrs Date: Sat Oct 19 06:47:02 2013 New Revision: 256760 URL: http://svnweb.freebsd.org/changeset/base/256760 Log: Corrects the Kirkwood dreamplug to use the right register for power managment. It was incorrectly using the clock register which also caused the status to be the opposite of what it is supposed to be. 1 - its disabled 0 - its enabled Per kirkwood spec FSS_88F6180_9x_6281_OpenSource.pdf Modified: head/sys/arm/mv/common.c head/sys/arm/mv/mvreg.h Modified: head/sys/arm/mv/common.c == --- head/sys/arm/mv/common.cSat Oct 19 06:30:20 2013(r256759) +++ head/sys/arm/mv/common.cSat Oct 19 06:47:02 2013(r256760) @@ -153,8 +153,11 @@ struct fdt_pm_mask_entry fdt_pm_mask_tab static __inline int pm_is_disabled(uint32_t mask) { - +#if defined(SOC_MV_KIRKWOOD) + return (soc_power_ctrl_get(mask) == mask); +#else return (soc_power_ctrl_get(mask) == mask ? 0 : 1); +#endif } /* @@ -221,7 +224,16 @@ fdt_pm(phandle_t node) continue; compat = fdt_is_compatible(node, fdt_pm_mask_table[i].compat); - +#if defined(SOC_MV_KIRKWOOD) + if (compat && (cpu_pm_ctrl & fdt_pm_mask_table[i].mask)) { + dev_mask |= (1 << i); + ena = 0; + break; + } else if (compat) { + dev_mask |= (1 << i); + break; + } +#else if (compat && (~cpu_pm_ctrl & fdt_pm_mask_table[i].mask)) { dev_mask |= (1 << i); ena = 0; @@ -230,6 +242,7 @@ fdt_pm(phandle_t node) dev_mask |= (1 << i); break; } +#endif } return (ena); Modified: head/sys/arm/mv/mvreg.h == --- head/sys/arm/mv/mvreg.h Sat Oct 19 06:30:20 2013(r256759) +++ head/sys/arm/mv/mvreg.h Sat Oct 19 06:47:02 2013(r256760) @@ -142,7 +142,11 @@ /* * Power Control */ +#if defined(SOC_MV_KIRKWOOD) +#define CPU_PM_CTRL0x18 +#else #define CPU_PM_CTRL0x1C +#endif #define CPU_PM_CTRL_NONE 0 #define CPU_PM_CTRL_ALL~0x0 ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r249907 - releng/8.4/sys/netinet
Author: rrs Date: Thu Apr 25 21:55:29 2013 New Revision: 249907 URL: http://svnweb.freebsd.org/changeset/base/249907 Log: MFC of r249848: This fixes the issue with the "randomly changing" default route. What it was is there are two places in ip_output.c where we do a goto again. One place was fine, it copies out the new address and then resets dst = ro->rt_dst; But the other place does *not* do that, which means earlier when we found the gateway, we have dst pointing there aka dst = ro->rt_gateway is done.. then we do a goto again.. bam now we clobber the default route. The fix is just to move the again so we are always doing dst = &ro->rt_dst; in the again loop. Approved by: r...@freebsd.org (Josh Paetzel) Modified: releng/8.4/sys/netinet/ip_output.c Directory Properties: releng/8.4/sys/ (props changed) releng/8.4/sys/netinet/ (props changed) Modified: releng/8.4/sys/netinet/ip_output.c == --- releng/8.4/sys/netinet/ip_output.c Thu Apr 25 21:19:50 2013 (r249906) +++ releng/8.4/sys/netinet/ip_output.c Thu Apr 25 21:55:29 2013 (r249907) @@ -197,8 +197,8 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = ip->ip_hl << 2; } - dst = (struct sockaddr_in *)&ro->ro_dst; again: + dst = (struct sockaddr_in *)&ro->ro_dst; /* * If there is a cached route, * check that it is to the same destination ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r249892 - stable/9/sys/netinet
Author: rrs Date: Thu Apr 25 11:25:24 2013 New Revision: 249892 URL: http://svnweb.freebsd.org/changeset/base/249892 Log: MFC of r249848 PR: 174749, 157796 Modified: stable/9/sys/netinet/ip_output.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netinet/ip_output.c == --- stable/9/sys/netinet/ip_output.cThu Apr 25 11:24:40 2013 (r249891) +++ stable/9/sys/netinet/ip_output.cThu Apr 25 11:25:24 2013 (r249892) @@ -194,8 +194,8 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = ip->ip_hl << 2; } - dst = (struct sockaddr_in *)&ro->ro_dst; again: + dst = (struct sockaddr_in *)&ro->ro_dst; ia = NULL; /* * If there is a cached route, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r249891 - stable/8/sys/netinet
Author: rrs Date: Thu Apr 25 11:24:40 2013 New Revision: 249891 URL: http://svnweb.freebsd.org/changeset/base/249891 Log: MFC of PR r249848. PR: 174749, 157796 Modified: stable/8/sys/netinet/ip_output.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/netinet/ip_output.c == --- stable/8/sys/netinet/ip_output.cThu Apr 25 08:57:15 2013 (r249890) +++ stable/8/sys/netinet/ip_output.cThu Apr 25 11:24:40 2013 (r249891) @@ -197,8 +197,8 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = ip->ip_hl << 2; } - dst = (struct sockaddr_in *)&ro->ro_dst; again: + dst = (struct sockaddr_in *)&ro->ro_dst; /* * If there is a cached route, * check that it is to the same destination ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r249848 - head/sys/netinet
I like the idea Gleb.. I myself had been thinking that it was rather strange that we used dst for both the gateway and destination.. this is a much cleaner (and safer) solution. R On Apr 25, 2013, at 4:24 AM, Gleb Smirnoff wrote: > -- Randall Stewart 803-317-4952 (cell) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r249848 - head/sys/netinet
Author: rrs Date: Wed Apr 24 18:30:32 2013 New Revision: 249848 URL: http://svnweb.freebsd.org/changeset/base/249848 Log: This fixes the issue with the "randomly changing" default route. What it was is there are two places in ip_output.c where we do a goto again. One place was fine, it copies out the new address and then resets dst = ro->rt_dst; But the other place does *not* do that, which means earlier when we found the gateway, we have dst pointing there aka dst = ro->rt_gateway is done.. then we do a goto again.. bam now we clobber the default route. The fix is just to move the again so we are always doing dst = &ro->rt_dst; in the again loop. PR:174749,157796 MFC after:1 week Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c == --- head/sys/netinet/ip_output.cWed Apr 24 18:00:28 2013 (r249847) +++ head/sys/netinet/ip_output.cWed Apr 24 18:30:32 2013 (r249848) @@ -196,8 +196,8 @@ ip_output(struct mbuf *m, struct mbuf *o hlen = ip->ip_hl << 2; } - dst = (struct sockaddr_in *)&ro->ro_dst; again: + dst = (struct sockaddr_in *)&ro->ro_dst; ia = NULL; /* * If there is a cached route, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r246482 - in head/sys: dev/bxe dev/e1000 dev/ixgbe dev/oce net ofed/drivers/net/mlx4 sys
Author: rrs Date: Thu Feb 7 15:20:54 2013 New Revision: 246482 URL: http://svnweb.freebsd.org/changeset/base/246482 Log: This fixes a out-of-order problem with several of the newer drivers. The basic problem was that the driver was pulling the mbuf off the drbr ring and then when sending with xmit(), encounting a full transmit ring. Thus the lower layer xmit() function would return an error, and the drivers would then append the data back on to the ring. For TCP this is a horrible scenario sure to bring on a fast-retransmit. The fix is to use drbr_peek() to pull the data pointer but not remove it from the ring. If it fails then we either call the new drbr_putback or drbr_advance method. Advance moves it forward (we do this sometimes when the xmit() function frees the mbuf). When we succeed we always call advance. The putback will always copy the mbuf back to the top of the ring. Note that the putback *cannot* be used with a drbr_dequeue() only with drbr_peek(). We most of the time, in putback, would not need to copy it back since most likey the mbuf is still the same, but sometimes xmit() functions will change the mbuf via a pullup or other call. So the optimial case for the single consumer is to always copy it back. If we ever do a multiple_consumer (for lagg?) we will need a test and atomic in the put back possibly a seperate putback_mc() in the ring buf. Reviewed by: j...@freebsd.org, j...@freebsd.org Modified: head/sys/dev/bxe/if_bxe.c head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c head/sys/dev/ixgbe/ixgbe.c head/sys/dev/ixgbe/ixv.c head/sys/dev/oce/oce_if.c head/sys/net/if_var.h head/sys/ofed/drivers/net/mlx4/en_tx.c head/sys/sys/buf_ring.h Modified: head/sys/dev/bxe/if_bxe.c == --- head/sys/dev/bxe/if_bxe.c Thu Feb 7 15:19:12 2013(r246481) +++ head/sys/dev/bxe/if_bxe.c Thu Feb 7 15:20:54 2013(r246482) @@ -9506,24 +9506,15 @@ bxe_tx_mq_start_locked(struct ifnet *ifp BXE_FP_LOCK_ASSERT(fp); - if (m == NULL) { - /* No new work, check for pending frames. */ - next = drbr_dequeue(ifp, fp->br); - } else if (drbr_needs_enqueue(ifp, fp->br)) { - /* Both new and pending work, maintain packet order. */ + if (m != NULL) { rc = drbr_enqueue(ifp, fp->br, m); if (rc != 0) { fp->tx_soft_errors++; goto bxe_tx_mq_start_locked_exit; } - next = drbr_dequeue(ifp, fp->br); - } else - /* New work only, nothing pending. */ - next = m; - + } /* Keep adding entries while there are frames to send. */ - while (next != NULL) { - + while ((next = drbr_peek(ifp, fp->br)) != NULL) { /* The transmit mbuf now belongs to us, keep track of it. */ fp->tx_mbuf_alloc++; @@ -9537,23 +9528,22 @@ bxe_tx_mq_start_locked(struct ifnet *ifp if (__predict_false(rc != 0)) { fp->tx_encap_failures++; /* Very Bad Frames(tm) may have been dropped. */ - if (next != NULL) { + if (next == NULL) { + drbr_advance(ifp, fp->br); + } else { + drbr_putback(ifp, fp->br, next); /* * Mark the TX queue as full and save * the frame. */ ifp->if_drv_flags |= IFF_DRV_OACTIVE; fp->tx_frame_deferred++; - - /* This may reorder frame. */ - rc = drbr_enqueue(ifp, fp->br, next); fp->tx_mbuf_alloc--; } - /* Stop looking for more work. */ break; } - + drbr_advance(ifp, fp->br); /* The transmit frame was enqueued successfully. */ tx_count++; @@ -9574,8 +9564,6 @@ bxe_tx_mq_start_locked(struct ifnet *ifp ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; break; } - - next = drbr_dequeue(ifp, fp->br); } /* No TX packets were dequeued. */ Modified: head/sys/dev/e1000/if_em.c == --- head/sys/dev/e1000/if_em.c Thu Feb 7 15:19:12 2013(r246481) +++ head/sys/dev/e1000/if_em.c Thu Feb 7 15:20:54 2013(r246482) @@ -905,22 +905,24 @@ em_mq_start_locked(struct ifnet *ifp, st } enq = 0; - if (m == NULL) { - next = dr
svn commit: r239672 - head/sys/netinet
Author: rrs Date: Sat Aug 25 09:26:37 2012 New Revision: 239672 URL: http://svn.freebsd.org/changeset/base/239672 Log: This small change takes care of a race condition that can occur when both sides close at the same time. If that occurs, without this fix the connection enters FIN1 on both sides and they will forever send FIN|ACK at each other until the connection times out. This is because we stopped processing the FIN|ACK and thus did not advance the sequence and so never ACK'd each others FIN. This fix adjusts it so we *do* process the FIN properly and the race goes away ;-) MFC after:1 month Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c == --- head/sys/netinet/tcp_input.cSat Aug 25 08:31:21 2012 (r239671) +++ head/sys/netinet/tcp_input.cSat Aug 25 09:26:37 2012 (r239672) @@ -2414,6 +2414,16 @@ tcp_do_segment(struct mbuf *m, struct tc } } else tp->snd_cwnd += tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* +* If its a fin we need to process +* it to avoid a race where both +* sides enter FIN-WAIT and send FIN|ACK +* at the same time. +*/ + break; + } (void) tcp_output(tp); goto drop; } else if (tp->t_dupacks == tcprexmtthresh) { @@ -2453,6 +2463,16 @@ tcp_do_segment(struct mbuf *m, struct tc } tp->snd_nxt = th->th_ack; tp->snd_cwnd = tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* +* If its a fin we need to process +* it to avoid a race where both +* sides enter FIN-WAIT and send FIN|ACK +* at the same time. +*/ + break; + } (void) tcp_output(tp); KASSERT(tp->snd_limited <= 2, ("%s: tp->snd_limited too big", @@ -2479,6 +2499,16 @@ tcp_do_segment(struct mbuf *m, struct tc (tp->snd_nxt - tp->snd_una) + (tp->t_dupacks - tp->snd_limited) * tp->t_maxseg; + if ((thflags & TH_FIN) && + (TCPS_HAVERCVDFIN(tp->t_state) == 0)) { + /* +* If its a fin we need to process +* it to avoid a race where both +* sides enter FIN-WAIT and send FIN|ACK +* at the same time. +*/ + break; + } (void) tcp_output(tp); sent = tp->snd_max - oldsndmax; if (sent > tp->t_maxseg) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r239395 - head/sys/netinet
Author: rrs Date: Sun Aug 19 11:54:02 2012 New Revision: 239395 URL: http://svn.freebsd.org/changeset/base/239395 Log: Though I disagree, I conceed to jhb & Rui. Note that we still have a problem with this whole structure of locks and in_input.c [it does not lock which it should not, but this *can* lead to crashes]. (I have seen it in our SQA testbed.. besides the one with a refcnt issue that I will have SQA work on next week ;-) Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Sun Aug 19 10:34:40 2012(r239394) +++ head/sys/netinet/in.c Sun Aug 19 11:54:02 2012(r239395) @@ -573,6 +573,7 @@ in_control(struct socket *so, u_long cmd } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); + ifa_free(&ia->ia_ifa);/* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); @@ -596,7 +597,6 @@ in_control(struct socket *so, u_long cmd } else ifa_free(&iap->ia_ifa); - ifa_free(&ia->ia_ifa); /* if_addrhead */ ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ out: if (ia != NULL) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r239353 - head/sys/netinet
On Aug 17, 2012, at 8:26 AM, John Baldwin wrote: > On Friday, August 17, 2012 1:51:46 am Randall Stewart wrote: >> Author: rrs >> Date: Fri Aug 17 05:51:46 2012 >> New Revision: 239353 >> URL: http://svn.freebsd.org/changeset/base/239353 >> >> Log: >> Ok jhb, lets move the ifa_free() down to the bottom to >> assure that *all* tables and such are removed before >> we start to free. This won't protect the Hash in ip_input.c >> but in theory should protect any other uses that *do* use locks. > > Eh, this is just a nop unless there is a reference counting bug. Only the > last reference would free the memory if the reference count is correct, so > this is just adding obfuscation by moving the ifa_free() away from the > associated TAILQ_REMOVE(). > Well there is definitely a reference counting but in here somewhere then. And as far as "obfuscation" of the code, it was not obvious to me when first looking at the code and it should have been since I looked at this earlier. So without a more detailed comment I think its obscure anyway ;-) I will get SQA another INVARIANT load and see if they can recreate it for me. The load they had when they first produced this was *supposed* to be INVARIANT but after a bit of research on my part I find they were running the non-invariant, which explains why things locked up instead of the assert triggering.. sigh. Note that in the main FreeBSD sources however, the fact that ip_input.c does *not* lock when it looks at the hash table these lines are removing from here means there is still a potential for a crash. I have a fix for this that does not require the lock, when I get a moment I will send it your way… you have seen part of it ;-) R > -- > John Baldwin > -- Randall Stewart 803-317-4952 (cell) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r239353 - head/sys/netinet
Author: rrs Date: Fri Aug 17 05:51:46 2012 New Revision: 239353 URL: http://svn.freebsd.org/changeset/base/239353 Log: Ok jhb, lets move the ifa_free() down to the bottom to assure that *all* tables and such are removed before we start to free. This won't protect the Hash in ip_input.c but in theory should protect any other uses that *do* use locks. MFC after:1 week (or more) Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Fri Aug 17 05:02:29 2012(r239352) +++ head/sys/netinet/in.c Fri Aug 17 05:51:46 2012(r239353) @@ -573,7 +573,6 @@ in_control(struct socket *so, u_long cmd } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); -/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); @@ -597,6 +596,7 @@ in_control(struct socket *so, u_long cmd } else ifa_free(&iap->ia_ifa); + ifa_free(&ia->ia_ifa); /* if_addrhead */ ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ out: if (ia != NULL) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r239334 - head/sys/netinet
On Aug 16, 2012, at 3:34 PM, John Baldwin wrote: > On Thursday, August 16, 2012 1:55:17 pm Randall Stewart wrote: >> Author: rrs >> Date: Thu Aug 16 17:55:16 2012 >> New Revision: 239334 >> URL: http://svn.freebsd.org/changeset/base/239334 >> >> Log: >> Its never a good idea to double free the same >> address. >> >> MFC after: 1 week (after the other commits ahead of this gets MFC'd) >> >> Modified: >> head/sys/netinet/in.c >> >> Modified: head/sys/netinet/in.c >> > == >> --- head/sys/netinet/in.cThu Aug 16 17:27:11 2012(r239333) >> +++ head/sys/netinet/in.cThu Aug 16 17:55:16 2012(r239334) >> @@ -573,7 +573,7 @@ in_control(struct socket *so, u_long cmd >> } >> TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); >> IF_ADDR_WUNLOCK(ifp); >> -ifa_free(&ia->ia_ifa); /* if_addrhead */ >> +/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ > > This isn't a double free. This is dropping a reference count. In this case > as the comment suggests, it is removing the reference held by the per- > interface if_addrhead list that it was just removed from two lines above. > Later in the function when ifa_free() is invoked: > > LIST_REMOVE(ia, ia_hash); > IN_IFADDR_WUNLOCK(); > ... > ifa_free(&ia->ia_ifa); /* in_ifaddrhead */ > > It is dropping the reference held by the in_ifaddrhead list which the ifa > was removed from by the above LIST_REMOVE(). Are you seeing a panic or > refcount underflow or some such? > No panic, I wish I were so lucky, I had a lockup/fault at: in_gif.c line 410 (this is 9 stable) --- IN_IFADDR_RLOCK(); TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) <--fault in kernel HERE continue; if (ip->ip_src.s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { IN_IFADDR_RUNLOCK(); return 0; } } IN_IFADDR_RUNLOCK(); I went through and made sure first that every reference using V_in_ifaddrhead was properly locking, and they were. The only thing I could find is this. From the instructions I could see in the assembly the ia4->ia_ifa.ifa_ifp was NULL. And thus caused a deref of a NULL pointer. Hmm, it takes two days of pounding to get this by the way. We are using a Shenick with our proxy that is adding and deleting addresses on a somewhat regular basis while traffic is flowing ;-0 Something that not a lot of folks do obviously… not sure why I did not get into DDB, two CPU's faulted at the same time though.. also the HP's that this thing was running on are not known for being kind on getting into even DDB ;-( Be glad when we get them all replaced with iX systems ;-) R > -- > John Baldwin > -- Randall Stewart 803-317-4952 (cell) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r239334 - head/sys/netinet
Author: rrs Date: Thu Aug 16 17:55:16 2012 New Revision: 239334 URL: http://svn.freebsd.org/changeset/base/239334 Log: Its never a good idea to double free the same address. MFC after:1 week (after the other commits ahead of this gets MFC'd) Modified: head/sys/netinet/in.c Modified: head/sys/netinet/in.c == --- head/sys/netinet/in.c Thu Aug 16 17:27:11 2012(r239333) +++ head/sys/netinet/in.c Thu Aug 16 17:55:16 2012(r239334) @@ -573,7 +573,7 @@ in_control(struct socket *so, u_long cmd } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); IF_ADDR_WUNLOCK(ifp); - ifa_free(&ia->ia_ifa); /* if_addrhead */ +/* ifa_free(&ia->ia_ifa); - Double free?? */ /* if_addrhead */ IN_IFADDR_WLOCK(); TAILQ_REMOVE(&V_in_ifaddrhead, ia, ia_link); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r236957 - head/sys/net
Author: rrs Date: Tue Jun 12 13:31:32 2012 New Revision: 236957 URL: http://svn.freebsd.org/changeset/base/236957 Log: Fix comment to better reflect how we are cheating and using the csum_data. Also fix style issues with the comments. Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c == --- head/sys/net/if_gif.c Tue Jun 12 13:15:27 2012(r236956) +++ head/sys/net/if_gif.c Tue Jun 12 13:31:32 2012(r236957) @@ -385,8 +385,9 @@ keep_going: m->m_pkthdr.len -= GIF_HDR_LEN6; #endif #endif - /* Now pull back the af in packet that -* was saved in the address location. + /* +* Now pull back the af that we +* stashed in the csum_data. */ af = m->m_pkthdr.csum_data; @@ -504,9 +505,12 @@ gif_output(ifp, m, dst, ro) dst->sa_family = af; } af = dst->sa_family; - /* Now save the af in the inbound pkt csum -* data, this is a cheat since really -* gif tunnels don't do offload. + /* +* Now save the af in the inbound pkt csum +* data, this is a cheat since we are using +* the inbound csum_data field to carry the +* af over to the gif_start() routine, avoiding +* using yet another mtag. */ m->m_pkthdr.csum_data = af; if (!(ifp->if_flags & IFF_UP) || @@ -516,7 +520,8 @@ gif_output(ifp, m, dst, ro) goto end; } #ifdef ALTQ - /* Make altq aware of the bytes we will add + /* +* Make altq aware of the bytes we will add * when we actually send it. */ #ifdef INET ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r236955 - head/sys/net
That actually will not effect things. Since the packet is on the way out. If the csum_data field gets set on the way in (not out)… so reusing it here I think is safe. R On Jun 12, 2012, at 8:53 AM, Bjoern A. Zeeb wrote: > > On 12. Jun 2012, at 12:44 , Randall Stewart wrote: > >> Author: rrs >> Date: Tue Jun 12 12:44:17 2012 >> New Revision: 236955 >> URL: http://svn.freebsd.org/changeset/base/236955 >> >> Log: >> Note to self. Have morning coffee *before* committing things. >> There is no mac_addr in the mbuf for BSD.. cheat like >> we are supposed to and use the csum field since our friend >> the gif tunnel itself will never use offload. > > There are cards that can do checksums for IPIP... with drivers in out tree. > > >> >> Modified: >> head/sys/net/if_gif.c >> >> Modified: head/sys/net/if_gif.c >> == >> --- head/sys/net/if_gif.cTue Jun 12 12:40:15 2012(r236954) >> +++ head/sys/net/if_gif.cTue Jun 12 12:44:17 2012(r236955) >> @@ -388,7 +388,8 @@ keep_going: >> /* Now pull back the af in packet that >> * was saved in the address location. >> */ >> -bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); >> +af = m->m_pkthdr.csum_data; >> + >> if (ifp->if_bridge) >> af = AF_LINK; >> >> @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro) >> dst->sa_family = af; >> } >> af = dst->sa_family; >> -/* Now save the af in the inbound pkt mac >> - * address location. >> +/* Now save the af in the inbound pkt csum >> + * data, this is a cheat since really >> + * gif tunnels don't do offload. >> */ >> -bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af)); >> +m->m_pkthdr.csum_data = af; >> if (!(ifp->if_flags & IFF_UP) || >> sc->gif_psrc == NULL || sc->gif_pdst == NULL) { >> m_freem(m); > > -- > Bjoern A. Zeeb You have to have visions! > It does not matter how good you are. It matters what good you do! > > -- Randall Stewart 803-317-4952 (cell) ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r236955 - head/sys/net
Author: rrs Date: Tue Jun 12 12:44:17 2012 New Revision: 236955 URL: http://svn.freebsd.org/changeset/base/236955 Log: Note to self. Have morning coffee *before* committing things. There is no mac_addr in the mbuf for BSD.. cheat like we are supposed to and use the csum field since our friend the gif tunnel itself will never use offload. Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c == --- head/sys/net/if_gif.c Tue Jun 12 12:40:15 2012(r236954) +++ head/sys/net/if_gif.c Tue Jun 12 12:44:17 2012(r236955) @@ -388,7 +388,8 @@ keep_going: /* Now pull back the af in packet that * was saved in the address location. */ - bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); + af = m->m_pkthdr.csum_data; + if (ifp->if_bridge) af = AF_LINK; @@ -503,10 +504,11 @@ gif_output(ifp, m, dst, ro) dst->sa_family = af; } af = dst->sa_family; - /* Now save the af in the inbound pkt mac -* address location. + /* Now save the af in the inbound pkt csum +* data, this is a cheat since really +* gif tunnels don't do offload. */ - bcopy(&af, m->m_pkthdr.src_mac_addr, sizeof(af)); + m->m_pkthdr.csum_data = af; if (!(ifp->if_flags & IFF_UP) || sc->gif_psrc == NULL || sc->gif_pdst == NULL) { m_freem(m); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r236954 - head/sys/net
Author: rrs Date: Tue Jun 12 12:40:15 2012 New Revision: 236954 URL: http://svn.freebsd.org/changeset/base/236954 Log: Opps forgot to commit the flag. Modified: head/sys/net/if.h Modified: head/sys/net/if.h == --- head/sys/net/if.h Tue Jun 12 12:10:10 2012(r236953) +++ head/sys/net/if.h Tue Jun 12 12:40:15 2012(r236954) @@ -153,7 +153,7 @@ struct if_data { #defineIFF_STATICARP 0x8 /* (n) static ARP */ #defineIFF_DYING 0x20/* (n) interface is winding down */ #defineIFF_RENAMING0x40/* (n) interface is being renamed */ - +#define IFF_GIF_WANTED 0x100 /* (n) The gif tunnel is wanted */ /* * Old names for driver flags so that user space tools can continue to use * the old (portable) names. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r236951 - head/sys/net
Author: rrs Date: Tue Jun 12 10:44:09 2012 New Revision: 236951 URL: http://svn.freebsd.org/changeset/base/236951 Log: Allow a gif tunnel to be used with ALTq. Reviewed by: gnn Modified: head/sys/net/if_gif.c Modified: head/sys/net/if_gif.c == --- head/sys/net/if_gif.c Tue Jun 12 10:25:11 2012(r236950) +++ head/sys/net/if_gif.c Tue Jun 12 10:44:09 2012(r236951) @@ -342,26 +342,98 @@ gif_encapcheck(m, off, proto, arg) return 0; } } +#ifdef INET +#define GIF_HDR_LEN (ETHER_HDR_LEN + sizeof (struct ip)) +#endif +#ifdef INET6 +#define GIF_HDR_LEN6 (ETHER_HDR_LEN + sizeof (struct ip6_hdr)) +#endif static void gif_start(struct ifnet *ifp) { struct gif_softc *sc; struct mbuf *m; + uint32_t af; + int error = 0; sc = ifp->if_softc; - + GIF_LOCK(sc); + if (ifp->if_drv_flags & IFF_DRV_OACTIVE) { + /* Already active */ + ifp->if_drv_flags |= IFF_GIF_WANTED; + GIF_UNLOCK(sc); + return; + } ifp->if_drv_flags |= IFF_DRV_OACTIVE; - for (;;) { - IFQ_DEQUEUE(&ifp->if_snd, m); + GIF_UNLOCK(sc); +keep_going: + while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { + + IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == 0) break; - gif_output(ifp, m, sc->gif_pdst, NULL); +#ifdef ALTQ + /* Take out those altq bytes we add in gif_output */ +#ifdef INET + if (sc->gif_psrc->sa_family == AF_INET) + m->m_pkthdr.len -= GIF_HDR_LEN; +#endif +#ifdef INET6 + if (sc->gif_psrc->sa_family == AF_INET6) + m->m_pkthdr.len -= GIF_HDR_LEN6; +#endif +#endif + /* Now pull back the af in packet that +* was saved in the address location. +*/ + bcopy(m->m_pkthdr.src_mac_addr, &af, sizeof(af)); + if (ifp->if_bridge) + af = AF_LINK; + + BPF_MTAP2(ifp, &af, sizeof(af), m); + ifp->if_opackets++; + +/* Done by IFQ_HANDOFF */ +/* ifp->if_obytes += m->m_pkthdr.len;*/ + /* override to IPPROTO_ETHERIP for bridged traffic */ + + M_SETFIB(m, sc->gif_fibnum); + /* inner AF-specific encapsulation */ + /* XXX should we check if our outer source is legal? */ + /* dispatch to output logic based on outer AF */ + switch (sc->gif_psrc->sa_family) { +#ifdef INET + case AF_INET: + error = in_gif_output(ifp, af, m); + break; +#endif +#ifdef INET6 + case AF_INET6: + error = in6_gif_output(ifp, af, m); + break; +#endif + default: + m_freem(m); + error = ENETDOWN; + } + if (error) + ifp->if_oerrors++; } + GIF_LOCK(sc); + if (ifp->if_drv_flags & IFF_GIF_WANTED) { + /* Someone did a start while +* we were unlocked and processing +* lets clear the flag and try again. +*/ + ifp->if_drv_flags &= ~IFF_GIF_WANTED; + GIF_UNLOCK(sc); + goto keep_going; + } ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - + GIF_UNLOCK(sc); return; } @@ -376,8 +448,7 @@ gif_output(ifp, m, dst, ro) struct m_tag *mtag; int error = 0; int gif_called; - u_int32_t af; - + uint32_t af; #ifdef MAC error = mac_ifnet_check_transmit(ifp, m); if (error) { @@ -426,55 +497,40 @@ gif_output(ifp, m, dst, ro) m_tag_prepend(m, mtag); m->m_flags &= ~(M_BCAST|M_MCAST); - - GIF_LOCK(sc); - - if (!(ifp->if_flags & IFF_UP) || - sc->gif_psrc == NULL || sc->gif_pdst == NULL) { - GIF_UNLOCK(sc); - m_freem(m); - error = ENETDOWN; - goto end; - } - /* BPF writes need to be handled specially. */ if (dst->sa_family == AF_UNSPEC) { bcopy(dst->sa_data, &af, sizeof(af)); dst->sa_family = af; } - af = dst->sa_family; - BPF_MTAP2(ifp, &af, sizeof(af), m); - ifp->if_opackets++; - ifp->if_obytes += m->m_pkthdr.len; - - /* override to IPPROTO_ETHERIP for bridged traffic */ - if (ifp->if_bridge) - af = AF_LINK; - - M_SETFIB(m, sc->gif_fibnum); - /* inner AF-specific encapsulation */ - - /* XXX should we check if our outer source is legal? */ - - /* dispatch to output logic based on outer AF */ - switch (sc->gif
svn commit: r233660 - head/sys/netinet
Author: rrs Date: Thu Mar 29 13:36:53 2012 New Revision: 233660 URL: http://svn.freebsd.org/changeset/base/233660 Log: Make stream our stream reset implementation compliant to RFC6525. MFC after:1 month Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_header.h head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_output.h head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_peeloff.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c head/sys/netinet/sctputil.h Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Thu Mar 29 13:01:29 2012(r233659) +++ head/sys/netinet/sctp.h Thu Mar 29 13:36:53 2012(r233660) @@ -155,8 +155,22 @@ struct sctp_paramhdr { * field. */ -/* these should probably go into sockets API */ -#define SCTP_RESET_STREAMS 0x1004 /* wo */ +#define SCTP_ENABLE_STREAM_RESET 0x0900 /* struct +* sctp_assoc_value */ +#define SCTP_RESET_STREAMS 0x0901 /* struct +* sctp_reset_streams */ +#define SCTP_RESET_ASSOC 0x0902 /* sctp_assoc_t */ +#define SCTP_ADD_STREAMS 0x0903 /* struct +* sctp_add_streams */ + +/* For enable stream reset */ +#define SCTP_ENABLE_RESET_STREAM_REQ 0x0001 +#define SCTP_ENABLE_RESET_ASSOC_REQ0x0002 +#define SCTP_ENABLE_CHANGE_ASSOC_REQ 0x0004 +#define SCTP_ENABLE_VALUE_MASK 0x0007 +/* For reset streams */ +#define SCTP_STREAM_RESET_INCOMING 0x0001 +#define SCTP_STREAM_RESET_OUTGOING 0x0002 /* here on down are more implementation specific */ Modified: head/sys/netinet/sctp_constants.h == --- head/sys/netinet/sctp_constants.h Thu Mar 29 13:01:29 2012 (r233659) +++ head/sys/netinet/sctp_constants.h Thu Mar 29 13:36:53 2012 (r233660) @@ -418,7 +418,8 @@ __FBSDID("$FreeBSD$"); #define SCTP_STR_RESET_IN_REQUEST 0x000e #define SCTP_STR_RESET_TSN_REQUEST 0x000f #define SCTP_STR_RESET_RESPONSE0x0010 -#define SCTP_STR_RESET_ADD_STREAMS 0x0011 +#define SCTP_STR_RESET_ADD_OUT_STREAMS 0x0011 +#define SCTP_STR_RESET_ADD_IN_STREAMS 0x0012 #define SCTP_MAX_RESET_PARAMS 2 #define SCTP_STREAM_RESET_TSN_DELTA0x1000 Modified: head/sys/netinet/sctp_header.h == --- head/sys/netinet/sctp_header.h Thu Mar 29 13:01:29 2012 (r233659) +++ head/sys/netinet/sctp_header.h Thu Mar 29 13:36:53 2012 (r233660) @@ -501,7 +501,7 @@ struct sctp_stream_reset_add_strm { #define SCTP_STREAM_RESET_NOTHING 0x /* Nothing for me to do */ #define SCTP_STREAM_RESET_PERFORMED 0x0001 /* Did it */ -#define SCTP_STREAM_RESET_DENIED0x0002 /* refused to do it */ +#define SCTP_STREAM_RESET_REJECT0x0002 /* refused to do it */ #define SCTP_STREAM_RESET_ERROR_STR 0x0003 /* bad Stream no */ #define SCTP_STREAM_RESET_TRY_LATER 0x0004 /* collision, try again */ #define SCTP_STREAM_RESET_BAD_SEQNO 0x0005 /* bad str-reset seq no */ Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Thu Mar 29 13:01:29 2012 (r233659) +++ head/sys/netinet/sctp_input.c Thu Mar 29 13:36:53 2012 (r233660) @@ -2790,6 +2790,7 @@ sctp_handle_cookie_echo(struct mbuf *m, inp->sctp_ecn_enable = (*inp_p)->sctp_ecn_enable; inp->partial_delivery_point = (*inp_p)->partial_delivery_point; inp->sctp_context = (*inp_p)->sctp_context; + inp->local_strreset_support = (*inp_p)->local_strreset_support; inp->inp_starting_point_for_iterator = NULL; /* * copy in the authentication parameters from the @@ -3612,20 +3613,35 @@ sctp_handle_stream_reset_response(struct if (asoc->stream_reset_outstanding) asoc->stream_reset_outstanding--; if (action != SCTP_STREAM_RESET_PERFORMED) { - sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, number_entries, srparam->list_of_streams, SCTP_SO_NOT_LOCKED); + sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, + number_entries,
svn commit: r232866 - head/sys/netinet
Author: rrs Date: Mon Mar 12 15:05:17 2012 New Revision: 232866 URL: http://svn.freebsd.org/changeset/base/232866 Log: This fixes PR 165210. Basically we just add in the netgraph interface to the list of acceptable interfaces. A todo at the next IETF code blitz, though is we need to review why we screen interfaces, there was a reason ;-). PR: 165210 MFC after:1 week Modified: head/sys/netinet/sctp_bsd_addr.c Modified: head/sys/netinet/sctp_bsd_addr.c == --- head/sys/netinet/sctp_bsd_addr.cMon Mar 12 14:07:57 2012 (r232865) +++ head/sys/netinet/sctp_bsd_addr.cMon Mar 12 15:05:17 2012 (r232866) @@ -184,6 +184,7 @@ sctp_is_desired_interface_type(struct if case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: + case IFT_PROPVIRTUAL: /* NetGraph Virtual too */ case IFT_VIRTUALIPADDRESS: result = 1; break; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r217592 - head/sys/netinet
John: So I caught up with Dave Thaler here at the IETF... He said that NO UDP socket that has NOT joined a multicast group should ever receive a packet sent to a multicast address. He also said this was part of the POSIX API and the way all Unix machines worked. So.. no it is a bug and the fix is correct. R On Mar 29, 2011, at 2:01 PM, John Baldwin wrote: > On Wednesday, January 19, 2011 2:07:16 pm Randall Stewart wrote: >> Author: rrs >> Date: Wed Jan 19 19:07:16 2011 >> New Revision: 217592 >> URL: http://svn.freebsd.org/changeset/base/217592 >> >> Log: >> Fix a bug where Multicast packets sent from a >> udp endpoint may end up echoing back to the sender >> even with OUT joining the multi-cast group. >> >> Reviewed by:gnn, bms, bz? >> Obtained from: deischen (with help from) >> >> Modified: >> head/sys/netinet/udp_usrreq.c >> >> Modified: head/sys/netinet/udp_usrreq.c >> > == >> --- head/sys/netinet/udp_usrreq.cWed Jan 19 18:20:11 2011 >> (r217591) >> +++ head/sys/netinet/udp_usrreq.cWed Jan 19 19:07:16 2011 >> (r217592) >> @@ -479,11 +479,13 @@ udp_input(struct mbuf *m, int off) >> * and source-specific multicast. [RFC3678] >> */ >> imo = inp->inp_moptions; >> -if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) && >> -imo != NULL) { >> +if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { >> struct sockaddr_in group; >> int blocked; >> - >> +if(imo == NULL) { >> +INP_RUNLOCK(inp); >> +continue; >> +} >> bzero(&group, sizeof(struct sockaddr_in)); >> group.sin_len = sizeof(struct sockaddr_in); >> group.sin_family = AF_INET; > > So it turns out that this is a feature, not a bug, and is how multicast has > always worked. Specifically, if you bind a UDP socket with a wildcard > address, it should receive all traffic for the bound port, unicast or > multicast. When you join a group, you have switched the socket into a mode > where it now has a whitelist of acceptable multicast groups, but if a socket > has no joined groups, it should receive all multicast traffic, not none. > This > change breaks that. > > I did not find this behavior intuitive at first, but it does seem to be > required. Note the description of IP_ADD_MEMBERSHIP from RFC 3678 for > example: > > 3. Overview of APIs > > There are a number of different APIs described in this document that > are appropriate for a number of different application types and IP > versions. Before providing detailed descriptions, this section > provides a "taxonomy" with a brief description of each. > > There are two categories of source-filter APIs, both of which are > designed to allow multicast receiver applications to designate the > unicast address(es) of sender(s) along with the multicast group > (destination address) to receive. > > o Basic (Delta-based): Some applications desire the simplicity of > a delta-based API in which each function call specifies a > single source address which should be added to or removed from > the existing filter for a given multicast group address on > which to listen. Such applications typically fall into either > of two categories: > > + Any-Source Multicast: By default, all sources are accepted. >Individual sources may be turned off and back on as needed >over time. This is also known as "exclude" mode, since the >source filter contains a list of excluded sources. > > + Source-Specific Multicast: Only sources in a given list are >allowed. The list may change over time. This is also known >as "include" mode, since the source filter contains a list >of included sources. > >This API would be used, for example, by "single-source" >applications such as audio/video broadcasting. It would >also be used for logical multi-source sessions where each >source independently allocates its own Source-Specific >Multicast group a
Re: svn commit: r217592 - head/sys/netinet
John: The original complaint on this came from Daniel... I believe he claimed that up until bms's multi-cast work.. you would NOT get a packet sent to you if you did not join the multi-cast group. I will also comment in-line below... On Mar 29, 2011, at 2:01 PM, John Baldwin wrote: > On Wednesday, January 19, 2011 2:07:16 pm Randall Stewart wrote: >> Author: rrs >> Date: Wed Jan 19 19:07:16 2011 >> New Revision: 217592 >> URL: http://svn.freebsd.org/changeset/base/217592 >> >> Log: >> Fix a bug where Multicast packets sent from a >> udp endpoint may end up echoing back to the sender >> even with OUT joining the multi-cast group. >> >> Reviewed by:gnn, bms, bz? >> Obtained from: deischen (with help from) >> >> Modified: >> head/sys/netinet/udp_usrreq.c >> >> Modified: head/sys/netinet/udp_usrreq.c >> > == >> --- head/sys/netinet/udp_usrreq.cWed Jan 19 18:20:11 2011 >> (r217591) >> +++ head/sys/netinet/udp_usrreq.cWed Jan 19 19:07:16 2011 >> (r217592) >> @@ -479,11 +479,13 @@ udp_input(struct mbuf *m, int off) >> * and source-specific multicast. [RFC3678] >> */ >> imo = inp->inp_moptions; >> -if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr)) && >> -imo != NULL) { >> +if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { >> struct sockaddr_in group; >> int blocked; >> - >> +if(imo == NULL) { >> +INP_RUNLOCK(inp); >> +continue; >> +} >> bzero(&group, sizeof(struct sockaddr_in)); >> group.sin_len = sizeof(struct sockaddr_in); >> group.sin_family = AF_INET; > > So it turns out that this is a feature, not a bug, and is how multicast has > always worked. Specifically, if you bind a UDP socket with a wildcard > address, it should receive all traffic for the bound port, unicast or > multicast. When you join a group, you have switched the socket into a mode > where it now has a whitelist of acceptable multicast groups, but if a socket > has no joined groups, it should receive all multicast traffic, not none. > This > change breaks that. > > I did not find this behavior intuitive at first, but it does seem to be > required. Note the description of IP_ADD_MEMBERSHIP from RFC 3678 for > example: I agree getting a packet that is coming to your port without joining the multi-cast group is not intuitive to me... > > 3. Overview of APIs > > There are a number of different APIs described in this document that > are appropriate for a number of different application types and IP > versions. Before providing detailed descriptions, this section > provides a "taxonomy" with a brief description of each. > > There are two categories of source-filter APIs, both of which are > designed to allow multicast receiver applications to designate the > unicast address(es) of sender(s) along with the multicast group > (destination address) to receive. > > o Basic (Delta-based): Some applications desire the simplicity of > a delta-based API in which each function call specifies a > single source address which should be added to or removed from > the existing filter for a given multicast group address on > which to listen. Such applications typically fall into either > of two categories: > > + Any-Source Multicast: By default, all sources are accepted. >Individual sources may be turned off and back on as needed >over time. This is also known as "exclude" mode, since the >source filter contains a list of excluded sources. > > + Source-Specific Multicast: Only sources in a given list are >allowed. The list may change over time. This is also known >as "include" mode, since the source filter contains a list >of included sources. > >This API would be used, for example, by "single-source" >applications such as audio/video broadcasting. It would >also be used for logical multi-source sessions where each >source independently allocates its own Source-S
svn commit: r219397 - head/sys/netinet
Author: rrs Date: Tue Mar 8 11:58:25 2011 New Revision: 219397 URL: http://svn.freebsd.org/changeset/base/219397 Log: Tunes and fixes the new DC-CC to seem to hit the right mix. Still may need some tweaks but it appears to almost not give away too much to an RFC2581 flow, but can really minimize the amount of buffers used in the net. MFC after:3 months Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_dtrace_declare.h head/sys/netinet/sctp_dtrace_define.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Tue Mar 8 11:50:59 2011(r219396) +++ head/sys/netinet/sctp.h Tue Mar 8 11:58:25 2011(r219397) @@ -263,6 +263,7 @@ struct sctp_paramhdr { #define SCTP_CC_OPT_RTCC_SETMODE 0x2000 #define SCTP_CC_OPT_USE_DCCC_ECN 0x2001 +#define SCTP_CC_OPT_STEADY_STEP 0x2002 /* RS - Supported stream scheduling modules for pluggable * stream scheduling Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cTue Mar 8 11:50:59 2011 (r219396) +++ head/sys/netinet/sctp_cc_functions.cTue Mar 8 11:58:25 2011 (r219397) @@ -185,6 +185,328 @@ sctp_cwnd_update_after_fr(struct sctp_tc } } +/* Defines for instantaneous bw decisions */ +#define SCTP_INST_LOOSING 1/* Loosing to other flows */ +#define SCTP_INST_NEUTRAL 2/* Neutral, no indication */ +#define SCTP_INST_GAINING 3/* Gaining, step down possible */ + + +static int +cc_bw_same(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw, +uint64_t rtt_offset, uint64_t vtag, uint8_t inst_ind) +{ + uint64_t oth, probepoint; + + probepoint = (((uint64_t) net->cwnd) << 32); + if (net->rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { + /* +* rtt increased we don't update bw.. so we don't update the +* rtt either. +*/ + /* Probe point 5 */ + probepoint |= ((5 << 16) | 1); + SDT_PROBE(sctp, cwnd, net, rttvar, + vtag, + ((net->cc_mod.rtcc.lbw << 32) | nbw), + ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), + net->flight_size, + probepoint); + if ((net->cc_mod.rtcc.steady_step) && (inst_ind != SCTP_INST_LOOSING)) { + if (net->cc_mod.rtcc.last_step_state == 5) + net->cc_mod.rtcc.step_cnt++; + else + net->cc_mod.rtcc.step_cnt = 1; + net->cc_mod.rtcc.last_step_state = 5; + if ((net->cc_mod.rtcc.step_cnt == net->cc_mod.rtcc.steady_step) || + ((net->cc_mod.rtcc.step_cnt > net->cc_mod.rtcc.steady_step) && + ((net->cc_mod.rtcc.step_cnt % net->cc_mod.rtcc.steady_step) == 0))) { + /* Try a step down */ + oth = net->cc_mod.rtcc.vol_reduce; + oth <<= 16; + oth |= net->cc_mod.rtcc.step_cnt; + oth <<= 16; + oth |= net->cc_mod.rtcc.last_step_state; + SDT_PROBE(sctp, cwnd, net, rttstep, + vtag, + ((net->cc_mod.rtcc.lbw << 32) | nbw), + ((net->cc_mod.rtcc.lbw_rtt << 32) | net->rtt), + oth, + probepoint); + if (net->cwnd > (4 * net->mtu)) { + net->cwnd -= net->mtu; + net->cc_mod.rtcc.vol_reduce++; + } else { + net->cc_mod.rtcc.step_cnt = 0; + } + } + } + return (1); + } + if (net->rtt < net->cc_mod.rtcc.lbw_rtt - rtt_offset) { + /* +* rtt decreased, there could be more room. we update both +* the bw and the rtt here to lock this in as a good step +* down. +*/ + /* Probe point 6 */ + probepoint |= ((6 << 16) | 0); + SDT
svn commit: r219120 - head/sys/netinet
Author: rrs Date: Tue Mar 1 00:37:46 2011 New Revision: 219120 URL: http://svn.freebsd.org/changeset/base/219120 Log: Adds a new Congestion Control that helps reduce the RTT that a flow will build up in buffers in transit. It is a slight modification to RFC2581 but is more friendly i.e. less aggressive. MFC after:3 months Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_constants.h head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Tue Mar 1 00:13:50 2011(r219119) +++ head/sys/netinet/sctp.h Tue Mar 1 00:37:46 2011(r219120) @@ -258,6 +258,11 @@ struct sctp_paramhdr { #define SCTP_CC_HSTCP 0x0001 /* HTCP Congestion Control */ #define SCTP_CC_HTCP 0x0002 +/* RTCC Congestion Control - RFC2581 plus */ +#define SCTP_CC_RTCC0x0003 + +#define SCTP_CC_OPT_RTCC_SETMODE 0x2000 +#define SCTP_CC_OPT_USE_DCCC_ECN 0x2001 /* RS - Supported stream scheduling modules for pluggable * stream scheduling Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cTue Mar 1 00:13:50 2011 (r219119) +++ head/sys/netinet/sctp_cc_functions.cTue Mar 1 00:37:46 2011 (r219120) @@ -185,10 +185,203 @@ sctp_cwnd_update_after_fr(struct sctp_tc } } + +/* RTCC Algoritm to limit growth of cwnd, return + * true if you want to NOT allow cwnd growth + */ +static int +cc_bw_limit(struct sctp_tcb *stcb, struct sctp_nets *net, uint64_t nbw) +{ + uint64_t bw_offset, rtt_offset, rtt, vtag, probepoint; + + /*- +* Here we need to see if we want +* to limit cwnd growth due to increase +* in overall rtt but no increase in bw. +* We use the following table to figure +* out what we should do. When we return +* 0, cc update goes on as planned. If we +* return 1, then no cc update happens and cwnd +* stays where it is at. +* -- +* BW|RTT | Action +* * +* INC |INC | return 0 +* -- +* INC |SAME | return 0 +* -- +* INC |DECR | return 0 +* -- +* SAME |INC | return 1 +* -- +* SAME |SAME | return 1 +* -- +* SAME |DECR | return 0 +* -- +* DECR |INC | return 0 or 1 based on if we caused. +* -- +* DECR |SAME | return 0 +* -- +* DECR |DECR | return 0 +* -- +* +* We are a bit fuzz on what an increase or +* decrease is. For BW it is the same if +* it did not change within 1/64th. For +* RTT it stayed the same if it did not +* change within 1/32nd +*/ + rtt = stcb->asoc.my_vtag; + vtag = (rtt << 32) | (((uint32_t) (stcb->sctp_ep->sctp_lport)) << 16) | (stcb->rport); + probepoint = (((uint64_t) net->cwnd) << 32); + rtt = net->rtt; + bw_offset = net->cc_mod.rtcc.lbw >> SCTP_BASE_SYSCTL(sctp_rttvar_bw); + if (nbw > net->cc_mod.rtcc.lbw + bw_offset) { + /* +* BW increased, so update and return 0, since all actions +* in our table say to do the normal CC update +*/ + /* PROBE POINT 0 */ + SDT_PROBE(sctp, cwnd, net, rttvar, + vtag, + ((net->cc_mod.rtcc.lbw << 32) | nbw), + net->cc_mod.rtcc.lbw_rtt, + rtt, + probepoint); + net->cc_mod.rtcc.lbw = nbw; + net->cc_mod.rtcc.lbw_rtt = rtt; + net->cc_mod.rtcc.cwnd_at_bw_set = net->cwnd; + return (0); + } + rtt_offset = net->cc_mod.rtcc.lbw_rtt >> SCTP_BASE_SYSCTL(sctp_rttvar_rtt); + if (nbw < net->cc_mod.rtcc.lbw - bw_offset) { + /* Bandwidth decreased. */ + if (rtt > net->cc_mod.rtcc.lbw_rtt + rtt_offset) { + /* rtt increased */ + /* Did we add more */ + if (net->cwnd > net->cc_mod.rtcc.cwnd_at_bw_set) { + /* We caused it maybe.. back off */ +
svn commit: r219057 - head/sys/netinet
Author: rrs Date: Sat Feb 26 15:23:46 2011 New Revision: 219057 URL: http://svn.freebsd.org/changeset/base/219057 Log: Improvements to CC modules: 1) Add four new points that allow you to get more information to cc algo's 2) Fix the case where user changes module on a existing TCB, in such a case, the initialization module needs to be called on all nets. 3) Move htcp_cc structure to a union that other modules can use. 4) Add 5th point for get/set socket options for cc_module specific options MFC after:2 months Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_cc_functions.c head/sys/netinet/sctp_dtrace_declare.h head/sys/netinet/sctp_dtrace_define.h head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h head/sys/netinet/sctp_sysctl.c head/sys/netinet/sctp_sysctl.h head/sys/netinet/sctp_timer.c head/sys/netinet/sctp_uio.h head/sys/netinet/sctp_usrreq.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp.h == --- head/sys/netinet/sctp.h Sat Feb 26 14:58:54 2011(r219056) +++ head/sys/netinet/sctp.h Sat Feb 26 15:23:46 2011(r219057) @@ -161,9 +161,10 @@ struct sctp_paramhdr { /* JRS - Pluggable Congestion Control Socket option */ #define SCTP_PLUGGABLE_CC 0x1202 /* RS - Pluggable Stream Scheduling Socket option */ -#define SCTP_PLUGGABLE_SS 0x1203 -#define SCTP_SS_VALUE 0x1204 - +#define SCTP_PLUGGABLE_SS 0x1203 +#define SCTP_SS_VALUE 0x1204 +#define SCTP_CC_OPTION 0x1205 /* Options for CC +* modules */ /* read only */ #define SCTP_GET_SNDBUF_USE0x1101 #define SCTP_GET_STAT_LOG 0x1103 Modified: head/sys/netinet/sctp_cc_functions.c == --- head/sys/netinet/sctp_cc_functions.cSat Feb 26 14:58:54 2011 (r219056) +++ head/sys/netinet/sctp_cc_functions.cSat Feb 26 15:23:46 2011 (r219057) @@ -1135,10 +1135,10 @@ htcp_reset(struct htcp *ca) static uint32_t htcp_cwnd_undo(struct sctp_tcb *stcb, struct sctp_nets *net) { - net->htcp_ca.last_cong = net->htcp_ca.undo_last_cong; - net->htcp_ca.maxRTT = net->htcp_ca.undo_maxRTT; - net->htcp_ca.old_maxB = net->htcp_ca.undo_old_maxB; - return max(net->cwnd, ((net->ssthresh / net->mtu << 7) / net->htcp_ca.beta) * net->mtu); + net->cc_mod.htcp_ca.last_cong = net->cc_mod.htcp_ca.undo_last_cong; + net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.undo_maxRTT; + net->cc_mod.htcp_ca.old_maxB = net->cc_mod.htcp_ca.undo_old_maxB; + return max(net->cwnd, ((net->ssthresh / net->mtu << 7) / net->cc_mod.htcp_ca.beta) * net->mtu); } #endif @@ -1149,15 +1149,15 @@ measure_rtt(struct sctp_tcb *stcb, struc uint32_t srtt = net->lastsa >> SCTP_RTT_SHIFT; /* keep track of minimum RTT seen so far, minRTT is zero at first */ - if (net->htcp_ca.minRTT > srtt || !net->htcp_ca.minRTT) - net->htcp_ca.minRTT = srtt; + if (net->cc_mod.htcp_ca.minRTT > srtt || !net->cc_mod.htcp_ca.minRTT) + net->cc_mod.htcp_ca.minRTT = srtt; /* max RTT */ - if (net->fast_retran_ip == 0 && net->ssthresh < 0x && htcp_ccount(&net->htcp_ca) > 3) { - if (net->htcp_ca.maxRTT < net->htcp_ca.minRTT) - net->htcp_ca.maxRTT = net->htcp_ca.minRTT; - if (net->htcp_ca.maxRTT < srtt && srtt <= net->htcp_ca.maxRTT + MSEC_TO_TICKS(20)) - net->htcp_ca.maxRTT = srtt; + if (net->fast_retran_ip == 0 && net->ssthresh < 0x && htcp_ccount(&net->cc_mod.htcp_ca) > 3) { + if (net->cc_mod.htcp_ca.maxRTT < net->cc_mod.htcp_ca.minRTT) + net->cc_mod.htcp_ca.maxRTT = net->cc_mod.htcp_ca.minRTT; + if (net->cc_mod.htcp_ca.maxRTT < srtt && srtt <= net->cc_mod.htcp_ca.maxRTT + MSEC_TO_TICKS(20)) + net->cc_mod.htcp_ca.maxRTT = srtt; } } @@ -1167,7 +1167,7 @@ measure_achieved_throughput(struct sctp_ uint32_t now = sctp_get_tick_count(); if (net->fast_retran_ip == 0) - net->htcp_ca.bytes_acked = net->net_ack; + net->cc_mod.htcp_ca.bytes_acked = net->net_ack; if (!use_bandwidth_switch) return; @@ -1175,29 +1175,29 @@ measure_achieved_throughput(struct sctp_ /* achieved throughput calculations */ /* JRS - not 100% sure of this statement */ if (net->fast_retran_ip == 1) { - net->htcp_ca.bytecount = 0; - net->htcp_ca.lasttime = now; + net->cc_mod.
svn commit: r218641 - head/sys/netinet
Author: rrs Date: Sun Feb 13 14:48:11 2011 New Revision: 218641 URL: http://svn.freebsd.org/changeset/base/218641 Log: Fix a bug reported by Jonathan Leighton in his web-sctp testing at the Univ-of-Del. Basically when a 1-to-1 socket did a socket/bind/send(data)/close. If the timing was right we would dereference a socket that is NULL. MFC after:1 month Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Sun Feb 13 14:46:39 2011 (r218640) +++ head/sys/netinet/sctp_input.c Sun Feb 13 14:48:11 2011 (r218641) @@ -2865,24 +2865,31 @@ sctp_handle_cookie_ack(struct sctp_cooki SCTP_SOCKET_LOCK(so, 1); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); - if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { - SCTP_SOCKET_UNLOCK(so, 1); - return; - } #endif - soisconnected(stcb->sctp_socket); + if ((stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) == 0) { + soisconnected(stcb->sctp_socket); + } #if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) SCTP_SOCKET_UNLOCK(so, 1); #endif } - sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, - stcb, net); /* * since we did not send a HB make sure we don't double * things */ net->hb_responded = 1; + if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { + /* +* We don't need to do the asconf thing, nor hb or +* autoclose if the socket is closed. +*/ + goto closed_socket; + } + sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, + stcb, net); + + if (stcb->asoc.sctp_autoclose_ticks && sctp_is_feature_on(stcb->sctp_ep, SCTP_PCB_FLAGS_AUTOCLOSE)) { sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, @@ -2906,6 +2913,7 @@ sctp_handle_cookie_ack(struct sctp_cooki #endif } } +closed_socket: /* Toss the cookie if I can */ sctp_toss_old_cookies(stcb, asoc); if (!TAILQ_EMPTY(&asoc->sent_queue)) { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r218393 - head/sys/netinet
Author: rrs Date: Mon Feb 7 08:12:24 2011 New Revision: 218393 URL: http://svn.freebsd.org/changeset/base/218393 Log: If not set (due to some error Michael is working on fixing) set it for the net. MFC after:3 months Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c == --- head/sys/netinet/sctp_output.c Mon Feb 7 08:10:29 2011 (r218392) +++ head/sys/netinet/sctp_output.c Mon Feb 7 08:12:24 2011 (r218393) @@ -3485,6 +3485,12 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_BUF_NEXT(newm) = m; m = newm; if (net != NULL) { + if (net->flowidset == 0) { + net->flowid = stcb->asoc.my_vtag ^ + ntohs(stcb->rport) ^ + ntohs(stcb->sctp_ep->sctp_lport); + net->flowidset = 1; + } m->m_pkthdr.flowid = net->flowid; m->m_flags |= M_FLOWID; } else { @@ -3815,6 +3821,12 @@ sctp_lowlevel_chunk_output(struct sctp_i SCTP_BUF_NEXT(newm) = m; m = newm; if (net != NULL) { + if (net->flowidset == 0) { + net->flowid = stcb->asoc.my_vtag ^ + ntohs(stcb->rport) ^ + ntohs(stcb->sctp_ep->sctp_lport); + net->flowidset = 1; + } m->m_pkthdr.flowid = net->flowid; m->m_flags |= M_FLOWID; } else { ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r218392 - head/sys/netinet
Author: rrs Date: Mon Feb 7 08:10:29 2011 New Revision: 218392 URL: http://svn.freebsd.org/changeset/base/218392 Log: 1) Track when flowid does get set. MFC after:3 months Modified: head/sys/netinet/sctp_input.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_structs.h Modified: head/sys/netinet/sctp_input.c == --- head/sys/netinet/sctp_input.c Mon Feb 7 07:52:53 2011 (r218391) +++ head/sys/netinet/sctp_input.c Mon Feb 7 08:10:29 2011 (r218392) @@ -2617,6 +2617,7 @@ sctp_handle_cookie_echo(struct mbuf *m, } if ((*netp != NULL) && (m->m_flags & M_FLOWID)) { (*netp)->flowid = m->m_pkthdr.flowid; + (*netp)->flowidset = 1; } /* * Ok, we built an association so confirm the address we sent the @@ -5845,6 +5846,7 @@ sctp_skip_csum_4: } if ((net != NULL) && (m->m_flags & M_FLOWID)) { net->flowid = m->m_pkthdr.flowid; + net->flowidset = 1; } /* inp's ref-count increased && stcb locked */ if (inp == NULL) { Modified: head/sys/netinet/sctp_pcb.c == --- head/sys/netinet/sctp_pcb.c Mon Feb 7 07:52:53 2011(r218391) +++ head/sys/netinet/sctp_pcb.c Mon Feb 7 08:10:29 2011(r218392) @@ -4039,6 +4039,7 @@ sctp_add_remote_addr(struct sctp_tcb *st net->flowid = stcb->asoc.my_vtag ^ ntohs(stcb->rport) ^ ntohs(stcb->sctp_ep->sctp_lport); + net->flowidset = 1; return (0); } @@ -5602,7 +5603,6 @@ sctp_startup_mcore_threads(void) #endif - void sctp_pcb_init() { @@ -5750,7 +5750,6 @@ sctp_pcb_init() * add the VRF's as addresses are added. */ sctp_init_vrf_list(SCTP_DEFAULT_VRF); - } /* Modified: head/sys/netinet/sctp_structs.h == --- head/sys/netinet/sctp_structs.h Mon Feb 7 07:52:53 2011 (r218391) +++ head/sys/netinet/sctp_structs.h Mon Feb 7 08:10:29 2011 (r218392) @@ -351,6 +351,7 @@ struct sctp_nets { /* JRS - struct used in HTCP algorithm */ struct htcp htcp_ca; uint32_t flowid; + uint8_t flowidset; }; ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"