All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eunbong Song <eunb.song@samsung.com>
To: sasha.levin@oracle.com
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH] tools/liblockdep: change current_obj from thread-local storage to non thread-local storage
Date: Thu, 23 Apr 2015 06:55:20 +0000 (GMT)	[thread overview]
Message-ID: <1635690742.249841429772120132.JavaMail.weblogic@epmlwas03d> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 1438 bytes --]


current_obj is declared as a thread-local storage.
This prevent to detect locking  problem between multiple threads because
each thread has it's own current_obj. liblockdep can only detect locking problem in a single
thread. However, pthread_mutex_xxx, pthread_rwlock_xxx functions are mainly used for synchro
nization of data between multiple threads.
This patch changes current_obj to non thread-local storage. and current_obj.pid is getting
from getpid system call.

Signed-off-by: Eunbong Song <eunb.song@samsung.com>
---
 tools/lib/lockdep/common.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c
index 8ef602f..6b9a6eb 100644
--- a/tools/lib/lockdep/common.c
+++ b/tools/lib/lockdep/common.c
@@ -5,7 +5,7 @@
 #include <unistd.h>
 #include <sys/syscall.h>
 
-static __thread struct task_struct current_obj;
+static struct task_struct current_obj;
 
 /* lockdep wants these */
 bool debug_locks = true;
@@ -26,7 +26,7 @@ struct task_struct *__curr(void)
 	if (current_obj.pid == 0) {
 		/* Makes lockdep output pretty */
 		prctl(PR_GET_NAME, current_obj.comm);
-		current_obj.pid = syscall(__NR_gettid);
+		current_obj.pid = syscall(__NR_getpid);
 	}
 
 	return &current_obj;
-- 
1.7.0.1
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

             reply	other threads:[~2015-04-23  6:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  6:55 Eunbong Song [this message]
2015-04-23 16:18 ` [PATCH] tools/liblockdep: change current_obj from thread-local storage to non thread-local storage Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1635690742.249841429772120132.JavaMail.weblogic@epmlwas03d \
    --to=eunb.song@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sasha.levin@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.