diff mbox series

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

Message ID 20231205-pmicpdcharger-ulog-fixups-v1-1-71c95162cb84@redhat.com
State Accepted
Commit 4d2b810f44f1c7b65d374b0128dabb15f1fd6c09
Headers show
Series [1/3] soc: qcom: pmic_pdcharger_ulog: Search current directory for headers | expand

Commit Message

Andrew Halaney Dec. 5, 2023, 11:05 p.m. UTC
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.

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

Comments

Andrew Halaney Dec. 12, 2023, 3:54 p.m. UTC | #1
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
    #
    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.

> 
> Thanks,
> Neil
> 
> > 
> > Fixes: 086fdb48bc65 ("soc: qcom: add ADSP PDCharger ULOG driver")
> > Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
> > ---
> >   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
> > 
>
Neil Armstrong Dec. 12, 2023, 4:52 p.m. UTC | #2
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.

Neil

>>
>>>
>>> Thanks,
>>> Neil
>>>
>>>>
>>>> Fixes: 086fdb48bc65 ("soc: qcom: add ADSP PDCharger ULOG driver")
>>>> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
>>>> ---
>>>>    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
>>>>
>>>
Neil Armstrong Dec. 12, 2023, 7:21 p.m. UTC | #3
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...

Neil

> 
> Neil
> 
>>>
>>>>
>>>> Thanks,
>>>> Neil
>>>>
>>>>>
>>>>> Fixes: 086fdb48bc65 ("soc: qcom: add ADSP PDCharger ULOG driver")
>>>>> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
>>>>> ---
>>>>>    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
>>>>>
>>>>
>
Neil Armstrong Dec. 13, 2023, 10:23 a.m. UTC | #4
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@redhat.com>
>>>>>>> ---
>>>>>>>     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
>>>>>>>
>>>>>>
>>>
>>
>
Neil Armstrong Dec. 13, 2023, 10:34 a.m. UTC | #5
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.
> 
> Fixes: 086fdb48bc65 ("soc: qcom: add ADSP PDCharger ULOG driver")
> Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
> ---
>   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
> 

I was able to reproduced it, and it only happens when we build in-tree, and checked
over the tree and indeed all the other trace drivers uses this flag to compile:

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks for the fix!

Neil
Andrew Halaney Dec. 13, 2023, 3:05 p.m. UTC | #6
On Wed, Dec 13, 2023 at 11:23:12AM +0100, Neil Armstrong wrote:
> 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)
> 

Thanks for poking around with that until reproducing!

