Commit Graph

605291 Commits

Author SHA1 Message Date
Keith Busch 32f0c4afb4 nvme: Remove RCU namespace protection
We can't sleep with RCU read lock held, but we need to do potentially
blocking stuff to namespace queues when iterating the list. This patch
removes the RCU locking and holds a mutex instead.

To prevent deadlocks, this patch removes holding the mutex during
namespace scanning and removal. The unlocked namespace scanning is made
safe by holding a reference to the namespace being scanned.

List iteration that does IO has to be unlocked to allow error recovery.
The caller must ensure the list can not be manipulated during such an
event, so this patch adds a comment explaining this requirement to the
only function that iterates an unlocked list. All callers currently
meet this requirement, so no further changes required.

List iterations that do not do IO can safely use the lock since it couldn't
block recovery from missing forced IO completions.

Reported-by: Ming Lin <mlin at kernel.org>
[fixes 0bf77e9 nvme: switch to RCU freeing the namespace]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
2016-07-14 08:48:08 -07:00
Arnaldo Carvalho de Melo 8c98abff43 tools: Make "__always_inline" just "inline" on Android
As the gcc there is producing tons of:

  "warning: always_inline function might not be inlinable"

At least on android-ndk-r12/platforms/android-24/arch-arm, so, for the
time being, use this big hammer.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-97l3eg3fnk5shmo4rsyyvj2t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-14 12:03:04 -03:00
Arnaldo Carvalho de Melo 09dd39d2d2 perf tools: Do not provide dup sched_getcpu() prototype on Android
The Bionic libc has this definition, so don't duplicate it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-rmd19832zkt07e4crdzyen9z@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-14 12:02:04 -03:00
Arnaldo Carvalho de Melo ca575ad209 tools lib traceevent: Add correct header for ipv6 definitions
We need to include netinet/in.h to get the in6_addr struct definition, needed to
build it on the Android NDK:

  In file included from event-parse.c:36:0:
  /home/acme/android/android-ndk-r12/platforms/android-24/arch-arm/usr/include/netinet/ip6.h:82:18: error: field 'ip6_src' has incomplete type
    struct in6_addr ip6_src; /* source address */

And it is the canonical way of getting IPv6 definitions, as described,
for instance, in Linux's 'man ipv6'

Doing that uncovers another problem: this source file uses PRIu64 but
doesn't include it, depending on it being included by chance via the now
replaced header (netinet/ip6.h), fix it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-tilr31n3yaba1whsd47qlwa3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-14 11:33:32 -03:00
Ville Syrjälä aeddda06c1 drm/i915: Ignore panel type from OpRegion on SKL
Dell XPS 13 9350 apparently doesn't like it when we use the panel type
from OpRegion. The OpRegion panel type (0) tells us to use use low
vswing for eDP, whereas the VBT panel type (2) tells us to use normal
vswing. The problem is that low vswing results in some display flickers.
Since no one seems to know how this stuff is supposed to be handled,
let's just ignore the OpRegion panel type on SKL for now.

v2: Print the panel type correctly in the debug output

