Re: [PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop

2023-07-20 Thread Michael S. Tsirkin
On Thu, Jul 20, 2023 at 01:26:20PM -0700, Shannon Nelson wrote: > On 7/20/23 1:38 AM, Jason Wang wrote: > > > > Adding cond_resched() to the command waiting loop for a better > > co-operation with the scheduler. This allows to give CPU a breath to > > run other task(workqueue) instead of busy loop

Re: [PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop

2023-07-20 Thread Michael S. Tsirkin
On Thu, Jul 20, 2023 at 08:31:13AM -0700, Shannon Nelson wrote: > On 7/20/23 1:38 AM, Jason Wang wrote: > > > > Adding cond_resched() to the command waiting loop for a better > > co-operation with the scheduler. This allows to give CPU a breath to > > run other task(workqueue) instead of busy loop

Re: [PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop

2023-07-20 Thread Shannon Nelson via Virtualization
On 7/20/23 1:38 AM, Jason Wang wrote: Adding cond_resched() to the command waiting loop for a better co-operation with the scheduler. This allows to give CPU a breath to run other task(workqueue) instead of busy looping when preemption is not allowed on a device whose CVQ might be slow. Signed-

Re: [PATCH net-next v4 1/2] virtio-net: convert rx mode setting to use workqueue

2023-07-20 Thread Shannon Nelson via Virtualization
On 7/20/23 1:38 AM, Jason Wang wrote: This patch convert rx mode setting to be done in a workqueue, this is a must for allow to sleep when waiting for the cvq command to response since current code is executed under addr spin lock. Note that we need to disable and flush the workqueue during fre

Re: [PATCH vhost v11 05/10] virtio_ring: introduce virtqueue_dma_dev()

2023-07-20 Thread Michael S. Tsirkin
On Wed, Jul 19, 2023 at 11:22:42PM -0700, Christoph Hellwig wrote: > On Thu, Jul 13, 2023 at 10:51:59AM -0400, Michael S. Tsirkin wrote: > > On Thu, Jul 13, 2023 at 04:15:16AM -0700, Christoph Hellwig wrote: > > > On Mon, Jul 10, 2023 at 11:42:32AM +0800, Xuan Zhuo wrote: > > > > Added virtqueue_dm

Re: [PATCH v1] virtio-pci: Fix legacy device flag setting error in probe

2023-07-20 Thread Michael S. Tsirkin
On Thu, Jul 20, 2023 at 10:27:04AM +0800, Jason Wang wrote: > On Wed, Jul 19, 2023 at 11:46 PM Feng Liu wrote: > > > > The 'is_legacy' flag is used to differentiate between legacy vs modern > > device. Currently, it is based on the value of vp_dev->ldev.ioaddr. > > However, due to the shared memor

Re: [PATCH v1] virtio-pci: Fix legacy device flag setting error in probe

2023-07-20 Thread Feng Liu via Virtualization
On 2023-07-19 p.m.10:27, Jason Wang wrote: External email: Use caution opening links or attachments On Wed, Jul 19, 2023 at 11:46 PM Feng Liu wrote: The 'is_legacy' flag is used to differentiate between legacy vs modern device. Currently, it is based on the value of vp_dev->ldev.ioaddr. Ho

Re: [PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop

2023-07-20 Thread Shannon Nelson via Virtualization
On 7/20/23 1:38 AM, Jason Wang wrote: Adding cond_resched() to the command waiting loop for a better co-operation with the scheduler. This allows to give CPU a breath to run other task(workqueue) instead of busy looping when preemption is not allowed on a device whose CVQ might be slow. Signed-

Re: [PATCH v11 8/8] vhost: use vhost_tasks for worker threads

2023-07-20 Thread Michael S. Tsirkin
On Thu, Feb 02, 2023 at 05:25:17PM -0600, Mike Christie wrote: > For vhost workers we use the kthread API which inherit's its values from > and checks against the kthreadd thread. This results in the wrong RLIMITs > being checked, so while tools like libvirt try to control the number of > threads b

[PATCH net-next v4 2/2] virtio-net: add cond_resched() to the command waiting loop

2023-07-20 Thread Jason Wang
Adding cond_resched() to the command waiting loop for a better co-operation with the scheduler. This allows to give CPU a breath to run other task(workqueue) instead of busy looping when preemption is not allowed on a device whose CVQ might be slow. Signed-off-by: Jason Wang --- drivers/net/virt

[PATCH net-next v4 1/2] virtio-net: convert rx mode setting to use workqueue

2023-07-20 Thread Jason Wang
This patch convert rx mode setting to be done in a workqueue, this is a must for allow to sleep when waiting for the cvq command to response since current code is executed under addr spin lock. Note that we need to disable and flush the workqueue during freeze, this means the rx mode setting is lo

[PATCH net-next v4 0/2] virtio-net: don't busy poll for cvq command

2023-07-20 Thread Jason Wang
Hi all: The code used to busy poll for cvq command which turns out to have several side effects: 1) infinite poll for buggy devices 2) bad interaction with scheduler So this series tries to use cond_resched() in the waiting loop. Before doing this we need first make sure the cvq command is not e

Re: [PATCH vhost v11 10/10] virtio_net: merge dma operation for one page

2023-07-20 Thread Christoph Hellwig
On Thu, Jul 20, 2023 at 03:41:56PM +0800, Jason Wang wrote: > > Did you actually check that it works though? > > Looks like with swiotlb you need to synch to trigger a copy > > before unmap, and I don't see where it's done in the current > > patch. > > And this is needed for XDP_REDIRECT as well.

Re: [PATCH vhost v11 10/10] virtio_net: merge dma operation for one page

2023-07-20 Thread Jason Wang
On Thu, Jul 20, 2023 at 2:23 PM Christoph Hellwig wrote: > > Hi Jason, > > can you please resend your reply with proper quoting? I had to give > up after multiple pages of scrolling without finding anything that > you added to the full quote. I guess it's this part? > > > You should also test w

Re: [PATCH vhost v11 05/10] virtio_ring: introduce virtqueue_dma_dev()

2023-07-20 Thread Xuan Zhuo
On Wed, 19 Jul 2023 23:57:51 -0700, Christoph Hellwig wrote: > On Thu, Jul 20, 2023 at 02:45:14PM +0800, Xuan Zhuo wrote: > > virtqueue_dma_dev() return the device that working with the DMA APIs. > > Then that can be used like other devices. So what is the problem. > > > > I always think the c