From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>, Namhyung Kim <namhyung@kernel.org>
Cc: Veronika Molnarova <vmolnaro@redhat.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@arm.com>, Jiri Olsa <jolsa@kernel.org>,
Kan Liang <kan.liang@linux.intel.com>,
Michael Petlan <mpetlan@redhat.com>,
Radostin Stoyanov <rstoyano@redhat.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] perf tests pmu: Initialize all fields of test_pmu variable
Date: Thu, 29 Aug 2024 18:09:10 -0300 [thread overview]
Message-ID: <ZtDjdt1QwbxJVKZ0@x1> (raw)
In-Reply-To: <CAP-5=fXFH8aqxzCVAgRRdZufUdiC2UMBApEeSnak3yhZ_CXNyA@mail.gmail.com>
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@redhat.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@redhat.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
next prev parent reply other threads:[~2024-08-29 21:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 13:03 [PATCH 1/1] perf tests pmu: Initialize all fields of test_pmu variable Arnaldo Carvalho de Melo
2024-08-12 14:05 ` Veronika Molnarova
2024-08-29 20:17 ` Ian Rogers
2024-08-29 21:09 ` Arnaldo Carvalho de Melo [this message]
2024-08-30 3:49 ` Namhyung Kim
2024-08-30 13:37 ` Arnaldo Carvalho de Melo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZtDjdt1QwbxJVKZ0@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@arm.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.org \
--cc=rstoyano@redhat.com \
--cc=vmolnaro@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox