Skip to content

Commit 76bfd3d

Browse files
committed
Merge tag 'trace-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt: "The majority of the changes are for fixes and clean ups. Notable changes: - Rework trace event triggers code to be easier to interact with. - Support for embedding bootconfig with the kernel (as suppose to having it embedded in initram). This is useful for embedded boards without initram disks. - Speed up boot by parallelizing the creation of tracefs files. - Allow absolute ring buffer timestamps handle timestamps that use more than 59 bits. - Added new tracing clock "TAI" (International Atomic Time) - Have weak functions show up in available_filter_function list as: __ftrace_invalid_address___<invalid-offset> instead of using the name of the function before it" * tag 'trace-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (52 commits) ftrace: Add FTRACE_MCOUNT_MAX_OFFSET to avoid adding weak function tracing: Fix comments for event_trigger_separate_filter() x86/traceponit: Fix comment about irq vector tracepoints x86,tracing: Remove unused headers ftrace: Clean up hash direct_functions on register failures tracing: Fix comments of create_filter() tracing: Disable kcov on trace_preemptirq.c tracing: Initialize integer variable to prevent garbage return value ftrace: Fix typo in comment ftrace: Remove return value of ftrace_arch_modify_*() tracing: Cleanup code by removing init "char *name" tracing: Change "char *" string form to "char []" tracing/timerlat: Do not wakeup the thread if the trace stops at the IRQ tracing/timerlat: Print stacktrace in the IRQ handler if needed tracing/timerlat: Notify IRQ new max latency only if stop tracing is set kprobes: Fix build errors with CONFIG_KRETPROBES=n tracing: Fix return value of trace_pid_write() tracing: Fix potential double free in create_var_ref() tracing: Use strim() to remove whitespace instead of doing it manually ftrace: Deal with error return code of the ftrace_process_locs() function ...
2 parents 09f73a1 + b39181f commit 76bfd3d

40 files changed

Lines changed: 822 additions & 646 deletions

Documentation/admin-guide/bootconfig.rst

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,15 @@ Each key-value pair is shown in each line with following style::
158158
Boot Kernel With a Boot Config
159159
==============================
160160

161-
Since the boot configuration file is loaded with initrd, it will be added
162-
to the end of the initrd (initramfs) image file with padding, size,
163-
checksum and 12-byte magic word as below.
161+
There are two options to boot the kernel with bootconfig: attaching the
162+
bootconfig to the initrd image or embedding it in the kernel itself.
163+
164+
Attaching a Boot Config to Initrd
165+
---------------------------------
166+
167+
Since the boot configuration file is loaded with initrd by default,
168+
it will be added to the end of the initrd (initramfs) image file with
169+
padding, size, checksum and 12-byte magic word as below.
164170

