From owner-svn-src-all@freebsd.org Wed May 23 17:00:07 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76151F2D455; Wed, 23 May 2018 17:00:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 253F474015; Wed, 23 May 2018 17:00:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0650D25811; Wed, 23 May 2018 17:00:07 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4NH065o047403; Wed, 23 May 2018 17:00:06 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4NH05hs047395; Wed, 23 May 2018 17:00:05 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805231700.w4NH05hs047395@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Wed, 23 May 2018 17:00:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334104 - in head/sys: netinet sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head/sys: netinet sys X-SVN-Commit-Revision: 334104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 May 2018 17:00:07 -0000 Author: mmacy Date: Wed May 23 17:00:05 2018 New Revision: 334104 URL: https://svnweb.freebsd.org/changeset/base/334104 Log: epoch: allow for conditionally asserting that the epoch context fields are unused by zeroing on INVARIANTS builds Modified: head/sys/netinet/ip_divert.c head/sys/netinet/raw_ip.c head/sys/netinet/tcp_subr.c head/sys/netinet/udp_usrreq.c head/sys/sys/epoch.h Modified: head/sys/netinet/ip_divert.c ============================================================================== --- head/sys/netinet/ip_divert.c Wed May 23 16:31:46 2018 (r334103) +++ head/sys/netinet/ip_divert.c Wed May 23 17:00:05 2018 (r334104) @@ -670,7 +670,7 @@ div_pcblist(SYSCTL_HANDLER_ARGS) if (error) return error; - il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_WAITOK|M_ZERO); + il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_EPOCH_CALL_WAITOK); inp_list = il->il_inp_list; INP_INFO_RLOCK(&V_divcbinfo); Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed May 23 16:31:46 2018 (r334103) +++ head/sys/netinet/raw_ip.c Wed May 23 17:00:05 2018 (r334104) @@ -1056,7 +1056,7 @@ rip_pcblist(SYSCTL_HANDLER_ARGS) if (error) return (error); - il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_WAITOK|M_ZERO); + il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_EPOCH_CALL_WAITOK); inp_list = il->il_inp_list; INP_INFO_RLOCK(&V_ripcbinfo); Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed May 23 16:31:46 2018 (r334103) +++ head/sys/netinet/tcp_subr.c Wed May 23 17:00:05 2018 (r334104) @@ -2151,7 +2151,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) if (error) return (error); - il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_WAITOK|M_ZERO); + il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_EPOCH_CALL_WAITOK); inp_list = il->il_inp_list; INP_INFO_WLOCK(&V_tcbinfo); Modified: head/sys/netinet/udp_usrreq.c ============================================================================== --- head/sys/netinet/udp_usrreq.c Wed May 23 16:31:46 2018 (r334103) +++ head/sys/netinet/udp_usrreq.c Wed May 23 17:00:05 2018 (r334104) @@ -874,7 +874,7 @@ udp_pcblist(SYSCTL_HANDLER_ARGS) error = SYSCTL_OUT(req, &xig, sizeof xig); if (error) return (error); - il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_WAITOK|M_ZERO); + il = malloc(sizeof(struct in_pcblist) + n * sizeof(struct inpcb *), M_TEMP, M_EPOCH_CALL_WAITOK); inp_list = il->il_inp_list; INP_INFO_RLOCK(&V_udbinfo); Modified: head/sys/sys/epoch.h ============================================================================== --- head/sys/sys/epoch.h Wed May 23 16:31:46 2018 (r334103) +++ head/sys/sys/epoch.h Wed May 23 17:00:05 2018 (r334104) @@ -64,6 +64,14 @@ int in_epoch(void); DPCPU_DECLARE(int, epoch_cb_count); DPCPU_DECLARE(struct grouptask, epoch_cb_task); +#ifdef INVARIANTS +#define M_EPOCH_CALL_NOWAIT (M_NOWAIT|M_ZERO) +#define M_EPOCH_CALL_WAITOK (M_WAITOK|M_ZERO) +#else +#define M_EPOCH_CALL_NOWAIT M_NOWAIT +#define M_EPOCH_CALL_WAITOK M_WAITOK +#endif + static __inline void epoch_enter_preempt(epoch_t epoch) {