<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/kernel/trace/ring_buffer.c, branch v6.12</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.12</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.12'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2024-11-14T15:01:00Z</updated>
<entry>
<title>Revert: "ring-buffer: Do not have boot mapped buffers hook to CPU hotplug"</title>
<updated>2024-11-14T15:01:00Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-11-14T04:08:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=580bb355bcae7e9a6606ce9644af09b2a793f1bb'/>
<id>urn:sha1:580bb355bcae7e9a6606ce9644af09b2a793f1bb</id>
<content type='text'>
A crash happened when testing cpu hotplug with respect to the memory
mapped ring buffers. It was assumed that the hot plug code was adding a
per CPU buffer that was already created that caused the crash. The real
problem was due to ref counting and was fixed by commit 2cf9733891a4
("ring-buffer: Fix refcount setting of boot mapped buffers").

When a per CPU buffer is created, it will not be created again even with
CPU hotplug, so the fix to not use CPU hotplug was a red herring. In fact,
it caused only the boot CPU buffer to be created, leaving the other CPU
per CPU buffers disabled.

Revert that change as it was not the culprit of the fix it was intended to
be.

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://lore.kernel.org/20241113230839.6c03640f@gandalf.local.home
Fixes: 912da2c384d5 ("ring-buffer: Do not have boot mapped buffers hook to CPU hotplug")
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Fix reader locking when changing the sub buffer order</title>
<updated>2024-10-15T15:18:51Z</updated>
<author>
<name>Petr Pavlu</name>
<email>petr.pavlu@suse.com</email>
</author>
<published>2024-10-15T11:24:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=09661f75e75cb6c1d2d8326a70c311d46729235f'/>
<id>urn:sha1:09661f75e75cb6c1d2d8326a70c311d46729235f</id>
<content type='text'>
The function ring_buffer_subbuf_order_set() updates each
ring_buffer_per_cpu and installs new sub buffers that match the requested
page order. This operation may be invoked concurrently with readers that
rely on some of the modified data, such as the head bit (RB_PAGE_HEAD), or
the ring_buffer_per_cpu.pages and reader_page pointers. However, no
exclusive access is acquired by ring_buffer_subbuf_order_set(). Modifying
the mentioned data while a reader also operates on them can then result in
incorrect memory access and various crashes.

Fix the problem by taking the reader_lock when updating a specific
ring_buffer_per_cpu in ring_buffer_subbuf_order_set().

Link: https://lore.kernel.org/linux-trace-kernel/20240715145141.5528-1-petr.pavlu@suse.com/
Link: https://lore.kernel.org/linux-trace-kernel/20241010195849.2f77cc3f@gandalf.local.home/
Link: https://lore.kernel.org/linux-trace-kernel/20241011112850.17212b25@gandalf.local.home/

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://lore.kernel.org/20241015112440.26987-1-petr.pavlu@suse.com
Fixes: 8e7b58c27b3c ("ring-buffer: Just update the subbuffers when changing their allocation order")
Signed-off-by: Petr Pavlu &lt;petr.pavlu@suse.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Do not have boot mapped buffers hook to CPU hotplug</title>
<updated>2024-10-09T13:24:35Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-10-08T18:32:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=912da2c384d510ce40c5af9c3adc316afa4ec547'/>
<id>urn:sha1:912da2c384d510ce40c5af9c3adc316afa4ec547</id>
<content type='text'>
The boot mapped ring buffer has its buffer mapped at a fixed location
found at boot up. It is not dynamic. It cannot grow or be expanded when
new CPUs come online.

Do not hook fixed memory mapped ring buffers to the CPU hotplug callback,
otherwise it can cause a crash when it tries to add the buffer to the
memory that is already fully occupied.

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Link: https://lore.kernel.org/20241008143242.25e20801@gandalf.local.home
Fixes: be68d63a139bd ("ring-buffer: Add ring_buffer_alloc_range()")
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Align meta-page to sub-buffers for improved TLB usage</title>
<updated>2024-08-26T17:42:23Z</updated>
<author>
<name>Vincent Donnefort</name>
<email>vdonnefort@google.com</email>
</author>
<published>2024-06-28T10:46:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=eb2dcde9f970ed8d3669444d47c8524b4bdf7d32'/>
<id>urn:sha1:eb2dcde9f970ed8d3669444d47c8524b4bdf7d32</id>
<content type='text'>
Previously, the mapped ring-buffer layout caused misalignment between
the meta-page and sub-buffers when the sub-buffer size was not a
multiple of PAGE_SIZE. This prevented hardware with larger TLB entries
from utilizing them effectively.

