diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2024-10-10 12:25:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2024-10-10 12:25:32 -0700 |
commit | 0edab8d1324dfeee52aad763236c9015e413c4c2 (patch) | |
tree | 178700158c02c7e55c1849266eff4acb623f6ae1 /kernel | |
parent | eb952c47d154ba2aac794b99c66c3c45eb4cc4ec (diff) | |
parent | 912da2c384d510ce40c5af9c3adc316afa4ec547 (diff) | |
download | linux-0edab8d1324dfeee52aad763236c9015e413c4c2.tar.gz linux-0edab8d1324dfeee52aad763236c9015e413c4c2.tar.bz2 linux-0edab8d1324dfeee52aad763236c9015e413c4c2.zip |
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
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/ring_buffer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c index 77dc0b25140e..fb04445f92c3 100644 --- a/kernel/trace/ring_buffer.c +++ b/kernel/trace/ring_buffer.c @@ -2337,9 +2337,12 @@ static struct trace_buffer *alloc_buffer(unsigned long size, unsigned flags, if (!buffer->buffers[cpu]) goto fail_free_buffers; - ret = cpuhp_state_add_instance(CPUHP_TRACE_RB_PREPARE, &buffer->node); - if (ret < 0) - goto fail_free_buffers; + /* If already mapped, do not hook to CPU hotplug */ + if (!start) { + ret = cpuhp_state_add_instance(CPUHP_TRACE_RB_PREPARE, &buffer->node); + if (ret < 0) + goto fail_free_buffers; + } mutex_init(&buffer->mutex); |