Commit graph

737673 commits

Author SHA1 Message Date
Jessica Yu 12310e3437 kprobes: Propagate error from arm_kprobe_ftrace()
Improve error handling when arming ftrace-based kprobes. Specifically, if
we fail to arm a ftrace-based kprobe, register_kprobe()/enable_kprobe()
should report an error instead of success. Previously, this has lead to
confusing situations where register_kprobe() would return 0 indicating
success, but the kprobe would not be functional if ftrace registration
during the kprobe arming process had failed. We should therefore take any
errors returned by ftrace into account and propagate this error so that we
do not register/enable kprobes that cannot be armed. This can happen if,
for example, register_ftrace_function() finds an IPMODIFY conflict (since
kprobe_ftrace_ops has this flag set) and returns an error. Such a conflict
is possible since livepatches also set the IPMODIFY flag for their ftrace_ops.

arm_all_kprobes() keeps its current behavior and attempts to arm all
kprobes. It returns the last encountered error and gives a warning if
not all probes could be armed.

This patch is based on Petr Mladek's original patchset (patches 2 and 3)
back in 2015, which improved kprobes error handling, found here:

   https://lkml.org/lkml/2015/2/26/452

However, further work on this had been paused since then and the patches
were not upstreamed.

Based-on-patches-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: David S . Miller <davem@davemloft.net>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Miroslav Benes <mbenes@suse.cz>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: live-patching@vger.kernel.org
Link: http://lkml.kernel.org/r/20180109235124.30886-2-jeyu@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-16 09:12:52 +01:00
Ingo Molnar 3f9e646313 perf/core improvements and fixes:
- perf_mmap overwrite mode overhaul, prep work to get 'perf top'
   using it, making it bearable to use it in large core count systems
   such as Knights Landing/Mill Intel systems (Kan Liang)
 
 - s/390 now uses syscall.tbl, just like x86-64 to generate the syscall
   table id -> string tables used by 'perf trace' (Hendrik Brueckner)
 
 - Add perf vendor JSON metrics for ARM Cortex-A53 Processor (William Cohen)
 
 - Use strtoull() instead of home grown function (Andy Shevchenko)
 
 - Synchronize kernel ABI headers, v4.16-rc1 (Ingo Molnar)
 
 - Document missing 'perf data --force' option (Sangwon Hong)
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEELb9bqkb7Te0zijNb1lAW81NSqkAFAlqFhnIACgkQ1lAW81NS
 qkCWiA/+MKuwFS/NiVBKRRmlBTEUHPo3zmOA3lPV4sJcf2qIicQKjpSTCdC8yTrM
 4Br9q3x211Zk1XxcRrB6urTT/8ySzkfo2sbKLRbJfvj5MT5rJ+wcVAJ3KLLoI2xF
 daDqrCMMP9otMcyiJUx9I88FagS2XkmL2r3M8O7z/9PzIegYLYSB5v2YwAoNVkJa
 odA1JTXChIB0KM980cY3NvrhlV++uPIVdv32q0MWhIdqExFWcl4Qct3ax6WztOeG
 QedMpFsEoAtjn+l8w9cc6l61vKiizCZaWvs/mgYZ2xaaWTwKGxm89W81KDYn9Kuq
 fZEkq/tDoy/0ehqZtaPMxjoH63FpYuMfsW557b7w21RDYo+M788D0yYnvBd63Fp3
 ptBgiLGZ2lHKEPrDab+6fVjIx0eEwXFVeuUniDWJ1ocTnyOoSna2nPzNF2cpEYaO
 hyiA+1McR3hf7x6l8wykzJ8f/HrPVeY+PgbBL1i6nZIJiDkqFfQ52/MjtAzD9ONJ
 kuKRIgCPGmD1+8z1/dTA4tgXZNbbCH+F05/G26hzcZjNTXam44/CjaA+0sfxD+jc
 3mVHTbPiHf6zJfFap7OmcJOcn+QEcRNajvHU1Eci6pwClMwrkhFH79hMbPkcewU9
 eqLQXkqrhitAEn5n2qirTT3CJZIZ65m6SM68rl9bYnShMsiyqNE=
 =TdvB
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo-4.17-20180215' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Pull perf/core fixes from Arnaldo Carvalho de Melo:

- perf_mmap overwrite mode fixes/overhaul, prep work to get 'perf top'
  using it, making it bearable to use it in large core count systems
  such as Knights Landing/Mill Intel systems (Kan Liang)

- s/390 now uses syscall.tbl, just like x86-64 to generate the syscall
  table id -> string tables used by 'perf trace' (Hendrik Brueckner)

- Use strtoull() instead of home grown function (Andy Shevchenko)

- Synchronize kernel ABI headers, v4.16-rc1 (Ingo Molnar)

- Document missing 'perf data --force' option (Sangwon Hong)

- Add perf vendor JSON metrics for ARM Cortex-A53 Processor (William Cohen)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-16 09:10:09 +01:00
Dave Airlie bfad2d08e5 Merge branch 'linux-4.16' of git://github.com/skeggsb/linux into drm-fixes
single fix for older gpus.

* 'linux-4.16' of git://github.com/skeggsb/linux:
  drm/nouveau: Make clock gate support conditional
