Re: [PATCH v5 0/4] perf annotate-data: Support flexible array types

From: Namhyung Kim

Date: Sat Sep 19 2026 - 13:56:46 EST


On Sat, Sep 19, 2026 at 09:18:55AM -0700, Ian Rogers wrote:
> On Fri, Sep 18, 2026 at 11:37 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > Hello,
> >
> > The flexible arrays are dynamically allocated with different size. So checking
> > with the original type size won't match and cannot find the type if the offset
> > is bigger than the size. This patch series detects those flex-arrays and allows
> > accesses beyong the original size.
> >
> > I'm not sure what's the best way to add test codes for data type profiling as it
> > seems we need to add a lot more workloads for different cases. Probably we may
> > want to split the workloads as separate binaries.
>
> We have tools/perf/tests/shell/data_type_profiling.sh, I wonder can we
> not just have some workload with a:
> ```
> struct flex_array {
> int len;
> int vals[];
> };
> ```
> then create a randomly sized flex array and access it in a loop something like:
> ```
> struct flex_array *a = calloc(sizeof(*a) + random_number * sizeof(int));
> a->len = random_number;
> while (!done) { /* done is set by an alarm like with noploop */
> for (int i = 0; i < a->len; i++) {
> a[i]++; /* Expect blame on struct flex_array here */
> }
> }
> ```
> ensuring the type profile blames the struct flex_array?

Sure, I can add that.

But I was afraid it'd need many small workloads to check data type
profiling behavior for different aspects. Maybe we can think about it
later when we need more. :)

Thanks,
Namhyung