[PATCH] kmap: fix header include to reflect actual path

Aurabindo Pillai posted 1 patch 3 months, 1 week ago
arch/arc/include/asm/highmem.h       | 2 +-
arch/arm/include/asm/fixmap.h        | 2 +-
arch/csky/include/asm/fixmap.h       | 2 +-
arch/csky/include/asm/highmem.h      | 2 +-
arch/microblaze/include/asm/fixmap.h | 2 +-
arch/mips/include/asm/fixmap.h       | 2 +-
arch/mips/include/asm/highmem.h      | 2 +-
arch/powerpc/include/asm/fixmap.h    | 2 +-
arch/sparc/include/asm/vaddrs.h      | 2 +-
arch/x86/include/asm/fixmap.h        | 2 +-
arch/xtensa/include/asm/fixmap.h     | 2 +-
include/linux/sched.h                | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
[PATCH] kmap: fix header include to reflect actual path
Posted by Aurabindo Pillai 3 months, 1 week ago
There are plenty of header includes like:

	#include <asm/kmap_size.h>

However, the file kmap_size.h is actually inside the folder asm-generic.
Fix the includes in various header files so that the correct path is
referenced in the source, so rename them to:

	#include <asm-generic/kmap_size.h>

Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
---
 arch/arc/include/asm/highmem.h       | 2 +-
 arch/arm/include/asm/fixmap.h        | 2 +-
 arch/csky/include/asm/fixmap.h       | 2 +-
 arch/csky/include/asm/highmem.h      | 2 +-
 arch/microblaze/include/asm/fixmap.h | 2 +-
 arch/mips/include/asm/fixmap.h       | 2 +-
 arch/mips/include/asm/highmem.h      | 2 +-
 arch/powerpc/include/asm/fixmap.h    | 2 +-
 arch/sparc/include/asm/vaddrs.h      | 2 +-
 arch/x86/include/asm/fixmap.h        | 2 +-
 arch/xtensa/include/asm/fixmap.h     | 2 +-
 include/linux/sched.h                | 2 +-
 12 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arc/include/asm/highmem.h b/arch/arc/include/asm/highmem.h
index a6b8e2c352c44..3be6754ab304d 100644
--- a/arch/arc/include/asm/highmem.h
+++ b/arch/arc/include/asm/highmem.h
@@ -9,7 +9,7 @@
 #ifdef CONFIG_HIGHMEM
 
 #include <uapi/asm/page.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 #define FIXMAP_SIZE		PGDIR_SIZE
 #define PKMAP_SIZE		PGDIR_SIZE
diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h
index 707068f852c27..149669def2e92 100644
--- a/arch/arm/include/asm/fixmap.h
+++ b/arch/arm/include/asm/fixmap.h
@@ -7,7 +7,7 @@
 #define FIXADDR_TOP		(FIXADDR_END - PAGE_SIZE)
 
 #include <linux/pgtable.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 enum fixed_addresses {
 	FIX_EARLYCON_MEM_BASE,
