<html><head></head><body dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="ApplePlainTextBody"><div class="ApplePlainTextBody"><br><br><blockquote type="cite">On 18-Jan-2021, at 3:51 PM, kajoljain <kjain@linux.ibm.com> wrote:<br><br><br><br>On 1/12/21 3:08 PM, Jiri Olsa wrote:<br><blockquote type="cite">On Mon, Dec 28, 2020 at 09:14:14PM -0500, Athira Rajeev wrote:<br><br>SNIP<br><br><blockquote type="cite">c000000002799370 b backtrace_flag<br>c000000002799378 B radix_tree_node_cachep<br>c000000002799380 B __bss_stop<br>c0000000027a0000 B _end<br>c008000003890000 t icmp_checkentry      [ip_tables]<br>c008000003890038 t ipt_alloc_initial_table      [ip_tables]<br>c008000003890468 T ipt_do_table [ip_tables]<br>c008000003890de8 T ipt_unregister_table_pre_exit        [ip_tables]<br>...<br><br>Perf calls function symbols__fixup_end() which sets the end of symbol<br>to 0xc008000003890000, which is the next address and this is the start<br>address of first module (icmp_checkentry in above) which will make the<br>huge symbol size of 0x80000010f0000.<br><br>After symbols__fixup_end:<br>symbols__fixup_end: sym->name: _end, sym->start: 0xc0000000027a0000,<br>sym->end: 0xc008000003890000<br><br>On powerpc, kernel text segment is located at 0xc000000000000000<br>whereas the modules are located at very high memory addresses,<br>0xc00800000xxxxxxx. Since the gap between end of kernel text segment<br>and beginning of first module's address is high, histogram allocation<br>using calloc fails.<br><br>Fix this by detecting the kernel's last symbol and limiting<br>the range of last kernel symbol to pagesize.<br></blockquote></blockquote><br>Patch looks good to me.<br><br>Tested-By: Kajol Jain<kjain@linux.ibm.com><br><br>Thanks,<br>Kajol Jain<br><blockquote type="cite"><blockquote type="cite"><br>Signed-off-by: Athira Rajeev<atrajeev@linux.vnet.ibm.com><br></blockquote><br>I can't test, but since the same approach works for arm and s390,<br>this also looks ok<br><br>Acked-by: Jiri Olsa <jolsa@redhat.com><br><br>thanks,<br>jirka<br></blockquote></blockquote><br>Hi Arnaldo,<br><br>Can you please help review this patch and merge if this looks good..<br><br>Thanks<br>Athira<br><br><blockquote type="cite"><blockquote type="cite"><br><blockquote type="cite">---<br>tools/perf/arch/powerpc/util/Build     |  1 +<br>tools/perf/arch/powerpc/util/machine.c | 24 ++++++++++++++++++++++++<br>2 files changed, 25 insertions(+)<br>create mode 100644 tools/perf/arch/powerpc/util/machine.c<br><br>diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build<br>index e86e210bf514..b7945e5a543b 100644<br>--- a/tools/perf/arch/powerpc/util/Build<br>+++ b/tools/perf/arch/powerpc/util/Build<br>@@ -1,4 +1,5 @@<br>perf-y += header.o<br>+perf-y += machine.o<br>perf-y += kvm-stat.o<br>perf-y += perf_regs.o<br>perf-y += mem-events.o<br>diff --git a/tools/perf/arch/powerpc/util/machine.c b/tools/perf/arch/powerpc/util/machine.c<br>new file mode 100644<br>index 000000000000..c30e5cc88c16<br>--- /dev/null<br>+++ b/tools/perf/arch/powerpc/util/machine.c<br>@@ -0,0 +1,24 @@<br>+// SPDX-License-Identifier: GPL-2.0<br>+<br>+#include <stdio.h><br>+#include <string.h><br>+#include <internal/lib.h> // page_size<br>+#include "debug.h"<br>+#include "symbol.h"<br>+<br>+/* On powerpc kernel text segment start at memory addresses, 0xc000000000000000<br>+ * whereas the modules are located at very high memory addresses,<br>+ * for example 0xc00800000xxxxxxx. The gap between end of kernel text segment<br>+ * and beginning of first module's text segment is very high.<br>+ * Therefore do not fill this gap and do not assign it to the kernel dso map.<br>+ */<br>+<br>+void arch__symbols__fixup_end(struct symbol *p, struct symbol *c)<br>+{<br>+<span class="Apple-tab-span" style="white-space:pre">    </span>if (strchr(p->name, '[') == NULL && strchr(c->name, '['))<br>+<span class="Apple-tab-span" style="white-space:pre">  </span><span class="Apple-tab-span" style="white-space:pre">    </span>/* Limit the range of last kernel symbol */<br>+<span class="Apple-tab-span" style="white-space:pre">      </span><span class="Apple-tab-span" style="white-space:pre">    </span>p->end += page_size;<br>+<span class="Apple-tab-span" style="white-space:pre">  </span>else<br>+<span class="Apple-tab-span" style="white-space:pre">     </span><span class="Apple-tab-span" style="white-space:pre">    </span>p->end = c->start;<br>+<span class="Apple-tab-span" style="white-space:pre"> </span>pr_debug4("%s sym:%s end:%#lx\n", __func__, p->name, p->end);<br>+}<br>-- <br>1.8.3.1<br></blockquote></blockquote></blockquote><br></div></body></html>