-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CSSPGO][llvm-profgen] Fix external address issues of perf reader (le…
…ading external LBR part) We can have the sampling just hit into the external addresses, in that case, both the top stack frame and the latest LBR target are external addresses. For example: ``` ffffffff 0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0 ffffffff 40067e 0xffffffff/0xffffffff/P/-/-/0 0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0 ``` Before we will ignore the entire samples. However, we found there exists some internal LBRs in the remaining part of sample, the range between them is still a valid range, we will lose some valid LBRs. Those LBRs will be unwinded based on a empty(context-less) call stack. This change tries to fix it, instead of ignoring the entire sample, we only ignore the leading external addresses. Note that the first outgoing LBR is useful since there is a valid range between it's source and next LBR's target. Reviewed By: hoy, wenlei Differential Revision: https://reviews.llvm.org/D115538
- Loading branch information
Showing
7 changed files
with
165 additions
and
44 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
llvm/test/tools/llvm-profgen/Inputs/external-address.perfscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PERF_RECORD_MMAP2 2854748/2854748: [0x400000(0x1000) @ 0 00:1d 123291722 526021]: r-xp /home/inline-cs-noprobe.perfbin | ||
|
||
; Test for an external top address, should only ignore the call stack and keep unwinding the LBR | ||
|
||
; Valid LBR. The first 4006d7 will be kept for unwinding, the second will be truncated. | ||
|
||
ffffffff | ||
ffffffff | ||
4006d7 | ||
ffffffff | ||
4006d7 | ||
ffffffff | ||
0x4006c8/0x40067e/P/-/-/0 0x40069b/0x400670/M/-/-/0 | ||
|
||
; Valid LBR | ||
ffffffff | ||
0x4006c8/0x40067e/P/-/-/0 0x40069b/0x400670/M/-/-/0 | ||
|
||
; Valid LBR | ||
ffffffff | ||
0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0 | ||
|
||
; Valid LBR | ||
40067e | ||
0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0 | ||
|
||
; Valid LBR | ||
ffffffff | ||
5541f689495641d7 | ||
0xffffffff/0xffffffff/P/-/-/0 0x4006c8/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0 | ||
|
||
; Empty sample | ||
ffffffff | ||
5541f689495641d7 | ||
0xffffffff/0xffffffff/P/-/-/0 0xffffffff/0xffffffff/P/-/-/0 | ||
|
||
; Invalid LBR | ||
ffffffff | ||
0xffffffff/0xffffffff/P/-/-/0 0x40069b/0x400670/M/-/-/0 |
7 changes: 0 additions & 7 deletions
7
llvm/test/tools/llvm-profgen/Inputs/inline-cs-noprobe.perfscript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
PERF_RECORD_MMAP2 2854748/2854748: [0x400000(0x1000) @ 0 00:1d 123291722 526021]: r-xp /home/inline-cs-noprobe.perfbin | ||
|
||
; test for an external or invalid top address, should skip the whole sample | ||
|
||
ffffffff | ||
40067e | ||
5541f689495641d7 | ||
0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x40069b/0x400670/M/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 | ||
|
||
40067e | ||
5541f689495641d7 | ||
0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x40069b/0x400670/M/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 0x4006c8/0x40067e/P/-/-/0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/external-address.perfscript --binary=%S/Inputs/inline-cs-noprobe.perfbin --output=%t --skip-symbolization --profile-summary-hot-count=0 --compress-recursion=0 | ||
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER | ||
|
||
|
||
; CHECK-UNWINDER: [main:1 @ foo] | ||
; CHECK-UNWINDER: 2 | ||
; CHECK-UNWINDER: 670-6ad:4 | ||
; CHECK-UNWINDER: 6bd-6c8:4 | ||
; CHECK-UNWINDER: 2 | ||
; CHECK-UNWINDER: 69b->670:5 | ||
; CHECK-UNWINDER: 6c8->67e:1 | ||
; CHECK-UNWINDER: [main:1 @ foo:3.1 @ bar] | ||
; CHECK-UNWINDER: 1 | ||
; CHECK-UNWINDER: 6af-6bb:4 | ||
; CHECK-UNWINDER: 0 | ||
|
||
; Manually created to test if remaining call stack can be correctly unwinded. | ||
; CHECK-UNWINDER: [main:1 @ foo:4 @ main:1 @ foo] | ||
; CHECK-UNWINDER: 2 | ||
; CHECK-UNWINDER: 670-6ad:1 | ||
; CHECK-UNWINDER: 6bd-6c8:1 | ||
; CHECK-UNWINDER: 2 | ||
; CHECK-UNWINDER: 69b->670:1 | ||
; CHECK-UNWINDER: 6c8->67e:1 | ||
; CHECK-UNWINDER: [main:1 @ foo:4 @ main:1 @ foo:3.1 @ bar] | ||
; CHECK-UNWINDER: 1 | ||
; CHECK-UNWINDER: 6af-6bb:1 | ||
; CHECK-UNWINDER: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.