This is a note to let you know that I've just added the patch titled perf report: Fix -F for branch & mem modes to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: perf-report-fix-f-for-branch-mem-modes.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 6740a4e70e5d1b9d8e7fe41fd46dd5656d65dadf Mon Sep 17 00:00:00 2001 From: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx> Date: Thu, 4 Mar 2021 11:59:58 +0530 Subject: perf report: Fix -F for branch & mem modes From: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx> commit 6740a4e70e5d1b9d8e7fe41fd46dd5656d65dadf upstream. perf report fails to add valid additional fields with -F when used with branch or mem modes. Fix it. Before patch: $ perf record -b $ perf report -b -F +srcline_from --stdio Error: Invalid --fields key: `srcline_from' After patch: $ perf report -b -F +srcline_from --stdio # Samples: 8K of event 'cycles' # Event count (approx.): 8784 ... Committer notes: There was an inversion: when looking at branch stack dimensions (keys) it was checking if the sort mode was 'mem', not 'branch'. Fixes: aa6b3c99236b ("perf report: Make -F more strict like -s") Reported-by: Athira Jajeev <atrajeev@xxxxxxxxxxxxxxxxxx> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxxxxxxxx> Reviewed-by: Athira Jajeev <atrajeev@xxxxxxxxxxxxxxxxxx> Tested-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Tested-by: Athira Jajeev <atrajeev@xxxxxxxxxxxxxxxxxx> Cc: Jiri Olsa <jolsa@xxxxxxxxxx> Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx> Cc: Namhyung Kim <namhyung@xxxxxxxxxx> Link: http://lore.kernel.org/lkml/20210304062958.85465-1-ravi.bangoria@xxxxxxxxxxxxx Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/perf/util/sort.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -3003,7 +3003,7 @@ int output_field_add(struct perf_hpp_lis if (strncasecmp(tok, sd->name, strlen(tok))) continue; - if (sort__mode != SORT_MODE__MEMORY) + if (sort__mode != SORT_MODE__BRANCH) return -EINVAL; return __sort_dimension__add_output(list, sd); @@ -3015,7 +3015,7 @@ int output_field_add(struct perf_hpp_lis if (strncasecmp(tok, sd->name, strlen(tok))) continue; - if (sort__mode != SORT_MODE__BRANCH) + if (sort__mode != SORT_MODE__MEMORY) return -EINVAL; return __sort_dimension__add_output(list, sd); Patches currently in stable-queue which might be from ravi.bangoria@xxxxxxxxxxxxx are queue-5.10/perf-report-fix-f-for-branch-mem-modes.patch