libhugetlbfs: add recipe
PATCH v2 1/1 libhugetlbfs: add recipe
From: Chunrong Guo <[email protected]>
Signed-off-by Chunrong Guo <[email protected]>
--- ...fs-Remove-segment-based-alignment-restric.patch | 131 ++++++++++++++++++++ ...-run_tests.py-fix-typo-in-test-invocation.patch | 30 +++++ .../files/Fix-cross-compiling-on-PPC.patch | 28 ++++ .../libhugetlbfs/files/aarch64-support.patch | 88 +++++++++++++ .../files/aarch64-unit-test-fixes.patch | 62 +++++++++ .../files/add-PROT-NONE-to-the-mprotest-test.patch | 38 ++++++ .../files/checks-if-mtab-is-a-symlink.patch | 30 +++++ .../libhugetlbfs/files/cross-compile.patch | 83 ++++++++++++ ...x-lib64-can-not-be-shiped-in-64bit-target.patch | 64 ++++++++++ .../libhugetlbfs/files/install64-fix.patch | 20 +++ ...s-Fix-perl-lib-can-not-be-shiped-to-sub-p.patch | 31 +++++ ...s-avoid-search-host-library-path-for-cros.patch | 99 +++++++++++++++ ...ng-LIB32-and-LIB64-if-they-point-to-the-s.patch | 48 +++++++ .../libhugetlbfs/libhugetlbfs_git.bb | 58 +++++++++ 14 files changed, 810 insertions(+), 0 deletions(-) create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0003-libhugetlbfs-Remove-segment-based-alignment-restric.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/0004-tests-run_tests.py-fix-typo-in-test-invocation.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/Fix-cross-compiling-on-PPC.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/aarch64-support.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/aarch64-unit-test-fixes.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/add-PROT-NONE-to-the-mprotest-test.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/checks-if-mtab-is-a-symlink.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/cross-compile.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/fix-lib64-can-not-be-shiped-in-64bit-target.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/install64-fix.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-Fix-perl-lib-can-not-be-shiped-to-sub-p.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-search-host-library-path-for-cros.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/files/skip-checking-LIB32-and-LIB64-if-they-point-to-the-s.patch create mode 100644 meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb
meta-oe/recipes-benchmark/libhugetlbfs/files/0003-libhugetlbfs-Remove-segment-based-alignment-restric.patch new file +131 -0
@@ -0,0 +1,131 @@ +Upstream-Status: Accepted + +From eee53989d5b7393352d77451b66066768113072a Mon Sep 17 00:00:00 2001 +From: Becky Bruce <[email protected]> +Date: Tue, 19 Apr 2011 14:13:18 -0500 +Subject: [PATCH 1/2] libhugetlbfs: Remove segment-based alignment restrictions + +The existing library code enforces classic PPC segment restrictons on the +alignment and allocation of hugepages. BookE Freescale processors +don't have this restriction and allowing it to remain in place +is overly restrictive on 32-bit processors. Define PPC_NO_SEGMENTS to +turn this off. + +Signed-off-by: Becky Bruce <[email protected]> +--- + Makefile | 2 +- + elflink.c | 7 ++++--- + libhugetlbfs_internal.h | 3 ++- + morecore.c | 2 +- + tests/brk_near_huge.c | 2 +- + tests/truncate_above_4GB.c | 6 ++++-- + 6 files changed, 13 insertions(+), 9 deletions(-) + +diff --git a/Makefile b/Makefile +index d781871..3160f83 100644 +--- a/Makefile ++++ b/Makefile +@@ -29,7 +29,7 @@ INSTALL = install + LDFLAGS += -Wl,-z,noexecstack -ldl + CFLAGS ?= -O2 -g + CFLAGS += -Wall -fPIC +-CPPFLAGS += -D__LIBHUGETLBFS__ ++CPPFLAGS += -D__LIBHUGETLBFS__ -DPPC_NO_SEGMENTS + + ARCH = $(shell uname -m | sed -e s/i.86/i386/) + +diff --git a/elflink.c b/elflink.c +index c24bedc..432f3d7 100644 +--- a/elflink.c ++++ b/elflink.c +@@ -552,7 +552,8 @@ bail2: + seg->extrasz = end_orig - start; + } + +-#if defined(__powerpc64__) || defined (__powerpc__) ++#if defined(__powerpc64__) || \ ++ (defined(__powerpc__) && !defined(PPC_NO_SEGMENTS)) + #define SLICE_LOW_TOP (0x100000000UL) + #define SLICE_LOW_SIZE (1UL << SLICE_LOW_SHIFT) + #define SLICE_HIGH_SIZE (1UL << SLICE_HIGH_SHIFT) +@@ -574,7 +575,7 @@ static unsigned long hugetlb_slice_start(unsigned long addr) + return SLICE_LOW_TOP; + else + return ALIGN_DOWN(addr, SLICE_HIGH_SIZE); +-#elif defined(__powerpc__) ++#elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS) + return ALIGN_DOWN(addr, SLICE_LOW_SIZE); + #else + return ALIGN_DOWN(addr, gethugepagesize()); +@@ -588,7 +589,7 @@ static unsigned long hugetlb_slice_end(unsigned long addr) + return ALIGN_UP(addr, SLICE_LOW_SIZE) - 1; + else + return ALIGN_UP(addr, SLICE_HIGH_SIZE) - 1; +-#elif defined(__powerpc__) ++#elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS) + return ALIGN_UP(addr, SLICE_LOW_SIZE) - 1; + #else + return ALIGN_UP(addr, gethugepagesize()) - 1; +diff --git a/libhugetlbfs_internal.h b/libhugetlbfs_internal.h +index 97b19fa..ef9f668 100644 +--- a/libhugetlbfs_internal.h ++++ b/libhugetlbfs_internal.h +@@ -49,7 +49,8 @@ + #define ALIGN_UP(x,a) ALIGN(x,a) + #define ALIGN_DOWN(x,a) ((x) & ~((a) - 1)) + +-#if defined(__powerpc64__) || defined (__powerpc__) ++#if defined(__powerpc64__) || \ ++ (defined(__powerpc__) && !defined(PPC_NO_SEGMENTS)) + #define SLICE_LOW_SHIFT 28 + #define SLICE_HIGH_SHIFT 40 + #elif defined(__ia64__) +diff --git a/morecore.c b/morecore.c +index 6b4364c..01c560e 100644 +--- a/morecore.c ++++ b/morecore.c +@@ -44,7 +44,7 @@ static long hugetlbfs_next_addr(long addr) + { + #if defined(__powerpc64__) + return ALIGN(addr, 1L << SLICE_HIGH_SHIFT); +-#elif defined(__powerpc__) ++#elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS) + return ALIGN(addr, 1L << SLICE_LOW_SHIFT); + #elif defined(__ia64__) + if (addr < (1UL << SLICE_HIGH_SHIFT)) +diff --git a/tests/brk_near_huge.c b/tests/brk_near_huge.c +index 71eb803..f6d1e07 100644 +--- a/tests/brk_near_huge.c ++++ b/tests/brk_near_huge.c +@@ -47,7 +47,7 @@ void *next_chunk(void *addr) + /* 1TB segments above */ + return PALIGN(addr, 0x10000000000UL); + } +-#elif defined(__powerpc__) ++#elif defined(__powerpc__) && !defined(PPC_NO_SEGMENTS) + void *next_chunk(void *addr) + { + return PALIGN(addr, 0x10000000UL); +diff --git a/tests/truncate_above_4GB.c b/tests/truncate_above_4GB.c +index 5b8c08f..4c427fc 100644 +--- a/tests/truncate_above_4GB.c ++++ b/tests/truncate_above_4GB.c +@@ -102,11 +102,13 @@ int main(int argc, char *argv[]) + *qi = 0; + + /* This part of the test makes the problem more obvious, but +- * is not essential. It can't be done on powerpc, where ++ * is not essential. It can't be done on segmented powerpc, where + * segment restrictions prohibit us from performing such a + * mapping, so skip it there. Similarly, ia64's address space + * restrictions prevent this. */ +-#if !defined(__powerpc__) && !defined(__powerpc64__) && !defined(__ia64__) ++#if (defined(__powerpc__) && defined(PPC_NO_SEGMENTS)) \ ++ || !defined(__powerpc__) && !defined(__powerpc64__) \ ++ && !defined(__ia64__) + /* Replace middle hpage by tinypage mapping to trigger + * nr_ptes BUG */ + verbose_printf("Replacing map at %p-%p...", q + hpage_size, +-- +1.5.6.5 +
meta-oe/recipes-benchmark/libhugetlbfs/files/0004-tests-run_tests.py-fix-typo-in-test-invocation.patch new file +30 -0
@@ -0,0 +1,30 @@ +From b3d5429449aef61cb8926c33925fd7b5cad737de Mon Sep 17 00:00:00 2001 +From: Becky Bruce <[email protected]> +Date: Tue, 19 Apr 2011 19:06:16 -0500 +Subject: [PATCH 2/2] tests/run_tests.py: fix typo in test invocation. + +One test was being invoked with HUGETLB_MORECORE=es (instead of yes)..... + +Upstream-Status: Accepted + +Signed-off-by: Becky Bruce <[email protected]> +--- + tests/run_tests.py | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/tests/run_tests.py b/tests/run_tests.py +index 8055940..f0049b3 100755 +--- a/tests/run_tests.py ++++ b/tests/run_tests.py +@@ -567,7 +567,7 @@ def functional_tests(): + do_test("heapshrink", LD_PRELOAD="libhugetlbfs.so libheapshrink.so", + HUGETLB_MORECORE="yes") + do_test("heapshrink", LD_PRELOAD="libheapshrink.so", HUGETLB_MORECORE="yes", +- HUGETLB_MORECORE_SHRINK="es") ++ HUGETLB_MORECORE_SHRINK="yes") + do_test("heapshrink", LD_PRELOAD="libhugetlbfs.so libheapshrink.so", + HUGETLB_MORECORE="yes", HUGETLB_MORECORE_SHRINK="yes") + do_test("heap-overflow", HUGETLB_VERBOSE="1", HUGETLB_MORECORE="yes") +-- +1.5.6.5 +
meta-oe/recipes-benchmark/libhugetlbfs/files/Fix-cross-compiling-on-PPC.patch new file +28 -0
@@ -0,0 +1,28 @@ +Upstream-Status: Accepted + +Renamed ARCH check to use powerpc (for ppc32) and powerpc64. + +Signed-off-by: Kumar Gala <[email protected]> +Signed-off-by: Guo Chunrong <[email protected]> + + +--- a/Makefileold 2013-09-05 03:19:24.261312044 -0500 ++++ b/Makefile 2013-09-05 03:20:43.312456972 -0500 +@@ -36,7 +36,7 @@ + + CUSTOM_LDSCRIPTS = yes + +-ifeq ($(ARCH),ppc64) ++ifeq ($(ARCH),powerpc64) + CC64 = $(CC) -m64 + ELF64 = elf64ppc + TMPLIB64 = lib64 +@@ -46,7 +46,7 @@ + ELF32 = elf32ppclinux + endif + else +-ifeq ($(ARCH),ppc) ++ifeq ($(ARCH),powerpc) + CC32 = $(CC) -m32 + ELF32 = elf32ppclinux + TMPLIB32 = lib
meta-oe/recipes-benchmark/libhugetlbfs/files/aarch64-support.patch new file +88 -0
88 lines not on this page · raw message
meta-oe/recipes-benchmark/libhugetlbfs/files/aarch64-unit-test-fixes.patch new file +62 -0
62 lines not on this page · raw message
meta-oe/recipes-benchmark/libhugetlbfs/files/add-PROT-NONE-to-the-mprotest-test.patch new file +38 -0
@@ -0,0 +1,38 @@ +Upstream-Status: Pending + +From c7fcb7270bb510d7271a1c0cea095a4dbea49420 Mon Sep 17 00:00:00 2001 +From: Steve Capper <[email protected]> +Date: Mon, 3 Jun 2013 17:00:45 +0100 +Subject: [PATCH] Add PROT_NONE to the mprotect test. + +The mprotect unit test checks PROT_READ and PROT_READ | PROT_WRITE +protections. We recently found that PROT_NONE wasn't properly +supported in our huge page kernel code. + +This patch adds PROT_NONE tests to mprotect. The expected behaviour +is that neither reads nor writes should succeed. + +Signed-off-by: Steve Capper <[email protected]> +--- + tests/mprotect.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/tests/mprotect.c b/tests/mprotect.c +index aa4673e..db6a662 100644 +--- a/tests/mprotect.c ++++ b/tests/mprotect.c +@@ -213,5 +213,11 @@ int main(int argc, char *argv[]) + test_mprotect(fd, "RW->R 1/2", 2*hpage_size, PROT_READ|PROT_WRITE, + hpage_size, PROT_READ); + ++ /* PROT_NONE tests */ ++ test_mprotect(fd, "NONE->R", hpage_size, PROT_NONE, ++ hpage_size, PROT_READ); ++ test_mprotect(fd, "NONE->RW", hpage_size, PROT_NONE, ++ hpage_size, PROT_READ|PROT_WRITE); ++ + PASS(); + } +-- +1.7.9.5 +
meta-oe/recipes-benchmark/libhugetlbfs/files/checks-if-mtab-is-a-symlink.patch new file +30 -0
@@ -0,0 +1,30 @@ +Upstream-Status: Accepted + +If /etc/mtab is a symlink to /proc/self/mounts, +mounting fails because addmntent returns an error. +As a consequence, the Private directory is unusable. +This is a patch which checks if /etc/mtab is a symlink, +and if so, doesn't try to call addmntent. + +Signed-off-by: Guo Chunrong <[email protected]> + + +--- a/hugeadm.c 2013-07-31 23:46:04.461258351 -0500 ++++ b/hugeadm.c 2013-07-31 23:50:03.249359534 -0500 +@@ -552,6 +552,16 @@ + return 1; + } + ++ char dummy; ++ int useMtab; ++ /* Check if mtab is a symlink */ ++ useMtab = (readlink(MOUNTED, &dummy, 1) < 0); ++ if (!useMtab) { ++ /* No need updating mtab */ ++ return 0; ++ } ++ ++ + mounts = setmntent(MOUNTED, "a+"); + if (mounts) { + entry.mnt_fsname = FS_NAME;
meta-oe/recipes-benchmark/libhugetlbfs/files/cross-compile.patch new file +83 -0
83 lines not on this page · raw message
meta-oe/recipes-benchmark/libhugetlbfs/files/fix-lib64-can-not-be-shiped-in-64bit-target.patch new file +64 -0
64 lines not on this page · raw message
meta-oe/recipes-benchmark/libhugetlbfs/files/install64-fix.patch new file +20 -0
@@ -0,0 +1,20 @@ +Upstream-Status: Inappropriate [oe-core specific] + +TESTS_64 is empty, install will fail due to missing file operand + + +Signed-off-by: Chunrong Guo <[email protected]> + +Index: git/tests/Makefile +=================================================================== +--- git.orig/tests/Makefile ++++ git/tests/Makefile +@@ -292,7 +292,7 @@ obj64/install: + $(INSTALL) -m 755 wrapper-utils.sh $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 $(HELPERS:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 $(HELPER_LIBS:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 +- $(INSTALL) -m 755 $(TESTS_64:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 ++# $(INSTALL) -m 755 $(TESTS_64:%=obj64/%) $(DESTDIR)$(INST_TESTSDIR64)/obj64 + $(INSTALL) -m 755 run_tests.py $(DESTDIR)$(INST_TESTSDIR64) + + install: $(OBJDIRS:%=%/install)
meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-Fix-perl-lib-can-not-be-shiped-to-sub-p.patch new file +31 -0
@@ -0,0 +1,31 @@ +Upstream-Status: Accepted + +From f6aab55052b8ad7b9498b325c8a26cac25703b01 Mon Sep 17 00:00:00 2001 +From: Yu Zongchun <[email protected]> +Date: Mon, 6 May 2013 18:06:02 +0800 +Subject: [PATCH] libhugetlbfs:Fix perl lib can not be shiped to sub-package + issue for 64bit board + +--- + Makefile | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/Makefile b/Makefile +index 03966b2..adbd91e 100644 +--- a/Makefile ++++ b/Makefile +@@ -149,7 +149,11 @@ LDSCRIPTDIR = $(PREFIX)/share/libhugetlbfs/ldscripts + BINDIR = $(PREFIX)/share/libhugetlbfs + EXEDIR = $(PREFIX)/bin + DOCDIR = $(PREFIX)/share/doc/libhugetlbfs ++ifdef CC32 + PMDIR = $(PREFIX)/lib/perl5/TLBC ++else ++PMDIR = $(PREFIX)/lib64/perl5/TLBC ++endif + MANDIR1 = $(PREFIX)/share/man/man1 + MANDIR3 = $(PREFIX)/share/man/man3 + MANDIR7 = $(PREFIX)/share/man/man7 +-- +1.7.5.4 +
meta-oe/recipes-benchmark/libhugetlbfs/files/libhugetlbfs-avoid-search-host-library-path-for-cros.patch new file +99 -0
99 lines not on this page · raw message
meta-oe/recipes-benchmark/libhugetlbfs/files/skip-checking-LIB32-and-LIB64-if-they-point-to-the-s.patch new file +48 -0
48 lines not on this page · raw message
meta-oe/recipes-benchmark/libhugetlbfs/libhugetlbfs_git.bb new file +58 -0
58 lines not on this page · raw message
Signature · 1 line
1.7.5.4
Quoted 3 lines · On Sun, Sep 22, 2013 at 6:22 AM, <[email protected]> wrote:
From: Chunrong Guo <[email protected]>
Signed-off-by Chunrong Guo <[email protected]>
It seems some of patches has been applied upstream so it makes more sense to use a newer snapshot and drop these patches.
Another thing which needs fix is to avoid dependency of -tests against the -dev package. Did you look at it?
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750