virtio-console: call scheduler when we free unused buffs
authorXianting Tian <xianting.tian@linux.alibaba.com>
Fri, 9 Jun 2023 13:18:16 +0000 (21:18 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 3 Jul 2023 16:15:12 +0000 (12:15 -0400)
For virtio-net we were getting CPU stall warnings, and fixed it by
calling the scheduler: see f8bb51043945 ("virtio_net: suppress cpu stall
when free_unused_bufs").

This driver is similar so theoretically the same logic applies.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
Message-Id: <20230609131817.712867-3-xianting.tian@linux.alibaba.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/char/virtio_console.c

index b65c809a4e978d41ba80bfab5b6fab1c5f9a2b7b..5ec4cf4ea919731c3453e7c4bceb34a39761d85f 100644 (file)
@@ -1935,6 +1935,7 @@ static void remove_vqs(struct ports_device *portdev)
                flush_bufs(vq, true);
                while ((buf = virtqueue_detach_unused_buf(vq)))
                        free_buf(buf, true);
+               cond_resched();
        }
        portdev->vdev->config->del_vqs(portdev->vdev);
        kfree(portdev->in_vqs);