Skip to contentSkip to conversation

irq/urgent for 5.7-rc1

GIT PULL Merged Thomas Gleixner 3 participants 7 messages Apr 5, 2020

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

Linus,

please pull the latest irq/urgent fixes from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-2020-04-05

up to: a67cd1fb660d: Merge tag 'irqchip-fixes-5.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/core

Two reverts addressing regressions of the Xilinx interrupt controller driver which affected the PPC users.

Thanks,

tglx

------------------>
Marc Zyngier (2):
Revert "irqchip/xilinx: Do not call irq_set_default_host()" Revert "irqchip/xilinx: Enable generic irq multi handler"

 arch/microblaze/Kconfig           |  2 --
 arch/microblaze/include/asm/irq.h |  3 +++
 arch/microblaze/kernel/irq.c      | 21 ++++++++++++++++++++-
 drivers/irqchip/irq-xilinx-intc.c | 35 +++++++++++++++--------------------
 4 files changed, 38 insertions(+), 23 deletions(-)
arch/microblaze/Kconfig +0 -2
index 242f58ec086b..6a331bd57ea8 100644
@@ -47,8 +47,6 @@ config MICROBLAZE
 	select CPU_NO_EFFICIENT_FFS
 	select MMU_GATHER_NO_RANGE if MMU
 	select SPARSE_IRQ
-	select GENERIC_IRQ_MULTI_HANDLER
-	select HANDLE_DOMAIN_IRQ
 
 # Endianness selection
 choice
arch/microblaze/include/asm/irq.h +3 -0
index 5166f0893e2b..eac2fb4b3fb9 100644
@@ -14,4 +14,7 @@
 struct pt_regs;
 extern void do_IRQ(struct pt_regs *regs);
 
+/* should be defined in each interrupt controller driver */
+extern unsigned int xintc_get_irq(void);
+
 #endif /* _ASM_MICROBLAZE_IRQ_H */
arch/microblaze/kernel/irq.c +20 -1
index 0b37dde60a1e..903dad822fad 100644
@@ -20,10 +20,29 @@
 #include <linux/irqchip.h>
 #include <linux/of_irq.h>
 
+static u32 concurrent_irq;
+
 void __irq_entry do_IRQ(struct pt_regs *regs)
 {
+	unsigned int irq;
+	struct pt_regs *old_regs = set_irq_regs(regs);
 	trace_hardirqs_off();
-	handle_arch_irq(regs);
+
+	irq_enter();
+	irq = xintc_get_irq();
+next_irq:
+	BUG_ON(!irq);
+	generic_handle_irq(irq);
+
+	irq = xintc_get_irq();
+	if (irq != -1U) {
+		pr_debug("next irq: %d\n", irq);
+		++concurrent_irq;
+		goto next_irq;
+	}
+
+	irq_exit();
+	set_irq_regs(old_regs);
 	trace_hardirqs_on();
 }
 
drivers/irqchip/irq-xilinx-intc.c +15 -20
index 7f811fe5bf69..1d3d273309bd 100644
@@ -124,6 +124,20 @@ static unsigned int xintc_get_irq_local(struct xintc_irq_chip *irqc)
 	return irq;
 }
 
+unsigned int xintc_get_irq(void)
+{
+	unsigned int irq = -1;
+	u32 hwirq;
+
+	hwirq = xintc_read(primary_intc, IVR);
+	if (hwirq != -1U)
+		irq = irq_find_mapping(primary_intc->root_domain, hwirq);
+
+	pr_debug("irq-xilinx: hwirq=%d, irq=%d\n", hwirq, irq);
+
+	return irq;
+}
+
 static int xintc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
 {
 	struct xintc_irq_chip *irqc = d->host_data;
@@ -163,25 +177,6 @@ static void xil_intc_irq_handler(struct irq_desc *desc)
 	chained_irq_exit(chip, desc);
 }
 
-static void xil_intc_handle_irq(struct pt_regs *regs)
-{
-	u32 hwirq;
-	struct xintc_irq_chip *irqc = primary_intc;
-
-	do {
-		hwirq = xintc_read(irqc, IVR);
-		if (likely(hwirq != -1U)) {
-			int ret;
-
-			ret = handle_domain_irq(irqc->root_domain, hwirq, regs);
-			WARN_ONCE(ret, "Unhandled HWIRQ %d\n", hwirq);
-			continue;
-		}
-
-		break;
-	} while (1);
-}
-
 static int __init xilinx_intc_of_init(struct device_node *intc,
 					     struct device_node *parent)
 {
@@ -250,7 +245,7 @@ static int __init xilinx_intc_of_init(struct device_node *intc,
 		}
 	} else {
 		primary_intc = irqc;
-		set_handle_irq(xil_intc_handle_irq);
+		irq_set_default_host(primary_intc->root_domain);
 	}
 
 	return 0;
#1 lore raw

[GIT pull] timers/urgent for 5.7-rc1

Linus,

please pull the latest timers/urgent branch from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2020-04-05

up to: 760a53768610: clocksource/drivers/timer-vf-pit: Add missing parenthesis

Two timer subsystem fixes:

- Prevent a use after free in the new lockdep state tracking for hrtimers

- Add missing parenthesis in the VF pit timer driver

Thanks,

tglx

------------------>
Sebastian Andrzej Siewior (1):
hrtimer: Don't dereference the hrtimer pointer after the callback

afzal mohammed (1):
clocksource/drivers/timer-vf-pit: Add missing parenthesis

 drivers/clocksource/timer-vf-pit.c |  2 +-
 include/linux/irqflags.h           | 27 ++++++++++++++++-----------
 kernel/time/hrtimer.c              |  5 +++--
 3 files changed, 20 insertions(+), 14 deletions(-)
drivers/clocksource/timer-vf-pit.c +1 -1
index 7ad4a8b008c2..1a86a4e7e344 100644
@@ -129,7 +129,7 @@ static int __init pit_clockevent_init(unsigned long rate, int irq)
 	__raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG);
 
 	BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL,
-			   "VF pit timer", &clockevent_pit);
+			   "VF pit timer", &clockevent_pit));
 
 	clockevent_pit.cpumask = cpumask_of(0);
 	clockevent_pit.irq = irq;
include/linux/irqflags.h +16 -11
index ceca42de4438..61a9ced3aa50 100644
@@ -58,16 +58,21 @@ do {						\
 } while (0)
 
 # define lockdep_hrtimer_enter(__hrtimer)		\