Add a padding with the zero-page between the meta-page and sub-buffers.
Also update the ring-buffer map_test to verify that padding.

Link: https://lore.kernel.org/20240628104611.1443542-1-vdonnefort@google.com
Signed-off-by: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Add magic and struct size to boot up meta data</title>
<updated>2024-08-26T17:34:22Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-08-15T15:50:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d0f2d6e9512ecf4306c4432761f04bd35cf9e3a6'/>
<id>urn:sha1:d0f2d6e9512ecf4306c4432761f04bd35cf9e3a6</id>
<content type='text'>
Add a magic number as well as save the struct size of the ring_buffer_meta
structure in the meta data to also use as validation. Updating the magic
number could be used to force a invalidation between kernel versions, and
saving the structure size is also a good method to make sure the content
is what is expected.

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Link: https://lore.kernel.org/20240815115032.0c197b32@rorschach.local.home
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Don't reset persistent ring-buffer meta saved addresses</title>
<updated>2024-08-26T17:33:53Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-08-15T15:36:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=bca704f62db2e2bb644fa845e98b08cf1e22f814'/>
<id>urn:sha1:bca704f62db2e2bb644fa845e98b08cf1e22f814</id>
<content type='text'>
The text and data address is saved in the meta data so that it can be used
to know the delta of the text and data addresses of the last boot compared
to the text and data addresses of the current boot. The delta is used to
convert function pointer entries in the ring buffer to something that can
be used by kallsyms (note this only works for built-in functions).

But the saved addresses get reset on boot up. If the buffer is not used
and there's another reboot, then the saved text and data addresses will be
of the last boot and not that of the boot that created the content in the
ring buffer.

To get an idea of the issue:

 # trace-cmd start -B boot_mapped -p function
 # reboot
 # trace-cmd show -B boot_mapped | tail
           &lt;...&gt;-1       [000] d..1.   461.983243: native_apic_msr_write &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983244: __pfx_native_apic_msr_eoi &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983244: reserve_irq_vector_locked &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983262: branch_emulate_op &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983262: __ia32_sys_ia32_pread64 &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983263: native_kick_ap &lt;-__smpboot_create_thread
           &lt;...&gt;-1       [000] d..1.   461.983263: store_cache_disable &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983279: acpi_power_off_prepare &lt;-native_kick_ap
           &lt;...&gt;-1       [000] d..1.   461.983280: __pfx_acpi_ns_delete_node &lt;-acpi_suspend_enter
           &lt;...&gt;-1       [000] d..1.   461.983280: __pfx_acpi_os_release_lock &lt;-acpi_suspend_enter
 # reboot
 # trace-cmd show -B boot_mapped  |tail
           &lt;...&gt;-1       [000] d..1.   461.983243: 0xffffffffa9669220 &lt;-0xffffffffa965f3db
           &lt;...&gt;-1       [000] d..1.   461.983244: 0xffffffffa96690f0 &lt;-0xffffffffa965f3db
           &lt;...&gt;-1       [000] d..1.   461.983244: 0xffffffffa9663fa0 &lt;-0xffffffffa965f3db
           &lt;...&gt;-1       [000] d..1.   461.983262: 0xffffffffa9672e80 &lt;-0xffffffffa965f3e0
           &lt;...&gt;-1       [000] d..1.   461.983262: 0xffffffffa962b940 &lt;-0xffffffffa965f3ec
           &lt;...&gt;-1       [000] d..1.   461.983263: 0xffffffffa965f540 &lt;-0xffffffffa96e1362
           &lt;...&gt;-1       [000] d..1.   461.983263: 0xffffffffa963c940 &lt;-0xffffffffa965f55b
           &lt;...&gt;-1       [000] d..1.   461.983279: 0xffffffffa9ee30c0 &lt;-0xffffffffa965f59b
           &lt;...&gt;-1       [000] d..1.   461.983280: 0xffffffffa9f16c10 &lt;-0xffffffffa9ee3157
           &lt;...&gt;-1       [000] d..1.   461.983280: 0xffffffffa9ee02e0 &lt;-0xffffffffa9ee3157