Reported-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: drm-intel-fixes@lists.freedesktop.org
References: https://lists.freedesktop.org/archives/intel-gfx/2016-June/098826.html
Fixes: a05628195a ("drm/i915: Get panel_type from OpRegion panel details")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1468324837-29237-1-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Tested-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
(cherry picked from commit bb10d4ec3b)
[danvet: Fix up cherry-pick conflict with an s/dev_priv/dev/.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-07-14 16:08:04 +02:00
Chris Wilson b192400627 drm/i915: Update ifdeffery for mutex->owner
In commit 7608a43d8f ("locking/mutexes: Use MUTEX_SPIN_ON_OWNER when
appropriate") the owner field in the mutex was updated from being
dependent upon CONFIG_SMP to using optimistic spin. Update our peek
function to suite.

Fixes:7608a43d8f2e ("locking/mutexes: Use MUTEX_SPIN_ON_OWNER...")
Reported-by: Hong Liu <hong.liu@intel.com>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1468244777-4888-1-git-send-email-chris@chris-wilson.co.uk
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
(cherry picked from commit 4f074a5393)
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2016-07-14 15:47:32 +02:00
Alexander Shishkin 7a1a47ce35 intel_th: pci: Add Kaby Lake PCH-H support
This adds Intel(R) Trace Hub PCI ID for Kaby Lake PCH-H.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: <stable@vger.kernel.org>
2016-07-14 13:16:56 +03:00
Alexander Shishkin a36aa80f3c intel_th: Fix a deadlock in modprobing
Driver initialization tries to request a hub (GTH) driver module from
its probe callback, resulting in a deadlock.

This patch solves the problem by adding a deferred work for requesting
the hub module.

Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: <stable@vger.kernel.org> # 4.4.x-
2016-07-14 13:02:39 +03:00
Rik van Riel 553bf6bbfd sched/cputime: Drop local_irq_save/restore from irqtime_account_irq()
Paolo pointed out that irqs are already blocked when irqtime_account_irq()
is called. That means there is no reason to call local_irq_save/restore()
again.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1468421405-20056-6-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 10:42:35 +02:00
Frederic Weisbecker 8612f17ab9 sched/cputime: Reorganize vtime native irqtime accounting headers
The vtime irqtime accounting headers are very scattered and convoluted
right now. Reorganize them such that it is obvious that only
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE does use it.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1468421405-20056-5-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 10:42:35 +02:00
Frederic Weisbecker 0cfdf9a198 sched/cputime: Clean up the old vtime gen irqtime accounting completely
Vtime generic irqtime accounting has been removed but there are a few
remnants to clean up:

* The vtime_accounting_cpu_enabled() check in irq entry was only used
  by CONFIG_VIRT_CPU_ACCOUNTING_GEN. We can safely remove it.

* Without the vtime_accounting_cpu_enabled(), we no longer need to
  have a vtime_common_account_irq_enter() indirect function.

* Move vtime_account_irq_enter() implementation under
  CONFIG_VIRT_CPU_ACCOUNTING_NATIVE which is the last user.

* The vtime_account_user() call was only used on irq entry for
  CONFIG_VIRT_CPU_ACCOUNTING_GEN. We can remove that too.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1468421405-20056-4-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 10:42:35 +02:00
Rik van Riel b58c358405 sched/cputime: Replace VTIME_GEN irq time code with IRQ_TIME_ACCOUNTING code
The CONFIG_VIRT_CPU_ACCOUNTING_GEN irq time tracking code does not
appear to currently work right.

On CPUs without nohz_full=, only tick based irq time sampling is
done, which breaks down when dealing with a nohz_idle CPU.

On firewalls and similar systems, no ticks may happen on a CPU for a
while, and the irq time spent may never get accounted properly. This
can cause issues with capacity planning and power saving, which use
the CPU statistics as inputs in decision making.

Remove the VTIME_GEN vtime irq time code, and replace it with the
IRQ_TIME_ACCOUNTING code, when selected as a config option by the user.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1468421405-20056-3-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 10:42:34 +02:00
Rik van Riel 5743021831 sched/cputime: Count actually elapsed irq & softirq time
Currently, if there was any irq or softirq time during 'ticks'
jiffies, the entire period will be accounted as irq or softirq
time.

This is inaccurate if only a subset of the time was actually spent
handling irqs, and could conceivably mis-count all of the ticks during
a period as irq time, when there was some irq and some softirq time.

This can actually happen when irqtime_account_process_tick is called
from account_idle_ticks, which can pass a larger number of ticks down
all at once.

Fix this by changing irqtime_account_hi_update(), irqtime_account_si_update(),
and steal_account_process_ticks() to work with cputime_t time units, and
return the amount of time spent in each mode.

Rename steal_account_process_ticks() to steal_account_process_time(), to
reflect that time is now accounted in cputime_t, instead of ticks.

Additionally, have irqtime_account_process_tick() take into account how
much time was spent in each of steal, irq, and softirq time.

The latter could help improve the accuracy of cputime
accounting when returning from idle on a NO_HZ_IDLE CPU.

Properly accounting how much time was spent in hardirq and
softirq time will also allow the NO_HZ_FULL code to re-use
these same functions for hardirq and softirq accounting.

Signed-off-by: Rik van Riel <riel@redhat.com>
[ Make nsecs_to_cputime64() actually return cputime64_t. ]
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Radim Krcmar <rkrcmar@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wanpeng Li <wanpeng.li@hotmail.com>
Link: http://lkml.kernel.org/r/1468421405-20056-2-git-send-email-fweisbec@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 10:42:34 +02:00
Ingo Molnar cefef3a762 Merge branch 'sched/core' into timers/nohz, to avoid conflicts in upcoming patches
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 10:37:48 +02:00
Dan Carpenter 2419036411 dsp56k: prevent a harmless underflow
There is a mistake here where we don't allow "len" to be zero but we
allow negative lengths.  It's basically harmless in this case, but the
underflow makes my static checker complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-14 16:21:53 +09:00
Fengguang Wu 077e2642fb chardev: add missing line break in pr_warn
To fix super long dmesg error lines like

  CHRDEV "dummy_stm.0" major number 224 goes below the dynamic allocation rangeCHRDEV "dummy_stm.1" major number 223 goes below the dynamic allocation rangeswapper: page allocation failure: order:8, mode:0x26040c0(GFP_KERNEL|__GFP_COMP|__GFP_NOTRACK)

After fix, it should look like

  CHRDEV "dummy_stm.0" major number 224 goes below the dynamic allocation range
  CHRDEV "dummy_stm.1" major number 223 goes below the dynamic allocation range
  swapper: page allocation failure: order:8, mode:0x26040c0(GFP_KERNEL|__GFP_COMP|__GFP_NOTRACK)

Reported-by: Philip Li <philip.li@intel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-14 16:21:53 +09:00
Ingo Molnar b29c657469 perf/core improvements and fixes:
User visible:
 
 - Finish merging initial SDT (Statically Defined Traces) support, see
   cset comments for details about how it all works (Masami Hiramatsu)
 
 - Support attaching eBPF programs to tracepoints (Wang Nan)
 
 Infrastructure:
 
 - Fix up BITS_PER_LONG setting (Arnaldo Carvalho de Melo)
 
 - Add fallback from ELF_C_READ_MMAP to ELF_C_READ in objtool, fixing
   the build in libelf implementations lacking that elf_begin() cmd,
   such as Alpine Linux's (Arnaldo Carvalho de Melo)
 
 - Avoid checking code drift on busybox's diff in objtool (Arnaldo Carvalho de Melo)
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXhvaLAAoJENZQFvNTUqpAoygP/i4bFNrt9j8Aq3FyUw6i1say
 GzLMVhjw1dQXUJwg9H4UPUEqkUYA6sg7Icn34SmLKWKWYoo/uu8zX4wBCJkgk8eT
 EL8oBSVAGX6cnVn09upZZWBnFerviMrLh0jEakuUt2KdhGRfd/b8rnPdX1/ApcMa
 FCDNC1yRGutD8EY31T5UbDF7UI6SBDrD0fzNysGJakt0NHvbwTftxdYBd2IpmAgK
 6FMSovyeILGpZIOdZZKv0gOUhI3MZUD3NLDJpYK+tlUjGOmwpqTxYZbMpPzh5GdU
 ITRLhHI/SQzd4qtNE201lc7ICkGMgWTrig3bZFT1XO25X25b/yJx9xVbTklccfRi
 qWcQISCyDtHEE3ij7071bb6cIR/RMle70No3qpPvQoYBDe24VpURJ5aRa1YXKQg2
 ig+3UdJVTmaykvc0YUPgz2V2vfq/NYAHemwU+mc5K5bjPgI6CmW+eaeHJElHbRca
 eO+aMNzy+zam6DNjrO/6lljhrLiJpTUXnMTr6WBy0uxxDg737Ga3x2DJIxBJnZdC
 Q/WHXyIdxVbV10zFt1y4n9J6sv0lJAT+w8wYpqxGFBuiuTH3l6zDtKENstyIeFxg
 S5rH14+NNWCaAyLYvFASo+ypmIYEzQkF8LA4fpekdX+AhfGaUHFFty0QnlbHTpn7
 ujPjCHsmdmrZTYZ4tIgC
 =pLbD
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo-20160713' 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:

- Finish merging initial SDT (Statically Defined Traces) support, see
  cset comments for details about how it all works (Masami Hiramatsu)

- Support attaching eBPF programs to tracepoints (Wang Nan)

Infrastructure changes:

- Fix up BITS_PER_LONG setting (Arnaldo Carvalho de Melo)

- Add fallback from ELF_C_READ_MMAP to ELF_C_READ in objtool, fixing
  the build in libelf implementations lacking that elf_begin() cmd,
  such as Alpine Linux's (Arnaldo Carvalho de Melo)

- Avoid checking code drift on busybox's diff in objtool (Arnaldo Carvalho de Melo)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-14 08:54:13 +02:00
Greg Kroah-Hartman 6c71ee3b61 Third set of IIO new device support, features and cleanups for the 4.8 cycle.
New core features
 - Selection of the clock source for IIO timestamps.  This is done per device
   as it makes little sense to have events in one timebase and data timestamped
   on another.  Biggest reason for this is that we currently use a clock
   source which is non monotonic which can result in 'interesting' data sets.
   (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind
    in an earlier version.)
 - MAINTAINERS add the git tree to the list for IIO.
 
 New device support + a kind of indirect staging graduation.
 * Broadcom iproc-static-adc
   - new driver
 * mcp4531
   - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers
 * mpu6050
   - support the IC20608 6 axis motion tracking device
 * st-sensors
   - support the lis3l02dq + drop the lis3l02dq driver from staging.
   The general purpose driver is missing event support, but good to get
   rid of this driver which was rather long in the tooth.
 
 New driver features
 * ak8975
   - Add vid regulator support and refactor handling in general.
   - Allow a delay after enabling regulators.
   - Runtime and system PM.
 * bmg160
   - filter frequency control support.
 * bmp280
   - SPI device support.
   - EOC interrupt support for the BMP085
   - power management support.
   - supply regulator support.
   - reset gpio support
   - dt bindings for reset gpio and regulators.
   - of table to support device tree registration
 * max1363
   - Device tree bindings.
 * mcp4531
   - Device tree bindings.
 * st-pressure
   - temperature channels as part of triggered buffer (previously not due
   probably to alignment issues - see below).
   - lps22hb open drain interrupt support.
   - lps22hb temperature channel support
 
 Cleanups and reworkings.
 * numerous ADC drivers
   - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so
   as to allow client bindings to find the device.
 * ak8975
   - Fix incorrect handling of missing regulator
   - make sure power is down and remove.
 * bmp280
   - read the calibration data only once as it doesn't change.
 * isl29125
   - Use a few macros to make code a touch more readable.
 * mma8452
   - fix a memory leak on error.
   - drop an unecessary bit of return value handling.
 * potentiometer kconfig
   - typo fix.
 * st-pressure
   - drop some uninformative default assignments of elements of the channel
   array structure (aids readability).
 * st-sensors
   - Harden interrupt handling considerably.  These are actually all using
   level interrupts, but at least two known boards have them wired to
   edge only interrupt chips.  Hence a slightly interesting bit of handling
   is needed in which we first allow for the easy option (level triggered) and
   secondly check the status registers before reenabling edge interrupts and
   fall back to a tight loop in the thread until we successfully clear the
   interrupt.  No harm is done if we never succeed in doing so.  It's an odd
   patch that has been through a lot of revisions to reach a consensus on how
   to handle what is basically broken hardware (which the previous defaults
   allowed to kind of work).
   - Fix alignment to defined storagebytes boundaries.
   - Ensure alignment of power of 2 byte boundaries.  This has always in theory
   been part of the ABI of IIO, but we missed a few that snuck in that need
   fixing.  The effect was minor as they were only followed by timestamp
   channels which were correctly aligned,
   - Add some docs to explain the gain calculations.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIuBAABCAAYBQJXfBqnERxqaWMyM0BrZXJuZWwub3JnAAoJEFSFNJnE9BaIqjwP
 /0OJbr8kIa1i6+iCqCRCPCixdymd6k9wvjDaKSQoDeamen+8iKOLZNhXJJjOX8hd
 eCRMrCJbvY96Bl2Ll51TCEBb8R1xppCwwYIYylKhF9CL6N2ndapzWY0G4XZb6pc0
 e1JIa6uxynAAEsfplBskk4Ytf5PPHDOWER5WsTmxlZcTTAL9gLxIlii2Du0AmeN/
 tANVzwuvK07i5HHuZfYV2h2+OWDSlm4Y5rvE7t8keWpp6wnZ0XtiIw1WjkpR1OY7
 KiKGKRJMomFlp51hP9IKqc20Dweiaf3lHS7BDggvkB11VxyajQTcjvogxQ0BSPUv
 7PTHHlk8txgEUMqrDWP8x0TL97iNt3hiOZ0/rI3IZdFLC8pnibewnB+uHEGCH3tv
 bqToPtpJHjsIiGlCGVxvt8BRgqT5Qq7JT65hYS6774uFcQiPEvPDI44BDqUxaDUf
 /1WFM23VB4KJpx8JnL+nC8iu6DBnVPDWDKAsjGgc+ljnz3VRcSxWz5P0yMFZRMA2
 mbLiG2yiD4oD/LcI8FeZh9X50Irg09ElAWu07VRymrYMRfCYLXO07o5nZJ0bOqOB
 R+1MToYaHz2g6jJ+KGVC0Ul5EuULzymqH0CMbdjWnaD9AaoPuOKkNfUVBkzRK0t/
 TO/wLHm/qNbk+zGZHQFU15mH1Nn9leEJ/uCdnGqkRo7i
 =FxNN
 -----END PGP SIGNATURE-----

Merge tag 'iio-for-4.8c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next

Jonathan writes:

Third set of IIO new device support, features and cleanups for the 4.8 cycle.

New core features
- Selection of the clock source for IIO timestamps.  This is done per device
  as it makes little sense to have events in one timebase and data timestamped
  on another.  Biggest reason for this is that we currently use a clock
  source which is non monotonic which can result in 'interesting' data sets.
  (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind
   in an earlier version.)
- MAINTAINERS add the git tree to the list for IIO.

New device support + a kind of indirect staging graduation.
* Broadcom iproc-static-adc
  - new driver
* mcp4531
  - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers
* mpu6050
  - support the IC20608 6 axis motion tracking device
* st-sensors
  - support the lis3l02dq + drop the lis3l02dq driver from staging.
  The general purpose driver is missing event support, but good to get
  rid of this driver which was rather long in the tooth.

New driver features
* ak8975
  - Add vid regulator support and refactor handling in general.
  - Allow a delay after enabling regulators.
  - Runtime and system PM.
* bmg160
  - filter frequency control support.
* bmp280
  - SPI device support.
  - EOC interrupt support for the BMP085
  - power management support.
  - supply regulator support.
  - reset gpio support
  - dt bindings for reset gpio and regulators.
  - of table to support device tree registration
* max1363
  - Device tree bindings.
* mcp4531
  - Device tree bindings.
* st-pressure
  - temperature channels as part of triggered buffer (previously not due
  probably to alignment issues - see below).
  - lps22hb open drain interrupt support.
  - lps22hb temperature channel support

Cleanups and reworkings.
* numerous ADC drivers
  - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so
  as to allow client bindings to find the device.
* ak8975
  - Fix incorrect handling of missing regulator
  - make sure power is down and remove.
* bmp280
  - read the calibration data only once as it doesn't change.
* isl29125
  - Use a few macros to make code a touch more readable.
* mma8452
  - fix a memory leak on error.
  - drop an unecessary bit of return value handling.
* potentiometer kconfig
  - typo fix.
* st-pressure
  - drop some uninformative default assignments of elements of the channel
  array structure (aids readability).
* st-sensors
  - Harden interrupt handling considerably.  These are actually all using
  level interrupts, but at least two known boards have them wired to
  edge only interrupt chips.  Hence a slightly interesting bit of handling
  is needed in which we first allow for the easy option (level triggered) and
  secondly check the status registers before reenabling edge interrupts and
  fall back to a tight loop in the thread until we successfully clear the
  interrupt.  No harm is done if we never succeed in doing so.  It's an odd
  patch that has been through a lot of revisions to reach a consensus on how
  to handle what is basically broken hardware (which the previous defaults
  allowed to kind of work).
  - Fix alignment to defined storagebytes boundaries.
  - Ensure alignment of power of 2 byte boundaries.  This has always in theory
  been part of the ABI of IIO, but we missed a few that snuck in that need
  fixing.  The effect was minor as they were only followed by timestamp
  channels which were correctly aligned,
  - Add some docs to explain the gain calculations.
2016-07-14 12:05:29 +09:00
Greg Kroah-Hartman ca2b6faeb9 phy: for 4.8 -rc1
*) Add a new phy_ops for setting the phy mode
 *) Add a new phy driver for DA8xx SoC USB PHY
 *) Minor fixes and cleanups
 
 Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJXel4TAAoJEA5ceFyATYLZrXYP/1RcGZCktZxW43MQNNtGUjlR
 4jhc36FlVQ+9Lrlp5ewLW6RPl/Z1D2ImYyTvxsWDRZhlj0T0N7F/AgwFWQXKPiKs
 l5opMvBL04dIy98M0Za68sr9SlPNxTZNyirejVm8oMtv2vA0+b18/YDZM2YFbt0N
 dTzVfJqvqrvFMSg2avVcTjARRQBnT5zNnKEjniDetVCSZ2yaD+yabrZ3OLh2JhZX
 AJdjvvxkOAVHqF1hBB1D/cNpf5N6fjgUu+xTI8MDDkYf81A3mOm8w7MjYDpusLjO
 Ix/AcuJqzg2216BzdyGF7zzg4wfgl3WmITXqUy+G9wuW4JPOZmeakTfppErAJPHr
 Quw1fIl0Je6l3xuSGGKIyPy3L4v5YvJeeZkhDzxATzhstKgk1fL4KJBN4lEjdRcs
 SeME8e1GVTiKFjFy4RTiP8bGBuUYRSHZVhLK7eeqcyE0hzQUD2LEyGQgLaj1s86k
 U+zFQoTNJwSenZsWINb/Skzwjg2E3kqEWsTbgLNDy02llvBaEykfVdjh6qk+4J5x
 1GbywhJiba5x/1G1v5M4U2A1Fnw3u4Rhb5k64Qqur2mWNIDEUc85M0G8+m6z9io3
 LqRitKkXxP6t/sp7KK3YAas6WnD5jRALgZpRBCsCYXW2lbTGb9Odi54LH4165xMP
 UFBoZLM1VDnK1Ja5fLbX
 =5bMI
 -----END PGP SIGNATURE-----

