[PATCH 38/40] vdpa: add trace events for eval_flush

Si-Wei Liu posted 40 patches 11 months, 3 weeks ago
[PATCH 38/40] vdpa: add trace events for eval_flush
Posted by Si-Wei Liu 11 months, 3 weeks ago
For better debuggability and observability.

Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
---
 net/trace-events | 2 ++
 net/vhost-vdpa.c | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/net/trace-events b/net/trace-events
index aab666a..d650c71 100644
--- a/net/trace-events
+++ b/net/trace-events
@@ -26,3 +26,5 @@ colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=%u"
 
 # vhost-vdpa.c
 vhost_vdpa_set_address_space_id(void *v, unsigned vq_group, unsigned asid_num) "vhost_vdpa: %p vq_group: %u asid: %u"
+vhost_vdpa_net_data_eval_flush(void *s, int qindex, int svq_switch, bool svq_flush) "vhost_vdpa: %p qp: %d svq_switch: %d flush_map: %d"
+vhost_vdpa_net_cvq_eval_flush(void *s, int qindex, int svq_switch, bool svq_flush) "vhost_vdpa: %p qp: %d svq_switch: %d flush_map: %d"
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 84876b0..a0bd8cd 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -608,6 +608,9 @@ static void vhost_vdpa_net_data_eval_flush(NetClientState *nc, bool stop)
                v->desc_group < 0) {
         v->shared->flush_map = true;
     }
+    trace_vhost_vdpa_net_data_eval_flush(v, s->vhost_vdpa.index,
+                                        v->shared->svq_switching,
+                                        v->shared->flush_map);
 }
 
 static NetClientInfo net_vhost_vdpa_info = {
@@ -1457,6 +1460,10 @@ static void vhost_vdpa_net_cvq_eval_flush(NetClientState *nc, bool stop)
         !s->cvq_isolated && v->desc_group < 0) {
         v->shared->flush_map = true;
     }
+
+    trace_vhost_vdpa_net_cvq_eval_flush(v, s->vhost_vdpa.index,
+                                       v->shared->svq_switching,
+                                       v->shared->flush_map);
 }
 
 static NetClientInfo net_vhost_vdpa_cvq_info = {
-- 
1.8.3.1
Re: [PATCH 38/40] vdpa: add trace events for eval_flush
Posted by Jason Wang 10 months, 2 weeks ago
On Fri, Dec 8, 2023 at 2:51 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote:
>
> For better debuggability and observability.
>
> Signed-off-by: Si-Wei Liu <si-wei.liu@oracle.com>
> ---
>  net/trace-events | 2 ++
>  net/vhost-vdpa.c | 7 +++++++
>  2 files changed, 9 insertions(+)
>
> diff --git a/net/trace-events b/net/trace-events
> index aab666a..d650c71 100644
> --- a/net/trace-events
> +++ b/net/trace-events
> @@ -26,3 +26,5 @@ colo_filter_rewriter_conn_offset(uint32_t offset) ": offset=%u"
>
>  # vhost-vdpa.c
>  vhost_vdpa_set_address_space_id(void *v, unsigned vq_group, unsigned asid_num) "vhost_vdpa: %p vq_group: %u asid: %u"
> +vhost_vdpa_net_data_eval_flush(void *s, int qindex, int svq_switch, bool svq_flush) "vhost_vdpa: %p qp: %d svq_switch: %d flush_map: %d"
> +vhost_vdpa_net_cvq_eval_flush(void *s, int qindex, int svq_switch, bool svq_flush) "vhost_vdpa: %p qp: %d svq_switch: %d flush_map: %d"
> diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
> index 84876b0..a0bd8cd 100644
> --- a/net/vhost-vdpa.c
> +++ b/net/vhost-vdpa.c
> @@ -608,6 +608,9 @@ static void vhost_vdpa_net_data_eval_flush(NetClientState *nc, bool stop)
>                 v->desc_group < 0) {
>          v->shared->flush_map = true;
>      }
> +    trace_vhost_vdpa_net_data_eval_flush(v, s->vhost_vdpa.index,
> +                                        v->shared->svq_switching,
> +                                        v->shared->flush_map);
>  }
>
>  static NetClientInfo net_vhost_vdpa_info = {
> @@ -1457,6 +1460,10 @@ static void vhost_vdpa_net_cvq_eval_flush(NetClientState *nc, bool stop)

For even better debuggability and observability.

Is it better to squash this into the patch into vhost_vdpa_net_cvq_eval_flush()?

Thanks

>          !s->cvq_isolated && v->desc_group < 0) {
>          v->shared->flush_map = true;
>      }
> +
> +    trace_vhost_vdpa_net_cvq_eval_flush(v, s->vhost_vdpa.index,
> +                                       v->shared->svq_switching,
> +                                       v->shared->flush_map);
>  }
>
>  static NetClientInfo net_vhost_vdpa_cvq_info = {
> --
> 1.8.3.1
>