Out of curiosity I did this to see that the out of tree does -I the current
directory when compiling (-d is probably not the best approach, but it worked):

    # Assume I did this for the failing in tree build as well, to /tmp/in-tree.txt
    # -d was the best thing I could find to make "make" be verbose enough...
    ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] % ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-  make -d O=$PWD/out/ drivers/soc/qcom/pmic_pdcharger_ulog.o &> /tmp/out-tree.txt
    ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] % grep -e "-I.\S*qcom" /tmp/in-tree.txt                                             :(
    ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] % grep -e "-I.\S*qcom" /tmp/out-tree.txt                                              :(
    set -e;  echo '  CC [M]  drivers/soc/qcom/pmic_pdcharger_ulog.o';   trap 'rm -f drivers/soc/qcom/pmic_pdcharger_ulog.o; trap - HUP; kill -s HUP $$' HUP;  trap 'rm -f drivers/soc/qcom/pmic_pdcharger_ulog.o; trap - INT; kill -s INT $$' INT;  trap 'rm -f drivers/soc/qcom/pmic_pdcharger_ulog.o; trap - QUIT; kill -s QUIT $$' QUIT;  trap 'rm -f drivers/soc/qcom/pmic_pdcharger_ulog.o; trap - TERM; kill -s TERM $$' TERM;  trap 'rm -f drivers/soc/qcom/pmic_pdcharger_ulog.o; trap - PIPE; kill -s PIPE $$' PIPE; aarch64-linux-gnu-gcc -Wp,-MMD,drivers/soc/qcom/.pmic_pdcharger_ulog.o.d -nostdinc -I../arch/arm64/include -I./arch/arm64/include/generated -I../include -I./include -I../arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi -I../include/uapi -I./include/generated/uapi -include ../include/linux/compiler-version.h -include ../include/linux/kconfig.h -include ../include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -DCC_USING_PATCHABLE_FUNCTION_ENTRY -DKASAN_SHADOW_SCALE_SHIFT= -fmacro-prefix-map=../= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mgeneral-regs-only -DCONFIG_CC_HAS_K_CONSTRAINT=1 -Wno-psabi -mabi=lp64 -fno-asynchronous-unwind-tables -fno-unwind-tables -mbranch-protection=pac-ret -Wa,-march=armv8.5-a -DARM64_ASM_ARCH='"armv8.5-a"' -DKASAN_SHADOW_SCALE_SHIFT= -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fpatchable-function-entry=4,2 -falign-functions=8 -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -fconserve-stack -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=2048 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -Wvla -Wno-pointer-sign -Wcast-function-type -Wstringop-overflow -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-restrict -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -g -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=1152 -I ../drivers/soc/qcom -I ./drivers/soc/qcom  -DMODULE  -DKBUILD_BASENAME='"pmic_pdcharger_ulog"' -DKBUILD_MODNAME='"pmic_pdcharger_ulog"' -D__KBUILD_MODNAME=kmod_pmic_pdcharger_ulog -c -o drivers/soc/qcom/pmic_pdcharger_ulog.o ../drivers/soc/qcom/pmic_pdcharger_ulog.c  ; scripts/basic/fixdep drivers/soc/qcom/.pmic_pdcharger_ulog.o.d drivers/soc/qcom/pmic_pdcharger_ulog.o 'aarch64-linux-gnu-gcc -Wp,-MMD,drivers/soc/qcom/.pmic_pdcharger_ulog.o.d -nostdinc -I../arch/arm64/include -I./arch/arm64/include/generated -I../include -I./include -I../arch/arm64/include/uapi -I./arch/arm64/include/generated/uapi -I../include/uapi -I./include/generated/uapi -include ../include/linux/compiler-version.h -include ../include/linux/kconfig.h -include ../include/linux/compiler_types.h -D__KERNEL__ -mlittle-endian -DCC_USING_PATCHABLE_FUNCTION_ENTRY -DKASAN_SHADOW_SCALE_SHIFT= -fmacro-prefix-map=../= -std=gnu11 -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -mgeneral-regs-only -DCONFIG_CC_HAS_K_CONSTRAINT=1 -Wno-psabi -mabi=lp64 -fno-asynchronous-unwind-tables -fno-unwind-tables -mbranch-protection=pac-ret -Wa,-march=armv8.5-a -DARM64_ASM_ARCH='\''"armv8.5-a"'\'' -DKASAN_SHADOW_SCALE_SHIFT= -fno-delete-null-pointer-checks -O2 -fno-allow-store-data-races -fstack-protector-strong -fno-omit-frame-pointer -fno-optimize-sibling-calls -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fpatchable-function-entry=4,2 -falign-functions=8 -fstrict-flex-arrays=3 -fno-strict-overflow -fno-stack-check -fconserve-stack -Wall -Wundef -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Werror=strict-prototypes -Wno-format-security -Wno-trigraphs -Wno-frame-address -Wno-address-of-packed-member -Wmissing-declarations -Wmissing-prototypes -Wframe-larger-than=2048 -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -Wvla -Wno-pointer-sign -Wcast-function-type -Wstringop-overflow -Wno-array-bounds -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wenum-conversion -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-restrict -Wno-packed-not-aligned -Wno-format-overflow -Wno-format-truncation -Wno-stringop-truncation -Wno-missing-field-initializers -Wno-type-limits -Wno-shift-negative-value -Wno-maybe-uninitialized -Wno-sign-compare -g -mstack-protector-guard=sysreg -mstack-protector-guard-reg=sp_el0 -mstack-protector-guard-offset=1152 -I ../drivers/soc/qcom -I ./drivers/soc/qcom  -DMODULE  -DKBUILD_BASENAME='\''"pmic_pdcharger_ulog"'\'' -DKBUILD_MODNAME='\''"pmic_pdcharger_ulog"'\'' -D__KBUILD_MODNAME=kmod_pmic_pdcharger_ulog -c -o drivers/soc/qcom/pmic_pdcharger_ulog.o ../drivers/soc/qcom/pmic_pdcharger_ulog.c  ' > drivers/soc/qcom/.pmic_pdcharger_ulog.o.cmd; rm -f drivers/soc/qcom/.pmic_pdcharger_ulog.o.d
    ahalaney@fedora ~/git/linux-next (git)-[b4/b4-stmmac-handle-mdio-enodev] %

I guess that makes sense, out of tree builds would need to include the local
folder to grab local headers when compiling in the new working directory,
whereas in tree works in the current directory so that's not a necessary
inclusion by default (but is in this case for tracing purposes).
diff mbox series

Patch

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