Merge tag 'phy-for-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-testing

Kishon writes:

phy: for 4.8 -rc1

*) Add a new phy_ops for setting the phy mode
*) Add a new phy driver for DA8xx SoC USB PHY
*) Minor fixes and cleanups

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
2016-07-14 12:03:50 +09:00
Greg Kroah-Hartman b25948afcc stm class/intel_th: Updates for 4.8
These are:
  * runtime power management implementation for both intel_th and stm class
  * semi-random kerneldoc fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iF4EABEIAAYFAld2LXAACgkQ68X2JGMFV/8e3wD/UvdNiAGzXP0YqfE5nMmLZzxc
 olSIFd2LEzZSx1kZ/nMA/i2c4nEGK2vI/l01Q27BuCWcwaKk7vpQWbluJN6fdf8y
 =KnU5
 -----END PGP SIGNATURE-----

Merge tag 'stm-for-greg-20160701' of git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm into char-misc-testing

Alexander writes:

stm class/intel_th: Updates for 4.8

These are:
 * runtime power management implementation for both intel_th and stm class
 * semi-random kerneldoc fixes
2016-07-14 12:02:35 +09:00
Greg Kroah-Hartman 7f96a82fde Update extcon for 4.8
Detailed description for patchset:
 1. Update the extcon-gpio.c driver
 - Use PM wakeirq APIs and support to check the state of external connector
   when wake-up from suspend state if the interrupt of external connector is
   not used as wakeup source.
 - Support for ACPI gpio interface
 
 2. Remove deprecated extcon APIs using the legacy cable name
 - The extcon framework handle the external connector only by unique id
   instead of legacy cable name to prevent the problem.
 - Removed functions
   : extcon_get_cable_state()
   : extcon_set_cable_state()
   : extcon_register_interest()
   : extcon_unregister_interest()
 - It has the dependency on the axp288_charger.c driver.
   So, this pull request includes the 'ib-extcon-powersupply-4.8'
   immutable branch to protect the merge conflict.
 
 3. Support the resource-managed function for extcon_register_notifier
 - Add the devm_extcon_register/unregister_notifier() funticon to handle
   the resource automatically by resource managed functions and split out
   the resource-managed function from extcon core to seprate file(devres.c).
 
 4. Supprot the suspend/resume for extcon-adc-jack.c driver
 - Add the support the suspend/resume function to use extcon-adc-jack.c
   as wakeup source.
 
 5. Fix the minor issue
 - Check the return value of find_cable_index_by_id()
 - Move the struct extcon_cable to extcon core from header file
   because it should be only handled on extcon core.
 - Add the missing of_node_put() after calling of_parse_phandle()
   to decrement the reference count.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXe5H/AAoJEJzN3yze689TWO8QAKjVWz/xVSF1Dzjl5j4qwB4p
 9yiX0kgkZc1IDGxVECsGjFWcAihEJ/0TZyswUYUt5Cyo8LBLUvTnNp40kWug2ozs
 KXruLIps344hd/YGH7JWptWubOUsxfbkrgI6YaI+r7OZih8bbnz2/p8G0cfl1vYf
 MC9zs1v31Fowk4A6P16fo4HTKPp1+LCZPLhVApxnB6A2chz4I5jwiI/qvjS6amRd
 gbM1cco5DveDkbBJKFs7GS12RcN2u+AcUWld65qCxltODFZkSTGV+AwRN78EnS4S
 RQEH8lWHXm6qDSiYswsf7s8w4SVBBZIV68GykI3MBzHR+vbH1j/5F+wPXcBQJyPy
 +nFFfd+/yXC6Nq5tr10UlKP4iFd5aBGkPYVWwjCeobCZvES3eNzDCvUiAP21pa0R
 KT2DpRHsx0mSNyQmk9lRvOW+dkYc6JichO7Seb7rrxgYNBwE+hHu0BoJRsKQzLQ6
 e2DnoWeQ2H3XfaV979AUugyVzZe4XcL4M3YdSoMr9yGCQkCunFmN9BBstqK3H1XF
 uU8VlyaLhS3VrPewIAv903iG1H4gg2Cf1aDBFHSvkmOpNGOj5utDBhnSrEmJKKwI
 LcfM1I6BQWmZxcEQzHKL2Ubx4be4+JDM7w4HP78TqzXwo/qhCZGXRxfHCgycy2TM
 iGEzj/IEPlSWBzWJHZdg
 =YnJ3
 -----END PGP SIGNATURE-----

