All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe  Gerum <rpm@xenomai.org>
To: xenomai@xenomai.org
Subject: [PATCH v2 1/7] cobalt/memory: fix __vmalloc() calls
Date: Sat, 27 Mar 2021 11:19:06 +0100	[thread overview]
Message-ID: <20210327101912.2291474-2-rpm@xenomai.org> (raw)
In-Reply-To: <20210327101912.2291474-1-rpm@xenomai.org>

From: Philippe Gerum <rpm@xenomai.org>

Since kernel v5.8, __vmalloc() does not take protection bits as
PROT_KERNEL is now wired in. Therefore we cannot disable the cache for
the UMM segment via the allocation call directly anymore.

This said, we don't support any CPU architecture exhibiting cache
aliasing braindamage anymore either (was armv4/v5), so let's convert
to the new __vmalloc() call format without bothering for cache
settings.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
---
 kernel/cobalt/heap.c                                 | 3 ++-
 kernel/cobalt/include/asm-generic/xenomai/wrappers.h | 6 ++++++
 kernel/cobalt/posix/memory.c                         | 7 ++++---
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/kernel/cobalt/heap.c b/kernel/cobalt/heap.c
index 9e184d4c3..d3f43729e 100644
--- a/kernel/cobalt/heap.c
+++ b/kernel/cobalt/heap.c
@@ -28,6 +28,7 @@
 #include <cobalt/kernel/heap.h>
 #include <cobalt/kernel/vfile.h>
 #include <cobalt/kernel/ancillaries.h>
+#include <asm/xenomai/wrappers.h>
 
 /**
  * @ingroup cobalt_core
@@ -849,7 +850,7 @@ void *xnheap_vmalloc(size_t size)
 	 * software on a 32bit system had to be wrong in the first
 	 * place anyway.
 	 */
-	return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL);
+	return vmalloc_kernel(size, 0);
 }
 EXPORT_SYMBOL_GPL(xnheap_vmalloc);
 
diff --git a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
index 9e8733b47..ac4e95aa0 100644
--- a/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
+++ b/kernel/cobalt/include/asm-generic/xenomai/wrappers.h
@@ -176,4 +176,10 @@ devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
 #define old_timeval32     compat_timeval
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,8,0)
+#define vmalloc_kernel(__size, __flags)	__vmalloc(__size, GFP_KERNEL|__flags, PAGE_KERNEL)
+#else
+#define vmalloc_kernel(__size, __flags)	__vmalloc(__size, GFP_KERNEL|__flags)
+#endif
+
 #endif /* _COBALT_ASM_GENERIC_WRAPPERS_H */
diff --git a/kernel/cobalt/posix/memory.c b/kernel/cobalt/posix/memory.c
index 1d888a219..fc88e264c 100644
--- a/kernel/cobalt/posix/memory.c
+++ b/kernel/cobalt/posix/memory.c
@@ -320,10 +320,11 @@ int cobalt_umm_init(struct cobalt_umm *umm, u32 size,
 
 	secondary_mode_only();
 
+	/* We don't support CPUs with VIVT caches and the like. */
+	BUG_ON(xnarch_cache_aliasing());
+
 	size = PAGE_ALIGN(size);
-	basemem = __vmalloc(size, GFP_KERNEL|__GFP_ZERO,
-			    xnarch_cache_aliasing() ?
-			    pgprot_noncached(PAGE_KERNEL) : PAGE_KERNEL);
+	basemem = vmalloc_kernel(size, __GFP_ZERO);
 	if (basemem == NULL)
 		return -ENOMEM;
 
-- 
2.29.2



  reply	other threads:[~2021-03-27 10:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-27 10:19 [PATCH v2 0/7] assorted v5.x related fixups Philippe Gerum
2021-03-27 10:19 ` Philippe Gerum [this message]
2021-03-27 10:19 ` [PATCH v2 2/7] cobalt/debug: switch to mmap_lock interface Philippe Gerum
2021-03-27 10:19 ` [PATCH v2 3/7] cobalt/kernel: convert to proc_ops Philippe Gerum
2021-04-07  9:52   ` Jan Kiszka
2021-04-07 10:17     ` Philippe Gerum
2021-04-07 10:37       ` Jan Kiszka
2021-04-07 11:03         ` Philippe Gerum
2021-03-27 10:19 ` [PATCH v2 4/7] cobalt/debug: prefer dump_stack() to show_stack() Philippe Gerum
2021-03-27 10:19 ` [PATCH v2 5/7] drivers/net: wrap csum_partial_copy_nocheck() Philippe Gerum
2021-04-07 10:06   ` Jan Kiszka
2021-04-15  7:21     ` Philippe Gerum
2021-04-15  7:35       ` Jan Kiszka
2021-04-15  7:54         ` Philippe Gerum
2021-04-15  8:10           ` Jan Kiszka
2021-04-16 16:48             ` Philippe Gerum
2021-04-16 17:12               ` Jan Kiszka
2021-04-18  9:18                 ` Philippe Gerum
2021-04-18 15:50                   ` Philippe Gerum
2021-05-04 14:48                     ` Philippe Gerum
2021-05-05  5:43                       ` Jan Kiszka
2021-03-27 10:19 ` [PATCH v2 6/7] drivers/net: icmp: remove variable-length array Philippe Gerum
2021-04-07 10:24   ` Jan Kiszka
2021-03-27 10:19 ` [PATCH v2 7/7] drivers/net: cfg: fix config file load up Philippe Gerum
2021-04-07 10:35   ` Jan Kiszka
2021-05-04 17:18     ` Philippe Gerum
2021-04-07 10:39 ` [PATCH v2 0/7] assorted v5.x related fixups Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210327101912.2291474-2-rpm@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.