2018-02-16 14:26:01 +10:00
Thierry Reding 9225626989 drm/nouveau: Make clock gate support conditional
The recently introduced clock gate support breaks on Tegra chips because
no thermal support is enabled for those devices. Conditionalize the code
on the existence of thermal support to fix this.

Fixes: b138eca661 ("drm/nouveau: Add support for basic clockgating on Kepler1")
Cc: Martin Peres <martin.peres@free.fr>
Cc: Lyude Paul <lyude@redhat.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
2018-02-16 14:07:58 +10:00
Dave Airlie 8d3c629439 There are important fixes for VLV with MIPI/DSI panels,
2 clean-up patches needed for this MIPI/DSI fix,
 and many fixes for GEM including fixes for Perf OA and PMU,
 and fixes on scheduler and preemption.
 
 This also includes GVT fixes: "This has one to fix GTT mmio 8b
 access from guest and two simple ones for mmio switch and typo fix"
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJahOllAAoJEPpiX2QO6xPKIVYH/RudH1UJQ4trA83c743Aa4Wl
 vZis80uUHq5Mhr95bosNZv+RupLbu3EC0GWRlbUlTBX4MlSNSaXYac0/SghNd3KY
 EQoNy0xjn7FSOQ+e1g2i2Tul0/Rn1+9NeEAy5jZzNtv0xOxtIdmVc0oCJMJz6Yfl
 lsC1ScKvEMbWzjEXbsyjOMuyM9PYHfavU4j2N0cfcSKqopfI64yqUz6IouCXkIpu
 Aocxht3gIrd0uJ8zKq7Kj35Dc/1Cxlj0xo4cfIe3SmgVwPiWiLTrMLmuk0Z85tkq
 0o9Y9jz9HsNN3Ff6egjc27iwMCOSQzq/CYlLJQ0yL+O1vgVIhl9CECnYcCGprsA=
 =uSBC
 -----END PGP SIGNATURE-----

Merge tag 'drm-intel-fixes-2018-02-14-1' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes

There are important fixes for VLV with MIPI/DSI panels,
2 clean-up patches needed for this MIPI/DSI fix,
and many fixes for GEM including fixes for Perf OA and PMU,
and fixes on scheduler and preemption.

This also includes GVT fixes: "This has one to fix GTT mmio 8b
access from guest and two simple ones for mmio switch and typo fix"

* tag 'drm-intel-fixes-2018-02-14-1' of git://anongit.freedesktop.org/drm/drm-intel:
  drm/i915: Fix DSI panels with v1 MIPI sequences without a DEASSERT sequence v3
  drm/i915: Free memdup-ed DSI VBT data structures on driver_unload
  drm/i915: Add intel_bios_cleanup() function
  drm/i915/vlv: Add cdclk workaround for DSI
  drm/i915/gvt: fix one typo of render_mmio trace
  drm/i915/gvt: Support BAR0 8-byte reads/writes
  drm/i915/gvt: add 0xe4f0 into gen9 render list
  drm/i915/pmu: Fix building without CONFIG_PM
  drm/i915/pmu: Fix sleep under atomic in RC6 readout
  drm/i915/pmu: Fix PMU enable vs execlists tasklet race
  drm/i915: Lock out execlist tasklet while peeking inside for busy-stats
  drm/i915/breadcrumbs: Ignore unsubmitted signalers
  drm/i915: Don't wake the device up to check if the engine is asleep
  drm/i915: Avoid truncation before clamping userspace's priority value
  drm/i915/perf: Fix compiler warning for string truncation
  drm/i915/perf: Fix compiler warning for string truncation
2018-02-16 12:33:03 +10:00
Dave Airlie 6bdd5b4edf Merge branch 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux into drm-fixes
single atpx fix

* 'drm-next-4.16' of git://people.freedesktop.org/~agd5f/linux:
  drm/amdgpu: add new device to use atpx quirk
2018-02-16 12:30:41 +10:00
Linus Torvalds b63b1e5730 ACPI updates for v4.16-rc2
- Revert a problematic EC driver change from the 4.13 cycle that
    introduced a system resume regression on Thinkpad X240 (Rafael
    Wysocki).
 
  - Clean up device tables handling in the ACPI core and the related
    part of the device properties framework (Andy Shevchenko).
 
  - Update the sysfs ABI documentatio of the dock and the INT3407
    special device drivers (Aishwarya Pant).
 
  - Add an expected switch fall-through marker to the SPCR table
    parsing code (Gustavo Silva).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJahfZtAAoJEILEb/54YlRxi38P/i+I+LcWj06h4aj2xXqoqyqk
 No7/BZrcQyg4Y8goRagsYwbxkC1WqcrlDcjNkaHV+tTjR77pAJlFsNhYNG4lo4ch
 hlA3ickDXhC71Sm/vUQ1SpOKRUAOojFyWkBf82JSqTiOkjJ3NpNy0z//JX6lM1II
 YwK45QK2GGQt6USJvU6pfBEBdDETfYq4l4xV7FhfpTrcqs3SFOHNBlbUYjtwoZ9l
 RCVvdUjAmYd3LTMyuLuQnj0g+oCul230CmAb2xd5E82jep+Wdne/oXmNMeJw/6vm
 hb2SAdHvJqAIm/yV25fKYt+/h8rjoUVdILoDtmjByvc3h5No6OvjhxL4zu4kg9O4
 EEVEnKGs55syk+fHpyhfawxdj/qe1XQHw2QUKh/gCbE/ObOnx+WC9Ot1gB+6Sw0w
 08CFzb5PJ74Atf/6ceFotSksWZzOsEM/QixqKVZ4u0QUiG42rO7rYTa8TVHxwGVv
 LOdIpShWbOzXaqBH+Se/9loKJVG+UnCWyfRlU+W1JjZs+I1c0PDgbIGyaOmgZXjk
 n5FxQ/dCudKWfZwU/z9dWya5O58aQM/aWP6KweuLtv2ZQ03aKNpen+HJC7MN3Xh2
 0x7RPCTmK9QROsXDOOeKckiCLSGiuSQZ2VMReY5C6EtlCX5GiD9jAG9IQiLDGVfb
 93VxegPRbEyY5HQe6Udy
 =gdK1
 -----END PGP SIGNATURE-----

