Enable systemtap on Power and S/390 and sync up with upstream

This commit is contained in:
Siddhesh Poyarekar 2014-01-07 15:06:38 +05:30
parent 8e0f85bf4e
commit 216cf91d8b
3 changed files with 108 additions and 104 deletions

View File

@ -1,20 +1,20 @@
diff -Nrup a/malloc/arena.c b/malloc/arena.c diff -pruN a/malloc/arena.c b/malloc/arena.c
--- a/malloc/arena.c 2012-05-29 16:45:53.000000000 -0600 --- a/malloc/arena.c 2014-01-07 07:07:47.000000000 +0530
+++ b/malloc/arena.c 2012-05-30 00:13:40.683514016 -0600 +++ b/malloc/arena.c 2014-01-07 14:11:40.093628218 +0530
@@ -673,7 +673,7 @@ heap_trim(heap_info *heap, size_t pad) @@ -702,7 +702,7 @@ heap_trim (heap_info *heap, size_t pad)
heap = prev_heap; if (!prev_inuse (p)) /* consolidate backward */
if(!prev_inuse(p)) { /* consolidate backward */ {
p = prev_chunk(p); p = prev_chunk (p);
- unlink(p, bck, fwd); - unlink (p, bck, fwd);
+ unlink(ar_ptr, p, bck, fwd); + unlink (ar_ptr, p, bck, fwd);
} }
assert(((unsigned long)((char*)p + new_size) & (pagesz-1)) == 0); assert (((unsigned long) ((char *) p + new_size) & (pagesz - 1)) == 0);
assert( ((char*)p + new_size) == ((char*)heap + heap->size) ); assert (((char *) p + new_size) == ((char *) heap + heap->size));
diff -Nrup a/malloc/hooks.c b/malloc/hooks.c diff -pruN a/malloc/hooks.c b/malloc/hooks.c
--- a/malloc/hooks.c 2012-05-29 16:45:53.000000000 -0600 --- a/malloc/hooks.c 2014-01-07 07:07:47.000000000 +0530
+++ b/malloc/hooks.c 2012-05-30 00:13:40.684514011 -0600 +++ b/malloc/hooks.c 2014-01-07 14:12:41.804625603 +0530
@@ -191,7 +191,9 @@ top_check(void) @@ -237,7 +237,9 @@ top_check (void)
(char*)t + chunksize(t) == mp_.sbrk_base + main_arena.system_mem))) (char *) t + chunksize (t) == mp_.sbrk_base + main_arena.system_mem)))
return 0; return 0;
+ mutex_unlock(&main_arena); + mutex_unlock(&main_arena);
@ -22,95 +22,95 @@ diff -Nrup a/malloc/hooks.c b/malloc/hooks.c
+ mutex_lock(&main_arena); + mutex_lock(&main_arena);
/* Try to set up a new top chunk. */ /* Try to set up a new top chunk. */
brk = MORECORE(0); brk = MORECORE (0);
diff -Nrup a/malloc/malloc.c b/malloc/malloc.c diff -pruN a/malloc/malloc.c b/malloc/malloc.c
--- a/malloc/malloc.c 2012-05-29 16:45:53.000000000 -0600 --- a/malloc/malloc.c 2014-01-07 07:07:47.000000000 +0530
+++ b/malloc/malloc.c 2012-05-30 00:13:40.686514001 -0600 +++ b/malloc/malloc.c 2014-01-07 14:29:53.370581893 +0530
@@ -1424,12 +1424,14 @@ typedef struct malloc_chunk* mbinptr; @@ -1404,11 +1404,15 @@ typedef struct malloc_chunk *mbinptr;
#define last(b) ((b)->bk) #define last(b) ((b)->bk)
/* Take a chunk off a bin list */ /* Take a chunk off a bin list */
-#define unlink(P, BK, FD) { \ -#define unlink(P, BK, FD) { \
+#define unlink(AV, P, BK, FD) { \ +#define unlink(AV, P, BK, FD) { \
FD = P->fd; \ FD = P->fd; \
BK = P->bk; \ BK = P->bk; \
- if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \ if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \
+ if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \ - malloc_printerr (check_action, "corrupted double-linked list", P); \
+ mutex_unlock(&(AV)->mutex); \ + { \
malloc_printerr (check_action, "corrupted double-linked list", P); \ + mutex_unlock(&(AV)->mutex); \
- else { \ + malloc_printerr (check_action, "corrupted double-linked list", P); \
+ mutex_lock(&(AV)->mutex); \ + mutex_lock(&(AV)->mutex); \
+ } else { \ + } \
FD->bk = BK; \ else { \
BK->fd = FD; \ FD->bk = BK; \
if (!in_smallbin_range (P->size) \ BK->fd = FD; \
@@ -2511,7 +2513,9 @@ static void* sysmalloc(INTERNAL_SIZE_T n @@ -2524,7 +2528,9 @@ sysmalloc (INTERNAL_SIZE_T nb, mstate av
else if (contiguous (av) && old_size && brk < old_end)
{
/* Oops! Someone else killed our space.. Can't touch anything. */
+ mutex_unlock(&av->mutex);
malloc_printerr (3, "break adjusted to free malloc space", brk);
+ mutex_lock(&av->mutex);
}
else if (contiguous(av) && old_size && brk < old_end) { /*
/* Oops! Someone else killed our space.. Can't touch anything. */ @@ -3353,7 +3359,9 @@ _int_malloc (mstate av, size_t bytes)
+ mutex_unlock(&av->mutex); {
malloc_printerr (3, "break adjusted to free malloc space", brk); errstr = "malloc(): memory corruption (fast)";
+ mutex_lock(&av->mutex); errout:
} + mutex_unlock(&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem (victim));
+ mutex_lock(&av->mutex);
return NULL;
}
check_remalloced_chunk (av, victim, nb);
@@ -3441,8 +3449,12 @@ _int_malloc (mstate av, size_t bytes)
bck = victim->bk;
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
|| __builtin_expect (victim->size > av->system_mem, 0))
- malloc_printerr (check_action, "malloc(): memory corruption",
- chunk2mem (victim));
+ {
+ void *p = chunk2mem(victim);
+ mutex_unlock(&av->mutex);
+ malloc_printerr (check_action, "malloc(): memory corruption", p);
+ mutex_lock(&av->mutex);
+ }
size = chunksize (victim);
/* /*
@@ -3345,7 +3349,9 @@ _int_malloc(mstate av, size_t bytes) @@ -3589,7 +3601,7 @@ _int_malloc (mstate av, size_t bytes)
{ victim = victim->fd;
errstr = "malloc(): memory corruption (fast)";
errout:
+ mutex_unlock(&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem (victim));
+ mutex_lock(&av->mutex);
return NULL;
}
check_remalloced_chunk(av, victim, nb);
@@ -3430,8 +3436,12 @@ _int_malloc(mstate av, size_t bytes)
bck = victim->bk;
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
|| __builtin_expect (victim->size > av->system_mem, 0))
- malloc_printerr (check_action, "malloc(): memory corruption",
- chunk2mem (victim));
+ {
+ void *p = chunk2mem(victim);
+ mutex_unlock(&av->mutex);
+ malloc_printerr (check_action, "malloc(): memory corruption", p);
+ mutex_lock(&av->mutex);
+ }
size = chunksize(victim);
/* remainder_size = size - nb;
@@ -3572,7 +3582,7 @@ _int_malloc(mstate av, size_t bytes) - unlink (victim, bck, fwd);
victim = victim->fd; + unlink (av, victim, bck, fwd);
remainder_size = size - nb; /* Exhaust */
- unlink(victim, bck, fwd); if (remainder_size < MINSIZE)
+ unlink(av, victim, bck, fwd); @@ -3694,7 +3706,7 @@ _int_malloc (mstate av, size_t bytes)
remainder_size = size - nb;
/* Exhaust */ /* unlink */
if (remainder_size < MINSIZE) { - unlink (victim, bck, fwd);
@@ -3670,7 +3680,7 @@ _int_malloc(mstate av, size_t bytes) + unlink (av, victim, bck, fwd);
remainder_size = size - nb;
/* unlink */ /* Exhaust */
- unlink(victim, bck, fwd); if (remainder_size < MINSIZE)
+ unlink(av, victim, bck, fwd); @@ -3832,9 +3844,11 @@ _int_free (mstate av, mchunkptr p, int h
/* Exhaust */
if (remainder_size < MINSIZE) {
@@ -3805,9 +3815,11 @@ _int_free(mstate av, mchunkptr p, int ha
{ {
errstr = "free(): invalid pointer"; errstr = "free(): invalid pointer";
errout: errout:
- if (! have_lock && locked) - if (!have_lock && locked)
+ if (have_lock || locked) + if (have_lock || locked)
(void)mutex_unlock(&av->mutex); (void) mutex_unlock (&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem(p)); malloc_printerr (check_action, errstr, chunk2mem (p));
+ if (have_lock) + if (have_lock)
+ mutex_lock(&av->mutex); + mutex_lock(&av->mutex);
return; return;
} }
/* We know that each chunk is at least MINSIZE bytes in size or a /* We know that each chunk is at least MINSIZE bytes in size or a
@@ -3952,7 +3964,7 @@ _int_free(mstate av, mchunkptr p, int ha @@ -3981,7 +3995,7 @@ _int_free (mstate av, mchunkptr p, int h
prevsize = p->prev_size; prevsize = p->prev_size;
size += prevsize; size += prevsize;
p = chunk_at_offset(p, -((long) prevsize)); p = chunk_at_offset(p, -((long) prevsize));
@ -119,7 +119,7 @@ diff -Nrup a/malloc/malloc.c b/malloc/malloc.c
} }
if (nextchunk != av->top) { if (nextchunk != av->top) {
@@ -3961,7 +3973,7 @@ _int_free(mstate av, mchunkptr p, int ha @@ -3990,7 +4004,7 @@ _int_free (mstate av, mchunkptr p, int h
/* consolidate forward */ /* consolidate forward */
if (!nextinuse) { if (!nextinuse) {
@ -128,7 +128,7 @@ diff -Nrup a/malloc/malloc.c b/malloc/malloc.c
size += nextsize; size += nextsize;
} else } else
clear_inuse_bit_at_offset(nextchunk, 0); clear_inuse_bit_at_offset(nextchunk, 0);
@@ -4122,7 +4134,7 @@ static void malloc_consolidate(mstate av @@ -4151,7 +4165,7 @@ static void malloc_consolidate(mstate av
prevsize = p->prev_size; prevsize = p->prev_size;
size += prevsize; size += prevsize;
p = chunk_at_offset(p, -((long) prevsize)); p = chunk_at_offset(p, -((long) prevsize));
@ -137,7 +137,7 @@ diff -Nrup a/malloc/malloc.c b/malloc/malloc.c
} }
if (nextchunk != av->top) { if (nextchunk != av->top) {
@@ -4130,7 +4142,7 @@ static void malloc_consolidate(mstate av @@ -4159,7 +4173,7 @@ static void malloc_consolidate(mstate av
if (!nextinuse) { if (!nextinuse) {
size += nextsize; size += nextsize;
@ -146,22 +146,22 @@ diff -Nrup a/malloc/malloc.c b/malloc/malloc.c
} else } else
clear_inuse_bit_at_offset(nextchunk, 0); clear_inuse_bit_at_offset(nextchunk, 0);
@@ -4199,7 +4211,9 @@ _int_realloc(mstate av, mchunkptr oldp, @@ -4228,7 +4242,9 @@ _int_realloc(mstate av, mchunkptr oldp,
{ {
errstr = "realloc(): invalid old size"; errstr = "realloc(): invalid old size";
errout: errout:
+ mutex_unlock(&av->mutex); + mutex_unlock(&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem(oldp)); malloc_printerr (check_action, errstr, chunk2mem (oldp));
+ mutex_lock(&av->mutex); + mutex_lock(&av->mutex);
return NULL; return NULL;
} }
@@ -4241,7 +4255,7 @@ _int_realloc(mstate av, mchunkptr oldp, @@ -4274,7 +4290,7 @@ _int_realloc(mstate av, mchunkptr oldp,
(unsigned long)(newsize = oldsize + nextsize) >= (unsigned long) (nb))
(unsigned long)(nb)) { {
newp = oldp; newp = oldp;
- unlink(next, bck, fwd); - unlink (next, bck, fwd);
+ unlink(av, next, bck, fwd); + unlink (av, next, bck, fwd);
} }
/* allocate, copy, free */ /* allocate, copy, free */

View File

@ -1,6 +1,6 @@
%define glibcsrcdir glibc-2.18-702-g6c9642e %define glibcsrcdir glibc-2.18-753-gd5780fe
%define glibcversion 2.18.90 %define glibcversion 2.18.90
%define glibcrelease 19%{?dist} %define glibcrelease 20%{?dist}
# Pre-release tarballs are pulled in from git using a command that is # Pre-release tarballs are pulled in from git using a command that is
# effectively: # effectively:
# #
@ -69,7 +69,7 @@
# If the architecture has SDT probe point support then we build glibc with # If the architecture has SDT probe point support then we build glibc with
# --enable-systemtap and include all SDT probe points in the library. It is # --enable-systemtap and include all SDT probe points in the library. It is
# the eventual goal that all supported arches should be on this list. # the eventual goal that all supported arches should be on this list.
%define systemtaparches %{ix86} x86_64 %define systemtaparches %{ix86} x86_64 ppc ppc64 s390 s390x
############################################################################## ##############################################################################
# Add -s for a less verbose build output. # Add -s for a less verbose build output.
%define silentrules PARALLELMFLAGS= %define silentrules PARALLELMFLAGS=
@ -1620,6 +1620,10 @@ rm -f *.filelist*
%endif %endif
%changelog %changelog
* Tue Jan 7 2014 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.18.90-20
- Sync with upstream master.
- Enable systemtap probes on Power and S/390.
* Fri Dec 27 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.18.90-19 * Fri Dec 27 2013 Siddhesh Poyarekar <siddhesh@redhat.com> - 2.18.90-19
- Sync with upstream master. - Sync with upstream master.

View File

@ -1 +1 @@
9f6e8d8469b765f0f336284327234190 glibc-2.18-702-g6c9642e.tar.gz 8453361d6cfeec94dd6c7ad5ef1e01e1 glibc-2.18-753-gd5780fe.tar.gz