summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/perf
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2022-06-21 19:02:44 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-06-22 22:40:28 +0100
commit04a4ecd767c1bc33c0165792779f5d961aefd5f6 (patch)
tree82da4b2ff798216a031a657eb14c760032ddee65 /meta/recipes-kernel/perf
parentfcd9594e80da2a34ab410e98049b616f62396755 (diff)
downloadpoky-04a4ecd767c1bc33c0165792779f5d961aefd5f6.tar.gz
perf: sort-pmuevents: really keep array terminators
Commit e1382583cd50 ("perf: sort-pmuevents: don't drop elements") tried to fix a case where the array terminator elements were dropped from the sorted list breaking the build, but it only worked for the case where the terminator is the only element of the array. When the array has other elements the terminator will still be silently dropped, causing invalid memory accesses at runtime when the perf utility iterates over the array. Fix this by treating any unmatched entry as an array terminator and also add a comment to make it a little more clear how things are ending up at the right position in the sorted list. (From OE-Core rev: 69c35a48c5100b884f1b633142b07222b9390e92) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel/perf')
-rwxr-xr-xmeta/recipes-kernel/perf/perf/sort-pmuevents.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/meta/recipes-kernel/perf/perf/sort-pmuevents.py b/meta/recipes-kernel/perf/perf/sort-pmuevents.py
index 09ba3328a7..0362f2d8fa 100755
--- a/meta/recipes-kernel/perf/perf/sort-pmuevents.py
+++ b/meta/recipes-kernel/perf/perf/sort-pmuevents.py
@@ -62,7 +62,10 @@ for struct in re.findall( struct_block_regex, data ):
62 #print( " name found: %s" % name.group(1) ) 62 #print( " name found: %s" % name.group(1) )
63 entry_dict[struct[2]]['fields'][name.group(1)] = entry 63 entry_dict[struct[2]]['fields'][name.group(1)] = entry
64 64
65 if not entry_dict[struct[2]]['fields']: 65 # unmatched entries are most likely array terminators and
66 # should end up as the last element in the sorted list, which
67 # is achieved by using '0' as the key
68 if not cpuid and not name:
66 entry_dict[struct[2]]['fields']['0'] = entry 69 entry_dict[struct[2]]['fields']['0'] = entry
67 70
68# created ordered dictionaries from the captured values. These are ordered by 71# created ordered dictionaries from the captured values. These are ordered by