diff mbox series

[2/3] virtio_console: fixup potential cpu stall when free unused bufs

Message ID 20230609131817.712867-3-xianting.tian@linux.alibaba.com (mailing list archive)
State Accepted
Commit 56b5e65efe0001fb5f95e412ee4167363debfc46
Headers show
Series fixup potential cpu stall | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/SubjectPrefix fail "Bluetooth: " prefix is not specified in the subject
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Xianting Tian June 9, 2023, 1:18 p.m. UTC
Cpu stall issue may happen if device is configured with multi queues
and large queue depth, so fix it.

Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
---
 drivers/char/virtio_console.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Michael S. Tsirkin June 9, 2023, 4:05 p.m. UTC | #1
On Fri, Jun 09, 2023 at 09:18:16PM +0800, Xianting Tian wrote:
> Cpu stall issue may happen if device is configured with multi queues
> and large queue depth, so fix it.

"may happen" is ambigous.

So is this: "for virtio-net we were getting
stall on CPU was observed message, this driver is similar
so theoretically the same logic applies"

or is this

"the following error occured: ..... "

?


> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
> ---
>  drivers/char/virtio_console.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
> index b65c809a4e97..5ec4cf4ea919 100644
> --- a/drivers/char/virtio_console.c
> +++ b/drivers/char/virtio_console.c
> @@ -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);
> -- 
> 2.17.1
Xianting Tian June 10, 2023, 3:19 a.m. UTC | #2
在 2023/6/10 上午12:05, Michael S. Tsirkin 写道:
> On Fri, Jun 09, 2023 at 09:18:16PM +0800, Xianting Tian wrote:
>> Cpu stall issue may happen if device is configured with multi queues
>> and large queue depth, so fix it.
> "may happen" is ambigous.
>
> So is this: "for virtio-net we were getting
> stall on CPU was observed message, this driver is similar
> so theoretically the same logic applies"

It is this one

  “this driver is similar so theoretically the same logic applies”

>
> or is this
>
> "the following error occured: ....."
>
> ?
>
>
>> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
>> ---
>>   drivers/char/virtio_console.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
>> index b65c809a4e97..5ec4cf4ea919 100644
>> --- a/drivers/char/virtio_console.c
>> +++ b/drivers/char/virtio_console.c
>> @@ -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);
>> -- 
>> 2.17.1
diff mbox series

Patch

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index b65c809a4e97..5ec4cf4ea919 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -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);