linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: Leo Yan <leo.yan@arm.com>, Ian Rogers <irogers@google.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] perf cpumap: Add checking for reference counter
Date: Mon, 9 Dec 2024 12:02:00 -0300	[thread overview]
Message-ID: <Z1cGaEbmDLUDpy1S@x1> (raw)
In-Reply-To: <a584b2da-7463-41c4-885c-1ff13e69b08a@intel.com>

On Fri, Nov 15, 2024 at 10:49:01AM +0200, Adrian Hunter wrote:
> On 7/11/24 14:53, Leo Yan wrote:
> > For the CPU map merging test, add an extra check for the reference
> > counter before releasing the last CPU map.
> > 
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> 
> Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>

Thanks, applied the series.

- Arnaldo
 
> > ---
> >  tools/perf/tests/cpumap.c | 9 +++++++++
> >  1 file changed, 9 insertions(+)
> > 
> > diff --git a/tools/perf/tests/cpumap.c b/tools/perf/tests/cpumap.c
> > index f8187a801b8e..5ed7ff072ea3 100644
> > --- a/tools/perf/tests/cpumap.c
> > +++ b/tools/perf/tests/cpumap.c
> > @@ -167,6 +167,15 @@ static int __test__cpu_map_merge(const char *lhs, const char *rhs, int nr, const
> >  	cpu_map__snprint(a, buf, sizeof(buf));
> >  	TEST_ASSERT_VAL("failed to merge map: bad result", !strcmp(buf, expected));
> >  	perf_cpu_map__put(b);
> > +
> > +	/*
> > +	 * If 'b' is a superset of 'a', 'a' points to the same map with the
> > +	 * map 'b'. In this case, the owner 'b' has released the resource above
> > +	 * but 'a' still keeps the ownership, the reference counter should be 1.
> > +	 */
> > +	TEST_ASSERT_VAL("unexpected refcnt: bad result",
> > +			refcount_read(perf_cpu_map__refcnt(a)) == 1);
> > +
> >  	perf_cpu_map__put(a);
> >  	return 0;
> >  }

      reply	other threads:[~2024-12-09 15:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 12:53 [PATCH v2 0/3] perf cpumap: Refactor perf_cpu_map__merge() Leo Yan
2024-11-07 12:53 ` [PATCH v2 1/3] libperf " Leo Yan
2024-11-15  8:38   ` Adrian Hunter
2024-11-07 12:53 ` [PATCH v2 2/3] perf cpumap: Add more tests for CPU map merging Leo Yan
2024-11-15  8:44   ` Adrian Hunter
2024-11-07 12:53 ` [PATCH v2 3/3] perf cpumap: Add checking for reference counter Leo Yan
2024-11-15  8:49   ` Adrian Hunter
2024-12-09 15:02     ` Arnaldo Carvalho de Melo [this message]

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=Z1cGaEbmDLUDpy1S@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).