All of lore.kernel.org
 help / color / mirror / Atom feed
From: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
To: Jason Wang <jasowang@redhat.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: netdev@vger.kernel.org, Willem de Bruijn <willemb@google.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH net 2/7] virtio_net: Don't call free_old_xmit_skbs for xdp_frames
Date: Fri, 18 Jan 2019 10:44:00 +0900	[thread overview]
Message-ID: <8b097123-5e10-69dd-a638-65e4dc6d7882__4998.86894035644$1547811558$gmane$org@lab.ntt.co.jp> (raw)
In-Reply-To: <7c8955f5-cd38-c26f-9932-0aa0be573b4e@redhat.com>

On 2019/01/17 21:39, Jason Wang wrote:
> On 2019/1/17 下午7:20, Toshiaki Makita wrote:
>> When napi_tx is enabled, virtnet_poll_cleantx() called
>> free_old_xmit_skbs() even for xdp send queue.
>> This is bogus since the queue has xdp_frames, not sk_buffs, thus mangled
>> device tx bytes counters because skb->len is meaningless value, and even
>> triggered oops due to general protection fault on freeing them.
>>
>> Since xdp send queues do not aquire locks, old xdp_frames should be
>> freed only in virtnet_xdp_xmit(), so just skip free_old_xmit_skbs() for
>> xdp send queues.
>>
>> Similarly virtnet_poll_tx() called free_old_xmit_skbs(). This NAPI
>> handler is called even without calling start_xmit() because cb for tx is
>> by default enabled. Once the handler is called, it enabled the cb again,
>> and then the handler would be called again. We don't need this handler
>> for XDP, so don't enable cb as well as not calling free_old_xmit_skbs().
>>
>> Also, we need to disable tx NAPI when disabling XDP, so
>> virtnet_poll_tx() can safely access curr_queue_pairs and
>> xdp_queue_pairs, which are not atomically updated while disabling XDP.
> 
> 
> I suggest to split this into another patch or squash this part to patch 1.

This part is for invocation of is_xdp_raw_buffer_queue() from
virtnet_poll_tx(), which is added in this patch, so I'm thinking it's
more natural to keep this hunk in this patch.

-- 
Toshiaki Makita

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2019-01-18  1:44 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 11:20 [PATCH net 0/7] virtio_net: Fix problems around XDP tx and napi_tx Toshiaki Makita
2019-01-17 11:20 ` [PATCH net 1/7] virtio_net: Don't enable NAPI when interface is down Toshiaki Makita
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 12:38   ` Jason Wang
2019-01-17 12:38   ` Jason Wang
2019-01-17 11:20 ` [PATCH net 2/7] virtio_net: Don't call free_old_xmit_skbs for xdp_frames Toshiaki Makita
2019-01-17 12:39   ` Jason Wang
2019-01-17 12:39   ` Jason Wang
2019-01-18  1:44     ` Toshiaki Makita [this message]
2019-01-18  1:44     ` Toshiaki Makita
2019-01-18  3:50       ` Jason Wang
2019-01-18  3:50       ` Jason Wang
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 11:20 ` [PATCH net 3/7] virtio_net: Fix not restoring real_num_rx_queues Toshiaki Makita
2019-01-17 12:39   ` Jason Wang
2019-01-17 12:39   ` Jason Wang
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 11:20 ` [PATCH net 4/7] virtio_net: Fix out of bounds access of sq Toshiaki Makita
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 12:42   ` Jason Wang
2019-01-17 12:42   ` Jason Wang
2019-01-17 11:20 ` [PATCH net 5/7] virtio_net: Don't process redirected XDP frames when XDP is disabled Toshiaki Makita
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 12:53   ` Jason Wang
2019-01-17 12:53   ` Jason Wang
2019-01-17 13:05     ` Jason Wang
2019-01-18  1:56       ` Toshiaki Makita
2019-01-18  3:52         ` Jason Wang
2019-01-18  4:02           ` Toshiaki Makita
2019-01-18  4:02           ` Toshiaki Makita
2019-01-18  3:52         ` Jason Wang
2019-01-18  1:56       ` Toshiaki Makita
2019-01-17 13:05     ` Jason Wang
2019-01-17 11:20 ` [PATCH net 6/7] virtio_net: Use xdp_return_frame to free xdp_frames on destroying vqs Toshiaki Makita
2019-01-17 12:56   ` Jason Wang
2019-01-17 13:39     ` Jesper Dangaard Brouer
2019-01-17 13:39     ` Jesper Dangaard Brouer
2019-01-17 12:56   ` Jason Wang
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 11:20 ` [PATCH net 7/7] virtio_net: Differentiate sk_buff and xdp_frame on freeing Toshiaki Makita
2019-01-17 13:04   ` Jason Wang
2019-01-17 13:04   ` Jason Wang
2019-01-17 11:20 ` Toshiaki Makita
2019-01-17 14:55 ` [PATCH net 0/7] virtio_net: Fix problems around XDP tx and napi_tx Michael S. Tsirkin
2019-01-17 14:55 ` Michael S. Tsirkin
2019-01-18  2:01   ` Toshiaki Makita
2019-01-18  2:01   ` Toshiaki Makita

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='8b097123-5e10-69dd-a638-65e4dc6d7882__4998.86894035644$1547811558$gmane$org@lab.ntt.co.jp' \
    --to=makita.toshiaki@lab.ntt.co.jp \
    --cc=davem@davemloft.net \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=willemb@google.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.