Merge tag 'extcon-next-for-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-testing

Chanwoo writes:

Update
extcot://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git
tags/extcon-next-for-4.8
n for 4.8

Detailed description for patchset:
1. Update the extcon-gpio.c driver
- Use PM wakeirq APIs and support to check the state of external connector
  when wake-up from suspend state if the interrupt of external connector is
  not used as wakeup source.
- Support for ACPI gpio interface

2. Remove deprecated extcon APIs using the legacy cable name
- The extcon framework handle the external connector only by unique id
  instead of legacy cable name to prevent the problem.
- Removed functions
  : extcon_get_cable_state()
  : extcon_set_cable_state()
  : extcon_register_interest()
  : extcon_unregister_interest()
- It has the dependency on the axp288_charger.c driver.
  So, this pull request includes the 'ib-extcon-powersupply-4.8'
  immutable branch to protect the merge conflict.

3. Support the resource-managed function for extcon_register_notifier
- Add the devm_extcon_register/unregister_notifier() funticon to handle
  the resource automatically by resource managed functions and split out
  the resource-managed function from extcon core to seprate file(devres.c).

4. Supprot the suspend/resume for extcon-adc-jack.c driver
- Add the support the suspend/resume function to use extcon-adc-jack.c
  as wakeup source.

5. Fix the minor issue
- Check the return value of find_cable_index_by_id()
- Move the struct extcon_cable to extcon core from header file
  because it should be only handled on extcon core.
- Add the missing of_node_put() after calling of_parse_phandle()
  to decrement the reference count.
2016-07-14 12:01:23 +09:00
Greg Kroah-Hartman 2a7fbcec95 refactoring for multiple source files and better layout
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 Comment: Kees Cook <kees@outflux.net>
 
 iQIcBAABCgAGBQJXfpuqAAoJEIly9N/cbcAmXQYQALT1502N/hUp0v0upjS/zVvO
 AzYK5LnkjMMDdTT5tvOngd44aLg9/h24VnoB4luRM4KGBS/tNOuMFjuEYKEUKsH0
 EbVcspWKAGTI07e4lVfpmB+BPENt0HwVtR46RxN68Q0/kp5H25ByLlv2Nj2pAz/3
 0JcC3R6/A1k4Hh00a+Lf9uu6rU1gYBmLyx3pWpkjJ7GquXe/t0f4RsbDTU3vKRjj
 er1aBsBR0peCcE8K2z32HS49dQNk7dCD4ZoAzYoREKPqn2GTzRN+dScdSuKdD1TM
 YDte3iTf2DIcF7uzzpSKFqnarPaaK7/+rCbvQoVH+isCiaQnlI9KKW9H6XWgEeZg
 9J3BmIyqH4+9Iw8Lbs8KoS/Mj5JHfOnZP3N59lyy94vFBecbkT4SshKEfPsScdnW
 1Zv8CJu7IP8j5zcGtYCniWAx5Rv37oy9yAAaYhRUr3NQ9ASFaMhkG5QTfx/EZR7C
 9TwGoWz+zA6qVkpxCnRKUIZUwwHnDKlZhfbf/cRgxMOnEP/YiUBgXAJ2LDNCbes9
 OzJP3lpL7iejGf1CVd+ZlT8ouIUrw/KWd5z4uOeUW2j4CMu3qJisy+idDD253m0W
 L+2kzPpAFirsWuOhr78Ya7k83+bIkiK9T5Ds2NwcuGj49RZ610IXON4/Wx272mqQ
 NTw3NJcqTiaVETniTHhU
 =168T
 -----END PGP SIGNATURE-----

