Skip to contentSkip to conversation

retrieving non-numeral fields from an event record

DISCUSSION Dave Jiang 3 participants 6 messages Aug 22, 2022 – Aug 25, 2022

lore
Share & tools
lore

Dave Jiang

author
#0 lore raw

Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse:

check-events.sh-5983 [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1
d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub ' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK GROUP|BANK|COLUMN'

Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields?

failed to get field: time
<CANT FIND FIELD time>
got field: id, len: 16
got field: handle, len: 2
got field: related_handle, len: 2
failed to get field: hdr_flags
<CANT FIND FIELD hdr_flags>
got field: phys_addr, len: 8
failed to get field: volatile
<CANT FIND FIELD volatile>
failed to get field: desc
<CANT FIND FIELD desc>
got field: type, len: 1
failed to get field: trans_type
<CANT FIND FIELD trans_type>
got field: channel, len: 1
got field: rank, len: 1
got field: nibble_mask, len: 4
got field: bank_group, len: 1
got field: bank, len: 1
got field: row, len: 4
got field: column, len: 2
got field: cor_mask, len: 32
failed to get field: valid_flags
<CANT FIND FIELD valid_flags>

#1 lore raw
Quoted 9 lines · On Mon, 22 Aug 2022 14:48:30 -0700 Dave Jiang <[email protected]> wrote:

Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse:

check-events.sh-5983 [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1
d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub ' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK GROUP|BANK|COLUMN'

Quoted 4 lines

Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields?

What's the format for this event? That is, what is the output of :

trace-cmd list -e cxl_dram_event -F

?

As what gets show in the output may not actually match the fields that are saved in the raw event.

-- Steve

author
#2 lore raw
Quoted 16 lines · Steven Rostedt
Quoted 9 lines · On Mon, 22 Aug 2022 14:48:30 -0700 Dave Jiang <[email protected]> wrote:

Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse:

   check-events.sh-5983    [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1

d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub ' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK GROUP|BANK|COLUMN'

Quoted 4 lines

Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields?

Quoted 5 lines

What's the format for this event? That is, what is the output of :

trace-cmd list -e cxl_dram_event -F

?

#trace-cmd list -e cxl_dram_event -F
system: cxl_events
name: cxl_dram_event
ID: 2325
format:

        field:unsigned short common_type;       offset:0;       size:2; signed:0;
        field:unsigned char common_flags;       offset:2;       size:1; signed:0;
        field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
        field:int common_pid;   offset:4;       size:4; signed:1;

        field:__data_loc char[] dev_name;       offset:8;       size:4; signed:1;
        field:int log;  offset:12;      size:4; signed:1;
        field:u8 id[16];        offset:16;      size:16;        signed:0;
        field:u32 flags;        offset:32;      size:4; signed:0;
        field:u16 handle;       offset:36;      size:2; signed:0;
        field:u16 related_handle;       offset:38;      size:2; signed:0;
        field:u64 timestamp;    offset:40;      size:8; signed:0;
        field:u64 phys_addr;    offset:48;      size:8; signed:0;
        field:u8 descriptor;    offset:56;      size:1; signed:0;
        field:u8 type;  offset:57;      size:1; signed:0;
        field:u8 transaction_type;      offset:58;      size:1; signed:0;
        field:u8 channel;       offset:59;      size:1; signed:0;
        field:u16 validity_flags;       offset:60;      size:2; signed:0;
        field:u16 column;       offset:62;      size:2; signed:0;
        field:u32 nibble_mask;  offset:64;      size:4; signed:0;
        field:u32 row;  offset:68;      size:4; signed:0;
        field:u8 cor_mask[0x20];        offset:72;      size:32;        signed:0;
        field:u8 rank;  offset:104;     size:1; signed:0;
        field:u8 bank_group;    offset:105;     size:1; signed:0;
        field:u8 bank;  offset:106;     size:1; signed:0;
Quoted 5 lines

As what gets show in the output may not actually match the fields that are saved in the raw event.

-- Steve

#3 lore raw
Quoted 45 lines · On Mon, 22 Aug 2022 15:21:01 -0700 Dave Jiang <[email protected]> wrote:
Quoted 16 lines · Steven Rostedt
Quoted 9 lines · On Mon, 22 Aug 2022 14:48:30 -0700 Dave Jiang <[email protected]> wrote:

Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse:

   check-events.sh-5983    [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1

d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub ' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK GROUP|BANK|COLUMN'

Quoted 4 lines

Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields?

Quoted 5 lines

What's the format for this event? That is, what is the output of :

trace-cmd list -e cxl_dram_event -F

?

#trace-cmd list -e cxl_dram_event -F
system: cxl_events
name: cxl_dram_event
ID: 2325
format:

         field:unsigned short common_type;       offset:0;       size:2; signed:0;
         field:unsigned char common_flags;       offset:2;       size:1; signed:0;
         field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
         field:int common_pid;   offset:4;       size:4; signed:1;

         field:__data_loc char[] dev_name;       offset:8;       size:4; signed:1;
         field:int log;  offset:12;      size:4; signed:1;
         field:u8 id[16];        offset:16;      size:16;        signed:0;
         field:u32 flags;        offset:32;      size:4; signed:0;
         field:u16 handle;       offset:36;      size:2; signed:0;
         field:u16 related_handle;       offset:38;      size:2; signed:0;
         field:u64 timestamp;    offset:40;      size:8; signed:0;
         field:u64 phys_addr;    offset:48;      size:8; signed:0;
         field:u8 descriptor;    offset:56;      size:1; signed:0;
         field:u8 type;  offset:57;      size:1; signed:0;
         field:u8 transaction_type;      offset:58;      size:1; signed:0;
         field:u8 channel;       offset:59;      size:1; signed:0;
Quoted 8 lines
         field:u16 validity_flags;       offset:60;      size:2; signed:0;
         field:u16 column;       offset:62;      size:2; signed:0;
         field:u32 nibble_mask;  offset:64;      size:4; signed:0;
         field:u32 row;  offset:68;      size:4; signed:0;
         field:u8 cor_mask[0x20];        offset:72;      size:32;        signed:0;
         field:u8 rank;  offset:104;     size:1; signed:0;
         field:u8 bank_group;    offset:105;     size:1; signed:0;
         field:u8 bank;  offset:106;     size:1; signed:0;

The above are the fields you need. If you want to see how they are formatted in the output, you can add "--full" to the above command and you'll see a "printf" like format.

Your output you showed in the previous email had:

Quoted 2 lines

failed to get field: time <CANT FIND FIELD time>

There's no field "time" above.

Quoted 5 lines

got field: id, len: 16
got field: handle, len: 2 got field: related_handle, len: 2 failed to get field: hdr_flags <CANT FIND FIELD hdr_flags>

Same for "hdr_flags"

Quoted 3 lines

got field: phys_addr, len: 8 failed to get field: volatile <CANT FIND FIELD volatile>

And "volatile"

Quoted 2 lines

failed to get field: desc <CANT FIND FIELD desc>

etc.

Quoted 3 lines

got field: type, len: 1 failed to get field: trans_type <CANT FIND FIELD trans_type>

etc.

Quoted 10 lines

got field: channel, len: 1 got field: rank, len: 1
got field: nibble_mask, len: 4 got field: bank_group, len: 1 got field: bank, len: 1
got field: row, len: 4
got field: column, len: 2 got field: cor_mask, len: 32 failed to get field: valid_flags <CANT FIND FIELD valid_flags>

etc.

The field names are from the above format, not what you see in the output of the event.

-- Steve

author
#4 lore raw
Quoted 98 lines · Steven Rostedt
Quoted 44 lines · On Mon, 22 Aug 2022 15:21:01 -0700 Dave Jiang <[email protected]> wrote:
Quoted 16 lines · Steven Rostedt
Quoted 9 lines · On Mon, 22 Aug 2022 14:48:30 -0700 Dave Jiang <[email protected]> wrote:

Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse:

    check-events.sh-5983    [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1
d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add
r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub
' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK
    GROUP|BANK|COLUMN'
Quoted 4 lines

Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields?

Quoted 5 lines

What's the format for this event? That is, what is the output of :

trace-cmd list -e cxl_dram_event -F

?

#trace-cmd list -e cxl_dram_event -F
system: cxl_events
name: cxl_dram_event
ID: 2325
format:

          field:unsigned short common_type;       offset:0;       size:2; signed:0;
          field:unsigned char common_flags;       offset:2;       size:1; signed:0;
          field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
          field:int common_pid;   offset:4;       size:4; signed:1;

          field:__data_loc char[] dev_name;       offset:8;       size:4; signed:1;
          field:int log;  offset:12;      size:4; signed:1;
          field:u8 id[16];        offset:16;      size:16;        signed:0;
          field:u32 flags;        offset:32;      size:4; signed:0;
          field:u16 handle;       offset:36;      size:2; signed:0;
          field:u16 related_handle;       offset:38;      size:2; signed:0;
          field:u64 timestamp;    offset:40;      size:8; signed:0;
          field:u64 phys_addr;    offset:48;      size:8; signed:0;
          field:u8 descriptor;    offset:56;      size:1; signed:0;
          field:u8 type;  offset:57;      size:1; signed:0;
          field:u8 transaction_type;      offset:58;      size:1; signed:0;
          field:u8 channel;       offset:59;      size:1; signed:0;
Quoted 8 lines
          field:u16 validity_flags;       offset:60;      size:2; signed:0;
          field:u16 column;       offset:62;      size:2; signed:0;
          field:u32 nibble_mask;  offset:64;      size:4; signed:0;
          field:u32 row;  offset:68;      size:4; signed:0;
          field:u8 cor_mask[0x20];        offset:72;      size:32;        signed:0;
          field:u8 rank;  offset:104;     size:1; signed:0;
          field:u8 bank_group;    offset:105;     size:1; signed:0;
          field:u8 bank;  offset:106;     size:1; signed:0;

The above are the fields you need. If you want to see how they are formatted in the output, you can add "--full" to the above command and you'll see a "printf" like format.

Your output you showed in the previous email had:

Quoted 2 lines

failed to get field: time <CANT FIND FIELD time>

There's no field "time" above.

Quoted 5 lines

got field: id, len: 16
got field: handle, len: 2 got field: related_handle, len: 2 failed to get field: hdr_flags <CANT FIND FIELD hdr_flags>

Same for "hdr_flags"

Quoted 3 lines

got field: phys_addr, len: 8 failed to get field: volatile <CANT FIND FIELD volatile>

And "volatile"

Quoted 2 lines

failed to get field: desc <CANT FIND FIELD desc>

etc.

Quoted 3 lines

got field: type, len: 1 failed to get field: trans_type <CANT FIND FIELD trans_type>

etc.

Quoted 10 lines

got field: channel, len: 1 got field: rank, len: 1
got field: nibble_mask, len: 4 got field: bank_group, len: 1 got field: bank, len: 1
got field: row, len: 4
got field: column, len: 2 got field: cor_mask, len: 32 failed to get field: valid_flags <CANT FIND FIELD valid_flags>

Quoted 5 lines

etc.

The field names are from the above format, not what you see in the output of the event.

Ok that makes sense. Thanks for the help!

Quoted 2 lines

-- Steve

#5 lore raw
Quoted 98 lines · Dave
Quoted 96 lines · Steven Rostedt
Quoted 42 lines · On Mon, 22 Aug 2022 15:21:01 -0700 Dave Jiang <[email protected]> wrote:
Quoted 11 lines · Steven Rostedt
Quoted 9 lines · On Mon, 22 Aug 2022 14:48:30 -0700 Dave Jiang <[email protected]> wrote:

Attempting to use libtraceevent to retrieve fields from events. For example here's the event I'm trying to parse:

    check-events.sh-5983    [002] ..... 261848.250238: cxl_dram_event: cxl_mem.7: Fatal time=0 id=b3cb1
d60-069c-ab4e-b8af-4e9bfb5c9624 handle=1 related_handle=0 hdr_flags='Performance Degraded': phys_add
r=8000 volatile=FALSE desc='Threshold event' type='Invalid Address' trans_type='Internal Media Scrub
' channel=1 rank=0 nibble_mask=0 bank_group=5 bank=2 row=0 column=1024 cor_mask=00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 valid_flags='CHANNEL|BANK
    GROUP|BANK|COLUMN'
Quoted 8 lines
Quoted 3 lines

Here's me iterating through all the fields and using tep_get_field_raw() trying to retrieve the fields. It appears that if the field is a string type I'm not able to retrieve the field and the error written back in the seq file is "CANT FIND FIELD". Am I doing something wrong or using the wrong API to retrieve those type of fields?

What's the format for this event? That is, what is the output of :

trace-cmd list -e cxl_dram_event -F

?

#trace-cmd list -e cxl_dram_event -F
system: cxl_events
name: cxl_dram_event
ID: 2325
format:

          field:unsigned short common_type;       offset:0;       size:2; signed:0;
          field:unsigned char common_flags;       offset:2;       size:1; signed:0;
          field:unsigned char common_preempt_count;       offset:3;       size:1; signed:0;
          field:int common_pid;   offset:4;       size:4; signed:1;

          field:__data_loc char[] dev_name;       offset:8;       size:4; signed:1;
          field:int log;  offset:12;      size:4; signed:1;
          field:u8 id[16];        offset:16;      size:16;        signed:0;
          field:u32 flags;        offset:32;      size:4; signed:0;
          field:u16 handle;       offset:36;      size:2; signed:0;
          field:u16 related_handle;       offset:38;      size:2; signed:0;
          field:u64 timestamp;    offset:40;      size:8; signed:0;
          field:u64 phys_addr;    offset:48;      size:8; signed:0;
          field:u8 descriptor;    offset:56;      size:1; signed:0;
          field:u8 type;  offset:57;      size:1; signed:0;
          field:u8 transaction_type;      offset:58;      size:1; signed:0;
          field:u8 channel;       offset:59;      size:1; signed:0;
Quoted 8 lines
          field:u16 validity_flags;       offset:60;      size:2; signed:0;
          field:u16 column;       offset:62;      size:2; signed:0;
          field:u32 nibble_mask;  offset:64;      size:4; signed:0;
          field:u32 row;  offset:68;      size:4; signed:0;
          field:u8 cor_mask[0x20];        offset:72;      size:32;        signed:0;
          field:u8 rank;  offset:104;     size:1; signed:0;
          field:u8 bank_group;    offset:105;     size:1; signed:0;
          field:u8 bank;  offset:106;     size:1; signed:0;

The above are the fields you need. If you want to see how they are formatted in the output, you can add "--full" to the above command and you'll see a "printf" like format.

Your output you showed in the previous email had:

Quoted 2 lines

failed to get field: time <CANT FIND FIELD time>

There's no field "time" above.

Quoted 5 lines

got field: id, len: 16
got field: handle, len: 2 got field: related_handle, len: 2 failed to get field: hdr_flags <CANT FIND FIELD hdr_flags>

Same for "hdr_flags"

Quoted 3 lines

got field: phys_addr, len: 8 failed to get field: volatile <CANT FIND FIELD volatile>

And "volatile"

Quoted 2 lines

failed to get field: desc <CANT FIND FIELD desc>

etc.

Quoted 3 lines

got field: type, len: 1 failed to get field: trans_type <CANT FIND FIELD trans_type>

etc.

Quoted 10 lines

got field: channel, len: 1 got field: rank, len: 1
got field: nibble_mask, len: 4 got field: bank_group, len: 1 got field: bank, len: 1
got field: row, len: 4
got field: column, len: 2 got field: cor_mask, len: 32 failed to get field: valid_flags <CANT FIND FIELD valid_flags>

Quoted 7 lines
Quoted 5 lines

etc.

The field names are from the above format, not what you see in the output of the event.

Ok that makes sense. Thanks for the help!

Not sure how I missed this thread. But sounds like for consistency the printk format should match these field names.

I'll add that to the list of cleanup.

Ira