Skip to content

Commit 852fb4a

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "No kernel side changes, all tooling fixes plus two tooling cleanups that were committed late in the merge window alongside the perf annotate fixes, delayed by Arnaldo's European trip" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (23 commits) perf annotate: Fix segfault with source toggle perf annotate: Align struct annotate_args perf annotate: Simplify disasm_line allocation and freeing code perf annotate: Remove privsize from symbol__annotate() args perf probe: Check return value of strlist__add() for -ENOMEM perf config: Document missing config options perf annotate: Fix perf config option description perf annotate: Prefer cmdline option over default config perf annotate: Make perf config effective perf config: Introduce perf_config_u8() perf annotate: Fix --show-nr-samples for tui/stdio2 perf annotate: Fix --show-total-period for tui/stdio2 perf annotate/tui: Re-render title bar after switching back from script browser tools headers UAPI: Update tools's copy of kvm.h headers tools arch x86: Sync the msr-index.h copy with the kernel sources perf arch powerpc: Sync powerpc syscall.tbl with the kernel sources perf auxtrace: Add auxtrace_record__read_finish() perf arm-spe: Fix endless record after being terminated perf cs-etm: Fix endless record after being terminated perf intel-bts: Fix endless record after being terminated ...
2 parents e130a92 + 7977fed commit 852fb4a

File tree

25 files changed

+251
-214
lines changed

25 files changed

+251
-214
lines changed

tools/arch/x86/include/asm/msr-index.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,8 @@
512512
#define MSR_K7_HWCR 0xc0010015
513513
#define MSR_K7_HWCR_SMMLOCK_BIT 0
514514
#define MSR_K7_HWCR_SMMLOCK BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
515+
#define MSR_K7_HWCR_IRPERF_EN_BIT 30
516+
#define MSR_K7_HWCR_IRPERF_EN BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
515517
#define MSR_K7_FID_VID_CTL 0xc0010041
516518
#define MSR_K7_FID_VID_STATUS 0xc0010042
517519

tools/arch/x86/include/uapi/asm/kvm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ struct kvm_sync_regs {
390390
#define KVM_STATE_NESTED_GUEST_MODE 0x00000001
391391
#define KVM_STATE_NESTED_RUN_PENDING 0x00000002
392392
#define KVM_STATE_NESTED_EVMCS 0x00000004
393+
#define KVM_STATE_NESTED_MTF_PENDING 0x00000008
393394

394395
#define KVM_STATE_NESTED_SMM_GUEST_MODE 0x00000001
395396
#define KVM_STATE_NESTED_SMM_VMXON 0x00000002

tools/perf/Documentation/perf-config.txt

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ buildid.*::
239239
set buildid.dir to /dev/null. The default is $HOME/.debug
240240

241241
annotate.*::
242-
These options work only for TUI.
243242
These are in control of addresses, jump function, source code
244243
in lines of assembly code from a specific program.
245244

@@ -269,6 +268,8 @@ annotate.*::
269268
│ mov (%rdi),%rdx
270269
│ return n;
271270

271+
This option works with tui, stdio2 browsers.
272+
272273
annotate.use_offset::
273274
Basing on a first address of a loaded function, offset can be used.
274275
Instead of using original addresses of assembly code,
@@ -287,6 +288,8 @@ annotate.*::
287288

288289
368:│ mov 0x8(%r14),%rdi
289290

291+
This option works with tui, stdio2 browsers.
292+
290293
annotate.jump_arrows::
291294
There can be jump instruction among assembly code.
292295
Depending on a boolean value of jump_arrows,
@@ -306,6 +309,8 @@ annotate.*::
306309
│1330: mov %r15,%r10
307310
│1333: cmp %r15,%r14
308311

312+
This option works with tui browser.
313+
309314
annotate.show_linenr::
310315
When showing source code if this option is 'true',
311316
line numbers are printed as below.
@@ -325,6 +330,8 @@ annotate.*::
325330
│ array++;
326331
│ }
327332

333+
This option works with tui, stdio2 browsers.
334+
328335
annotate.show_nr_jumps::
329336
Let's see a part of assembly code.
330337

@@ -335,6 +342,8 @@ annotate.*::
335342

336343
│1 1382: movb $0x1,-0x270(%rbp)
337344

