From nobody Thu Nov 21 18:55:56 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XvS9n2JZnz5dS19; Thu, 21 Nov 2024 18:55:57 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XvS9n0pvyz4d93; Thu, 21 Nov 2024 18:55:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732215357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0nNEnXddVJnMMtX5bh7LNljTiuViIHCIBzqhlg6JjcI=; b=aY2F3EHTjip3gZOYwdyT7JKGyvtuTUkuRM7KyE8NXhwC436g6YlWTrXRbhcdxdBO0NJnPD hEYEV6W/kfch5gI3/iizoxS0St0hjewKzwv2+REyWpdGPVWOkUyM/XhZYu+7kc3FNQCocy hQ03LByZtd+gpDxT7PGFzknPE+GxqvwonBcunVXjCHCqCwiANZjdDQE2vVgaXSQjzuHkP5 WKDOAawvj0nM5M7o29Hr5JJGmp+RkfiVVI00YgUIOFpAVAVYNALHW3hPHqmgx1fyLmUwuJ iLfwTIG/Kb78I6nor926qJZMIgaORFmhPYDAuuBCEcdoY1G534NLH0Z1zuhnmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732215357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0nNEnXddVJnMMtX5bh7LNljTiuViIHCIBzqhlg6JjcI=; b=c8qsRQYW7yJohLsiG2uO46NSZhX4+cXHYW5hI6jlKmX64ET9qG43ydxsg0rYKV8ymR2/+7 xNKJYsc9oKP7tOpp7Xn0LSPxPwh3VUqpgxmbIYTy+mU4Swyz9qzsMPPgyU0AxylJojLETa qdHiE4Z3AcEBqlTLUx+ED5FCXBvCFw5N6QzOgmHvB89csNdJlackkfBevJwuxRrEd98yV0 qFuIzXjqOhNYcB8T64bO0eNEtZlYE0KDC3K+pI7mEGxJiWB2YHyIL3H66Ht+//yR87xl/p N5WpDyCp5+t8b0GT8accwM12SHJJTtSSTLmTUUPVgqx7IXSu4pVrKkIkx4SQRQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732215357; a=rsa-sha256; cv=none; b=UANiddofw7yL4yLPm2rBm0cVgAC4gVhG6REOVwmhKa54v0ZbUSwo8tb+KE0quXUlsnflsy SZCJTQH9Pn48JAAG2NrWmwwBRatRxLd0Hn8x+4JHFR6mFDpw2/hq0RmeYuUcF9fOxuShCe Y6RtTgLLYqu/bkz9eOZDLXFXVEGRNauSkGmdqFjI1x9b3WsKNJU6MUpOiF5Q8lirRV8RCg r+vRQFYQx/V8fUMgka6AETLlJYTHTcs1YQNrUIIMNB7Ieabz0s61Umvz2iPY6S7mrkLobN GWIaLqrCwTPb0F1TFYMrx84vDma1LoE8NEDVEhAiJJfDIV4L5J343Y/j/cQS1g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XvS9m6vH5zrMg; Thu, 21 Nov 2024 18:55:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4ALItu60013228; Thu, 21 Nov 2024 18:55:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4ALItu0W013225; Thu, 21 Nov 2024 18:55:56 GMT (envelope-from git) Date: Thu, 21 Nov 2024 18:55:56 GMT Message-Id: <202411211855.4ALItu0W013225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 46f38a6dedb1 - main - netgraph: Exit the net epoch to handle control messages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 46f38a6dedb1b474f04b7c2b072825fda5d7bd5a Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=46f38a6dedb1b474f04b7c2b072825fda5d7bd5a commit 46f38a6dedb1b474f04b7c2b072825fda5d7bd5a Author: Mark Johnston AuthorDate: 2024-11-21 18:55:35 +0000 Commit: Mark Johnston CommitDate: 2024-11-21 18:55:35 +0000 netgraph: Exit the net epoch to handle control messages In general, in the direct dispatch case netgraph only enters the net epoch to send data messages, but this was inconsistent with the netgraph thread, which also entered the net epoch to send fn and fn2 messages to nodes. Some handlers, e.g., ng_bridge_newhook(), may sleep, and so cannot be called in epoch context; the netgraph tests occasionally panic due to this problem. Make ngthread() consistent with the direct dispatch path. Discussed with: afedorov (in D44615) MFC after: 2 weeks Sponsored by: Klara, Inc. --- sys/netgraph/ng_base.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/ng_base.c b/sys/netgraph/ng_base.c index 5bff0663e03e..77c7cb0d3c00 100644 --- a/sys/netgraph/ng_base.c +++ b/sys/netgraph/ng_base.c @@ -3440,10 +3440,13 @@ ngthread(void *arg) NG_QUEUE_UNLOCK(&node->nd_input_queue); NGI_GET_NODE(item, node); /* zaps stored node */ - if ((item->el_flags & NGQF_TYPE) == NGQF_MESG) { + if ((item->el_flags & NGQF_TYPE) != NGQF_DATA) { /* - * NGQF_MESG items should never be processed in - * NET_EPOCH context. So, temporary exit from EPOCH. + * NGQF_MESG, NGQF_FN and NGQF_FN2 items + * should never be processed in + * NET_EPOCH context; they generally + * require heavier synchronization and + * may sleep. So, temporarily exit. */ NET_EPOCH_EXIT(et); ng_apply_item(node, item, rw);