Merge tag 'acpi-4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
 "These fix a system resume regression from the 4.13 cycle, clean up
  device table handling in the ACPI core, update sysfs ABI documentation
  of a couple of drivers and add an expected switch fall-through marker
  to the SPCR table parsing code.

  Specifics:

   - Revert a problematic EC driver change from the 4.13 cycle that
     introduced a system resume regression on Thinkpad X240 (Rafael
     Wysocki).

   - Clean up device tables handling in the ACPI core and the related
     part of the device properties framework (Andy Shevchenko).

   - Update the sysfs ABI documentatio of the dock and the INT3407
     special device drivers (Aishwarya Pant).

   - Add an expected switch fall-through marker to the SPCR table
     parsing code (Gustavo Silva)"

* tag 'acpi-4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: dock: document sysfs interface
  ACPI / DPTF: Document dptf_power sysfs atttributes
  device property: Constify device_get_match_data()
  ACPI / bus: Rename acpi_get_match_data() to acpi_device_get_match_data()
  ACPI / bus: Remove checks in acpi_get_match_data()
  ACPI / bus: Do not traverse through non-existed device table
  ACPI: SPCR: Mark expected switch fall-through in acpi_parse_spcr
  ACPI / EC: Restore polling during noirq suspend/resume phases
2018-02-15 14:50:32 -08:00
Linus Torvalds 8bb8966603 Power management updates for v4.16-rc2
- Fix a recently introduced build issue related to cpuidle by
    covering all of the relevant combinations of Kconfig options
    in its header (Rafael Wysocki).
 
  - Add missing invocation of pm_runtime_drop_link() to the
    !CONFIG_SRCU variant of __device_link_del() (Lukas Wunner).
 
  - Fix unbalanced IRQ enable in the wakeup interrupts framework
    (Tony Lindgren).
 
  - Update cpuidle sysfs ABI documentation (Aishwarya Pant).
 
  - Use GFP_KERNEL instead of GFP_ATOMIC for allocating memory
    in dev_pm_opp_init_cpufreq_table() (Jia-Ju Bai).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJahfXsAAoJEILEb/54YlRxvCQP/jtIJ6wtIPVCKBY0RrWEsya8
 MkFrsaXBVA2mTfBbRxiCr/gMEP/7OFfV1WN2Y0lLUhCckI9EB5Q4ctF4UFRv6f4y
 ZfPF6THLLN4Li7l+1XUulfom8mtO1ZJAcfRV2iwd4Lgk3bX8l74ViZXyhb/3LckF
 BMKbkQi7sLvCx01Cw63YcEuqLJz1wwQPq3yGEUvRySSKB1qQsFabqR8cuRVkp5Js
 e3dDoi0Pe0i80m+E2Ophi5k3QpiTEejaPTmHVzs35Z1sgUXGne7Fa+TI1WTKoe9b
 9M2mXRe9l1rJ8t4IFwtOV5Cv6onSt9kFP+rIEnLu1urf8GhHgzHXbzvoTeK89NkR
 dA+/iS2q9cU7R3hAiear/Treb8TiaCBHES4koE/exLjtjyfuM5gcf7GG4IjXVIu6
 zVT4ioCqegexcgCBEm3uCu7YWiObWPjmG6KC8pH0+MKlaKtyKfZqtnAkD1ZMzDlG
 Rh9r++NO1AZMMHVlMxydNYVBYy4Vm6WTrA311/41GB3bgkFxxHZ+opio1t3wfebW
 It5Gar6yJfrzNLruu2GGjqnfDLKIrXxCc2NUvuWhtRR2KDuEz7Z3ugvdEEMM+QSI
 YwMtSPMUmOJOaqN5brkmHz9pl/bxWjFOwldboS8XVCC6Oeiodg2UOHcTjDbkFfJ0
 yBoNdooSQ0X+Woq7J2np
 =U6ev
 -----END PGP SIGNATURE-----

