Skip to contentSkip to conversation

virtio_net: support rx/tx queue reset

bug report Dan Carpenter 2 participants 2 messages Mar 10, 2022 virtio core

lore
Share & tools
lore
#0 lore raw

Hello Xuan Zhuo,

The patch 26ae35c46f93: "virtio_net: support rx/tx queue reset" from Mar 8, 2022, leads to the following Smatch static checker warning:

	drivers/net/virtio_net.c:1410 virtnet_napi_tx_disable()
	warn: sleeping in atomic context

drivers/net/virtio_net.c
1829 static int virtnet_tx_vq_reset(struct virtnet_info *vi,
1830 struct send_queue *sq, u32 ring_num)
1831 {
1832 struct netdev_queue *txq;
1833 int err, qindex;
1834
1835 qindex = sq - vi->sq;
1836
1837 txq = netdev_get_tx_queue(vi->dev, qindex);

  1838                __netif_tx_lock_bh(txq);
                      ^^^^^^^^^^^^^^^^^^^^^^^

Disables preempt

1839

  1840                /* stop tx queue and napi */
  1841                netif_stop_subqueue(vi->dev, qindex);
  1842                virtnet_napi_tx_disable(&sq->napi);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

napi_disable() is a might_sleep() function.

  1843
  1844                __netif_tx_unlock_bh(txq);
  1845
  1846                /* reset the queue */
  1847                err = virtio_reset_vq(sq->vq);
  1848                if (err) {
  1849                        netif_start_subqueue(vi->dev, qindex);
  1850                        goto err;
  1851                }

regards,
dan carpenter
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

reviewer
#1 lore raw
Quoted 4 lines · Dan Carpenter

Hello Xuan Zhuo,

The patch 26ae35c46f93: "virtio_net: support rx/tx queue reset" from Mar 8, 2022, leads to the following Smatch static checker warning:

Yes, thanks to you, I also found this problem today.

Quoted 35 lines
	drivers/net/virtio_net.c:1410 virtnet_napi_tx_disable()
	warn: sleeping in atomic context

drivers/net/virtio_net.c
1829 static int virtnet_tx_vq_reset(struct virtnet_info *vi,
1830 struct send_queue *sq, u32 ring_num)
1831 {
1832 struct netdev_queue *txq;
1833 int err, qindex;
1834
1835 qindex = sq - vi->sq;
1836
1837 txq = netdev_get_tx_queue(vi->dev, qindex);

  1838                __netif_tx_lock_bh(txq);
                      ^^^^^^^^^^^^^^^^^^^^^^^

Disables preempt

1839

  1840                /* stop tx queue and napi */
  1841                netif_stop_subqueue(vi->dev, qindex);
  1842                virtnet_napi_tx_disable(&sq->napi);
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

napi_disable() is a might_sleep() function.

  1843
  1844                __netif_tx_unlock_bh(txq);
  1845
  1846                /* reset the queue */
  1847                err = virtio_reset_vq(sq->vq);
  1848                if (err) {
  1849                        netif_start_subqueue(vi->dev, qindex);
  1850                        goto err;
  1851                }
Quoted 2 lines

regards,
dan carpenter

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization