From patchwork Tue Oct 15 11:20:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eelco Chaudron X-Patchwork-Id: 1176938 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46stJT6jJWz9sPF for ; Tue, 15 Oct 2019 22:20:25 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 5A30FC86; Tue, 15 Oct 2019 11:20:22 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 27696C83 for ; Tue, 15 Oct 2019 11:20:21 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C2BBD6D6 for ; Tue, 15 Oct 2019 11:20:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1AE7D309DEE2 for ; Tue, 15 Oct 2019 11:20:16 +0000 (UTC) Received: from netdev64.ntdv.lab.eng.bos.redhat.com (wsfd-netdev64.ntdv.lab.eng.bos.redhat.com [10.19.188.127]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA6EF60BE2 for ; Tue, 15 Oct 2019 11:20:15 +0000 (UTC) From: Eelco Chaudron To: dev@openvswitch.org Date: Tue, 15 Oct 2019 07:20:14 -0400 Message-Id: <20191015112013.12369.42639.stgit@netdev64> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 15 Oct 2019 11:20:16 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [dpdk-latest PATCH] netdev-dpdk: add custom vhost statistics to count IRQs X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org When the dpdk vhost library executes an eventfd_write() call, i.e. waking up the guest, a new callback will be called. This patch adds the callback to count the number of interrupts sent to the VM to track the number of times interrupts where generated. This might be of interest to find out system-calls were called in the DPDK fast path. The custom statistics can be seen with the following command: ovs-ofctl -O OpenFlow14 dump-ports {} Signed-off-by: Eelco Chaudron --- lib/netdev-dpdk.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ba92e89..7ebbcdc 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -165,6 +165,8 @@ static int new_device(int vid); static void destroy_device(int vid); static int vring_state_changed(int vid, uint16_t queue_id, int enable); static void destroy_connection(int vid); +static void vhost_guest_notified(int vid); + static const struct vhost_device_ops virtio_net_device_ops = { .new_device = new_device, @@ -173,6 +175,7 @@ static const struct vhost_device_ops virtio_net_device_ops = .features_changed = NULL, .new_connection = NULL, .destroy_connection = destroy_connection, + .guest_notified = vhost_guest_notified, }; enum { DPDK_RING_SIZE = 256 }; @@ -416,6 +419,8 @@ struct netdev_dpdk { struct netdev_stats stats; /* Custom stat for retries when unable to transmit. */ uint64_t tx_retries; + /* Custom stat counting number of times a vhost remote was woken up */ + uint64_t vhost_irqs; /* Protects stats */ rte_spinlock_t stats_lock; /* 4 pad bytes here. */ @@ -2826,7 +2831,8 @@ netdev_dpdk_vhost_get_custom_stats(const struct netdev *netdev, int i; #define VHOST_CSTATS \ - VHOST_CSTAT(tx_retries) + VHOST_CSTAT(tx_retries) \ + VHOST_CSTAT(vhost_irqs) #define VHOST_CSTAT(NAME) + 1 custom_stats->size = VHOST_CSTATS; @@ -3746,6 +3752,25 @@ destroy_connection(int vid) } } +static +void vhost_guest_notified(int vid) +{ + struct netdev_dpdk *dev; + + ovs_mutex_lock(&dpdk_mutex); + LIST_FOR_EACH (dev, list_node, &dpdk_list) { + if (netdev_dpdk_get_vid(dev) == vid) { + ovs_mutex_lock(&dev->mutex); + rte_spinlock_lock(&dev->stats_lock); + dev->vhost_irqs++; + rte_spinlock_unlock(&dev->stats_lock); + ovs_mutex_unlock(&dev->mutex); + break; + } + } + ovs_mutex_unlock(&dpdk_mutex); +} + /* * Retrieve the DPDK virtio device ID (vid) associated with a vhostuser * or vhostuserclient netdev.