From: Guillaume Nault <gnault@redhat.com>
To: Pravin Shelar <pshelar@ovn.org>
Cc: Linux Kernel Network Developers <netdev@vger.kernel.org>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
Alexei Starovoitov <ast@plumgrid.com>,
Jesse Gross <jesse@nicira.com>,
Pravin B Shelar <pshelar@nicira.com>,
Jiri Benc <jbenc@redhat.com>
Subject: Re: [RFC PATCH net] netns: fix GFP flags in rtnl_net_notifyid()
Date: Mon, 14 Oct 2019 00:22:31 +0200 [thread overview]
Message-ID: <20191013222231.GA4647@linux.home> (raw)
In-Reply-To: <CAOrHB_Dfoy3hiVVWu7+4fgm_U+rcB_CPuRV58XqB7kKOBcGb1w@mail.gmail.com>
On Sun, Oct 13, 2019 at 12:09:43PM -0700, Pravin Shelar wrote:
> On Thu, Oct 10, 2019 at 12:07 PM Guillaume Nault <gnault@redhat.com> wrote:
> >
> > In rtnl_net_notifyid(), we certainly can't pass a null GFP flag to
> > rtnl_notify(). A GFP_KERNEL flag would be fine in most circumstances,
> > but there are a few paths calling rtnl_net_notifyid() from atomic
> > context or from RCU critical section. The later also precludes the use
> > of gfp_any() as it wouldn't detect the RCU case. Also, the nlmsg_new()
> > call is wrong too, as it uses GFP_KERNEL unconditionally.
> >
> > Therefore, we need to pass the GFP flags as parameter. The problem then
> > propagates recursively to the callers until the proper flags can be
> > determined. The problematic call chains are:
> >
> > * ovs_vport_cmd_fill_info -> peernet2id_alloc -> rtnl_net_notifyid
> >
> > * rtnl_fill_ifinfo -> rtnl_fill_link_netnsid -> peernet2id_alloc
> > -> rtnl_net_notifyid
> >
> > For openvswitch, ovs_vport_cmd_get() and ovs_vport_cmd_dump() prevent
> > ovs_vport_cmd_fill_info() from using GFP_KERNEL. It'd be nice to move
> > the call out of the RCU critical sections, but struct vport doesn't
> > have a reference counter, so that'd probably require taking the ovs
> > lock. Also, I don't get why ovs_vport_cmd_build_info() used GFP_ATOMIC
> > in nlmsg_new(). I've changed it to GFP_KERNEL for consistency, as this
> > functions seems to be allowed to sleep (as stated in the comment, it's
> > called from a workqueue, under the protection of a mutex).
> >
> It is safe to change GFP flags to GFP_KERNEL in ovs_vport_cmd_build_info().
> The patch looks good to me.
>
Thanks for your feedback.
The point of my RFC is to know if it's possible to avoid all these
gfp_t flags, by allowing ovs_vport_cmd_fill_info() to sleep (at least
I'd like to figure out if it's worth spending time investigating this
path).
To do so, we'd requires moving the ovs_vport_cmd_fill_info() call of
ovs_vport_cmd_{get,dump}() out of RCU critical section. Since we have
no reference counter, I believe we'd have to protect these calls with
ovs_lock() instead of RCU. Is that acceptable? If not, is there any
other way?
next prev parent reply other threads:[~2019-10-13 22:22 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 19:07 [RFC PATCH net] netns: fix GFP flags in rtnl_net_notifyid() Guillaume Nault
2019-10-13 17:29 ` David Miller
2019-10-13 19:09 ` Pravin Shelar
2019-10-13 22:22 ` Guillaume Nault [this message]
2019-10-18 20:55 ` Pravin Shelar
2019-10-18 23:29 ` Guillaume Nault
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=20191013222231.GA4647@linux.home \
--to=gnault@redhat.com \
--cc=ast@plumgrid.com \
--cc=jbenc@redhat.com \
--cc=jesse@nicira.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pshelar@nicira.com \
--cc=pshelar@ovn.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.