Thread (34 messages) flat view 34 messages, 4 authors, 2021-04-21

Re: [PATCH v10 03/10] powerpc: Always define MODULES_{VADDR,END}

From: Christophe Leroy <hidden>
Date: 2021-03-30 05:01:28


Le 30/03/2021 à 06:51, Jordan Niethe a écrit :
quoted hunk ↗ jump to hunk
If MODULES_{VADDR,END} are not defined set them to VMALLOC_START and
VMALLOC_END respectively. This reduces the need for special cases. For
example, powerpc's module_alloc() was previously predicated on
MODULES_VADDR being defined but now is unconditionally defined.

This will be useful reducing conditional code in other places that need
to allocate from the module region (i.e., kprobes).

Signed-off-by: Jordan Niethe <redacted>
---
v10: New to series
---
  arch/powerpc/include/asm/pgtable.h | 5 +++++
  arch/powerpc/kernel/module.c       | 5 +----
  2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 4eed82172e33..014c2921f26a 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -167,6 +167,11 @@ struct seq_file;
  void arch_report_meminfo(struct seq_file *m);
  #endif /* CONFIG_PPC64 */
  
+#ifndef MODULES_VADDR
+#define MODULES_VADDR VMALLOC_START
+#define MODULES_END VMALLOC_END
+#endif
+
  #endif /* __ASSEMBLY__ */
  
  #endif /* _ASM_POWERPC_PGTABLE_H */
diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
index a211b0253cdb..f1fb58389d58 100644
--- a/arch/powerpc/kernel/module.c
+++ b/arch/powerpc/kernel/module.c
@@ -14,6 +14,7 @@
  #include <asm/firmware.h>
  #include <linux/sort.h>
  #include <asm/setup.h>
+#include <linux/mm.h>
  
  static LIST_HEAD(module_bug_list);
  
@@ -87,13 +88,9 @@ int module_finalize(const Elf_Ehdr *hdr,
  	return 0;
  }
  
-#ifdef MODULES_VADDR
  void *module_alloc(unsigned long size)
  {
-	BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
-
This check is important, if we remove it from here it should be done somewhere else, for instance in 
asm/task_size_32.h
  	return __vmalloc_node_range(size, 1, MODULES_VADDR, MODULES_END, GFP_KERNEL,
  				    PAGE_KERNEL_EXEC, VM_FLUSH_RESET_PERMS, NUMA_NO_NODE,
  				    __builtin_return_address(0));
  }
-#endif
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help