Merge tag 'pm-4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
 "These fix a recently introduced build issue related to cpuidle and two
  bugs in the PM core, update cpuidle documentation and clean up memory
  allocations in the operating performance points (OPP) framework.

  Specifics:

   - Fix a recently introduced build issue related to cpuidle by
     covering all of the relevant combinations of Kconfig options
     in its header (Rafael Wysocki).

   - Add missing invocation of pm_runtime_drop_link() to the
     !CONFIG_SRCU variant of __device_link_del() (Lukas Wunner).

   - Fix unbalanced IRQ enable in the wakeup interrupts framework
     (Tony Lindgren).

   - Update cpuidle sysfs ABI documentation (Aishwarya Pant).

   - Use GFP_KERNEL instead of GFP_ATOMIC for allocating memory
     in dev_pm_opp_init_cpufreq_table() (Jia-Ju Bai)"

* tag 'pm-4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  PM: cpuidle: Fix cpuidle_poll_state_init() prototype
  PM / runtime: Update links_count also if !CONFIG_SRCU
  PM / wakeirq: Fix unbalanced IRQ enable for wakeirq
  Documentation/ABI: update cpuidle sysfs documentation
  opp: cpu: Replace GFP_ATOMIC with GFP_KERNEL in dev_pm_opp_init_cpufreq_table
2018-02-15 14:40:01 -08:00
Linus Torvalds 3e9f4df0ea Fix bad temperature display on Ryzen/Threadripper
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJahgQ1AAoJEMsfJm/On5mBNfgQAJgCjg4gatr0U2pqd40IPtwS
 V/KrAfLtt9+zv6HSdW1zc1vUKb3mAvi9roVIX6i4nuSjS9eitPRyvcSN+UW9X01t
 r8jqwtStssaXEKLzRkEGBoACy7/A0fNCcjHMOj1EPftKIOZdfGnZ6r4cI+/wGyLR
 ybBjcvfMNkLGgJbRKy/2Acib/Jp9OoJpjLMVyIFnhRGgRmvYKSDu7rK6ecmW2KSG
 mgKyzxL29PLfWu8jVwnkXfZcdG97akEv90BfUUa16KXA3+hgvscM5+7jQmap4N3p
 nh3yLc7MyTXvfOhKauer4czTwbr3JoDZ+BZ38a1qoD+cPX6e5GkGJnFR1E0NBG/p
 7m2w1u7LVhab5t7NFA8JgKB8J8PfyGVCiHfF0szil6lA0LiRVN/rgMcAEIavIO7K
 7C5OBjVYWk0PeJULU66r81kILvZMtc6xh6XC2gc8Z+t6uu4Ld4FSUsIWL6Muu0l6
 i2h8WX5HSMjSqCylPBTRD0a/hvPuQjWE0fkLoAtgPCt112Je6xitJzZM+RPDKonV
 8+zG1NM9eePnSNt3TsdMeF6HOR9fR9n7E3D0xsM2cbHXa1BOwlVCkPYYqNA6QkaM
 ZKTRKysZn3fYfMT0fVfdZ7E0ODZPpY/gwdqE4bduH9pMksqO0E2/g9PX/JQV13bN
 IwpMFO9aHMqVc+U8Xwhu
 =kHhI
 -----END PGP SIGNATURE-----

Merge tag 'hwmon-for-linus-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fix from Guenter Roeck:
 "Fix bad temperature display on Ryzen/Threadripper"

* tag 'hwmon-for-linus-v4.16-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (k10temp) Only apply temperature offset if result is positive
2018-02-15 14:31:28 -08:00
Linus Torvalds 2439f9766d virtio: bugfixes
This includes a bugfix for virtio 9p fs.
 It also fixes hybernation for s390 guests with virtio devices.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJahJ2jAAoJECgfDbjSjVRpGbsIAKvK50iQK/5Qe0X78DCv/9pW
 gVkW29bAKG8D8JcI/EViLFW3IgeDM1a2fcbCoSiOTzydAf6nMTI0vZqURopQbXKC
 teJw7PwHjaZ9Y3IL/mzMODrhZvZrl9iI2yAQoZqoeCeaX76t5k8kYB35U4Uuiw7Y
 gKWOpuOPEZx2mKrPCmIN2X0VrETJz122bNyb5DB+V4oLAx/9PolGGiGBmyu61pv/
 Fx1PQ6at8/M+74tFeeFwKbuUf5GmdanqPVCZlJJPKa2acaRtBFhI01OhBMIxAUYj
 9+1dzp5E4KjmGbz7Fd3dsleRLCV/q4E8gDWLbZVx4p2vVsp7edxk/29kcSVrhlE=
 =c8q9
 -----END PGP SIGNATURE-----

Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost

Pull virtio fixes from Michael Tsirkin:
 "This includes a bugfix for virtio 9p fs. It also fixes hybernation for
  s390 guests with virtio devices"

* tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
  virtio/s390: implement PM operations for virtio_ccw
  9p/trans_virtio: discard zero-length reply