Merge tag 'lkdtm-next' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into char-misc-testing

Kees writes:

refactoring for multiple source files and better layout
2016-07-14 11:59:53 +09:00
Joseph Salisbury 25b1f9acc4 usb: quirks: Add no-lpm quirk for Elan
BugLink: http://bugs.launchpad.net/bugs/1498667

As reported in BugLink, this device has an issue with Linux Power
Management so adding a quirk.  This quirk was reccomended by Alan Stern:

http://lkml.iu.edu/hypermail/linux/kernel/1606.2/05590.html

Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-14 11:58:46 +09:00
Masami Hiramatsu 8e5dc84835 perf test: Add a test case for SDT event
Add a basic test case for SDT event support.  This test scans an SDT
event in perftools and check whether the SDT event is correctly stored
into the buildid cache.

Here is an example:

  ----
  $ perf test sdt -v
  47: Test SDT event probing                                   :
  --- start ---
  test child forked, pid 20732
  Found 72 SDTs in /home/mhiramat/ksrc/linux/tools/perf/perf
  Writing cache: %sdt_perf:test_target=test_target
  Cache committed: 0
  symbol:test_target file:(null) line:0 offset:0 return:0 lazy:(null)
  test child finished with 0
  ---- end ----
  Test SDT event probing: Ok
  ----

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831796546.17065.1502584370844087537.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:10 -03:00
Masami Hiramatsu e26e63be64 perf build: Add sdt feature detection
This checks whether sys/sdt.h is available or not, which is required for
DTRACE_PROBE().

We can disable this feature by passing NO_SDT=1 when building.

This flag will be used for SDT test case and further SDT events in
perftools.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831795615.17065.17513820540591053933.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:09 -03:00
Masami Hiramatsu 7e9fca51fb perf probe: Support a special SDT probe format
Support a special SDT probe format which can omit the '%' prefix only if
the SDT group name starts with "sdt_". So, for example both of
"%sdt_libc:setjump" and "sdt_libc:setjump" are acceptable for perf probe
--add.

E.g. without this:

  # perf probe -a sdt_libc:setjmp
  Semantic error :There is non-digit char in line number.
  ...

With this:

  # perf probe -a sdt_libc:setjmp
  Added new event:
    sdt_libc:setjmp      (on %setjmp in /usr/lib64/libc-2.20.so)

  You can now use it in all perf tools, such as:

  	perf record -e sdt_libc:setjmp -aR sleep 1

Suggested-by: Brendan Gregg <brendan.d.gregg@gmail.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831794674.17065.13359473252168740430.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:09 -03:00
Masami Hiramatsu a598180aa1 perf probe: Support @BUILDID or @FILE suffix for SDT events
Support @BUILDID or @FILE suffix for SDT events. This allows perf to add
probes on SDTs/pre-cached events on given FILE or the file which has
given BUILDID (also, this complements BUILDID.)

For example, both gcc and libstdc++ has same SDTs as below.  If you
would like to add a probe on sdt_libstdcxx:catch on gcc, you can do as
below.

  ----
  # perf list sdt | tail -n 6
    sdt_libstdcxx:catch@/usr/bin/gcc(0cc207fc4b27)     [SDT event]
    sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
    sdt_libstdcxx:rethrow@/usr/bin/gcc(0cc207fc4b27)   [SDT event]
    sdt_libstdcxx:rethrow@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
    sdt_libstdcxx:throw@/usr/bin/gcc(0cc207fc4b27)     [SDT event]
    sdt_libstdcxx:throw@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
  # perf probe -a %sdt_libstdcxx:catch@0cc
  Added new event:
    sdt_libstdcxx:catch  (on %catch in /usr/bin/gcc)

  You can now use it in all perf tools, such as:

  	perf record -e sdt_libstdcxx:catch -aR sleep 1
  ----

Committer note:

Doing the full sequence of steps to get the results above:

With a clean build-id cache:

  [root@jouet ~]# rm -rf ~/.debug/
  [root@jouet ~]# perf list sdt

  List of pre-defined events (to be used in -e):

  [root@jouet ~]#

No events whatsoever, then, we can add all events in gcc to the build-id
cache, doing a --add + --dry-run:

  [root@jouet ~]# perf probe --dry-run --cache -x /usr/bin/gcc --add %sdt_libstdcxx:\*
  Added new events:
    sdt_libstdcxx:throw  (on %* in /usr/bin/gcc)
    sdt_libstdcxx:rethrow (on %* in /usr/bin/gcc)
    sdt_libstdcxx:catch  (on %* in /usr/bin/gcc)

  You can now use it in all perf tools, such as:

	perf record -e sdt_libstdcxx:catch -aR sleep 1

  [root@jouet ~]#

It really didn't add any events, it just cached them:

  [root@jouet ~]# perf probe -l
  [root@jouet ~]#

We can see that it was cached as:

  [root@jouet ~]# ls -la ~/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/
  total 976
  drwxr-xr-x. 2 root root   4096 Jul 13 21:47 .
  drwxr-xr-x. 3 root root   4096 Jul 13 21:47 ..
  -rwxr-xr-x. 4 root root 985912 Jun 22 18:52 elf
  -rw-r--r--. 1 root root    303 Jul 13 21:47 probes
  [root@jouet ~]# file ~/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/elf
  /root/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/elf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2, stripped
  [root@jouet ~]# cat ~/.debug/usr/bin/gcc/9a0730e2bcc6d2a2003d21ac46807e8ee6bcb7c2/probes
  %sdt_libstdcxx:throw=throw
  p:sdt_libstdcxx/throw /usr/bin/gcc:0x71ffd
  %sdt_libstdcxx:rethrow=rethrow
  p:sdt_libstdcxx/rethrow /usr/bin/gcc:0x720b8
  %sdt_libstdcxx:catch=catch
  p:sdt_libstdcxx/catch /usr/bin/gcc:0x7307f
  %sdt_libgcc:unwind=unwind
  p:sdt_libgcc/unwind /usr/bin/gcc:0x7eec0
  #sdt_libstdcxx:*=%*
  [root@jouet ~]#

Ok, now we can use 'perf probe' to refer to those cached entries as:

  Humm, nope, doing as above we end up with:

  [root@jouet ~]# perf probe -a %sdt_libstdcxx:catch
  Semantic error :* is bad for event name -it must follow C symbol-naming rule.
    Error: Failed to add events.
  [root@jouet ~]#

But it worked at some point, lets try not using --dry-run:

Resetting everything:

  # rm -rf ~/.debug/
  # perf probe -d *:*
  # perf probe -l
  # perf list sdt

    List of pre-defined events (to be used in -e):

  #

Ok, now it cached everything, even things we haven't asked it to
(sdt_libgcc:unwind):

  [root@jouet ~]# perf probe -x /usr/bin/gcc --add %sdt_libstdcxx:\*
  Added new events:
    sdt_libstdcxx:throw  (on %* in /usr/bin/gcc)
    sdt_libstdcxx:rethrow (on %* in /usr/bin/gcc)
    sdt_libstdcxx:catch  (on %* in /usr/bin/gcc)

  You can now use it in all perf tools, such as:

	perf record -e sdt_libstdcxx:catch -aR sleep 1

  [root@jouet ~]# perf list sdt

  List of pre-defined events (to be used in -e):

    sdt_libgcc:unwind                                  [SDT event]
    sdt_libstdcxx:catch                                [SDT event]
    sdt_libstdcxx:rethrow                              [SDT event]
    sdt_libstdcxx:throw                                [SDT event]
  [root@jouet ~]#

