DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xia, Chenbo" <chenbo.xia@intel.com>
To: Maxime Coquelin <maxime.coquelin@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	"david.marchand@redhat.com" <david.marchand@redhat.com>,
	"i.maximets@ovn.org" <i.maximets@ovn.org>
Subject: RE: [PATCH 4/5] vhost: add statistics for IOTLB
Date: Wed, 11 May 2022 13:56:43 +0000	[thread overview]
Message-ID: <SN6PR11MB350485C492EBAF39B984A1B29CC89@SN6PR11MB3504.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220510201720.1262368-5-maxime.coquelin@redhat.com>

> -----Original Message-----
> From: Maxime Coquelin <maxime.coquelin@redhat.com>
> Sent: Wednesday, May 11, 2022 4:17 AM
> To: dev@dpdk.org; Xia, Chenbo <chenbo.xia@intel.com>;
> david.marchand@redhat.com; i.maximets@ovn.org
> Cc: Maxime Coquelin <maxime.coquelin@redhat.com>
> Subject: [PATCH 4/5] vhost: add statistics for IOTLB
> 
> This patch adds statistics for IOTLB hits and misses.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
> ---
>  lib/vhost/vhost.c | 10 +++++++++-
>  lib/vhost/vhost.h |  2 ++
>  2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
> index fa708c1f9c..721b3a3247 100644
> --- a/lib/vhost/vhost.c
> +++ b/lib/vhost/vhost.c
> @@ -43,6 +43,8 @@ static const struct vhost_vq_stats_name_off
> vhost_vq_stat_strings[] = {
>  	{"size_1024_1518_packets", offsetof(struct vhost_virtqueue,
> stats.size_bins[6])},
>  	{"size_1519_max_packets",  offsetof(struct vhost_virtqueue,
> stats.size_bins[7])},
>  	{"guest_notifications",    offsetof(struct vhost_virtqueue,
> stats.guest_notifications)},
> +	{"iotlb_hits",             offsetof(struct vhost_virtqueue,
> stats.iotlb_hits)},
> +	{"iotlb_misses",           offsetof(struct vhost_virtqueue,
> stats.iotlb_misses)},
>  };
> 
>  #define VHOST_NB_VQ_STATS RTE_DIM(vhost_vq_stat_strings)
> @@ -60,8 +62,14 @@ __vhost_iova_to_vva(struct virtio_net *dev, struct
> vhost_virtqueue *vq,
>  	tmp_size = *size;
> 
>  	vva = vhost_user_iotlb_cache_find(vq, iova, &tmp_size, perm);
> -	if (tmp_size == *size)
> +	if (tmp_size == *size) {
> +		if (dev->flags & VIRTIO_DEV_STATS_ENABLED)
> +			vq->stats.iotlb_hits++;
>  		return vva;
> +	}
> +
> +	if (dev->flags & VIRTIO_DEV_STATS_ENABLED)
> +		vq->stats.iotlb_misses++;
> 
>  	iova += tmp_size;
> 
> diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h
> index 13c5c2266d..872675207e 100644
> --- a/lib/vhost/vhost.h
> +++ b/lib/vhost/vhost.h
> @@ -134,6 +134,8 @@ struct virtqueue_stats {
>  	/* Size bins in array as RFC 2819, undersized [0], 64 [1], etc */
>  	uint64_t size_bins[8];
>  	uint64_t guest_notifications;
> +	uint64_t iotlb_hits;
> +	uint64_t iotlb_misses;
>  };
> 
>  /**
> --
> 2.35.1

Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>

  reply	other threads:[~2022-05-11 13:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10 20:17 [PATCH 0/5] vhost: introduce per-virtqueue stats API Maxime Coquelin
2022-05-10 20:17 ` [PATCH 1/5] vhost: add per-virtqueue statistics support Maxime Coquelin
2022-05-11 13:56   ` Xia, Chenbo
2022-05-10 20:17 ` [PATCH 2/5] net/vhost: move to Vhost library stats API Maxime Coquelin
2022-05-10 20:17 ` [PATCH 3/5] vhost: add statistics for guest notifications Maxime Coquelin
2022-05-10 20:17 ` [PATCH 4/5] vhost: add statistics for IOTLB Maxime Coquelin
2022-05-11 13:56   ` Xia, Chenbo [this message]
2022-05-10 20:17 ` [PATCH 5/5] vhost: add statistics for in-flight packets Maxime Coquelin
2022-05-11 13:57   ` Xia, Chenbo
2022-05-11  7:24 ` [PATCH 0/5] vhost: introduce per-virtqueue stats API Maxime Coquelin
2022-05-17 13:23 ` Maxime Coquelin
2022-05-17 13:33   ` Maxime Coquelin

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=SN6PR11MB350485C492EBAF39B984A1B29CC89@SN6PR11MB3504.namprd11.prod.outlook.com \
    --to=chenbo.xia@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=i.maximets@ovn.org \
    --cc=maxime.coquelin@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).