165171
[initrd][bootconfig][padding][size(le32)][checksum(le32)][#BOOTCONFIG\n]
166172

@@ -196,6 +202,25 @@ To remove the config from the image, you can use -d option as below::
196202
Then add "bootconfig" on the normal kernel command line to tell the
197203
kernel to look for the bootconfig at the end of the initrd file.
198204

205+
Embedding a Boot Config into Kernel
206+
-----------------------------------
207+
208+
If you can not use initrd, you can also embed the bootconfig file in the
209+
kernel by Kconfig options. In this case, you need to recompile the kernel
210+
with the following configs::
211+
212+
CONFIG_BOOT_CONFIG_EMBED=y
213+
CONFIG_BOOT_CONFIG_EMBED_FILE="/PATH/TO/BOOTCONFIG/FILE"
214+
215+
``CONFIG_BOOT_CONFIG_EMBED_FILE`` requires an absolute path or a relative
216+
path to the bootconfig file from source tree or object tree.
217+
The kernel will embed it as the default bootconfig.
218+
219+
Just as when attaching the bootconfig to the initrd, you need ``bootconfig``
220+
option on the kernel command line to enable the embedded bootconfig.
221+
222+
Note that even if you set this option, you can override the embedded
223+
bootconfig by another bootconfig which attached to the initrd.
199224

200225
Kernel parameters via Boot Config
201226
=================================

Documentation/trace/ftrace.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,18 @@ of ftrace. Here is a list of some of the key files:
517517
processing should be able to handle them. See comments in the
518518
ktime_get_boot_fast_ns() function for more information.
519519

520+
tai:
521+
This is the tai clock (CLOCK_TAI) and is derived from the wall-
522+
clock time. However, this clock does not experience
523+
discontinuities and backwards jumps caused by NTP inserting leap
524+
seconds. Since the clock access is designed for use in tracing,
525+
side effects are possible. The clock access may yield wrong
526+
readouts in case the internal TAI offset is updated e.g., caused
527+
by setting the system time or using adjtimex() with an offset.
528+
These effects are rare and post processing should be able to
529+
handle them. See comments in the ktime_get_tai_fast_ns()
530+
function for more information.
531+
520532
To set a clock, simply echo the clock name into this file::
521533

522534
# echo global > trace_clock

Documentation/trace/timerlat-tracer.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ directory. The timerlat configs are:
7474
- stop_tracing_total_us: stop the system tracing if a
7575
timer latency at the *thread* context is higher than the configured
7676
value happens. Writing 0 disables this option.
77-
- print_stack: save the stack of the IRQ occurrence, and print
78-
it after the *thread context* event".
77+
- print_stack: save the stack of the IRQ occurrence. The stack is printed
78+
after the *thread context* event, or at the IRQ handler if *stop_tracing_us*
79+
is hit.
7980

8081
timerlat and osnoise
8182
----------------------------

MAINTAINERS

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7517,6 +7517,7 @@ S: Maintained
75177517
F: Documentation/admin-guide/bootconfig.rst
75187518
F: fs/proc/bootconfig.c
75197519
F: include/linux/bootconfig.h
7520+
F: lib/bootconfig-data.S
75207521
F: lib/bootconfig.c
75217522
F: tools/bootconfig/*
75227523
F: tools/bootconfig/scripts/*
@@ -20119,8 +20120,8 @@ M: Ingo Molnar <mingo@redhat.com>
2011920120
S: Maintained
2012020121
T: git git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
2012120122
F: Documentation/trace/ftrace.rst
20122-
F: arch/*/*/*/ftrace.h
20123-
F: arch/*/kernel/ftrace.c
20123+
F: arch/*/*/*/*ftrace*
20124+
F: arch/*/*/*ftrace*
2012420125
F: fs/tracefs/
2012520126
F: include/*/ftrace.h
2012620127
F: include/linux/trace*.h

arch/arm/kernel/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ static unsigned long __ref adjust_address(struct dyn_ftrace *rec,
7979
return (unsigned long)&ftrace_regs_caller_from_init;
8080
}
8181

82-
int ftrace_arch_code_modify_prepare(void)
82+
void ftrace_arch_code_modify_prepare(void)
8383
{
84-
return 0;
8584
}
8685

87-
int ftrace_arch_code_modify_post_process(void)
86+
void ftrace_arch_code_modify_post_process(void)
8887
{
8988
/* Make sure any TLB misses during machine stop are cleared. */
9089
flush_tlb_all();
91-
return 0;
9290
}
9391

9492
static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr,

arch/riscv/kernel/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@
1212
#include <asm/patch.h>
1313

1414
#ifdef CONFIG_DYNAMIC_FTRACE
15-
int ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
15+
void ftrace_arch_code_modify_prepare(void) __acquires(&text_mutex)
1616
{
1717
mutex_lock(&text_mutex);
18-
return 0;
1918
}
2019

21-
int ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
20+
void ftrace_arch_code_modify_post_process(void) __releases(&text_mutex)
2221
{
2322
mutex_unlock(&text_mutex);
24-
return 0;
2523
}
2624

2725
static int ftrace_check_current_call(unsigned long hook_pos,

arch/s390/kernel/ftrace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,13 @@ void arch_ftrace_update_code(int command)
225225
ftrace_modify_all_code(command);
226226
}
227227

228-
int ftrace_arch_code_modify_post_process(void)
228+
void ftrace_arch_code_modify_post_process(void)
229229
{
230230
/*
231231
* Flush any pre-fetched instructions on all
232232
* CPUs to make the new code visible.
233233
*/
234234
text_poke_sync_lock();
235-
return 0;
236235
}
237236

238237
#ifdef CONFIG_MODULES

arch/x86/include/asm/ftrace.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@
99
# define MCOUNT_ADDR ((unsigned long)(__fentry__))
1010
#define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
1111

12+
/* Ignore unused weak functions which will have non zero offsets */
13+
#ifdef CONFIG_HAVE_FENTRY
14+
# include <asm/ibt.h>
15+
/* Add offset for endbr64 if IBT enabled */
16+
# define FTRACE_MCOUNT_MAX_OFFSET ENDBR_INSN_SIZE
17+
#endif
18+
1219
#ifdef CONFIG_DYNAMIC_FTRACE
1320
#define ARCH_SUPPORTS_FTRACE_OPS 1
1421
#endif

arch/x86/kernel/ftrace.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
static int ftrace_poke_late = 0;
3939

40-
int ftrace_arch_code_modify_prepare(void)
40+
void ftrace_arch_code_modify_prepare(void)
4141
__acquires(&text_mutex)
4242
{
4343
/*
@@ -47,10 +47,9 @@ int ftrace_arch_code_modify_prepare(void)
4747
*/
4848
mutex_lock(&text_mutex);
4949
ftrace_poke_late = 1;
50-
return 0;
5150
}
5251

53-
int ftrace_arch_code_modify_post_process(void)
52+
void ftrace_arch_code_modify_post_process(void)
5453
__releases(&text_mutex)
5554
{
5655
/*
@@ -61,7 +60,6 @@ int ftrace_arch_code_modify_post_process(void)
6160
text_poke_finish();
6261
ftrace_poke_late = 0;
6362
mutex_unlock(&text_mutex);
64-
return 0;
6563
}
6664

6765
static const char *ftrace_nop_replace(void)

arch/x86/kernel/tracepoint.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
// SPDX-License-Identifier: GPL-2.0
22
/*
3-
* Code for supporting irq vector tracepoints.
4-
*
53
* Copyright (C) 2013 Seiji Aguchi <seiji.aguchi@hds.com>
6-
*
74
*/
85
#include <linux/jump_label.h>
96
#include <linux/atomic.h>
107

11-
#include <asm/hw_irq.h>
12-
#include <asm/desc.h>
138
#include <asm/trace/exceptions.h>
14-
#include <asm/trace/irq_vectors.h>
159

1610
DEFINE_STATIC_KEY_FALSE(trace_pagefault_key);
1711

0 commit comments

Comments
 (0)