-	  do {						\
-		  if (!__hrtimer->is_hard)		\
-			current->irq_config = 1;	\
-	  } while (0)
-
-# define lockdep_hrtimer_exit(__hrtimer)		\
-	  do {						\
-		  if (!__hrtimer->is_hard)		\
+({							\
+	bool __expires_hardirq = true;			\
+							\
+	if (!__hrtimer->is_hard) {			\
+		current->irq_config = 1;		\
+		__expires_hardirq = false;		\
+	}						\
+	__expires_hardirq;				\
+})
+
+# define lockdep_hrtimer_exit(__expires_hardirq)	\
+	do {						\
+		if (!__expires_hardirq)			\
 			current->irq_config = 0;	\
-	  } while (0)
+	} while (0)
 
 # define lockdep_posixtimer_enter()				\
 	  do {							\
@@ -102,8 +107,8 @@ do {						\
 # define lockdep_hardirq_exit()		do { } while (0)
 # define lockdep_softirq_enter()	do { } while (0)
 # define lockdep_softirq_exit()		do { } while (0)
-# define lockdep_hrtimer_enter(__hrtimer)		do { } while (0)
-# define lockdep_hrtimer_exit(__hrtimer)		do { } while (0)
+# define lockdep_hrtimer_enter(__hrtimer)	false
+# define lockdep_hrtimer_exit(__context)	do { } while (0)
 # define lockdep_posixtimer_enter()		do { } while (0)
 # define lockdep_posixtimer_exit()		do { } while (0)
 # define lockdep_irq_work_enter(__work)		do { } while (0)
kernel/time/hrtimer.c +3 -2
index d0a5ba37aff4..d89da1c7e005 100644
@@ -1480,6 +1480,7 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
 			  unsigned long flags) __must_hold(&cpu_base->lock)
 {
 	enum hrtimer_restart (*fn)(struct hrtimer *);
+	bool expires_in_hardirq;
 	int restart;
 
 	lockdep_assert_held(&cpu_base->lock);
@@ -1514,11 +1515,11 @@ static void __run_hrtimer(struct hrtimer_cpu_base *cpu_base,
 	 */
 	raw_spin_unlock_irqrestore(&cpu_base->lock, flags);
 	trace_hrtimer_expire_entry(timer, now);
-	lockdep_hrtimer_enter(timer);
+	expires_in_hardirq = lockdep_hrtimer_enter(timer);
 
 	restart = fn(timer);
 
-	lockdep_hrtimer_exit(timer);
+	lockdep_hrtimer_exit(expires_in_hardirq);
 	trace_hrtimer_expire_exit(timer);
 	raw_spin_lock_irq(&cpu_base->lock);
 
merge bot Merged
#2 lore raw

Re: [GIT pull] timers/urgent for 5.7-rc1

The pull request you sent on Sun, 05 Apr 2020 13:41:52 -0000:

The pull request you sent on Sun, 05 Apr 2020 13:41:52 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2020-04-05

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d5ca32738f8fbd3632928929cccb5789d44be390

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#3 lore raw

[GIT pull] perf/urgent for 5.7-rc1

In reply to Thomas Gleixner

Linus,

please pull the latest perf/urgent updates and fixes from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2020-04-05

up to: 7dc41b9b99cd: Merge tag 'perf-urgent-for-mingo-5.7-20200403' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

perf updates all over the place:

core:

- Support for cgroup tracking in samples to allow cgroup based analysis

tools:

- Support for cgroup analysis

- Commandline option and hotkey for perf top to change the sort order

- A set of fixes all over the place

- Various build system related improvements

- Updates of the X86 pmu event JSON data

- Documentation updates

Thanks,

tglx

------------------>
Adrian Hunter (2):
perf test x86: Add CET instructions to the new instructions test perf events parser: Add missing Intel CPU events to parser

Andreas Gerstmayr (2):
perf script report: Fix SEGFAULT when using DWARF mode perf script: Fix invalid read of directory entry after closedir()

Arnaldo Carvalho de Melo (5):
tools headers uapi: Update linux/in.h copy
perf python: Include rwsem.c in the pythong biding
perf build-test: Honour JOBS to override detection of number of cores perf report/top TUI: Fix title line formatting
perf python: Fix clang detection to strip out options passed in $CC

Christophe JAILLET (1):
perf cpumap: Fix snprintf overflow check

Hagen Paul Pfeifer (1):

      perf script: Introduce --deltatime option

He Zhe (1):
perf: Normalize gcc parameter when generating arch errno table

Ian Rogers (3):
perf parse-events: Fix 3 use after frees found with clang ASAN perf parse-events: Add defensive NULL check
perf script: add -S/--symbols documentation

Jin Yao (10):
perf report: Print al_addr when symbol is not found
perf report: Support interactive annotation of code without symbols perf report/top TUI: Support hotkey 'a' for annotation of unresolved addresses perf report: Allow specifying event to be used as sort key in --group output perf report: Support a new key to reload the browser
perf report/top TUI: Support hotkeys to let user select any event for sorting perf stat: Align the output for interval aggregation mode
perf top: Support --group-sort-idx to change the sort order
perf top: Support hotkey to change sort order
perf pmu-events x86: Use CPU_CLK_UNHALTED.THREAD in Kernel_Utilization metric

Jiri Olsa (1):
perf tools: Unify a bit the build directory output

John Garry (7):
perf jevents: Add some test events perf jevents: Support test events folder perf pmu: Refactor pmu_add_cpu_aliases() perf test: Add pmu-events test
perf pmu: Add is_pmu_core()
perf pmu: Make pmu_uncore_alias_match() public perf test: Test pmu-events aliases

Kajol Jain (1):
perf metricgroup: Fix printing event names of metric group with multiple events incase of overlapping events

Kemeng Shi (1):
perf symbols: Fix arm64 gap between kernel start and module end

Leo Yan (1):
perf symbols: Consolidate symbol fixup issue

Namhyung Kim (11):
perf/core: Add PERF_RECORD_CGROUP event
perf/core: Add PERF_SAMPLE_CGROUP feature
tools headers UAPI: Update tools's copy of linux/perf_event.h perf tools: Add file-handle feature test
perf tools: Basic support for CGROUP event
perf cgroup: Maintain cgroup hierarchy
perf report: Add 'cgroup' sort key
perf record: Support synthesizing cgroup events perf record: Add --all-cgroups option
perf top: Add --all-cgroups option
perf script: Add --show-cgroup-events option

Ravi Bangoria (1):
perf dso: Fix dso comparison

Sam Lunt (1):
perf tools: Support Python 3.8+ in Makefile

Stephane Eranian (1):
perf script: Allow --symbol to accept hexadecimal addresses

Tony Jones (1):
perf callchain: Update docs regarding kernel/user space unwinding

Vijay Thakkar (3):
perf vendor events amd: Restrict model detection for zen1 based processors perf vendor events amd: Add Zen2 events
perf vendor events amd: Update Zen1 events to V2

Yu-cheng Yu (1):
x86/insn: Add Control-flow Enforcement (CET) instructions to the opcode map

 include/linux/perf_event.h                         |   1 +
 include/uapi/linux/perf_event.h                    |  16 +-
 init/Kconfig                                       |   3 +-
 kernel/events/core.c                               | 133 ++++++++
 tools/build/Makefile.feature                       |   3 +-
 tools/build/feature/Makefile                       |   6 +-
 tools/build/feature/test-file-handle.c             |  17 +
 tools/include/uapi/linux/perf_event.h              |  16 +-
 tools/lib/perf/include/perf/event.h                |   7 +
 tools/perf/Documentation/perf-config.txt           |  14 +-
 tools/perf/Documentation/perf-record.txt           |  23 +-
 tools/perf/Documentation/perf-report.txt           |   6 +
 tools/perf/Documentation/perf-script.txt           |  14 +
 tools/perf/Documentation/perf-top.txt              |   9 +
 tools/perf/Makefile.config                         |  15 +-
 tools/perf/Makefile.perf                           |  11 +-
 tools/perf/arch/arm64/util/Build                   |   2 +-
 tools/perf/arch/arm64/util/machine.c               |  27 ++
 tools/perf/arch/arm64/util/sym-handling.c          |  19 --
 tools/perf/arch/powerpc/util/Build                 |   1 -
 tools/perf/arch/powerpc/util/sym-handling.c        |  10 -
 tools/perf/builtin-diff.c                          |   1 +
 tools/perf/builtin-record.c                        |  16 +
 tools/perf/builtin-report.c                        |  17 +-
 tools/perf/builtin-script.c                        |  60 +++-
 tools/perf/builtin-top.c                           |  30 +-
 .../{x86/amdfam17h => test/test_cpu}/branch.json   |   0
 .../perf/pmu-events/arch/test/test_cpu/other.json  |  26 ++
 .../perf/pmu-events/arch/test/test_cpu/uncore.json |  21 ++
 .../perf/pmu-events/arch/x86/amdfam17h/cache.json  | 329 ------------------
 .../perf/pmu-events/arch/x86/amdfam17h/other.json  |  65 ----
 tools/perf/pmu-events/arch/x86/amdzen1/branch.json |  23 ++
 tools/perf/pmu-events/arch/x86/amdzen1/cache.json  | 294 ++++++++++++++++
 .../arch/x86/{amdfam17h => amdzen1}/core.json      |  15 +-
 .../x86/{amdfam17h => amdzen1}/floating-point.json |  64 +++-
 .../arch/x86/{amdfam17h => amdzen1}/memory.json    |  82 +++--
 tools/perf/pmu-events/arch/x86/amdzen1/other.json  |  56 +++
 tools/perf/pmu-events/arch/x86/amdzen2/branch.json |  52 +++
 tools/perf/pmu-events/arch/x86/amdzen2/cache.json  | 338 ++++++++++++++++++
 tools/perf/pmu-events/arch/x86/amdzen2/core.json   | 130 +++++++
 .../arch/x86/amdzen2/floating-point.json           | 140 ++++++++
 tools/perf/pmu-events/arch/x86/amdzen2/memory.json | 341 ++++++++++++++++++
 tools/perf/pmu-events/arch/x86/amdzen2/other.json  | 115 +++++++
 .../pmu-events/arch/x86/broadwell/bdw-metrics.json |   2 +-
 .../arch/x86/broadwellde/bdwde-metrics.json        |   2 +-
 .../arch/x86/broadwellx/bdx-metrics.json           |   2 +-
 .../arch/x86/cascadelakex/clx-metrics.json         |   2 +-
 .../pmu-events/arch/x86/haswell/hsw-metrics.json   |   2 +-
 .../pmu-events/arch/x86/haswellx/hsx-metrics.json  |   2 +-
 .../pmu-events/arch/x86/ivybridge/ivb-metrics.json |   2 +-
 .../pmu-events/arch/x86/ivytown/ivt-metrics.json   |   2 +-
 .../pmu-events/arch/x86/jaketown/jkt-metrics.json  |   2 +-
 tools/perf/pmu-events/arch/x86/mapfile.csv         |   3 +-
 .../arch/x86/sandybridge/snb-metrics.json          |   2 +-
 .../pmu-events/arch/x86/skylake/skl-metrics.json   |   2 +-
 .../pmu-events/arch/x86/skylakex/skx-metrics.json  |   2 +-
 tools/perf/pmu-events/jevents.c                    |  30 ++
 tools/perf/tests/Build                             |   1 +
 tools/perf/tests/builtin-test.c                    |   4 +
 tools/perf/tests/make                              |  10 +-
 tools/perf/tests/pmu-events.c                      | 379 +++++++++++++++++++++
 tools/perf/tests/sample-parsing.c                  |   6 +-
 tools/perf/tests/tests.h                           |   1 +
 tools/perf/ui/browsers/hists.c                     | 126 +++++--
 tools/perf/ui/hist.c                               |  93 ++++-
 tools/perf/ui/keysyms.h                            |   1 +
 tools/perf/util/annotate.h                         |   1 +
 tools/perf/util/cgroup.c                           |  80 +++++
 tools/perf/util/cgroup.h                           |  17 +-
 tools/perf/util/cpumap.c                           |  10 +-
 tools/perf/util/dsos.c                             |  22 +-
 tools/perf/util/env.c                              |   2 +
 tools/perf/util/env.h                              |   6 +
 tools/perf/util/event.c                            |  39 ++-
 tools/perf/util/event.h                            |   6 +
 tools/perf/util/evsel.c                            |  18 +-
 tools/perf/util/evsel.h                            |   1 +
 tools/perf/util/hist.c                             |  13 +
 tools/perf/util/hist.h                             |   2 +
 tools/perf/util/machine.c                          |  19 ++
 tools/perf/util/machine.h                          |   3 +
 tools/perf/util/metricgroup.c                      |  49 +--
 tools/perf/util/parse-events.c                     |   6 +-
 tools/perf/util/parse-events.l                     |  12 +-
 tools/perf/util/perf_event_attr_fprintf.c          |   2 +
 tools/perf/util/pmu.c                              |  39 ++-
 tools/perf/util/pmu.h                              |   5 +
 tools/perf/util/python-ext-sources                 |   1 +
 tools/perf/util/record.h                           |   1 +
 .../util/scripting-engines/trace-event-python.c    |   3 +
 tools/perf/util/session.c                          |   4 +
 tools/perf/util/setup.py                           |   2 +-
 tools/perf/util/sort.c                             |  43 ++-
 tools/perf/util/sort.h                             |   2 +
 tools/perf/util/stat-display.c                     |   6 +-
 tools/perf/util/symbol-elf.c                       |  10 +-
 tools/perf/util/symbol_conf.h                      |   1 +
 tools/perf/util/synthetic-events.c                 | 130 +++++++
 tools/perf/util/synthetic-events.h                 |   1 +
 tools/perf/util/tool.h                             |   2 +
 100 files changed, 3182 insertions(+), 622 deletions(-)
 create mode 100644 tools/build/feature/test-file-handle.c
 create mode 100644 tools/perf/arch/arm64/util/machine.c
 delete mode 100644 tools/perf/arch/arm64/util/sym-handling.c
 rename tools/perf/pmu-events/arch/{x86/amdfam17h => test/test_cpu}/branch.json (100%)
 create mode 100644 tools/perf/pmu-events/arch/test/test_cpu/other.json
 create mode 100644 tools/perf/pmu-events/arch/test/test_cpu/uncore.json
 delete mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/cache.json
 delete mode 100644 tools/perf/pmu-events/arch/x86/amdfam17h/other.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen1/branch.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen1/cache.json
 rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/core.json (87%)
 rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/floating-point.json (61%)
 rename tools/perf/pmu-events/arch/x86/{amdfam17h => amdzen1}/memory.json (63%)
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen1/other.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/branch.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/cache.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/core.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/floating-point.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/memory.json
 create mode 100644 tools/perf/pmu-events/arch/x86/amdzen2/other.json
 create mode 100644 tools/perf/tests/pmu-events.c
include/linux/perf_event.h +1 -0
index 8768a39b5258..9c3e7619c929 100644
@@ -1020,6 +1020,7 @@ struct perf_sample_data {
 	u64				stack_user_size;
 
 	u64				phys_addr;
+	u64				cgroup;
 } ____cacheline_aligned;
 
 /* default value for data source */
include/uapi/linux/perf_event.h +14 -2
index 397cfd65b3fe..7b2d6fc9e6ed 100644
@@ -142,8 +142,9 @@ enum perf_event_sample_format {
 	PERF_SAMPLE_REGS_INTR			= 1U << 18,
 	PERF_SAMPLE_PHYS_ADDR			= 1U << 19,
 	PERF_SAMPLE_AUX				= 1U << 20,
+	PERF_SAMPLE_CGROUP			= 1U << 21,
 
-	PERF_SAMPLE_MAX = 1U << 21,		/* non-ABI */
+	PERF_SAMPLE_MAX = 1U << 22,		/* non-ABI */
 
 	__PERF_SAMPLE_CALLCHAIN_EARLY		= 1ULL << 63, /* non-ABI; internal use */
 };
@@ -381,7 +382,8 @@ struct perf_event_attr {
 				ksymbol        :  1, /* include ksymbol events */
 				bpf_event      :  1, /* include bpf events */
 				aux_output     :  1, /* generate AUX records instead of events */
-				__reserved_1   : 32;
+				cgroup         :  1, /* include cgroup events */
+				__reserved_1   : 31;
 
 	union {
 		__u32		wakeup_events;	  /* wakeup every n events */
@@ -1012,6 +1014,16 @@ enum perf_event_type {
 	 */
 	PERF_RECORD_BPF_EVENT			= 18,
 
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u64				id;
+	 *	char				path[];
+	 *	struct sample_id		sample_id;
+	 * };
+	 */
+	PERF_RECORD_CGROUP			= 19,
+
 	PERF_RECORD_MAX,			/* non-ABI */
 };
 
init/Kconfig +2 -1
index 697d109387ed..93e1fafa88ce 100644
@@ -1030,7 +1030,8 @@ config CGROUP_PERF
 	help
 	  This option extends the perf per-cpu mode to restrict monitoring
 	  to threads which belong to the cgroup specified and run on the
-	  designated cpu.
+	  designated cpu.  Or this can be used to have cgroup ID in samples
+	  so that it can monitor performance events among cgroups.
 
 	  Say N if unsure.
 
kernel/events/core.c +133 -0

193 lines not on this page · raw message

tools/build/Makefile.feature +2 -1
index 574c2e0b9d20..3e0c019ef297 100644
@@ -72,7 +72,8 @@ FEATURE_TESTS_BASIC :=                  \
         setns				\
         libaio				\
         libzstd				\
-        disassembler-four-args
+        disassembler-four-args		\
+        file-handle
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
tools/build/feature/Makefile +5 -1
index 7ac0d8088565..621f528f7822 100644
@@ -67,7 +67,8 @@ FILES=                                          \
          test-llvm.bin				\
          test-llvm-version.bin			\
          test-libaio.bin			\
-         test-libzstd.bin
+         test-libzstd.bin			\
+         test-file-handle.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -321,6 +322,9 @@ $(OUTPUT)test-libaio.bin:
 $(OUTPUT)test-libzstd.bin:
 	$(BUILD) -lzstd
 
+$(OUTPUT)test-file-handle.bin:
+	$(BUILD)
+
 ###############################
 
 clean:
tools/build/feature/test-file-handle.c new file +17 -0
new file mode 100644
index 000000000000..4d3b03b27a0b
@@ -0,0 +1,17 @@
+#define _GNU_SOURCE
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <inttypes.h>
+
+int main(void)
+{
+	struct {
+		struct file_handle fh;
+		uint64_t cgroup_id;
+	} handle;
+	int mount_id;
+
+	name_to_handle_at(AT_FDCWD, "/", &handle.fh, &mount_id, 0);
+	return 0;
+}
tools/include/uapi/linux/perf_event.h +14 -2
index 397cfd65b3fe..7b2d6fc9e6ed 100644
@@ -142,8 +142,9 @@ enum perf_event_sample_format {
 	PERF_SAMPLE_REGS_INTR			= 1U << 18,
 	PERF_SAMPLE_PHYS_ADDR			= 1U << 19,
 	PERF_SAMPLE_AUX				= 1U << 20,
+	PERF_SAMPLE_CGROUP			= 1U << 21,
 
-	PERF_SAMPLE_MAX = 1U << 21,		/* non-ABI */
+	PERF_SAMPLE_MAX = 1U << 22,		/* non-ABI */
 
 	__PERF_SAMPLE_CALLCHAIN_EARLY		= 1ULL << 63, /* non-ABI; internal use */
 };
@@ -381,7 +382,8 @@ struct perf_event_attr {
 				ksymbol        :  1, /* include ksymbol events */
 				bpf_event      :  1, /* include bpf events */
 				aux_output     :  1, /* generate AUX records instead of events */
-				__reserved_1   : 32;
+				cgroup         :  1, /* include cgroup events */
+				__reserved_1   : 31;
 
 	union {
 		__u32		wakeup_events;	  /* wakeup every n events */
@@ -1012,6 +1014,16 @@ enum perf_event_type {
 	 */
 	PERF_RECORD_BPF_EVENT			= 18,
 
+	/*
+	 * struct {
+	 *	struct perf_event_header	header;
+	 *	u64				id;
+	 *	char				path[];
+	 *	struct sample_id		sample_id;
+	 * };
+	 */
+	PERF_RECORD_CGROUP			= 19,
+
 	PERF_RECORD_MAX,			/* non-ABI */
 };
 
tools/lib/perf/include/perf/event.h +7 -0
index 18106899cb4e..69b44d2cc0f5 100644
@@ -105,6 +105,12 @@ struct perf_record_bpf_event {
 	__u8			 tag[BPF_TAG_SIZE];  // prog tag
 };
 
+struct perf_record_cgroup {
+	struct perf_event_header header;
+	__u64			 id;
+	char			 path[PATH_MAX];
+};
+
 struct perf_record_sample {
 	struct perf_event_header header;
 	__u64			 array[];
@@ -352,6 +358,7 @@ union perf_event {
 	struct perf_record_mmap2		mmap2;
 	struct perf_record_comm			comm;
 	struct perf_record_namespaces		namespaces;
+	struct perf_record_cgroup		cgroup;
 	struct perf_record_fork			fork;
 	struct perf_record_lost			lost;
 	struct perf_record_lost_samples		lost_samples;
tools/perf/Documentation/perf-config.txt +8 -6
index 8ead55593984..f16d8a71d3f5 100644
@@ -405,14 +405,16 @@ ui.*::
 		This option is only applied to TUI.
 
 call-graph.*::
-	When sub-commands 'top' and 'report' work with -g/—-children
-	there're options in control of call-graph.
+	The following controls the handling of call-graphs (obtained via the
+	-g/--call-graph options).
 
 	call-graph.record-mode::
-		The record-mode can be 'fp' (frame pointer), 'dwarf' and 'lbr'.
-		The value of 'dwarf' is effective only if perf detect needed library
-		(libunwind or a recent version of libdw).
-		'lbr' only work for cpus that support it.
+		The mode for user space can be 'fp' (frame pointer), 'dwarf'
+		and 'lbr'.  The value 'dwarf' is effective only if libunwind
+		(or a recent version of libdw) is present on the system;
+		the value 'lbr' only works for certain cpus. The method for
+		kernel space is controlled not by this option but by the
+		kernel config (CONFIG_UNWINDER_*).
 
 	call-graph.dump-size::
 		The size of stack to dump in order to do post-unwinding. Default is 8192 (byte).
tools/perf/Documentation/perf-record.txt +16 -7
index 7f4db7592467..b3f3b3f1c161 100644
@@ -237,16 +237,22 @@ OPTIONS
 	option and remains only for backward compatibility.  See --event.
 
 -g::
-	Enables call-graph (stack chain/backtrace) recording.
+	Enables call-graph (stack chain/backtrace) recording for both
+	kernel space and user space.
 
 --call-graph::
 	Setup and enable call-graph (stack chain/backtrace) recording,
-	implies -g.  Default is "fp".
+	implies -g.  Default is "fp" (for user space).
 
-	Allows specifying "fp" (frame pointer) or "dwarf"
-	(DWARF's CFI - Call Frame Information) or "lbr"
-	(Hardware Last Branch Record facility) as the method to collect
-	the information used to show the call graphs.
+	The unwinding method used for kernel space is dependent on the
+	unwinder used by the active kernel configuration, i.e
+	CONFIG_UNWINDER_FRAME_POINTER (fp) or CONFIG_UNWINDER_ORC (orc)
+
+	Any option specified here controls the method used for user space.
+
+	Valid options are "fp" (frame pointer), "dwarf" (DWARF's CFI -
+	Call Frame Information) or "lbr" (Hardware Last Branch Record
+	facility).
 
 	In some systems, where binaries are build with gcc
 	--fomit-frame-pointer, using the "fp" method will produce bogus
@@ -385,7 +391,10 @@ displayed with the weight and local_weight sort keys.  This currently works for
 abort events and some memory events in precise mode on modern Intel CPUs.
 
 --namespaces::
-Record events of type PERF_RECORD_NAMESPACES.
+Record events of type PERF_RECORD_NAMESPACES.  This enables 'cgroup_id' sort key.
+
+--all-cgroups::
+Record events of type PERF_RECORD_CGROUP.  This enables 'cgroup' sort key.
 
 --transaction::
 Record transaction flags for transaction related events.
tools/perf/Documentation/perf-report.txt +6 -0
index bd0a029d4c08..f569b9ea4002 100644
@@ -95,6 +95,7 @@ OPTIONS
 	abort cost. This is the global weight.
 	- local_weight: Local weight version of the weight above.
 	- cgroup_id: ID derived from cgroup namespace device and inode numbers.
+	- cgroup: cgroup pathname in the cgroupfs.
 	- transaction: Transaction abort flags.
 	- overhead: Overhead percentage of sample
 	- overhead_sys: Overhead percentage of sample running in system mode
@@ -377,6 +378,11 @@ OPTIONS
 	Show event group information together. It forces group output also
 	if there are no groups defined in data file.
 
+--group-sort-idx::
+	Sort the output by the event at the index n in group. If n is invalid,
+	sort by the first event. It can support multiple groups with different
+	amount of events. WARNING: This should be used on grouped events.
+
 --demangle::
 	Demangle symbol names to human readable form. It's enabled by default,
 	disable with --no-demangle.
tools/perf/Documentation/perf-script.txt +14 -0
index db6a36aac47e..963487e82edc 100644
@@ -319,6 +319,9 @@ OPTIONS
 --show-bpf-events
 	Display bpf events i.e. events of type PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT.
 
+--show-cgroup-events
+	Display cgroup events i.e. events of type PERF_RECORD_CGROUP.
+
 --demangle::
 	Demangle symbol names to human readable form. It's enabled by default,
 	disable with --no-demangle.
@@ -390,6 +393,9 @@ include::itrace.txt[]
 --reltime::
 	Print time stamps relative to trace start.
 
+--deltatime::
+	Print time stamps relative to previous event.
+
 --per-event-dump::
 	Create per event files with a "perf.data.EVENT.dump" name instead of
         printing to stdout, useful, for instance, for generating flamegraphs.
@@ -406,6 +412,14 @@ include::itrace.txt[]
 --xed::
 	Run xed disassembler on output. Requires installing the xed disassembler.
 
+-S::
+--symbols=symbol[,symbol...]::
+	Only consider the listed symbols. Symbols are typically a name
+	but they may also be hexadecimal address.
+
+	For example, to select the symbol noploop or the address 0x4007a0:
+	perf script --symbols=noploop,0x4007a0
+
 --call-trace::
 	Show call stream for intel_pt traces. The CPUs are interleaved, but
 	can be filtered with -C.
tools/perf/Documentation/perf-top.txt +9 -0
index 324b6b53c86b..487737a725e9 100644
@@ -53,6 +53,11 @@ Default is to monitor all CPUS.
 --group::
         Put the counters into a counter group.
 
+--group-sort-idx::
+	Sort the output by the event at the index n in group. If n is invalid,
+	sort by the first event. It can support multiple groups with different
+	amount of events. WARNING: This should be used on grouped events.
+
 -F <freq>::
 --freq=<freq>::
 	Profile at this frequency. Use 'max' to use the currently maximum
@@ -272,6 +277,10 @@ Default is to monitor all CPUS.
 	Record events of type PERF_RECORD_NAMESPACES and display it with the
 	'cgroup_id' sort key.
 
+--all-cgroups::
+	Record events of type PERF_RECORD_CGROUP and display it with the
+	'cgroup' sort key.
+
 --switch-on EVENT_NAME::
 	Only consider events after this event is found.
 
tools/perf/Makefile.config +14 -1
index 80e55e796be9..12a8204d63c6 100644
@@ -228,8 +228,17 @@ strip-libs  = $(filter-out -l%,$(1))
 
 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
 
+# Python 3.8 changed the output of `python-config --ldflags` to not include the
+# '-lpythonX.Y' flag unless '--embed' is also passed. The feature check for
+# libpython fails if that flag is not included in LDFLAGS
+ifeq ($(shell $(PYTHON_CONFIG_SQ) --ldflags --embed 2>&1 1>/dev/null; echo $$?), 0)
+  PYTHON_CONFIG_LDFLAGS := --ldflags --embed
+else
+  PYTHON_CONFIG_LDFLAGS := --ldflags
+endif
+
 ifdef PYTHON_CONFIG
-  PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+  PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) $(PYTHON_CONFIG_LDFLAGS) 2>/dev/null)
   PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
   PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
   PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --includes 2>/dev/null)
@@ -348,6 +357,10 @@ ifeq ($(feature-gettid), 1)
   CFLAGS += -DHAVE_GETTID
 endif
 
+ifeq ($(feature-file-handle), 1)
+  CFLAGS += -DHAVE_FILE_HANDLE
+endif
+
 ifdef NO_LIBELF
   NO_DWARF := 1
   NO_DEMANGLE := 1
tools/perf/Makefile.perf +6 -5
index 3eda9d4b88e7..d15a311408f1 100644
@@ -231,6 +231,7 @@ TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
 BPF_DIR         = $(srctree)/tools/lib/bpf/
 SUBCMD_DIR      = $(srctree)/tools/lib/subcmd/
 LIBPERF_DIR     = $(srctree)/tools/lib/perf/
+DOC_DIR         = $(srctree)/tools/perf/Documentation/
 
 # Set FEATURE_TESTS to 'all' so all possible feature checkers are executed.
 # Without this setting the output feature dump file misses some features, for
@@ -573,7 +574,7 @@ arch_errno_hdr_dir := $(srctree)/tools
 arch_errno_tbl := $(srctree)/tools/perf/trace/beauty/arch_errno_names.sh
 
 $(arch_errno_name_array): $(arch_errno_tbl)
-	$(Q)$(SHELL) '$(arch_errno_tbl)' $(CC) $(arch_errno_hdr_dir) > $@
+	$(Q)$(SHELL) '$(arch_errno_tbl)' $(firstword $(CC)) $(arch_errno_hdr_dir) > $@
 
 sync_file_range_arrays := $(beauty_outdir)/sync_file_range_arrays.c
 sync_file_range_tbls := $(srctree)/tools/perf/trace/beauty/sync_file_range.sh
@@ -792,7 +793,6 @@ $(LIBSUBCMD): FORCE
 	$(Q)$(MAKE) -C $(SUBCMD_DIR) O=$(OUTPUT) $(OUTPUT)libsubcmd.a
 
 $(LIBSUBCMD)-clean:
-	$(call QUIET_CLEAN, libsubcmd)
 	$(Q)$(MAKE) -C $(SUBCMD_DIR) O=$(OUTPUT) clean
 
 help:
@@ -832,7 +832,7 @@ INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
 
 # 'make doc' should call 'make -C Documentation all'
 $(DOC_TARGETS):
-	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
+	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:doc=all)
 
 TAG_FOLDERS= . ../lib ../include
 TAG_FILES= ../../include/uapi/linux/perf_event.h
@@ -959,7 +959,7 @@ install-python_ext:
 
 # 'make install-doc' should call 'make -C Documentation install'
 $(INSTALL_DOC_TARGETS):
-	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
+	$(Q)$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) $(@:-doc=)
 
 ### Cleaning rules
 
@@ -1008,7 +1008,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea
 		$(OUTPUT)$(rename_flags_array) \
 		$(OUTPUT)$(arch_errno_name_array) \
 		$(OUTPUT)$(sync_file_range_arrays)
-	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
+	$(call QUIET_CLEAN, Documentation) \
+	$(MAKE) -C $(DOC_DIR) O=$(OUTPUT) clean >/dev/null
 
 #
 # To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
tools/perf/arch/arm64/util/Build +1 -1
index 0a7782c61209..5c13438c7bd4 100644
@@ -1,6 +1,6 @@
 perf-y += header.o
+perf-y += machine.o
 perf-y += perf_regs.o
-perf-y += sym-handling.o
 perf-$(CONFIG_DWARF)     += dwarf-regs.o
 perf-$(CONFIG_LOCAL_LIBUNWIND) += unwind-libunwind.o
 perf-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
tools/perf/arch/arm64/util/machine.c new file +27 -0
new file mode 100644
index 000000000000..d41b27e781d3
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <stdio.h>
+#include <string.h>
+#include "debug.h"
+#include "symbol.h"
+
+/* On arm64, kernel text segment start at high memory address,
+ * for example 0xffff 0000 8xxx xxxx. Modules start at a low memory
+ * address, like 0xffff 0000 00ax xxxx. When only samll amount of
+ * memory is used by modules, gap between end of module's text segment
+ * and start of kernel text segment may be reach 2G.
+ * Therefore do not fill this gap and do not assign it to the kernel dso map.
+ */
+
+#define SYMBOL_LIMIT (1 << 12) /* 4K */
+
+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)
+{
+	if ((strchr(p->name, '[') && strchr(c->name, '[') == NULL) ||
+			(strchr(p->name, '[') == NULL && strchr(c->name, '[')))
+		/* Limit range of last symbol in module and kernel */
+		p->end += SYMBOL_LIMIT;
+	else
+		p->end = c->start;
+	pr_debug4("%s sym:%s end:%#lx\n", __func__, p->name, p->end);
+}
tools/perf/arch/arm64/util/sym-handling.c deleted +0 -19
deleted file mode 100644
index 8dfa3e5229f1..000000000000
@@ -1,19 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- *
- * Copyright (C) 2015 Naveen N. Rao, IBM Corporation
- */
-
-#include "symbol.h" // for the elf__needs_adjust_symbols() prototype
-#include <stdbool.h>
-
-#ifdef HAVE_LIBELF_SUPPORT
-#include <gelf.h>
-
-bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
-{
-	return ehdr.e_type == ET_EXEC ||
-	       ehdr.e_type == ET_REL ||
-	       ehdr.e_type == ET_DYN;
-}
-#endif
tools/perf/arch/powerpc/util/Build +0 -1
index 7cf0b8803097..e5c9504f8586 100644
@@ -1,5 +1,4 @@
 perf-y += header.o
-perf-y += sym-handling.o
 perf-y += kvm-stat.o
 perf-y += perf_regs.o
 perf-y += mem-events.o
tools/perf/arch/powerpc/util/sym-handling.c +0 -10
index abb7a12d8f93..0856b32f9e08 100644
@@ -10,16 +10,6 @@
 #include "probe-event.h"
 #include "probe-file.h"
 
-#ifdef HAVE_LIBELF_SUPPORT
-bool elf__needs_adjust_symbols(GElf_Ehdr ehdr)
-{
-	return ehdr.e_type == ET_EXEC ||
-	       ehdr.e_type == ET_REL ||
-	       ehdr.e_type == ET_DYN;
-}
-
-#endif
-
 int arch__choose_best_symbol(struct symbol *syma,
 			     struct symbol *symb __maybe_unused)
 {
tools/perf/builtin-diff.c +1 -0
index 5e697cd2224a..c94a002f295e 100644
@@ -455,6 +455,7 @@ static struct perf_diff pdiff = {
 		.fork	= perf_event__process_fork,
 		.lost	= perf_event__process_lost,
 		.namespaces = perf_event__process_namespaces,
+		.cgroup = perf_event__process_cgroup,
 		.ordered_events = true,
 		.ordering_requires_timestamps = true,
 	},
tools/perf/builtin-record.c +16 -0
index 4c301466101b..1ab349abe904 100644
@@ -1397,6 +1397,11 @@ static int record__synthesize(struct record *rec, bool tail)
 	if (err < 0)
 		pr_warning("Couldn't synthesize bpf events.\n");
 
+	err = perf_event__synthesize_cgroups(tool, process_synthesized_event,
+					     machine);
+	if (err < 0)
+		pr_warning("Couldn't synthesize cgroup events.\n");
+
 	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->core.threads,
 					    process_synthesized_event, opts->sample_address,
 					    1);
@@ -1428,6 +1433,15 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	if (rec->opts.record_namespaces)
 		tool->namespace_events = true;
 
+	if (rec->opts.record_cgroup) {
+#ifdef HAVE_FILE_HANDLE
+		tool->cgroup_events = true;
+#else
+		pr_err("cgroup tracking is not supported\n");
+		return -1;
+#endif
+	}
+
 	if (rec->opts.auxtrace_snapshot_mode || rec->switch_output.enabled) {
 		signal(SIGUSR2, snapshot_sig_handler);
 		if (rec->opts.auxtrace_snapshot_mode)
@@ -2358,6 +2372,8 @@ static struct option __record_options[] = {
 			"per thread proc mmap processing timeout in ms"),
 	OPT_BOOLEAN(0, "namespaces", &record.opts.record_namespaces,
 		    "Record namespaces events"),
+	OPT_BOOLEAN(0, "all-cgroups", &record.opts.record_cgroup,
+		    "Record cgroup events"),
 	OPT_BOOLEAN(0, "switch-events", &record.opts.record_switch_events,
 		    "Record context switch events"),
 	OPT_BOOLEAN_FLAG(0, "all-kernel", &record.opts.all_kernel,
tools/perf/builtin-report.c +14 -3
index 5f4045df76f4..26d8fc27e427 100644
@@ -635,7 +635,7 @@ static int report__browse_hists(struct report *rep)
 		 * Usually "ret" is the last pressed key, and we only
 		 * care if the key notifies us to switch data file.
 		 */
-		if (ret != K_SWITCH_INPUT_DATA)
+		if (ret != K_SWITCH_INPUT_DATA && ret != K_RELOAD)
 			ret = 0;
 		break;
 	case 2:
@@ -1105,6 +1105,7 @@ int cmd_report(int argc, const char **argv)
 			.mmap2		 = perf_event__process_mmap2,
 			.comm		 = perf_event__process_comm,
 			.namespaces	 = perf_event__process_namespaces,
+			.cgroup		 = perf_event__process_cgroup,
 			.exit		 = perf_event__process_exit,
 			.fork		 = perf_event__process_fork,
 			.lost		 = perf_event__process_lost,
@@ -1227,6 +1228,10 @@ int cmd_report(int argc, const char **argv)
 		    "Show a column with the sum of periods"),
 	OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group, &report.group_set,
 		    "Show event group information together"),
+	OPT_INTEGER(0, "group-sort-idx", &symbol_conf.group_sort_idx,
+		    "Sort the output by the event at the index n in group. "
+		    "If n is invalid, sort by the first event. "
+		    "WARNING: should be used on grouped events."),
 	OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "",
 		    "use branch records for per branch histogram filling",
 		    parse_branch_mode),
@@ -1369,6 +1374,12 @@ int cmd_report(int argc, const char **argv)
 
 	setup_forced_leader(&report, session->evlist);
 
+	if (symbol_conf.group_sort_idx && !session->evlist->nr_groups) {
+		parse_options_usage(NULL, options, "group-sort-idx", 0);
+		ret = -EINVAL;
+		goto error;
+	}
+
 	if (itrace_synth_opts.last_branch)
 		has_br_stack = true;
 
@@ -1470,7 +1481,7 @@ int cmd_report(int argc, const char **argv)
 		sort_order = sort_tmp;
 	}
 
-	if ((last_key != K_SWITCH_INPUT_DATA) &&
+	if ((last_key != K_SWITCH_INPUT_DATA && last_key != K_RELOAD) &&
 	    (setup_sorting(session->evlist) < 0)) {
 		if (sort_order)
 			parse_options_usage(report_usage, options, "s", 1);
@@ -1549,7 +1560,7 @@ int cmd_report(int argc, const char **argv)
 	sort__setup_elide(stdout);
 
 	ret = __cmd_report(&report);
-	if (ret == K_SWITCH_INPUT_DATA) {
+	if (ret == K_SWITCH_INPUT_DATA || ret == K_RELOAD) {
 		perf_session__delete(session);
 		last_key = K_SWITCH_INPUT_DATA;
 		goto repeat;
tools/perf/builtin-script.c +59 -1

124 lines not on this page · raw message

tools/perf/builtin-top.c +28 -2
index d2539b793f9d..289cf83e658a 100644
@@ -616,6 +616,7 @@ static void *display_thread_tui(void *arg)
 		.arg		= top,
 		.refresh	= top->delay_secs,
 	};
+	int ret;
 
 	/* In order to read symbols from other namespaces perf to  needs to call
 	 * setns(2).  This isn't permitted if the struct_fs has multiple users.
@@ -626,6 +627,7 @@ static void *display_thread_tui(void *arg)
 
 	prctl(PR_SET_NAME, "perf-top-UI", 0, 0, 0);
 
+repeat:
 	perf_top__sort_new_samples(top);
 
 	/*
@@ -638,13 +640,18 @@ static void *display_thread_tui(void *arg)
 		hists->uid_filter_str = top->record_opts.target.uid_str;
 	}
 
-	perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
+	ret = perf_evlist__tui_browse_hists(top->evlist, help, &hbt,
 				      top->min_percent,
 				      &top->session->header.env,
 				      !top->record_opts.overwrite,
 				      &top->annotation_opts);
 
-	stop_top();
+	if (ret == K_RELOAD) {
+		top->zero = true;
+		goto repeat;
+	} else
+		stop_top();
+
 	return NULL;
 }
 
@@ -1246,6 +1253,14 @@ static int __cmd_top(struct perf_top *top)
 
 	if (opts->record_namespaces)
 		top->tool.namespace_events = true;
+	if (opts->record_cgroup) {
+#ifdef HAVE_FILE_HANDLE
+		top->tool.cgroup_events = true;
+#else
+		pr_err("cgroup tracking is not supported.\n");
+		return -1;
+#endif
+	}
 
 	ret = perf_event__synthesize_bpf_events(top->session, perf_event__process,
 						&top->session->machines.host,
@@ -1253,6 +1268,11 @@ static int __cmd_top(struct perf_top *top)
 	if (ret < 0)
 		pr_debug("Couldn't synthesize BPF events: Pre-existing BPF programs won't have symbols resolved.\n");
 
+	ret = perf_event__synthesize_cgroups(&top->tool, perf_event__process,
+					     &top->session->machines.host);
+	if (ret < 0)
+		pr_debug("Couldn't synthesize cgroup events.\n");
+
 	machine__synthesize_threads(&top->session->machines.host, &opts->target,
 				    top->evlist->core.threads, false,
 				    top->nr_threads_synthesize);
@@ -1545,6 +1565,12 @@ int cmd_top(int argc, const char **argv)
 			"number of thread to run event synthesize"),
 	OPT_BOOLEAN(0, "namespaces", &opts->record_namespaces,
 		    "Record namespaces events"),
+	OPT_BOOLEAN(0, "all-cgroups", &opts->record_cgroup,
+		    "Record cgroup events"),
+	OPT_INTEGER(0, "group-sort-idx", &symbol_conf.group_sort_idx,
+		    "Sort the output by the event at the index n in group. "
+		    "If n is invalid, sort by the first event. "
+		    "WARNING: should be used on grouped events."),
 	OPTS_EVSWITCH(&top.evswitch),
 	OPT_END()
 	};
tools/perf/pmu-events/arch/test/test_cpu/branch.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/branch.json +0 -0
similarity index 100%
rename from tools/perf/pmu-events/arch/x86/amdfam17h/branch.json
rename to tools/perf/pmu-events/arch/test/test_cpu/branch.json
tools/perf/pmu-events/arch/test/test_cpu/other.json new file +26 -0
new file mode 100644
index 000000000000..7d53d7ecd723
@@ -0,0 +1,26 @@
+[
+    {
+        "EventCode": "0x6",
+        "Counter": "0,1",
+        "UMask": "0x80",
+        "EventName": "SEGMENT_REG_LOADS.ANY",
+        "SampleAfterValue": "200000",
+        "BriefDescription": "Number of segment register loads."
+    },
+    {
+        "EventCode": "0x9",
+        "Counter": "0,1",
+        "UMask": "0x20",
+        "EventName": "DISPATCH_BLOCKED.ANY",
+        "SampleAfterValue": "200000",
+        "BriefDescription": "Memory cluster signals to block micro-op dispatch for any reason"
+    },
+    {
+        "EventCode": "0x3A",
+        "Counter": "0,1",
+        "UMask": "0x0",
+        "EventName": "EIST_TRANS",
+        "SampleAfterValue": "200000",
+        "BriefDescription": "Number of Enhanced Intel SpeedStep(R) Technology (EIST) transitions"
+    }
+]
\ No newline at end of file
tools/perf/pmu-events/arch/test/test_cpu/uncore.json new file +21 -0
new file mode 100644
index 000000000000..d0a890cc814d
@@ -0,0 +1,21 @@
+[
+ {
+	    "EventCode": "0x02",
+	    "EventName": "uncore_hisi_ddrc.flux_wcmd",
+	    "BriefDescription": "DDRC write commands",
+	    "PublicDescription": "DDRC write commands",
+	    "Unit": "hisi_sccl,ddrc"
+   },
+   {
+	    "Unit": "CBO",
+	    "EventCode": "0x22",
+	    "UMask": "0x81",
+	    "EventName": "UNC_CBO_XSNP_RESPONSE.MISS_EVICTION",
+	    "BriefDescription": "A cross-core snoop resulted from L3 Eviction which misses in some processor core.",
+	    "PublicDescription": "A cross-core snoop resulted from L3 Eviction which misses in some processor core.",
+	    "Counter": "0,1",
+	    "CounterMask": "0",
+	    "Invert": "0",
+	    "EdgeDetect": "0"
+  }
+]
tools/perf/pmu-events/arch/x86/amdfam17h/cache.json deleted +0 -329

329 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdfam17h/other.json deleted +0 -65

65 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen1/branch.json new file +23 -0
new file mode 100644
index 000000000000..a9943eeb8d6b
@@ -0,0 +1,23 @@
+[
+  {
+    "EventName": "bp_l1_btb_correct",
+    "EventCode": "0x8a",
+    "BriefDescription": "L1 BTB Correction."
+  },
+  {
+    "EventName": "bp_l2_btb_correct",
+    "EventCode": "0x8b",
+    "BriefDescription": "L2 BTB Correction."
+  },
+  {
+    "EventName": "bp_dyn_ind_pred",
+    "EventCode": "0x8e",
+    "BriefDescription": "Dynamic Indirect Predictions.",
+    "PublicDescription": "Indirect Branch Prediction for potential multi-target branch (speculative)."
+  },
+  {
+    "EventName": "bp_de_redirect",
+    "EventCode": "0x91",
+    "BriefDescription": "Decoder Overrides Existing Branch Prediction (speculative)."
+  }
+]
tools/perf/pmu-events/arch/x86/amdzen1/cache.json new file +294 -0

294 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen1/core.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/core.json +3 -12
similarity index 87%
rename from tools/perf/pmu-events/arch/x86/amdfam17h/core.json
rename to tools/perf/pmu-events/arch/x86/amdzen1/core.json
index 1079544eeed5..7e1aa8273935 100644
@@ -62,7 +62,6 @@
     "EventName": "ex_ret_brn_ind_misp",
     "EventCode": "0xca",
     "BriefDescription": "Retired Indirect Branch Instructions Mispredicted.",
-    "PublicDescription": "Retired Indirect Branch Instructions Mispredicted."
   },
   {
     "EventName": "ex_ret_mmx_fp_instr.sse_instr",
@@ -90,11 +89,6 @@
     "EventCode": "0xd1",
     "BriefDescription": "Retired Conditional Branch Instructions."
   },
-  {
-    "EventName": "ex_ret_cond_misp",
-    "EventCode": "0xd2",
-    "BriefDescription": "Retired Conditional Branch Instructions Mispredicted."
-  },
   {
     "EventName": "ex_div_busy",
     "EventCode": "0xd3",
@@ -108,22 +102,19 @@
   {
     "EventName": "ex_tagged_ibs_ops.ibs_count_rollover",
     "EventCode": "0x1cf",
-    "BriefDescription": "Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.",
-    "PublicDescription": "Tagged IBS Ops. Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.",
+    "BriefDescription": "Tagged IBS Ops. Number of times an op could not be tagged by IBS because of a previous tagged op that has not retired.",
     "UMask": "0x4"
   },
   {
     "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops_ret",
     "EventCode": "0x1cf",
-    "BriefDescription": "Number of Ops tagged by IBS that retired.",
-    "PublicDescription": "Tagged IBS Ops. Number of Ops tagged by IBS that retired.",
+    "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS that retired.",
     "UMask": "0x2"
   },
   {
     "EventName": "ex_tagged_ibs_ops.ibs_tagged_ops",
     "EventCode": "0x1cf",
-    "BriefDescription": "Number of Ops tagged by IBS.",
-    "PublicDescription": "Tagged IBS Ops. Number of Ops tagged by IBS.",
+    "BriefDescription": "Tagged IBS Ops. Number of Ops tagged by IBS.",
     "UMask": "0x1"
   },
   {
tools/perf/pmu-events/arch/x86/amdzen1/floating-point.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/floating-point.json +60 -4

77 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen1/memory.json renamed from tools/perf/pmu-events/arch/x86/amdfam17h/memory.json +52 -30

198 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen1/other.json new file +56 -0

56 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen2/branch.json new file +52 -0

52 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen2/cache.json new file +338 -0

338 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen2/core.json new file +130 -0

130 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen2/floating-point.json new file +140 -0

140 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen2/memory.json new file +341 -0

295 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/amdzen2/other.json new file +115 -0

115 lines not on this page · raw message

tools/perf/pmu-events/arch/x86/broadwell/bdw-metrics.json +1 -1
index 45a34ce4fe89..8cdc7c13dc2a 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/broadwellde/bdwde-metrics.json +1 -1
index 961fe4395758..16fd8a7490fc 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/broadwellx/bdx-metrics.json +1 -1
index 746734ce09be..1eb0415fa11a 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/cascadelakex/clx-metrics.json +1 -1
index a728c6e5119b..7fde0d2943cd 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/haswell/hsw-metrics.json +1 -1
index 5402cd3120f9..f57c5f3506c2 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/haswellx/hsx-metrics.json +1 -1
index 832f3cb40b34..311a005dc35b 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/ivybridge/ivb-metrics.json +1 -1
index d69b2a8fc0bc..28e25447d3ef 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/ivytown/ivt-metrics.json +1 -1
index 5f465fd81315..db23db2e98be 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/jaketown/jkt-metrics.json +1 -1
index 3e909b306003..dbb33e00b72a 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/mapfile.csv +2 -1
index 745ced083844..25b06cf98747 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/sandybridge/snb-metrics.json +1 -1
index 50c053235752..fb2d7b8875f8 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/skylake/skl-metrics.json +1 -1
index f97e8316ad2f..8704efeb8d31 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/arch/x86/skylakex/skx-metrics.json +1 -1
index 35f5db1786f7..b4f91137f40c 100644

Lines of this file are not shown. View the raw message.

tools/perf/pmu-events/jevents.c +30 -0
index 3c4236a5bad8..fa86c5f997cc 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/Build +1 -0
index 1692529639b0..b3d1bf13ca07 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/builtin-test.c +4 -0
index 54d9516c9839..b6322eb0f423 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/make +7 -3
index c850d1664c56..5d0c3a9c47a1 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/pmu-events.c new file +379 -0

379 lines not on this page · raw message

tools/perf/tests/sample-parsing.c +5 -1
index 14239e472187..61865699c3f4 100644

Lines of this file are not shown. View the raw message.

tools/perf/tests/tests.h +1 -0
index 9a160fef47c9..61a1ab032080 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/browsers/hists.c +104 -22

126 lines not on this page · raw message

tools/perf/ui/hist.c +78 -15

93 lines not on this page · raw message

tools/perf/ui/keysyms.h +1 -0
index fbfac29077f2..04cc4e5c031f 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/annotate.h +1 -0
index 07c775938d46..2d88069d6428 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/cgroup.c +80 -0

80 lines not on this page · raw message

tools/perf/util/cgroup.h +13 -4
index 2ec11f01090d..e98d5975fe55 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/cpumap.c +5 -5
index 983b7388f22b..dc5c5e6fc502 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/dsos.c +21 -1
index 591707c69c39..939471731ea6 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/env.c +2 -0
index 4154f944f474..fadc59708ece 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/env.h +6 -0
index 11d05ae3606a..7632075a8792 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/event.c +35 -4
index c5447ff516a2..dc0e11214ae1 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/event.h +6 -0
index 3cda40a2fafc..b8289f160f07 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/evsel.c +17 -1
index 816d930d774e..eb880efbce16 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/evsel.h +1 -0
index 33804740e2ca..53187c501ee8 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/hist.c +13 -0
index e74a5acf66d9..283a69ff6a3d 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/hist.h +2 -0
index 0aa63aeb58ec..4141295a66fa 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/machine.c +19 -0
index fd14f1489802..97142e9671be 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/machine.h +3 -0
index be0a930eca89..fa1be9ea00fa 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/metricgroup.c +30 -19

49 lines not on this page · raw message

tools/perf/util/parse-events.c +3 -3
index a7dc0b096974..10107747b361 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/parse-events.l +7 -5
index 7b1c8ee537cf..baa48f28d57d 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/perf_event_attr_fprintf.c +2 -0
index 355d3458d4e6..b94fa07f5d32 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/pmu.c +24 -15
index 8b99fd312aae..ef6a63f3d386 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/pmu.h +5 -0
index 6737e3d5d568..5fb3f16828df 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/python-ext-sources +1 -0
index e7279ea6043a..a9d9c142eb7c 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/record.h +1 -0
index 5421fd2ad383..24316458be20 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/scripting-engines/trace-event-python.c +3 -0
index 8c1b27cd8b99..2c372cf5495e 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/session.c +4 -0
index 055b00abd56d..0b0bfe5bef17 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/setup.py +1 -1
index 8a065a6f9713..347b2c0789e4 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/sort.c +41 -2

43 lines not on this page · raw message

tools/perf/util/sort.h +2 -0
index 6c862d62d052..cfa6ac6f7d06 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/stat-display.c +3 -3
index 76c6052b12e2..9e757d18d713 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/symbol-elf.c +8 -2
index 1965aefccb02..be5b493f8284 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/symbol_conf.h +1 -0
index 10f1ec3e0349..b916afb95ec5 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/synthetic-events.c +130 -0

130 lines not on this page · raw message

tools/perf/util/synthetic-events.h +1 -0
index baead0cdc381..e7a3e9589738 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/tool.h +2 -0
index 2abbf668b8de..3fb67bd31e4a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

merge bot Merged
#4 lore raw

Re: [GIT pull] perf/urgent for 5.7-rc1

The pull request you sent on Sun, 05 Apr 2020 13:41:51 -0000:

The pull request you sent on Sun, 05 Apr 2020 13:41:51 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf-urgent-2020-04-05

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/c48b07226bd41f4053aa2024c5e347183c04deb5

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker
#5 lore raw
In reply to Thomas Gleixner
Quoted 3 lines · Thomas Gleixner

Two reverts addressing regressions of the Xilinx interrupt controller driver which affected the PPC users.

Gah.

Those reverts don't actually say what was wrong with the commits.

The "breaks a number of PPC platforms" is not actually saying what went wrong. Breaks how? Does it stop booting, does it not build, or what?

And the link in it also is entirely useless.

This link _would_ have been useful:

https://lore.kernel.org/linux-next/[email protected]/

but that's not what is in the commit messages.

Please write _useful_ commit messages, not this completely worthless noise.

Linus

merge bot Merged
#6 lore raw
In reply to Thomas Gleixner
The pull request you sent on Sun, 05 Apr 2020 13:41:49 -0000:

The pull request you sent on Sun, 05 Apr 2020 13:41:49 -0000:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git irq-urgent-2020-04-05

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/e5adbd6ec480164fe30ee65c94426cb12d64bc99

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker