Skip to contentSkip to conversation

More section-related cleanups

PATCH In review Geert Uytterhoeven 2 participants 6 messages Aug 29, 2014 Module support

lore
Share & tools
lore
#0 lore raw

cover More section-related cleanups

Hi Andrew,

Here's a resend of 4 more patches from the series "[PATCH 00/17] <asm/sections.h> related cleanups" I sent almost one year ago
(https://lkml.org/lkml/2013/11/12/510).

3 of them received acks from their maintainers.

Thanks for applying!

Geert Uytterhoeven (4):
frv: Remove unused declarations of __start___ex_table and

    __stop___ex_table
  ia64: Remove duplicate declarations of __per_cpu_start[] and
    __per_cpu_end[]

tile: Remove tile-specific _sinitdata and _einitdata kernel/param: Consolidate __{start,stop}___param[] in
<linux/moduleparam.h>

 arch/frv/mm/extable.c            |  2 --
 arch/ia64/include/asm/sections.h |  2 +-
 arch/tile/include/asm/sections.h |  3 ---
 arch/tile/kernel/vmlinux.lds.S   |  2 --
 arch/tile/mm/init.c              | 10 +++++-----
 include/linux/moduleparam.h      |  2 ++
 init/main.c                      |  2 --
 kernel/params.c                  |  7 +++----
 8 files changed, 11 insertions(+), 19 deletions(-)
Signature · 12 lines
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds
#1 lore raw

PATCH 1/4 frv: Remove unused declarations of __start___ex_table and __stop___ex_table

---
 arch/frv/mm/extable.c | 2 --
 1 file changed, 2 deletions(-)
arch/frv/mm/extable.c +0 -2
index 6aea124f574d..2fb9b3ab57b9 100644
@@ -6,8 +6,6 @@
 #include <linux/spinlock.h>
 #include <asm/uaccess.h>
 
-extern const struct exception_table_entry __attribute__((aligned(8))) __start___ex_table[];
-extern const struct exception_table_entry __attribute__((aligned(8))) __stop___ex_table[];
 extern const void __memset_end, __memset_user_error_lr, __memset_user_error_handler;
 extern const void __memcpy_end, __memcpy_user_error_lr, __memcpy_user_error_handler;
 extern spinlock_t modlist_lock;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/4 ia64: Remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[]

In reply to Geert Uytterhoeven

They're already provided by <asm/sections.h>.

---
 arch/ia64/include/asm/sections.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/include/asm/sections.h +1 -1
index 1a873b36a4a1..2ab2003698ef 100644
@@ -10,7 +10,7 @@
 #include <linux/uaccess.h>
 #include <asm-generic/sections.h>
 
-extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
+extern char __phys_per_cpu_start[];
 #ifdef	CONFIG_SMP
 extern char __cpu0_per_cpu[];
 #endif
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/4 tile: Remove tile-specific _sinitdata and _einitdata

In reply to Geert Uytterhoeven

Use standard __init_begin and __init_end instead.

---
 arch/tile/include/asm/sections.h |  3 ---
 arch/tile/kernel/vmlinux.lds.S   |  2 --
 arch/tile/mm/init.c              | 10 +++++-----
 3 files changed, 5 insertions(+), 10 deletions(-)
arch/tile/include/asm/sections.h +0 -3
index 5d5d3b739a6b..86a746243dc8 100644
@@ -19,9 +19,6 @@
 
 #include <asm-generic/sections.h>
 
-/* Text and data are at different areas in the kernel VA space. */
-extern char _sinitdata[], _einitdata[];
-
 /* Write-once data is writable only till the end of initialization. */
 extern char __w1data_begin[], __w1data_end[];
 
arch/tile/kernel/vmlinux.lds.S +0 -2
index f1819423ffc9..0e059a0101ea 100644
@@ -66,11 +66,9 @@ SECTIONS
 
   . = ALIGN(PAGE_SIZE);
   __init_begin = .;
-  VMLINUX_SYMBOL(_sinitdata) = .;
   INIT_DATA_SECTION(16) :data =0
   PERCPU_SECTION(L2_CACHE_BYTES)
   . = ALIGN(PAGE_SIZE);
-  VMLINUX_SYMBOL(_einitdata) = .;
   __init_end = .;
 
   _sdata = .;                   /* Start of data section */
arch/tile/mm/init.c +5 -5
index bfb3127b4df9..930c95526762 100644
@@ -254,7 +254,7 @@ static pgprot_t __init init_pgprot(ulong address)
 	 * Everything else that isn't data or bss is heap, so mark it
 	 * with the initial heap home (hash-for-home, or this cpu).  This
 	 * includes any addresses after the loaded image and any address before
-	 * _einitdata, since we already captured the case of text before
+	 * __init_end, since we already captured the case of text before
 	 * _sinittext, and __pa(einittext) is approximately __pa(sinitdata).
 	 *
 	 * All the LOWMEM pages that we mark this way will get their
@@ -263,7 +263,7 @@ static pgprot_t __init init_pgprot(ulong address)
 	 * homes, but with a zero free_time we don't have to actually
 	 * do a flush action the first time we use them, either.
 	 */
-	if (address >= (ulong) _end || address < (ulong) _einitdata)
+	if (address >= (ulong) _end || address < (ulong) __init_end)
 		return construct_pgprot(PAGE_KERNEL, initial_heap_home());
 
 	/* Use hash-for-home if requested for data/bss. */
@@ -632,7 +632,7 @@ int devmem_is_allowed(unsigned long pagenr)
 {
 	return pagenr < kaddr_to_pfn(_end) &&
 		!(pagenr >= kaddr_to_pfn(&init_thread_union) ||
-		  pagenr < kaddr_to_pfn(_einitdata)) &&
+		  pagenr < kaddr_to_pfn(__init_end)) &&
 		!(pagenr >= kaddr_to_pfn(_sinittext) ||
 		  pagenr <= kaddr_to_pfn(_einittext-1));
 }
