aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/trace/ring_buffer.c19
-rw-r--r--kernel/trace/trace.c6
-rw-r--r--tools/perf/builtin-annotate.c2
-rw-r--r--tools/perf/builtin-top.c2
-rw-r--r--tools/perf/util/debug.c2
-rw-r--r--tools/perf/util/newt.c1
-rw-r--r--tools/perf/util/symbol.c27
-rw-r--r--tools/perf/util/symbol.h2
8 files changed, 45 insertions, 16 deletions
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 7f6059c5aa94..1da7b6ea8b85 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1768,6 +1768,14 @@ rb_reset_tail(struct ring_buffer_per_cpu *cpu_buffer,
1768 * must fill the old tail_page with padding. 1768 * must fill the old tail_page with padding.
1769 */ 1769 */
1770 if (tail >= BUF_PAGE_SIZE) { 1770 if (tail >= BUF_PAGE_SIZE) {
1771 /*
1772 * If the page was filled, then we still need
1773 * to update the real_end. Reset it to zero
1774 * and the reader will ignore it.
1775 */
1776 if (tail == BUF_PAGE_SIZE)
1777 tail_page->real_end = 0;
1778
1771 local_sub(length, &tail_page->write); 1779 local_sub(length, &tail_page->write);
1772 return; 1780 return;
1773 } 1781 }
@@ -3894,12 +3902,12 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
3894 ret = read; 3902 ret = read;
3895 3903
3896 cpu_buffer->lost_events = 0; 3904 cpu_buffer->lost_events = 0;
3905
3906 commit = local_read(&bpage->commit);
3897 /* 3907 /*
3898 * Set a flag in the commit field if we lost events 3908 * Set a flag in the commit field if we lost events
3899 */ 3909 */
3900 if (missed_events) { 3910 if (missed_events) {
3901 commit = local_read(&bpage->commit);
3902
3903 /* If there is room at the end of the page to save the 3911 /* If there is room at the end of the page to save the
3904 * missed events, then record it there. 3912 * missed events, then record it there.
3905 */ 3913 */
@@ -3907,10 +3915,17 @@ int ring_buffer_read_page(struct ring_buffer *buffer,
3907 memcpy(&bpage->data[commit], &missed_events, 3915 memcpy(&bpage->data[commit], &missed_events,
3908 sizeof(missed_events)); 3916 sizeof(missed_events));
3909 local_add(RB_MISSED_STORED, &bpage->commit); 3917 local_add(RB_MISSED_STORED, &bpage->commit);
3918 commit += sizeof(missed_events);
3910 } 3919 }
3911 local_add(RB_MISSED_EVENTS, &bpage->commit); 3920 local_add(RB_MISSED_EVENTS, &bpage->commit);
3912 } 3921 }
3913 3922
3923 /*
3924 * This page may be off to user land. Zero it out here.
3925 */
3926 if (commit < BUF_PAGE_SIZE)
3927 memset(&bpage->data[commit], 0, BUF_PAGE_SIZE - commit);
3928
3914 out_unlock: 3929 out_unlock:
3915 spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); 3930 spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags);
3916 3931
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 55e48511d7c8..086d36316805 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3666,7 +3666,6 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
3666 size_t count, loff_t *ppos) 3666 size_t count, loff_t *ppos)
3667{ 3667{
3668 struct ftrace_buffer_info *info = filp->private_data; 3668 struct ftrace_buffer_info *info = filp->private_data;
3669 unsigned int pos;
3670 ssize_t ret; 3669 ssize_t ret;
3671 size_t size; 3670 size_t size;
3672 3671
@@ -3693,11 +3692,6 @@ tracing_buffers_read(struct file *filp, char __user *ubuf,
3693 if (ret < 0) 3692 if (ret < 0)
3694 return 0; 3693 return 0;
3695 3694
3696 pos = ring_buffer_page_len(info->spare);
3697
3698 if (pos < PAGE_SIZE)
3699 memset(info->spare + pos, 0, PAGE_SIZE - pos);
3700
3701read: 3695read:
3702 size = PAGE_SIZE - info->read; 3696 size = PAGE_SIZE - info->read;
3703 if (size > count) 3697 if (size > count)
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 08278eda31a5..96db5248e995 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -343,7 +343,7 @@ find_next:
343 continue; 343 continue;
344 } 344 }
345 345
346 if (use_browser) { 346 if (use_browser > 0) {
347 key = hist_entry__tui_annotate(he); 347 key = hist_entry__tui_annotate(he);
348 if (is_exit_key(key)) 348 if (is_exit_key(key))
349 break; 349 break;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 397290a0a76e..a66f4272b994 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1060,7 +1060,7 @@ static void event__process_sample(const event_t *self,
1060 pr_err("Can't annotate %s", sym->name); 1060 pr_err("Can't annotate %s", sym->name);
1061 if (sym_filter_entry->map->dso->origin == DSO__ORIG_KERNEL) { 1061 if (sym_filter_entry->map->dso->origin == DSO__ORIG_KERNEL) {
1062 pr_err(": No vmlinux file was found in the path:\n"); 1062 pr_err(": No vmlinux file was found in the path:\n");
1063 vmlinux_path__fprintf(stderr); 1063 machine__fprintf_vmlinux_path(machine, stderr);
1064 } else 1064 } else
1065 pr_err(".\n"); 1065 pr_err(".\n");
1066 exit(1); 1066 exit(1);
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c
index dd824cf3b628..6cddff2bc970 100644
--- a/tools/perf/util/debug.c
+++ b/tools/perf/util/debug.c
@@ -22,7 +22,7 @@ int eprintf(int level, const char *fmt, ...)
22 22
23 if (verbose >= level) { 23 if (verbose >= level) {
24 va_start(args, fmt); 24 va_start(args, fmt);
25 if (use_browser) 25 if (use_browser > 0)
26 ret = browser__show_help(fmt, args); 26 ret = browser__show_help(fmt, args);
27 else 27 else
28 ret = vfprintf(stderr, fmt, args); 28 ret = vfprintf(stderr, fmt, args);
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c
index d54c540f49db..cf182ca132fe 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -1139,6 +1139,7 @@ void setup_browser(void)
1139 struct newtPercentTreeColors *c = &defaultPercentTreeColors; 1139 struct newtPercentTreeColors *c = &defaultPercentTreeColors;
1140 1140
1141 if (!isatty(1) || !use_browser || dump_trace) { 1141 if (!isatty(1) || !use_browser || dump_trace) {
1142 use_browser = 0;
1142 setup_pager(); 1143 setup_pager();
1143 return; 1144 return;
1144 } 1145 }
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index aaa51ba147df..7fd6b151feb5 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1695,9 +1695,20 @@ int dso__load_vmlinux_path(struct dso *self, struct map *map,
1695 symbol_filter_t filter) 1695 symbol_filter_t filter)
1696{ 1696{
1697 int i, err = 0; 1697 int i, err = 0;
1698 char *filename;
1698 1699
1699 pr_debug("Looking at the vmlinux_path (%d entries long)\n", 1700 pr_debug("Looking at the vmlinux_path (%d entries long)\n",
1700 vmlinux_path__nr_entries); 1701 vmlinux_path__nr_entries + 1);
1702
1703 filename = dso__build_id_filename(self, NULL, 0);
1704 if (filename != NULL) {
1705 err = dso__load_vmlinux(self, map, filename, filter);
1706 if (err > 0) {
1707 dso__set_long_name(self, filename);
1708 goto out;
1709 }
1710 free(filename);
1711 }
1701 1712
1702 for (i = 0; i < vmlinux_path__nr_entries; ++i) { 1713 for (i = 0; i < vmlinux_path__nr_entries; ++i) {
1703 err = dso__load_vmlinux(self, map, vmlinux_path[i], filter); 1714 err = dso__load_vmlinux(self, map, vmlinux_path[i], filter);
@@ -1706,7 +1717,7 @@ int dso__load_vmlinux_path(struct dso *self, struct map *map,
1706 break; 1717 break;
1707 } 1718 }
1708 } 1719 }
1709 1720out:
1710 return err; 1721 return err;
1711} 1722}
1712 1723
@@ -2102,13 +2113,21 @@ out_fail:
2102 return -1; 2113 return -1;
2103} 2114}
2104 2115
2105size_t vmlinux_path__fprintf(FILE *fp) 2116size_t machine__fprintf_vmlinux_path(struct machine *self, FILE *fp)
2106{ 2117{
2107 int i; 2118 int i;
2108 size_t printed = 0; 2119 size_t printed = 0;
2120 struct dso *kdso = self->vmlinux_maps[MAP__FUNCTION]->dso;
2121
2122 if (kdso->has_build_id) {
2123 char filename[PATH_MAX];
2124 if (dso__build_id_filename(kdso, filename, sizeof(filename)))
2125 printed += fprintf(fp, "[0] %s\n", filename);
2126 }
2109 2127
2110 for (i = 0; i < vmlinux_path__nr_entries; ++i) 2128 for (i = 0; i < vmlinux_path__nr_entries; ++i)
2111 printed += fprintf(fp, "[%d] %s\n", i, vmlinux_path[i]); 2129 printed += fprintf(fp, "[%d] %s\n",
2130 i + kdso->has_build_id, vmlinux_path[i]);
2112 2131
2113 return printed; 2132 return printed;
2114} 2133}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 5d25b5eb1456..5e02d2c17154 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -216,6 +216,6 @@ int machines__create_guest_kernel_maps(struct rb_root *self);
216int symbol__init(void); 216int symbol__init(void);
217bool symbol_type__is_a(char symbol_type, enum map_type map_type); 217bool symbol_type__is_a(char symbol_type, enum map_type map_type);
218 218
219size_t vmlinux_path__fprintf(FILE *fp); 219size_t machine__fprintf_vmlinux_path(struct machine *self, FILE *fp);
220 220
221#endif /* __PERF_SYMBOL */ 221#endif /* __PERF_SYMBOL */