2018-02-15 14:29:27 -08:00
James Hogan 5efad9eee3
sparc,leon: Select USB_UHCI_BIG_ENDIAN_{MMIO,DESC}
Now that USB_UHCI_BIG_ENDIAN_MMIO and USB_UHCI_BIG_ENDIAN_DESC are moved
outside of the USB_SUPPORT conditional, simply select them from
SPARC_LEON rather than by the symbol's defaults in drivers/usb/Kconfig,
similar to how it is done for USB_EHCI_BIG_ENDIAN_MMIO and
USB_EHCI_BIG_ENDIAN_DESC.

Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: sparclinux@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Acked-by: David S. Miller <davem@davemloft.net>
Patchwork: https://patchwork.linux-mips.org/patch/18560/
2018-02-15 21:45:16 +00:00
James Hogan ec897569ad
usb: Move USB_UHCI_BIG_ENDIAN_* out of USB_SUPPORT
Move the Kconfig symbols USB_UHCI_BIG_ENDIAN_MMIO and
USB_UHCI_BIG_ENDIAN_DESC out of drivers/usb/host/Kconfig, which is
conditional upon USB && USB_SUPPORT, so that it can be freely selected
by platform Kconfig symbols in architecture code.

For example once the MIPS_GENERIC platform selects are fixed in commit
2e6522c565 ("MIPS: Fix typo BIG_ENDIAN to CPU_BIG_ENDIAN"), the MIPS
32r6_defconfig warns like so:

warning: (MIPS_GENERIC) selects USB_UHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT && USB)
warning: (MIPS_GENERIC) selects USB_UHCI_BIG_ENDIAN_DESC which has unmet direct dependencies (USB_SUPPORT && USB)

Fixes: 2e6522c565 ("MIPS: Fix typo BIG_ENDIAN to CPU_BIG_ENDIAN")
Signed-off-by: James Hogan <jhogan@kernel.org>
Cc: Corentin Labbe <clabbe.montjoie@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: linux-usb@vger.kernel.org
Cc: linux-mips@linux-mips.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Patchwork: https://patchwork.linux-mips.org/patch/18559/
2018-02-15 21:29:13 +00:00
David S. Miller 35ed663f5f Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
Johan Hedberg says:

====================
pull request: bluetooth-next 2018-02-15

Here's the first bluetooth-next pull request targetting the 4.17 kernel
release.

 - Fixes & cleanups to Atheros and Marvell drivers
 - Support for two new Realtek controllers
 - Support for new Intel Bluetooth controller
 - Fix for supporting multiple slave-role Bluetooth LE connections
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:43:49 -05:00
Prashant Bhole ddd0010392 selftests/net: fixes psock_fanout eBPF test case
eBPF test fails due to verifier failure because log_buf is too small.
Fixed by increasing log_buf size

Signed-off-by: Prashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:43:04 -05:00
David Ahern 68e813aa43 net/ipv4: Remove fib table id from rtable
Remove rt_table_id from rtable. It was added for getroute to return the
table id that was hit in the lookup. With the changes for fibmatch the
table id can be extracted from the fib_info returned in the fib_result
so it no longer needs to be in rtable directly.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:41:42 -05:00
David S. Miller 45b3a37627 Merge branch 'tc-testing-plugin-architecture'
Brenda J. Butler says:

====================
tools: tc-testing: Plugin Architecture

To make tdc.py more general, we are introducing a plugin architecture.

This patch set first organizes the command line parameters, then
introduces the plugin architecture and some example plugins.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler 95ce14c3ff tools: tc-testing: Update README and TODO
Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler c25e473686 tools: tc-testing: valgrindPlugin
Run the command under test under valgrind.  Produce an extra set of
tap output for the memory check on each test.

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler a13fedbe56 tools: tc-testing: nsPlugin
Move the functionality of creating a namespace before the test suite
and destroying it afterwards to a plugin.

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler f6926e85ee tools: tc-testing: rootPlugin
Move the functionality that checks for root permissions into a plugin.

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler 93707cbabc tools: tc-testing: Introduce plugin architecture
This should be a general test architecture, and yet allow specific
tests to be done.  Introduce a plugin architecture.

An individual test has 4 stages, setup/execute/verify/teardown.  Each
plugin gets a chance to run a function at each stage, plus one call
before all the tests are called ("pre" suite) and one after all the
tests are called ("post" suite).  In addition, just before each
command is executed, the plugin gets a chance to modify the command
using the "adjust_command" hook.  This makes the test suite quite
flexible.

Future patches will take some functionality out of the tdc.py script and
place it in plugins.

To use the plugins, place the implementation in the plugins directory
and run tdc.py.  It will notice the plugins and use them.

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler 6fac733d9d tools: tc-testing: Refactor test-runner
Split the test_runner function into the loop part (test_runner)
and the contents (run_one_test) for maintainability.
It makes it a little easier to catch exceptions
in an individual test, and keep going (and flush a bunch
of tap results for the skipped tests).

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
Brenda J. Butler f87c7f646c tools: tc-testing: Command line parms
Separate the functionality of the command line parameters into "selection"
parameters, "action" parameters and other parameters.

"Selection" parameters are for choosing which tests on which to act.
"Action" parameters are for choosing what to do with the selected tests.
"Other" parameters are for global effect (like "help" or "verbose").

With this commit, we add the ability to name a directory as another
selection mechanism.  We can accumulate a number of tests by directory,
file, category, or even by test id, instead of being constrained to
run all tests in one collection or just one test.

