linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm/mapping_dirty_helpers: Guard hugepage pud's usage
@ 2021-04-09 16:51 Zack Rusin
  0 siblings, 0 replies; only message in thread
From: Zack Rusin @ 2021-04-09 16:51 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Thomas Hellström, linux-mm

Mapping dirty helpers have, so far, been only used on X86, but
a port of vmwgfx to ARM64 exposed a problem which results
in a compilation error on ARM64 systems:
mm/mapping_dirty_helpers.c: In function ‘wp_clean_pud_entry’:
mm/mapping_dirty_helpers.c:172:32: error: implicit declaration of function ‘pud_dirty’; did you mean ‘pmd_dirty’? [-Werror=implicit-function-declaration]

This is due to the fact that mapping_dirty_helpers code assumes
that pud_dirty is always defined, which is not the case for
architectures that don't define CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD.

ARM64 arch is a little inconsistent when it comes to PUD
hugepage helpers, e.g. it defines pud_young but not pud_dirty
but regardless of that the core kernel code shouldn't assume
that any of the PUD hugepage helpers are available unless
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD is defined. This
prevents compilation errors whenever one of the drivers
is ported to new architectures.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Hellström (Intel) <thomas_os@shipmail.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
---
 mm/mapping_dirty_helpers.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/mapping_dirty_helpers.c b/mm/mapping_dirty_helpers.c
index b59054ef2e10..b890854ec761 100644
--- a/mm/mapping_dirty_helpers.c
+++ b/mm/mapping_dirty_helpers.c
@@ -165,10 +165,12 @@ static int wp_clean_pud_entry(pud_t *pud, unsigned long addr, unsigned long end,
 		return 0;
 	}
 
+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
 	/* Huge pud */
 	walk->action = ACTION_CONTINUE;
 	if (pud_trans_huge(pudval) || pud_devmap(pudval))
 		WARN_ON(pud_write(pudval) || pud_dirty(pudval));
+#endif
 
 	return 0;
 }
-- 
2.27.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-09 16:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-09 16:51 [PATCH v2] mm/mapping_dirty_helpers: Guard hugepage pud's usage Zack Rusin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).