gnu: jemalloc: Fix tests for aarch64.

* gnu/packages/patches/jemalloc-arm-address-bits.patch: New patch.
* gnu/packages/jemalloc.scm (jemalloc)[source]: Use it.
* gnu/local.mk (dist_patch_DATA): Add it.
This commit is contained in:
Eric Bavier 2017-12-07 12:09:09 -06:00 committed by Eric Bavier
parent 7f04197fef
commit aa5c206348
No known key found for this signature in database
GPG Key ID: FD73CAC719D32566
3 changed files with 44 additions and 1 deletions

View File

@ -757,6 +757,7 @@ dist_patch_DATA = \
%D%/packages/patches/isl-0.11.1-aarch64-support.patch \ %D%/packages/patches/isl-0.11.1-aarch64-support.patch \
%D%/packages/patches/jacal-fix-texinfo.patch \ %D%/packages/patches/jacal-fix-texinfo.patch \
%D%/packages/patches/java-powermock-fix-java-files.patch \ %D%/packages/patches/java-powermock-fix-java-files.patch \
%D%/packages/patches/jemalloc-arm-address-bits.patch \
%D%/packages/patches/jbig2dec-ignore-testtest.patch \ %D%/packages/patches/jbig2dec-ignore-testtest.patch \
%D%/packages/patches/jbig2dec-CVE-2016-9601.patch \ %D%/packages/patches/jbig2dec-CVE-2016-9601.patch \
%D%/packages/patches/jbig2dec-CVE-2017-7885.patch \ %D%/packages/patches/jbig2dec-CVE-2017-7885.patch \

View File

@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -24,6 +25,7 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages perl) #:use-module (gnu packages perl)
#:use-module (guix build-system gnu)) #:use-module (guix build-system gnu))
@ -38,7 +40,8 @@
version "/jemalloc-" version ".tar.bz2")) version "/jemalloc-" version ".tar.bz2"))
(sha256 (sha256
(base32 (base32
"1sf3lzgb0y8nnyzmp4zrca3sngdxw3kfh20sna9z03jv74fph528")))) "1sf3lzgb0y8nnyzmp4zrca3sngdxw3kfh20sna9z03jv74fph528"))
(patches (search-patches "jemalloc-arm-address-bits.patch"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:phases `(#:phases

View File

@ -0,0 +1,39 @@
From 8cfc9dec37b312a2686f602bbcdd102ca07cca99 Mon Sep 17 00:00:00 2001
From: David Goldblatt <davidgoldblatt@fb.com>
Date: Fri, 29 Sep 2017 13:54:08 -0700
Subject: [PATCH] ARM: Don't extend bit LG_VADDR to compute high address bits.
In userspace ARM on Linux, zero-ing the high bits is the correct way to do this.
This doesn't fix the fact that we currently set LG_VADDR to 48 on ARM, when in
fact larger virtual address sizes are coming soon. We'll cross that bridge when
we come to it.
---
include/jemalloc/internal/rtree.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/jemalloc/internal/rtree.h b/include/jemalloc/internal/rtree.h
index b5d4db39..4563db23 100644
--- a/include/jemalloc/internal/rtree.h
+++ b/include/jemalloc/internal/rtree.h
@@ -178,9 +178,21 @@ rtree_leaf_elm_bits_read(tsdn_t *tsdn, rtree_t *rtree, rtree_leaf_elm_t *elm,
JEMALLOC_ALWAYS_INLINE extent_t *
rtree_leaf_elm_bits_extent_get(uintptr_t bits) {
+# ifdef __aarch64__
+ /*
+ * aarch64 doesn't sign extend the highest virtual address bit to set
+ * the higher ones. Instead, the high bits gets zeroed.
+ */
+ uintptr_t high_bit_mask = ((uintptr_t)1 << LG_VADDR) - 1;
+ /* Mask off the slab bit. */
+ uintptr_t low_bit_mask = ~(uintptr_t)1;
+ uintptr_t mask = high_bit_mask & low_bit_mask;
+ return (extent_t *)(bits & mask);
+# else
/* Restore sign-extended high bits, mask slab bit. */
return (extent_t *)((uintptr_t)((intptr_t)(bits << RTREE_NHIB) >>
RTREE_NHIB) & ~((uintptr_t)0x1));
+# endif
}
JEMALLOC_ALWAYS_INLINE szind_t