Re: [PATCH V2 3/5] tools/perf: Add powerpc support for PERF_SAMPLE_WEIGHT_STRUCT
On 25-Mar-2021, at 1:13 AM, Jiri Olsa wrote:On Mon, Mar 22, 2021 at 10:57:25AM -0400, Athira Rajeev wrote:Add arch specific arch_evsel__set_sample_weight() to set the newsample type for powerpc.Add arch specific arch_perf_parse_sample_weight() to store thesample->weight values depending on the sample type applied.if the new sample type (PERF_SAMPLE_WEIGHT_STRUCT) is applied,store only the lower 32 bits to sample->weight. If sample typeis 'PERF_SAMPLE_WEIGHT', store the full 64-bit to sample->weight.Signed-off-by: Athira Rajeev ---tools/perf/arch/powerpc/util/Build | 2 ++tools/perf/arch/powerpc/util/event.c | 32 tools/perf/arch/powerpc/util/evsel.c | 8 3 files changed, 42 insertions(+)create mode 100644 tools/perf/arch/powerpc/util/event.ccreate mode 100644 tools/perf/arch/powerpc/util/evsel.cdiff --git a/tools/perf/arch/powerpc/util/Build b/tools/perf/arch/powerpc/util/Buildindex b7945e5a543b..8a79c4126e5b 100644--- a/tools/perf/arch/powerpc/util/Build+++ b/tools/perf/arch/powerpc/util/Build@@ -4,6 +4,8 @@ perf-y += kvm-stat.operf-y += perf_regs.operf-y += mem-events.operf-y += sym-handling.o+perf-y += evsel.o+perf-y += event.operf-$(CONFIG_DWARF) += dwarf-regs.operf-$(CONFIG_DWARF) += skip-callchain-idx.odiff --git a/tools/perf/arch/powerpc/util/event.c b/tools/perf/arch/powerpc/util/event.cnew file mode 100644index ..f49d32c2c8ae--- /dev/null+++ b/tools/perf/arch/powerpc/util/event.c@@ -0,0 +1,32 @@+// SPDX-License-Identifier: GPL-2.0+#include +#include +#include ++#include "../../../util/event.h"+#include "../../../util/synthetic-events.h"+#include "../../../util/machine.h"+#include "../../../util/tool.h"+#include "../../../util/map.h"+#include "../../../util/debug.h"nit, just #include "utils/...h" should work no?other than that, the patchset looks ok to meAcked-by: Jiri Olsa Hi Jiri, ArnaldoThanks for reviewing the patch set.I checked that, just using "utils/...h" also works.Below is the change which I verified. Since the patches are presently merged in https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/core, can you please suggest how can we go about this change ?diff --git a/tools/perf/arch/powerpc/util/event.c b/tools/perf/arch/powerpc/util/event.cindex 3bf441257466..c479d0a0e696 100644--- a/tools/perf/arch/powerpc/util/event.c+++ b/tools/perf/arch/powerpc/util/event.c@@ -3,12 +3,12 @@ #include #include -#include "../../../util/event.h"-#include "../../../util/synthetic-events.h"-#include "../../../util/machine.h"-#include "../../../util/tool.h"-#include "../../../util/map.h"-#include "../../../util/debug.h"+#include "util/event.h"+#include "util/synthetic-events.h"+#include "util/machine.h"+#include "util/tool.h"+#include "util/map.h"+#include "util/debug.h" void arch_perf_parse_sample_weight(struct perf_sample *data, const __u64 *array, u64 type)ThanksAthirathanks,jirka++void arch_perf_parse_sample_weight(struct perf_sample *data,+ const __u64 *array, u64 type)+{+ union perf_sample_weight weight;++ weight.full = *array;+ if (type & PERF_SAMPLE_WEIGHT)+ data->weight = weight.full;+ else+ data->weight = weight.var1_dw;+}++void arch_perf_synthesize_sample_weight(const struct perf_sample *data,+ __u64 *array, u64 type)+{+ *array = data->weight;++ if (type & PERF_SAMPLE_WEIGHT_STRUCT)+ *array &= 0x;+}diff --git a/tools/perf/arch/powerpc/util/evsel.c b/tools/perf/arch/powerpc/util/evsel.cnew file mode 100644index ..2f733cdc8dbb--- /dev/null+++ b/tools/perf/arch/powerpc/util/evsel.c@@ -0,0 +1,8 @@+// SPDX-License-Identifier: GPL-2.0+#include +#include "util/evsel.h"++void arch_evsel__set_sample_weight(struct evsel *evsel)+{+ evsel__set_sample_bit(evsel, WEIGHT_STRUCT);+}-- 1.8.3.1
Re: [PATCH V2 3/5] tools/perf: Add powerpc support for PERF_SAMPLE_WEIGHT_STRUCT
On March 26, 2021 12:23:04 PM GMT-03:00, Athira Rajeev wrote: > > >On 25-Mar-2021, at 1:13 AM, Jiri Olsa wrote: > >On Mon, Mar 22, 2021 at 10:57:25AM -0400, Athira Rajeev wrote: > >Add arch specific arch_evsel__set_sample_weight() to set the new >sample type for powerpc. > >Add arch specific arch_perf_parse_sample_weight() to store the >sample->weight values depending on the sample type applied. >if the new sample type (PERF_SAMPLE_WEIGHT_STRUCT) is applied, >store only the lower 32 bits to sample->weight. If sample type >is 'PERF_SAMPLE_WEIGHT', store the full 64-bit to sample->weight. > >Signed-off-by: Athira Rajeev >--- >tools/perf/arch/powerpc/util/Build | 2 ++ >tools/perf/arch/powerpc/util/event.c | 32 > >tools/perf/arch/powerpc/util/evsel.c | 8 >3 files changed, 42 insertions(+) >create mode 100644 tools/perf/arch/powerpc/util/event.c >create mode 100644 tools/perf/arch/powerpc/util/evsel.c > >diff --git a/tools/perf/arch/powerpc/util/Build >b/tools/perf/arch/powerpc/util/Build >index b7945e5a543b..8a79c4126e5b 100644 >--- a/tools/perf/arch/powerpc/util/Build >+++ b/tools/perf/arch/powerpc/util/Build >@@ -4,6 +4,8 @@ perf-y += kvm-stat.o >perf-y += perf_regs.o >perf-y += mem-events.o >perf-y += sym-handling.o >+perf-y += evsel.o >+perf-y += event.o > >perf-$(CONFIG_DWARF) += dwarf-regs.o >perf-$(CONFIG_DWARF) += skip-callchain-idx.o >diff --git a/tools/perf/arch/powerpc/util/event.c >b/tools/perf/arch/powerpc/util/event.c >new file mode 100644 >index ..f49d32c2c8ae >--- /dev/null >+++ b/tools/perf/arch/powerpc/util/event.c >@@ -0,0 +1,32 @@ >+// SPDX-License-Identifier: GPL-2.0 >+#include >+#include >+#include >+ >+#include "../../../util/event.h" >+#include "../../../util/synthetic-events.h" >+#include "../../../util/machine.h" >+#include "../../../util/tool.h" >+#include "../../../util/map.h" >+#include "../../../util/debug.h" > > >nit, just #include "utils/...h" should work no? > >other than that, the patchset looks ok to me > >Acked-by: Jiri Olsa > > > >Hi Jiri, Arnaldo > >Thanks for reviewing the patch set. >I checked that, just using "utils/...h" also works. >Below is the change which I verified. Since the patches are presently >merged in >https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/log/?h=tmp.perf/core, > >can you please suggest how can we go about this change ? I'll fix it up here, Thanks for the patch. - Arnaldo -- Sent from my Android device with K-9 Mail. Please excuse my brevity.
Re: [PATCH V2 3/5] tools/perf: Add powerpc support for PERF_SAMPLE_WEIGHT_STRUCT
On Mon, Mar 22, 2021 at 10:57:25AM -0400, Athira Rajeev wrote: > Add arch specific arch_evsel__set_sample_weight() to set the new > sample type for powerpc. > > Add arch specific arch_perf_parse_sample_weight() to store the > sample->weight values depending on the sample type applied. > if the new sample type (PERF_SAMPLE_WEIGHT_STRUCT) is applied, > store only the lower 32 bits to sample->weight. If sample type > is 'PERF_SAMPLE_WEIGHT', store the full 64-bit to sample->weight. > > Signed-off-by: Athira Rajeev > --- > tools/perf/arch/powerpc/util/Build | 2 ++ > tools/perf/arch/powerpc/util/event.c | 32 > tools/perf/arch/powerpc/util/evsel.c | 8 > 3 files changed, 42 insertions(+) > create mode 100644 tools/perf/arch/powerpc/util/event.c > create mode 100644 tools/perf/arch/powerpc/util/evsel.c > > diff --git a/tools/perf/arch/powerpc/util/Build > b/tools/perf/arch/powerpc/util/Build > index b7945e5a543b..8a79c4126e5b 100644 > --- a/tools/perf/arch/powerpc/util/Build > +++ b/tools/perf/arch/powerpc/util/Build > @@ -4,6 +4,8 @@ perf-y += kvm-stat.o > perf-y += perf_regs.o > perf-y += mem-events.o > perf-y += sym-handling.o > +perf-y += evsel.o > +perf-y += event.o > > perf-$(CONFIG_DWARF) += dwarf-regs.o > perf-$(CONFIG_DWARF) += skip-callchain-idx.o > diff --git a/tools/perf/arch/powerpc/util/event.c > b/tools/perf/arch/powerpc/util/event.c > new file mode 100644 > index ..f49d32c2c8ae > --- /dev/null > +++ b/tools/perf/arch/powerpc/util/event.c > @@ -0,0 +1,32 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#include > +#include > +#include > + > +#include "../../../util/event.h" > +#include "../../../util/synthetic-events.h" > +#include "../../../util/machine.h" > +#include "../../../util/tool.h" > +#include "../../../util/map.h" > +#include "../../../util/debug.h" nit, just #include "utils/...h" should work no? other than that, the patchset looks ok to me Acked-by: Jiri Olsa thanks, jirka > + > +void arch_perf_parse_sample_weight(struct perf_sample *data, > +const __u64 *array, u64 type) > +{ > + union perf_sample_weight weight; > + > + weight.full = *array; > + if (type & PERF_SAMPLE_WEIGHT) > + data->weight = weight.full; > + else > + data->weight = weight.var1_dw; > +} > + > +void arch_perf_synthesize_sample_weight(const struct perf_sample *data, > + __u64 *array, u64 type) > +{ > + *array = data->weight; > + > + if (type & PERF_SAMPLE_WEIGHT_STRUCT) > + *array &= 0x; > +} > diff --git a/tools/perf/arch/powerpc/util/evsel.c > b/tools/perf/arch/powerpc/util/evsel.c > new file mode 100644 > index ..2f733cdc8dbb > --- /dev/null > +++ b/tools/perf/arch/powerpc/util/evsel.c > @@ -0,0 +1,8 @@ > +// SPDX-License-Identifier: GPL-2.0 > +#include > +#include "util/evsel.h" > + > +void arch_evsel__set_sample_weight(struct evsel *evsel) > +{ > + evsel__set_sample_bit(evsel, WEIGHT_STRUCT); > +} > -- > 1.8.3.1 >