Sandipan Das <sandipan@xxxxxxxxxxxxx> writes: > Both 4K and 64K pages are supported on powerpc. Parts of > the selftest code perform alignment computations based on > the PAGE_SIZE macro which is currently hardcoded to 64K > for powerpc. This causes some test failures on kernels > configured with 4K page size. > > This problem is solved by determining the correct page > size during the build process rather than hardcoding it > in the header file. Doing it at build time is wrong, the test could be built on a 4K system and then run on a 64K system, or vice versa. You should just use getpagesize() at runtime. cheers > diff --git a/tools/testing/selftests/vm/Makefile b/tools/testing/selftests/vm/Makefile > index 4e9c741be6af..ada3a67eaac6 100644 > --- a/tools/testing/selftests/vm/Makefile > +++ b/tools/testing/selftests/vm/Makefile > @@ -4,6 +4,10 @@ uname_M := $(shell uname -m 2>/dev/null || echo not) > ARCH ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/') > > CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS) > +ifneq (,$(filter $(ARCH), ppc64 ppc64le)) > +protection_keys: EXTRA_CFLAGS += -DPAGE_SIZE=$(shell getconf PAGESIZE) > +endif > + > LDLIBS = -lrt > TEST_GEN_FILES = compaction_test > TEST_GEN_FILES += gup_benchmark > diff --git a/tools/testing/selftests/vm/pkey-powerpc.h b/tools/testing/selftests/vm/pkey-powerpc.h > index 3cd8e03fd640..07fa9f529014 100644 > --- a/tools/testing/selftests/vm/pkey-powerpc.h > +++ b/tools/testing/selftests/vm/pkey-powerpc.h > @@ -36,7 +36,6 @@ > pkey-31 and exec-only key */ > #define PKEY_BITS_PER_PKEY 2 > #define HPAGE_SIZE (1UL << 24) > -#define PAGE_SIZE (1UL << 16) > #define pkey_reg_t u64 > #define PKEY_REG_FMT "%016lx" > > -- > 2.17.1