mbox series

[0/7] ndctl: cxl: add monitor support for trace events

Message ID 166318836385.3087953.6809315284050736931.stgit@djiang5-desk3.ch.intel.com
Headers show
Series ndctl: cxl: add monitor support for trace events | expand

Message

Dave Jiang Sept. 14, 2022, 8:47 p.m. UTC
This patch series for ndctl implements the monitor command for the cxl tool.
The initial implementation will collect CXL trace events emitted by the
kernel. libtraceevent and libtracefs will be used to parse the trace
event buffer. The monitor will pend on an epoll fd and wait for new event
entries to be posted. The output will be in json format. By default the events
are emitted to stdio, but can also be logged to a file. Each event is converted
to a JSON object and logged as such. All the fields exported are read by the
monitor code and added to the JSON object.

---

Dave Jiang (7):
      ndctl: cxl: add helper function to parse trace event to json object
      ndctl: cxl: add helper to parse through all current events
      ndctl: cxl: add common function to enable event trace
      ndctl: cxl: add common function to disable event trace
      ndctl: cxl: add monitor function for event trace events
      ndctl: cxl: add logging functions for monitor
      ndctl: cxl: add monitor command to cxl


 cxl/builtin.h     |   1 +
 cxl/cxl.c         |   1 +
 cxl/event_trace.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++
 cxl/event_trace.h |  23 +++++
 cxl/meson.build   |   4 +
 cxl/monitor.c     | 235 +++++++++++++++++++++++++++++++++++++++++++++
 meson.build       |   3 +
 7 files changed, 503 insertions(+)
 create mode 100644 cxl/event_trace.c
 create mode 100644 cxl/event_trace.h
 create mode 100644 cxl/monitor.c

--

Comments

Dave Jiang Sept. 14, 2022, 10:19 p.m. UTC | #1
On 9/14/2022 1:47 PM, Dave Jiang wrote:
> This patch series for ndctl implements the monitor command for the cxl tool.
> The initial implementation will collect CXL trace events emitted by the
> kernel. libtraceevent and libtracefs will be used to parse the trace
> event buffer. The monitor will pend on an epoll fd and wait for new event
> entries to be posted. The output will be in json format. By default the events
> are emitted to stdio, but can also be logged to a file. Each event is converted
> to a JSON object and logged as such. All the fields exported are read by the
> monitor code and added to the JSON object.
>
> ---
>
> Dave Jiang (7):
>        ndctl: cxl: add helper function to parse trace event to json object
>        ndctl: cxl: add helper to parse through all current events
>        ndctl: cxl: add common function to enable event trace
>        ndctl: cxl: add common function to disable event trace
>        ndctl: cxl: add monitor function for event trace events
>        ndctl: cxl: add logging functions for monitor
>        ndctl: cxl: add monitor command to cxl

Missing man page and systemd service. Will add in v2. Also will add 
default log file path when running in daemon mode.


>
>   cxl/builtin.h     |   1 +
>   cxl/cxl.c         |   1 +
>   cxl/event_trace.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++
>   cxl/event_trace.h |  23 +++++
>   cxl/meson.build   |   4 +
>   cxl/monitor.c     | 235 +++++++++++++++++++++++++++++++++++++++++++++
>   meson.build       |   3 +
>   7 files changed, 503 insertions(+)
>   create mode 100644 cxl/event_trace.c
>   create mode 100644 cxl/event_trace.h
>   create mode 100644 cxl/monitor.c
>
> --
>
Verma, Vishal L Sept. 14, 2022, 11:04 p.m. UTC | #2
On Wed, 2022-09-14 at 15:19 -0700, Dave Jiang wrote:
> 
> On 9/14/2022 1:47 PM, Dave Jiang wrote:
> > This patch series for ndctl implements the monitor command for the cxl tool.
> > The initial implementation will collect CXL trace events emitted by the
> > kernel. libtraceevent and libtracefs will be used to parse the trace
> > event buffer. The monitor will pend on an epoll fd and wait for new event
> > entries to be posted. The output will be in json format. By default the events
> > are emitted to stdio, but can also be logged to a file. Each event is converted
> > to a JSON object and logged as such. All the fields exported are read by the
> > monitor code and added to the JSON object.
> > 
> > ---
> > 
> > Dave Jiang (7):
> >        ndctl: cxl: add helper function to parse trace event to json object
> >        ndctl: cxl: add helper to parse through all current events
> >        ndctl: cxl: add common function to enable event trace
> >        ndctl: cxl: add common function to disable event trace
> >        ndctl: cxl: add monitor function for event trace events
> >        ndctl: cxl: add logging functions for monitor
> >        ndctl: cxl: add monitor command to cxl
> 
> Missing man page and systemd service. Will add in v2. Also will add 
> default log file path when running in daemon mode.

Haven't started looking at the rest, but I'll quickly add that no need
to include the 'ndctl:' prefix for these. 'cxl:' (or 'libcxl:' for
library patches) should be enough.

