1. 07 Oct, 2019 18 commits
    • Björn Töpel's avatar
      samples/bpf: fix build by setting HAVE_ATTR_TEST to zero · fce9501a
      Björn Töpel authored
      To remove that test_attr__{enabled/open} are used by perf-sys.h, we
      set HAVE_ATTR_TEST to zero.
      Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Tested-by: default avatarKP Singh <kpsingh@google.com>
      Acked-by: default avatarSong Liu <songliubraving@fb.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20191001113307.27796-3-bjorn.topel@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fce9501a
    • Björn Töpel's avatar
      perf tools: Make usage of test_attr__* optional for perf-sys.h · 06f84d19
      Björn Töpel authored
      For users of perf-sys.h outside perf, e.g. samples/bpf/bpf_load.c, it's
      convenient not to depend on test_attr__*.
      
      After commit 91854f9a ("perf tools: Move everything related to
      sys_perf_event_open() to perf-sys.h"), all users of perf-sys.h will
      depend on test_attr__enabled and test_attr__open.
      
      This commit enables a user to define HAVE_ATTR_TEST to zero in order
      to omit the test dependency.
      
      Fixes: 91854f9a ("perf tools: Move everything related to sys_perf_event_open() to perf-sys.h")
      Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Acked-by: default avatarSong Liu <songliubraving@fb.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20191001113307.27796-2-bjorn.topel@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      06f84d19
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Add Time chart by CPU · b3700f21
      Adrian Hunter authored
      Add a time chart based on context switch information.
      
      Context switch information was added to the database export fairly
      recently, so the chart menu option will only appear if context switch
      information is in the database.
      
      Refer to the Exported SQL Viewer Help option for more information about
      the chart.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20190821083216.1340-7-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3700f21
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Add ability for Call tree to open... · e69d5df7
      Adrian Hunter authored
      perf scripts python: exported-sql-viewer.py: Add ability for Call tree to open at a specified task and time
      
      Add ability for Call tree to open at a specified task and time.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20190821083216.1340-6-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e69d5df7
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Tidy up Call tree call_time · da4264f5
      Adrian Hunter authored
      Record call_time on tree nodes and re-name the misnamed "count" parameter.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20190821083216.1340-5-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da4264f5
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Add global time range calculations · 9a9dae36
      Adrian Hunter authored
      Add calculations to determine a time range that encompasses all data.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20190821083216.1340-4-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a9dae36
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Add HBoxLayout and VBoxLayout · 42c303ff
      Adrian Hunter authored
      Add layout classes HBoxLayout and VBoxLayout.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20190821083216.1340-3-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      42c303ff
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Add LookupModel() · 181ea40a
      Adrian Hunter authored
      Add LookupModel() to find a model in the model cache without creating it.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lore.kernel.org/lkml/20190821083216.1340-2-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      181ea40a
    • Arnaldo Carvalho de Melo's avatar
      perf trace augmented_syscalls: Do not show syscalls when none was asked for · 8bd436b0
      Arnaldo Carvalho de Melo authored
      When not using augmented syscalls, i.e. not passing thru the command
      line a eBPF source or object file event that provides the
      __augmented_syscalls__ BPF_MAP_TYPE_PERF_EVENT_ARRAY, etc, as with:
      
         perf trace -e tools/perf/examples/bpf/augmented_raw_syscalls.c
      
      or passing that augmented eBPF source/object via the trace.add_events in
      .perfconfig file, we were assuming that syscalls were asked for,
      differing from when not using augmented syscalls at all.
      
      This is confusing when using .perfconfig to hide the fact we're using
      the augmenter, i.e. using:
      
       # perf trace -e sched:* sleep 1
      
      Will show both the scheduler tracepoints and the syscalls, where what we
      want is to show just the scheduler tracepoints.
      
      To see the scheduler tracepoints and some specific syscall strace-like
      formatting, one has to use:
      
        # perf trace -e sched:*,nanosleep sleep 1
      
      Or, if wanting all the syscalls:
      
        # perf trace -e sched:* --syscalls sleep 1
      
      This way 'perf trace' can be used to trace just a set of tracepoints
      while allowing for mixing with strace-like when desired, by simply
      adding to the mix the name of the syscalls to show in addition to the
      tracepoints.
      
      Fix it so that the behaviour using the eBPF based syscall augmenter is
      the same as when not using one.
      
      Testing:
      
      Before this patch, with this ~/.perfconfig:
      
        # egrep -B1 ^[[:space:]]+add_events ~/.perfconfig
        [trace]
        	add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
        #
      
      That points to this pre-compiled eBPF syscall augmenter:
      
        # file /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o
        /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o: ELF 64-bit LSB relocatable, eBPF, version 1 (SYSV), with debug_info, not stripped
      
      And when asking for _only_ sched:sched_switch and sched:sched_wakeup we
      were unconditionally getting all the syscalls formatted strace-like:
      
        # perf trace -e sched:*switch,sched:*wakeup sleep 1 |& tail
           0.633 fstat(3, 0x7fe11d030ac0)                = 0
           0.635 mmap(NULL, 217750512, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fe10fec5000
           0.643 close(3)                                = 0
           0.668 nanosleep(0x7fff649a3a90, NULL)      ...
           0.672 sched:sched_switch:prev_comm=sleep prev_pid=4417 prev_prio=120 prev_state=S ==> next_comm=swapper/6 next_pid=0 next_prio=120
        1000.822 sched:sched_wakeup:comm=sleep pid=4417 prio=120 target_cpu=006
           0.668  ... [continued]: nanosleep())          = 0
        1000.923 close(1)                                = 0
        1000.941 close(2)                                = 0
        1000.974 exit_group(0)                           = ?
        #
      
      After the patch:
      
        # perf trace -e sched:*switch,sched:*wakeup sleep 1
           0.000 sched:sched_wakeup:comm=perf pid=5529 prio=120 target_cpu=005
           1.186 sched:sched_switch:prev_comm=sleep prev_pid=5529 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120
        1001.573 sched:sched_wakeup:comm=sleep pid=5529 prio=120 target_cpu=005
        #
      
      If we add the "open*" syscalls to the mix then the eBPF augmented _will_
      be used and these syscalls will be traced together with the specified
      sched tracepoints:
      
        # cd /sys/kernel/debug/tracing/events/syscalls/
        # ls -1d sys_enter_open*
        sys_enter_open
        sys_enter_openat
        sys_enter_open_by_handle_at
        sys_enter_open_tree
        #
      
        # perf trace -e open*,sched:*switch,sched:*wakeup sleep 1
             0.000 sched:sched_wakeup:comm=perf pid=5580 prio=120 target_cpu=005
             0.590 openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
             0.616 openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
             0.846 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
             0.891 sched:sched_switch:prev_comm=sleep prev_pid=5580 prev_prio=120 prev_state=S ==> next_comm=swapper/5 next_pid=0 next_prio=120
          1001.005 sched:sched_wakeup:comm=sleep pid=5580 prio=120 target_cpu=005
        #
      
      And as we can see, the pathnames were collected via the eBPF augmenters.
      
      If we don't specify anything it'll trace all syscalls:
      
        # perf trace sleep 1 |& tail
             0.299 brk(0x5597543a3000)                     = 0x5597543a3000
             0.302 brk(NULL)                               = 0x5597543a3000
             0.307 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
             0.313 fstat(3, 0x7feece50cac0)                = 0
             0.315 mmap(NULL, 217750512, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7feec13a1000
             0.323 close(3)                                = 0
             0.354 nanosleep(0x7ffe338856e0, NULL)         = 0
          1000.641 close(1)                                = 0
          1000.655 close(2)                                = 0
          1000.673 exit_group(0)                           = ?
        #
      
      Ditto if we don't use .perfconfig's trace.add_events but instead pass
      just the augmenter as a command line event:
      
        # vim ~/.perfconfig
        # egrep -B1 ^[[:space:]]+add_events ~/.perfconfig
        # perf trace -e /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o sleep 1 |& tail
             0.294 brk(0x55ae08ec3000)                     = 0x55ae08ec3000
             0.297 brk(NULL)                               = 0x55ae08ec3000
             0.302 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
             0.309 fstat(3, 0x7f726488fac0)                = 0
             0.311 mmap(NULL, 217750512, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f7257724000
             0.319 close(3)                                = 0
             0.347 nanosleep(0x7ffe23643a70, NULL)         = 0
          1000.560 close(1)                                = 0
          1000.575 close(2)                                = 0
          1000.593 exit_group(0)                           = ?
        #
      
      As well as that + some syscall names for strace-like formatting:
      
        # perf trace -e socket,connect,/home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.o ssh localhost
             0.000 socket(PF_LOCAL, SOCK_STREAM|CLOEXEC|NONBLOCK, 0) = 3
             0.021 connect(3, { .family: PF_LOCAL, path: /var/run/nscd/socket }, 110) = -1 ENOENT (No such file or directory)
             0.034 socket(PF_LOCAL, SOCK_STREAM|CLOEXEC|NONBLOCK, 0) = 3
             0.041 connect(3, { .family: PF_LOCAL, path: /var/run/nscd/socket }, 110) = -1 ENOENT (No such file or directory)
             0.163 socket(PF_LOCAL, SOCK_STREAM, 0)        = 4
             0.185 connect(4, { .family: PF_LOCAL, path: /var/lib/sss/pipes/nss }, 110) = 0
             0.670 socket(PF_LOCAL, SOCK_STREAM|CLOEXEC|NONBLOCK, 0) = 7
             0.684 connect(7, { .family: PF_LOCAL, path: /var/run/nscd/socket }, 110) = -1 ENOENT (No such file or directory)
             0.694 socket(PF_LOCAL, SOCK_STREAM|CLOEXEC|NONBLOCK, 0) = 7
             0.701 connect(7, { .family: PF_LOCAL, path: /var/run/nscd/socket }, 110) = -1 ENOENT (No such file or directory)
             0.994 socket(PF_LOCAL, SOCK_STREAM|CLOEXEC|NONBLOCK, 0) = 5
             1.006 connect(5, { .family: PF_LOCAL, path: /var/run/nscd/socket }, 110) = -1 ENOENT (No such file or directory)
             1.014 socket(PF_LOCAL, SOCK_STREAM|CLOEXEC|NONBLOCK, 0) = 5
             1.022 connect(5, { .family: PF_LOCAL, path: /var/run/nscd/socket }, 110) = -1 ENOENT (No such file or directory)
             1.068 socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5
             1.087 connect(5, { .family: PF_INET, port: 22, addr: 127.0.0.1 }, 16) = 0
            24.299 socket(PF_LOCAL, SOCK_STREAM, 0)        = 6
            24.337 connect(6, { .family: PF_LOCAL, path: /var/run/.heim_org.h5l.kcm-socket }, 110) = 0
            28.441 socket(PF_LOCAL, SOCK_STREAM, 0)        = 6
            28.516 connect(6, { .family: PF_LOCAL, path: /var/run/.heim_org.h5l.kcm-socket }, 110) = 0
        root@localhost's password:^C
        #
      
      Everything works without augmenters:
      
        # egrep -B1 ^[[:space:]]+add_events ~/.perfconfig
        # perf trace sleep 1 |& tail
             0.261 brk(0x5635068ac000)                     = 0x5635068ac000
             0.264 brk(NULL)                               = 0x5635068ac000
             0.268 openat(AT_FDCWD, 0xdce642a0, O_RDONLY|O_CLOEXEC) = 3
             0.275 fstat(3, 0x7f3fdce97ac0)                = 0
             0.277 mmap(NULL, 217750512, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f3fcfd2c000
             0.284 close(3)                                = 0
             0.310 nanosleep(0x7ffdaea6ecd0, NULL)         = 0
          1000.552 close(1)                                = 0
          1000.565 close(2)                                = 0
          1000.580 exit_group(0)                           = ?
        #
      
        # perf trace -e connect ssh localhost
             0.000 connect(3, 0x58266930, 110)             = -1 ENOENT (No such file or directory)
             0.022 connect(3, 0x58266af0, 110)             = -1 ENOENT (No such file or directory)
             0.150 connect(4, 0x58266b00, 110)             = 0
             0.490 connect(7, 0x58264150, 110)             = -1 ENOENT (No such file or directory)
             0.505 connect(7, 0x58264300, 110)             = -1 ENOENT (No such file or directory)
             0.832 connect(5, 0x58266220, 110)             = -1 ENOENT (No such file or directory)
             0.847 connect(5, 0x582663e0, 110)             = -1 ENOENT (No such file or directory)
             0.899 connect(5, 0x95ba0630, 16)              = 0
            25.619 connect(6, 0x58266360, 110)             = 0
            40.564 connect(6, 0x58266330, 110)             = 0
        root@localhost's password: ^C
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-624f6jxic04031tnt40va4dd@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8bd436b0
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Postpone parsing .perfconfig trace.add_events to after --verbose is processed · 7e035929
      Arnaldo Carvalho de Melo authored
      When we add events via the '[trace]' section in perfconfig the command
      line options are not yet processed, so when something goes wrong with
      parsing those events and using --verbose is advised, we end up not
      getting any more verbosity by doing so.
      
      So just copy the trace.add_events string for later processing, after we
      processed --verbose and the other command line options.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-d6wbnz85ftqljdll6ynjyjd8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e035929
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Generalize the syscall_fmt find routines · bcddbfc5
      Arnaldo Carvalho de Melo authored
      To allow them to be used with other stuff, such as tracepoints.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-od3gzg77ppqgnnrxqv40fvgx@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bcddbfc5
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Separate 'struct syscall_fmt' definition from syscall_fmts variable · 9b2036cd
      Arnaldo Carvalho de Melo authored
      As this has all the things needed to format tracepoints events, not just
      syscalls, that, after all, are just tracepoints with a set in stone ABI,
      i.e. order and number of parameters.
      
      For tracepoints we'll create a
      
        static struct syscall_fmt tracepoint_fmts[]
      
      array and will fill the ->arg[] entries with the beautifier for each
      positional argument and record the name, then, when we need it, we'll
      just check that the position has the same name, maybe even type, so that
      we can do some check that the tracepoint hasn't changed, if it has, we
      can even reorder things.
      
      Keep calling it syscall_fmt but use it as well for tracepoints, do it
      this way to minimize changes and reuse what is in place for syscalls,
      we'll see.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-2x1jgiev13zt4njaanlnne0d@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9b2036cd
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Make evlist__set_evsel_handler() affect just entries without a handler · 206d635a
      Arnaldo Carvalho de Melo authored
      Renaming it to evlist__set_default_evsel_handler(), to better reflect
      what we want to do, which is to set a default handler for events we
      still haven't set a custom handler, like the ones for "msr:write_msr",
      etc that are coming soon.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-e1bit7upnpmtsayh8039kfuw@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      206d635a
    • Arnaldo Carvalho de Melo's avatar
      perf evlist: Adopt __set_tracepoint_handlers method from perf_session · c0e53476
      Arnaldo Carvalho de Melo authored
      It all operates on the evsels in the session's evlist, so move it to the
      evlist layer to make it useful to tools not using perf_session, just
      evlists, like 'perf trace' in live mode.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-9oc53gnfi53vg82fvolkm85g@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c0e53476
    • Arnaldo Carvalho de Melo's avatar
      perf top: Initialize perf_env->cpuid, needed by the per arch annotation init routine · 608127f7
      Arnaldo Carvalho de Melo authored
      Just read it so that later on the per arch init routine can use it,
      e.g. x86__annotate_init().
      
      When using a perf.data file this is obtained from a header that was put
      there by 'perf record', and then it may be for another machine, another
      arch.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-4t4n3o8l8s0tc2b1pq53hyr4@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      608127f7
    • Arnaldo Carvalho de Melo's avatar
      perf env: Add routine to read the env->cpuid from the running machine · f1cedfb8
      Arnaldo Carvalho de Melo authored
      In 'perf top' we use that cpuid when initializing the per arch
      annotation init routines (e.g. x86__annotate_init()) and in that case
      (live mode, 'perf top') we need to obtain it from the running machine,
      not from a perf.data file header.
      
      Provide a means to do that. Will be used by 'perf top' in a followup
      patch.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-h2wb3sx7u7znx6lqfezrh7ca@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1cedfb8
    • Alexander Shishkin's avatar
      perf/core: Fix inheritance of aux_output groups · f733c6b5
      Alexander Shishkin authored
      Commit:
      
        ab43762e ("perf: Allow normal events to output AUX data")
      
      forgets to configure aux_output relation in the inherited groups, which
      results in child PEBS events forever failing to schedule.
      
      Fix this by setting up the AUX output link in the inheritance path.
      Signed-off-by: default avatarAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: https://lkml.kernel.org/r/20191004125729.32397-1-alexander.shishkin@linux.intel.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      f733c6b5
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo-5.4-20191001' of... · a4cf7b39
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo-5.4-20191001' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
      perf script:
      
        Andi Kleen:
      
          - Fix recovery from LBR/binary mismatch in the "brstackinsn" --field.
      
      perf annotate:
      
        Arnaldo Carvalho de Melo:
      
        - Propagate errors so that meaningful messages can be presented to the
          user in case of problems.
      
      perf map:
      
        Steve MacLean:
      
        - Fix handling of maps partially overlapped, resolving symbols in the
          ranges not replaced by new mmaps.
      
      perf tests:
      
        Ian Rogers:
      
        - Use raise() instead of NULL derefs to avoid causing a SIGILL rather than a
          SIGSEGV for optimized builds that turn NULL derefs into ud2 instructions.
      
      perf LLVM:
      
        Ian Rogers:
      
        - Don't access out-of-scope array.
      
      perf inject:
      
        Steve MacLean:
      
        - Fix JIT_CODE_MOVE filename, that was having a u64 truncaded into a 32-bit
          snprintf format and also a missing ".so" suffix in another case.
      
      libsubcmd:
      
        Ian Rogers:
      
        - Make _FORTIFY_SOURCE defines dependent on the feature, avoiding
          false positives with with memory sanitizers such as LLVM's ASan.
      
      Vendor specific events:
      
      Intel:
      
        Andi Kleen:
      
        - Fix period for Intel fixed counters.
      
      s390:
      
        Thomas Richter (2):
      
        - Fix some event details transaction for machine type 8561.
      
      tools headers UAPI:
      
        Arnaldo Carvalho de Melo:
      
        - Sync headers with the kernel, catching new usbdevfs ioctls and
          madvise behaviours to properly decode in 'perf trace' output.
      
      Documentation:
      
        Steve MacLean:
      
        - Correct and clarify jitdump spec.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a4cf7b39
  2. 06 Oct, 2019 4 commits
    • Linus Torvalds's avatar
      Linux 5.4-rc2 · da0c9ea1
      Linus Torvalds authored
      da0c9ea1
    • Linus Torvalds's avatar
      elf: don't use MAP_FIXED_NOREPLACE for elf executable mappings · b212921b
      Linus Torvalds authored
      In commit 4ed28639 ("fs, elf: drop MAP_FIXED usage from elf_map") we
      changed elf to use MAP_FIXED_NOREPLACE instead of MAP_FIXED for the
      executable mappings.
      
      Then, people reported that it broke some binaries that had overlapping
      segments from the same file, and commit ad55eac7 ("elf: enforce
      MAP_FIXED on overlaying elf segments") re-instated MAP_FIXED for some
      overlaying elf segment cases.  But only some - despite the summary line
      of that commit, it only did it when it also does a temporary brk vma for
      one obvious overlapping case.
      
      Now Russell King reports another overlapping case with old 32-bit x86
      binaries, which doesn't trigger that limited case.  End result: we had
      better just drop MAP_FIXED_NOREPLACE entirely, and go back to MAP_FIXED.
      
      Yes, it's a sign of old binaries generated with old tool-chains, but we
      do pride ourselves on not breaking existing setups.
      
      This still leaves MAP_FIXED_NOREPLACE in place for the load_elf_interp()
      and the old load_elf_library() use-cases, because nobody has reported
      breakage for those. Yet.
      
      Note that in all the cases seen so far, the overlapping elf sections
      seem to be just re-mapping of the same executable with different section
      attributes.  We could possibly introduce a new MAP_FIXED_NOFILECHANGE
      flag or similar, which acts like NOREPLACE, but allows just remapping
      the same executable file using different protection flags.
      
      It's not clear that would make a huge difference to anything, but if
      people really hate that "elf remaps over previous maps" behavior, maybe
      at least a more limited form of remapping would alleviate some concerns.
      
      Alternatively, we should take a look at our elf_map() logic to see if we
      end up not mapping things properly the first time.
      
      In the meantime, this is the minimal "don't do that then" patch while
      people hopefully think about it more.
      Reported-by: default avatarRussell King <linux@armlinux.org.uk>
      Fixes: 4ed28639 ("fs, elf: drop MAP_FIXED usage from elf_map")
      Fixes: ad55eac7 ("elf: enforce  MAP_FIXED on overlaying elf segments")
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b212921b
    • Linus Torvalds's avatar
      Merge tag 'dma-mapping-5.4-1' of git://git.infradead.org/users/hch/dma-mapping · 7cdb85df
      Linus Torvalds authored
      Pull dma-mapping regression fix from Christoph Hellwig:
       "Revert an incorret hunk from a patch that caused problems on various
        arm boards (Andrey Smirnov)"
      
      * tag 'dma-mapping-5.4-1' of git://git.infradead.org/users/hch/dma-mapping:
        dma-mapping: fix false positive warnings in dma_common_free_remap()
      7cdb85df
    • Linus Torvalds's avatar
      Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 43b815c6
      Linus Torvalds authored
      Pull ARM SoC fixes from Olof Johansson:
       "A few fixes this time around:
      
         - Fixup of some clock specifications for DRA7 (device-tree fix)
      
         - Removal of some dead/legacy CPU OPP/PM code for OMAP that throws
           warnings at boot
      
         - A few more minor fixups for OMAPs, most around display
      
         - Enable STM32 QSPI as =y since their rootfs sometimes comes from
           there
      
         - Switch CONFIG_REMOTEPROC to =y since it went from tristate to bool
      
         - Fix of thermal zone definition for ux500 (5.4 regression)"
      
      * tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: multi_v7_defconfig: Fix SPI_STM32_QSPI support
        ARM: dts: ux500: Fix up the CPU thermal zone
        arm64/ARM: configs: Change CONFIG_REMOTEPROC from m to y
        ARM: dts: am4372: Set memory bandwidth limit for DISPC
        ARM: OMAP2+: Fix warnings with broken omap2_set_init_voltage()
        ARM: OMAP2+: Add missing LCDC midlemode for am335x
        ARM: OMAP2+: Fix missing reset done flag for am3 and am43
        ARM: dts: Fix gpio0 flags for am335x-icev2
        ARM: omap2plus_defconfig: Enable more droid4 devices as loadable modules
        ARM: omap2plus_defconfig: Enable DRM_TI_TFP410
        DTS: ARM: gta04: introduce legacy spi-cs-high to make display work again
        ARM: dts: Fix wrong clocks for dra7 mcasp
        clk: ti: dra7: Fix mcasp8 clock bits
      43b815c6
  3. 05 Oct, 2019 18 commits
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v5.4' of... · 2d00aee2
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - remove unneeded ar-option and KBUILD_ARFLAGS
      
       - remove long-deprecated SUBDIRS
      
       - fix modpost to suppress false-positive warnings for UML builds
      
       - fix namespace.pl to handle relative paths to ${objtree}, ${srctree}
      
       - make setlocalversion work for /bin/sh
      
       - make header archive reproducible
      
       - fix some Makefiles and documents
      
      * tag 'kbuild-fixes-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kheaders: make headers archive reproducible
        kbuild: update compile-test header list for v5.4-rc2
        kbuild: two minor updates for Documentation/kbuild/modules.rst
        scripts/setlocalversion: clear local variable to make it work for sh
        namespace: fix namespace.pl script to support relative paths
        video/logo: do not generate unneeded logo C files
        video/logo: remove unneeded *.o pattern from clean-files
        integrity: remove pointless subdir-$(CONFIG_...)
        integrity: remove unneeded, broken attempt to add -fshort-wchar
        modpost: fix static EXPORT_SYMBOL warnings for UML build
        kbuild: correct formatting of header in kbuild module docs
        kbuild: remove SUBDIRS support
        kbuild: remove ar-option and KBUILD_ARFLAGS
      2d00aee2
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 126195c9
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Twelve patches mostly small but obvious fixes or cosmetic but small
        updates"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: qla2xxx: Fix Nport ID display value
        scsi: qla2xxx: Fix N2N link up fail
        scsi: qla2xxx: Fix N2N link reset
        scsi: qla2xxx: Optimize NPIV tear down process
        scsi: qla2xxx: Fix stale mem access on driver unload
        scsi: qla2xxx: Fix unbound sleep in fcport delete path.
        scsi: qla2xxx: Silence fwdump template message
        scsi: hisi_sas: Make three functions static
        scsi: megaraid: disable device when probe failed after enabled device
        scsi: storvsc: setup 1:1 mapping between hardware queue and CPU queue
        scsi: qedf: Remove always false 'tmp_prio < 0' statement
        scsi: ufs: skip shutdown if hba is not powered
        scsi: bnx2fc: Handle scope bits when array returns BUSY or TSF
      126195c9
    • Linus Torvalds's avatar
      Merge branch 'readdir' (readdir speedup and sanity checking) · 4f11918a
      Linus Torvalds authored
      This makes getdents() and getdents64() do sanity checking on the
      pathname that it gives to user space.  And to mitigate the performance
      impact of that, it first cleans up the way it does the user copying, so
      that the code avoids doing the SMAP/PAN updates between each part of the
      dirent structure write.
      
      I really wanted to do this during the merge window, but didn't have
      time.  The conversion of filldir to unsafe_put_user() is something I've
      had around for years now in a private branch, but the extra pathname
      checking finally made me clean it up to the point where it is mergable.
      
      It's worth noting that the filename validity checking really should be a
      bit smarter: it would be much better to delay the error reporting until
      the end of the readdir, so that non-corrupted filenames are still
      returned.  But that involves bigger changes, so let's see if anybody
      actually hits the corrupt directory entry case before worrying about it
      further.
      
      * branch 'readdir':
        Make filldir[64]() verify the directory entry filename is valid
        Convert filldir[64]() from __put_user() to unsafe_put_user()
      4f11918a
    • Linus Torvalds's avatar
      Make filldir[64]() verify the directory entry filename is valid · 8a23eb80
      Linus Torvalds authored
      This has been discussed several times, and now filesystem people are
      talking about doing it individually at the filesystem layer, so head
      that off at the pass and just do it in getdents{64}().
      
      This is partially based on a patch by Jann Horn, but checks for NUL
      bytes as well, and somewhat simplified.
      
      There's also commentary about how it might be better if invalid names
      due to filesystem corruption don't cause an immediate failure, but only
      an error at the end of the readdir(), so that people can still see the
      filenames that are ok.
      
      There's also been discussion about just how much POSIX strictly speaking
      requires this since it's about filesystem corruption.  It's really more
      "protect user space from bad behavior" as pointed out by Jann.  But
      since Eric Biederman looked up the POSIX wording, here it is for context:
      
       "From readdir:
      
         The readdir() function shall return a pointer to a structure
         representing the directory entry at the current position in the
         directory stream specified by the argument dirp, and position the
         directory stream at the next entry. It shall return a null pointer
         upon reaching the end of the directory stream. The structure dirent
         defined in the <dirent.h> header describes a directory entry.
      
        From definitions:
      
         3.129 Directory Entry (or Link)
      
         An object that associates a filename with a file. Several directory
         entries can associate names with the same file.
      
        ...
      
         3.169 Filename
      
         A name consisting of 1 to {NAME_MAX} bytes used to name a file. The
         characters composing the name may be selected from the set of all
         character values excluding the slash character and the null byte. The
         filenames dot and dot-dot have special meaning. A filename is
         sometimes referred to as a 'pathname component'."
      
      Note that I didn't bother adding the checks to any legacy interfaces
      that nobody uses.
      
      Also note that if this ends up being noticeable as a performance
      regression, we can fix that to do a much more optimized model that
      checks for both NUL and '/' at the same time one word at a time.
      
      We haven't really tended to optimize 'memchr()', and it only checks for
      one pattern at a time anyway, and we really _should_ check for NUL too
      (but see the comment about "soft errors" in the code about why it
      currently only checks for '/')
      
      See the CONFIG_DCACHE_WORD_ACCESS case of hash_name() for how the name
      lookup code looks for pathname terminating characters in parallel.
      
      Link: https://lore.kernel.org/lkml/20190118161440.220134-2-jannh@google.com/
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Jann Horn <jannh@google.com>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8a23eb80
    • Linus Torvalds's avatar
      Convert filldir[64]() from __put_user() to unsafe_put_user() · 9f79b78e
      Linus Torvalds authored
      We really should avoid the "__{get,put}_user()" functions entirely,
      because they can easily be mis-used and the original intent of being
      used for simple direct user accesses no longer holds in a post-SMAP/PAN
      world.
      
      Manually optimizing away the user access range check makes no sense any
      more, when the range check is generally much cheaper than the "enable
      user accesses" code that the __{get,put}_user() functions still need.
      
      So instead of __put_user(), use the unsafe_put_user() interface with
      user_access_{begin,end}() that really does generate better code these
      days, and which is generally a nicer interface.  Under some loads, the
      multiple user writes that filldir() does are actually quite noticeable.
      
      This also makes the dirent name copy use unsafe_put_user() with a couple
      of macros.  We do not want to make function calls with SMAP/PAN
      disabled, and the code this generates is quite good when the
      architecture uses "asm goto" for unsafe_put_user() like x86 does.
      
      Note that this doesn't bother with the legacy cases.  Nobody should use
      them anyway, so performance doesn't really matter there.
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9f79b78e
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 9819a30c
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix ieeeu02154 atusb driver use-after-free, from Johan Hovold.
      
       2) Need to validate TCA_CBQ_WRROPT netlink attributes, from Eric
          Dumazet.
      
       3) txq null deref in mac80211, from Miaoqing Pan.
      
       4) ionic driver needs to select NET_DEVLINK, from Arnd Bergmann.
      
       5) Need to disable bh during nft_connlimit GC, from Pablo Neira Ayuso.
      
       6) Avoid division by zero in taprio scheduler, from Vladimir Oltean.
      
       7) Various xgmac fixes in stmmac driver from Jose Abreu.
      
       8) Avoid 64-bit division in mlx5 leading to link errors on 32-bit from
          Michal Kubecek.
      
       9) Fix bad VLAN check in rtl8366 DSA driver, from Linus Walleij.
      
      10) Fix sleep while atomic in sja1105, from Vladimir Oltean.
      
      11) Suspend/resume deadlock in stmmac, from Thierry Reding.
      
      12) Various UDP GSO fixes from Josh Hunt.
      
      13) Fix slab out of bounds access in tcp_zerocopy_receive(), from Eric
          Dumazet.
      
      14) Fix OOPS in __ipv6_ifa_notify(), from David Ahern.
      
      15) Memory leak in NFC's llcp_sock_bind, from Eric Dumazet.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (72 commits)
        selftests/net: add nettest to .gitignore
        net: qlogic: Fix memory leak in ql_alloc_large_buffers
        nfc: fix memory leak in llcp_sock_bind()
        sch_dsmark: fix potential NULL deref in dsmark_init()
        net: phy: at803x: use operating parameters from PHY-specific status
        net: phy: extract pause mode
        net: phy: extract link partner advertisement reading
        net: phy: fix write to mii-ctrl1000 register
        ipv6: Handle missing host route in __ipv6_ifa_notify
        net: phy: allow for reset line to be tied to a sleepy GPIO controller
        net: ipv4: avoid mixed n_redirects and rate_tokens usage
        r8152: Set macpassthru in reset_resume callback
        cxgb4:Fix out-of-bounds MSI-X info array access
        Revert "ipv6: Handle race in addrconf_dad_work"
        net: make sock_prot_memory_pressure() return "const char *"
        rxrpc: Fix rxrpc_recvmsg tracepoint
        qmi_wwan: add support for Cinterion CLS8 devices
        tcp: fix slab-out-of-bounds in tcp_zerocopy_receive()
        lib: textsearch: fix escapes in example code
        udp: only do GSO if # of segs > 1
        ...
      9819a30c
    • Linus Torvalds's avatar
      Merge tag 's390-5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 6fe137cb
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - defconfig updates
      
       - Fix build errors with CC_OPTIMIZE_FOR_SIZE due to usage of "i"
         constraint for function arguments. Two kvm changes acked-by Christian
         Borntraeger.
      
       - Fix -Wunused-but-set-variable warnings in mm code.
      
       - Avoid a constant misuse in qdio.
      
       - Handle a case when cpumf is temporarily unavailable.
      
      * tag 's390-5.4-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        KVM: s390: mark __insn32_query() as __always_inline
        KVM: s390: fix __insn32_query() inline assembly
        s390: update defconfigs
        s390/pci: mark function(s) __always_inline
        s390/mm: mark function(s) __always_inline
        s390/jump_label: mark function(s) __always_inline
        s390/cpu_mf: mark function(s) __always_inline
        s390/atomic,bitops: mark function(s) __always_inline
        s390/mm: fix -Wunused-but-set-variable warnings
        s390: mark __cpacf_query() as __always_inline
        s390/qdio: clarify size of the QIB parm area
        s390/cpumf: Fix indentation in sampling device driver
        s390/cpumsf: Check for CPU Measurement sampling
        s390/cpumf: Use consistant debug print format
      6fe137cb
    • Heiko Carstens's avatar
      KVM: s390: mark __insn32_query() as __always_inline · d0dea733
      Heiko Carstens authored
      __insn32_query() will not compile if the compiler decides to not
      inline it, since it contains an inline assembly with an "i" constraint
      with variable contents.
      Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      d0dea733
    • Heiko Carstens's avatar
      KVM: s390: fix __insn32_query() inline assembly · b1c41ac3
      Heiko Carstens authored
      The inline assembly constraints of __insn32_query() tell the compiler
      that only the first byte of "query" is being written to. Intended was
      probably that 32 bytes are written to.
      
      Fix and simplify the code and just use a "memory" clobber.
      
      Fixes: d6681397 ("KVM: s390: provide query function for instructions returning 32 byte")
      Cc: stable@vger.kernel.org # v5.2+
      Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      b1c41ac3
    • Andrey Smirnov's avatar
      dma-mapping: fix false positivse warnings in dma_common_free_remap() · 2cf2aa6a
      Andrey Smirnov authored
      Commit 5cf45379 ("dma-mapping: introduce a dma_common_find_pages
      helper") changed invalid input check in dma_common_free_remap() from:
      
          if (!area || !area->flags != VM_DMA_COHERENT)
      
      to
      
          if (!area || !area->flags != VM_DMA_COHERENT || !area->pages)
      
      which seem to produce false positives for memory obtained via
      dma_common_contiguous_remap()
      
      This triggers the following warning message when doing "reboot" on ZII
      VF610 Dev Board Rev B:
      
      WARNING: CPU: 0 PID: 1 at kernel/dma/remap.c:112 dma_common_free_remap+0x88/0x8c
      trying to free invalid coherent area: 9ef82980
      Modules linked in:
      CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.3.0-rc6-next-20190820 #119
      Hardware name: Freescale Vybrid VF5xx/VF6xx (Device Tree)
      Backtrace:
      [<8010d1ec>] (dump_backtrace) from [<8010d588>] (show_stack+0x20/0x24)
       r7:8015ed78 r6:00000009 r5:00000000 r4:9f4d9b14
      [<8010d568>] (show_stack) from [<8077e3f0>] (dump_stack+0x24/0x28)
      [<8077e3cc>] (dump_stack) from [<801197a0>] (__warn.part.3+0xcc/0xe4)
      [<801196d4>] (__warn.part.3) from [<80119830>] (warn_slowpath_fmt+0x78/0x94)
       r6:00000070 r5:808e540c r4:81c03048
      [<801197bc>] (warn_slowpath_fmt) from [<8015ed78>] (dma_common_free_remap+0x88/0x8c)
       r3:9ef82980 r2:808e53e0
       r7:00001000 r6:a0b1e000 r5:a0b1e000 r4:00001000
      [<8015ecf0>] (dma_common_free_remap) from [<8010fa9c>] (remap_allocator_free+0x60/0x68)
       r5:81c03048 r4:9f4d9b78
      [<8010fa3c>] (remap_allocator_free) from [<801100d0>] (__arm_dma_free.constprop.3+0xf8/0x148)
       r5:81c03048 r4:9ef82900
      [<8010ffd8>] (__arm_dma_free.constprop.3) from [<80110144>] (arm_dma_free+0x24/0x2c)
       r5:9f563410 r4:80110120
      [<80110120>] (arm_dma_free) from [<8015d80c>] (dma_free_attrs+0xa0/0xdc)
      [<8015d76c>] (dma_free_attrs) from [<8020f3e4>] (dma_pool_destroy+0xc0/0x154)
       r8:9efa8860 r7:808f02f0 r6:808f02d0 r5:9ef82880 r4:9ef82780
      [<8020f324>] (dma_pool_destroy) from [<805525d0>] (ehci_mem_cleanup+0x6c/0x150)
       r7:9f563410 r6:9efa8810 r5:00000000 r4:9efd0148
      [<80552564>] (ehci_mem_cleanup) from [<80558e0c>] (ehci_stop+0xac/0xc0)
       r5:9efd0148 r4:9efd0000
      [<80558d60>] (ehci_stop) from [<8053c4bc>] (usb_remove_hcd+0xf4/0x1b0)
       r7:9f563410 r6:9efd0074 r5:81c03048 r4:9efd0000
      [<8053c3c8>] (usb_remove_hcd) from [<8056361c>] (host_stop+0x48/0xb8)
       r7:9f563410 r6:9efd0000 r5:9f5f4040 r4:9f5f5040
      [<805635d4>] (host_stop) from [<80563d0c>] (ci_hdrc_host_destroy+0x34/0x38)
       r7:9f563410 r6:9f5f5040 r5:9efa8800 r4:9f5f4040
      [<80563cd8>] (ci_hdrc_host_destroy) from [<8055ef18>] (ci_hdrc_remove+0x50/0x10c)
      [<8055eec8>] (ci_hdrc_remove) from [<804a2ed8>] (platform_drv_remove+0x34/0x4c)
       r7:9f563410 r6:81c4f99c r5:9efa8810 r4:9efa8810
      [<804a2ea4>] (platform_drv_remove) from [<804a18a8>] (device_release_driver_internal+0xec/0x19c)
       r5:00000000 r4:9efa8810
      [<804a17bc>] (device_release_driver_internal) from [<804a1978>] (device_release_driver+0x20/0x24)
       r7:9f563410 r6:81c41ed0 r5:9efa8810 r4:9f4a1dac
      [<804a1958>] (device_release_driver) from [<804a01b8>] (bus_remove_device+0xdc/0x108)
      [<804a00dc>] (bus_remove_device) from [<8049c204>] (device_del+0x150/0x36c)
       r7:9f563410 r6:81c03048 r5:9efa8854 r4:9efa8810
      [<8049c0b4>] (device_del) from [<804a3368>] (platform_device_del.part.2+0x20/0x84)
       r10:9f563414 r9:809177e0 r8:81cb07dc r7:81c78320 r6:9f563454 r5:9efa8800
       r4:9efa8800
      [<804a3348>] (platform_device_del.part.2) from [<804a3420>] (platform_device_unregister+0x28/0x34)
       r5:9f563400 r4:9efa8800
      [<804a33f8>] (platform_device_unregister) from [<8055dce0>] (ci_hdrc_remove_device+0x1c/0x30)
       r5:9f563400 r4:00000001
      [<8055dcc4>] (ci_hdrc_remove_device) from [<805652ac>] (ci_hdrc_imx_remove+0x38/0x118)
       r7:81c78320 r6:9f563454 r5:9f563410 r4:9f541010
      [<8056538c>] (ci_hdrc_imx_shutdown) from [<804a2970>] (platform_drv_shutdown+0x2c/0x30)
      [<804a2944>] (platform_drv_shutdown) from [<8049e4fc>] (device_shutdown+0x158/0x1f0)
      [<8049e3a4>] (device_shutdown) from [<8013ac80>] (kernel_restart_prepare+0x44/0x48)
       r10:00000058 r9:9f4d8000 r8:fee1dead r7:379ce700 r6:81c0b280 r5:81c03048
       r4:00000000
      [<8013ac3c>] (kernel_restart_prepare) from [<8013ad14>] (kernel_restart+0x1c/0x60)
      [<8013acf8>] (kernel_restart) from [<8013af84>] (__do_sys_reboot+0xe0/0x1d8)
       r5:81c03048 r4:00000000
      [<8013aea4>] (__do_sys_reboot) from [<8013b0ec>] (sys_reboot+0x18/0x1c)
       r8:80101204 r7:00000058 r6:00000000 r5:00000000 r4:00000000
      [<8013b0d4>] (sys_reboot) from [<80101000>] (ret_fast_syscall+0x0/0x54)
      Exception stack(0x9f4d9fa8 to 0x9f4d9ff0)
      9fa0:                   00000000 00000000 fee1dead 28121969 01234567 379ce700
      9fc0: 00000000 00000000 00000000 00000058 00000000 00000000 00000000 00016d04
      9fe0: 00028e0c 7ec87c64 000135ec 76c1f410
      
      Restore original invalid input check in dma_common_free_remap() to
      avoid this problem.
      
      Fixes: 5cf45379 ("dma-mapping: introduce a dma_common_find_pages helper")
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      [hch: just revert the offending hunk instead of creating a new helper]
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      2cf2aa6a
    • Dmitry Goldin's avatar
      kheaders: make headers archive reproducible · 86cdd2fd
      Dmitry Goldin authored
      In commit 43d8ce9d ("Provide in-kernel headers to make
      extending kernel easier") a new mechanism was introduced, for kernels
      >=5.2, which embeds the kernel headers in the kernel image or a module
      and exposes them in procfs for use by userland tools.
      
      The archive containing the header files has nondeterminism caused by
      header files metadata. This patch normalizes the metadata and utilizes
      KBUILD_BUILD_TIMESTAMP if provided and otherwise falls back to the
      default behaviour.
      
      In commit f7b101d3 ("kheaders: Move from proc to sysfs") it was
      modified to use sysfs and the script for generation of the archive was
      renamed to what is being patched.
      Signed-off-by: default avatarDmitry Goldin <dgoldin+lkml@protonmail.ch>
      Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reviewed-by: default avatarJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      86cdd2fd
    • Masahiro Yamada's avatar
      kbuild: update compile-test header list for v5.4-rc2 · d188b8c9
      Masahiro Yamada authored
      Commit 6dc280eb ("coda: remove uapi/linux/coda_psdev.h") removed
      a header in question. Some more build errors were fixed. Add more
      headers into the test coverage.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      d188b8c9
    • Masahiro Yamada's avatar
      kbuild: two minor updates for Documentation/kbuild/modules.rst · 43496709
      Masahiro Yamada authored
      Capitalize the first word in the sentence.
      
      Use obj-m instead of obj-y. obj-y still works, but we have no built-in
      objects in external module builds. So, obj-m is better IMHO.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      43496709
    • Masahiro Yamada's avatar
      scripts/setlocalversion: clear local variable to make it work for sh · 7a82e3fa
      Masahiro Yamada authored
      Geert Uytterhoeven reports a strange side-effect of commit 858805b3
      ("kbuild: add $(BASH) to run scripts with bash-extension"), which
      inserts the contents of a localversion file in the build directory twice.
      
      [Steps to Reproduce]
        $ echo bar > localversion
        $ mkdir build
        $ cd build/
        $ echo foo > localversion
        $ make -s -f ../Makefile defconfig include/config/kernel.release
        $ cat include/config/kernel.release
        5.4.0-rc1foofoobar
      
      This comes down to the behavior change of local variables.
      
      The 'man sh' on my Ubuntu machine, where sh is an alias to dash,
      explains as follows:
        When a variable is made local, it inherits the initial value and
        exported and readonly flags from the variable with the same name
        in the surrounding scope, if there is one. Otherwise, the variable
        is initially unset.
      
      [Test Code]
      
        foo ()
        {
                local res
                echo "res: $res"
        }
      
        res=1
        foo
      
      [Result]
      
        $ sh test.sh
        res: 1
        $ bash test.sh
        res:
      
      So, scripts/setlocalversion correctly works only for bash in spite of
      its hashbang being #!/bin/sh. Nobody had noticed it before because
      CONFIG_SHELL was previously set to bash almost all the time.
      
      Now that CONFIG_SHELL is set to sh, we must write portable and correct
      code. I gave the Fixes tag to the commit that uncovered the issue.
      
      Clear the variable 'res' in collect_files() to make it work for sh
      (and it also works on distributions where sh is an alias to bash).
      
      Fixes: 858805b3 ("kbuild: add $(BASH) to run scripts with bash-extension")
      Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      7a82e3fa
    • Jacob Keller's avatar
      namespace: fix namespace.pl script to support relative paths · 82fdd12b
      Jacob Keller authored
      The namespace.pl script does not work properly if objtree is not set to
      an absolute path. The do_nm function is run from within the find
      function, which changes directories.
      
      Because of this, appending objtree, $File::Find::dir, and $source, will
      return a path which is not valid from the current directory.
      
      This used to work when objtree was set to an absolute path when using
      "make namespacecheck". It appears to have not worked when calling
      ./scripts/namespace.pl directly.
      
      This behavior was changed in 7e1c0477 ("kbuild: Use relative path
      for $(objtree)", 2014-05-14)
      
      Rather than fixing the Makefile to set objtree to an absolute path, just
      fix namespace.pl to work when srctree and objtree are relative. Also fix
      the script to use an absolute path for these by default.
      
      Use the File::Spec module for this purpose. It's been part of perl
      5 since 5.005.
      
      The curdir() function is used to get the current directory when the
      objtree and srctree aren't set in the environment.
      
      rel2abs() is used to convert possibly relative objtree and srctree
      environment variables to absolute paths.
      
      Finally, the catfile() function is used instead of string appending
      paths together, since this is more robust when joining paths together.
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      82fdd12b
    • Masahiro Yamada's avatar
      video/logo: do not generate unneeded logo C files · 01bb2515
      Masahiro Yamada authored
      Currently, all the logo C files are generated irrespective of the
      CONFIG options. Adding them to extra-y is wrong. What we need to do
      here is to add them to 'targets' so that if_changed works properly.
      
      Files listed in 'targets' are cleaned, so clean-files is unneeded.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      01bb2515
    • Masahiro Yamada's avatar
      video/logo: remove unneeded *.o pattern from clean-files · a9bbe79f
      Masahiro Yamada authored
      The pattern *.o is cleaned up globally by the top Makefile.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      a9bbe79f
    • Masahiro Yamada's avatar
      integrity: remove pointless subdir-$(CONFIG_...) · 7a8beb7a
      Masahiro Yamada authored
      The ima/ and evm/ sub-directories contain built-in objects, so
      obj-$(CONFIG_...) is the correct way to descend into them.
      
      subdir-$(CONFIG_...) is redundant.
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      7a8beb7a