Skip to content

Commit 8d58e99

Browse files
committed
seq_buf: Move the seq_buf code to lib/
The seq_buf functions are rather useful outside of tracing. Instead of having it be dependent on CONFIG_TRACING, move the code into lib/ and allow other users to have access to it even when tracing is not configured. The seq_buf utility is similar to the seq_file utility, but instead of writing sending data back up to userland, it writes it into a buffer defined at seq_buf_init(). This allows us to send a descriptor around that writes printf() formatted strings into it that can be retrieved later. It is currently used by the tracing facility for such things like trace events to convert its binary saved data in the ring buffer into an ASCII human readable context to be displayed in /sys/kernel/debug/trace. It can also be used for doing NMI prints safely from NMI context into the seq_buf and retrieved later and dumped to printk() safely. Doing printk() from an NMI context is dangerous because an NMI can preempt a current printk() and deadlock on it. Link: http://lkml.kernel.org/p/[email protected] Tested-by: Jiri Kosina <[email protected]> Acked-by: Jiri Kosina <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Signed-off-by: Steven Rostedt <[email protected]>
1 parent 2448913 commit 8d58e99

File tree

3 files changed

+1
-2
lines changed

3 files changed

+1
-2
lines changed

kernel/trace/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ obj-$(CONFIG_RING_BUFFER_BENCHMARK) += ring_buffer_benchmark.o
2929
obj-$(CONFIG_TRACING) += trace.o
3030
obj-$(CONFIG_TRACING) += trace_output.o
3131
obj-$(CONFIG_TRACING) += trace_seq.o
32-
obj-$(CONFIG_TRACING) += seq_buf.o
3332
obj-$(CONFIG_TRACING) += trace_stat.o
3433
obj-$(CONFIG_TRACING) += trace_printk.o
3534
obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o

lib/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
1313
sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
1414
proportions.o flex_proportions.o ratelimit.o show_mem.o \
1515
is_single_threaded.o plist.o decompress.o kobject_uevent.o \
16-
earlycpio.o
16+
earlycpio.o seq_buf.o
1717

1818
obj-$(CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS) += usercopy.o
1919
lib-$(CONFIG_MMU) += ioremap.o
File renamed without changes.

0 commit comments

Comments
 (0)