aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/perf/util/machine.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index bdc33ce40bdc..205d27017361 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1771,11 +1771,6 @@ static int resolve_lbr_callchain_sample(struct thread *thread,
1771 */ 1771 */
1772 int mix_chain_nr = i + 1 + lbr_nr + 1; 1772 int mix_chain_nr = i + 1 + lbr_nr + 1;
1773 1773
1774 if (mix_chain_nr > (int)sysctl_perf_event_max_stack + PERF_MAX_BRANCH_DEPTH) {
1775 pr_warning("corrupted callchain. skipping...\n");
1776 return 0;
1777 }
1778
1779 for (j = 0; j < mix_chain_nr; j++) { 1774 for (j = 0; j < mix_chain_nr; j++) {
1780 if (callchain_param.order == ORDER_CALLEE) { 1775 if (callchain_param.order == ORDER_CALLEE) {
1781 if (j < i + 1) 1776 if (j < i + 1)
@@ -1815,7 +1810,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
1815 struct ip_callchain *chain = sample->callchain; 1810 struct ip_callchain *chain = sample->callchain;
1816 int chain_nr = chain->nr; 1811 int chain_nr = chain->nr;
1817 u8 cpumode = PERF_RECORD_MISC_USER; 1812 u8 cpumode = PERF_RECORD_MISC_USER;
1818 int i, j, err, nr_entries, nr_contexts; 1813 int i, j, err, nr_entries;
1819 int skip_idx = -1; 1814 int skip_idx = -1;
1820 int first_call = 0; 1815 int first_call = 0;
1821 1816
@@ -1830,8 +1825,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
1830 * Based on DWARF debug information, some architectures skip 1825 * Based on DWARF debug information, some architectures skip
1831 * a callchain entry saved by the kernel. 1826 * a callchain entry saved by the kernel.
1832 */ 1827 */
1833 if (chain_nr < sysctl_perf_event_max_stack) 1828 skip_idx = arch_skip_callchain_idx(thread, chain);
1834 skip_idx = arch_skip_callchain_idx(thread, chain);
1835 1829
1836 /* 1830 /*
1837 * Add branches to call stack for easier browsing. This gives 1831 * Add branches to call stack for easier browsing. This gives
@@ -1891,7 +1885,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
1891 } 1885 }
1892 1886
1893check_calls: 1887check_calls:
1894 for (i = first_call, nr_entries = 0, nr_contexts = 0; 1888 for (i = first_call, nr_entries = 0;
1895 i < chain_nr && nr_entries < max_stack; i++) { 1889 i < chain_nr && nr_entries < max_stack; i++) {
1896 u64 ip; 1890 u64 ip;
1897 1891
@@ -1906,13 +1900,8 @@ check_calls:
1906#endif 1900#endif
1907 ip = chain->ips[j]; 1901 ip = chain->ips[j];
1908 1902
1909 if (ip >= PERF_CONTEXT_MAX) { 1903 if (ip < PERF_CONTEXT_MAX)
1910 if (++nr_contexts > sysctl_perf_event_max_contexts_per_stack) 1904 ++nr_entries;
1911 goto out_corrupted_callchain;
1912 } else {
1913 if (++nr_entries > sysctl_perf_event_max_stack)
1914 goto out_corrupted_callchain;
1915 }
1916 1905
1917 err = add_callchain_ip(thread, cursor, parent, root_al, &cpumode, ip); 1906 err = add_callchain_ip(thread, cursor, parent, root_al, &cpumode, ip);
1918 1907
@@ -1921,10 +1910,6 @@ check_calls:
1921 } 1910 }
1922 1911
1923 return 0; 1912 return 0;
1924
1925out_corrupted_callchain:
1926 pr_warning("corrupted callchain. skipping...\n");
1927 return 0;
1928} 1913}
1929 1914
1930static int unwind_entry(struct unwind_entry *entry, void *arg) 1915static int unwind_entry(struct unwind_entry *entry, void *arg)