2023-09-14 23:34:56

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 1/2] LoongArch: Add missing headers

The header uses definitions from sizes.h, include it.
For __iomem we need the compiler_types.h, include it.

Signed-off-by: Andy Shevchenko <[email protected]>
---
arch/loongarch/include/asm/addrspace.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/loongarch/include/asm/addrspace.h b/arch/loongarch/include/asm/addrspace.h
index 5c9c03bdf915..eaf8ac098622 100644
--- a/arch/loongarch/include/asm/addrspace.h
+++ b/arch/loongarch/include/asm/addrspace.h
@@ -10,7 +10,9 @@
#ifndef _ASM_ADDRSPACE_H
#define _ASM_ADDRSPACE_H

+#include <linux/compiler_types.h>
#include <linux/const.h>
+#include <linux/sizes.h>

#include <asm/loongarch.h>

--
2.40.0.1.gaa8946217a0b


2023-09-16 12:07:37

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] LoongArch: Add missing headers

On Sat, Sep 16, 2023 at 6:27 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Fri, Sep 15, 2023 at 08:36:24AM +0800, Huacai Chen wrote:
> > On Fri, Sep 15, 2023 at 2:53 AM Andy Shevchenko
> > <[email protected]> wrote:
> > > On Thu, Sep 14, 2023 at 11:25:22PM +0800, Huacai Chen wrote:
>
> > > > Thank you for your patch, can this patch solve the problem below?
> > > > https://lore.kernel.org/oe-kbuild-all/[email protected]/T/#u
> > >
> > > Nope, this just adds missing includes.
> > > No functional change, so warnings will still be there.
> > But I think a patch should solve a problem.
>
> No, that problem is static analyser concern, not the compiler nor linker.
>
> > If we don't get a build
> > error or warning without this patch, does that mean the 'missing'
> > headers are actually included indirectly?
>
> I might be missing something, but I do not see any build error in the above message.
Hmm, then I think I will take the second patch only.

Huacai
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
>

2023-09-18 08:24:43

by Huacai Chen

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] LoongArch: Add missing headers

Hi, Andy,

On Mon, Sep 18, 2023 at 2:49 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Sat, Sep 16, 2023 at 08:05:52PM +0800, Huacai Chen wrote:
> > On Sat, Sep 16, 2023 at 6:27 PM Andy Shevchenko
> > <[email protected]> wrote:
> > > On Fri, Sep 15, 2023 at 08:36:24AM +0800, Huacai Chen wrote:
> > > > On Fri, Sep 15, 2023 at 2:53 AM Andy Shevchenko
> > > > <[email protected]> wrote:
> > > > > On Thu, Sep 14, 2023 at 11:25:22PM +0800, Huacai Chen wrote:
> > >
> > > > > > Thank you for your patch, can this patch solve the problem below?
> > > > > > https://lore.kernel.org/oe-kbuild-all/[email protected]/T/#u
> > > > >
> > > > > Nope, this just adds missing includes.
> > > > > No functional change, so warnings will still be there.
> > > > But I think a patch should solve a problem.
> > >
> > > No, that problem is static analyser concern, not the compiler nor linker.
> > >
> > > > If we don't get a build
> > > > error or warning without this patch, does that mean the 'missing'
> > > > headers are actually included indirectly?
> > >
> > > I might be missing something, but I do not see any build error in the above message.
> > Hmm, then I think I will take the second patch only.
>
> Thanks, but can you shed a light why?
>
> The rule of thumb is to include the headers we are direct users of, we have not
> to imply any other inclusions done by others, unless it's kinda same family of
> headers (like types.h always includes compiler_types.h). Since in your case
> the const.h is included the other two are missing and it's even worse, as I
> understand you rely on the specific headers to be included _before_ using this
> one in the users.
I agree with you more or less, but I doubt there is another rule: no
break, no fix. Please see:

https://lore.kernel.org/loongarch/[email protected]/T/#t

