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: <65aa390533d0529bc2e9ce4e459af1f5a4a04fde.camel@redhat.com>
Date: Fri, 26 Apr 2024 11:47:30 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Daniel Jurgens <danielj@...dia.com>, netdev@...r.kernel.org
Cc: mst@...hat.com, jasowang@...hat.com, xuanzhuo@...ux.alibaba.com, 
	virtualization@...ts.linux.dev, davem@...emloft.net, edumazet@...gle.com, 
	kuba@...nel.org, jiri@...dia.com
Subject: Re: [PATCH net-next v5 5/6] virtio_net: Add a lock for per queue RX
 coalesce

On Tue, 2024-04-23 at 06:57 +0300, Daniel Jurgens wrote:
> Once the RTNL locking around the control buffer is removed there can be
> contention on the per queue RX interrupt coalescing data. Use a mutex
> per queue. A mutex is required because virtnet_send_command can sleep.
> 
> Signed-off-by: Daniel Jurgens <danielj@...dia.com>
> ---
>  drivers/net/virtio_net.c | 53 +++++++++++++++++++++++++++++++---------
>  1 file changed, 41 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index af9048ddc3c1..033e1d6ea31b 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -184,6 +184,9 @@ struct receive_queue {
>  	/* Is dynamic interrupt moderation enabled? */
>  	bool dim_enabled;
>  
> +	/* Used to protect dim_enabled and inter_coal */
> +	struct mutex dim_lock;
> +
>  	/* Dynamic Interrupt Moderation */
>  	struct dim dim;
>  
> @@ -2218,6 +2221,10 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
>  	/* Out of packets? */
>  	if (received < budget) {
>  		napi_complete = virtqueue_napi_complete(napi, rq->vq, received);
> +		/* Intentionally not taking dim_lock here. This could result
> +		 * in a net_dim call with dim now disabled. But virtnet_rx_dim_work
> +		 * will take the lock not update settings if dim is now disabled.

Minor nit: the above comment looks confusing/mangled to me ?!?

		   will take the lock and will not update settings...

Thanks,

Paolo


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