345+
This option works with tui, stdio2 browsers.
346+
338347
annotate.show_total_period::
339348
To compare two records on an instruction base, with this option
340349
provided, display total number of samples that belong to a line
@@ -348,11 +357,30 @@ annotate.*::
348357

349358
99.93 │ mov %eax,%eax
350359

360+
This option works with tui, stdio2, stdio browsers.
361+
362+
annotate.show_nr_samples::
363+
By default perf annotate shows percentage of samples. This option
364+
can be used to print absolute number of samples. Ex, when set as
365+
false:
366+
367+
Percent│
368+
74.03 │ mov %fs:0x28,%rax
369+
370+
When set as true:
371+
372+
Samples│
373+
6 │ mov %fs:0x28,%rax
374+
375+
This option works with tui, stdio2, stdio browsers.
376+
351377
annotate.offset_level::
352378
Default is '1', meaning just jump targets will have offsets show right beside
353379
the instruction. When set to '2' 'call' instructions will also have its offsets
354380
shown, 3 or higher will show offsets for all instructions.
355381

382+
This option works with tui, stdio2 browsers.
383+
356384
hist.*::
357385
hist.percentage::
358386
This option control the way to calculate overhead of filtered entries -
@@ -490,6 +518,12 @@ top.*::
490518
column by default.
491519
The default is 'true'.
492520

521+
top.call-graph::
522+
This is identical to 'call-graph.record-mode', except it is
523+
applicable only for 'top' subcommand. This option ONLY setup
524+
the unwind method. To enable 'perf top' to actually use it,
525+
the command line option -g must be specified.
526+
493527
man.*::
494528
man.viewer::
495529
This option can assign a tool to view manual pages when 'help'
@@ -517,6 +551,16 @@ record.*::
517551
But if this option is 'no-cache', it will not update the build-id cache.
518552
'skip' skips post-processing and does not update the cache.
519553

554+
record.call-graph::
555+
This is identical to 'call-graph.record-mode', except it is
556+
applicable only for 'record' subcommand. This option ONLY setup
557+
the unwind method. To enable 'perf record' to actually use it,
558+
the command line option -g must be specified.
559+
560+
record.aio::
561+
Use 'n' control blocks in asynchronous (Posix AIO) trace writing
562+
mode ('n' default: 1, max: 4).
563+
520564
diff.*::
521565
diff.order::
522566
This option sets the number of columns to sort the result.
@@ -566,6 +610,11 @@ trace.*::
566610
"libbeauty", the default, to use the same argument beautifiers used in the
567611
strace-like sys_enter+sys_exit lines.
568612

613+
ftrace.*::
614+
ftrace.tracer::
615+
Can be used to select the default tracer. Possible values are
616+
'function' and 'function_graph'.
617+
569618
llvm.*::
570619
llvm.clang-path::
571620
Path to clang. If omit, search it from $PATH.
@@ -610,6 +659,29 @@ scripts.*::
610659
The script gets the same options passed as a full perf script,
611660
in particular -i perfdata file, --cpu, --tid
612661

662+
convert.*::
663+
664+
convert.queue-size::
665+
Limit the size of ordered_events queue, so we could control
666+
allocation size of perf data files without proper finished
667+
round events.
668+
669+
intel-pt.*::
670+
671+
intel-pt.cache-divisor::
672+
673+
intel-pt.mispred-all::
674+
If set, Intel PT decoder will set the mispred flag on all
675+
branches.
676+
677+
auxtrace.*::
678+
679+
auxtrace.dumpdir::
680+
s390 only. The directory to save the auxiliary trace buffer
681+
can be changed using this option. Ex, auxtrace.dumpdir=/tmp.
682+
If the directory does not exist or has the wrong file type,
683+
the current directory is used.
684+
613685
SEE ALSO
614686
--------
615687
linkperf:perf[1]

tools/perf/arch/arm/util/cs-etm.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -858,21 +858,6 @@ static void cs_etm_recording_free(struct auxtrace_record *itr)
858858
free(ptr);
859859
}
860860

