lkml.org 
[lkml]   [2022]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/9] cxl/mem: Implement Get Event Records command
On Tue, Aug 16, 2022 at 12:41:28PM -0400, Steven Rostedt wrote:
> On Tue, 16 Aug 2022 12:39:58 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > > + record_count = le16_to_cpu(payload.record_count);
> > > + if (record_count > 0)
> > > + trace_cxl_event(dev_name(cxlds->dev), type,
> > > + &payload.record);
> > > +
> > > + if (payload.flags & CXL_GET_EVENT_FLAG_OVERFLOW)
> > > + trace_cxl_event_overflow(dev_name(cxlds->dev), type,
> > > + &payload);
> >
> > If you want to avoid the compare operations when the tracepoints are not
> > enabled, you can add:
> >
> > if (trace_cxl_event_enabled()) {
> > if (record_count > 0)
> > trace_cxl_event(dev_name(cxlds->dev), type,
> > &payload.record);
> > }
> >
> > if (trace_cxl_event_overflow_enabled()) {
> > if (payload.flags & CXL_GET_EVENT_FLAG_OVERFLOW)
> > trace_cxl_event_overflow(dev_name(cxlds->dev), type,
> > &payload);
> > }
> >
> > Those "<tracepoint>_enabled()" functions are static branches. Which means
> > when not enabled it's a nop that skips this code, and when either is
> > enabled, it turns into a jump to the contents of the if block.
>
> Ignore this suggestion. I see in the second patch you add more logic to the
> if condition.

Correct.

> Only use this suggestion if the logic is only for when the
> tracepoint is enabled.

This could apply to the overflow trace. I think it is more likely that either
all of these traces will be enabled or none.

So other than doing:

if (trace_cxl_event_enabled() ||
trace_cxl_event_overflow_enabled() ||
trace_cxl_gen_media_event() ||
<every event defined>
...) {

Is there a way to know if

/sys/kernel/tracing/events/cxl_events/enable

is != 0?

I feel like the real optimization will be to shut this entire functionality
down if no one is listening.

Ira

\
 
 \ /
  Last update: 2022-08-17 01:14    [W:0.207 / U:1.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site