From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Xin Long <lucien.xin@gmail.com>
Cc: netfilter-devel@vger.kernel.org,
network dev <netdev@vger.kernel.org>,
Florian Westphal <fw@strlen.de>,
Jozsef Kadlecsik <kadlec@netfilter.org>,
davem@davemloft.net, kuba@kernel.org,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>
Subject: Re: [PATCH nf] netfilter: fix using __this_cpu_add in preemptible in nf_flow_table_offload
Date: Mon, 28 Nov 2022 17:20:40 +0100 [thread overview]
Message-ID: <Y4Tf2BaN5DzibJKl@salvia> (raw)
In-Reply-To: <9fc554880eeb0bc9d1749d9577e3aa058eb9f61c.1669312450.git.lucien.xin@gmail.com>
On Thu, Nov 24, 2022 at 12:54:10PM -0500, Xin Long wrote:
> flow_offload_queue_work() can be called in workqueue without
> bh disabled, like the call trace showed in my act_ct testing,
> calling NF_FLOW_TABLE_STAT_INC() there would cause a call
> trace:
>
> BUG: using __this_cpu_add() in preemptible [00000000] code: kworker/u4:0/138560
> caller is flow_offload_queue_work+0xec/0x1b0 [nf_flow_table]
> Workqueue: act_ct_workqueue tcf_ct_flow_table_cleanup_work [act_ct]
> Call Trace:
> <TASK>
> dump_stack_lvl+0x33/0x46
> check_preemption_disabled+0xc3/0xf0
> flow_offload_queue_work+0xec/0x1b0 [nf_flow_table]
> nf_flow_table_iterate+0x138/0x170 [nf_flow_table]
> nf_flow_table_free+0x140/0x1a0 [nf_flow_table]
> tcf_ct_flow_table_cleanup_work+0x2f/0x2b0 [act_ct]
> process_one_work+0x6a3/0x1030
> worker_thread+0x8a/0xdf0
>
> This patch fixes it by using NF_FLOW_TABLE_STAT_INC_ATOMIC()
> instead in flow_offload_queue_work().
>
> Note that for FLOW_CLS_REPLACE branch in flow_offload_queue_work(),
> it may not be called in preemptible path, but it's good to use
> NF_FLOW_TABLE_STAT_INC_ATOMIC() for all cases in
> flow_offload_queue_work().
Applied, thanks
prev parent reply other threads:[~2022-11-28 16:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-24 17:54 [PATCH nf] netfilter: fix using __this_cpu_add in preemptible in nf_flow_table_offload Xin Long
2022-11-28 16:20 ` Pablo Neira Ayuso [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y4Tf2BaN5DzibJKl@salvia \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=lucien.xin@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox