From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5BBEEA0093; Tue, 10 May 2022 16:15:30 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E74A42832; Tue, 10 May 2022 16:15:30 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 09AB54069D for ; Tue, 10 May 2022 16:15:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652192128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aYWnXC+FpEgE5FhucIJ7IqRL/GupOn0FCrx1/YbMRes=; b=UFk9HzVNC9vHdBaDg9HIgvTowN3btxtSUf0yRPDjASxICOb8HmSmmkZUOUZLjLw4Zq5pUh ydnAG6hTF1+FNsoK4+c6kQl8dKgtPJw7ZBIgKcRSqxbm2PjDlW5TEkzt/ePjkXpzi4pPYd 8mjM/3b1445PzX88L8v1f2vegvE5Luo= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-303-sfedjBhnNXGc0lx6knVsjg-1; Tue, 10 May 2022 10:15:17 -0400 X-MC-Unique: sfedjBhnNXGc0lx6knVsjg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 741362932482; Tue, 10 May 2022 14:15:17 +0000 (UTC) Received: from [10.39.208.28] (unknown [10.39.208.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2BDDEC07F43; Tue, 10 May 2022 14:15:14 +0000 (UTC) Message-ID: Date: Tue, 10 May 2022 16:15:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH v2 5/5] vhost: add statistics for IOTLB To: "Xia, Chenbo" , "dev@dpdk.org" , "david.marchand@redhat.com" , "i.maximets@ovn.org" References: <20220324124638.32672-1-maxime.coquelin@redhat.com> <20220324124638.32672-6-maxime.coquelin@redhat.com> From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 4/25/22 14:10, Xia, Chenbo wrote: > Hi Maxime, > >> -----Original Message----- >> From: Maxime Coquelin >> Sent: Thursday, March 24, 2022 8:47 PM >> To: dev@dpdk.org; Xia, Chenbo ; >> david.marchand@redhat.com; i.maximets@ovn.org >> Cc: Maxime Coquelin >> Subject: [PATCH v2 5/5] vhost: add statistics for IOTLB >> >> This patch adds statistics for IOTLB hits and misses. >> >> Signed-off-by: Maxime Coquelin >> --- >> lib/vhost/vhost.c | 10 +++++++++- >> lib/vhost/vhost.h | 3 +++ >> 2 files changed, 12 insertions(+), 1 deletion(-) >> >> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c >> index 58b58fc40e..7f4fafdcb0 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..e876fc157b 100644 >> --- a/lib/vhost/vhost.h >> +++ b/lib/vhost/vhost.h >> @@ -134,6 +134,9 @@ 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; >> + uint64_t iotlb_errors; > > This seems defined but never used. Good catch, I'll remove it in next revision. Regards, Maxime > Thanks, > Chenbo > >> }; >> >> /** >> -- >> 2.35.1 >