mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for vineash" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: vineash <vineash30640@gmail.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: perf/core] perf/x86: Don't WARN when the ext_regs_buf allocation fails
Date: Fri, 16 Oct 2026 08:01:09 -0000	[thread overview]
Message-ID: <179213766956.2666988.5589345438223076331.tip-bot2@tip-bot2> (raw)
In-Reply-To: <179187920064.3441876.15687522011658301558@gmail.com>

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     f5a78ecccd98a04c47cea1cd63c2a2fdce8a4b48
Gitweb:        https://git.kernel.org/tip/f5a78ecccd98a04c47cea1cd63c2a2fdce8a4b48
Author:        vineash <vineash30640@gmail.com>
AuthorDate:    Tue, 13 Oct 2026 16:13:20 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Fri, 16 Oct 2026 09:49:05 +02:00

perf/x86: Don't WARN when the ext_regs_buf allocation fails

reserve_ext_regs_buffers() wraps the per-CPU ext_regs_buf allocation in
WARN_ON_ONCE(). The allocator already prints a warning with a stack dump
when a GFP_KERNEL allocation fails, so the WARN only repeats it, which
Documentation/process/coding-style.rst asks not to do. The failure is
also handled: the buffers are freed again, the event is still created,
and events that ask for SIMD or extended register sampling are rejected
with -ENOMEM in x86_pmu_hw_config() and event_simd_regs_validate().

syzkaller hit this with fault injection on next-20261002. The trigger
is a plain hardware cycles event opened while no other x86 PMU event
exists, with the allocation failed:

  !per_cpu(ext_regs_buf, cpu)
  WARNING: arch/x86/events/core.c:441 at reserve_ext_regs_buffers arch/x86/events/core.c:441 [inline]
  WARNING: arch/x86/events/core.c:441 at x86_reserve_hardware+0x6ff/0x880 arch/x86/events/core.c:458
  Call Trace:
   __x86_pmu_event_init arch/x86/events/core.c:825 [inline]
   x86_pmu_event_init+0x109/0xc50 arch/x86/events/core.c:3003
   perf_try_init_event+0x140/0xbc0 kernel/events/core.c:13261
   perf_init_event kernel/events/core.c:13365 [inline]
   perf_event_alloc+0x2145/0x5680 kernel/events/core.c:13640
   __do_sys_perf_event_open+0x669/0x2d40 kernel/events/core.c:14185
   do_syscall_64+0x12c/0x7b0 arch/x86/entry/syscall_64.c:84
   entry_SYSCALL_64_after_hwframe+0x77/0x7f

Drop the WARN_ON_ONCE(). This matches reserve_ds_buffers() and
reserve_lbr_buffers(), which also handle allocation failure without a
warning.

Fixes: b84c96283684 ("perf/x86: Enable XMM register sampling for non-PEBS events")
Assisted-by: Claude:claude-opus-5-5 syzkaller
Signed-off-by: vineash <vineash30640@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/179187920064.3441876.15687522011658301558@gmail.com
---
 arch/x86/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/core.c b/arch/x86/events/core.c
index 9b1a903..4df792b 100644
--- a/arch/x86/events/core.c
+++ b/arch/x86/events/core.c
@@ -438,7 +438,7 @@ static void reserve_ext_regs_buffers(void)
 	for_each_possible_cpu(cpu) {
 		per_cpu(ext_regs_buf, cpu) = kzalloc_node(size, GFP_KERNEL,
 							  cpu_to_node(cpu));
-		if (WARN_ON_ONCE(!per_cpu(ext_regs_buf, cpu)))
+		if (!per_cpu(ext_regs_buf, cpu))
 			goto err;
 	}
 

      reply	other threads:[~2026-10-16  8:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  8:13 [PATCH] " vineash
2026-10-16  8:01 ` tip-bot2 for vineash [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=179213766956.2666988.5589345438223076331.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=vineash30640@gmail.com \
    --cc=x86@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

all inboxes | Powered by JetHome®