From: "Michael S. Tsirkin" <mst@redhat.com>
To: "Nambiar, Amritha" <amritha.nambiar@intel.com>
Cc: Andrei Vagin <avagin@virtuozzo.com>,
netdev@vger.kernel.org, davem@davemloft.net,
alexander.h.duyck@intel.com, willemdebruijn.kernel@gmail.com,
sridhar.samudrala@intel.com, alexander.duyck@gmail.com,
edumazet@google.com, hannes@stressinduktion.org,
tom@herbertland.com, tom@quantonium.net, jasowang@redhat.com,
gaowanlong@cn.fujitsu.com,
virtualization@lists.linux-foundation.org, rostedt@goodmis.org
Subject: Re: [net-next, v6, 6/7] net-sysfs: Add interface for Rx queue(s) map per Tx queue
Date: Fri, 3 Aug 2018 00:08:05 +0300 [thread overview]
Message-ID: <20180803000725-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <c3fbd7f6-054b-a9a3-ea21-4169b26a0a41@intel.com>
On Thu, Aug 02, 2018 at 02:04:12PM -0700, Nambiar, Amritha wrote:
> On 8/1/2018 5:11 PM, Andrei Vagin wrote:
> > On Tue, Jul 10, 2018 at 07:28:49PM -0700, Nambiar, Amritha wrote:
> >> With this patch series, I introduced static_key for XPS maps
> >> (xps_needed), so static_key_slow_inc() is used to switch branches. The
> >> definition of static_key_slow_inc() has cpus_read_lock in place. In the
> >> virtio_net driver, XPS queues are initialized after setting the
> >> queue:cpu affinity in virtnet_set_affinity() which is already protected
> >> within cpus_read_lock. Hence, the warning here trying to acquire
> >> cpus_read_lock when it is already held.
> >>
> >> A quick fix for this would be to just extract netif_set_xps_queue() out
> >> of the lock by simply wrapping it with another put/get_online_cpus
> >> (unlock right before and hold lock right after).
> >
> > virtnet_set_affinity() is called from virtnet_cpu_online(), which is
> > called under cpus_read_lock too.
> >
> > It looks like now we can't call netif_set_xps_queue() from cpu hotplug
> > callbacks.
> >
> > I can suggest a very straightforward fix for this problem. The patch is
> > attached.
> >
>
> Thanks for looking into this. I was thinking of fixing this in the
> virtio_net driver by moving the XPS initialization (and have a new
> get_affinity utility) in the ndo_open (so it is together with other tx
> preparation) instead of probe. Your patch solves this in general for
> setting up cpu hotplug callbacks which is under cpus_read_lock.
I like this too. Could you repost in a standard way
(inline, with your signoff etc) so we can ack this for
net-next?
> >> But this may not a
> >> clean solution. It'd help if I can get suggestions on what would be a
> >> clean option to fix this without extensively changing the code in
> >> virtio_net. Is it mandatory to protect the affinitization with
> >> read_lock? I don't see similar lock in other drivers while setting the
> >> affinity. I understand this warning should go away, but isn't it safe to
> >> have multiple readers.
> >>
> >>> On Fri, Jun 29, 2018 at 09:27:07PM -0700, Amritha Nambiar wrote:
next prev parent reply other threads:[~2018-08-02 23:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-30 4:26 [net-next PATCH v6 0/7] Symmetric queue selection using XPS for Rx queues Amritha Nambiar
2018-06-30 4:26 ` [net-next PATCH v6 1/7] net: Refactor XPS for CPUs and " Amritha Nambiar
2018-06-30 4:26 ` [net-next PATCH v6 2/7] net: Use static_key for XPS maps Amritha Nambiar
2018-06-30 4:26 ` [net-next PATCH v6 3/7] net: sock: Change tx_queue_mapping in sock_common to unsigned short Amritha Nambiar
2018-06-30 4:26 ` [net-next PATCH v6 4/7] net: Record receive queue number for a connection Amritha Nambiar
2018-06-30 4:27 ` [net-next PATCH v6 5/7] net: Enable Tx queue selection based on Rx queues Amritha Nambiar
2018-06-30 4:27 ` [net-next PATCH v6 6/7] net-sysfs: Add interface for Rx queue(s) map per Tx queue Amritha Nambiar
2018-07-04 7:20 ` [net-next, v6, " Andrei Vagin
2018-07-11 2:28 ` Nambiar, Amritha
2018-07-18 18:22 ` Andrei Vagin
2018-07-18 19:24 ` Stephen Hemminger
2018-07-19 9:16 ` Peter Zijlstra
2018-08-02 0:11 ` Andrei Vagin
2018-08-02 21:04 ` Nambiar, Amritha
2018-08-02 21:08 ` Michael S. Tsirkin [this message]
2018-08-03 19:06 ` Andrei Vagin
2018-08-03 19:12 ` Michael S. Tsirkin
2018-08-03 21:19 ` Andrei Vagin
2018-08-04 4:30 ` Andrei Vagin
2018-08-03 19:12 ` Michael S. Tsirkin
2018-08-02 21:08 ` Michael S. Tsirkin
2018-06-30 4:27 ` [net-next PATCH v6 7/7] Documentation: Add explanation for XPS using Rx-queue(s) map Amritha Nambiar
2018-07-02 0:11 ` [net-next PATCH v6 0/7] Symmetric queue selection using XPS for Rx queues David Miller
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=20180803000725-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=alexander.h.duyck@intel.com \
--cc=amritha.nambiar@intel.com \
--cc=avagin@virtuozzo.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=gaowanlong@cn.fujitsu.com \
--cc=hannes@stressinduktion.org \
--cc=jasowang@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=sridhar.samudrala@intel.com \
--cc=tom@herbertland.com \
--cc=tom@quantonium.net \
--cc=virtualization@lists.linux-foundation.org \
--cc=willemdebruijn.kernel@gmail.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 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.