2019-03-29 17:47:04

by Nick Desaulniers

[permalink] [raw]
Subject: [PATCH] gcov: include linux/module.h for within_module

Fixes commit 8c3d220cb6b5 ("gcov: clang support")

Cc: Greg Hackmann <[email protected]>
Cc: Tri Vo <[email protected]>
Cc: Peter Oberparleiter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reported-by: kbuild test robot <[email protected]>
Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
Signed-off-by: Nick Desaulniers <[email protected]>
---
kernel/gcov/gcc_3_4.c | 1 +
kernel/gcov/gcc_4_7.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
index 801ee4b0b969..0eda59ef57df 100644
--- a/kernel/gcov/gcc_3_4.c
+++ b/kernel/gcov/gcc_3_4.c
@@ -16,6 +16,7 @@
*/

#include <linux/errno.h>
+#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/seq_file.h>
diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
index ec37563674d6..677851284fe2 100644
--- a/kernel/gcov/gcc_4_7.c
+++ b/kernel/gcov/gcc_4_7.c
@@ -13,6 +13,7 @@
*/

#include <linux/errno.h>
+#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/seq_file.h>
--
2.21.0.392.gf8f6787159e-goog



2019-03-29 18:02:16

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] gcov: include linux/module.h for within_module

On 3/29/19 10:45 AM, Nick Desaulniers wrote:
> Fixes commit 8c3d220cb6b5 ("gcov: clang support")
>
> Cc: Greg Hackmann <[email protected]>
> Cc: Tri Vo <[email protected]>
> Cc: Peter Oberparleiter <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Reported-by: kbuild test robot <[email protected]>
> Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
> Signed-off-by: Nick Desaulniers <[email protected]>

Reported-by: Randy Dunlap <[email protected]>
see https://lore.kernel.org/linux-mm/20190328225107.ULwYw%[email protected]/T/#mee26c00158574326e807480fc39dfcbd7bebd5fd

Did you test this? kernel/gcov/gcc_4_7.c includes local "gcov.h",
which includes <linux/module.h>, so why didn't that work or why
does this patch work?

thanks.

> ---
> kernel/gcov/gcc_3_4.c | 1 +
> kernel/gcov/gcc_4_7.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
> index 801ee4b0b969..0eda59ef57df 100644
> --- a/kernel/gcov/gcc_3_4.c
> +++ b/kernel/gcov/gcc_3_4.c
> @@ -16,6 +16,7 @@
> */
>
> #include <linux/errno.h>
> +#include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/string.h>
> #include <linux/seq_file.h>
> diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
> index ec37563674d6..677851284fe2 100644
> --- a/kernel/gcov/gcc_4_7.c
> +++ b/kernel/gcov/gcc_4_7.c
> @@ -13,6 +13,7 @@
> */
>
> #include <linux/errno.h>
> +#include <linux/module.h>
> #include <linux/slab.h>
> #include <linux/string.h>
> #include <linux/seq_file.h>
>


--
~Randy

2019-03-29 18:09:09

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] gcov: include linux/module.h for within_module

On 3/29/19 11:01 AM, Randy Dunlap wrote:
> On 3/29/19 10:45 AM, Nick Desaulniers wrote:
>> Fixes commit 8c3d220cb6b5 ("gcov: clang support")
>>
>> Cc: Greg Hackmann <[email protected]>
>> Cc: Tri Vo <[email protected]>
>> Cc: Peter Oberparleiter <[email protected]>
>> Cc: [email protected]
>> Cc: [email protected]
>> Reported-by: kbuild test robot <[email protected]>
>> Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
>> Signed-off-by: Nick Desaulniers <[email protected]>
>
> Reported-by: Randy Dunlap <[email protected]>
> see https://lore.kernel.org/linux-mm/20190328225107.ULwYw%[email protected]/T/#mee26c00158574326e807480fc39dfcbd7bebd5fd
>
> Did you test this? kernel/gcov/gcc_4_7.c includes local "gcov.h",
> which includes <linux/module.h>, so why didn't that work or why
> does this patch work?

No, this patch does not fix the build error for me.

> thanks.
>
>> ---
>> kernel/gcov/gcc_3_4.c | 1 +
>> kernel/gcov/gcc_4_7.c | 1 +
>> 2 files changed, 2 insertions(+)
>>
>> diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
>> index 801ee4b0b969..0eda59ef57df 100644
>> --- a/kernel/gcov/gcc_3_4.c
>> +++ b/kernel/gcov/gcc_3_4.c
>> @@ -16,6 +16,7 @@
>> */
>>
>> #include <linux/errno.h>
>> +#include <linux/module.h>
>> #include <linux/slab.h>
>> #include <linux/string.h>
>> #include <linux/seq_file.h>
>> diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
>> index ec37563674d6..677851284fe2 100644
>> --- a/kernel/gcov/gcc_4_7.c
>> +++ b/kernel/gcov/gcc_4_7.c
>> @@ -13,6 +13,7 @@
>> */
>>
>> #include <linux/errno.h>
>> +#include <linux/module.h>
>> #include <linux/slab.h>
>> #include <linux/string.h>
>> #include <linux/seq_file.h>
>>
>
>