And we have the events in place:

  [root@jouet ~]# perf probe -l
    sdt_libstdcxx:catch  (on execute_cfa_program+1551@../../../libgcc/unwind-dw2.c in /usr/bin/gcc)
    sdt_libstdcxx:rethrow (on d_print_subexpr+280@libsupc++/cp-demangle.c in /usr/bin/gcc)
    sdt_libstdcxx:throw  (on d_print_subexpr+93@libsupc++/cp-demangle.c in /usr/bin/gcc)
  [root@jouet ~]#

And trying to use them at least has 'perf trace --event sdt*:*' working.

Then, if we try to add the ones in libstdc++:

  [root@jouet ~]# perf probe -x /usr/lib64/libstdc++.so.6 -a %sdt_libstdcxx:\*
  Error: event "catch" already exists.
   Hint: Remove existing event by 'perf probe -d'
         or force duplicates by 'perf probe -f'
         or set 'force=yes' in BPF source.
    Error: Failed to add events.
  [root@jouet ~]#

Doesn't work, dups, but at least this served to, unbeknownst to the user, add
the SDT probes in /usr/lib64/libstdc++.so.6!

  [root@jouet ~]# perf list sdt

  List of pre-defined events (to be used in -e):

    sdt_libgcc:unwind                                  [SDT event]
    sdt_libstdcxx:catch@/usr/bin/gcc(9a0730e2bcc6)     [SDT event]
    sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
    sdt_libstdcxx:rethrow@/usr/bin/gcc(9a0730e2bcc6)   [SDT event]
    sdt_libstdcxx:rethrow@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
    sdt_libstdcxx:throw@/usr/bin/gcc(9a0730e2bcc6)     [SDT event]
    sdt_libstdcxx:throw@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
  [root@jouet ~]#

Now we should be able to get to the original cset comment, if we remove all
SDTs events in place, not from the cache, from the kernel, where it was set up as:

  [root@jouet ~]# ls -la /sys/kernel/debug/tracing/events/sdt_libstdcxx/
  total 0
  drwxr-xr-x.  5 root root 0 Jul 13 22:00 .
  drwxr-xr-x. 80 root root 0 Jul 13 21:56 ..
  drwxr-xr-x.  2 root root 0 Jul 13 22:00 catch
  -rw-r--r--.  1 root root 0 Jul 13 22:00 enable
  -rw-r--r--.  1 root root 0 Jul 13 22:00 filter
  drwxr-xr-x.  2 root root 0 Jul 13 22:00 rethrow
  drwxr-xr-x.  2 root root 0 Jul 13 22:00 throw
  [root@jouet ~]#

  [root@jouet ~]# head -2 /sys/kernel/debug/tracing/events/sdt_libstdcxx/throw/format
  name: throw
  ID: 2059
  [root@jouet ~]#

Now to remove it:

  [root@jouet ~]# perf probe -d sdt_libstdc*:*
  Removed event: sdt_libstdcxx:catch
  Removed event: sdt_libstdcxx:rethrow
  Removed event: sdt_libstdcxx:throw
  [root@jouet ~]#

Which caused:

  [root@jouet ~]# ls -la /sys/kernel/debug/tracing/events/sdt_libstdcxx/
  ls: cannot access '/sys/kernel/debug/tracing/events/sdt_libstdcxx/': No such file or directory
  [root@jouet ~]#

Ok, now we can do:

  [root@jouet ~]# perf list sdt_libstdcxx:catch

  List of pre-defined events (to be used in -e):

    sdt_libstdcxx:catch@/usr/bin/gcc(9a0730e2bcc6)     [SDT event]
    sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
  [root@jouet ~]#

So, these are not really 'pre-defined events', i.e. we can't use them with
'perf record --event':

  [root@jouet ~]# perf record --event sdt_libstdcxx:catch*
  event syntax error: 'sdt_libstdcxx:catch*'
                       \___ unknown tracepoint

  Error:	File /sys/kernel/debug/tracing/events/sdt_libstdcxx/catch* not found.
  Hint:	Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
<SNIP>
  [root@jouet ~]#

To have it really pre-defined we must use perf probe to get its definition from
the cache and set it up in the kernel, creating the tracepoint to _then_ use it
with 'perf record --event':

  [root@jouet ~]# perf probe -a sdt_libstdcxx:catch
  Semantic error :There is non-digit char in line number.
  <SNIP>

Oops, there is another gotcha here, we need that pesky '%' character:

  [root@jouet ~]# perf probe -a %sdt_libstdcxx:catch
  Added new events:
    sdt_libstdcxx:catch  (on %catch in /usr/bin/gcc)
    sdt_libstdcxx:catch_1 (on %catch in /usr/lib64/libstdc++.so.6.0.22)

  You can now use it in all perf tools, such as:

	perf record -e sdt_libstdcxx:catch_1 -aR sleep 1

  [root@jouet ~]#

But then we added _two_ events, one with the name we expected, the other one
with a _ added, when doing the analysis we need to pay attention to who maps to
who.

And here is where we get to the point of this patch, which is to be able to
disambiguate those definitions for 'catch' in the build-id cache, but first we need
remove those events we just added:

[root@jouet ~]# perf probe -d %sdt_libstdcxx:catch

Oops, that didn't remove anything, we need to _remove_ that % char in this case:

  [root@jouet ~]# perf probe -d sdt_libstdcxx:catch
  Removed event: sdt_libstdcxx:catch

And we need to remove the other event added, i.e. I forgot to add a * at the end:

  [root@jouet ~]# perf probe -d sdt_libstdcxx:catch*
  Removed event: sdt_libstdcxx:catch_1
  [root@jouet ~]#

Ok, disambiguating it using what is in this patch:

  [root@jouet ~]# perf list sdt_libstdcxx:catch

  List of pre-defined events (to be used in -e):

    sdt_libstdcxx:catch@/usr/bin/gcc(9a0730e2bcc6)     [SDT event]
    sdt_libstdcxx:catch@/usr/lib64/libstdc++.so.6.0.22(ef2b7066559a) [SDT event]
  [root@jouet ~]#
  [root@jouet ~]# perf probe -a %sdt_libstdcxx:catch@9a07
  Added new event:
    sdt_libstdcxx:catch  (on %catch in /usr/bin/gcc)

  You can now use it in all perf tools, such as:

	perf record -e sdt_libstdcxx:catch -aR sleep 1

  [root@jouet ~]# perf probe -l
    sdt_libstdcxx:catch  (on execute_cfa_program+1551@../../../libgcc/unwind-dw2.c in /usr/bin/gcc)
  [root@jouet ~]#

Yeah, it works! But we need to try and simplify this :-)

Update: Some aspects of this simplification take place in the following
        patches.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831793746.17065.13065062753978236612.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:08 -03:00
Masami Hiramatsu 40218daea1 perf list: Show SDT and pre-cached events
Show SDT and pre-cached events by perf-list with "sdt". This also shows
the binary and build-id where the events are placed only when there are
same name events on different binaries.

e.g.:

  # perf list sdt

  List of pre-defined events (to be used in -e):

    sdt_libc:lll_futex_wake                            [SDT event]
    sdt_libc:lll_lock_wait_private                     [SDT event]
    sdt_libc:longjmp                                   [SDT event]
    sdt_libc:longjmp_target                            [SDT event]
  ...
    sdt_libstdcxx:rethrow@/usr/bin/gcc(0cc207fc4b27)   [SDT event]
    sdt_libstdcxx:rethrow@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)
    sdt_libstdcxx:throw@/usr/bin/gcc(0cc207fc4b27)     [SDT event]
    sdt_libstdcxx:throw@/usr/lib64/libstdc++.so.6.0.20(91c7a88fdf49)