> > 
> >   cxl/builtin.h     |   1 +
> >   cxl/cxl.c         |   1 +
> >   cxl/event_trace.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++
> >   cxl/event_trace.h |  23 +++++
> >   cxl/meson.build   |   4 +
> >   cxl/monitor.c     | 235 +++++++++++++++++++++++++++++++++++++++++++++
> >   meson.build       |   3 +
> >   7 files changed, 503 insertions(+)
> >   create mode 100644 cxl/event_trace.c
> >   create mode 100644 cxl/event_trace.h
> >   create mode 100644 cxl/monitor.c
> > 
> > --
> >
Jonathan Cameron Sept. 22, 2022, 2:21 p.m. UTC | #3
On Wed, 14 Sep 2022 13:47:49 -0700
Dave Jiang <dave.jiang@intel.com> wrote:

> This patch series for ndctl implements the monitor command for the cxl tool.
> The initial implementation will collect CXL trace events emitted by the
> kernel. libtraceevent and libtracefs will be used to parse the trace
> event buffer. The monitor will pend on an epoll fd and wait for new event
> entries to be posted. The output will be in json format. By default the events
> are emitted to stdio, but can also be logged to a file. Each event is converted
> to a JSON object and logged as such. All the fields exported are read by the
> monitor code and added to the JSON object.

Hi Dave,

FYI, I just wanted to mention that we will be aiming to duplicate a bunch
of this functionality in rasdaemon.

As that is handling the equivalent of many of these events on our systems
from other components we don't want to grab the data via alternative tooling
and then have to merge it later.

Absolutely not a problem to have it in this tool as well. I mostly wanted
to raise it because longer term we'll need to be careful to test with both
solutions if there are any changes to what they are being sent.

Thanks,

Jonathan

> 
> ---
> 
> Dave Jiang (7):
>       ndctl: cxl: add helper function to parse trace event to json object
>       ndctl: cxl: add helper to parse through all current events
>       ndctl: cxl: add common function to enable event trace
>       ndctl: cxl: add common function to disable event trace
>       ndctl: cxl: add monitor function for event trace events
>       ndctl: cxl: add logging functions for monitor
>       ndctl: cxl: add monitor command to cxl
> 
> 
>  cxl/builtin.h     |   1 +
>  cxl/cxl.c         |   1 +
>  cxl/event_trace.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++
>  cxl/event_trace.h |  23 +++++
>  cxl/meson.build   |   4 +
>  cxl/monitor.c     | 235 +++++++++++++++++++++++++++++++++++++++++++++
>  meson.build       |   3 +
>  7 files changed, 503 insertions(+)
>  create mode 100644 cxl/event_trace.c
>  create mode 100644 cxl/event_trace.h
>  create mode 100644 cxl/monitor.c
> 
> --
>
Dave Jiang Sept. 22, 2022, 2:45 p.m. UTC | #4
On 9/22/2022 7:21 AM, Jonathan Cameron wrote:
> On Wed, 14 Sep 2022 13:47:49 -0700
> Dave Jiang <dave.jiang@intel.com> wrote:
>
>> This patch series for ndctl implements the monitor command for the cxl tool.
>> The initial implementation will collect CXL trace events emitted by the
>> kernel. libtraceevent and libtracefs will be used to parse the trace
>> event buffer. The monitor will pend on an epoll fd and wait for new event
>> entries to be posted. The output will be in json format. By default the events
>> are emitted to stdio, but can also be logged to a file. Each event is converted
>> to a JSON object and logged as such. All the fields exported are read by the
>> monitor code and added to the JSON object.
> Hi Dave,
>
> FYI, I just wanted to mention that we will be aiming to duplicate a bunch
> of this functionality in rasdaemon.
>
> As that is handling the equivalent of many of these events on our systems
> from other components we don't want to grab the data via alternative tooling
> and then have to merge it later.
>
> Absolutely not a problem to have it in this tool as well. I mostly wanted
> to raise it because longer term we'll need to be careful to test with both
> solutions if there are any changes to what they are being sent.

Thanks for the heads up Jonathan!


>
> Thanks,
>
> Jonathan
>
>> ---
>>
>> Dave Jiang (7):
>>        ndctl: cxl: add helper function to parse trace event to json object
>>        ndctl: cxl: add helper to parse through all current events
>>        ndctl: cxl: add common function to enable event trace
>>        ndctl: cxl: add common function to disable event trace
>>        ndctl: cxl: add monitor function for event trace events
>>        ndctl: cxl: add logging functions for monitor
>>        ndctl: cxl: add monitor command to cxl
>>
>>
>>   cxl/builtin.h     |   1 +
>>   cxl/cxl.c         |   1 +
>>   cxl/event_trace.c | 236 ++++++++++++++++++++++++++++++++++++++++++++++
>>   cxl/event_trace.h |  23 +++++
>>   cxl/meson.build   |   4 +
>>   cxl/monitor.c     | 235 +++++++++++++++++++++++++++++++++++++++++++++
>>   meson.build       |   3 +
>>   7 files changed, 503 insertions(+)
>>   create mode 100644 cxl/event_trace.c
>>   create mode 100644 cxl/event_trace.h
>>   create mode 100644 cxl/monitor.c
>>
>> --
>>