1. 23 Mar, 2023 37 commits
  2. 19 Mar, 2023 3 commits
    • Linus Torvalds's avatar
      Linux 6.3-rc3 · e8d018dd
      Linus Torvalds authored
      e8d018dd
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · eaba52d6
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix setting affinity of hwlat threads in containers
      
         Using sched_set_affinity() has unwanted side effects when being
         called within a container. Use set_cpus_allowed_ptr() instead
      
       - Fix per cpu thread management of the hwlat tracer:
          - Do not start per_cpu threads if one is already running for the CPU
          - When starting per_cpu threads, do not clear the kthread variable
            as it may already be set to running per cpu threads
      
       - Fix return value for test_gen_kprobe_cmd()
      
         On error the return value was overwritten by being set to the result
         of the call from kprobe_event_delete(), which would likely succeed,
         and thus have the function return success
      
       - Fix splice() reads from the trace file that was broken by commit
         36e2c742 ("fs: don't allow splice read/write without explicit
         ops")
      
       - Remove obsolete and confusing comment in ring_buffer.c
      
         The original design of the ring buffer used struct page flags for
         tricks to optimize, which was shortly removed due to them being
         tricks. But a comment for those tricks remained
      
       - Set local functions and variables to static
      
      * tag 'trace-v6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing/hwlat: Replace sched_setaffinity with set_cpus_allowed_ptr
        ring-buffer: remove obsolete comment for free_buffer_page()
        tracing: Make splice_read available again
        ftrace: Set direct_ops storage-class-specifier to static
        trace/hwlat: Do not start per-cpu thread if it is already running
        trace/hwlat: Do not wipe the contents of per-cpu thread data
        tracing/osnoise: set several trace_osnoise.c variables storage-class-specifier to static
        tracing: Fix wrong return in kprobe_event_gen_test.c
      eaba52d6
    • Costa Shulyupin's avatar
      tracing/hwlat: Replace sched_setaffinity with set_cpus_allowed_ptr · 71c7a304
      Costa Shulyupin authored
      There is a problem with the behavior of hwlat in a container,
      resulting in incorrect output. A warning message is generated:
      "cpumask changed while in round-robin mode, switching to mode none",
      and the tracing_cpumask is ignored. This issue arises because
      the kernel thread, hwlatd, is not a part of the container, and
      the function sched_setaffinity is unable to locate it using its PID.
      Additionally, the task_struct of hwlatd is already known.
      Ultimately, the function set_cpus_allowed_ptr achieves
      the same outcome as sched_setaffinity, but employs task_struct
      instead of PID.
      
      Test case:
      
        # cd /sys/kernel/tracing
        # echo 0 > tracing_on
        # echo round-robin > hwlat_detector/mode
        # echo hwlat > current_tracer
        # unshare --fork --pid bash -c 'echo 1 > tracing_on'
        # dmesg -c
      
      Actual behavior:
      
      [573502.809060] hwlat_detector: cpumask changed while in round-robin mode, switching to mode none
      
      Link: https://lore.kernel.org/linux-trace-kernel/20230316144535.1004952-1-costa.shul@redhat.com
      
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Fixes: 0330f7aa ("tracing: Have hwlat trace migrate across tracing_cpumask CPUs")
      Signed-off-by: default avatarCosta Shulyupin <costa.shul@redhat.com>
      Acked-by: default avatarDaniel Bristot de Oliveira <bristot@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      71c7a304