]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
Merge tag 'trace-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Feb 2020 07:12:11 +0000 (07:12 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 6 Feb 2020 07:12:11 +0000 (07:12 +0000)
Pull tracing updates from Steven Rostedt:

 - Added new "bootconfig".

   This looks for a file appended to initrd to add boot config options,
   and has been discussed thoroughly at Linux Plumbers.

   Very useful for adding kprobes at bootup.

   Only enabled if "bootconfig" is on the real kernel command line.

 - Created dynamic event creation.

   Merges common code between creating synthetic events and kprobe
   events.

 - Rename perf "ring_buffer" structure to "perf_buffer"

 - Rename ftrace "ring_buffer" structure to "trace_buffer"

   Had to rename existing "trace_buffer" to "array_buffer"

 - Allow trace_printk() to work withing (some) tracing code.

 - Sort of tracing configs to be a little better organized

 - Fixed bug where ftrace_graph hash was not being protected properly

 - Various other small fixes and clean ups

* tag 'trace-v5.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (88 commits)
  bootconfig: Show the number of nodes on boot message
  tools/bootconfig: Show the number of bootconfig nodes
  bootconfig: Add more parse error messages
  bootconfig: Use bootconfig instead of boot config
  ftrace: Protect ftrace_graph_hash with ftrace_sync
  ftrace: Add comment to why rcu_dereference_sched() is open coded
  tracing: Annotate ftrace_graph_notrace_hash pointer with __rcu
  tracing: Annotate ftrace_graph_hash pointer with __rcu
  bootconfig: Only load bootconfig if "bootconfig" is on the kernel cmdline
  tracing: Use seq_buf for building dynevent_cmd string
  tracing: Remove useless code in dynevent_arg_pair_add()
  tracing: Remove check_arg() callbacks from dynevent args
  tracing: Consolidate some synth_event_trace code
  tracing: Fix now invalid var_ref_vals assumption in trace action
  tracing: Change trace_boot to use synth_event interface
  tracing: Move tracing selftests to bottom of menu
  tracing: Move mmio tracer config up with the other tracers
  tracing: Move tracing test module configs together
  tracing: Move all function tracing configs together
  tracing: Documentation for in-kernel synthetic event API
  ...

19 files changed:
1  2 
Documentation/admin-guide/index.rst
Documentation/admin-guide/kernel-parameters.txt
MAINTAINERS
include/linux/trace_events.h
include/trace/trace_events.h
init/Kconfig
init/main.c
kernel/events/core.c
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_entries.h
kernel/trace/trace_events.c
kernel/trace/trace_events_hist.c
kernel/trace/trace_hwlat.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_syscalls.c
kernel/trace/trace_uprobe.c
lib/Kconfig
lib/Makefile

Simple merge
diff --cc MAINTAINERS
index 777f87ac255185496d43067fe15ff6a64a2ea580,47873f2e6696d092e5c691276af3c6c06e5d50a3..5c87b133dfa6dc0769bdc6f0f39b939e166b8e75
@@@ -15931,9 -15768,17 +15931,18 @@@ M: Jose Abreu <joabreu@synopsys.com
  L:    netdev@vger.kernel.org
  W:    http://www.stlinux.com
  S:    Supported
 +F:    Documentation/networking/device_drivers/stmicro/
  F:    drivers/net/ethernet/stmicro/stmmac/
  