--
~Randy

2019-03-29 18:10:41

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH] gcov: include linux/module.h for within_module

On Fri, Mar 29, 2019 at 11:01 AM Randy Dunlap <[email protected]> wrote:
>
> On 3/29/19 10:45 AM, Nick Desaulniers wrote:
> > Fixes commit 8c3d220cb6b5 ("gcov: clang support")
> >
> > Cc: Greg Hackmann <[email protected]>
> > Cc: Tri Vo <[email protected]>
> > Cc: Peter Oberparleiter <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Reported-by: kbuild test robot <[email protected]>
> > Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
> > Signed-off-by: Nick Desaulniers <[email protected]>
>
> Reported-by: Randy Dunlap <[email protected]>
> see https://lore.kernel.org/linux-mm/20190328225107.ULwYw%[email protected]/T/#mee26c00158574326e807480fc39dfcbd7bebd5fd
>
> Did you test this?

Yes, built with gcc 7.3 and
defconfig
+
CONFIG_GCOV_KERNEL=y
CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
CONFIG_GCOV_FORMAT_4_7=y

> kernel/gcov/gcc_4_7.c includes local "gcov.h",
> which includes <linux/module.h>, so why didn't that work or why
> does this patch work?

Good point. May be something in the configs from 0-day bot. Boarding
a plane for Bangkok, but can dig further once landed.

Maybe module support was disabled?

--
Thanks,
~Nick Desaulniers

2019-03-29 18:13:04

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH] gcov: include linux/module.h for within_module

On 3/29/19 11:09 AM, Nick Desaulniers wrote:
> On Fri, Mar 29, 2019 at 11:01 AM Randy Dunlap <[email protected]> wrote:
>>
>> On 3/29/19 10:45 AM, Nick Desaulniers wrote:
>>> Fixes commit 8c3d220cb6b5 ("gcov: clang support")
>>>
>>> Cc: Greg Hackmann <[email protected]>
>>> Cc: Tri Vo <[email protected]>
>>> Cc: Peter Oberparleiter <[email protected]>
>>> Cc: [email protected]
>>> Cc: [email protected]
>>> Reported-by: kbuild test robot <[email protected]>
>>> Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
>>> Signed-off-by: Nick Desaulniers <[email protected]>
>>
>> Reported-by: Randy Dunlap <[email protected]>
>> see https://lore.kernel.org/linux-mm/20190328225107.ULwYw%[email protected]/T/#mee26c00158574326e807480fc39dfcbd7bebd5fd
>>
>> Did you test this?
>
> Yes, built with gcc 7.3 and
> defconfig
> +
> CONFIG_GCOV_KERNEL=y
> CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y
> CONFIG_GCOV_FORMAT_4_7=y
>
>> kernel/gcov/gcc_4_7.c includes local "gcov.h",
>> which includes <linux/module.h>, so why didn't that work or why
>> does this patch work?
>
> Good point. May be something in the configs from 0-day bot. Boarding
> a plane for Bangkok, but can dig further once landed.
>
> Maybe module support was disabled?

Yes, I reported the problem with CONFIG_MODULES not enabled.


--
~Randy

2019-03-29 18:19:38

by Nick Desaulniers

[permalink] [raw]
Subject: [PATCH v2] gcov: fix when CONFIG_MODULES is not set

Fixes commit 8c3d220cb6b5 ("gcov: clang support")

Cc: Greg Hackmann <[email protected]>
Cc: Tri Vo <[email protected]>
Cc: Peter Oberparleiter <[email protected]>
Cc: [email protected]
Cc: [email protected]
Reported-by: Randy Dunlap <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
Signed-off-by: Nick Desaulniers <[email protected]>
---
kernel/gcov/gcc_3_4.c | 4 ++++
kernel/gcov/gcc_4_7.c | 4 ++++
2 files changed, 8 insertions(+)

diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
index 801ee4b0b969..8fc30f178351 100644
--- a/kernel/gcov/gcc_3_4.c
+++ b/kernel/gcov/gcc_3_4.c
@@ -146,7 +146,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
*/
bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
{
+#ifdef CONFIG_MODULES
return within_module((unsigned long)info, mod);
+#else
+ return false;
+#endif
}

/* Symbolic links to be created for each profiling data file. */
diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
index ec37563674d6..0b6886d4a4dd 100644
--- a/kernel/gcov/gcc_4_7.c
+++ b/kernel/gcov/gcc_4_7.c
@@ -159,7 +159,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
*/
bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
{
+#ifdef CONFIG_MODULES
return within_module((unsigned long)info, mod);
+#else
+ return false;
+#endif
}

/* Symbolic links to be created for each profiling data file. */
--
2.21.0.392.gf8f6787159e-goog


2019-03-29 20:54:51

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH v2] gcov: fix when CONFIG_MODULES is not set

On 3/29/19 11:18 AM, Nick Desaulniers wrote:
> Fixes commit 8c3d220cb6b5 ("gcov: clang support")

