From: John Fastabend <john.fastabend@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: jasowang@redhat.com, mst@redhat.com, john.r.fastabend@intel.com,
netdev@vger.kernel.org, alexei.starovoitov@gmail.com,
daniel@iogearbox.net
Subject: Re: [net PATCH v4 2/6] virtio_net: wrap rtnl_lock in test for calling with lock already held
Date: Tue, 17 Jan 2017 11:03:20 -0800 [thread overview]
Message-ID: <587E6A78.6020901@gmail.com> (raw)
In-Reply-To: <20170117.115733.428297564258724055.davem@davemloft.net>
On 17-01-17 08:57 AM, David Miller wrote:
> From: John Fastabend <john.fastabend@gmail.com>
> Date: Sun, 15 Jan 2017 15:59:47 -0800
>
>> @@ -2358,7 +2371,10 @@ static void remove_vq_common(struct virtnet_info *vi)
>> /* Free unused buffers in both send and recv, if any. */
>> free_unused_bufs(vi);
>>
>> - free_receive_bufs(vi);
>> + if (rtnl_is_locked())
>> + _free_receive_bufs(vi);
>> + else
>> + free_receive_bufs(vi);
>>
>> free_receive_page_frags(vi);
>>
>
> This doesn't work. rtnl_is_locked() doesn't tell if _you_ own the mutex, it
> just says that someone does.
>
> So if we now execute this code without taking the RTNL lock just because some
> other thread of control holds it, we introduce a race.
>
yeah this bit is junk. dang. Trying to get this locking right without duplicate
code or pushing around lock_me variables is getting tricky.
.John
next prev parent reply other threads:[~2017-01-17 19:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-15 23:59 [net PATCH v4 0/6] virtio_net XDP fixes and adjust_header support John Fastabend
2017-01-15 23:59 ` [net PATCH v4 1/6] virtio_net: use dev_kfree_skb for small buffer XDP receive John Fastabend
2017-01-15 23:59 ` [net PATCH v4 2/6] virtio_net: wrap rtnl_lock in test for calling with lock already held John Fastabend
2017-01-17 16:57 ` David Miller
2017-01-17 19:03 ` John Fastabend [this message]
2017-01-16 0:00 ` [net PATCH v4 3/6] virtio_net: factor out xdp handler for readability John Fastabend
2017-01-16 0:00 ` [net PATCH v4 4/6] virtio_net: remove duplicate queue pair binding in XDP John Fastabend
2017-01-16 0:01 ` [net PATCH v4 5/6] virtio: add pci_down/pci_up configuration John Fastabend
2017-01-16 3:57 ` Jason Wang
2017-01-16 4:04 ` John Fastabend
2017-01-17 18:45 ` John Fastabend
2017-01-16 0:01 ` [net PATCH v4 6/6] virtio_net: XDP support for adjust_head John Fastabend
2017-01-16 5:48 ` Jason Wang
2017-01-16 5:51 ` [net PATCH v4 0/6] virtio_net XDP fixes and adjust_header support Jason Wang
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=587E6A78.6020901@gmail.com \
--to=john.fastabend@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jasowang@redhat.com \
--cc=john.r.fastabend@intel.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.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.