1. 23 Nov, 2015 9 commits
    • Andi Kleen's avatar
      perf/x86: Optimize stack walk user accesses · 75925e1a
      Andi Kleen authored
      Change the perf user stack walking to use the new
      __copy_from_user_nmi(), and split each access into word sized transfer
      sizes. This allows to inline the complete access and optimize it all
      into a single load.
      
      The main advantage is that this avoids the overhead of double page
      faults.  When normal copy_from_user() fails it reexecutes the copy to
      compute an accurate number of non copied bytes. This leads to
      executing the expensive page fault twice.
      
      While walking stacks having a fault at some point is relatively common
      (typically when some part of the program isn't compiled with frame
      pointers), so this is a large overhead.
      
      With the optimized copies we avoid this problem because they only do
      all accesses once. And of course they're much faster too when the
      access does not fault because they're just single instructions instead
      of complex function calls.
      
      While profiling a kernel build with -g, the patch brings down the
      average time of the PMI handler from 966ns to 552ns (-43%).
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Link: http://lkml.kernel.org/r/1445551641-13379-2-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      75925e1a
    • Andi Kleen's avatar
      x86: Add an inlined __copy_from_user_nmi() variant · 10013ebb
      Andi Kleen authored
      Add a inlined __ variant of copy_from_user_nmi. The inlined variant allows
      the user to:
      
       - batch the access_ok() check for multiple accesses
      
       - avoid having a pagefault_disable/enable() on every access if the
         caller already ensures disabled page faults due to its context.
      
       - get all the optimizations in copy_*_user() for small constant sized
         transfers
      
      It is just a define to __copy_from_user_inatomic().
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/1445551641-13379-1-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      10013ebb
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 8c2accc8
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - Allows BPF scriptlets specify arguments to be fetched using
          DWARF info, using a prologue generated at compile/build time (He Kuang, Wang Nan)
      
        - Allow attaching BPF scriptlets to module symbols (Wang Nan)
      
        - Allow attaching BPF scriptlets to userspace code using uprobe (Wang Nan)
      
        - BPF programs now can specify 'perf probe' tunables via its section name,
          separating key=val values using semicolons (Wang Nan)
      
      Testing some of these new BPF features:
      
        Use case: get callchains when receiving SSL packets, filter then in the
                  kernel, at arbitrary place.
      
        # cat ssl.bpf.c
        #define SEC(NAME) __attribute__((section(NAME), used))
      
        struct pt_regs;
      
        SEC("func=__inet_lookup_established hnum")
        int func(struct pt_regs *ctx, int err, unsigned short port)
        {
                return err == 0 && port == 443;
        }
      
        char _license[] SEC("license") = "GPL";
        int  _version   SEC("version") = LINUX_VERSION_CODE;
        #
        # perf record -a -g -e ssl.bpf.c
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.787 MB perf.data (3 samples) ]
        # perf script | head -30
        swapper     0 [000] 58783.268118: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
      	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
      	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
      	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
      	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
      	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
      	 8572a8 process_backlog (/lib/modules/4.3.0+/build/vmlinux)
      	 856b11 net_rx_action (/lib/modules/4.3.0+/build/vmlinux)
      	 2a284b __do_softirq (/lib/modules/4.3.0+/build/vmlinux)
      	 2a2ba3 irq_exit (/lib/modules/4.3.0+/build/vmlinux)
      	 96b7a4 do_IRQ (/lib/modules/4.3.0+/build/vmlinux)
      	 969807 ret_from_intr (/lib/modules/4.3.0+/build/vmlinux)
      	 2dede5 cpu_startup_entry (/lib/modules/4.3.0+/build/vmlinux)
      	 95d5bc rest_init (/lib/modules/4.3.0+/build/vmlinux)
      	1163ffa start_kernel ([kernel.vmlinux].init.text)
      	11634d7 x86_64_start_reservations ([kernel.vmlinux].init.text)
      	1163623 x86_64_start_kernel ([kernel.vmlinux].init.text)
      
        qemu-system-x86  9178 [003] 58785.792417: perf_bpf_probe:func: (ffffffff816a0f60) hnum=0x1bb
      	 8a0f61 __inet_lookup_established (/lib/modules/4.3.0+/build/vmlinux)
      	 896def ip_rcv_finish (/lib/modules/4.3.0+/build/vmlinux)
      	 8976c2 ip_rcv (/lib/modules/4.3.0+/build/vmlinux)
      	 855eba __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
      	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
      	 856660 netif_receive_skb_internal (/lib/modules/4.3.0+/build/vmlinux)
      	 8566ec netif_receive_skb_sk (/lib/modules/4.3.0+/build/vmlinux)
      	   430a br_handle_frame_finish ([bridge])
      	   48bc br_handle_frame ([bridge])
      	 855f44 __netif_receive_skb_core (/lib/modules/4.3.0+/build/vmlinux)
      	 8565d8 __netif_receive_skb (/lib/modules/4.3.0+/build/vmlinux)
        #
      
          Use 'perf probe' various options to list functions, see what variables can
          be collected at any given point, experiment first collecting without a filter,
          then filter, use it together with 'perf trace', 'perf top', with or without
          callchains, if it explodes, please tell us!
      
        - Introduce a new callchain mode: "folded", that will list per line
          representations of all callchains for a give histogram entry, facilitating
          'perf report' output processing by other tools, such as Brendan Gregg's
          flamegraph tools (Namhyung Kim)
      
        E.g:
      
       # perf report | grep -v ^# | head
          18.37%     0.00%  swapper  [kernel.kallsyms]   [k] cpu_startup_entry
                          |
                          ---cpu_startup_entry
                             |
                             |--12.07%--start_secondary
                             |
                              --6.30%--rest_init
                                        start_kernel
                                        x86_64_start_reservations
                                        x86_64_start_kernel
        #
      
       Becomes, in "folded" mode:
      
       # perf report -g folded | grep -v ^# | head -5
           18.37%     0.00%  swapper [kernel.kallsyms]   [k] cpu_startup_entry
         12.07% cpu_startup_entry;start_secondary
          6.30% cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
           16.90%     0.00%  swapper [kernel.kallsyms]   [k] call_cpuidle
         11.23% call_cpuidle;cpu_startup_entry;start_secondary
          5.67% call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
           16.90%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter
         11.23% cpuidle_enter;call_cpuidle;cpu_startup_entry;start_secondary
          5.67% cpuidle_enter;call_cpuidle;cpu_startup_entry;rest_init;start_kernel;x86_64_start_reservations;x86_64_start_kernel
           15.12%     0.00%  swapper [kernel.kallsyms]   [k] cpuidle_enter_state
        #
      
         The user can also select one of "count", "period" or "percent" as the first column.
      
      Infrastructure changes:
      
        - Fix multiple leaks found with Valgrind and a refcount
          debugger (Masami Hiramatsu)
      
        - Add further 'perf test' entries for BPF and LLVM (Wang Nan)
      
        - Improve 'perf test' to suport subtests, so that the series of tests
          performed in the LLVM and BPF main tests appear in the default 'perf test'
          output (Wang Nan)
      
        - Move memdup() from tools/perf to tools/lib/string.c (Arnaldo Carvalho de Melo)
      
        - Adopt strtobool() from the kernel into tools/lib/ (Wang Nan)
      
        - Fix selftests_install tools/ Makefile rule (Kevin Hilman)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      8c2accc8
    • Peter Zijlstra's avatar
      treewide: Remove old email address · 90eec103
      Peter Zijlstra authored
      There were still a number of references to my old Red Hat email
      address in the kernel source. Remove these while keeping the
      Red Hat copyright notices intact.
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      90eec103
    • Andi Kleen's avatar
      perf/x86: Fix LBR call stack save/restore · b28ae956
      Andi Kleen authored
      This fixes a bug I added in the following commit:
      
        90405aa0 ("perf/x86/intel/lbr: Limit LBR accesses to TOS in callstack mode")
      
      The bug could lead to lost LBR call stacks. When restoring the LBR state
      we need to use the TOS of the previous context, not the current context.
      To do that we need to save/restore the TOS.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: acme@kernel.org
      Cc: jolsa@kernel.org
      Link: http://lkml.kernel.org/r/1445366797-30894-1-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b28ae956
    • Peter Zijlstra's avatar
      perf: Update email address in MAINTAINERS · daecbd26
      Peter Zijlstra authored
      While still valid, I'm trying to phase out this email address.
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      daecbd26
    • Stephane Eranian's avatar
      perf/core: Robustify the perf_cgroup_from_task() RCU checks · 614e4c4e
      Stephane Eranian authored
      This patch reinforces the lockdep checks performed by
      perf_cgroup_from_tsk() by passing the perf_event_context
      whenever possible. It is okay to not hold the RCU read lock
      when we know we hold the ctx->lock. This patch makes sure this
      property holds.
      
      In some functions, such as perf_cgroup_sched_in(), we do not
      pass the context because we are sure we are holding the RCU
      read lock.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: edumazet@google.com
      Link: http://lkml.kernel.org/r/1447322404-10920-3-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      614e4c4e
    • Stephane Eranian's avatar
      perf/core: Fix RCU problem with cgroup context switching code · ddaaf4e2
      Stephane Eranian authored
      The RCU checker detected RCU violation in the cgroup switching routines
      perf_cgroup_sched_in() and perf_cgroup_sched_out(). We were dereferencing
      cgroup from task without holding the RCU lock.
      
      Fix this by holding the RCU read lock. We move the locking from
      perf_cgroup_switch() to avoid double locking.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: edumazet@google.com
      Link: http://lkml.kernel.org/r/1447322404-10920-2-git-send-email-eranian@google.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ddaaf4e2
    • Linus Torvalds's avatar
      Linux 4.4-rc2 · 1ec21837
      Linus Torvalds authored
      1ec21837
  2. 22 Nov, 2015 20 commits
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 104e2a6f
      Linus Torvalds authored
      Merge slub bulk allocator updates from Andrew Morton:
       "This missed the merge window because I was waiting for some repairs to
        come in.  Nothing actually uses the bulk allocator yet and the changes
        to other code paths are pretty small.  And the net guys are waiting
        for this so they can start merging the client code"
      
      More comments from Jesper Dangaard Brouer:
       "The kmem_cache_alloc_bulk() call, in mm/slub.c, were included in
        previous kernel.  The present version contains a bug.  Vladimir
        Davydov noticed it contained a bug, when kernel is compiled with
        CONFIG_MEMCG_KMEM (see commit 03ec0ed5: "slub: fix kmem cgroup
        bug in kmem_cache_alloc_bulk").  Plus the mem cgroup counterpart in
        kmem_cache_free_bulk() were missing (see commit 03374518 "slub:
        add missing kmem cgroup support to kmem_cache_free_bulk").
      
        I don't consider the fix stable-material because there are no in-tree
        users of the API.
      
        But with known bugs (for memcg) I cannot start using the API in the
        net-tree"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>:
        slab/slub: adjust kmem_cache_alloc_bulk API
        slub: add missing kmem cgroup support to kmem_cache_free_bulk
        slub: fix kmem cgroup bug in kmem_cache_alloc_bulk
        slub: optimize bulk slowpath free by detached freelist
        slub: support for bulk free with SLUB freelists
      104e2a6f
    • Linus Torvalds's avatar
      Merge tag 'tty-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · dcfeda9d
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are a few small tty/serial driver fixes for 4.4-rc2 that resolve
        some reported problems.
      
        All have been in linux-next, full details are in the shortlog below"
      
      * tag 'tty-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: export fsl8250_handle_irq
        serial: 8250_mid: Add missing dependency
        tty: audit: Fix audit source
        serial: etraxfs-uart: Fix crash
        serial: fsl_lpuart: Fix earlycon support
        bcm63xx_uart: Use the device name when registering an interrupt
        tty: Fix direct use of tty buffer work
        tty: Fix tty_send_xchar() lock order inversion
      dcfeda9d
    • Linus Torvalds's avatar
      Merge tag 'staging-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 7f217393
      Linus Torvalds authored
      Pull staging/IIO fixes from Greg KH:
       "Here are some staging and iio driver fixes for 4.4-rc2.  All of these
        are in response to issues that have been reported and have been in
        linux-next for a while"
      
      * tag 'staging-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        Revert "Staging: wilc1000: coreconfigurator: Drop unneeded wrapper functions"
        iio: adc: xilinx: Fix VREFN scale
        iio: si7020: Swap data byte order
        iio: adc: vf610_adc: Fix division by zero error
        iio:ad7793: Fix ad7785 product ID
        iio: ad5064: Fix ad5629/ad5669 shift
        iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success
        iio: lpc32xx_adc: fix warnings caused by enabling unprepared clock
        staging: iio: select IRQ_WORK for IIO_DUMMY_EVGEN
        vf610_adc: Fix internal temperature calculation
      7f217393
    • Linus Torvalds's avatar
      Merge tag 'usb-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 6d2d91b3
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a number of USB fixes and new device ids for 4.4-rc2.  All
        have been in linux-next and the details are in the shortlog"
      
      * tag 'usb-4.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (28 commits)
        usblp: do not set TASK_INTERRUPTIBLE before lock
        USB: MAINTAINERS: cxacru
        usb: kconfig: fix warning of select USB_OTG
        USB: option: add XS Stick W100-2 from 4G Systems
        xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices
        usb: xhci: fix checking ep busy for CFC
        xhci: Workaround to get Intel xHCI reset working more reliably
        usb: chipidea: imx: fix a possible NULL dereference
        usb: chipidea: usbmisc_imx: fix a possible NULL dereference
        usb: chipidea: otg: gadget module load and unload support
        usb: chipidea: debug: disable usb irq while role switch
        ARM: dts: imx27.dtsi: change the clock information for usb
        usb: chipidea: imx: refine clock operations to adapt for all platforms
        usb: gadget: atmel_usba_udc: Expose correct device speed
        usb: musb: enable usb_dma parameter
        usb: phy: phy-mxs-usb: fix a possible NULL dereference
        usb: dwc3: gadget: let us set lower max_speed
        usb: musb: fix tx fifo flush handling
        usb: gadget: f_loopback: fix the warning during the enumeration
        usb: dwc2: host: Fix remote wakeup when not in DWC2_L2
        ...
      6d2d91b3
    • Linus Torvalds's avatar
      Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · 0ec7dc8d
      Linus Torvalds authored
      Pull MIPS fixes from Ralf Baechle:
      
       - Fix a flood of annoying build warnings
      
       - A number of fixes for Atheros 79xx platforms
      
      * 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        MIPS: ath79: Add a machine entry for booting OF machines
        MIPS: ath79: Fix the size of the MISC INTC registers in ar9132.dtsi
        MIPS: ath79: Fix the DDR control initialization on ar71xx and ar934x
        MIPS: Fix flood of warnings about comparsion being always true.
      0ec7dc8d
    • Linus Torvalds's avatar
      Merge branch 'parisc-4.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 94521b2f
      Linus Torvalds authored
      Pull parisc update from Helge Deller:
       "This patchset adds Huge Page and HUGETLBFS support for parisc"
      
      Honestly, the hugepage support should have gone through in the merge
      window, and is not really an rc-time fix.  But it only touches
      arch/parisc, and I cannot find it in myself to care.  If one of the
      three parisc users notices a breakage, I will point at Helge and make
      rude farting noises.
      
      * 'parisc-4.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Map kernel text and data on huge pages
        parisc: Add Huge Page and HUGETLBFS support
        parisc: Use long branch to do_syscall_trace_exit
        parisc: Increase initial kernel mapping to 32MB on 64bit kernel
        parisc: Initialize the fault vector earlier in the boot process.
        parisc: Add defines for Huge page support
        parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h
        parisc: Drop definition of start_thread_som for HP-UX SOM binaries
        parisc: Fix wrong comment regarding first pmd entry flags
      94521b2f
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 727cde6c
      Linus Torvalds authored
      Pull perf tool fixes from Thomas Gleixner:
       "A couple of fixes for perf tools:
      
         - Build system updates
      
         - Plug a memory leak in an error path of perf probe
      
         - Tear down probes correctly when adding fails
      
         - Fixes to the perf symbol handling
      
         - Fix ordering of event processing in buildid-list
      
         - Fix per DSO filtering in the histogram browser"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf probe: Clear probe_trace_event when add_probe_trace_event() fails
        perf probe: Fix memory leaking on failure by clearing all probe_trace_events
        perf inject: Also re-pipe lost_samples event
        perf buildid-list: Requires ordered events
        perf symbols: Fix dso lookup by long name and missing buildids
        perf symbols: Allow forcing reading of non-root owned files by root
        perf hists browser: The dso can be obtained from popup_action->ms.map->dso
        perf hists browser: Fix 'd' hotkey action to filter by DSO
        perf symbols: Rebuild rbtree when adjusting symbols for kcore
        tools: Add a "make all" rule
        tools: Actually install tmon in the install rule
      727cde6c
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 069ec229
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "This update contains:
      
         - MPX updates for handling 32bit processes
      
         - A fix for a long standing bug in 32bit signal frame handling
           related to FPU/XSAVE state
      
         - Handle get_xsave_addr() correctly in KVM
      
         - Fix SMAP check under paravirtualization
      
         - Add a comment to the static function trace entry to avoid further
           confusion about the difference to dynamic tracing"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Fix SMAP check in PVOPS environments
        x86/ftrace: Add comment on static function tracing
        x86/fpu: Fix get_xsave_addr() behavior under virtualization
        x86/fpu: Fix 32-bit signal frame handling
        x86/mpx: Fix 32-bit address space calculation
        x86/mpx: Do proper get_user() when running 32-bit binaries on 64-bit kernels
      069ec229
    • Jesper Dangaard Brouer's avatar
      slab/slub: adjust kmem_cache_alloc_bulk API · 865762a8
      Jesper Dangaard Brouer authored
      Adjust kmem_cache_alloc_bulk API before we have any real users.
      
      Adjust API to return type 'int' instead of previously type 'bool'.  This
      is done to allow future extension of the bulk alloc API.
      
      A future extension could be to allow SLUB to stop at a page boundary, when
      specified by a flag, and then return the number of objects.
      
      The advantage of this approach, would make it easier to make bulk alloc
      run without local IRQs disabled.  With an approach of cmpxchg "stealing"
      the entire c->freelist or page->freelist.  To avoid overshooting we would
      stop processing at a slab-page boundary.  Else we always end up returning
      some objects at the cost of another cmpxchg.
      
      To keep compatible with future users of this API linking against an older
      kernel when using the new flag, we need to return the number of allocated
      objects with this API change.
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Cc: Vladimir Davydov <vdavydov@virtuozzo.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      865762a8
    • Jesper Dangaard Brouer's avatar
      slub: add missing kmem cgroup support to kmem_cache_free_bulk · 03374518
      Jesper Dangaard Brouer authored
      Initial implementation missed support for kmem cgroup support in
      kmem_cache_free_bulk() call, add this.
      
      If CONFIG_MEMCG_KMEM is not enabled, the compiler should be smart enough
      to not add any asm code.
      
      Incoming bulk free objects can belong to different kmem cgroups, and
      object free call can happen at a later point outside memcg context.  Thus,
      we need to keep the orig kmem_cache, to correctly verify if a memcg object
      match against its "root_cache" (s->memcg_params.root_cache).
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Reviewed-by: default avatarVladimir Davydov <vdavydov@virtuozzo.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      03374518
    • Jesper Dangaard Brouer's avatar
      slub: fix kmem cgroup bug in kmem_cache_alloc_bulk · 03ec0ed5
      Jesper Dangaard Brouer authored
      The call slab_pre_alloc_hook() interacts with kmemgc and is not allowed to
      be called several times inside the bulk alloc for loop, due to the call to
      memcg_kmem_get_cache().
      
      This would result in hitting the VM_BUG_ON in __memcg_kmem_get_cache.
      
      As suggested by Vladimir Davydov, change slab_post_alloc_hook() to be able
      to handle an array of objects.
      
      A subtle detail is, loop iterator "i" in slab_post_alloc_hook() must have
      same type (size_t) as size argument.  This helps the compiler to easier
      realize that it can remove the loop, when all debug statements inside loop
      evaluates to nothing.  Note, this is only an issue because the kernel is
      compiled with GCC option: -fno-strict-overflow
      
      In slab_alloc_node() the compiler inlines and optimizes the invocation of
      slab_post_alloc_hook(s, flags, 1, &object) by removing the loop and access
      object directly.
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Reported-by: default avatarVladimir Davydov <vdavydov@virtuozzo.com>
      Suggested-by: default avatarVladimir Davydov <vdavydov@virtuozzo.com>
      Reviewed-by: default avatarVladimir Davydov <vdavydov@virtuozzo.com>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      03ec0ed5
    • Jesper Dangaard Brouer's avatar
      slub: optimize bulk slowpath free by detached freelist · d0ecd894
      Jesper Dangaard Brouer authored
      This change focus on improving the speed of object freeing in the
      "slowpath" of kmem_cache_free_bulk.
      
      The calls slab_free (fastpath) and __slab_free (slowpath) have been
      extended with support for bulk free, which amortize the overhead of
      the (locked) cmpxchg_double.
      
      To use the new bulking feature, we build what I call a detached
      freelist.  The detached freelist takes advantage of three properties:
      
       1) the free function call owns the object that is about to be freed,
          thus writing into this memory is synchronization-free.
      
       2) many freelist's can co-exist side-by-side in the same slab-page
          each with a separate head pointer.
      
       3) it is the visibility of the head pointer that needs synchronization.
      
      Given these properties, the brilliant part is that the detached
      freelist can be constructed without any need for synchronization.  The
      freelist is constructed directly in the page objects, without any
      synchronization needed.  The detached freelist is allocated on the
      stack of the function call kmem_cache_free_bulk.  Thus, the freelist
      head pointer is not visible to other CPUs.
      
      All objects in a SLUB freelist must belong to the same slab-page.
      Thus, constructing the detached freelist is about matching objects
      that belong to the same slab-page.  The bulk free array is scanned is
      a progressive manor with a limited look-ahead facility.
      
      Kmem debug support is handled in call of slab_free().
      
      Notice kmem_cache_free_bulk no longer need to disable IRQs. This
      only slowed down single free bulk with approx 3 cycles.
      
      Performance data:
       Benchmarked[1] obj size 256 bytes on CPU i7-4790K @ 4.00GHz
      
      SLUB fastpath single object quick reuse: 47 cycles(tsc) 11.931 ns
      
      To get stable and comparable numbers, the kernel have been booted with
      "slab_merge" (this also improve performance for larger bulk sizes).
      
      Performance data, compared against fallback bulking:
      
      bulk -  fallback bulk            - improvement with this patch
         1 -  62 cycles(tsc) 15.662 ns - 49 cycles(tsc) 12.407 ns- improved 21.0%
         2 -  55 cycles(tsc) 13.935 ns - 30 cycles(tsc) 7.506 ns - improved 45.5%
         3 -  53 cycles(tsc) 13.341 ns - 23 cycles(tsc) 5.865 ns - improved 56.6%
         4 -  52 cycles(tsc) 13.081 ns - 20 cycles(tsc) 5.048 ns - improved 61.5%
         8 -  50 cycles(tsc) 12.627 ns - 18 cycles(tsc) 4.659 ns - improved 64.0%
        16 -  49 cycles(tsc) 12.412 ns - 17 cycles(tsc) 4.495 ns - improved 65.3%
        30 -  49 cycles(tsc) 12.484 ns - 18 cycles(tsc) 4.533 ns - improved 63.3%
        32 -  50 cycles(tsc) 12.627 ns - 18 cycles(tsc) 4.707 ns - improved 64.0%
        34 -  96 cycles(tsc) 24.243 ns - 23 cycles(tsc) 5.976 ns - improved 76.0%
        48 -  83 cycles(tsc) 20.818 ns - 21 cycles(tsc) 5.329 ns - improved 74.7%
        64 -  74 cycles(tsc) 18.700 ns - 20 cycles(tsc) 5.127 ns - improved 73.0%
       128 -  90 cycles(tsc) 22.734 ns - 27 cycles(tsc) 6.833 ns - improved 70.0%
       158 -  99 cycles(tsc) 24.776 ns - 30 cycles(tsc) 7.583 ns - improved 69.7%
       250 - 104 cycles(tsc) 26.089 ns - 37 cycles(tsc) 9.280 ns - improved 64.4%
      
      Performance data, compared current in-kernel bulking:
      
      bulk - curr in-kernel  - improvement with this patch
         1 -  46 cycles(tsc) - 49 cycles(tsc) - improved (cycles:-3) -6.5%
         2 -  27 cycles(tsc) - 30 cycles(tsc) - improved (cycles:-3) -11.1%
         3 -  21 cycles(tsc) - 23 cycles(tsc) - improved (cycles:-2) -9.5%
         4 -  18 cycles(tsc) - 20 cycles(tsc) - improved (cycles:-2) -11.1%
         8 -  17 cycles(tsc) - 18 cycles(tsc) - improved (cycles:-1) -5.9%
        16 -  18 cycles(tsc) - 17 cycles(tsc) - improved (cycles: 1)  5.6%
        30 -  18 cycles(tsc) - 18 cycles(tsc) - improved (cycles: 0)  0.0%
        32 -  18 cycles(tsc) - 18 cycles(tsc) - improved (cycles: 0)  0.0%
        34 -  78 cycles(tsc) - 23 cycles(tsc) - improved (cycles:55) 70.5%
        48 -  60 cycles(tsc) - 21 cycles(tsc) - improved (cycles:39) 65.0%
        64 -  49 cycles(tsc) - 20 cycles(tsc) - improved (cycles:29) 59.2%
       128 -  69 cycles(tsc) - 27 cycles(tsc) - improved (cycles:42) 60.9%
       158 -  79 cycles(tsc) - 30 cycles(tsc) - improved (cycles:49) 62.0%
       250 -  86 cycles(tsc) - 37 cycles(tsc) - improved (cycles:49) 57.0%
      
      Performance with normal SLUB merging is significantly slower for
      larger bulking.  This is believed to (primarily) be an effect of not
      having to share the per-CPU data-structures, as tuning per-CPU size
      can achieve similar performance.
      
      bulk - slab_nomerge   -  normal SLUB merge
         1 -  49 cycles(tsc) - 49 cycles(tsc) - merge slower with cycles:0
         2 -  30 cycles(tsc) - 30 cycles(tsc) - merge slower with cycles:0
         3 -  23 cycles(tsc) - 23 cycles(tsc) - merge slower with cycles:0
         4 -  20 cycles(tsc) - 20 cycles(tsc) - merge slower with cycles:0
         8 -  18 cycles(tsc) - 18 cycles(tsc) - merge slower with cycles:0
        16 -  17 cycles(tsc) - 17 cycles(tsc) - merge slower with cycles:0
        30 -  18 cycles(tsc) - 23 cycles(tsc) - merge slower with cycles:5
        32 -  18 cycles(tsc) - 22 cycles(tsc) - merge slower with cycles:4
        34 -  23 cycles(tsc) - 22 cycles(tsc) - merge slower with cycles:-1
        48 -  21 cycles(tsc) - 22 cycles(tsc) - merge slower with cycles:1
        64 -  20 cycles(tsc) - 48 cycles(tsc) - merge slower with cycles:28
       128 -  27 cycles(tsc) - 57 cycles(tsc) - merge slower with cycles:30
       158 -  30 cycles(tsc) - 59 cycles(tsc) - merge slower with cycles:29
       250 -  37 cycles(tsc) - 56 cycles(tsc) - merge slower with cycles:19
      
      Joint work with Alexander Duyck.
      
      [1] https://github.com/netoptimizer/prototype-kernel/blob/master/kernel/mm/slab_bulk_test01.c
      
      [akpm@linux-foundation.org: BUG_ON -> WARN_ON;return]
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@redhat.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d0ecd894
    • Jesper Dangaard Brouer's avatar
      slub: support for bulk free with SLUB freelists · 81084651
      Jesper Dangaard Brouer authored
      Make it possible to free a freelist with several objects by adjusting API
      of slab_free() and __slab_free() to have head, tail and an objects counter
      (cnt).
      
      Tail being NULL indicate single object free of head object.  This allow
      compiler inline constant propagation in slab_free() and
      slab_free_freelist_hook() to avoid adding any overhead in case of single
      object free.
      
      This allows a freelist with several objects (all within the same
      slab-page) to be free'ed using a single locked cmpxchg_double in
      __slab_free() and with an unlocked cmpxchg_double in slab_free().
      
      Object debugging on the free path is also extended to handle these
      freelists.  When CONFIG_SLUB_DEBUG is enabled it will also detect if
      objects don't belong to the same slab-page.
      
      These changes are needed for the next patch to bulk free the detached
      freelists it introduces and constructs.
      
      Micro benchmarking showed no performance reduction due to this change,
      when debugging is turned off (compiled with CONFIG_SLUB_DEBUG).
      Signed-off-by: default avatarJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@redhat.com>
      Acked-by: default avatarChristoph Lameter <cl@linux.com>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      81084651
    • Helge Deller's avatar
      parisc: Map kernel text and data on huge pages · 41b85a11
      Helge Deller authored
      Adjust the linker script and map_pages() to map kernel text and data on
      physical 1MB huge/large pages.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      41b85a11
    • Helge Deller's avatar
      parisc: Add Huge Page and HUGETLBFS support · 736d2169
      Helge Deller authored
      This patch adds huge page support to allow userspace to allocate huge
      pages and to use hugetlbfs filesystem on 32- and 64-bit Linux kernels.
      A later patch will add kernel support to map kernel text and data on
      huge pages.
      
      The only requirement is, that the kernel needs to be compiled for a
      PA8X00 CPU (PA2.0 architecture). Older PA1.X CPUs do not support
      variable page sizes. 64bit Kernels are compiled for PA2.0 by default.
      
      Technically on parisc multiple physical huge pages may be needed to
      emulate standard 2MB huge pages.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      736d2169
    • Helge Deller's avatar
      parisc: Use long branch to do_syscall_trace_exit · 337685e5
      Helge Deller authored
      Use the 22bit instead of the 17bit branch instruction on a 64bit kernel
      to reach the do_syscall_trace_exit function from the gateway page.
      A huge page enabled kernel may need the additional branch distance bits.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      337685e5
    • Helge Deller's avatar
      parisc: Increase initial kernel mapping to 32MB on 64bit kernel · 332b42e4
      Helge Deller authored
      For the 64bit kernel the initially 16 MB kernel memory might become too
      small if you build a kernel with many modules built-in and with kernel
      text and data areas mapped on huge pages.
      
      This patch increases the initial mapping to 32MB for 64bit kernels and
      keeps 16MB for 32bit kernels.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      332b42e4
    • Helge Deller's avatar
      parisc: Initialize the fault vector earlier in the boot process. · 4182d0cd
      Helge Deller authored
      A fault vector on parisc needs to be 2K aligned.  Furthermore the
      checksum of the fault vector needs to sum up to 0 which is being
      calculated and written at runtime.
      
      Up to now we aligned both PA20 and PA11 fault vectors on the same 4K
      page in order to easily write the checksum after having mapped the
      kernel read-only (by mapping this page only as read-write).
      But when we want to map the kernel text and data on huge pages this
      makes things harder.
      So, simplify it by aligning both fault vectors on 2K boundries and write
      the checksum before we map the page read-only.
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      4182d0cd
    • Helge Deller's avatar
      parisc: Add defines for Huge page support · 1f25ad26
      Helge Deller authored
      Huge pages on parisc will have the same size as one pmd table, which
      is on a 64bit kernel 2MB on a kernel with 4K kernel page sizes, and
      on a 32bit kernel 4MB when used with 4K kernel pages.
      
      Since parisc does not physically supports 2MB huge page sizes, emulate
      it with two consecutive 1MB page sizes instead. Keeping the same huge
      page size as one pmd will allow us to add transparent huge page support
      later on.
      
      Bit 21 in the pte flags was unused and will now be used to mark a page
      as huge page (_PAGE_HPAGE_BIT).
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      1f25ad26
    • Helge Deller's avatar
      parisc: Drop unused MADV_xxxK_PAGES flags from asm/mman.h · dcbf0d29
      Helge Deller authored
      Drop the MADV_xxK_PAGES flags, which were never used and were from a proposed
      API which was never integrated into the generic Linux kernel code.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      dcbf0d29
  3. 21 Nov, 2015 11 commits