mm: PAGE_KERNEL_* fallbacks
Subsystems (6)
Luis R. Rodriguez
maintainerv2 cover mm: PAGE_KERNEL_* fallbacks
While dusting out the firmware loader closet I spotted a PAGE_KERNEL_* fallback hack. This hurts my eyes, and it should also be blinding others. Turns out we have other PAGE_KERNEL_* fallback hacks in other places.
This moves them to asm-generic, and keeps track of architectures which need some love or review. At least 0-day was happy with the changes.
Matthew Wilcox did put together a PAGE_KERNEL_RO patch for ia64, that needs review and testing, and if it goes well it should be merged.
Luis R. Rodriguez (2):
mm: provide a fallback for PAGE_KERNEL_RO for architectures
mm: provide a fallback for PAGE_KERNEL_EXEC for architectures
drivers/base/firmware_loader/fallback.c | 5 ---- include/asm-generic/pgtable.h | 36 +++++++++++++++++++++++++ mm/nommu.c | 4 --- mm/vmalloc.c | 4 --- 4 files changed, 36 insertions(+), 13 deletions(-)
Signature · 1 line
2.17.0
Luis R. Rodriguez
maintainerPATCH v2 1/2 mm: provide a fallback for PAGE_KERNEL_RO for architectures
Some architectures do not define certain PAGE_KERNEL_* flags, this is either because:
a) The way to implement some these flags is *not yet ported*, or
b) The architecture *has no way* to describe them
Over time we have accumulated a few PAGE_KERNEL_* fallback work arounds for architectures in the kernel which do not define them using *relatively safe* equivalents. Move these scattered fallback hacks into asm-generic and document which architectures needs further evaluation for which PAGE_KERNEL_* flag.
We start off with PAGE_KERNEL_RO using PAGE_KERNEL as a fallback. This has been in place on the firmware loader for years. Move the fallback into the respective asm-generic header.
Architectures which don't define this yet:
o alpha
o ia64
o m68k
o mips
o sparc64
o sparc
--- drivers/base/firmware_loader/fallback.c | 5 ----- include/asm-generic/pgtable.h | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 5 deletions(-)
drivers/base/firmware_loader/fallback.c +0 -5
@@ -219,11 +219,6 @@ static ssize_t firmware_loading_show(struct device *dev,return sprintf (buf,"%d\n" , loading); } -/* Some architectures don't have PAGE_KERNEL_RO */ -#ifndef PAGE_KERNEL_RO -#define PAGE_KERNEL_RO PAGE_KERNEL -#endif -/* one pages buffer should be mapped/unmapped only once */ static int map_fw_priv_pages (struct fw_priv *fw_priv) {
include/asm-generic/pgtable.h +24 -0
@@ -1083,6 +1083,30 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,static inline void init_espfix_bsp (void ) { }#endif +/* +* Architecture PAGE_KERNEL_* fallbacks +* +* Some architectures don't define certain PAGE_KERNEL_* flags. This is either +* because they really don't support them, or the port needs to be updated to +* reflect the required functionality. Below are a set of relatively safe +* fallbacks, as best effort, which we can count on in lieu of the architectures +* not defining them on their own yet. +*/ + +/* +* Current architectures known to not define PAGE_KERNEL_RO: +* +* o alpha +* o ia64 +* o m68k +* o mips +* o sparc64 +* o sparc +*/ +#ifndef PAGE_KERNEL_RO +# define PAGE_KERNEL_RO PAGE_KERNEL +#endif +#endif /* !__ASSEMBLY__ */ #ifndef io_remap_pfn_range
Signature · 1 line
2.17.0
Luis R. Rodriguez
maintainerPATCH v2 2/2 mm: provide a fallback for PAGE_KERNEL_EXEC for architectures
In reply to Luis R. RodriguezSome architectures just don't have PAGE_KERNEL_EXEC. The mm/nommu.c and mm/vmalloc.c code have been using PAGE_KERNEL as a fallback for years. Move this fallback to asm-generic.
Architectures which do not define PAGE_KERNEL_EXEC yet:
o alpha
o mips
o openrisc
o sparc64
--- include/asm-generic/pgtable.h | 12 ++++++++++++ mm/nommu.c | 4 ---- mm/vmalloc.c | 4 ---- 3 files changed, 12 insertions(+), 8 deletions(-)
include/asm-generic/pgtable.h +12 -0
@@ -1107,6 +1107,18 @@ static inline void init_espfix_bsp(void) { }# define PAGE_KERNEL_RO PAGE_KERNEL#endif +/* +* Current architectures known to not define PAGE_KERNEL_EXEC: +* +* o alpha +* o mips +* o openrisc +* o sparc64 +*/ +#ifndef PAGE_KERNEL_EXEC +# define PAGE_KERNEL_EXEC PAGE_KERNEL +#endif +#endif /* !__ASSEMBLY__ */ #ifndef io_remap_pfn_range
mm/nommu.c +0 -4
@@ -364,10 +364,6 @@ void *vzalloc_node(unsigned long size, int node) }EXPORT_SYMBOL (vzalloc_node); -#ifndef PAGE_KERNEL_EXEC -# define PAGE_KERNEL_EXEC PAGE_KERNEL -#endif -/** * vmalloc_exec - allocate virtually contiguous, executable memory * @size: allocation size
mm/vmalloc.c +0 -4
@@ -1920,10 +1920,6 @@ void *vzalloc_node(unsigned long size, int node) }EXPORT_SYMBOL (vzalloc_node); -#ifndef PAGE_KERNEL_EXEC -# define PAGE_KERNEL_EXEC PAGE_KERNEL -#endif -/** * vmalloc_exec - allocate virtually contiguous, executable memory * @size: allocation size
Signature · 1 line
2.17.0
Re: [PATCH v2 2/2] mm: provide a fallback for PAGE_KERNEL_EXEC for architectures
Hi Luis,
Quoted 10 lines · Luis R. Rodriguez
Some architectures just don't have
PAGE_KERNEL_EXEC. Themm/nommu.candmm/vmalloc.ccode have been usingPAGE_KERNELas a fallback for years. Move this fallback to asm-generic.Architectures which do not define
PAGE_KERNEL_EXECyet:o alpha
o mips
o openrisc
o sparc64
The above list seems to be far from complete?
Quoted 2 lines
Suggested-by Matthew Wilcox <[email protected]>Signed-off-by Luis R. Rodriguez <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
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
Luis R. Rodriguez
maintainerRe: [PATCH v2 2/2] mm: provide a fallback for PAGE_KERNEL_EXEC for architectures
Quoted 7 lines · Geert Uytterhoeven
Hi Luis,
Quoted 4 lines · Luis R. Rodriguez
Some architectures just don't have
PAGE_KERNEL_EXEC. Themm/nommu.candmm/vmalloc.ccode have been usingPAGE_KERNELas a fallback for years. Move this fallback to asm-generic.
Quoted 8 lines
Quoted 6 lines
Architectures which do not define
PAGE_KERNEL_EXECyet:o alpha
o mips
o openrisc
o sparc64The above list seems to be far from complete?
I'll look again. If you know of others lemme know.
Luis
Luis R. Rodriguez
maintainerRe: [PATCH v2 2/2] mm: provide a fallback for PAGE_KERNEL_EXEC for architectures
Quoted 10 lines · Luis R. Rodriguez
Quoted 9 lines · Geert Uytterhoeven
Hi Luis,
Quoted 6 lines · Luis R. Rodriguez
Some architectures just don't have
PAGE_KERNEL_EXEC. Themm/nommu.candmm/vmalloc.ccode have been usingPAGE_KERNELas a fallback for years. Move this fallback to asm-generic.Architectures which do not define
PAGE_KERNEL_EXECyet:
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
o alpha
o mips
o openrisc
o sparc64The above list seems to be far from complete?
I'll look again. If you know of others lemme know.
You know, better just ignore documenting these. I'll respin without that.
Luis
Greg KH
maintainerQuoted 15 lines · Luis R. Rodriguez
While dusting out the firmware loader closet I spotted a PAGE_KERNEL_* fallback hack. This hurts my eyes, and it should also be blinding others. Turns out we have other PAGE_KERNEL_* fallback hacks in other places.
This moves them to asm-generic, and keeps track of architectures which need some love or review. At least 0-day was happy with the changes.
Matthew Wilcox did put together a
PAGE_KERNEL_ROpatch for ia64, that needs review and testing, and if it goes well it should be merged.Luis R. Rodriguez (2):
mm: provide a fallback forPAGE_KERNEL_ROfor architectures
mm: provide a fallback forPAGE_KERNEL_EXECfor architectures
Quoted 5 lines
drivers/base/firmware_loader/fallback.c | 5 ---- include/asm-generic/pgtable.h | 36 +++++++++++++++++++++++++ mm/nommu.c | 4 --- mm/vmalloc.c | 4 --- 4 files changed, 36 insertions(+), 13 deletions(-)
No list of changes that happened from v1? :(
Luis R. Rodriguez
maintainerQuoted 16 lines · Greg KH
Quoted 15 lines · Luis R. Rodriguez
While dusting out the firmware loader closet I spotted a PAGE_KERNEL_* fallback hack. This hurts my eyes, and it should also be blinding others. Turns out we have other PAGE_KERNEL_* fallback hacks in other places.
This moves them to asm-generic, and keeps track of architectures which need some love or review. At least 0-day was happy with the changes.
Matthew Wilcox did put together a
PAGE_KERNEL_ROpatch for ia64, that needs review and testing, and if it goes well it should be merged.Luis R. Rodriguez (2):
mm: provide a fallback forPAGE_KERNEL_ROfor architectures
mm: provide a fallback forPAGE_KERNEL_EXECfor architectures
Quoted 7 lines
Quoted 5 lines
drivers/base/firmware_loader/fallback.c | 5 ---- include/asm-generic/pgtable.h | 36 +++++++++++++++++++++++++ mm/nommu.c | 4 --- mm/vmalloc.c | 4 --- 4 files changed, 36 insertions(+), 13 deletions(-)No list of changes that happened from v1? :(
Didn't know you'd want it for such simple patch set, but I'll provide one for v3 and also list the changes in v2.
Luis
Greg KH
maintainerQuoted 23 lines · Luis R. Rodriguez
Quoted 22 lines · Greg KH
Quoted 20 lines · Luis R. Rodriguez
While dusting out the firmware loader closet I spotted a PAGE_KERNEL_* fallback hack. This hurts my eyes, and it should also be blinding others. Turns out we have other PAGE_KERNEL_* fallback hacks in other places.
This moves them to asm-generic, and keeps track of architectures which need some love or review. At least 0-day was happy with the changes.
Matthew Wilcox did put together a
PAGE_KERNEL_ROpatch for ia64, that needs review and testing, and if it goes well it should be merged.Luis R. Rodriguez (2):
mm: provide a fallback forPAGE_KERNEL_ROfor architectures
mm: provide a fallback forPAGE_KERNEL_EXECfor architecturesdrivers/base/firmware_loader/fallback.c | 5 ---- include/asm-generic/pgtable.h | 36 +++++++++++++++++++++++++ mm/nommu.c | 4 --- mm/vmalloc.c | 4 --- 4 files changed, 36 insertions(+), 13 deletions(-)
Quoted 4 lines
Quoted 1 line
No list of changes that happened from v1? :(
Didn't know you'd want it for such simple patch set, but I'll provide one for v3 and also list the changes in v2.
Nothing is "trivial" really, and given the huge rate of patch submissions, how is anyone supposed to remember what you did in the last one?
thanks,
greg k-h