From: wen.yang@linux.dev
To: Gabriele Monaco <gmonaco@redhat.com>
Cc: Nam Cao <namcao@linutronix.de>,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
Wen Yang <wen.yang@linux.dev>
Subject: [PATCH v4 0/4] rv/reactors: fix lockdep warning and add KUnit tests
Date: Fri, 28 Aug 2026 02:22:42 +0800 [thread overview]
Message-ID: <cover.1787854397.git.wen.yang@linux.dev> (raw)
From: Wen Yang <wen.yang@linux.dev>
We occasionally hit a lockdep "Invalid wait context" warning in
production when a reactor callback is preempted by a timer interrupt.
On interrupt exit the scheduler takes rq->__lock (LD_WAIT_SPIN) while
rv_react() still holds its wait-type-override map, which declared
LD_WAIT_FREE. On any kernel where the task context has preemption
enabled (not just CONFIG_PREEMPT_RT) this triggers a spurious lockdep
report:
[ BUG: Invalid wait context ]
1 lock held by kunit_try_catch/209:
#0: (rv_react_map-wait-type-override){+.+.}-{1:1}
kunit_try_catch/209 is trying to lock:
ffff8a743ed3e8a0 (&rq->__lock){-...}-{2:2}
This series switches to a single LD_WAIT_SPIN override, hardens reactor
registration error handling, exports the registration helpers for
modules, and adds KUnit coverage.
Changes in v4:
- Patch 1: replace the context-sensitive two-map wait type with a
single LD_WAIT_SPIN override, and document the constraint.
- Patch 4: use a plain int instead of atomic_t for the test counter,
trim redundant comments.
v3: https://lore.kernel.org/lkml/cover.1786294920.git.wen.yang@linux.dev/
v2: https://lore.kernel.org/lkml/cover.1785695669.git.wen.yang@linux.dev/
v1: https://lore.kernel.org/lkml/cover.1781541556.git.wen.yang@linux.dev/
Wen Yang (4):
rv/reactors: use LD_WAIT_SPIN as the reactor lockdep wait type
rv/reactors: propagate rv_register_reactor() error from reactor init
rv/reactors: export rv_register_reactor() and rv_unregister_reactor()
rv/reactors: add KUnit tests for reactor registration and dispatch
Documentation/trace/rv/monitor_synthesis.rst | 20 ++++
kernel/trace/rv/Kconfig | 12 +++
kernel/trace/rv/Makefile | 1 +
kernel/trace/rv/reactor_panic.c | 3 +-
kernel/trace/rv/reactor_printk.c | 3 +-
kernel/trace/rv/rv_reactors.c | 8 +-
kernel/trace/rv/rv_reactors_kunit.c | 105 +++++++++++++++++++
7 files changed, 147 insertions(+), 5 deletions(-)
create mode 100644 kernel/trace/rv/rv_reactors_kunit.c
base-commit: 785095112f4198de49760552374f364043c8dbdf
--
2.25.1
next reply other threads:[~2026-08-27 18:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 18:22 wen.yang [this message]
2026-08-27 18:22 ` [PATCH v4 1/4] rv/reactors: use LD_WAIT_SPIN as the reactor lockdep wait type wen.yang
2026-08-27 18:36 ` sashiko-bot
2026-08-31 9:48 ` Gabriele Monaco
2026-08-27 18:22 ` [PATCH v4 2/4] rv/reactors: propagate rv_register_reactor() error from reactor init wen.yang
2026-08-27 18:22 ` [PATCH v4 3/4] rv/reactors: export rv_register_reactor() and rv_unregister_reactor() wen.yang
2026-08-27 18:48 ` sashiko-bot
2026-08-27 18:22 ` [PATCH v4 4/4] rv/reactors: add KUnit tests for reactor registration and dispatch wen.yang
2026-08-27 19:02 ` 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=cover.1787854397.git.wen.yang@linux.dev \
--to=wen.yang@linux.dev \
--cc=gmonaco@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=namcao@linutronix.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.