diff --git a/arch/csky/include/asm/fixmap.h b/arch/csky/include/asm/fixmap.h
index 49a77cbbe2a9c..c68aabec22429 100644
--- a/arch/csky/include/asm/fixmap.h
+++ b/arch/csky/include/asm/fixmap.h
@@ -7,7 +7,7 @@
 #include <asm/memory.h>
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 #endif
 
 enum fixed_addresses {
diff --git a/arch/csky/include/asm/highmem.h b/arch/csky/include/asm/highmem.h
index 1ed810effb3d1..c3c4d51a93d0d 100644
--- a/arch/csky/include/asm/highmem.h
+++ b/arch/csky/include/asm/highmem.h
@@ -8,7 +8,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/uaccess.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 #include <asm/cache.h>
 
 /* undef for production */
diff --git a/arch/microblaze/include/asm/fixmap.h b/arch/microblaze/include/asm/fixmap.h
index e6e9288bff761..77996f6605949 100644
--- a/arch/microblaze/include/asm/fixmap.h
+++ b/arch/microblaze/include/asm/fixmap.h
@@ -20,7 +20,7 @@
 #include <asm/page.h>
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 #endif
 
 #define FIXADDR_TOP	((unsigned long)(-PAGE_SIZE))
diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h
index b037718d7e8b4..85e2854a2fc50 100644
--- a/arch/mips/include/asm/fixmap.h
+++ b/arch/mips/include/asm/fixmap.h
@@ -17,7 +17,7 @@
 #include <spaces.h>
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 #endif
 
 /*
diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
index 92a3802100178..80a6409d4a137 100644
--- a/arch/mips/include/asm/highmem.h
+++ b/arch/mips/include/asm/highmem.h
@@ -24,7 +24,7 @@
 #include <linux/interrupt.h>
 #include <linux/uaccess.h>
 #include <asm/cpu-features.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 /* declarations for highmem.c */
 extern unsigned long highstart_pfn, highend_pfn;
diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
index f9068dd8dfce7..b0622370fbab1 100644
--- a/arch/powerpc/include/asm/fixmap.h
+++ b/arch/powerpc/include/asm/fixmap.h
@@ -20,7 +20,7 @@
 #include <asm/page.h>
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 #endif
 
 /*
diff --git a/arch/sparc/include/asm/vaddrs.h b/arch/sparc/include/asm/vaddrs.h
index 4fec0341e2a81..f21d51153d6ef 100644
--- a/arch/sparc/include/asm/vaddrs.h
+++ b/arch/sparc/include/asm/vaddrs.h
@@ -32,7 +32,7 @@
 #define SRMMU_NOCACHE_ALCRATIO	64	/* 256 pages per 64MB of system RAM */
 
 #ifndef __ASSEMBLY__
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 enum fixed_addresses {
 	FIX_HOLE,
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
index d0dcefb5cc59d..ed2dc040747e4 100644
--- a/arch/x86/include/asm/fixmap.h
+++ b/arch/x86/include/asm/fixmap.h
@@ -14,7 +14,7 @@
 #ifndef _ASM_X86_FIXMAP_H
 #define _ASM_X86_FIXMAP_H
 
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 /*
  * Exposed to assembly code for setting up initial page tables. Cannot be
diff --git a/arch/xtensa/include/asm/fixmap.h b/arch/xtensa/include/asm/fixmap.h
index 1c65dc1d33971..af09aafb66687 100644
--- a/arch/xtensa/include/asm/fixmap.h
+++ b/arch/xtensa/include/asm/fixmap.h
@@ -16,7 +16,7 @@
 #ifdef CONFIG_HIGHMEM
 #include <linux/threads.h>
 #include <linux/pgtable.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 /* The map slots for temporary mappings via kmap_atomic/local(). */
 enum fixed_addresses {
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 9c15365a30c08..28507df174ee7 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -46,7 +46,7 @@
 #include <linux/rv.h>
 #include <linux/livepatch_sched.h>
 #include <linux/uidgid_types.h>
-#include <asm/kmap_size.h>
+#include <asm-generic/kmap_size.h>
 
 /* task_struct member predeclarations (sorted alphabetically): */
 struct audit_context;
-- 
2.50.0
Re: [PATCH] kmap: fix header include to reflect actual path
Posted by Christophe Leroy 3 months, 1 week ago

Le 27/06/2025 à 17:32, Aurabindo Pillai a écrit :
> [Vous ne recevez pas souvent de courriers de aurabindo.pillai@amd.com. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> There are plenty of header includes like:
> 
>          #include <asm/kmap_size.h>

Yes and in reality that includes those,

./arch/arm64/include/generated/asm/kmap_size.h
./arch/riscv/include/generated/asm/kmap_size.h
./arch/arc/include/generated/asm/kmap_size.h
./arch/x86/include/generated/asm/kmap_size.h
./arch/powerpc/include/generated/asm/kmap_size.h
./arch/arm/include/generated/asm/kmap_size.h

Which contain:

$ cat arch/powerpc/include/generated/asm/kmap_size.h
#include <asm-generic/kmap_size.h>

So what is the problem really ?

architectures are allowed to override the generic kmap_size.h, so you 
should definitely not change include/linux/sched.h

Or if you think architectures shouldn't be allowed to override it, then 
explain it and remove the following line in include/asm-generic/Kbuild:

	mandatory-y += kmap_size.h

Also I wonder why you didn't change in mm/highmem.c:

	#include <asm/kmap_size.h>

If you change how it works you have to explain it.

Christophe

> 
> However, the file kmap_size.h is actually inside the folder asm-generic.
> Fix the includes in various header files so that the correct path is
> referenced in the source, so rename them to:
> 
>          #include <asm-generic/kmap_size.h>
> 
> Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
> ---
>   arch/arc/include/asm/highmem.h       | 2 +-
>   arch/arm/include/asm/fixmap.h        | 2 +-
>   arch/csky/include/asm/fixmap.h       | 2 +-
>   arch/csky/include/asm/highmem.h      | 2 +-
>   arch/microblaze/include/asm/fixmap.h | 2 +-
>   arch/mips/include/asm/fixmap.h       | 2 +-
>   arch/mips/include/asm/highmem.h      | 2 +-
>   arch/powerpc/include/asm/fixmap.h    | 2 +-
>   arch/sparc/include/asm/vaddrs.h      | 2 +-
>   arch/x86/include/asm/fixmap.h        | 2 +-
>   arch/xtensa/include/asm/fixmap.h     | 2 +-
>   include/linux/sched.h                | 2 +-
>   12 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arc/include/asm/highmem.h b/arch/arc/include/asm/highmem.h
> index a6b8e2c352c44..3be6754ab304d 100644
> --- a/arch/arc/include/asm/highmem.h
> +++ b/arch/arc/include/asm/highmem.h
> @@ -9,7 +9,7 @@
>   #ifdef CONFIG_HIGHMEM
> 
>   #include <uapi/asm/page.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   #define FIXMAP_SIZE            PGDIR_SIZE
>   #define PKMAP_SIZE             PGDIR_SIZE
> diff --git a/arch/arm/include/asm/fixmap.h b/arch/arm/include/asm/fixmap.h
> index 707068f852c27..149669def2e92 100644
> --- a/arch/arm/include/asm/fixmap.h
> +++ b/arch/arm/include/asm/fixmap.h
> @@ -7,7 +7,7 @@
>   #define FIXADDR_TOP            (FIXADDR_END - PAGE_SIZE)
> 
>   #include <linux/pgtable.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   enum fixed_addresses {
>          FIX_EARLYCON_MEM_BASE,
> diff --git a/arch/csky/include/asm/fixmap.h b/arch/csky/include/asm/fixmap.h
> index 49a77cbbe2a9c..c68aabec22429 100644
> --- a/arch/csky/include/asm/fixmap.h
> +++ b/arch/csky/include/asm/fixmap.h
> @@ -7,7 +7,7 @@
>   #include <asm/memory.h>
>   #ifdef CONFIG_HIGHMEM
>   #include <linux/threads.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
>   #endif
> 
>   enum fixed_addresses {
> diff --git a/arch/csky/include/asm/highmem.h b/arch/csky/include/asm/highmem.h
> index 1ed810effb3d1..c3c4d51a93d0d 100644
> --- a/arch/csky/include/asm/highmem.h
> +++ b/arch/csky/include/asm/highmem.h
> @@ -8,7 +8,7 @@
>   #include <linux/init.h>
>   #include <linux/interrupt.h>
>   #include <linux/uaccess.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
>   #include <asm/cache.h>
> 
>   /* undef for production */
> diff --git a/arch/microblaze/include/asm/fixmap.h b/arch/microblaze/include/asm/fixmap.h
> index e6e9288bff761..77996f6605949 100644
> --- a/arch/microblaze/include/asm/fixmap.h
> +++ b/arch/microblaze/include/asm/fixmap.h
> @@ -20,7 +20,7 @@
>   #include <asm/page.h>
>   #ifdef CONFIG_HIGHMEM
>   #include <linux/threads.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
>   #endif
> 
>   #define FIXADDR_TOP    ((unsigned long)(-PAGE_SIZE))
> diff --git a/arch/mips/include/asm/fixmap.h b/arch/mips/include/asm/fixmap.h
> index b037718d7e8b4..85e2854a2fc50 100644
> --- a/arch/mips/include/asm/fixmap.h
> +++ b/arch/mips/include/asm/fixmap.h
> @@ -17,7 +17,7 @@
>   #include <spaces.h>
>   #ifdef CONFIG_HIGHMEM
>   #include <linux/threads.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
>   #endif
> 
>   /*
> diff --git a/arch/mips/include/asm/highmem.h b/arch/mips/include/asm/highmem.h
> index 92a3802100178..80a6409d4a137 100644
> --- a/arch/mips/include/asm/highmem.h
> +++ b/arch/mips/include/asm/highmem.h
> @@ -24,7 +24,7 @@
>   #include <linux/interrupt.h>
>   #include <linux/uaccess.h>
>   #include <asm/cpu-features.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   /* declarations for highmem.c */
>   extern unsigned long highstart_pfn, highend_pfn;
> diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/fixmap.h
> index f9068dd8dfce7..b0622370fbab1 100644
> --- a/arch/powerpc/include/asm/fixmap.h
> +++ b/arch/powerpc/include/asm/fixmap.h
> @@ -20,7 +20,7 @@
>   #include <asm/page.h>
>   #ifdef CONFIG_HIGHMEM
>   #include <linux/threads.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
>   #endif
> 
>   /*
> diff --git a/arch/sparc/include/asm/vaddrs.h b/arch/sparc/include/asm/vaddrs.h
> index 4fec0341e2a81..f21d51153d6ef 100644
> --- a/arch/sparc/include/asm/vaddrs.h
> +++ b/arch/sparc/include/asm/vaddrs.h
> @@ -32,7 +32,7 @@
>   #define SRMMU_NOCACHE_ALCRATIO 64      /* 256 pages per 64MB of system RAM */
> 
>   #ifndef __ASSEMBLY__
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   enum fixed_addresses {
>          FIX_HOLE,
> diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h
> index d0dcefb5cc59d..ed2dc040747e4 100644
> --- a/arch/x86/include/asm/fixmap.h
> +++ b/arch/x86/include/asm/fixmap.h
> @@ -14,7 +14,7 @@
>   #ifndef _ASM_X86_FIXMAP_H
>   #define _ASM_X86_FIXMAP_H
> 
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   /*
>    * Exposed to assembly code for setting up initial page tables. Cannot be
> diff --git a/arch/xtensa/include/asm/fixmap.h b/arch/xtensa/include/asm/fixmap.h
> index 1c65dc1d33971..af09aafb66687 100644
> --- a/arch/xtensa/include/asm/fixmap.h
> +++ b/arch/xtensa/include/asm/fixmap.h
> @@ -16,7 +16,7 @@
>   #ifdef CONFIG_HIGHMEM
>   #include <linux/threads.h>
>   #include <linux/pgtable.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   /* The map slots for temporary mappings via kmap_atomic/local(). */
>   enum fixed_addresses {
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 9c15365a30c08..28507df174ee7 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -46,7 +46,7 @@
>   #include <linux/rv.h>
>   #include <linux/livepatch_sched.h>
>   #include <linux/uidgid_types.h>
> -#include <asm/kmap_size.h>
> +#include <asm-generic/kmap_size.h>
> 
>   /* task_struct member predeclarations (sorted alphabetically): */
>   struct audit_context;
> --
> 2.50.0
> 

Re: [PATCH] kmap: fix header include to reflect actual path
Posted by Aurabindo Pillai 3 months, 1 week ago

On 2025-06-27 12:34, Christophe Leroy wrote:
> 
> 
> Le 27/06/2025 à 17:32, Aurabindo Pillai a écrit :
>> [Vous ne recevez pas souvent de courriers de aurabindo.pillai@amd.com. 
>> Découvrez pourquoi ceci est important à https://aka.ms/ 
>> LearnAboutSenderIdentification ]
>>
>> There are plenty of header includes like:
>>
>>          #include <asm/kmap_size.h>
> 
> Yes and in reality that includes those,
> 
> ./arch/arm64/include/generated/asm/kmap_size.h
> ./arch/riscv/include/generated/asm/kmap_size.h
> ./arch/arc/include/generated/asm/kmap_size.h
> ./arch/x86/include/generated/asm/kmap_size.h
> ./arch/powerpc/include/generated/asm/kmap_size.h
> ./arch/arm/include/generated/asm/kmap_size.h
> 
> Which contain:
> 
> $ cat arch/powerpc/include/generated/asm/kmap_size.h
> #include <asm-generic/kmap_size.h>
> 
> So what is the problem really ?

Thanks for the explanation. I was trying to reuse some driver source 
code in another project such that it compiles the related files in Linux 
and ran into a compilation issue, and the error was that the header file 
asm-generic/kmap_size.h was not found.

I just realized that once the kernel is built, the path asm/kmap_size.h 
will exist, and hence there is no need for this patch.
-- 
Thanks & Regards,
Aurabindo Pillai