861-
static int cs_etm_read_finish(struct auxtrace_record *itr, int idx)
862-
{
863-
struct cs_etm_recording *ptr =
864-
container_of(itr, struct cs_etm_recording, itr);
865-
struct evsel *evsel;
866-
867-
evlist__for_each_entry(ptr->evlist, evsel) {
868-
if (evsel->core.attr.type == ptr->cs_etm_pmu->type)
869-
return perf_evlist__enable_event_idx(ptr->evlist,
870-
evsel, idx);
871-
}
872-
873-
return -EINVAL;
874-
}
875-
876861
struct auxtrace_record *cs_etm_record_init(int *err)
877862
{
878863
struct perf_pmu *cs_etm_pmu;
@@ -892,6 +877,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
892877
}
893878

894879
ptr->cs_etm_pmu = cs_etm_pmu;
880+
ptr->itr.pmu = cs_etm_pmu;
895881
ptr->itr.parse_snapshot_options = cs_etm_parse_snapshot_options;
896882
ptr->itr.recording_options = cs_etm_recording_options;
897883
ptr->itr.info_priv_size = cs_etm_info_priv_size;
@@ -901,7 +887,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
901887
ptr->itr.snapshot_finish = cs_etm_snapshot_finish;
902888
ptr->itr.reference = cs_etm_reference;
903889
ptr->itr.free = cs_etm_recording_free;
904-
ptr->itr.read_finish = cs_etm_read_finish;
890+
ptr->itr.read_finish = auxtrace_record__read_finish;
905891

906892
*err = 0;
907893
return &ptr->itr;

tools/perf/arch/arm64/util/arm-spe.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -158,20 +158,6 @@ static void arm_spe_recording_free(struct auxtrace_record *itr)
158158
free(sper);
159159
}
160160

161-
static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
162-
{
163-
struct arm_spe_recording *sper =
164-
container_of(itr, struct arm_spe_recording, itr);
165-
struct evsel *evsel;
166-
167-
evlist__for_each_entry(sper->evlist, evsel) {
168-
if (evsel->core.attr.type == sper->arm_spe_pmu->type)
169-
return perf_evlist__enable_event_idx(sper->evlist,
170-
evsel, idx);
171-
}
172-
return -EINVAL;
173-
}
174-
175161
struct auxtrace_record *arm_spe_recording_init(int *err,
176162
struct perf_pmu *arm_spe_pmu)
177163
{
@@ -189,12 +175,13 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
189175
}
190176

191177
sper->arm_spe_pmu = arm_spe_pmu;
178+
sper->itr.pmu = arm_spe_pmu;
192179
sper->itr.recording_options = arm_spe_recording_options;
193180
sper->itr.info_priv_size = arm_spe_info_priv_size;
194181
sper->itr.info_fill = arm_spe_info_fill;
195182
sper->itr.free = arm_spe_recording_free;
196183
sper->itr.reference = arm_spe_reference;
197-
sper->itr.read_finish = arm_spe_read_finish;
184+
sper->itr.read_finish = auxtrace_record__read_finish;
198185
sper->itr.alignment = 0;
199186

200187
*err = 0;

tools/perf/arch/powerpc/entry/syscalls/syscall.tbl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -517,3 +517,5 @@
517517
433 common fspick sys_fspick
518518
434 common pidfd_open sys_pidfd_open
519519
435 nospu clone3 ppc_clone3
520+
437 common openat2 sys_openat2
521+
438 common pidfd_getfd sys_pidfd_getfd

tools/perf/arch/x86/util/intel-bts.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -413,20 +413,6 @@ static int intel_bts_find_snapshot(struct auxtrace_record *itr, int idx,
413413
return err;
414414
}
415415

416-
static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
417-
{
418-
struct intel_bts_recording *btsr =
419-
container_of(itr, struct intel_bts_recording, itr);
420-
struct evsel *evsel;
421-
422-
evlist__for_each_entry(btsr->evlist, evsel) {
423-
if (evsel->core.attr.type == btsr->intel_bts_pmu->type)
424-
return perf_evlist__enable_event_idx(btsr->evlist,
425-
evsel, idx);
426-
}
427-
return -EINVAL;
428-
}
429-
430416
struct auxtrace_record *intel_bts_recording_init(int *err)
431417
{
432418
struct perf_pmu *intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME);
@@ -447,6 +433,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
447433
}
448434

