tracing/user_events: Share state with existing threads
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest posting 2/23 patches 5 repliesIn review
- v2 posting 1/22 patches 0 repliesSuperseded
- v12 patches 0 repliesSuperseded
Changes in v2 from the cover letter
- Split the duplicate-enabler locking correction into a preparatory patch.
- Protect duplicate-enabler traversal with event_mutex.
- Document and assert the group reg_mutex contract.
- Simplify existing-thread attachment around user_event_mms_lock.
- Serialize the final tasks decrement and list removal with lookup and attachment.
- Keep the regression selftest as the final patch.
Patches in v2 posting 2/2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | tracing/user_events: Serialize duplicate enabler lookup with event removalkernel/ | +9 | 0 replies | |
| 2/3 | tracing/user_events: Share event state with existing threadskernel/ | +37 | 0 replies | |
| 3/3 | selftests/user_events: Test registration from existing threadstools/ | +125 | 0 replies |
Reviews trailers per patch
None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Beau Belgrave |
|---|---|
| Series | R-b |
| 1/3 | |
| 2/3 | |
| 3/3 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/3] tracing/user_events: Share state with existing threads
A thread created before the first user_events registration can share an mm with another thread while retaining a NULL user_event_mm. If it later registers an event, it can create independent registration state instead of observing the state already associated with the shared mm. This allows pre-existing threads in one address space to register different events using the same enable address and bit.
Patch 1 fixes a locking issue found while reviewing this path. Duplicate enabler lookup performs a plain traversal of the enabler list, while asynchronous fault cleanup can remove entries under event_mutex. Serialize the traversal with that cleanup.
Patch 2 finds the already-published user_event_mm for the current mm and attaches the pre-existing thread to it. The global list lock serializes lookup and attachment with the final task-count decrement and list removal.
Patch 3 adds a regression test covering two pre-existing threads that attempt to register different events at the same enable address and bit.
Tested on 7.3.0-rc6 with virtme-ng:
- user_events ftrace_test: 6/6 passed
- user_events dyn_test: 4/4 passed
- user_events perf_test: 2/2 passed
- user_events abi_test: 7/7 passed
The user.preexisting_threads_same_address test passed.
Changes since v1:
- Split the duplicate-enabler locking correction into a preparatory patch.
- Protect duplicate-enabler traversal with event_mutex.
- Document and assert the group reg_mutex contract.
- Simplify existing-thread attachment around user_event_mms_lock.
- Serialize the final tasks decrement and list removal with lookup and attachment.
- Keep the regression selftest as the final patch.
Jeff Barnes (3):
tracing/user_events: Serialize duplicate enabler lookup with event
removal
tracing/user_events: Share event state with existing threads selftests/user_events: Test registration from existing threads
kernel/trace/trace_events_user.c | 56 ++++++-- .../testing/selftests/user_events/abi_test.c | 125 ++++++++++++++++++ 2 files changed, 171 insertions(+), 10 deletions(-)
base-commit: a90ee4305c4a5df72c11b31dacfdc76e00fcf78a
Signature · 1 line
2.43.0