[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtDjdt1QwbxJVKZ0@x1>
Date: Thu, 29 Aug 2024 18:09:10 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>, Namhyung Kim <namhyung@...nel.org>
Cc: Veronika Molnarova <vmolnaro@...hat.com>,
Adrian Hunter <adrian.hunter@...el.com>,
James Clark <james.clark@....com>, Jiri Olsa <jolsa@...nel.org>,
Kan Liang <kan.liang@...ux.intel.com>,
Michael Petlan <mpetlan@...hat.com>,
Radostin Stoyanov <rstoyano@...hat.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/1] perf tests pmu: Initialize all fields of test_pmu
variable
On Thu, Aug 29, 2024 at 01:17:13PM -0700, Ian Rogers wrote:
> On Mon, Aug 12, 2024 at 7:05 AM Veronika Molnarova <vmolnaro@...hat.com> wrote:
> > On 8/12/24 15:03, Arnaldo Carvalho de Melo wrote:
> > > This makes the code more robust, avoiding the error recently fixed when
> > > the .alias_name was used and contained a random value.
> > > +++ b/tools/perf/tests/pmu.c
> > > @@ -458,10 +458,10 @@ static int test__name_cmp(struct test_suite *test __maybe_unused, int subtest __
> > > static int test__pmu_match(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
> > > {
> > > - struct perf_pmu test_pmu;
> > > - test_pmu.alias_name = NULL;
> > > + struct perf_pmu test_pmu = {
> > > + .name = "pmuname",
> > > + };
> > > - test_pmu.name = "pmuname";
> > > TEST_ASSERT_EQUAL("Exact match", perf_pmu__match(&test_pmu, "pmuname"), true);
> > > TEST_ASSERT_EQUAL("Longer token", perf_pmu__match(&test_pmu, "longertoken"), false);
> > > TEST_ASSERT_EQUAL("Shorter token", perf_pmu__match(&test_pmu, "pmu"), false);
> > Reviewed-by: Veronika Molnarova <vmolnaro@...hat.com>
> This seems like a simple enough fix for a test that it could be
> cherry-picked into perf-tools for v6.11, I'm not seeing it currently:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git/log/tools/perf/tests/pmu.c?h=perf-tools
This is not a fix, its just to make the code more future proof by
initializing all non explicitely initialized fields to zeros.
Veronika's fix, that this improves upon, is enough for the problems
detected so far.
Or are you noticing some other bug that gets fixed by my patch?
Ok, now I noticed that Veronika's fix:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools.git/commit/?h=perf-tools&id=37e2a19c98bf99747ca997be876dfc13f9165e0a
is marked with:
perf test pmu: Set uninitialized PMU alias to null
Notice: this object is not reachable from any branch.
Being only in perf-tools-next:
https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/commit/?h=perf-tools-next&id=37e2a19c98bf99747ca997be876dfc13f9165e0a
So yeah, probably Namhyung can cherry-pick that patch (Veronika's) into
perf-tools for v6.11.
There were a few more fixes that I noticed and picked for
perf-tools-next that then people reported that should also be
cherry-picked for v6.11, Namhyung?
- Arnaldo
Powered by blists - more mailing lists