+ EXTRA BOOT CONFIG
+ M:    Masami Hiramatsu <mhiramat@kernel.org>
+ S:    Maintained
+ F:    lib/bootconfig.c
+ F:    fs/proc/bootconfig.c
+ F:    include/linux/bootconfig.h
+ F:    tools/bootconfig/*
+ F:    Documentation/admin-guide/bootconfig.rst
  SUN3/3X
  M:    Sam Creasey <sammy@sammy.net>
  W:    http://sammy.net/sun3/
Simple merge
Simple merge
diff --cc init/Kconfig
Simple merge
diff --cc init/main.c
index d8c7e86c2d28d0642e4dd694a5fab2fc7bd1deae,491f1cdb31056dc1f1e1958129b6b9ac0d56cace..cc0ee4873419ce36558a3ec8d2561f78d6407e1c
@@@ -245,8 -248,159 +248,158 @@@ static int __init loglevel(char *str
  
  early_param("loglevel", loglevel);
  
+ #ifdef CONFIG_BOOT_CONFIG
+ char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
+ #define rest(dst, end) ((end) > (dst) ? (end) - (dst) : 0)
+ static int __init xbc_snprint_cmdline(char *buf, size_t size,
+                                     struct xbc_node *root)
+ {
+       struct xbc_node *knode, *vnode;
+       char *end = buf + size;
+       char c = '\"';
+       const char *val;
+       int ret;
+       xbc_node_for_each_key_value(root, knode, val) {
+               ret = xbc_node_compose_key_after(root, knode,
+                                       xbc_namebuf, XBC_KEYLEN_MAX);
+               if (ret < 0)
+                       return ret;
+               vnode = xbc_node_get_child(knode);
+               ret = snprintf(buf, rest(buf, end), "%s%c", xbc_namebuf,
+                               vnode ? '=' : ' ');
+               if (ret < 0)
+                       return ret;
+               buf += ret;
+               if (!vnode)
+                       continue;
+               c = '\"';
+               xbc_array_for_each_value(vnode, val) {
+                       ret = snprintf(buf, rest(buf, end), "%c%s", c, val);
+                       if (ret < 0)
+                               return ret;
+                       buf += ret;
+                       c = ',';
+               }
+               if (rest(buf, end) > 2)
+                       strcpy(buf, "\" ");
+               buf += 2;
+       }
+       return buf - (end - size);
+ }
+ #undef rest
+ /* Make an extra command line under given key word */
+ static char * __init xbc_make_cmdline(const char *key)
+ {
+       struct xbc_node *root;
+       char *new_cmdline;
+       int ret, len = 0;
+       root = xbc_find_node(key);
+       if (!root)
+               return NULL;
+       /* Count required buffer size */
+       len = xbc_snprint_cmdline(NULL, 0, root);
+       if (len <= 0)
+               return NULL;
+       new_cmdline = memblock_alloc(len + 1, SMP_CACHE_BYTES);
+       if (!new_cmdline) {
+               pr_err("Failed to allocate memory for extra kernel cmdline.\n");
+               return NULL;
+       }
+       ret = xbc_snprint_cmdline(new_cmdline, len + 1, root);
+       if (ret < 0 || ret > len) {
+               pr_err("Failed to print extra kernel cmdline.\n");
+               return NULL;
+       }
+       return new_cmdline;
+ }
+ u32 boot_config_checksum(unsigned char *p, u32 size)
+ {
+       u32 ret = 0;
+       while (size--)
+               ret += *p++;
+       return ret;
+ }
+ static void __init setup_boot_config(const char *cmdline)
+ {
+       u32 size, csum;
+       char *data, *copy;
+       const char *p;
+       u32 *hdr;
+       int ret;
+       p = strstr(cmdline, "bootconfig");
+       if (!p || (p != cmdline && !isspace(*(p-1))) ||
+           (p[10] && !isspace(p[10])))
+               return;
+       if (!initrd_end)
+               goto not_found;
+       hdr = (u32 *)(initrd_end - 8);
+       size = hdr[0];
+       csum = hdr[1];
+       if (size >= XBC_DATA_MAX) {
+               pr_err("bootconfig size %d greater than max size %d\n",
+                       size, XBC_DATA_MAX);
+               return;
+       }
+       data = ((void *)hdr) - size;
+       if ((unsigned long)data < initrd_start)
+               goto not_found;
+       if (boot_config_checksum((unsigned char *)data, size) != csum) {
+               pr_err("bootconfig checksum failed\n");
+               return;
+       }
+       copy = memblock_alloc(size + 1, SMP_CACHE_BYTES);
+       if (!copy) {
+               pr_err("Failed to allocate memory for bootconfig\n");
+               return;
+       }
+       memcpy(copy, data, size);
+       copy[size] = '\0';
+       ret = xbc_init(copy);
+       if (ret < 0)
+               pr_err("Failed to parse bootconfig\n");
+       else {
+               pr_info("Load bootconfig: %d bytes %d nodes\n", size, ret);
+               /* keys starting with "kernel." are passed via cmdline */
+               extra_command_line = xbc_make_cmdline("kernel");
+               /* Also, "init." keys are init arguments */
+               extra_init_args = xbc_make_cmdline("init");
+       }
+       return;
+ not_found:
+       pr_err("'bootconfig' found on command line, but no bootconfig found\n");
+ }
+ #else
+ #define setup_boot_config(cmdline)    do { } while (0)
+ #endif
  /* Change NUL term back to "=", to make "param" the whole string. */
 -static int __init repair_env_string(char *param, char *val,
 -                                  const char *unused, void *arg)
 +static void __init repair_env_string(char *param, char *val)
  {
        if (val) {
                /* param=val or param="val"? */
@@@ -990,22 -1175,15 +1175,21 @@@ static const char *initcall_level_names
        "late",
  };
  
- static void __init do_initcall_level(int level)
 +static int __init ignore_unknown_bootoption(char *param, char *val,
 +                             const char *unused, void *arg)
 +{
 +      return 0;
 +}
 +
+ static void __init do_initcall_level(int level, char *command_line)
  {
        initcall_entry_t *fn;
  
-       strcpy(initcall_command_line, saved_command_line);
        parse_args(initcall_level_names[level],
-                  initcall_command_line, __start___param,
+                  command_line, __start___param,
                   __stop___param - __start___param,
                   level, level,
 -                 NULL, &repair_env_string);
 +                 NULL, ignore_unknown_bootoption);
  
        trace_initcall_level(initcall_level_names[level]);
        for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc lib/Kconfig
Simple merge
diff --cc lib/Makefile
Simple merge