diff mbox series

[ovs-dev,v4] netdev-dpdk: add coverage counter to count vhost IRQs

Message ID 20191212025909.96010.69426.stgit@netdev64
State Accepted
Delegated to: Ilya Maximets
Headers show
Series [ovs-dev,v4] netdev-dpdk: add coverage counter to count vhost IRQs | expand

Commit Message

Eelco Chaudron Dec. 12, 2019, 3 a.m. UTC
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 coverage counter is called "vhost_notification" and
can be read with:

  $ ovs-appctl coverage/read-counter vhost_notification
  13238319

Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
---

v3 -> v4
  - rebase to latest ovs master with DPDK 19.11

v2 -> v3
  - rebased on latest dpdk-latest

v1 -> v2
  - Moved to using a coverage counter

 lib/netdev-dpdk.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Eelco Chaudron Dec. 18, 2019, 2:30 p.m. UTC | #1
Ilya,

Anything missing for this patch now that DPDK 19.11 is in?

Cheers,

Eelco


On 12 Dec 2019, at 4:00, Eelco Chaudron wrote:

> 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 coverage counter is called "vhost_notification" and
> can be read with:
>
>   $ ovs-appctl coverage/read-counter vhost_notification
>   13238319
>
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---
>
> v3 -> v4
>   - rebase to latest ovs master with DPDK 19.11
>
> v2 -> v3
>   - rebased on latest dpdk-latest
>
> v1 -> v2
>   - Moved to using a coverage counter
>
>  lib/netdev-dpdk.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 89c73a2..5796b72 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -74,6 +74,7 @@ VLOG_DEFINE_THIS_MODULE(netdev_dpdk);
>  static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
>
>  COVERAGE_DEFINE(vhost_tx_contention);
> +COVERAGE_DEFINE(vhost_notification);
>
>  #define DPDK_PORT_WATCHDOG_INTERVAL 5
>
> @@ -168,6 +169,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,
> @@ -176,6 +179,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,
>  };
>
>  /* Custom software stats for dpdk ports */
> @@ -3844,6 +3848,12 @@ destroy_connection(int vid)
>      }
>  }
>
> +static
> +void vhost_guest_notified(int vid OVS_UNUSED)
> +{
> +    COVERAGE_INC(vhost_notification);
> +}
> +
>  /*
>   * Retrieve the DPDK virtio device ID (vid) associated with a 
> vhostuser
>   * or vhostuserclient netdev.
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ilya Maximets Dec. 19, 2019, 8:22 a.m. UTC | #2
On 12.12.2019 04:00, Eelco Chaudron wrote:
> 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 coverage counter is called "vhost_notification" and
> can be read with:
> 
>   $ ovs-appctl coverage/read-counter vhost_notification
>   13238319
> 
> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
> ---

Looks OK, but I really hope that we'll replace this with some
kind of statistics counted inside DPDK vhost library someday.

Applied to master.  Thanks!

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 89c73a2..5796b72 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -74,6 +74,7 @@  VLOG_DEFINE_THIS_MODULE(netdev_dpdk);
 static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20);
 
 COVERAGE_DEFINE(vhost_tx_contention);
+COVERAGE_DEFINE(vhost_notification);
 
 #define DPDK_PORT_WATCHDOG_INTERVAL 5
 
@@ -168,6 +169,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,
@@ -176,6 +179,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,
 };
 
 /* Custom software stats for dpdk ports */
@@ -3844,6 +3848,12 @@  destroy_connection(int vid)
     }
 }
 
+static
+void vhost_guest_notified(int vid OVS_UNUSED)
+{
+    COVERAGE_INC(vhost_notification);
+}
+
 /*
  * Retrieve the DPDK virtio device ID (vid) associated with a vhostuser
  * or vhostuserclient netdev.