Signed-off-by: Brenda J. Butler <bjb@mojatatu.com>
Acked-by: Lucas Bates <lucasb@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:38:33 -05:00
David S. Miller c402fb7e38 Merge branch 'tunchr-get-netns'
Kirill Tkhai says:

====================
net: Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device

Currently, it's not possible to get or check net namespace,
which was used to create tun socket. User may have two tun
devices with the same names in different nets, and there
is no way to differ them each other.

The patchset adds support for ioctl() cmd SIOCGSKNS for tun
devices. It will allow people to obtain net namespace file
descriptor like we allow to do that for sockets in general.

v2: Add new patch [2/3] to export open_related_ns().
====================

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:35:11 -05:00
Kirill Tkhai f2780d6d74 tun: Add ioctl() SIOCGSKNS cmd to allow obtaining net ns of tun device
This patch adds possibility to get tun device's net namespace fd
in the same way we allow to do that for sockets.

Socket ioctl numbers do not intersect with tun-specific, and there
is already SIOCSIFHWADDR used in tun code. So, SIOCGSKNS number
is choosen instead of custom-made for this functionality.

Note, that open_related_ns() uses plain get_net_ns() and it's safe
(net can't be already dead at this moment):

  tun socket is allocated via sk_alloc() with zero last arg (kern = 0).
  So, each alive socket increments net::count, and the socket is definitely
  alive during ioctl syscall.

Also, common variable net is introduced, so small cleanup in TUNSETIFF
is made.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:34:42 -05:00
Kirill Tkhai 24dce0800b net: Export open_related_ns()
This function will be used to obtain net of tun device.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:34:42 -05:00
Kirill Tkhai d8d211a2a0 net: Make extern and export get_net_ns()
This function will be used to obtain net of tun device.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-02-15 15:34:42 -05:00
Linus Torvalds 1388c80438 Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Ingo Molnar:
 "Misc fixes:

   - fix rq->lock lockdep annotation bug

   - fix/improve update_curr_rt() and update_curr_dl() accounting

   - update documentation

   - remove unused macro"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched/cpufreq: Remove unused SUGOV_KTHREAD_PRIORITY macro
  sched/core: Fix DEBUG_SPINLOCK annotation for rq->lock
  sched/rt: Make update_curr_rt() more accurate
  sched/deadline: Make update_curr_dl() more accurate
  membarrier-sync-core: Document architecture support
2018-02-15 09:28:47 -08:00
Linus Torvalds e9e3b3002f Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull locking fixes from Ingo Molnar:
 "This contains two qspinlock fixes and three documentation and comment
  fixes"

* 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/semaphore: Update the file path in documentation
  locking/atomic/bitops: Document and clarify ordering semantics for failed test_and_{}_bit()
  locking/qspinlock: Ensure node->count is updated before initialising node
  locking/qspinlock: Ensure node is initialised before updating prev->next
  Documentation/locking/mutex-design: Update to reflect latest changes
2018-02-15 09:05:26 -08:00
Minwoo Im 096392e071 block: fix a typo in comment of BLK_MQ_POLL_STATS_BKTS
Update comment typo _consisitent_ to _consistent_ from following commit.
commit 0206319fdf ("blk-mq: Fix poll_stat for new size-based bucketing.")

Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-02-15 08:27:06 -07:00
Hendrik Brueckner f1d0b4cde9 Revert "tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h"
This reverts commit f120c7b187e6c418238710b48723ce141f467543 which is no
longer required with the introduction of a syscall.tbl on s390.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: linux-s390@vger.kernel.org
LPU-Reference: 1518090470-2899-2-git-send-email-brueckner@linux.vnet.ibm.com
Link: https://lkml.kernel.org/n/tip-q1lg0nvhha1tk39ri9aqalcb@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 10:06:15 -03:00
Hendrik Brueckner 690d22d9d4 perf s390: Rework system call table creation by using syscall.tbl
Recently, s390 uses a syscall.tbl input file to generate its system call
table and unistd uapi header files.  Hence, update mksyscalltbl to use
it as input to create the system table for perf.

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: linux-s390@vger.kernel.org
LPU-Reference: 1518090470-2899-4-git-send-email-brueckner@linux.vnet.ibm.com
Link: https://lkml.kernel.org/n/tip-bdyhllhsq1zgxv2qx4m377y6@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 10:06:08 -03:00
Hendrik Brueckner baa6761030 perf s390: Grab a copy of arch/s390/kernel/syscall/syscall.tbl
Grab a copy of the s390 system call table file introduced with commit
857f46bfb0 "s390/syscalls: add system call
table".

Signed-off-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Thomas Richter <tmricht@linux.vnet.ibm.com>
Cc: linux-s390@vger.kernel.org
LPU-Reference: 1518090470-2899-3-git-send-email-brueckner@linux.vnet.ibm.com
Link: https://lkml.kernel.org/n/tip-hpw7vdjp7g92ivgpddrp5ydq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 10:06:00 -03:00
Ingo Molnar f091f1d6a2 tools/headers: Synchronize kernel ABI headers, v4.16-rc1
Sync the following tooling headers with the latest kernel version:

  tools/arch/powerpc/include/uapi/asm/kvm.h
  tools/arch/x86/include/asm/cpufeatures.h
  tools/include/uapi/drm/i915_drm.h
  tools/include/uapi/linux/if_link.h
  tools/include/uapi/linux/kvm.h

All the changes are new ABI additions which don't impact their use
in existing tooling.

Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2018-02-15 10:01:46 -03:00
Thomas Richter 7a92453620 perf test: Fix test trace+probe_libc_inet_pton.sh for s390x
On Intel test case trace+probe_libc_inet_pton.sh succeeds and the
output is:

[root@f27 perf]# ./perf trace --no-syscalls
                  -e probe_libc:inet_pton/max-stack=3/ ping -6 -c 1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.037 ms

 --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.037/0.037/0.037/0.000 ms
     0.000 probe_libc:inet_pton:(7fa40ac618a0))
              __GI___inet_pton (/usr/lib64/libc-2.26.so)
              getaddrinfo (/usr/lib64/libc-2.26.so)
              main (/usr/bin/ping)

