Skip to content

Commit 0edab8d

Browse files
committed
Merge tag 'trace-ringbuffer-v6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull tracing fix from Steven Rostedt: "Ring-buffer fix: do not have boot-mapped buffers use CPU hotplug callbacks When a ring buffer is mapped to memory assigned at boot, it also splits it up evenly between the possible CPUs. But the allocation code still attached a CPU notifier callback to this ring buffer. When a CPU is added, the callback will happen and another per-cpu buffer is created for the ring buffer. But for boot mapped buffers, there is no room to add another one (as they were all created already). The result of calling the CPU hotplug notifier on a boot mapped ring buffer is unpredictable and could lead to a system crash. If the ring buffer is boot mapped simply do not attach the CPU notifier to it" * tag 'trace-ringbuffer-v6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: ring-buffer: Do not have boot mapped buffers hook to CPU hotplug
2 parents eb952c4 + 912da2c commit 0edab8d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

kernel/trace/ring_buffer.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,9 +2337,12 @@ static struct trace_buffer *alloc_buffer(unsigned long size, unsigned flags,
23372337
if (!buffer->buffers[cpu])
23382338
goto fail_free_buffers;
23392339

2340-
ret = cpuhp_state_add_instance(CPUHP_TRACE_RB_PREPARE, &buffer->node);
2341-
if (ret < 0)
2342-
goto fail_free_buffers;
2340+
/* If already mapped, do not hook to CPU hotplug */
2341+
if (!start) {
2342+
ret = cpuhp_state_add_instance(CPUHP_TRACE_RB_PREPARE, &buffer->node);
2343+
if (ret < 0)
2344+
goto fail_free_buffers;
2345+
}
23432346

23442347
mutex_init(&buffer->mutex);
23452348

0 commit comments

Comments
 (0)