From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v1 2/5] perf test: Make sure maps to have a machine
Date: Sun, 18 Oct 2026 22:36:35 -0700 [thread overview]
Message-ID: <atWsYwyWGxPc9VcR@z2> (raw)
In-Reply-To: <CAP-5=fWt5r++c1=BnM+459WsiZiwvihGpcjZ+j5_6Kr4P7sDUw@mail.gmail.com>
On Sun, Oct 18, 2026 at 01:33:45PM -0700, Ian Rogers wrote:
> On Sun, Oct 18, 2026 at 9:37 AM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > It's be easier if we could guarantee that maps always have a machine.
> > IIUC this is true for all real use cases, but only the test code has
> > an exception. Let's get rid of it and make sure they have machines.
> >
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> > tools/perf/tests/maps.c | 15 +++++++++++++--
> > 1 file changed, 13 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/tests/maps.c b/tools/perf/tests/maps.c
> > index 2c05d62f40dcdf72..f40b68f5fa5fe2c1 100644
> > --- a/tools/perf/tests/maps.c
> > +++ b/tools/perf/tests/maps.c
> > @@ -1,5 +1,6 @@
> > // SPDX-License-Identifier: GPL-2.0
> > #include <inttypes.h>
> > +#include <unistd.h>
> > #include <linux/compiler.h>
> > #include <linux/kernel.h>
> > #include "tests.h"
> > @@ -100,8 +101,12 @@ static int test__maps__merge_in(struct test_suite *t __maybe_unused, int subtest
> > };
> > struct map *map_kcore1, *map_kcore2, *map_kcore3;
> > int ret;
> > - struct maps *maps = maps__new(NULL);
> > + struct machine *machine = machine__new_live(/*host_env=*/NULL,
> > + /*kernel_maps=*/false,
> > + getpid());
> > + struct maps *maps = maps__new(machine);
> >
> > + TEST_ASSERT_VAL("failed to create machine", machine);
> > TEST_ASSERT_VAL("failed to create maps", maps);
> >
> > for (i = 0; i < ARRAY_SIZE(bpf_progs); i++) {
> > @@ -159,6 +164,7 @@ static int test__maps__merge_in(struct test_suite *t __maybe_unused, int subtest
> > map__zput(map_kcore1);
> > map__zput(map_kcore2);
> > map__zput(map_kcore3);
> > + machine__delete(machine);
> > return TEST_OK;
> > }
> >
> > @@ -189,8 +195,12 @@ static int test__maps__fixup_overlap_and_insert(struct test_suite *t __maybe_unu
> > struct map *map_split, *map_eclipse;
> > int ret;
> > unsigned int i;
> > - struct maps *maps = maps__new(NULL);
> > + struct machine *machine = machine__new_live(/*host_env=*/NULL,
> > + /*kernel_maps=*/false,
> > + getpid());
>
> For completeness should we pass in a host_env like in builtin-top.c?
> https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/builtin-top.c?h=perf-tools-next#n1661
Sure, will add in v2.
Thanks,
Namhyung
next prev parent reply other threads:[~2026-10-19 5:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 16:37 [PATCH v1 1/5] perf test: Fix a memory leak in PE file parsing test Namhyung Kim
2026-10-18 16:37 ` [PATCH v1 2/5] perf test: Make sure maps to have a machine Namhyung Kim
2026-10-18 16:43 ` sashiko-bot
2026-10-18 20:33 ` Ian Rogers
2026-10-19 5:36 ` Namhyung Kim [this message]
2026-10-18 16:37 ` [PATCH v1 3/5] perf tools: Remove NULL check for maps__machine() Namhyung Kim
2026-10-18 16:42 ` sashiko-bot
2026-10-18 16:37 ` [PATCH v1 4/5] perf symbol: Check result when reading section headers Namhyung Kim
2026-10-18 16:40 ` sashiko-bot
2026-10-18 16:37 ` [PATCH v1 5/5] perf symbol: Ensure dso__set_is_64_bit() for libbfd Namhyung Kim
2026-10-18 16:44 ` sashiko-bot
2026-10-19 5:38 ` Namhyung Kim
2026-10-18 16:40 ` [PATCH v1 1/5] perf test: Fix a memory leak in PE file parsing test sashiko-bot
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=atWsYwyWGxPc9VcR@z2 \
--to=namhyung@kernel.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.