Skip to contentSkip to conversation

perf tools: Fix lockup using 32-bit compat vdso

PATCH In review Adrian Hunter 3 participants 3 messages Jul 7, 2015 – Jul 10, 2015 perf events

lore
Share & tools
lore

Adrian Hunter

author reviewer
#0 lore raw

PATCH 1/1 perf tools: Fix lockup using 32-bit compat vdso

__machine__findnew_compat() is called only from
__machine__findnew_vdso_compat() which is called
only from machine__findnew_vdso() which already
holds machine->dsos.lock, so remove locking from
__machine__findnew_compat().

This manifests itself tracing 32-bit programs
with a 64-bit perf.

---
 tools/perf/util/vdso.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
tools/perf/util/vdso.c +3 -5
index 4b89118f158d..44d440da15dc 100644
@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine,
 	const char *file_name;
 	struct dso *dso;
 
-	pthread_rwlock_wrlock(&machine->dsos.lock);
 	dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true);
 	if (dso)
-		goto out_unlock;
+		goto out;
 
 	file_name = vdso__get_compat_file(vdso_file);
 	if (!file_name)
-		goto out_unlock;
+		goto out;
 
 	dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name);
-out_unlock:
-	pthread_rwlock_unlock(&machine->dsos.lock);
+out:
 	return dso;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

Em Tue, Jul 07, 2015 at 02:13:38PM +0300, Adrian Hunter escreveu:

Quoted 8 lines

__machine__findnew_compat() is called only from
__machine__findnew_vdso_compat() which is called
only from machine__findnew_vdso() which already
holds machine->dsos.lock, so remove locking from
__machine__findnew_compat().

This manifests itself tracing 32-bit programs
with a 64-bit perf.

Thanks, applying it to my perf/urgent branch.

- Arnaldo

#2 lore raw
In reply to Adrian Hunter
perf tools: Fix lockup using 32-bit compat vdso
Commit-ID:  6d545a632fbbce79492ba535b15ea0142aa3e80d
Gitweb:     http://git.kernel.org/tip/6d545a632fbbce79492ba535b15ea0142aa3e80d
Author:     Adrian Hunter <[email protected]>
AuthorDate: Tue, 7 Jul 2015 14:13:38 +0300
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 7 Jul 2015 11:05:08 -0300

perf tools: Fix lockup using 32-bit compat vdso

The __machine__findnew_compat() function is called only from __machine__findnew_vdso_compat() which is called only from machine__findnew_vdso() which already holds machine->dsos.lock, so remove locking from __machine__findnew_compat().

This manifests itself tracing 32-bit programs with a 64-bit perf.

---
 tools/perf/util/vdso.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
tools/perf/util/vdso.c +3 -5
index 4b89118..44d440d 100644
@@ -236,18 +236,16 @@ static struct dso *__machine__findnew_compat(struct machine *machine,
 	const char *file_name;
 	struct dso *dso;
 
-	pthread_rwlock_wrlock(&machine->dsos.lock);
 	dso = __dsos__find(&machine->dsos, vdso_file->dso_name, true);
 	if (dso)
-		goto out_unlock;
+		goto out;
 
 	file_name = vdso__get_compat_file(vdso_file);
 	if (!file_name)
-		goto out_unlock;
+		goto out;
 
 	dso = __machine__addnew_vdso(machine, vdso_file->dso_name, file_name);
-out_unlock:
-	pthread_rwlock_unlock(&machine->dsos.lock);
+out:
 	return dso;
 }