From owner-svn-src-head@freebsd.org Thu Jan 23 01:49:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D94F227534; Thu, 23 Jan 2020 01:49:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4834vR1pyjz3Mst; Thu, 23 Jan 2020 01:49:23 +0000 (UTC) (envelope-from glebius@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 1F7CF709F; Thu, 23 Jan 2020 01:49:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00N1nNo2042383; Thu, 23 Jan 2020 01:49:23 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00N1nNwn042382; Thu, 23 Jan 2020 01:49:23 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202001230149.00N1nNwn042382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 23 Jan 2020 01:49:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357013 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 357013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jan 2020 01:49:23 -0000 Author: glebius Date: Thu Jan 23 01:49:22 2020 New Revision: 357013 URL: https://svnweb.freebsd.org/changeset/base/357013 Log: Since now drivers that support pfil run their interrupts in the network epoch, stop entering it in pfil_run_hooks(). Assert the epoch there. Modified: head/sys/net/pfil.c Modified: head/sys/net/pfil.c ============================================================================== --- head/sys/net/pfil.c Thu Jan 23 01:47:43 2020 (r357012) +++ head/sys/net/pfil.c Thu Jan 23 01:49:22 2020 (r357013) @@ -69,10 +69,6 @@ MTX_SYSINIT(pfil_mtxinit, &pfil_lock, "pfil(9) lock", #define PFIL_UNLOCK() mtx_unlock(&pfil_lock) #define PFIL_LOCK_ASSERT() mtx_assert(&pfil_lock, MA_OWNED) -#define PFIL_EPOCH net_epoch_preempt -#define PFIL_EPOCH_ENTER(et) epoch_enter_preempt(net_epoch_preempt, &(et)) -#define PFIL_EPOCH_EXIT(et) epoch_exit_preempt(net_epoch_preempt, &(et)) - struct pfil_hook { pfil_func_t hook_func; void *hook_ruleset; @@ -168,12 +164,13 @@ int pfil_run_hooks(struct pfil_head *head, pfil_packet_t p, struct ifnet *ifp, int flags, struct inpcb *inp) { - struct epoch_tracker et; pfil_chain_t *pch; struct pfil_link *link; pfil_return_t rv; bool realloc = false; + NET_EPOCH_ASSERT(); + if (PFIL_DIR(flags) == PFIL_IN) pch = &head->head_in; else if (__predict_true(PFIL_DIR(flags) == PFIL_OUT)) @@ -182,7 +179,6 @@ pfil_run_hooks(struct pfil_head *head, pfil_packet_t p panic("%s: bogus flags %d", __func__, flags); rv = PFIL_PASS; - PFIL_EPOCH_ENTER(et); CK_STAILQ_FOREACH(link, pch, link_chain) { if ((flags & PFIL_MEMPTR) && !(link->link_flags & PFIL_MEMPTR)) rv = pfil_fake_mbuf(link->link_func, &p, ifp, flags, @@ -197,7 +193,6 @@ pfil_run_hooks(struct pfil_head *head, pfil_packet_t p realloc = true; } } - PFIL_EPOCH_EXIT(et); if (realloc && rv == PFIL_PASS) rv = PFIL_REALLOCED; return (rv); @@ -313,9 +308,9 @@ pfil_unlink(struct pfil_link_args *pa, pfil_head_t hea PFIL_UNLOCK(); if (in != NULL) - epoch_call(PFIL_EPOCH, pfil_link_free, &in->link_epoch_ctx); + NET_EPOCH_CALL(pfil_link_free, &in->link_epoch_ctx); if (out != NULL) - epoch_call(PFIL_EPOCH, pfil_link_free, &out->link_epoch_ctx); + NET_EPOCH_CALL(pfil_link_free, &out->link_epoch_ctx); if (in == NULL && out == NULL) return (ENOENT); @@ -443,15 +438,13 @@ retry: if (in != NULL) { head->head_nhooksin--; hook->hook_links--; - epoch_call(PFIL_EPOCH, pfil_link_free, - &in->link_epoch_ctx); + NET_EPOCH_CALL(pfil_link_free, &in->link_epoch_ctx); } out = pfil_link_remove(&head->head_out, hook); if (out != NULL) { head->head_nhooksout--; hook->hook_links--; - epoch_call(PFIL_EPOCH, pfil_link_free, - &out->link_epoch_ctx); + NET_EPOCH_CALL(pfil_link_free, &out->link_epoch_ctx); } if (in != NULL || out != NULL) /* What if some stupid admin put same filter twice? */