From: duoming@zju.edu.cn
To: "David Ahern" <dsahern@kernel.org>
Cc: linux-kernel@vger.kernel.org, davem@davemloft.net,
yoshfuji@linux-ipv6.org, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org
Subject: Re: [PATCH net] net: Add a gfp_t parameter in ip_fib_metrics_init to support atomic context
Date: Wed, 30 Nov 2022 12:01:41 +0800 (GMT+08:00) [thread overview]
Message-ID: <27dfa798.18d8b.184c6b28dcc.Coremail.duoming@zju.edu.cn> (raw)
In-Reply-To: <a37f9c82-9f25-c5ba-f941-1cedf8c10187@kernel.org>
Hello,
On Tue, 29 Nov 2022 09:33:45 -0700 David Ahern wrote:
> On 11/28/22 10:53 PM, Duoming Zhou wrote:
> > The ip_fib_metrics_init() do not support atomic context, because it
> > calls "kzalloc(..., GFP_KERNEL)". When ip_fib_metrics_init() is used
> > in atomic context, the sleep-in-atomic-context bug will happen.
>
> Did you actually hit this sleep-in-atomic-context bug or is it theory
> based on code analysis?
Thank your for your reply and suggestions. This is based on code analysis.
> > For example, the neigh_proxy_process() is a timer handler that is
> > used to process the proxy request that is timeout. But it could call
> > ip_fib_metrics_init(). As a result, the can_block flag in ipv6_add_addr()
> > and the gfp_flags in addrconf_f6i_alloc() and ip6_route_info_create()
> > are useless. The process is shown below.
> >
> > (atomic context)
> > neigh_proxy_process()
> > pndisc_redo()
> > ndisc_recv_ns()
> > addrconf_dad_failure()
> > ipv6_add_addr(..., bool can_block)
> > addrconf_f6i_alloc(..., gfp_t gfp_flags)
>
> cfg has fc_mx == NULL.
>
> > ip6_route_info_create(..., gfp_t gfp_flags)
>
> rt->fib6_metrics = ip_fib_metrics_init(net, cfg->fc_mx, cfg->fc_mx_len,
> extack);
>
> > ip_fib_metrics_init()
>
> if (!fc_mx)
> return (struct dst_metrics *)&dst_default_metrics;
I understand it, thank your for your advice.
Best regards,
Duoming Zhou
prev parent reply other threads:[~2022-11-30 4:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 5:53 Duoming Zhou
2022-11-29 16:33 ` David Ahern
2022-11-30 4:01 ` duoming [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=27dfa798.18d8b.184c6b28dcc.Coremail.duoming@zju.edu.cn \
--to=duoming@zju.edu.cn \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=yoshfuji@linux-ipv6.org \
/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
all inboxes | Powered by JetHome®