Obviously static_key is used in page-flags.h and it really causes
build errors once before, but at last I removed the inclusion of
static_key.h to get that series merged.

Huacai

>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
>

2023-09-18 13:33:23

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] LoongArch: Add missing headers

On Mon, Sep 18, 2023 at 04:05:50PM +0800, Huacai Chen wrote:
> On Mon, Sep 18, 2023 at 2:49 PM Andy Shevchenko
> <[email protected]> wrote:
> > On Sat, Sep 16, 2023 at 08:05:52PM +0800, Huacai Chen wrote:
> > > On Sat, Sep 16, 2023 at 6:27 PM Andy Shevchenko
> > > <[email protected]> wrote:
> > > > On Fri, Sep 15, 2023 at 08:36:24AM +0800, Huacai Chen wrote:
> > > > > On Fri, Sep 15, 2023 at 2:53 AM Andy Shevchenko
> > > > > <[email protected]> wrote:
> > > > > > On Thu, Sep 14, 2023 at 11:25:22PM +0800, Huacai Chen wrote:
> > > >
> > > > > > > Thank you for your patch, can this patch solve the problem below?
> > > > > > > https://lore.kernel.org/oe-kbuild-all/[email protected]/T/#u
> > > > > >
> > > > > > Nope, this just adds missing includes.
> > > > > > No functional change, so warnings will still be there.
> > > > > But I think a patch should solve a problem.
> > > >
> > > > No, that problem is static analyser concern, not the compiler nor linker.
> > > >
> > > > > If we don't get a build
> > > > > error or warning without this patch, does that mean the 'missing'
> > > > > headers are actually included indirectly?
> > > >
> > > > I might be missing something, but I do not see any build error in the above message.
> > > Hmm, then I think I will take the second patch only.
> >
> > Thanks, but can you shed a light why?
> >
> > The rule of thumb is to include the headers we are direct users of, we have not
> > to imply any other inclusions done by others, unless it's kinda same family of
> > headers (like types.h always includes compiler_types.h). Since in your case
> > the const.h is included the other two are missing and it's even worse, as I
> > understand you rely on the specific headers to be included _before_ using this
> > one in the users.
> I agree with you more or less, but I doubt there is another rule: no
> break, no fix. Please see:
>
> https://lore.kernel.org/loongarch/[email protected]/T/#t
>
> Obviously static_key is used in page-flags.h and it really causes
> build errors once before, but at last I removed the inclusion of
> static_key.h to get that series merged.

This is strange requirement to be honest. Doing like this is to move your
responsibility and understanding of the code to be a burden of the person who
volunteers cleaning up the header mess we have in the Linux kernel source tree.

Since I'm the one who tries to fix some mess (in particular kernel.h), I am
pretty much know what I am talking about from the experience.

Cc'ing Guo. Guo, can you shed a light on the rationale of your comment in
the above mentioned thread?

--
With Best Regards,
Andy Shevchenko


2023-09-18 14:18:10

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] LoongArch: Add missing headers

On Sat, Sep 16, 2023 at 08:05:52PM +0800, Huacai Chen wrote:
> On Sat, Sep 16, 2023 at 6:27 PM Andy Shevchenko
> <[email protected]> wrote:
> > On Fri, Sep 15, 2023 at 08:36:24AM +0800, Huacai Chen wrote:
> > > On Fri, Sep 15, 2023 at 2:53 AM Andy Shevchenko
> > > <[email protected]> wrote:
> > > > On Thu, Sep 14, 2023 at 11:25:22PM +0800, Huacai Chen wrote:
> >
> > > > > Thank you for your patch, can this patch solve the problem below?
> > > > > https://lore.kernel.org/oe-kbuild-all/[email protected]/T/#u
> > > >
> > > > Nope, this just adds missing includes.
> > > > No functional change, so warnings will still be there.
> > > But I think a patch should solve a problem.
> >
> > No, that problem is static analyser concern, not the compiler nor linker.
> >
> > > If we don't get a build
> > > error or warning without this patch, does that mean the 'missing'
> > > headers are actually included indirectly?
> >
> > I might be missing something, but I do not see any build error in the above message.
> Hmm, then I think I will take the second patch only.

