1. 16 Jul, 2019 9 commits
  2. 18 Jun, 2019 1 commit
    • Gustavo A. R. Silva's avatar
      tracepoint: Use struct_size() in kmalloc() · f0553dcb
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct tp_probes {
      	...
              struct tracepoint_func probes[0];
      };
      
      instance = kmalloc(sizeof(sizeof(struct tp_probes) +
      			sizeof(struct tracepoint_func) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kmalloc(struct_size(instance, probes, count) GFP_KERNEL);
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      f0553dcb
  3. 28 May, 2019 1 commit
    • Steven Rostedt (VMware)'s avatar
      ring-buffer: Remove HAVE_64BIT_ALIGNED_ACCESS · 86b3de60
      Steven Rostedt (VMware) authored
      Commit c19fa94a ("Add HAVE_64BIT_ALIGNED_ACCESS") added the config for
      architectures that required 64bit aligned access for all 64bit words. As
      the ftrace ring buffer stores data on 4 byte alignment, this config option
      was used to force it to store data on 8 byte alignment to make sure the data
      being stored and written directly into the ring buffer was 8 byte aligned as
      it would cause issues trying to write an 8 byte word on a 4 not 8 byte
      aligned memory location.
      
      But with the removal of the metag architecture, which was the only
      architecture to use this, there is no architecture supported by Linux that
      requires 8 byte aligne access for all 8 byte words (4 byte alignment is good
      enough). Removing this config can simplify the code a bit.
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      86b3de60
  4. 26 May, 2019 17 commits
  5. 22 May, 2019 1 commit
  6. 21 May, 2019 3 commits
    • Tom Zanussi's avatar
      tracing: Add a check_val() check before updating cond_snapshot() track_val · 9b2ca371
      Tom Zanussi authored
      Without this check a snapshot is taken whenever a bucket's max is hit,
      rather than only when the global max is hit, as it should be.
      
      Before:
      
        In this example, we do a first run of the workload (cyclictest),
        examine the output, note the max ('triggering value') (347), then do
        a second run and note the max again.
      
        In this case, the max in the second run (39) is below the max in the
        first run, but since we haven't cleared the histogram, the first max
        is still in the histogram and is higher than any other max, so it
        should still be the max for the snapshot.  It isn't however - the
        value should still be 347 after the second run.
      
        # echo 'hist:keys=pid:ts0=common_timestamp.usecs if comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_waking/trigger
        # echo 'hist:keys=next_pid:wakeup_lat=common_timestamp.usecs-$ts0:onmax($wakeup_lat).save(next_prio,next_comm,prev_pid,prev_prio,prev_comm):onmax($wakeup_lat).snapshot() if next_comm=="cyclictest"' >> /sys/kernel/debug/tracing/events/sched/sched_switch/trigger
      
        # cyclictest -p 80 -n -s -t 2 -D 2
      
        # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
      
        { next_pid:       2143 } hitcount:        199
          max:         44  next_prio:        120  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/4
      
        { next_pid:       2145 } hitcount:       1325
          max:         38  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/2
      
        { next_pid:       2144 } hitcount:       1982
          max:        347  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
      
        Snapshot taken (see tracing/snapshot).  Details:
            triggering value { onmax($wakeup_lat) }:        347
            triggered by event with key: { next_pid:       2144 }
      
        # cyclictest -p 80 -n -s -t 2 -D 2
      
        # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
      
        { next_pid:       2143 } hitcount:        199
          max:         44  next_prio:        120  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/4
      
        { next_pid:       2148 } hitcount:        199
          max:         16  next_prio:        120  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/1
      
        { next_pid:       2145 } hitcount:       1325
          max:         38  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/2
      
        { next_pid:       2150 } hitcount:       1326
          max:         39  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/4
      
        { next_pid:       2144 } hitcount:       1982
          max:        347  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
      
        { next_pid:       2149 } hitcount:       1983
          max:        130  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/0
      
        Snapshot taken (see tracing/snapshot).  Details:
          triggering value { onmax($wakeup_lat) }:    39
          triggered by event with key: { next_pid:       2150 }
      
      After:
      
        In this example, we do a first run of the workload (cyclictest),
        examine the output, note the max ('triggering value') (375), then do
        a second run and note the max again.
      
        In this case, the max in the second run is still 375, the highest in
        any bucket, as it should be.
      
        # cyclictest -p 80 -n -s -t 2 -D 2
      
        # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
      
        { next_pid:       2072 } hitcount:        200
          max:         28  next_prio:        120  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/5
      
        { next_pid:       2074 } hitcount:       1323
          max:        375  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/2
      
        { next_pid:       2073 } hitcount:       1980
          max:        153  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
      
        Snapshot taken (see tracing/snapshot).  Details:
          triggering value { onmax($wakeup_lat) }:        375
          triggered by event with key: { next_pid:       2074 }
      
        # cyclictest -p 80 -n -s -t 2 -D 2
      
        # cat /sys/kernel/debug/tracing/events/sched/sched_switch/hist
      
        { next_pid:       2101 } hitcount:        199
          max:         49  next_prio:        120  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
      
        { next_pid:       2072 } hitcount:        200
          max:         28  next_prio:        120  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/5
      
        { next_pid:       2074 } hitcount:       1323
          max:        375  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/2
      
        { next_pid:       2103 } hitcount:       1325
          max:         74  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/4
      
        { next_pid:       2073 } hitcount:       1980
          max:        153  next_prio:         19  next_comm: cyclictest
          prev_pid:          0  prev_prio:        120  prev_comm: swapper/6
      
        { next_pid:       2102 } hitcount:       1981
          max:         84  next_prio:         19  next_comm: cyclictest
          prev_pid:         12  prev_prio:        120  prev_comm: kworker/0:1
      
        Snapshot taken (see tracing/snapshot).  Details:
          triggering value { onmax($wakeup_lat) }:        375
          triggered by event with key: { next_pid:       2074 }
      
      Link: http://lkml.kernel.org/r/95958351329f129c07504b4d1769c47a97b70d65.1555597045.git.tom.zanussi@linux.intel.com
      
      Cc: stable@vger.kernel.org
      Fixes: a3785b7e ("tracing: Add hist trigger snapshot() action")
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      9b2ca371
    • Tom Zanussi's avatar
      tracing: Check keys for variable references in expressions too · c8d94a18
      Tom Zanussi authored
      There's an existing check for variable references in keys, but it
      doesn't go far enough.  It checks whether a key field is a variable
      reference but doesn't check whether it's an expression containing
      variable references, which can cause the same problems for callers.
      
      Use the existing field_has_hist_vars() function rather than a direct
      top-level flag check to catch all possible variable references.
      
      Link: http://lkml.kernel.org/r/e8c3d3d53db5ca90ceea5a46e5413103a6902fc7.1555597045.git.tom.zanussi@linux.intel.com
      
      Cc: stable@vger.kernel.org
      Fixes: 067fe038 ("tracing: Add variable reference handling to hist triggers")
      Reported-by: default avatarVincent Bernat <vincent@bernat.ch>
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      c8d94a18
    • Tom Zanussi's avatar
      tracing: Prevent hist_field_var_ref() from accessing NULL tracing_map_elts · 55267c88
      Tom Zanussi authored
      hist_field_var_ref() is an implementation of hist_field_fn_t(), which
      can be called with a null tracing_map_elt elt param when assembling a
      key in event_hist_trigger().
      
      In the case of hist_field_var_ref() this doesn't make sense, because a
      variable can only be resolved by looking it up using an already
      assembled key i.e. a variable can't be used to assemble a key since
      the key is required in order to access the variable.
      
      Upper layers should prevent the user from constructing a key using a
      variable in the first place, but in case one slips through, it
      shouldn't cause a NULL pointer dereference.  Also if one does slip
      through, we want to know about it, so emit a one-time warning in that
      case.
      
      Link: http://lkml.kernel.org/r/64ec8dc15c14d305295b64cdfcc6b2b9dd14753f.1555597045.git.tom.zanussi@linux.intel.comReported-by: default avatarVincent Bernat <vincent@bernat.ch>
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      55267c88
  7. 19 May, 2019 8 commits
    • Linus Torvalds's avatar
      Linux 5.2-rc1 · a188339c
      Linus Torvalds authored
      a188339c
    • Linus Torvalds's avatar
      Merge tag 'upstream-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs · 2e2c1220
      Linus Torvalds authored
      Pull UBIFS fixes from Richard Weinberger:
      
       - build errors wrt xattrs
      
       - mismerge which lead to a wrong Kconfig ifdef
      
       - missing endianness conversion
      
      * tag 'upstream-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/ubifs:
        ubifs: Convert xattr inum to host order
        ubifs: Use correct config name for encryption
        ubifs: Fix build error without CONFIG_UBIFS_FS_XATTR
      2e2c1220
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · cb6f8739
      Linus Torvalds authored
      Merge yet more updates from Andrew Morton:
       "A few final bits:
      
         - large changes to vmalloc, yielding large performance benefits
      
         - tweak the console-flush-on-panic code
      
         - a few fixes"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        panic: add an option to replay all the printk message in buffer
        initramfs: don't free a non-existent initrd
        fs/writeback.c: use rcu_barrier() to wait for inflight wb switches going into workqueue when umount
        mm/compaction.c: correct zone boundary handling when isolating pages from a pageblock
        mm/vmap: add DEBUG_AUGMENT_LOWEST_MATCH_CHECK macro
        mm/vmap: add DEBUG_AUGMENT_PROPAGATE_CHECK macro
        mm/vmalloc.c: keep track of free blocks for vmap allocation
      cb6f8739
    • Linus Torvalds's avatar
      Merge tag 'kbuild-v5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild · ff8583d6
      Linus Torvalds authored
      Pull more Kbuild updates from Masahiro Yamada:
      
       - remove unneeded use of cc-option, cc-disable-warning, cc-ldoption
      
       - exclude tracked files from .gitignore
      
       - re-enable -Wint-in-bool-context warning
      
       - refactor samples/Makefile
      
       - stop building immediately if syncconfig fails
      
       - do not sprinkle error messages when $(CC) does not exist
      
       - move arch/alpha/defconfig to the configs subdirectory
      
       - remove crappy header search path manipulation
      
       - add comment lines to .config to clarify the end of menu blocks
      
       - check uniqueness of module names (adding new warnings intentionally)
      
      * tag 'kbuild-v5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (24 commits)
        kconfig: use 'else ifneq' for Makefile to improve readability
        kbuild: check uniqueness of module names
        kconfig: Terminate menu blocks with a comment in the generated config
        kbuild: add LICENSES to KBUILD_ALLDIRS
        kbuild: remove 'addtree' and 'flags' magic for header search paths
        treewide: prefix header search paths with $(srctree)/
        media: prefix header search paths with $(srctree)/
        media: remove unneeded header search paths
        alpha: move arch/alpha/defconfig to arch/alpha/configs/defconfig
        kbuild: terminate Kconfig when $(CC) or $(LD) is missing
        kbuild: turn auto.conf.cmd into a mandatory include file
        .gitignore: exclude .get_maintainer.ignore and .gitattributes
        kbuild: add all Clang-specific flags unconditionally
        kbuild: Don't try to add '-fcatch-undefined-behavior' flag
        kbuild: add some extra warning flags unconditionally
        kbuild: add -Wvla flag unconditionally
        arch: remove dangling asm-generic wrappers
        samples: guard sub-directories with CONFIG options
        kbuild: re-enable int-in-bool-context warning
        MAINTAINERS: kbuild: Add pattern for scripts/*vmlinux*
        ...
      ff8583d6
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · f23d8719
      Linus Torvalds authored
      Pull i2c updates from Wolfram Sang:
       "Some I2C core API additions which are kind of simple but enhance error
        checking for users a lot, especially by returning errno now.
      
        There are wrappers to still support the old API but it will be removed
        once all users are converted"
      
      * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: core: add device-managed version of i2c_new_dummy
        i2c: core: improve return value handling of i2c_new_device and i2c_new_dummy
      f23d8719
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · c4d36b63
      Linus Torvalds authored
      Pull ext4 fixes from Ted Ts'o:
       "Some bug fixes, and an update to the URL's for the final version of
        Unicode 12.1.0"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: avoid panic during forced reboot due to aborted journal
        ext4: fix block validity checks for journal inodes using indirect blocks
        unicode: update to Unicode 12.1.0 final
        unicode: add missing check for an error return from utf8lookup()
        ext4: fix miscellaneous sparse warnings
        ext4: unsigned int compared against zero
        ext4: fix use-after-free in dx_release()
        ext4: fix data corruption caused by overlapping unaligned and aligned IO
        jbd2: fix potential double free
        ext4: zero out the unused memory region in the extent tree block
      c4d36b63
    • Linus Torvalds's avatar
      Merge tag '5.2-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · d8848eef
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Minor cleanup and fixes, one for stable, four rdma (smbdirect)
        related. Also adds SEEK_HOLE support"
      
      * tag '5.2-rc-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: add support for SEEK_DATA and SEEK_HOLE
        Fixed https://bugzilla.kernel.org/show_bug.cgi?id=202935 allow write on the same file
        cifs: Allocate memory for all iovs in smb2_ioctl
        cifs: Don't match port on SMBDirect transport
        cifs:smbd Use the correct DMA direction when sending data
        cifs:smbd When reconnecting to server, call smbd_destroy() after all MIDs have been called
        cifs: use the right include for signal_pending()
        smb3: trivial cleanup to smb2ops.c
        cifs: cleanup smb2ops.c and normalize strings
        smb3: display session id in debug data
      d8848eef
    • Linus Torvalds's avatar
      Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1ba3b5dc
      Linus Torvalds authored
      Pull perf tooling updates from Ingo Molnar:
       "perf.data:
      
         - Streaming compression of perf ring buffer into
           PERF_RECORD_COMPRESSED user space records, resulting in ~3-5x
           perf.data file size reduction on variety of tested workloads what
           saves storage space on larger server systems where perf.data size
           can easily reach several tens or even hundreds of GiBs, especially
           when profiling with DWARF-based stacks and tracing of context
           switches.
      
        perf record:
      
         - Improve -user-regs/intr-regs suggestions to overcome errors
      
        perf annotate:
      
         - Remove hist__account_cycles() from callback, speeding up branch
           processing (perf record -b)
      
        perf stat:
      
         - Add a 'percore' event qualifier, e.g.: -e
           cpu/event=0,umask=0x3,percore=1/, that sums up the event counts for
           both hardware threads in a core.
      
           We can already do this with --per-core, but it's often useful to do
           this together with other metrics that are collected per hardware
           thread.
      
           I.e. now its possible to do this per-event, and have it mixed with
           other events not aggregated by core.
      
        arm64:
      
         - Map Brahma-B53 CPUID to cortex-a53 events.
      
         - Add Cortex-A57 and Cortex-A72 events.
      
        csky:
      
         - Add DWARF register mappings for libdw, allowing --call-graph=dwarf
           to work on the C-SKY arch.
      
        x86:
      
         - Add support for recording and printing XMM registers, available,
           for instance, on Icelake.
      
         - Add uncore_upi (Intel's "Ultra Path Interconnect" events) JSON
           support. UPI replaced the Intel QuickPath Interconnect (QPI) in
           Xeon Skylake-SP.
      
        Intel PT:
      
         - Fix instructions sampling rate.
      
         - Timestamp fixes.
      
         - Improve exported-sql-viewer GUI, allowing, for instance, to
           copy'n'paste the trees, useful for e-mailing"
      
      * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (73 commits)
        perf stat: Support 'percore' event qualifier
        perf stat: Factor out aggregate counts printing
        perf tools: Add a 'percore' event qualifier
        perf docs: Add description for stderr
        perf intel-pt: Fix sample timestamp wrt non-taken branches
        perf intel-pt: Fix improved sample timestamp
        perf intel-pt: Fix instructions sampling rate
        perf regs x86: Add X86 specific arch__intr_reg_mask()
        perf parse-regs: Add generic support for arch__intr/user_reg_mask()
        perf parse-regs: Split parse_regs
        perf vendor events arm64: Add Cortex-A57 and Cortex-A72 events
        perf vendor events arm64: Map Brahma-B53 CPUID to cortex-a53 events
        perf vendor events arm64: Remove [[:xdigit:]] wildcard
        perf jevents: Remove unused variable
        perf test zstd: Fixup verbose mode output
        perf tests: Implement Zstd comp/decomp integration test
        perf inject: Enable COMPRESSED record decompression
        perf report: Implement perf.data record decompression
        perf record: Implement -z,--compression_level[=<n>] option
        perf report: Add stub processing of compressed events for -D
        ...
      1ba3b5dc