<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 25-Mar-2021, at 1:13 AM, Jiri Olsa <jolsa@redhat.com> wrote:<br><br>On Mon, Mar 22, 2021 at 10:57:25AM -0400, Athira Rajeev wrote:<br><blockquote type="cite">Add arch specific arch_evsel__set_sample_weight() to set the new<br>sample type for powerpc.<br><br>Add arch specific arch_perf_parse_sample_weight() to store the<br>sample->weight values depending on the sample type applied.<br>if the new sample type (PERF_SAMPLE_WEIGHT_STRUCT) is applied,<br>store only the lower 32 bits to sample->weight. If sample type<br>is 'PERF_SAMPLE_WEIGHT', store the full 64-bit to sample->weight.<br><br>Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com><br>---<br>tools/perf/arch/powerpc/util/Build   |  2 ++<br>tools/perf/arch/powerpc/util/event.c | 32 ++++++++++++++++++++++++++++++++<br>tools/perf/arch/powerpc/util/evsel.c |  8 ++++++++<br>3 files changed, 42 insertions(+)<br>create mode 100644 tools/perf/arch/powerpc/util/event.c<br>create mode 100644 tools/perf/arch/powerpc/util/evsel.c<br><br>diff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Build<br>index b7945e5a543b..8a79c4126e5b 100644<br>--- a/tools/perf/arch/powerpc/util/Build<br>+++ b/tools/perf/arch/powerpc/util/Build<br>@@ -4,6 +4,8 @@ perf-y += kvm-stat.o<br>perf-y += perf_regs.o<br>perf-y += mem-events.o<br>perf-y += sym-handling.o<br>+perf-y += evsel.o<br>+perf-y += event.o<br><br>perf-$(CONFIG_DWARF) += dwarf-regs.o<br>perf-$(CONFIG_DWARF) += skip-callchain-idx.o<br>diff --git a/tools/perf/arch/powerpc/util/event.c b/tools/perf/arch/powerpc/util/event.c<br>new file mode 100644<br>index 000000000000..f49d32c2c8ae<br>--- /dev/null<br>+++ b/tools/perf/arch/powerpc/util/event.c<br>@@ -0,0 +1,32 @@<br>+// SPDX-License-Identifier: GPL-2.0<br>+#include <linux/types.h><br>+#include <linux/string.h><br>+#include <linux/zalloc.h><br>+<br>+#include "../../../util/event.h"<br>+#include "../../../util/synthetic-events.h"<br>+#include "../../../util/machine.h"<br>+#include "../../../util/tool.h"<br>+#include "../../../util/map.h"<br>+#include "../../../util/debug.h"<br></blockquote><br>nit, just #include "utils/...h" should work no?<br><br>other than that, the patchset looks ok to me<br><br>Acked-by: Jiri Olsa <jolsa@redhat.com><br></blockquote><br><br>Hi Jiri, Arnaldo<br><br>Thanks for reviewing the patch set.<br>I checked that, just using "utils/...h" also works.<br>Below is the change which I verified. Since the patches are presently merged in <br>https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/core, <br>can you please suggest how can we go about this change ?<br><br>diff --git a/tools/perf/arch/powerpc/util/event.c b/tools/perf/arch/powerpc/util/event.c<br>index 3bf441257466..c479d0a0e696 100644<br>--- a/tools/perf/arch/powerpc/util/event.c<br>+++ b/tools/perf/arch/powerpc/util/event.c<br>@@ -3,12 +3,12 @@<br> #include <linux/string.h><br> #include <linux/zalloc.h><br><br>-#include "../../../util/event.h"<br>-#include "../../../util/synthetic-events.h"<br>-#include "../../../util/machine.h"<br>-#include "../../../util/tool.h"<br>-#include "../../../util/map.h"<br>-#include "../../../util/debug.h"<br>+#include "util/event.h"<br>+#include "util/synthetic-events.h"<br>+#include "util/machine.h"<br>+#include "util/tool.h"<br>+#include "util/map.h"<br>+#include "util/debug.h"<br><br> void arch_perf_parse_sample_weight(struct perf_sample *data,<br> <span class="Apple-tab-span" style="white-space:pre">     </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>   const __u64 *array, u64 type)<br><br><br>Thanks<br>Athira<br><br><blockquote type="cite"><br>thanks,<br>jirka<br><br><blockquote type="cite">+<br>+void arch_perf_parse_sample_weight(struct perf_sample *data,<br>+<span class="Apple-tab-span" style="white-space:pre">   </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>   const __u64 *array, u64 type)<br>+{<br>+<span class="Apple-tab-span" style="white-space:pre">   </span>union perf_sample_weight weight;<br>+<br>+<span class="Apple-tab-span" style="white-space:pre">      </span>weight.full = *array;<br>+<span class="Apple-tab-span" style="white-space:pre">    </span>if (type & PERF_SAMPLE_WEIGHT)<br>+<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span>data->weight = weight.full;<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>data->weight = weight.var1_dw;<br>+}<br>+<br>+void arch_perf_synthesize_sample_weight(const struct perf_sample *data,<br>+<span class="Apple-tab-span" style="white-space:pre">       </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span><span class="Apple-tab-span" style="white-space:pre">    </span>__u64 *array, u64 type)<br>+{<br>+<span class="Apple-tab-span" style="white-space:pre">      </span>*array = data->weight;<br>+<br>+<span class="Apple-tab-span" style="white-space:pre">     </span>if (type & PERF_SAMPLE_WEIGHT_STRUCT)<br>+<span class="Apple-tab-span" style="white-space:pre">        </span><span class="Apple-tab-span" style="white-space:pre">    </span>*array &= 0xffffffff;<br>+}<br>diff --git a/tools/perf/arch/powerpc/util/evsel.c b/tools/perf/arch/powerpc/util/evsel.c<br>new file mode 100644<br>index 000000000000..2f733cdc8dbb<br>--- /dev/null<br>+++ b/tools/perf/arch/powerpc/util/evsel.c<br>@@ -0,0 +1,8 @@<br>+// SPDX-License-Identifier: GPL-2.0<br>+#include <stdio.h><br>+#include "util/evsel.h"<br>+<br>+void arch_evsel__set_sample_weight(struct evsel *evsel)<br>+{<br>+<span class="Apple-tab-span" style="white-space:pre">        </span>evsel__set_sample_bit(evsel, WEIGHT_STRUCT);<br>+}<br>-- <br>1.8.3.1<br></blockquote></blockquote><br></div></body></html>