Re: [RFC V2 PATCH 05/11] cxl/mem: Trace General Media Event Record

From: Steven Rostedt
Date: Sat Oct 15 2022 - 07:30:52 EST


On Mon, 10 Oct 2022 15:41:25 -0700
ira.weiny@xxxxxxxxx wrote:

> +static void cxl_trace_event_record(const char *dev_name,
> + enum cxl_event_log_type type,
> + struct cxl_get_event_payload *payload)
> +{
> + uuid_t *id = &payload->record.hdr.id;
> +

Perhaps you want to add here:

if (!trace_cxl_general_media_enabled() && !trace_clx_generic_event_enabled())
return;

This way the below logic is only executed if either event is enabled.
The above uses static_branches, so if the architecture supports them,
they are not compare and branch, but jumps and/or nops.

-- Steve


> + if (uuid_equal(id, &gen_media_event_uuid)) {
> + struct cxl_event_gen_media *rec =
> + (struct cxl_event_gen_media *)&payload->record;
> +
> + trace_general_media(dev_name, type, rec);
> + return;
> + }
> +
> + /* For unknown record types print just the header */
> + trace_generic_event(dev_name, type, &payload->record);
> +}