Re: [PATCH v5 9/9] x86/nmi: Include NMI-source information in tracepoint and debug prints

Steven Rostedt
2025-05-07T21:48:02Z

On Tue, 6 May 2025 18:21:45 -0700
Sohil Mehta <sohil.mehta@intel.com> wrote:

> diff --git a/include/trace/events/nmi.h b/include/trace/events/nmi.h
> index 18e0411398ba..6e4a1ff70a44 100644
> --- a/include/trace/events/nmi.h
> +++ b/include/trace/events/nmi.h
> @@ -10,29 +10,32 @@
>
> TRACE_EVENT(nmi_handler,
>
> - TP_PROTO(void *handler, s64 delta_ns, int handled),
> + TP_PROTO(void *handler, s64 delta_ns, int handled, unsigned long source_bitmap),

Even though x86 is currently the only architecture using the nmi
tracepoint, this "source_bitmap" makes it become very x86 specific.

This file should be moved into arch/x86/include/asm/trace/

And that would require adding to the Makefile:

CFLAGS_nmi.o := -I $(src)/../include/asm/trace

>
> - TP_ARGS(handler, delta_ns, handled),
> + TP_ARGS(handler, delta_ns, handled, source_bitmap),
>
> TP_STRUCT__entry(
> __field( void *, handler )
> __field( s64, delta_ns)
> __field( int, handled )
> + __field( unsigned long, source_bitmap)
> ),
>
> TP_fast_assign(
> __entry->handler = handler;
> __entry->delta_ns = delta_ns;
> __entry->handled = handled;
> + __entry->source_bitmap = source_bitmap;
> ),
>
> - TP_printk("%ps() delta_ns: %lld handled: %d",
> + TP_printk("%ps() delta_ns: %lld handled: %d source_bitmap: 0x%lx",
> __entry->handler,
> __entry->delta_ns,
> - __entry->handled)
> + __entry->handled,
> + __entry->source_bitmap)
> );
>
> #endif /* _TRACE_NMI_H */
>
> -/* This part ust be outside protection */
> +/* This part must be outside protection */

And this would need to have:

#undef TRACE_INCLUDE_PATH
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_PATH .
#define TRACE_INCLUDE_FILE nmi

-- Steve

> #include <trace/define_trace.h>