All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/5] mm/vmalloc: remove map_kernel_range
       [not found] ` <20210322021806.892164-2-npiggin@gmail.com>
@ 2021-04-01 15:56   ` Nicholas Piggin
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Piggin @ 2021-04-01 15:56 UTC (permalink / raw)
  To: Andrew Morton, linux-mm; +Cc: Christoph Hellwig

Excerpts from Nicholas Piggin's message of March 22, 2021 12:18 pm:
> This is a shim around vmap_pages_range, get rid of it.
> 
> Move the main API comment from the _noflush variant to the normal
> variant, and make _noflush internal to mm/.
> 

This requires a fix for nommu builds.
---

Fix "mm/vmalloc: remove map_kernel_range"

Fixes: "percpu.c:undefined reference to `vmap_pages_range_noflush'" on
riscv nommu builds.

Previous code had a strange NOMMU implementation of
map_kernel_range_noflush that came in with commit b554cb426a955
("NOMMU: support SMP dynamic percpu_alloc") which would return
success if the size was <= PAGE_SIZE, but that has no way of working
on NOMMU because the page can not be mapped to the new start address
even if there is only one of them. So change this code to always
return failure.

NOMMU probably needs to take a closer look at what it does with
percpu-vm.c and carve out a special case there if necessary rather
than pretend vmap works.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 mm/internal.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mm/internal.h b/mm/internal.h
index 6d3fd85ab866..ac5d1abfb739 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -621,7 +621,16 @@ struct migration_target_control {
 /*
  * mm/vmalloc.c
  */
+#ifdef CONFIG_MMU
 int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
                 pgprot_t prot, struct page **pages, unsigned int page_shift);
+#else
+static inline
+int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
+                pgprot_t prot, struct page **pages, unsigned int page_shift)
+{
+	return -EINVAL;
+}
+#endif
 
 #endif	/* __MM_INTERNAL_H */
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 4/5] mm/vmalloc: remove unmap_kernel_range
       [not found] ` <20210322021806.892164-5-npiggin@gmail.com>
@ 2021-04-01 15:58   ` Nicholas Piggin
  0 siblings, 0 replies; 2+ messages in thread
From: Nicholas Piggin @ 2021-04-01 15:58 UTC (permalink / raw)
  To: Andrew Morton, linux-mm; +Cc: Christoph Hellwig

Excerpts from Nicholas Piggin's message of March 22, 2021 12:18 pm:
> This is a shim around vunmap_range, get rid of it.
> 
> Move the main API comment from the _noflush variant to the normal
> variant, and make _noflush internal to mm/.

This requires a fix for nommu builds and a comment bug that sfr noticed.

---

Fix for "mm/vmalloc: remove unmap_kernel_range"

Fixes:

mm/vmalloc.c:425: warning: expecting prototype for vunmap_range_noflush().
Prototype was for vunmap_range() instead

percpu.c:undefined reference to `vunmap_range_noflush` on NOMMU builds

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 mm/internal.h | 3 +++
 mm/vmalloc.c  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/mm/internal.h b/mm/internal.h
index 8b20d5039b74..217fff7c7807 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -632,6 +632,9 @@ int vmap_pages_range_noflush(unsigned long addr, unsigned long end,
 {
 	return -EINVAL;
 }
+static inline void vunmap_range_noflush(unsigned long start, unsigned long end)
+{
+}
 #endif
 
 #endif	/* __MM_INTERNAL_H */
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 5423f6c1417f..f99c1bf714cd 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -413,7 +413,7 @@ void vunmap_range_noflush(unsigned long start, unsigned long end)
 }
 
 /**
- * vunmap_range_noflush - unmap kernel virtual addresses
+ * vunmap_range - unmap kernel virtual addresses
  * @addr: start of the VM area to unmap
  * @end: end of the VM area to unmap (non-inclusive)
  *
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-01 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210322021806.892164-1-npiggin@gmail.com>
     [not found] ` <20210322021806.892164-2-npiggin@gmail.com>
2021-04-01 15:56   ` [PATCH v2 1/5] mm/vmalloc: remove map_kernel_range Nicholas Piggin
     [not found] ` <20210322021806.892164-5-npiggin@gmail.com>
2021-04-01 15:58   ` [PATCH v2 4/5] mm/vmalloc: remove unmap_kernel_range Nicholas Piggin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.