Thanks, but can you shed a light why?

The rule of thumb is to include the headers we are direct users of, we have not
to imply any other inclusions done by others, unless it's kinda same family of
headers (like types.h always includes compiler_types.h). Since in your case
the const.h is included the other two are missing and it's even worse, as I
understand you rely on the specific headers to be included _before_ using this
one in the users.


--
With Best Regards,
Andy Shevchenko


2023-09-19 00:58:59

by Guo Ren

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] LoongArch: Add missing headers

On Mon, Sep 18, 2023 at 4:23 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Mon, Sep 18, 2023 at 04:05:50PM +0800, Huacai Chen wrote:
> > On Mon, Sep 18, 2023 at 2:49 PM Andy Shevchenko
> > <[email protected]> wrote:
> > > On Sat, Sep 16, 2023 at 08:05:52PM +0800, Huacai Chen wrote:
> > > > On Sat, Sep 16, 2023 at 6:27 PM Andy Shevchenko
> > > > <[email protected]> wrote:
> > > > > On Fri, Sep 15, 2023 at 08:36:24AM +0800, Huacai Chen wrote:
> > > > > > On Fri, Sep 15, 2023 at 2:53 AM Andy Shevchenko
> > > > > > <[email protected]> wrote:
> > > > > > > On Thu, Sep 14, 2023 at 11:25:22PM +0800, Huacai Chen wrote:
> > > > >
> > > > > > > > Thank you for your patch, can this patch solve the problem below?
> > > > > > > > https://lore.kernel.org/oe-kbuild-all/[email protected]/T/#u
> > > > > > >
> > > > > > > Nope, this just adds missing includes.
> > > > > > > No functional change, so warnings will still be there.
> > > > > > But I think a patch should solve a problem.
> > > > >
> > > > > No, that problem is static analyser concern, not the compiler nor linker.
> > > > >
> > > > > > If we don't get a build
> > > > > > error or warning without this patch, does that mean the 'missing'
> > > > > > headers are actually included indirectly?
> > > > >
> > > > > I might be missing something, but I do not see any build error in the above message.
> > > > Hmm, then I think I will take the second patch only.
> > >
> > > Thanks, but can you shed a light why?
> > >
> > > The rule of thumb is to include the headers we are direct users of, we have not
> > > to imply any other inclusions done by others, unless it's kinda same family of
> > > headers (like types.h always includes compiler_types.h). Since in your case
> > > the const.h is included the other two are missing and it's even worse, as I
> > > understand you rely on the specific headers to be included _before_ using this
> > > one in the users.
> > I agree with you more or less, but I doubt there is another rule: no
> > break, no fix. Please see:
> >
> > https://lore.kernel.org/loongarch/[email protected]/T/#t
> >
> > Obviously static_key is used in page-flags.h and it really causes
> > build errors once before, but at last I removed the inclusion of
> > static_key.h to get that series merged.
>
> This is strange requirement to be honest. Doing like this is to move your
> responsibility and understanding of the code to be a burden of the person who
> volunteers cleaning up the header mess we have in the Linux kernel source tree.
>
> Since I'm the one who tries to fix some mess (in particular kernel.h), I am
> pretty much know what I am talking about from the experience.
>
> Cc'ing Guo. Guo, can you shed a light on the rationale of your comment in
> the above mentioned thread?

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 5c02720c53a5..9cdef3944a75 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include <linux/bug.h>
#include <linux/mmdebug.h>
+#include <linux/static_key.h>
#ifndef __GENERATING_BOUNDS_H
#include <linux/mm_types.h>
#include <generated/bounds.h>

My meaning is riscv needn't include the above header file to support
HVO, and I just tested the above modification with riscv, all passed,
so go ahead.

>
> --
> With Best Regards,
> Andy Shevchenko
>
>


--
Best Regards
Guo Ren