mbox series

[net-next,v4,0/5] virtio_net: enable the irq for ctrlq

Message ID 20240619161908.82348-1-hengqi@linux.alibaba.com (mailing list archive)
Headers show
Series virtio_net: enable the irq for ctrlq | expand

Message

Heng Qi June 19, 2024, 4:19 p.m. UTC
Ctrlq in polling mode may cause the virtual machine to hang and
occupy additional CPU resources. Enabling the irq for ctrlq
alleviates this problem and allows commands to be requested
concurrently.

Changelog
=========
v3->v4:
  - Turn off the switch before flush the get_cvq work.
  - Add interrupt suppression.

v2->v3:
  - Use the completion for dim cmds.

v1->v2:
  - Refactor the patch 1 and rephase the commit log.

Heng Qi (5):
  virtio_net: passing control_buf explicitly
  virtio_net: enable irq for the control vq
  virtio_net: change the command token to completion
  virtio_net: refactor command sending and response handling
  virtio_net: improve dim command request efficiency

 drivers/net/virtio_net.c | 309 ++++++++++++++++++++++++++++++++-------
 1 file changed, 260 insertions(+), 49 deletions(-)

Comments

Michael S. Tsirkin June 19, 2024, 9:16 p.m. UTC | #1
On Thu, Jun 20, 2024 at 12:19:03AM +0800, Heng Qi wrote:
> Ctrlq in polling mode may cause the virtual machine to hang and
> occupy additional CPU resources. Enabling the irq for ctrlq
> alleviates this problem and allows commands to be requested
> concurrently.

Any patch that is supposed to be a performance improvement
has to come with actual before/after testing restults, not
vague "may cause".



> Changelog
> =========
> v3->v4:
>   - Turn off the switch before flush the get_cvq work.
>   - Add interrupt suppression.
> 
> v2->v3:
>   - Use the completion for dim cmds.
> 
> v1->v2:
>   - Refactor the patch 1 and rephase the commit log.
> 
> Heng Qi (5):
>   virtio_net: passing control_buf explicitly
>   virtio_net: enable irq for the control vq
>   virtio_net: change the command token to completion
>   virtio_net: refactor command sending and response handling
>   virtio_net: improve dim command request efficiency
> 
>  drivers/net/virtio_net.c | 309 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 260 insertions(+), 49 deletions(-)
> 
> -- 
> 2.32.0.3.g01195cf9f
Heng Qi June 20, 2024, 7:16 a.m. UTC | #2
On Wed, 19 Jun 2024 17:16:57 -0400, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Thu, Jun 20, 2024 at 12:19:03AM +0800, Heng Qi wrote:
> > Ctrlq in polling mode may cause the virtual machine to hang and
> > occupy additional CPU resources. Enabling the irq for ctrlq
> > alleviates this problem and allows commands to be requested
> > concurrently.
> 
> Any patch that is supposed to be a performance improvement
> has to come with actual before/after testing restults, not
> vague "may cause".

1. If the device does not respond in time, the CPU usage for ctrlq in the polling mode is
   ~100%, and in irq mode is ~0%;
2. If there are concurrent requests, the situation in 1 will be even worse;
3. On 64 queues with dim on, use nginx + wrk with the number of connections is 500:
   a. If ctrlq is in polling mode and concurrent requests are not supported:
      seeing that the dim worker occupies 20%+ CPU usage. Because of the
      large number of queues, dim requests cannot be concurrent, and the
      performance is unstable;
   b. If ctrlq is in irq mode and concurrent requests are supported: the overhead
      of the dim worker is not visible, and the pps increases by ~13%
      compared to a.

Thanks.

> 
> 
> 
> > Changelog
> > =========
> > v3->v4:
> >   - Turn off the switch before flush the get_cvq work.
> >   - Add interrupt suppression.
> > 
> > v2->v3:
> >   - Use the completion for dim cmds.
> > 
> > v1->v2:
> >   - Refactor the patch 1 and rephase the commit log.
> > 
> > Heng Qi (5):
> >   virtio_net: passing control_buf explicitly
> >   virtio_net: enable irq for the control vq
> >   virtio_net: change the command token to completion
> >   virtio_net: refactor command sending and response handling
> >   virtio_net: improve dim command request efficiency
> > 
> >  drivers/net/virtio_net.c | 309 ++++++++++++++++++++++++++++++++-------
> >  1 file changed, 260 insertions(+), 49 deletions(-)
> > 
> > -- 
> > 2.32.0.3.g01195cf9f
>