Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yury Norov" <ynorov@nvidia.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-mm@kvack.org, "Rasmus Villemoes" <linux@rasmusvillemoes.dk>,
	"David Hildenbrand" <david@kernel.org>,
	"Gregory Price" <gourry@gourry.net>, "Zi Yan" <ziy@nvidia.com>,
	"Joshua Hahn" <joshua.hahnjy@gmail.com>,
	"Rakie Kim" <rakie.kim@sk.com>,
	"Ying Huang" <ying.huang@linux.alibaba.com>,
	"Muchun Song" <muchun.song@linux.dev>,
	"Oscar Salvador" <osalvador@suse.de>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Kairui Song" <kasong@tencent.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	"Len Brown" <lenb@kernel.org>, "Jens Axboe" <axboe@kernel.dk>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Mel Gorman" <mgorman@suse.de>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	linux-trace-kernel@vger.kernel.org
Cc: "Liam R. Howlett" <liam@infradead.org>,
	"Axel Rasmussen" <axelrasmussen@google.com>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>,
	"Baoquan He" <baoquan.he@linux.dev>,
	"Barry Song" <baohua@kernel.org>,
	"Linus Torvalds" <torvalds@linux-foundation.org>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Michal Hocko" <mhocko@suse.com>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Qi Zheng" <qi.zheng@linux.dev>,
	"Shakeel Butt" <shakeel.butt@linux.dev>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Wei Xu" <weixugc@google.com>, "Yuanchu Xie" <yuanchu@google.com>,
	"Yury Norov" <yury.norov@gmail.com>
Subject: Re: [PATCH 10/11] sched/numa: bound cpuset trace masks by nr_node_ids
Date: Sat, 28 Nov 2026 23:02:56 +0000	[thread overview]
Message-ID: <sashiko-outbox-239132@kernel.org> (raw)
In-Reply-To: <20261127230128.111933-11-ynorov@nvidia.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] sched/numa: unresolvable nr_node_ids in
  sched_skip_cpuset_numa TP_printk()
--

commit 9899bfb4a5bbc8bb11767c04c29e4c3bd6fcb50c
Author: Yury Norov <ynorov@nvidia.com>

sched/numa: bound cpuset trace masks by nr_node_ids

This commit updates the sched_skip_cpuset_numa trace event to copy
mem_allowed using nodes_copy_and_extend() and pass nr_node_ids instead of
MAX_NUMNODES to TP_printk().

> diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
> index 535860581f159..38a2a10cba429 100644
> --- a/include/trace/events/sched.h
> +++ b/include/trace/events/sched.h
> @@ -793,8 +793,9 @@ TRACE_EVENT(sched_skip_cpuset_numa,
>  		__entry->ngid		 = task_numa_group_id(tsk);
>  		BUILD_BUG_ON(sizeof(nodemask_t) != \
>  			     BITS_TO_LONGS(MAX_NUMNODES) * sizeof(long));
> -		memcpy(__entry->mem_allowed, mem_allowed_ptr->bits,
> -		       sizeof(__entry->mem_allowed));
> +		/* Clear unused bits in the fixed-size trace field. */
> +		nodes_copy_and_extend(*(nodemask_t *)__entry->mem_allowed,
> +				      *mem_allowed_ptr);
>  	),
>  
>  	TP_printk("comm=%s pid=%d tgid=%d ngid=%d mem_nodes_allowed=%*pbl",
> @@ -802,7 +803,7 @@ TRACE_EVENT(sched_skip_cpuset_numa,
>  		  __entry->pid,
>  		  __entry->tgid,
>  		  __entry->ngid,
> -		  MAX_NUMNODES, __entry->mem_allowed)
> +		  nr_node_ids, __entry->mem_allowed)

[Severity: Medium]
Does passing nr_node_ids to TP_printk() break userspace trace parsers reading
the sched_skip_cpuset_numa format file?

When MAX_NUMNODES > 1, nr_node_ids is a runtime C variable rather than a
preprocessor constant.  Stage 7 stringifies TP_printk() arguments directly into
the tracefs format file, emitting the literal identifier nr_node_ids into
print fmt where tools like libtraceevent, perf, and trace-cmd cannot resolve
it when decoding raw trace records.

Since nodes_copy_and_extend() already zeroes all bits from nr_node_ids up to
MAX_NUMNODES in __entry->mem_allowed, keeping MAX_NUMNODES in TP_printk() will
still format only the active runtime bit range via %*pbl while keeping the
tracefs format file valid.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261127230128.111933-1-ynorov@nvidia.com?part=10

  reply	other threads:[~2026-11-28 23:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-27 23:01 [PATCH 00/11] nodemask: switch to runtime nr_node_ids Yury Norov
2026-11-27 23:01 ` [PATCH 01/11] nodemask: add 'small' and 'large' compile-time sizes Yury Norov
2026-11-27 23:01 ` [PATCH 02/11] nodemask: pass nodemask length to node search functions Yury Norov
2026-11-27 23:01 ` [PATCH 03/11] mm/mempolicy: reject migrate_pages source IDs beyond nr_node_ids Yury Norov
2026-11-27 23:01 ` [PATCH 04/11] mm/mempolicy: preserve full-width userspace nodemasks Yury Norov
2026-11-27 23:01 ` [PATCH 05/11] mm: switch to runtime nodemask length Yury Norov
2026-11-27 23:01 ` [PATCH 06/11] MIPS: IP27: switch nmi_dump " Yury Norov
2026-11-27 23:01 ` [PATCH 07/11] ACPI: NUMA: switch acpi_map_pxm_to_node " Yury Norov
2026-11-27 23:01 ` [PATCH 08/11] mtip32xx: switch next_online_node() " Yury Norov
2026-11-27 23:01 ` [PATCH 09/11] nodemask: add nodes_copy_and_extend() Yury Norov
2026-11-27 23:01 ` [PATCH 10/11] sched/numa: bound cpuset trace masks by nr_node_ids Yury Norov
2026-11-28 23:02   ` sashiko-bot [this message]
2026-11-27 23:01 ` [PATCH 11/11] nodemask: add cpumask-style operation size bounds Yury Norov
2026-11-28 23:40 ` [PATCH 00/11] nodemask: switch to runtime nr_node_ids Andrew Morton

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=sashiko-outbox-239132@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=axelrasmussen@google.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=baoquan.he@linux.dev \
    --cc=david@kernel.org \
    --cc=gourry@gourry.net \
    --cc=hannes@cmpxchg.org \
    --cc=joshua.hahnjy@gmail.com \
    --cc=kasong@tencent.com \
    --cc=lenb@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=ljs@kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mgorman@suse.de \
    --cc=mhiramat@kernel.org \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterz@infradead.org \
    --cc=qi.zheng@linux.dev \
    --cc=rafael@kernel.org \
    --cc=rakie.kim@sk.com \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=surenb@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=vbabka@kernel.org \
    --cc=weixugc@google.com \
    --cc=ying.huang@linux.alibaba.com \
    --cc=ynorov@nvidia.com \
    --cc=yuanchu@google.com \
    --cc=yury.norov@gmail.com \
    --cc=ziy@nvidia.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