The binary path and build-id are shown in below format;

  <GROUP>:<EVENT>@<PATH>(<BUILD-ID>)

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160624090646.25421.44225.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:07 -03:00
Masami Hiramatsu 1de7b8bf72 perf probe: Search SDT/cached event from all probe caches
Search SDT/cached event from all probe caches if user doesn't pass any
binary. With this, we don't have to specify target binary for SDT and
named cached events (which start with %).

E.g. without this, a target binary must be passed with -x.

  # perf probe -x /usr/lib64/libc-2.20.so -a %sdt_libc:\*

With this change, we don't need it anymore.

  # perf probe -a %sdt_libc:\*

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831792812.17065.2353705982669445313.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:07 -03:00
Masami Hiramatsu 42bba263eb perf probe: Allow wildcard for cached events
Allo glob wildcard for reusing cached/SDT events. E.g.

  # perf probe -x /usr/lib64/libc-2.20.so -a %sdt_libc:\*

This example adds probes for all SDT in libc.
Note that the SDTs must have been scanned by perf buildid-cache.

Committer note:

Using it to check what of those SDT probes would take place when doing
a cargo run (rust):

  # trace --no-sys --event sdt_libc:* cargo run
     0.000 sdt_libc:setjmp:(7f326b69c4d1))
    28.423 sdt_libc:setjmp:(7f4b0a5364d1))
    29.000 sdt_libc:setjmp:(7f4b0a5364d1))
    88.597 sdt_libc:setjmp:(7fc01fd414d1))
    89.220 sdt_libc:setjmp:(7fc01fd414d1))
    95.501 sdt_libc:setjmp:(7f326b69c4d1))
     Running `target/debug/hello_world`
    97.110 sdt_libc:setjmp:(7f95e09234d1))
  Hello, world!
  #

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831791813.17065.17846564230840594888.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:07 -03:00
Masami Hiramatsu 05bf2c8a2a perf probe-cache: Add for_each_probe_cache_entry() wrapper
Add for_each_probe_cache_entry() wrapper macro for hiding list in
probe_cache.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831790386.17065.15082256697569419710.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:06 -03:00
Masami Hiramatsu c3492a3a4e perf probe: Make --list show only available cached events
Make "perf probe --cache --list" show only available cached events by
checking build-id validity.

