[PATCH i-g-t v2 1/2] /lib/xe/xe_eudebug: Add trigger removal method

Grzegorzek, Dominik dominik.grzegorzek at intel.com
Fri Oct 25 09:55:09 UTC 2024


On Thu, 2024-10-24 at 12:08 +0000, Jan Sokolowski wrote:
> Add method xe_eudebug_debugger_remove_trigger to remove
> trigger from list of triggers.
> 
> Signed-off-by: Jan Sokolowski <jan.sokolowski at intel.com>
> Reviewed-by: Dominik Grzegorzek <dominik.grzegorzek at intel.com>

Not sure why you add this rb beforehand, but anyway you can keep it for both. v2 looks good to me.

Regards,
Dominik
> Signed-off-by: Dominik Grzegorzk <dominik.grzegorzek at intel.com>
> ---
>  lib/xe/xe_eudebug.c | 30 ++++++++++++++++++++++++++++++
>  lib/xe/xe_eudebug.h |  2 ++
>  2 files changed, 32 insertions(+)
> 
> diff --git a/lib/xe/xe_eudebug.c b/lib/xe/xe_eudebug.c
> index 36763a184..74aa26024 100644
> --- a/lib/xe/xe_eudebug.c
> +++ b/lib/xe/xe_eudebug.c
> @@ -1226,6 +1226,36 @@ void xe_eudebug_debugger_add_trigger(struct xe_eudebug_debugger *d,
>  	igt_debug("added trigger %p\n", t);
>  }
>  
> +/**
> + * xe_eudebug_debugger_remove_trigger:
> + * @d: pointer to the debugger
> + * @type: the type of the event which activates the trigger.
> + * @fn: function to be removed when event of @type was read by the debugger.
> + *
> + * Removes function @fn from the list of triggers activated when event of
> + * @type has been read by worker.
> + */
> +void xe_eudebug_debugger_remove_trigger(struct xe_eudebug_debugger *d,
> +					int type, xe_eudebug_trigger_fn fn)
> +{
> +	struct event_trigger *t;
> +	bool found = false;
> +
> +	igt_list_for_each_entry(t, &d->triggers, link) {
> +		if (type == t->type && fn == t->fn) {
> +			igt_list_del(&t->link);
> +			found = true;
> +			break;
> +		}
> +	}
> +	if (found) {
> +		igt_debug("removed trigger %p\n", t);
> +		free(t);
> +	} else {
> +		igt_debug("trigger of type %d was not removed as it's not in the list\n", type);
> +	}
> +}
> +
>  /**
>   * xe_eudebug_debugger_start_worker:
>   * @d: pointer to the debugger
> diff --git a/lib/xe/xe_eudebug.h b/lib/xe/xe_eudebug.h
> index 6e4666333..9aadbe847 100644
> --- a/lib/xe/xe_eudebug.h
> +++ b/lib/xe/xe_eudebug.h
> @@ -150,6 +150,8 @@ void xe_eudebug_debugger_detach(struct xe_eudebug_debugger *d);
>  void xe_eudebug_debugger_set_data(struct xe_eudebug_debugger *c, void *ptr);
>  void xe_eudebug_debugger_add_trigger(struct xe_eudebug_debugger *d, int type,
>  				     xe_eudebug_trigger_fn fn);
> +void xe_eudebug_debugger_remove_trigger(struct xe_eudebug_debugger *d, int type,
> +				     xe_eudebug_trigger_fn fn);
>  void xe_eudebug_debugger_signal_stage(struct xe_eudebug_debugger *d, uint64_t stage);
>  void xe_eudebug_debugger_wait_stage(struct xe_eudebug_session *s, uint64_t stage);
>  



More information about the igt-dev mailing list