@@ -975,8 +975,8 @@ void free_initmem(void)
 
 	/* Free the data pages that we won't use again after init. */
 	free_init_pages("unused kernel data",
-			(unsigned long)_sinitdata,
-			(unsigned long)_einitdata);
+			(unsigned long)__init_begin,
+			(unsigned long)__init_end);
 
 	/*
 	 * Free the pages mapped from 0xc0000000 that correspond to code
Signature · 1 line
1.9.1
#4 lore raw

Re: [PATCH 3/4] tile: Remove tile-specific _sinitdata and _einitdata

Quoted 9 lines · Geert Uytterhoeven

Use standard __init_begin and __init_end instead.

---
  arch/tile/include/asm/sections.h |  3 ---
  arch/tile/kernel/vmlinux.lds.S   |  2 --
  arch/tile/mm/init.c              | 10 +++++-----
  3 files changed, 5 insertions(+), 10 deletions(-)

This is still in the tile tree; I missed the merge window for 3.17 since I was lazing around on the beach, but I'll push it to Linus for 3.18.

Signature · 2 lines
Chris Metcalf, Tilera Corp.
http://www.tilera.com
#5 lore raw

PATCH 4/4 kernel/param: Consolidate __{start,stop}___param[] in <linux/moduleparam.h>

In reply to Geert Uytterhoeven

Consolidate the various external const and non-const declarations of __start___param[] and __stop___param in <linux/moduleparam.h>. This requires making a few struct kernel_param pointers in kernel/params.c const.

---
 include/linux/moduleparam.h | 2 ++
 init/main.c                 | 2 --
 kernel/params.c             | 7 +++----
 3 files changed, 5 insertions(+), 6 deletions(-)
include/linux/moduleparam.h +2 -0
index 494f99e852da..af582591e05a 100644
@@ -68,6 +68,8 @@ struct kernel_param {
 	};
 };
 
+extern const struct kernel_param __start___param[], __stop___param[];
+
 /* Special one for strings we want to copy into */
 struct kparam_string {
 	unsigned int maxlen;
init/main.c +0 -2
index bb1aed928f21..8197dfc738bc 100644
@@ -501,7 +501,6 @@ asmlinkage __visible void __init start_kernel(void)
 {
 	char *command_line;
 	char *after_dashes;
-	extern const struct kernel_param __start___param[], __stop___param[];
 
 	/*
 	 * Need to run as early as possible, to initialize the
@@ -843,7 +842,6 @@ static char *initcall_level_names[] __initdata = {
 
 static void __init do_initcall_level(int level)
 {
-	extern const struct kernel_param __start___param[], __stop___param[];
 	initcall_t *fn;
 
 	strcpy(initcall_command_line, saved_command_line);
kernel/params.c +3 -4
index 34f527023794..27c0320fae36 100644
@@ -19,6 +19,7 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -503,8 +504,6 @@ EXPORT_SYMBOL(param_ops_string);
 #define to_module_attr(n) container_of(n, struct module_attribute, attr)
 #define to_module_kobject(n) container_of(n, struct module_kobject, kobj)
 
-extern struct kernel_param __start___param[], __stop___param[];
-
 struct param_attribute
 {
 	struct module_attribute mattr;
@@ -763,7 +762,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name)
 }
 
 static void __init kernel_add_sysfs_param(const char *name,
-					  struct kernel_param *kparam,
+					  const struct kernel_param *kparam,
 					  unsigned int name_skip)
 {
 	struct module_kobject *mk;
@@ -798,7 +797,7 @@ static void __init kernel_add_sysfs_param(const char *name,
  */
 static void __init param_sysfs_builtin(void)
 {
-	struct kernel_param *kp;
+	const struct kernel_param *kp;
 	unsigned int name_len;
 	char modname[MODULE_NAME_LEN];
 
Signature · 1 line
1.9.1