The kernel stack unwinder is used, it is specified implicitly
as call-graph=fp (frame pointer).

On s390x only dwarf is available for stack unwinding. It is also
done in user space. This requires different parameter setup
and result checking for s390x and Intel.

This patch adds separate perf trace setup and result checking
for Intel and s390x. On s390x specify this command line to
get a call-graph and handle the different call graph result
checking:

[root@s35lp76 perf]# ./perf trace --no-syscalls
	-e probe_libc:inet_pton/call-graph=dwarf/ ping -6 -c 1 ::1
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.041 ms

 --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.041/0.041/0.041/0.000 ms
     0.000 probe_libc:inet_pton:(3ffb9942060))
            __GI___inet_pton (/usr/lib64/libc-2.26.so)
            gaih_inet (inlined)
            __GI_getaddrinfo (inlined)
            main (/usr/bin/ping)
            __libc_start_main (/usr/lib64/libc-2.26.so)
            _start (/usr/bin/ping)
[root@s35lp76 perf]#

Before:
[root@s8360047 perf]# ./perf test -vv 58
58: probe libc's inet_pton & backtrace it with ping       :
 --- start ---
test child forked, pid 26349
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.079 ms
 --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.079/0.079/0.079/0.000 ms
0.000 probe_libc:inet_pton:(3ff925c2060))
test child finished with -1
 ---- end ----
probe libc's inet_pton & backtrace it with ping: FAILED!
[root@s8360047 perf]#

After:
[root@s35lp76 perf]# ./perf test -vv 57
57: probe libc's inet_pton & backtrace it with ping       :
 --- start ---
test child forked, pid 38708
PING ::1(::1) 56 data bytes
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.038 ms
 --- ::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.038/0.038/0.038/0.000 ms
0.000 probe_libc:inet_pton:(3ff87342060))
__GI___inet_pton (/usr/lib64/libc-2.26.so)
gaih_inet (inlined)
__GI_getaddrinfo (inlined)
main (/usr/bin/ping)
__libc_start_main (/usr/lib64/libc-2.26.so)
_start (/usr/bin/ping)
test child finished with 0
 ---- end ----
probe libc's inet_pton & backtrace it with ping: Ok
[root@s35lp76 perf]#

On Intel the test case runs unchanged and succeeds.

Signed-off-by: Thomas Richter <tmricht@linux.vnet.ibm.com>
Reviewed-by: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Link: http://lkml.kernel.org/r/20180117083831.101001-1-tmricht@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:57:47 -03:00
Sangwon Hong ba7e851642 perf data: Document missing --force option
Add the --force option to the man page.

Signed-off-by: Sangwon Hong <qpakzk@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Taeung Song <treeze.taeung@gmail.com>
Link: http://lkml.kernel.org/r/1517831315-31490-1-git-send-email-qpakzk@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:57:33 -03:00
Andy Shevchenko 6677d26c8b perf tools: Substitute yet another strtoull()
Instead of home grown function let's use what library provides us.

Signed-off-by: Andriy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/20180129130359.1490-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:57:19 -03:00
Kan Liang 8cc42de736 perf top: Check the latency of perf_top__mmap_read()
The latency of perf_top__mmap_read() should be lower than refresh time.
If not, give some hints to reduce the latency.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-18-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:57:06 -03:00
Kan Liang ebebbf0823 perf top: Switch default mode to overwrite mode
perf_top__mmap_read() has a severe performance issue in the Knights
Landing/Mill platform, when monitoring heavy load systems. It costs
several minutes to finish, which is unacceptable.

Currently, 'perf top' uses the non overwrite mode. For non overwrite
mode, it tries to read everything in the ringbuffer and doesn't pause
it. Once there are lots of samples delivered persistently, the
processing time could be very long. Also, the latest samples could be
lost when the ringbuffer is full.

For overwrite mode, it takes a snapshot for the system by pausing the
ringbuffer, which could significantly reduce the processing time.  Also,
the overwrite mode always keep the latest samples.  Considering the real
time requirement for 'perf top', the overwrite mode is more suitable for
it.

