Skip to content

Commit

Permalink
utilities: Add netlink flow operation USDT probes and upcall_cost scr…
Browse files Browse the repository at this point in the history
…ipt.

This patch adds a series of NetLink flow operation USDT probes.
These probes are in turn used in the upcall_cost Python script,
which in addition of some kernel tracepoints, give an insight into
the time spent on processing upcall.

Signed-off-by: Eelco Chaudron <[email protected]>
Acked-by: Paolo Valerio <[email protected]>
Signed-off-by: Ilya Maximets <[email protected]>
  • Loading branch information
chaudron authored and igsilya committed Jan 17, 2022
1 parent 51ec986 commit 85d3785
Show file tree
Hide file tree
Showing 4 changed files with 1,892 additions and 1 deletion.
86 changes: 86 additions & 0 deletions Documentation/topics/usdt-probes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,96 @@ used naming convention.

Available probes in ``ovs_vswitchd``:

- dpif_netlink_operate\_\_:op_flow_del
- dpif_netlink_operate\_\_:op_flow_execute
- dpif_netlink_operate\_\_:op_flow_get
- dpif_netlink_operate\_\_:op_flow_put
- dpif_recv:recv_upcall
- main:poll_block
- main:run_start


dpif_netlink_operate\_\_:op_flow_del
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Description**:

This probe gets triggered when the Netlink datapath is about to execute the
DPIF_OP_FLOW_DEL operation as part of the dpif ``operate()`` callback.

**Arguments**:

- *arg0*: ``(struct dpif_netlink *) dpif``
- *arg1*: ``(struct dpif_flow_del *) del``
- *arg2*: ``(struct dpif_netlink_flow *) flow``
- *arg3*: ``(struct ofpbuf *) aux->request``

**Script references**:

- *None*


dpif_netlink_operate\_\_:op_flow_execute
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Description**:

This probe gets triggered when the Netlink datapath is about to execute the
DPIF_OP_FLOW_EXECUTE operation as part of the dpif ``operate()`` callback.

**Arguments**:

- *arg0*: ``(struct dpif_netlink *) dpif``
- *arg1*: ``(struct dpif_execute *) op->execute``
- *arg2*: ``dp_packet_data(op->execute.packet)``
- *arg3*: ``dp_packet_size(op->execute.packet)``
- *arg4*: ``(struct ofpbuf *) aux->request``

**Script references**:

- ``utilities/usdt-scripts/upcall_cost.py``


dpif_netlink_operate\_\_:op_flow_get
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Description**:

This probe gets triggered when the Netlink datapath is about to execute the
DPIF_OP_FLOW_GET operation as part of the dpif ``operate()`` callback.

**Arguments**:

- *arg0*: ``(struct dpif_netlink *) dpif``
- *arg1*: ``(struct dpif_flow_get *) get``
- *arg2*: ``(struct dpif_netlink_flow *) flow``
- *arg3*: ``(struct ofpbuf *) aux->request``

**Script references**:

- *None*


dpif_netlink_operate\_\_:op_flow_put
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**Description**:

This probe gets triggered when the Netlink datapath is about to execute the
DPIF_OP_FLOW_PUT operation as part of the dpif ``operate()`` callback.

**Arguments**:

- *arg0*: ``(struct dpif_netlink *) dpif``
- *arg1*: ``(struct dpif_flow_put *) put``
- *arg2*: ``(struct dpif_netlink_flow *) flow``
- *arg3*: ``(struct ofpbuf *) aux->request``

**Script references**:

- ``utilities/usdt-scripts/upcall_cost.py``


probe dpif_recv:recv_upcall
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand All @@ -229,6 +314,7 @@ sent to ``ovs-vswitchd``.

**Script references**:

- ``utilities/usdt-scripts/upcall_cost.py``
- ``utilities/usdt-scripts/upcall_monitor.py``


Expand Down
16 changes: 16 additions & 0 deletions lib/dpif-netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include "openvswitch/poll-loop.h"
#include "openvswitch/shash.h"
#include "openvswitch/thread.h"
#include "openvswitch/usdt-probes.h"
#include "openvswitch/vlog.h"
#include "packets.h"
#include "random.h"
Expand Down Expand Up @@ -2052,6 +2053,9 @@ dpif_netlink_operate__(struct dpif_netlink *dpif,
aux->txn.reply = &aux->reply;
}
dpif_netlink_flow_to_ofpbuf(&flow, &aux->request);

OVS_USDT_PROBE(dpif_netlink_operate__, op_flow_put,
dpif, put, &flow, &aux->request);
break;

case DPIF_OP_FLOW_DEL:
Expand All @@ -2062,6 +2066,9 @@ dpif_netlink_operate__(struct dpif_netlink *dpif,
aux->txn.reply = &aux->reply;
}
dpif_netlink_flow_to_ofpbuf(&flow, &aux->request);

OVS_USDT_PROBE(dpif_netlink_operate__, op_flow_del,
dpif, del, &flow, &aux->request);
break;

case DPIF_OP_EXECUTE:
Expand All @@ -2082,6 +2089,12 @@ dpif_netlink_operate__(struct dpif_netlink *dpif,
} else {
dpif_netlink_encode_execute(dpif->dp_ifindex, &op->execute,
&aux->request);

OVS_USDT_PROBE(dpif_netlink_operate__, op_flow_execute,
dpif, &op->execute,
dp_packet_data(op->execute.packet),
dp_packet_size(op->execute.packet),
&aux->request);
}
break;

Expand All @@ -2090,6 +2103,9 @@ dpif_netlink_operate__(struct dpif_netlink *dpif,
dpif_netlink_init_flow_get(dpif, get, &flow);
aux->txn.reply = get->buffer;
dpif_netlink_flow_to_ofpbuf(&flow, &aux->request);

OVS_USDT_PROBE(dpif_netlink_operate__, op_flow_get,
dpif, get, &flow, &aux->request);
break;

default:
Expand Down
4 changes: 3 additions & 1 deletion utilities/automake.mk
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ EXTRA_DIST += \
utilities/docker/debian/Dockerfile \
utilities/docker/debian/build-kernel-modules.sh \
utilities/usdt-scripts/bridge_loop.bt \
utilities/usdt-scripts/upcall_cost.py \
utilities/usdt-scripts/upcall_monitor.py
MAN_ROOTS += \
utilities/ovs-testcontroller.8.in \
Expand Down Expand Up @@ -132,6 +133,7 @@ FLAKE8_PYFILES += utilities/ovs-pcap.in \
utilities/ovs-check-dead-ifs.in \
utilities/ovs-tcpdump.in \
utilities/ovs-pipegen.py \
utilities/usdt-scripts/upcall_monitor.py
utilities/usdt-scripts/upcall_monitor.py \
utilities/usdt-scripts/upcall_cost.py

include utilities/bugtool/automake.mk
Loading

0 comments on commit 85d3785

Please sign in to comment.