E.g. without this patch:
  ----
  $ ./perf probe --cache --add oldevent=cmd_probe
  $ make #(to update ./perf)
  $ ./perf probe --cache --add newevent=cmd_probe
  $ ./perf probe --cache --list
  /home/mhiramat/ksrc/linux/tools/perf/perf (061e90539bac69
  probe_perf:newevent=cmd_probe
  /home/mhiramat/ksrc/linux/tools/perf/perf (c2e44d614e33e1
  probe_perf:oldevent=cmd_probe
  ----
It shows both of old and new events but user can not use old one.
With this;
  ----
  $ ./perf probe --cache -l
  /home/mhiramat/ksrc/linux/tools/perf/perf (061e90539bac69
  probe_perf:newevent=cmd_probe
  ----

This shows only new events which are on the existing binary.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831789417.17065.17896487479879669610.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:05 -03:00
Masami Hiramatsu 36a009fe07 perf probe: Accept %sdt and %cached event name
To improve usability, support %[PROVIDER:]SDTEVENT format to add new
probes on SDT and cached events.

e.g.
  ----
  # perf probe -x /lib/libc-2.17.so  %lll_lock_wait_private
  Added new event:
    sdt_libc:lll_lock_wait_private (on %lll_lock_wait_private in /usr/lib/libc-2.17.so)

  You can now use it in all perf tools, such as:

          perf record -e sdt_libc:lll_lock_wait_private -aR sleep 1

  # perf probe -l | more
    sdt_libc:lll_lock_wait_private (on __lll_lock_wait_private+21 in /usr/lib/libc-2.17.so)
  ----

Note that this is not only for SDT events, but also normal
events with event-name.

e.g. define "myevent" on cache (-n doesn't add the real probe)
  ----
  # perf probe -x ./perf --cache -n --add 'myevent=dso__load $params'
  ----
  Reuse the "myevent" from cache as below.
  ----
  # perf probe -x ./perf %myevent
  ----

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831788372.17065.3645054540325909346.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:05 -03:00
Masami Hiramatsu f6eb0518f3 perf probe: Fix to show correct error message for $vars and $params
Fix to show correct error messages for $vars and $params because
those special variables requires debug information to find the
real variables or function parameters.

E.g. without this fix;
  ----
  # perf probe -x /lib64/libc-2.23.so getaddrinfo \$params
  Failed to write event: Invalid argument
  Please upgrade your kernel to at least 3.14 to have access to feature $params
    Error: Failed to add events.
  ----

Perf ends up with an error, but the message is not correct.  With this
fix, perf shows correct error message as below.

  ----
  # perf probe -x /lib64/libc-2.23.so getaddrinfo \$params
  The /usr/lib64/libc-2.23.so file has no debug information.
  Rebuild with -g, or install an appropriate debuginfo package.
    Error: Failed to add events.
  ----

Reported-and-Tested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/146831787438.17065.6152436996780110699.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:04 -03:00
Wang Nan b4ee6d415e perf bpf: Support BPF program attach to tracepoints
To support 98b5c2c65c ("perf, bpf: allow bpf programs attach to
tracepoints"), this patch allows BPF scripts to select tracepoints in
their section name.

Example:

  # cat test_tracepoint.c
  /*********************************************/
  #include <uapi/linux/bpf.h>
  #define SEC(NAME) __attribute__((section(NAME), used))
  SEC("raw_syscalls:sys_enter")
  int func(void *ctx)
  {
 	/*
 	 * /sys/kernel/debug/tracing/events/raw_syscalls/sys_enter/format:
 	 * ...
 	 * field:long id;	offset:8;	size:8;	signed:1;
 	 * ...
 	 * ctx + 8 select 'id'
 	 */
 	u64 id = *((u64 *)(ctx + 8));
 	if (id == 1)
 		return 1;
 	return 0;
  }
  SEC("_write=sys_write")
  int _write(void *ctx)
  {
 	return 1;
  }
  char _license[] SEC("license") = "GPL";
  int _version SEC("version") = LINUX_VERSION_CODE;
  /*********************************************/
  # perf record -e ./test_tracepoint.c  dd if=/dev/zero of=/dev/null count=5
  5+0 records in
  5+0 records out
  2560 bytes (2.6 kB) copied, 6.2281e-05 s, 41.1 MB/s
  [ perf record: Woken up 1 times to write data ]
  # perf script
         dd 13436 [005] 1596.490869: raw_syscalls:sys_enter: NR 1 (1, 178d000, 200, 7ffe82470d60, ffffffffffffe020, fffff
         dd 13436 [005] 1596.490871:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490873: raw_syscalls:sys_enter: NR 1 (1, 178d000, 200, ffffffffffffe000, ffffffffffffe020, f
         dd 13436 [005] 1596.490874:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490876: raw_syscalls:sys_enter: NR 1 (1, 178d000, 200, ffffffffffffe000, ffffffffffffe020, f
         dd 13436 [005] 1596.490876:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490878: raw_syscalls:sys_enter: NR 1 (1, 178d000, 200, ffffffffffffe000, ffffffffffffe020, f
         dd 13436 [005] 1596.490879:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490881: raw_syscalls:sys_enter: NR 1 (1, 178d000, 200, ffffffffffffe000, ffffffffffffe020, f
         dd 13436 [005] 1596.490882:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490900: raw_syscalls:sys_enter: NR 1 (2, 7ffe8246e640, 1f, 40acb8, 7f44bac74700, 7f44baa4fba
         dd 13436 [005] 1596.490901:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490917: raw_syscalls:sys_enter: NR 1 (2, 7ffe8246e640, 1a, fffffffa, 7f44bac74700, 7f44baa4f
         dd 13436 [005] 1596.490918:  perf_bpf_probe:_write: (ffffffff812351e0)
         dd 13436 [005] 1596.490932: raw_syscalls:sys_enter: NR 1 (2, 7ffe8246e640, 1a, fffffff9, 7f44bac74700, 7f44baa4f
         dd 13436 [005] 1596.490933:  perf_bpf_probe:_write: (ffffffff812351e0)

Committer note:

Further testing:

  # trace --no-sys --event /home/acme/bpf/tracepoint.c cat /etc/passwd > /dev/null
     0.000 raw_syscalls:sys_enter:NR 1 (1, 7f0490504000, c48, 7f0490503010, ffffffffffffffff, 0))
     0.006 perf_bpf_probe:_write:(ffffffff81241bc0))
  #

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468406646-21642-6-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:04 -03:00
Wang Nan cd102d70fe perf bpf: Rename bpf__foreach_tev() to bpf__foreach_event()
Following commit will allow BPF script attach to tracepoints.
bpf__foreach_tev() will iterate over all events, not only kprobes.
Rename it to bpf__foreach_event().

Since only group and event are used by caller, there's no need to pass
full 'struct probe_trace_event' to bpf_prog_iter_callback_t. Pass only
these two strings. After this patch bpf_prog_iter_callback_t natually
support tracepoints.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468406646-21642-5-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:03 -03:00
Wang Nan 8c619d6a33 perf event parser: Add const qualifier to evt_name and sys_name
Add missing 'const' qualifiers so following commits are able to create
tracepoints using const strings.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468406646-21642-4-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:03 -03:00
Wang Nan 705fa2190d tools lib bpf: Report error when kernel doesn't support program type
Now libbpf support tracepoint program type. Report meaningful error when kernel
version is less than 4.7.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468406646-21642-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:02 -03:00
Wang Nan 5f44e4c810 tools lib bpf: New API to adjust type of a BPF program
Add 4 new APIs to adjust and query the type of a BPF program.
Load program according to type set by caller. Default is set to
BPF_PROG_TYPE_KPROBE.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468406646-21642-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:09:02 -03:00
Arnaldo Carvalho de Melo 1a4bf28573 objtool: Avoid checking code drift on busybox's diff
That doesn't have -I to match lines.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-1zqv1h6okt70e2huokkdtf1u@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 23:08:54 -03:00
Linus Torvalds f97d10454e Merge branches 'perf-urgent-for-linus' and 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf and timer fixes from Ingo Molnar:
 "A fix for a posix CPU timers bug, and a perf printk message fix"

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86: Fix bogus kernel printk, again

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  posix_cpu_timer: Exit early when process has been reaped
2016-07-14 05:44:47 +09:00
Linus Torvalds a7bf89a1b1 Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar:
 "This contains three commits to fix memory corruption bugs with certain
  Apple AirPort cards, plus a fix for a X86_BUG() ID definitions collision
  bug in asm/cpufeatures.h"

* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86/quirks: Add early quirk to reset Apple AirPort card
  x86/quirks: Reintroduce scanning of secondary buses
  x86/quirks: Apply nvidia_bugs quirk only on root bus
  x86/cpu: Fix duplicated X86_BUG(9) macro
2016-07-14 05:33:38 +09:00
Linus Torvalds 2cc499b398 Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core fixes from Ingo Molnar:
 "Fix an objtool false positive plus an UP kernel memory corruption bug
  on certain configs"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  cpu/hotplug: Keep enough storage space if SMP=n to avoid array out of bounds scribble
  objtool: Fix STACK_FRAME_NON_STANDARD macro checking for function symbols
2016-07-14 05:10:28 +09:00
David S. Miller 790e5ef59f Merge branch 'sk_filter-trim-limit'
Willem de Bruijn says:

====================
limit sk_filter trim to payload

Sockets can apply a filter to incoming packets to drop or trim them.
Fix two codepaths that call skb_pull/__skb_pull after sk_filter
without checking for packet length.

Reading beyond skb->tail after trimming happens in more codepaths, but
safety of reading in the linear segment is based on minimum allocation
size (MAX_HEADER, GRO_MAX_HEAD, ..).
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-13 11:53:41 -07:00
Willem de Bruijn 4f0c40d944 dccp: limit sk_filter trim to payload
Dccp verifies packet integrity, including length, at initial rcv in
dccp_invalid_packet, later pulls headers in dccp_enqueue_skb.

A call to sk_filter in-between can cause __skb_pull to wrap skb->len.
skb_copy_datagram_msg interprets this as a negative value, so
(correctly) fails with EFAULT. The negative length is reported in
ioctl SIOCINQ or possibly in a DCCP_WARN in dccp_close.

Introduce an sk_receive_skb variant that caps how small a filter
program can trim packets, and call this in dccp with the header
length. Excessively trimmed packets are now processed normally and
queued for reception as 0B payloads.

Fixes: 7c657876b6 ("[DCCP]: Initial implementation")
Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-13 11:53:41 -07:00
Willem de Bruijn f4979fcea7 rose: limit sk_filter trim to payload
Sockets can have a filter program attached that drops or trims
incoming packets based on the filter program return value.

Rose requires data packets to have at least ROSE_MIN_LEN bytes. It
verifies this on arrival in rose_route_frame and unconditionally pulls
the bytes in rose_recvmsg. The filter can trim packets to below this
value in-between, causing pull to fail, leaving the partial header at
the time of skb_copy_datagram_msg.

Place a lower bound on the size to which sk_filter may trim packets
by introducing sk_filter_trim_cap and call this for rose packets.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-13 11:53:40 -07:00
Arnaldo Carvalho de Melo 774bec3fdd objtool: Add fallback from ELF_C_READ_MMAP to ELF_C_READ
Not all libelf implementations have this "Please, ELF_C_READ, but use
mmap if possible" elf_begin() cmd, so provide a fallback to plain old
ELF_C_READ.

Case in point: Alpine Linux 3.4.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-1fctuknrawgoi5xqon4mu9dv@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-07-13 15:38:50 -03:00
David S. Miller 22cb99fb76 Merge branch 'mlx5-fixes'
Saeed Mahameed says:

====================
mlx5 tx timeout watchdog fixes

This patch set provides two trivial fixes for the tx timeout series lately
applied into net 4.7.

From Daniel, detect stuck queues due to BQL
From Mohamad, fix tx timeout watchdog false alarm

Hopefully those two fixes will make it to -stable, assuming
3947ca1859 ('net/mlx5e: Implement ndo_tx_timeout callback') was also backported to -stable.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-13 11:38:17 -07:00
Mohamad Haj Yahia c3b7c5c950 net/mlx5e: start/stop all tx queues upon open/close netdev
Start all tx queues (including inactive ones) when opening the netdev.
Stop all tx queues (including inactive ones) when closing the netdev.

This is a workaround for the tx timeout watchdog false alarm issue in
which the netdev watchdog is polling all the tx queues which may include
inactive queues and thus once lowering the real tx queues number
(ethtool -L) it will generate tx timeout watchdog false alarms.

Fixes: 3947ca1859 ('net/mlx5e: Implement ndo_tx_timeout callback')
Signed-off-by: Mohamad Haj Yahia <mohamad@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-13 11:38:16 -07:00
Daniel Jurgens 2c1ccc9937 net/mlx5e: Fix TX Timeout to detect queues stuck on BQL
Change netif_tx_queue_stopped to netif_xmit_stopped.  This will show
when queues are stopped due to byte queue limits.

Fixes: 3947ca1859 ('net/mlx5e: Implement ndo_tx_timeout callback')
Signed-off-by: Daniel Jurgens <danielj@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-07-13 11:38:16 -07:00