All of lore.kernel.org
 help / color / mirror / Atom feed
From: Parav Pandit via Virtualization <virtualization@lists.linux-foundation.org>
To: Eli Cohen <elic@nvidia.com>, "mst@redhat.com" <mst@redhat.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Cc: "lvivier@redhat.com" <lvivier@redhat.com>,
	"eperezma@redhat.com" <eperezma@redhat.com>,
	"si-wei.liu@oracle.com" <si-wei.liu@oracle.com>
Subject: RE: [PATH v1 2/2] vdpa/mlx5: Add support for reading descriptor statistics
Date: Thu, 25 Nov 2021 05:50:34 +0000	[thread overview]
Message-ID: <PH0PR12MB5481AE5B7549BD57A9263B52DC629@PH0PR12MB5481.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20211124165531.42624-3-elic@nvidia.com>


> From: Eli Cohen <elic@nvidia.com>
> Sent: Wednesday, November 24, 2021 10:26 PM
> Implement the get_vq_stats calback of vdpa_config_ops to return the statistics
> for a virtqueue.
> 
> Signed-off-by: Eli Cohen <elic@nvidia.com>
> ---
> V0 -> V1:
> Use mutex to sync stats query with change of number of queues
> 
>  drivers/vdpa/mlx5/net/mlx5_vnet.c  | 143 +++++++++++++++++++++++++++++
>  include/linux/mlx5/mlx5_ifc.h      |   1 +
>  include/linux/mlx5/mlx5_ifc_vdpa.h |  39 ++++++++
>  3 files changed, 183 insertions(+)
> 
> diff --git a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> index 9b7d8c721354..465e832f2ad1 100644
> --- a/drivers/vdpa/mlx5/net/mlx5_vnet.c
> +++ b/drivers/vdpa/mlx5/net/mlx5_vnet.c
> @@ -119,6 +119,7 @@ struct mlx5_vdpa_virtqueue {
>  	struct mlx5_vdpa_umem umem2;
>  	struct mlx5_vdpa_umem umem3;
> 
> +	u32 counter_set_id;
>  	bool initialized;
>  	int index;
>  	u32 virtq_id;
> @@ -164,6 +165,8 @@ struct mlx5_vdpa_net {
>  	u32 cur_num_vqs;
>  	struct notifier_block nb;
>  	struct vdpa_callback config_cb;
> +	/* sync access to virtqueues statistics */
> +	struct mutex numq_lock;
It is better to use rw_semaphore, than mutex. 
So get_stats do down/up_read() and change_num_qps() do down/up_write().
This helps to better annotate stats getter is only a reader and handle_ctrl_mq() is updater.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  parent reply	other threads:[~2021-11-25  5:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20211124165531.42624-1-elic@nvidia.com>
     [not found] ` <20211124165531.42624-2-elic@nvidia.com>
2021-11-25  4:50   ` [PATH v1 1/2] vdpa: Add support for querying vendor statistics Jason Wang
2021-11-30  4:09     ` Parav Pandit via Virtualization
2021-11-25  5:34   ` Parav Pandit via Virtualization
     [not found]     ` <20211125080701.GF214101@mtl-vdi-166.wap.labs.mlnx>
2021-11-25 18:31       ` Parav Pandit via Virtualization
     [not found] ` <20211124165531.42624-3-elic@nvidia.com>
2021-11-25  4:57   ` [PATH v1 2/2] vdpa/mlx5: Add support for reading descriptor statistics Jason Wang
     [not found]     ` <20211125075923.GD214101@mtl-vdi-166.wap.labs.mlnx>
2021-11-26  4:24       ` Jason Wang
2021-11-25  5:50   ` Parav Pandit via Virtualization [this message]
2021-12-08 20:30 ` [PATH v1 0/2] Support reading vendor statistics through iproute2/vdpa tool Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PH0PR12MB5481AE5B7549BD57A9263B52DC629@PH0PR12MB5481.namprd12.prod.outlook.com \
    --to=virtualization@lists.linux-foundation.org \
    --cc=elic@nvidia.com \
    --cc=eperezma@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=parav@nvidia.com \
    --cc=si-wei.liu@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.