449435
btsr->intel_bts_pmu = intel_bts_pmu;
436+
btsr->itr.pmu = intel_bts_pmu;
450437
btsr->itr.recording_options = intel_bts_recording_options;
451438
btsr->itr.info_priv_size = intel_bts_info_priv_size;
452439
btsr->itr.info_fill = intel_bts_info_fill;
@@ -456,7 +443,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
456443
btsr->itr.find_snapshot = intel_bts_find_snapshot;
457444
btsr->itr.parse_snapshot_options = intel_bts_parse_snapshot_options;
458445
btsr->itr.reference = intel_bts_reference;
459-
btsr->itr.read_finish = intel_bts_read_finish;
446+
btsr->itr.read_finish = auxtrace_record__read_finish;
460447
btsr->itr.alignment = sizeof(struct branch);
461448
return &btsr->itr;
462449
}

tools/perf/arch/x86/util/intel-pt.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,20 +1166,6 @@ static u64 intel_pt_reference(struct auxtrace_record *itr __maybe_unused)
11661166
return rdtsc();
11671167
}
11681168

1169-
static int intel_pt_read_finish(struct auxtrace_record *itr, int idx)
1170-
{
1171-
struct intel_pt_recording *ptr =
1172-
container_of(itr, struct intel_pt_recording, itr);
1173-
struct evsel *evsel;
1174-
1175-
evlist__for_each_entry(ptr->evlist, evsel) {
1176-
if (evsel->core.attr.type == ptr->intel_pt_pmu->type)
1177-
return perf_evlist__enable_event_idx(ptr->evlist, evsel,
1178-
idx);
1179-
}
1180-
return -EINVAL;
1181-
}
1182-
11831169
struct auxtrace_record *intel_pt_recording_init(int *err)
11841170
{
11851171
struct perf_pmu *intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME);
@@ -1200,6 +1186,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
12001186
}
12011187

12021188
ptr->intel_pt_pmu = intel_pt_pmu;
1189+
ptr->itr.pmu = intel_pt_pmu;
12031190
ptr->itr.recording_options = intel_pt_recording_options;
12041191
ptr->itr.info_priv_size = intel_pt_info_priv_size;
12051192
ptr->itr.info_fill = intel_pt_info_fill;
@@ -1209,7 +1196,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
12091196
ptr->itr.find_snapshot = intel_pt_find_snapshot;
12101197
ptr->itr.parse_snapshot_options = intel_pt_parse_snapshot_options;
12111198
ptr->itr.reference = intel_pt_reference;
1212-
ptr->itr.read_finish = intel_pt_read_finish;
1199+
ptr->itr.read_finish = auxtrace_record__read_finish;
12131200
/*
12141201
* Decoding starts at a PSB packet. Minimum PSB period is 2K so 4K
12151202
* should give at least 1 PSB per sample.

tools/perf/builtin-annotate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@ int cmd_annotate(int argc, const char **argv)
566566
if (ret < 0)
567567
return ret;
568568

569+
annotation_config__init(&annotate.opts);
570+
569571
argc = parse_options(argc, argv, options, annotate_usage, 0);
570572
if (argc) {
571573
/*
@@ -605,8 +607,6 @@ int cmd_annotate(int argc, const char **argv)
605607
if (ret < 0)
606608
goto out_delete;
607609

608-
annotation_config__init();
609-
610610
symbol_conf.try_vmlinux_path = true;
611611

612612
ret = symbol__init(&annotate.session->header.env);

tools/perf/builtin-probe.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,8 @@ static int perf_del_probe_events(struct strfilter *filter)
449449
ret = probe_file__del_strlist(kfd, klist);
450450
if (ret < 0)
451451
goto error;
452-
}
452+
} else if (ret == -ENOMEM)
453+
goto error;
453454

454455
ret2 = probe_file__get_events(ufd, filter, ulist);
455456
if (ret2 == 0) {
@@ -459,7 +460,8 @@ static int perf_del_probe_events(struct strfilter *filter)
459460
ret2 = probe_file__del_strlist(ufd, ulist);
460461
if (ret2 < 0)
461462
goto error;
462-
}
463+
} else if (ret2 == -ENOMEM)
464+
goto error;
463465

464466
if (ret == -ENOENT && ret2 == -ENOENT)
465467
pr_warning("\"%s\" does not hit any event.\n", str);

0 commit comments

Comments
 (0)