Message ID | 20210504191227.793712-1-irogers@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | perf arm: Fix off-by-one directory paths. | expand |
Hi Ian, On Tue, May 4, 2021 at 12:12 PM Ian Rogers <irogers@google.com> wrote: > > Relative path include works in the regular build due to -I paths but may > fail in other situations. Right, can we simply change them all to have a relative path from the $(srctree)/tools/perf ? I think it'd be cleaner and easier to maintain. Thanks, Namhyung > > Signed-off-by: Ian Rogers <irogers@google.com> > --- > tools/perf/arch/arm/util/auxtrace.c | 8 +++---- > tools/perf/arch/arm/util/cs-etm.c | 24 ++++++++++----------- > tools/perf/arch/arm/util/perf_regs.c | 2 +- > tools/perf/arch/arm/util/pmu.c | 2 +- > tools/perf/arch/arm/util/unwind-libdw.c | 6 +++--- > tools/perf/arch/arm/util/unwind-libunwind.c | 4 ++-- > 6 files changed, 23 insertions(+), 23 deletions(-) > > diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c > index b187bddbd01a..7ed57222465e 100644 > --- a/tools/perf/arch/arm/util/auxtrace.c > +++ b/tools/perf/arch/arm/util/auxtrace.c > @@ -8,10 +8,10 @@ > #include <linux/coresight-pmu.h> > #include <linux/zalloc.h> > > -#include "../../util/auxtrace.h" > -#include "../../util/debug.h" > -#include "../../util/evlist.h" > -#include "../../util/pmu.h" > +#include "../../../util/auxtrace.h" > +#include "../../../util/debug.h" > +#include "../../../util/evlist.h" > +#include "../../../util/pmu.h" > #include "cs-etm.h" > #include "arm-spe.h" > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > index d942f118d32c..67c7fb8d7eb0 100644 > --- a/tools/perf/arch/arm/util/cs-etm.c > +++ b/tools/perf/arch/arm/util/cs-etm.c > @@ -16,19 +16,19 @@ > #include <linux/zalloc.h> > > #include "cs-etm.h" > -#include "../../util/debug.h" > -#include "../../util/record.h" > -#include "../../util/auxtrace.h" > -#include "../../util/cpumap.h" > -#include "../../util/event.h" > -#include "../../util/evlist.h" > -#include "../../util/evsel.h" > -#include "../../util/perf_api_probe.h" > -#include "../../util/evsel_config.h" > -#include "../../util/pmu.h" > -#include "../../util/cs-etm.h" > +#include "../../../util/debug.h" > +#include "../../../util/record.h" > +#include "../../../util/auxtrace.h" > +#include "../../../util/cpumap.h" > +#include "../../../util/event.h" > +#include "../../../util/evlist.h" > +#include "../../../util/evsel.h" > +#include "../../../util/perf_api_probe.h" > +#include "../../../util/evsel_config.h" > +#include "../../../util/pmu.h" > +#include "../../../util/cs-etm.h" > #include <internal/lib.h> // page_size > -#include "../../util/session.h" > +#include "../../../util/session.h" > > #include <errno.h> > #include <stdlib.h> > diff --git a/tools/perf/arch/arm/util/perf_regs.c b/tools/perf/arch/arm/util/perf_regs.c > index 2864e2e3776d..2833e101a7c6 100644 > --- a/tools/perf/arch/arm/util/perf_regs.c > +++ b/tools/perf/arch/arm/util/perf_regs.c > @@ -1,5 +1,5 @@ > // SPDX-License-Identifier: GPL-2.0 > -#include "../../util/perf_regs.h" > +#include "../../../util/perf_regs.h" > > const struct sample_reg sample_reg_masks[] = { > SMPL_REG_END > diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c > index bbc297a7e2e3..b8b23b9dc598 100644 > --- a/tools/perf/arch/arm/util/pmu.c > +++ b/tools/perf/arch/arm/util/pmu.c > @@ -10,7 +10,7 @@ > #include <linux/string.h> > > #include "arm-spe.h" > -#include "../../util/pmu.h" > +#include "../../../util/pmu.h" > > struct perf_event_attr > *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) > diff --git a/tools/perf/arch/arm/util/unwind-libdw.c b/tools/perf/arch/arm/util/unwind-libdw.c > index 36ba4c69c3c5..b7692cb0c733 100644 > --- a/tools/perf/arch/arm/util/unwind-libdw.c > +++ b/tools/perf/arch/arm/util/unwind-libdw.c > @@ -1,8 +1,8 @@ > // SPDX-License-Identifier: GPL-2.0 > #include <elfutils/libdwfl.h> > -#include "../../util/unwind-libdw.h" > -#include "../../util/perf_regs.h" > -#include "../../util/event.h" > +#include "../../../util/unwind-libdw.h" > +#include "../../../util/perf_regs.h" > +#include "../../../util/event.h" > > bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) > { > diff --git a/tools/perf/arch/arm/util/unwind-libunwind.c b/tools/perf/arch/arm/util/unwind-libunwind.c > index 3a550225dfaf..438906bf0014 100644 > --- a/tools/perf/arch/arm/util/unwind-libunwind.c > +++ b/tools/perf/arch/arm/util/unwind-libunwind.c > @@ -3,8 +3,8 @@ > #include <errno.h> > #include <libunwind.h> > #include "perf_regs.h" > -#include "../../util/unwind.h" > -#include "../../util/debug.h" > +#include "../../../util/unwind.h" > +#include "../../../util/debug.h" > > int libunwind__arch_reg_id(int regnum) > { > -- > 2.31.1.607.g51e8a6a459-goog >
On Tue, May 4, 2021 at 12:43 PM Namhyung Kim <namhyung@kernel.org> wrote: > > Hi Ian, > > On Tue, May 4, 2021 at 12:12 PM Ian Rogers <irogers@google.com> wrote: > > > > Relative path include works in the regular build due to -I paths but may > > fail in other situations. > > Right, can we simply change them all to have a relative path from the > $(srctree)/tools/perf ? I think it'd be cleaner and easier to maintain. It'd be a larger change but I agree it would be cleaner. I had a related problem here: https://lore.kernel.org/lkml/20210307223024.4081067-1-irogers@google.com/ Relying less on include path order, especially confusing in the ARM vs ARM64 case where both arch directories are necessary, and on linker tricks like weak I think would make the build cleaner and easier to understand. Not calling C and header files the same name would also I think reduce confusion. The cost would likely be more #ifs. Given that is a larger refactor I think we can merge this while working out a better plan. Thanks, Ian > Thanks, > Namhyung > > > > > Signed-off-by: Ian Rogers <irogers@google.com> > > --- > > tools/perf/arch/arm/util/auxtrace.c | 8 +++---- > > tools/perf/arch/arm/util/cs-etm.c | 24 ++++++++++----------- > > tools/perf/arch/arm/util/perf_regs.c | 2 +- > > tools/perf/arch/arm/util/pmu.c | 2 +- > > tools/perf/arch/arm/util/unwind-libdw.c | 6 +++--- > > tools/perf/arch/arm/util/unwind-libunwind.c | 4 ++-- > > 6 files changed, 23 insertions(+), 23 deletions(-) > > > > diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c > > index b187bddbd01a..7ed57222465e 100644 > > --- a/tools/perf/arch/arm/util/auxtrace.c > > +++ b/tools/perf/arch/arm/util/auxtrace.c > > @@ -8,10 +8,10 @@ > > #include <linux/coresight-pmu.h> > > #include <linux/zalloc.h> > > > > -#include "../../util/auxtrace.h" > > -#include "../../util/debug.h" > > -#include "../../util/evlist.h" > > -#include "../../util/pmu.h" > > +#include "../../../util/auxtrace.h" > > +#include "../../../util/debug.h" > > +#include "../../../util/evlist.h" > > +#include "../../../util/pmu.h" > > #include "cs-etm.h" > > #include "arm-spe.h" > > > > diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c > > index d942f118d32c..67c7fb8d7eb0 100644 > > --- a/tools/perf/arch/arm/util/cs-etm.c > > +++ b/tools/perf/arch/arm/util/cs-etm.c > > @@ -16,19 +16,19 @@ > > #include <linux/zalloc.h> > > > > #include "cs-etm.h" > > -#include "../../util/debug.h" > > -#include "../../util/record.h" > > -#include "../../util/auxtrace.h" > > -#include "../../util/cpumap.h" > > -#include "../../util/event.h" > > -#include "../../util/evlist.h" > > -#include "../../util/evsel.h" > > -#include "../../util/perf_api_probe.h" > > -#include "../../util/evsel_config.h" > > -#include "../../util/pmu.h" > > -#include "../../util/cs-etm.h" > > +#include "../../../util/debug.h" > > +#include "../../../util/record.h" > > +#include "../../../util/auxtrace.h" > > +#include "../../../util/cpumap.h" > > +#include "../../../util/event.h" > > +#include "../../../util/evlist.h" > > +#include "../../../util/evsel.h" > > +#include "../../../util/perf_api_probe.h" > > +#include "../../../util/evsel_config.h" > > +#include "../../../util/pmu.h" > > +#include "../../../util/cs-etm.h" > > #include <internal/lib.h> // page_size > > -#include "../../util/session.h" > > +#include "../../../util/session.h" > > > > #include <errno.h> > > #include <stdlib.h> > > diff --git a/tools/perf/arch/arm/util/perf_regs.c b/tools/perf/arch/arm/util/perf_regs.c > > index 2864e2e3776d..2833e101a7c6 100644 > > --- a/tools/perf/arch/arm/util/perf_regs.c > > +++ b/tools/perf/arch/arm/util/perf_regs.c > > @@ -1,5 +1,5 @@ > > // SPDX-License-Identifier: GPL-2.0 > > -#include "../../util/perf_regs.h" > > +#include "../../../util/perf_regs.h" > > > > const struct sample_reg sample_reg_masks[] = { > > SMPL_REG_END > > diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c > > index bbc297a7e2e3..b8b23b9dc598 100644 > > --- a/tools/perf/arch/arm/util/pmu.c > > +++ b/tools/perf/arch/arm/util/pmu.c > > @@ -10,7 +10,7 @@ > > #include <linux/string.h> > > > > #include "arm-spe.h" > > -#include "../../util/pmu.h" > > +#include "../../../util/pmu.h" > > > > struct perf_event_attr > > *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) > > diff --git a/tools/perf/arch/arm/util/unwind-libdw.c b/tools/perf/arch/arm/util/unwind-libdw.c > > index 36ba4c69c3c5..b7692cb0c733 100644 > > --- a/tools/perf/arch/arm/util/unwind-libdw.c > > +++ b/tools/perf/arch/arm/util/unwind-libdw.c > > @@ -1,8 +1,8 @@ > > // SPDX-License-Identifier: GPL-2.0 > > #include <elfutils/libdwfl.h> > > -#include "../../util/unwind-libdw.h" > > -#include "../../util/perf_regs.h" > > -#include "../../util/event.h" > > +#include "../../../util/unwind-libdw.h" > > +#include "../../../util/perf_regs.h" > > +#include "../../../util/event.h" > > > > bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) > > { > > diff --git a/tools/perf/arch/arm/util/unwind-libunwind.c b/tools/perf/arch/arm/util/unwind-libunwind.c > > index 3a550225dfaf..438906bf0014 100644 > > --- a/tools/perf/arch/arm/util/unwind-libunwind.c > > +++ b/tools/perf/arch/arm/util/unwind-libunwind.c > > @@ -3,8 +3,8 @@ > > #include <errno.h> > > #include <libunwind.h> > > #include "perf_regs.h" > > -#include "../../util/unwind.h" > > -#include "../../util/debug.h" > > +#include "../../../util/unwind.h" > > +#include "../../../util/debug.h" > > > > int libunwind__arch_reg_id(int regnum) > > { > > -- > > 2.31.1.607.g51e8a6a459-goog > >
diff --git a/tools/perf/arch/arm/util/auxtrace.c b/tools/perf/arch/arm/util/auxtrace.c index b187bddbd01a..7ed57222465e 100644 --- a/tools/perf/arch/arm/util/auxtrace.c +++ b/tools/perf/arch/arm/util/auxtrace.c @@ -8,10 +8,10 @@ #include <linux/coresight-pmu.h> #include <linux/zalloc.h> -#include "../../util/auxtrace.h" -#include "../../util/debug.h" -#include "../../util/evlist.h" -#include "../../util/pmu.h" +#include "../../../util/auxtrace.h" +#include "../../../util/debug.h" +#include "../../../util/evlist.h" +#include "../../../util/pmu.h" #include "cs-etm.h" #include "arm-spe.h" diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c index d942f118d32c..67c7fb8d7eb0 100644 --- a/tools/perf/arch/arm/util/cs-etm.c +++ b/tools/perf/arch/arm/util/cs-etm.c @@ -16,19 +16,19 @@ #include <linux/zalloc.h> #include "cs-etm.h" -#include "../../util/debug.h" -#include "../../util/record.h" -#include "../../util/auxtrace.h" -#include "../../util/cpumap.h" -#include "../../util/event.h" -#include "../../util/evlist.h" -#include "../../util/evsel.h" -#include "../../util/perf_api_probe.h" -#include "../../util/evsel_config.h" -#include "../../util/pmu.h" -#include "../../util/cs-etm.h" +#include "../../../util/debug.h" +#include "../../../util/record.h" +#include "../../../util/auxtrace.h" +#include "../../../util/cpumap.h" +#include "../../../util/event.h" +#include "../../../util/evlist.h" +#include "../../../util/evsel.h" +#include "../../../util/perf_api_probe.h" +#include "../../../util/evsel_config.h" +#include "../../../util/pmu.h" +#include "../../../util/cs-etm.h" #include <internal/lib.h> // page_size -#include "../../util/session.h" +#include "../../../util/session.h" #include <errno.h> #include <stdlib.h> diff --git a/tools/perf/arch/arm/util/perf_regs.c b/tools/perf/arch/arm/util/perf_regs.c index 2864e2e3776d..2833e101a7c6 100644 --- a/tools/perf/arch/arm/util/perf_regs.c +++ b/tools/perf/arch/arm/util/perf_regs.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0 -#include "../../util/perf_regs.h" +#include "../../../util/perf_regs.h" const struct sample_reg sample_reg_masks[] = { SMPL_REG_END diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c index bbc297a7e2e3..b8b23b9dc598 100644 --- a/tools/perf/arch/arm/util/pmu.c +++ b/tools/perf/arch/arm/util/pmu.c @@ -10,7 +10,7 @@ #include <linux/string.h> #include "arm-spe.h" -#include "../../util/pmu.h" +#include "../../../util/pmu.h" struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __maybe_unused) diff --git a/tools/perf/arch/arm/util/unwind-libdw.c b/tools/perf/arch/arm/util/unwind-libdw.c index 36ba4c69c3c5..b7692cb0c733 100644 --- a/tools/perf/arch/arm/util/unwind-libdw.c +++ b/tools/perf/arch/arm/util/unwind-libdw.c @@ -1,8 +1,8 @@ // SPDX-License-Identifier: GPL-2.0 #include <elfutils/libdwfl.h> -#include "../../util/unwind-libdw.h" -#include "../../util/perf_regs.h" -#include "../../util/event.h" +#include "../../../util/unwind-libdw.h" +#include "../../../util/perf_regs.h" +#include "../../../util/event.h" bool libdw__arch_set_initial_registers(Dwfl_Thread *thread, void *arg) { diff --git a/tools/perf/arch/arm/util/unwind-libunwind.c b/tools/perf/arch/arm/util/unwind-libunwind.c index 3a550225dfaf..438906bf0014 100644 --- a/tools/perf/arch/arm/util/unwind-libunwind.c +++ b/tools/perf/arch/arm/util/unwind-libunwind.c @@ -3,8 +3,8 @@ #include <errno.h> #include <libunwind.h> #include "perf_regs.h" -#include "../../util/unwind.h" -#include "../../util/debug.h" +#include "../../../util/unwind.h" +#include "../../../util/debug.h" int libunwind__arch_reg_id(int regnum) {
Relative path include works in the regular build due to -I paths but may fail in other situations. Signed-off-by: Ian Rogers <irogers@google.com> --- tools/perf/arch/arm/util/auxtrace.c | 8 +++---- tools/perf/arch/arm/util/cs-etm.c | 24 ++++++++++----------- tools/perf/arch/arm/util/perf_regs.c | 2 +- tools/perf/arch/arm/util/pmu.c | 2 +- tools/perf/arch/arm/util/unwind-libdw.c | 6 +++--- tools/perf/arch/arm/util/unwind-libunwind.c | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-)