Skip to content

Commit

Permalink
netdev-dpdk: Add coverage counter to count vhost IRQs.
Browse files Browse the repository at this point in the history
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>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
  • Loading branch information
chaudron authored and igsilya committed Dec 19, 2019
1 parent 6d77abf commit 3d56e4a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/netdev-dpdk.c
Expand Up @@ -75,6 +75,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

Expand Down Expand Up @@ -169,6 +170,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,
Expand All @@ -177,6 +180,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 */
Expand Down Expand Up @@ -3881,6 +3885,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.
Expand Down

0 comments on commit 3d56e4a

Please sign in to comment.