There is a certain format for Fixes: and that's not quite it. :(

> Cc: Greg Hackmann <[email protected]>
> Cc: Tri Vo <[email protected]>
> Cc: Peter Oberparleiter <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Reported-by: Randy Dunlap <[email protected]>
> Reported-by: kbuild test robot <[email protected]>
> Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
> Signed-off-by: Nick Desaulniers <[email protected]>

Acked-by: Randy Dunlap <[email protected]> # build-tested

Thanks.

> ---
> kernel/gcov/gcc_3_4.c | 4 ++++
> kernel/gcov/gcc_4_7.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/kernel/gcov/gcc_3_4.c b/kernel/gcov/gcc_3_4.c
> index 801ee4b0b969..8fc30f178351 100644
> --- a/kernel/gcov/gcc_3_4.c
> +++ b/kernel/gcov/gcc_3_4.c
> @@ -146,7 +146,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
> */
> bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
> {
> +#ifdef CONFIG_MODULES
> return within_module((unsigned long)info, mod);
> +#else
> + return false;
> +#endif
> }
>
> /* Symbolic links to be created for each profiling data file. */
> diff --git a/kernel/gcov/gcc_4_7.c b/kernel/gcov/gcc_4_7.c
> index ec37563674d6..0b6886d4a4dd 100644
> --- a/kernel/gcov/gcc_4_7.c
> +++ b/kernel/gcov/gcc_4_7.c
> @@ -159,7 +159,11 @@ void gcov_info_unlink(struct gcov_info *prev, struct gcov_info *info)
> */
> bool gcov_info_within_module(struct gcov_info *info, struct module *mod)
> {
> +#ifdef CONFIG_MODULES
> return within_module((unsigned long)info, mod);
> +#else
> + return false;
> +#endif
> }
>
> /* Symbolic links to be created for each profiling data file. */
>


--
~Randy

2019-03-31 00:00:08

by Tri Vo

[permalink] [raw]
Subject: Re: [PATCH v2] gcov: fix when CONFIG_MODULES is not set

On Fri, Mar 29, 2019 at 1:53 PM Randy Dunlap <[email protected]> wrote:
>
> On 3/29/19 11:18 AM, Nick Desaulniers wrote:
> > Fixes commit 8c3d220cb6b5 ("gcov: clang support")
>
> There is a certain format for Fixes: and that's not quite it. :(
>
> > Cc: Greg Hackmann <[email protected]>
> > Cc: Tri Vo <[email protected]>
> > Cc: Peter Oberparleiter <[email protected]>
> > Cc: [email protected]
> > Cc: [email protected]
> > Reported-by: Randy Dunlap <[email protected]>
> > Reported-by: kbuild test robot <[email protected]>
> > Link: https://marc.info/?l=linux-mm&m=155384681109231&w=2
> > Signed-off-by: Nick Desaulniers <[email protected]>
>
> Acked-by: Randy Dunlap <[email protected]> # build-tested
>
> Thanks.
>
> > ---
> > kernel/gcov/gcc_3_4.c | 4 ++++
> > kernel/gcov/gcc_4_7.c | 4 ++++
> > 2 files changed, 8 insertions(+)

Thanks for taking a look at this Nick! I believe same fix should be
applied to kernel/gcov/clang.c. I'll send out an updated version later
today.

2019-04-02 02:55:53

by Nick Desaulniers

[permalink] [raw]
Subject: Re: [PATCH v2] gcov: fix when CONFIG_MODULES is not set

On Sun, Mar 31, 2019 at 6:57 AM Tri Vo <[email protected]> wrote:
>
> On Fri, Mar 29, 2019 at 1:53 PM Randy Dunlap <[email protected]> wrote:
> >
> > On 3/29/19 11:18 AM, Nick Desaulniers wrote:
> > > Fixes commit 8c3d220cb6b5 ("gcov: clang support")
> >
> > There is a certain format for Fixes: and that's not quite it. :(

Looks like the format is:
Fixes: <first 12 characters of commit sha> ("<first line of commit>")
so:
Fixes: 8c3d220cb6b5 ("gcov: clang support")

We should update:
https://www.kernel.org/doc/html/v5.0/process/stable-kernel-rules.html
to include this information.

> Thanks for taking a look at this Nick! I believe same fix should be
> applied to kernel/gcov/clang.c. I'll send out an updated version later
> today.

All yours, happy to review.

--
Thanks,
~Nick Desaulniers

2019-04-03 15:26:49

by Matthew Wilcox

[permalink] [raw]
Subject: Re: [PATCH v2] gcov: fix when CONFIG_MODULES is not set

On Tue, Apr 02, 2019 at 09:54:50AM +0700, Nick Desaulniers wrote:
> Looks like the format is:
> Fixes: <first 12 characters of commit sha> ("<first line of commit>")
> so:
> Fixes: 8c3d220cb6b5 ("gcov: clang support")
>
> We should update:
> https://www.kernel.org/doc/html/v5.0/process/stable-kernel-rules.html
> to include this information.

It's in Documentation/process/submitting-patches.rst already.