Re: [PATCH V4 11/20] rv/monitor: wwnr instrumentation and Makefile/Kconfig entries

From: Steven Rostedt
Date: Tue Jun 28 2022 - 15:05:51 EST


On Thu, 16 Jun 2022 10:44:53 +0200
Daniel Bristot de Oliveira <bristot@xxxxxxxxxx> wrote:

> diff --git a/kernel/trace/rv/monitors/wwnr/wwnr.c b/kernel/trace/rv/monitors/wwnr/wwnr.c
> index 8ba01f0f0df8..3fe1ad9125d3 100644
> --- a/kernel/trace/rv/monitors/wwnr/wwnr.c
> +++ b/kernel/trace/rv/monitors/wwnr/wwnr.c
> @@ -10,11 +10,8 @@
>
> #define MODULE_NAME "wwnr"
>
> -/*
> - * XXX: include required tracepoint headers, e.g.,
> - * #include <linux/trace/events/sched.h>
> - */
> #include <trace/events/rv.h>
> +#include <trace/events/sched.h>
>
> /*
> * This is the self-generated part of the monitor. Generally, there is no need
> @@ -37,21 +34,20 @@ DECLARE_DA_MON_PER_TASK(wwnr, char);
> * are translated into model's event.
> *
> */
> -static void handle_switch_in(void *data, /* XXX: fill header */)
> +static void handle_switch(void *data, bool preempt, struct task_struct *p,
> + struct task_struct *n, unsigned int prev_state)
> {


Patch 8 was the "educational" patch. There's no reason to split 10 and 11
up too.

-- Steve


> - struct task_struct *p = /* XXX: how do I get p? */;
> - da_handle_event_wwnr(p, switch_in_wwnr);
> -}
> + /* start monitoring only after the first suspension */
> + if (prev_state == TASK_INTERRUPTIBLE)
> + da_handle_init_event_wwnr(p, switch_out_wwnr);
> + else
> + da_handle_event_wwnr(p, switch_out_wwnr);
>
> -static void handle_switch_out(void *data, /* XXX: fill header */)
> -{
> - struct task_struct *p = /* XXX: how do I get p? */;
> - da_handle_event_wwnr(p, switch_out_wwnr);
> + da_handle_event_wwnr(n, switch_in_wwnr);
> }
>
> -static void handle_wakeup(void *data, /* XXX: fill header */)
> +static void handle_wakeup(void *data, struct task_struct *p)
> {
> - struct task_struct *p = /* XXX: how do I get p? */;
> da_handle_event_wwnr(p, wakeup_wwnr);
> }