By not updating the saved text and data addresses in the meta data at
every boot up and only updating them when the buffer is reset, it
allows multiple boots to see the same data.

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Link: https://lore.kernel.org/20240815113629.0dc90af8@rorschach.local.home
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'v6.11-rc3' into trace/ring-buffer/core</title>
<updated>2024-08-14T20:59:28Z</updated>
<author>
<name>Steven Rostedt</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-08-14T20:56:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ee057c8c194b9283f4137b253b70e292693a39f0'/>
<id>urn:sha1:ee057c8c194b9283f4137b253b70e292693a39f0</id>
<content type='text'>
The "reserve_mem" kernel command line parameter has been pulled into
v6.11. Merge the latest -rc3 to allow the persistent ring buffer memory to
be able to be mapped at the address specified by the "reserve_mem" command
line parameter.

Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Remove unused function ring_buffer_nr_pages()</title>
<updated>2024-08-08T00:26:44Z</updated>
<author>
<name>Jianhui Zhou</name>
<email>912460177@qq.com</email>
</author>
<published>2024-08-05T11:36:31Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=58f7e4d7ba32758b861807e77535853cacc1f426'/>
<id>urn:sha1:58f7e4d7ba32758b861807e77535853cacc1f426</id>
<content type='text'>
Because ring_buffer_nr_pages() is not an inline function and user accesses
buffer-&gt;buffers[cpu]-&gt;nr_pages directly, the function ring_buffer_nr_pages
is removed.

Signed-off-by: Jianhui Zhou &lt;912460177@qq.com&gt;
Link: https://lore.kernel.org/tencent_F4A7E9AB337F44E0F4B858D07D19EF460708@qq.com
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>ring-buffer: Use vma_pages() helper function</title>
<updated>2024-07-15T19:09:06Z</updated>
<author>
<name>Thorsten Blum</name>
<email>thorsten.blum@toblux.com</email>
</author>
<published>2024-07-09T21:56:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b96c312551b241bc17226c5347c6d6b38a1efd3e'/>
<id>urn:sha1:b96c312551b241bc17226c5347c6d6b38a1efd3e</id>
<content type='text'>
Use the vma_pages() helper function and fix the following
Coccinelle/coccicheck warning reported by vma_pages.cocci:

  WARNING: Consider using vma_pages helper on vma

Rename the local variable vma_pages accordingly.

Signed-off-by: Thorsten Blum &lt;thorsten.blum@toblux.com&gt;
Link: https://lore.kernel.org/20240709215657.322071-2-thorsten.blum@toblux.com
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
<entry>
<title>tracing/ring-buffer: Add last_boot_info file to boot instance</title>
<updated>2024-06-14T16:28:22Z</updated>
<author>
<name>Steven Rostedt (Google)</name>
<email>rostedt@goodmis.org</email>
</author>
<published>2024-06-12T23:19:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7a1d1e4b9639ff08b2f42605c2950ae1ba4a43bf'/>
<id>urn:sha1:7a1d1e4b9639ff08b2f42605c2950ae1ba4a43bf</id>
<content type='text'>
If an instance is mapped to memory on boot up, create a new file called
"last_boot_info" that will hold information that can be used to properly
parse the raw data in the ring buffer.

It will export the delta of the addresses for text and data from what it
was from the last boot. It does not expose actually addresses (unless you
knew what the actual address was from the last boot).

The output will look like:

 # cat last_boot_info
 text delta:	-268435456
 data delta:	-268435456

The text and data are kept separate in case they are ever made different.

Link: https://lkml.kernel.org/r/20240612232026.658680738@goodmis.org

Cc: Masami Hiramatsu &lt;mhiramat@kernel.org&gt;
Cc: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Vincent Donnefort &lt;vdonnefort@google.com&gt;
Cc: Joel Fernandes &lt;joel@joelfernandes.org&gt;
Cc: Daniel Bristot de Oliveira &lt;bristot@redhat.com&gt;
Cc: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Vineeth Pillai &lt;vineeth@bitbyteword.org&gt;
Cc: Youssef Esmat &lt;youssefesmat@google.com&gt;
Cc: Beau Belgrave &lt;beaub@linux.microsoft.com&gt;
Cc: Alexander Graf &lt;graf@amazon.com&gt;
Cc: Baoquan He &lt;bhe@redhat.com&gt;
Cc: Borislav Petkov &lt;bp@alien8.de&gt;
Cc: "Paul E. McKenney" &lt;paulmck@kernel.org&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Mike Rapoport &lt;rppt@kernel.org&gt;
Cc: Dave Hansen &lt;dave.hansen@linux.intel.com&gt;
Cc: Tony Luck &lt;tony.luck@intel.com&gt;
Cc: Guenter Roeck &lt;linux@roeck-us.net&gt;
Cc: Ross Zwisler &lt;zwisler@google.com&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Steven Rostedt (Google) &lt;rostedt@goodmis.org&gt;
</content>
</entry>
</feed>
