Linux Perf Users
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Thomas Falcon <thomas.falcon@intel.com>
Cc: sashiko-reviews@lists.linux.dev, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v9 4/6] perf tools: Show memory region in perf-c2c subcommand
Date: Mon, 14 Sep 2026 21:07:36 -0300	[thread overview]
Message-ID: <aqiMSGuBkJHjMYei@x2> (raw)
In-Reply-To: <20260914225716.667A11F000FF@smtp.kernel.org>

On Mon, Sep 14, 2026 at 10:57:16PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Medium] perf c2c: valid memory region overwritten by N/A

All the other are minor stuff that I would fix up myself, but there this
one, can you take a look at it, address the other minor ones and post
v10?

Thanks,

- Arnaldo

> - [Low] perf c2c: missing stdio.h inclusion for asprintf
> --
> 
> commit d7af7398254a585e98330957faf348c7603375be
> Author: Dapeng Mi <dapeng1.mi@linux.intel.com>
> 
> perf tools: Show memory region in perf-c2c subcommand
> 
> Add memory region field to the cacheline list view to help users
> identify the memory region to which the cacheline belongs. The memory
> region field was included with the introduction of support for the
> Off-module Response facility (OMR) in Intel's Diamond Rapids and
> Nova Lake architectures.
> 
> Link: https://lore.kernel.org/all/20260114011750.350569-1-dapeng1.mi@linux.intel.com/
> 
> > diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
> > index 715b75d42f2a8..4272f5f22c01f 100644
> > --- a/tools/perf/builtin-c2c.c
> > +++ b/tools/perf/builtin-c2c.c
> > @@ -247,6 +248,16 @@ static void c2c_he__set_node(struct c2c_hist_entry *c2c_he,
> >  	}
> >  }
> >  
> > +static void c2c_he__set_mem_region(struct c2c_hist_entry *c2c_he,
> > +				   unsigned int mem_region)
> > +{
> > +	if (WARN_ONCE(mem_region > PERF_MEM_REGION_MEM7,
> > +		      "WARNING: invalid memory region ID\n"))
> > +		return;
> > +
> > +	c2c_he->mem_region = mem_region;
> 
> [Severity: Medium]
> Does this code unconditionally overwrite a previously recorded valid memory
> region with a new value?
> 
> In process_sample_event(), this is called for every sample grouped into the
> cacheline hist_entry:
> 
> process_sample_event()
>   c2c_he__set_mem_region(c2c_he, mem_region);
> 
> If multiple samples hit the same cacheline, could an earlier sample that
> provides valid OMR region data be overwritten by a later standard sample
> (such as an L1 hit) lacking it? This could result in the cacheline's
> memory region being incorrectly displayed as 'N/A' in the perf c2c output.
> 
> [ ... ]
> 
> > @@ -3271,9 +3353,16 @@ static int perf_c2c__report(int argc, const char **argv)
> >  		goto out_mem2node;
> >  	}
> >  
> > -	if (c2c.display != DISPLAY_SNP_PEER)
> > -		output_str = "cl_idx,"
> > +	c2c.show_mem_region = perf_header__has_feat(&session->header,
> > +						HEADER_MEMORY_RANGES);
> > +	if (c2c.show_mem_region)
> > +		dim_dcacheline.header.line[0].span = 3;
> > +
> > +	if (c2c.display != DISPLAY_SNP_PEER) {
> > +		if (asprintf(&output_str,
> > +			     "cl_idx,"
> 
> [Severity: Low]
> Does this file explicitly include <stdio.h> for asprintf?
> 
> Since musl libc enforces strict POSIX header separation and doesn't
> implicitly include headers, omitting <stdio.h> here could lead to build
> failures when compiling perf with a musl libc toolchain.
> 
> >  			     "dcacheline,"
> > +			     "%s"
> 
> -- 
> Sashiko AI review · https://sashiko.dev/#/patchset/20260914224650.52982-1-thomas.falcon@intel.com?part=4

  reply	other threads:[~2026-09-15  0:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14 22:46 [PATCH v9 0/6] perf: Add support for memory region/range reporting Thomas Falcon
2026-09-14 22:46 ` [PATCH v9 1/6] perf mem: Fix size tracking for mem_lvl's in perf_script__meminfo_scnprintf() Thomas Falcon
2026-09-14 22:53   ` sashiko-bot
2026-09-14 22:46 ` [PATCH v9 2/6] perf mem: Add support for printing PERF_MEM_LVLNUM_L0 Thomas Falcon
2026-09-14 22:52   ` sashiko-bot
2026-09-14 22:46 ` [PATCH v9 3/6] perf header: Support memory ranges Thomas Falcon
2026-09-14 23:14   ` sashiko-bot
2026-09-14 22:46 ` [PATCH v9 4/6] perf tools: Show memory region in perf-c2c subcommand Thomas Falcon
2026-09-14 22:57   ` sashiko-bot
2026-09-15  0:07     ` Arnaldo Carvalho de Melo [this message]
2026-09-15 16:01       ` Falcon, Thomas
2026-09-15  5:11   ` Mi, Dapeng
2026-09-14 22:46 ` [PATCH v9 5/6] perf tools: Show memory region in perf-script subcommand Thomas Falcon
2026-09-14 22:59   ` sashiko-bot
2026-09-15  5:12   ` Mi, Dapeng
2026-09-14 22:46 ` [PATCH v9 6/6] perf c2c: print memory region data with stdio output Thomas Falcon
2026-09-14 22:54   ` 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=aqiMSGuBkJHjMYei@x2 \
    --to=acme@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=thomas.falcon@intel.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