lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250424080749-mutt-send-email-mst@kernel.org>
Date: Thu, 24 Apr 2025 08:11:03 -0400
From: "Michael S. Tsirkin" <mst@...hat.com>
To: Paolo Abeni <pabeni@...hat.com>
Cc: Jon Kohler <jon@...anix.com>, Jason Wang <jasowang@...hat.com>,
	Eugenio Pérez <eperezma@...hat.com>,
	kvm@...r.kernel.org, virtualization@...ts.linux.dev,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v2] vhost/net: Defer TX queue re-enable until
 after sendmsg

On Thu, Apr 24, 2025 at 01:48:53PM +0200, Paolo Abeni wrote:
> On 4/20/25 3:05 AM, Jon Kohler wrote:
> > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
> > index b9b9e9d40951..9b04025eea66 100644
> > --- a/drivers/vhost/net.c
> > +++ b/drivers/vhost/net.c
> > @@ -769,13 +769,17 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock)
> >  			break;
> >  		/* Nothing new?  Wait for eventfd to tell us they refilled. */
> >  		if (head == vq->num) {
> > +			/* If interrupted while doing busy polling, requeue
> > +			 * the handler to be fair handle_rx as well as other
> > +			 * tasks waiting on cpu
> > +			 */
> >  			if (unlikely(busyloop_intr)) {
> >  				vhost_poll_queue(&vq->poll);
> > -			} else if (unlikely(vhost_enable_notify(&net->dev,
> > -								vq))) {
> > -				vhost_disable_notify(&net->dev, vq);
> > -				continue;
> >  			}
> > +			/* Kicks are disabled at this point, break loop and
> > +			 * process any remaining batched packets. Queue will
> > +			 * be re-enabled afterwards.
> > +			 */
> >  			break;
> >  		}
> 
> It's not clear to me why the zerocopy path does not need a similar change.

It can have one, it's just that Jon has a separate patch to drop
it completely. A commit log comment mentioning this would be a good
idea, yes.

> > @@ -825,7 +829,14 @@ static void handle_tx_copy(struct vhost_net *net, struct socket *sock)
> >  		++nvq->done_idx;
> >  	} while (likely(!vhost_exceeds_weight(vq, ++sent_pkts, total_len)));
> >  
> > +	/* Kicks are still disabled, dispatch any remaining batched msgs. */
> >  	vhost_tx_batch(net, nvq, sock, &msg);
> > +
> > +	/* All of our work has been completed; however, before leaving the
> > +	 * TX handler, do one last check for work, and requeue handler if
> > +	 * necessary. If there is no work, queue will be reenabled.
> > +	 */
> > +	vhost_net_busy_poll_try_queue(net, vq);
> 
> This will call vhost_poll_queue() regardless of the 'busyloop_intr' flag
> value, while AFAICS prior to this patch vhost_poll_queue() is only
> performed with busyloop_intr == true. Why don't we need to take care of
> such flag here?

Hmm I agree this is worth trying, a free if possibly small performance
gain, why not. Jon want to try?


> @Michael: I assume you prefer that this patch will go through the
> net-next tree, right?
> 
> Thanks,
> 
> Paolo

I don't mind and this seems to be what Jon wants.
I could queue it too, but extra review  it gets in the net tree is good.

-- 
MST


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