Re: [PATCH v3] dma: Trace API
From: Sean Anderson
Date: Thu Sep 05 2024 - 13:00:12 EST
On 9/3/24 20:53, Steven Rostedt wrote:
> On Tue, 3 Sep 2024 10:36:29 -0400
> Sean Anderson <sean.anderson@xxxxxxxxx> wrote:
>
>> This doesn't apply for arrays:
>>
>> field:__data_loc u64[] addrs; offset:12; size:4; signed:0;
>>
>> Here the size is not for the data type but for the array. And so the
>> type is parsed by process_sizeof in src/event-parse.c.
>
> Ah, I see what you are talking about:
>
> + TP_printk("%s dir=%s phys_addrs=%s attrs=%s",
> + __get_str(device),
> + decode_dma_data_direction(__entry->dir),
> + __print_array(__get_dynamic_array(addrs),
> + __get_dynamic_array_len(addrs) /
> + sizeof(unsigned long long), sizeof(unsigned long long)),
> + decode_dma_attrs(__entry->attrs))
>
> That part.
>
> Yeah, the "sizeof()" parsing is somewhat of a hack. It would be trivial to
> add u64 and all the variants to that.
>
> This should do. I could get it into the next minor version.
>
> diff --git a/src/event-parse.c b/src/event-parse.c
> index ddeb3b9909c0..73563c8e9dea 100644
> --- a/src/event-parse.c
> +++ b/src/event-parse.c
> @@ -3571,6 +3571,23 @@ process_sizeof(struct tep_event *event, struct tep_print_arg *arg, char **tok)
> /* The token is the next token */
> token_has_paren = true;
> }
> +
> + } else if (strcmp(token, "__u64") == 0 || strcmp(token, "u64") == 0 ||
> + strcmp(token, "__s64") == 0 || strcmp(token, "s64") == 0) {
> + arg->atom.atom = strdup("8");
> +
> + } else if (strcmp(token, "__u32") == 0 || strcmp(token, "u32") == 0 ||
> + strcmp(token, "__s32") == 0 || strcmp(token, "s32") == 0) {
> + arg->atom.atom = strdup("4");
> +
> + } else if (strcmp(token, "__u16") == 0 || strcmp(token, "u16") == 0 ||
> + strcmp(token, "__s16") == 0 || strcmp(token, "s16") == 0) {
> + arg->atom.atom = strdup("2");
> +
> + } else if (strcmp(token, "__u8") == 0 || strcmp(token, "u8") == 0 ||
> + strcmp(token, "__s8") == 0 || strcmp(token, "s8") == 0) {
> + arg->atom.atom = strdup("1");
> +
> } else if (strcmp(token, "REC") == 0) {
>
> free_token(token);
The above patch fixes the issue for me. Feel free to add
Tested-by: Sean Anderson <sean.anderson@xxxxxxxxx>
when you send it.
--Sean