Actually, 'perf top' was overwrite mode. It is changed to non overwrite
mode since commit 93fc64f144 ("perf top: Switch to non overwrite
mode"). It's better to change it back to overwrite mode by default.

For the kernel which doesn't support overwrite mode, it will fall back
to non overwrite mode.

There would be some records lost in overwrite mode because of pausing
the ringbuffer. It has little impact for the accuracy of the snapshot
and can be tolerated.

For overwrite mode, unconditionally wait 100 ms before each snapshot. It
also reduces the overhead caused by pausing ringbuffer, especially on
light load system.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-17-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:56:54 -03:00
Kan Liang a1ff5b05e9 perf top: Remove lost events checking
There would be some records lost in overwrite mode because of pausing
the ringbuffer. It has little impact for the accuracy of the snapshot
and could be tolerated by 'perf top'.

Remove the lost events checking.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-16-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:56:43 -03:00
Kan Liang 06cc1a470a perf hists browser: Add parameter to disable lost event warning
For overwrite mode, the ringbuffer will be paused. The event lost is
expected. It needs a way to notify the browser not print the warning.

It will be used later for perf top to disable lost event warning in
overwrite mode. There is no behavior change for now.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-15-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:56:26 -03:00
Kan Liang 204721d7ea perf top: Add overwrite fall back
Switch to non-overwrite mode if kernel doesnot support overwrite
ringbuffer.

It's only effect when overwrite mode is supported.  No change to current
behavior.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-14-git-send-email-kan.liang@intel.com
[ Use perf_missing_features.write_backward instead of the non merged is_write_backward_fail() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:56:14 -03:00
Arnaldo Carvalho de Melo 9a831b3a32 perf evsel: Expose the perf_missing_features struct
As tools may need to adjust to missing features, as 'perf top' will, in
the next csets, to cope with a missing 'write_backward' feature.

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-jelngl9q1ooaizvkcput9tic@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:54:53 -03:00
Kan Liang 63878a53ce perf top: Check per-event overwrite term
Per-event overwrite term is not forbidden in 'perf top', which can bring
problems. Because 'perf top' only support non-overwrite mode now.

Add new rules and check regarding to overwrite term for 'perf top'.
- All events either have same per-event term or don't have per-event
  mode setting. Otherwise, it will error out.
- Per-event overwrite term should be consistent as opts->overwrite.
  If not, updating the opts->overwrite according to per-event term.

Make it possible to support either non-overwrite or overwrite mode.
The overwrite mode is forbidden now, which will be removed when the
overwrite mode is supported later.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-12-git-send-email-kan.liang@intel.com
[ Renamed perf_top_overwrite_check to perf_top__overwrite_check, to follow existing convention ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:54:42 -03:00
Kan Liang 3effc2f165 perf mmap: Discard legacy interface for mmap read
Discards perf_mmap__read_backward() and perf_mmap__read_catchup(). No
tools use them.

There are tools still use perf_mmap__read_forward(). Keep it, but add
comments to point to the new interface for future use.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-11-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:54:17 -03:00
Kan Liang 600a7cfe88 perf test: Update mmap read functions for backward-ring-buffer test
Use the new perf_mmap__read_* interfaces for overwrite ringbuffer test.

Commiter notes:

Testing:

  [root@seventh ~]# perf test -v backward
  48: Read backward ring buffer                             :
  --- start ---
  test child forked, pid 8309
  Using CPUID GenuineIntel-6-9E
  mmap size 1052672B
  mmap size 8192B
  Finished reading overwrite ring buffer: rewind
  test child finished with 0
  ---- end ----
  Read backward ring buffer: Ok
  [root@seventh ~]#

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-10-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:54:08 -03:00
Kan Liang 7bb4597295 perf mmap: Introduce perf_mmap__read_event()
Except for 'perf record', the other perf tools read events one by one
from the ring buffer using perf_mmap__read_forward(). But it only
supports non-overwrite mode.

Introduce perf_mmap__read_event() to support both non-overwrite and
overwrite mode.

Usage:
perf_mmap__read_init()
while(event = perf_mmap__read_event()) {
        //process the event
        perf_mmap__consume()
}
perf_mmap__read_done()

It cannot use perf_mmap__read_backward(). Because it always reads the
stale buffer which is already processed. Furthermore, the forward and
backward concepts have been removed. The perf_mmap__read_backward() will
be replaced and discarded later.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-9-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:53:40 -03:00
Kan Liang ee023de05f perf mmap: Introduce perf_mmap__read_done()
The direction of overwrite mode is backward. The last perf_mmap__read()
will set tail to map->prev. Need to correct the map->prev to head which
is the end of next read.

It will be used later.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-8-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:53:15 -03:00
Kan Liang b4b036b4c7 perf mmap: Discard 'prev' in perf_mmap__read()
The 'start' and 'prev' variables are duplicates in perf_mmap__read().

Use 'map->prev' to replace 'start' in perf_mmap__read_*().

Suggested-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-7-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:53:06 -03:00
Kan Liang 189f2cc91f perf mmap: Add new return value logic for perf_mmap__read_init()
Improve the readability by using meaningful enum (-EAGAIN, -EINVAL and
0) to replace the three returning states (0, -1 and 1).

Suggested-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Kan Liang <kan.liang@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1516310792-208685-6-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2018-02-15 09:52:49 -03:00