Linux Perf Users
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>, 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,
	Jiawei Sun <abyssmystery@gmail.com>
Subject: [PATCH] tools/lib/api: Check nonfilterable in fdarray__filter()
Date: Fri, 10 Jul 2026 12:42:22 -0700	[thread overview]
Message-ID: <20260710194222.1788638-1-namhyung@kernel.org> (raw)

IIUC fdarray__filter() should check filterable events only and leave
non-filterable events to be handled outside.  The recent change to set
fd to -1 made perf record test stuck forever.  Adding the check the flag
fixes the problem for me.

Before:
  $ timeout 100 sudo perf test 105
  105: perf record tests                                     : Running (1 active)

  Signal (15) while running tests.
  Terminating tests with the same signal
  Internal test harness failure. Completing any started tests:
  105: perf record tests                                     : FAILED!

  === Test Summary ===
  Passed main tests : 0
  Passed subtests   : 0
  Skipped tests     : 0
  Failed tests      : 1
  List of failed tests:
    105: perf record tests

After:
  $ time sudo perf test 105
  105: perf record tests                                     : Ok

  === Test Summary ===
  Passed main tests : 1
  Passed subtests   : 0
  Skipped tests     : 0
  Failed tests      : 0

  real	0m52.472s
  user	0m0.830s
  sys	0m0.535s

Fixes:f94563fac269 ("perf record: fix poll storm when monitored threads exit")
Cc: Jiawei Sun <abyssmystery@gmail.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/lib/api/fd/array.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/lib/api/fd/array.c b/tools/lib/api/fd/array.c
index ffe8272af59b2da0..b4570e4981492cd7 100644
--- a/tools/lib/api/fd/array.c
+++ b/tools/lib/api/fd/array.c
@@ -117,6 +117,8 @@ int fdarray__filter(struct fdarray *fda, short revents,
 	for (fd = 0; fd < fda->nr; ++fd) {
 		if (!fda->entries[fd].events)
 			continue;
+		if (fda->priv[fd].flags & fdarray_flag__nonfilterable)
+			continue;
 
 		if (fda->entries[fd].revents & revents) {
 			if (entry_destructor)
@@ -132,8 +134,7 @@ int fdarray__filter(struct fdarray *fda, short revents,
 			continue;
 		}
 
-		if (!(fda->priv[fd].flags & fdarray_flag__nonfilterable))
-			++nr;
+		++nr;
 	}
 
 	return nr;
-- 
2.55.0.795.g602f6c329a-goog


             reply	other threads:[~2026-07-10 19:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-10 19:42 Namhyung Kim [this message]
2026-07-10 20:01 ` [PATCH] tools/lib/api: Check nonfilterable in fdarray__filter() sashiko-bot
2026-07-10 21:51   ` Namhyung Kim

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=20260710194222.1788638-1-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=abyssmystery@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox