Patch "perf expr: Fix "has_event" function for metric style events" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    perf expr: Fix "has_event" function for metric style events

to the 6.6-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-expr-fix-has_event-function-for-metric-style-ev.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2ccffb344d48da866dd65d9096f0f2aa8aeba593
Author: Ian Rogers <irogers@xxxxxxxxxx>
Date:   Fri Feb 9 12:49:45 2024 -0800

    perf expr: Fix "has_event" function for metric style events
    
    [ Upstream commit 6dd76680b925228312756c13b9b983661b552a64 ]
    
    Events in metrics cannot use '/' as a separator, it would be
    recognized as a divide, so they use '@'. The '@' is recognized in the
    metricgroups code and changed to '/', do the same in the has_event
    function so that the parsing is only tried without the @s.
    
    Fixes: 4a4a9bf9075f ("perf expr: Add has_event function")
    Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
    Reviewed-by: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
    Cc: K Prateek Nayak <kprateek.nayak@xxxxxxx>
    Cc: James Clark <james.clark@xxxxxxx>
    Cc: Kaige Ye <ye@xxxxxxxxx>
    Cc: John Garry <john.g.garry@xxxxxxxxxx>
    Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240209204947.3873294-3-irogers@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c
index 4488f306de785..80cf2478f98fc 100644
--- a/tools/perf/util/expr.c
+++ b/tools/perf/util/expr.c
@@ -500,7 +500,25 @@ double expr__has_event(const struct expr_parse_ctx *ctx, bool compute_ids, const
 	tmp = evlist__new();
 	if (!tmp)
 		return NAN;
-	ret = parse_event(tmp, id) ? 0 : 1;
+
+	if (strchr(id, '@')) {
+		char *tmp_id, *p;
+
+		tmp_id = strdup(id);
+		if (!tmp_id) {
+			ret = NAN;
+			goto out;
+		}
+		p = strchr(tmp_id, '@');
+		*p = '/';
+		p = strrchr(tmp_id, '@');
+		*p = '/';
+		ret = parse_event(tmp, tmp_id) ? 0 : 1;
+		free(tmp_id);
+	} else {
+		ret = parse_event(tmp, id) ? 0 : 1;
+	}
+out:
 	evlist__delete(tmp);
 	return ret;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux