Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Falcon" <thomas.falcon@intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v9 3/6] perf header: Support memory ranges
Date: Mon, 14 Sep 2026 23:14:27 +0000	[thread overview]
Message-ID: <20260914231432.810751F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260914224650.52982-4-thomas.falcon@intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: missing <fcntl.h> for POSIX file operations
--

commit 3d29383e185965a287c0130b763ba9ba19b03791
Author: Thomas Falcon <thomas.falcon@intel.com>

perf header: Support memory ranges

This patch parses memory range data from the ACPI MRRM table exposed via
sysfs and saves it in the header of the perf data file under a new feature
bit. Memory range data can then be viewed with perf-report and perf-script.

Link: https://lore.kernel.org/lkml/20250505173819.419271-1-tony.luck@intel.com/

> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 7db7da090a1e0..83416ce395d7c 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
[ ... ]
> @@ -1892,6 +1893,132 @@ static int write_cpu_domain_info(struct feat_fd *ff,
>  	return ret;
>  }
>  
> +static int memory_range__read(struct memory_range *range, const char *path)
> +{
> +	char buf[32];
> +	ssize_t n;
> +	int dfd, fd, tmp, ret = -1;
> +
> +	dfd = open(path, O_RDONLY | O_DIRECTORY);

[Severity: Low]
Should we explicitly include <fcntl.h> for these POSIX file operations?

The standard strictly requires <fcntl.h> for open(), openat(), and constants
like O_DIRECTORY. Because tools/perf/util/header.c does not explicitly include
it, this can lead to build failures in environments like musl libc that
enforce strict namespace separation.

> +	if (dfd < 0)
> +		return -1;
> +
> +#define _R(name, dst, conv)			\
> +	fd = openat(dfd, name, O_RDONLY);	\
> +	if (fd < 0)				\
> +		goto out;			\
> +	n = read(fd, buf, sizeof(buf) - 1);	\

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260914224650.52982-1-thomas.falcon@intel.com?part=3

  reply	other threads:[~2026-09-14 23:14 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 [this message]
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
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=20260914231432.810751F000FF@smtp.kernel.org \
    --to=sashiko-bot@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