Re: [PATCH 1/3] soc: qcom: pmic_pdcharger_ulog: Search current directory for headers

From: Neil Armstrong
Date: Wed Dec 13 2023 - 05:23:21 EST


Hi Andrew,

On 12/12/2023 23:21, Andrew Halaney wrote:
On Tue, Dec 12, 2023 at 08:21:41PM +0100, Neil Armstrong wrote:
On 12/12/2023 17:52, Neil Armstrong wrote:
On 12/12/2023 17:15, Andrew Halaney wrote:
On Tue, Dec 12, 2023 at 09:54:48AM -0600, Andrew Halaney wrote:
On Tue, Dec 12, 2023 at 04:23:20PM +0100, Neil Armstrong wrote:
Hi Andrew,

On 06/12/2023 00:05, Andrew Halaney wrote:
As specified in samples/trace_events/Makefile:

      If you include a trace header outside of include/trace/events
      then the file that does the #define CREATE_TRACE_POINTS must
      have that tracer file in its main search path. This is because
      define_trace.h will include it, and must be able to find it from
      the include/trace directory.

Without this the following compilation error is seen:

        CC      drivers/soc/qcom/pmic_pdcharger_ulog.o
      In file included from drivers/soc/qcom/pmic_pdcharger_ulog.h:36,
                       from drivers/soc/qcom/pmic_pdcharger_ulog.c:15:
      ./include/trace/define_trace.h:95:42: fatal error: ./pmic_pdcharger_ulog.h: No such file or directory
         95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
            |                                          ^
      compilation terminated.

I never experienced such error, and no CI even reported it, can you explain how you got this ?

To be honest, I am unsure why I'm experiencing this (and until I saw
another thread about it today I thought maybe I had screwed something
up!).

I just took it as an opportunity to try and read up on the tracing
infrastructure and sent this series. Definitely no expertise with the
in's and out's of tracing :)

I'm able to reproduce this on next-20231211:

     ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] % ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make mrproper
     <snip>
     ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] % ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig
     <snip>
     *** Default configuration is based on 'defconfig'
     #
     # configuration written to .config
     #

Realized I missed a step, actually enabling tracing and the driver at
play here... but the result is the same.

Attached is a config where I hit this.

     130 ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] % ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make drivers/soc/qcom/pmic_pdcharger_ulog.o
       HOSTCC  scripts/dtc/dtc.o
     <snip>
       CC      drivers/soc/qcom/pmic_pdcharger_ulog.o
     In file included from drivers/soc/qcom/pmic_pdcharger_ulog.h:36,
             from drivers/soc/qcom/pmic_pdcharger_ulog.c:15:
     ./include/trace/define_trace.h:95:42: fatal error: ./pmic_pdcharger_ulog.h: No such file or directory
        95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
     <snip>
     2 ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] %

I even tried it in a fedora container with the above build commands and
the following podman invocation (plus some package installs) and saw the error:

     podman run -it -v ~/git/linux-next:/linux-next:z quay.io/fedora/fedora:latest /bin/bash

So I'm unsure if it's a fedora package version thing (which I'm running on my host)
or something else... Once I saw it was sort of spelled out in the
examples I referenced here I just decided it was something needed
fixing, regardless of why I'm hitting it while others seem ok.

Interesting, I don't get the problem with the same tag, same .config but with gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu

I'll try with gcc 13.

Ok tried with ARM's arm-gnu-toolchain-13.2.rel1-x86_64-aarch64-none-linux-gnu (https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads),
and no error, and I even tried with https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/13.2.0/ and same no error...

Hmm. I'm unsure what's up. I tried with a debian container and a fresh
clone and still saw it :/

If you want, something like (swap docker for podman if that's your
thing): podman run -it debian:latest /bin/bash
should let you reproduce after cloning etc.

I was able to reproduce it in fedora:latest:
CC [M] drivers/soc/qcom/pmic_pdcharger_ulog.o
In file included from drivers/soc/qcom/pmic_pdcharger_ulog.h:36,
from drivers/soc/qcom/pmic_pdcharger_ulog.c:15:
./include/trace/define_trace.h:95:42: fatal error: ./pmic_pdcharger_ulog.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^
and debian:latest:
CC [M] drivers/soc/qcom/pmic_pdcharger_ulog.o
In file included from drivers/soc/qcom/pmic_pdcharger_ulog.h:36,
from drivers/soc/qcom/pmic_pdcharger_ulog.c:15:
./include/trace/define_trace.h:95:42: fatal error: ./pmic_pdcharger_ulog.h: No such file or directory
95 | #include TRACE_INCLUDE(TRACE_INCLUDE_FILE)
| ^

But in my build setup I always build of of tree:

$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make O=$PWD/out/ drivers/soc/qcom/pmic_pdcharger_ulog.o
...
CC drivers/soc/qcom/pmic_pdcharger_ulog.o
make[1]: Leaving directory '/linux-next/out'

So why building out of tree works ? (likewise all CI builds out of tree)

Neil




Neil


Neil



Thanks,
Neil


Fixes: 086fdb48bc65 ("soc: qcom: add ADSP PDCharger ULOG driver")
Signed-off-by: Andrew Halaney <ahalaney@xxxxxxxxxx>
---
   drivers/soc/qcom/Makefile | 1 +
   1 file changed, 1 insertion(+)

diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile
index 110108e23669..05b3d54e8dc9 100644
--- a/drivers/soc/qcom/Makefile
+++ b/drivers/soc/qcom/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_QCOM_PDR_HELPERS)    += pdr_interface.o
   obj-$(CONFIG_QCOM_PMIC_GLINK)    += pmic_glink.o
   obj-$(CONFIG_QCOM_PMIC_GLINK)    += pmic_glink_altmode.o
   obj-$(CONFIG_QCOM_PMIC_PDCHARGER_ULOG)    += pmic_pdcharger_ulog.o
+CFLAGS_pmic_pdcharger_ulog.o    :=  -I$(src)
   obj-$(CONFIG_QCOM_QMI_HELPERS)    += qmi_helpers.o
   qmi_helpers-y    += qmi_encdec.o qmi_interface.o
   obj-$(CONFIG_QCOM_RAMP_CTRL)    += ramp_controller.o