[CRIU] [PATCH 2/2] include/common: Default to build host's page size

Christopher Covington cov at codeaurora.org
Wed Nov 2 10:15:20 PDT 2016


On PowerPC or arm64, different distributions may configure their
kernel to provide different page sizes (4k versus 64k for example).
CRIU must currently be built for a specific page size. Default to
using the build system's page size, to make native building work by
default. For cross-compiling or other situations, the default can
be overriden like so:

  rm criu/include/config.h
  make PAGE_SIZE=65536

Signed-off-by: Christopher Covington <cov at codeaurora.org>
---
 Makefile                               | 3 +++
 Makefile.config                        | 4 ++++
 include/common/arch/aarch64/asm/page.h | 5 +----
 include/common/arch/arm/asm/page.h     | 4 +---
 include/common/arch/ppc64/asm/page.h   | 9 +--------
 include/common/arch/x86/asm/page.h     | 4 +---
 6 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 4055fc8..5abd80b 100644
--- a/Makefile
+++ b/Makefile
@@ -178,6 +178,9 @@ include/common/asm: include/common/arch/$(ARCH)/asm
 	$(Q) ln -s ./arch/$(ARCH)/asm $@
 $(VERSION_HEADER): include/common/asm
 
+# Default to build host's page size (override with `make PAGE_SIZE=...`)
+PAGE_SIZE := $(shell getconf PAGESIZE)
+
 #
 # piegen tool might be disabled by hands. Don't use it until
 # you know what you're doing.
diff --git a/Makefile.config b/Makefile.config
index cce32fa..62a1e0f 100644
--- a/Makefile.config
+++ b/Makefile.config
@@ -44,6 +44,10 @@ $(CONFIG_HEADER): $(SRC_DIR)/scripts/feature-tests.mak
 	$(Q) @echo '#ifndef __CR_CONFIG_H__'				> $$@
 	$(Q) @echo '#define __CR_CONFIG_H__'				>> $$@
 	$(Q) @echo ''							>> $$@
+	$(Q) @echo '#ifndef PAGE_SIZE'					>> $$@
+	$(Q) @echo '  #define PAGE_SIZE '$$(PAGE_SIZE)'UL'		>> $$@
+	$(Q) @echo '#endif'						>> $$@
+	$(Q) @echo ''							>> $$@
 $(call map,gen-feature-test,$(FEATURES_LIST))
 ifeq ($$(VDSO),y)
 	$(Q) @echo '#define CONFIG_VDSO'				>> $$@
diff --git a/include/common/arch/aarch64/asm/page.h b/include/common/arch/aarch64/asm/page.h
index b9e6a03..62da857 100644
--- a/include/common/arch/aarch64/asm/page.h
+++ b/include/common/arch/aarch64/asm/page.h
@@ -2,10 +2,7 @@
 #define __CR_ASM_PAGE_H__
 
 #include <unistd.h>
-
-#ifndef PAGE_SIZE
-# define PAGE_SIZE	4096UL
-#endif
+#include "config.h"
 
 #ifndef PAGE_MASK
 # define PAGE_MASK	(~(PAGE_SIZE - 1))
diff --git a/include/common/arch/arm/asm/page.h b/include/common/arch/arm/asm/page.h
index 0c8cf21..dc5d7e5 100644
--- a/include/common/arch/arm/asm/page.h
+++ b/include/common/arch/arm/asm/page.h
@@ -1,9 +1,7 @@
 #ifndef __CR_ASM_PAGE_H__
 #define __CR_ASM_PAGE_H__
 
-#ifndef PAGE_SIZE
-# define PAGE_SIZE	4096UL
-#endif
+#include "config.h"
 
 #ifndef PAGE_MASK
 # define PAGE_MASK	(~(PAGE_SIZE - 1))
diff --git a/include/common/arch/ppc64/asm/page.h b/include/common/arch/ppc64/asm/page.h
index 1a68777..62da857 100644
--- a/include/common/arch/ppc64/asm/page.h
+++ b/include/common/arch/ppc64/asm/page.h
@@ -2,14 +2,7 @@
 #define __CR_ASM_PAGE_H__
 
 #include <unistd.h>
-
-/*
- * Default config for Pseries is to use 64K pages.
- * See kernel file arch/powerpc/configs/pseries_*defconfig
- */
-#ifndef PAGE_SIZE
-# define PAGE_SIZE	65536UL
-#endif
+#include "config.h"
 
 #ifndef PAGE_MASK
 # define PAGE_MASK	(~(PAGE_SIZE - 1))
diff --git a/include/common/arch/x86/asm/page.h b/include/common/arch/x86/asm/page.h
index 0c8cf21..dc5d7e5 100644
--- a/include/common/arch/x86/asm/page.h
+++ b/include/common/arch/x86/asm/page.h
@@ -1,9 +1,7 @@
 #ifndef __CR_ASM_PAGE_H__
 #define __CR_ASM_PAGE_H__
 
-#ifndef PAGE_SIZE
-# define PAGE_SIZE	4096UL
-#endif
+#include "config.h"
 
 #ifndef PAGE_MASK
 # define PAGE_MASK	(~(PAGE_SIZE - 1))
-- 
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.



More information about the CRIU mailing list