public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: torvalds@linux-foundation.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/9] liblockdep: Wrap kernel/lockdep.c to allow usage from userspace
Date: Wed, 8 May 2013 15:35:47 +0200	[thread overview]
Message-ID: <20130508133547.GA8386@dyad.programming.kicks-ass.net> (raw)
In-Reply-To: <518A52D2.4050505@oracle.com>

On Wed, May 08, 2013 at 09:27:46AM -0400, Sasha Levin wrote:
> [snip]
> 
> Hi Peter,
> 
> You're right - I broke multithreading for some odd reason (mostly me being stupid)
> after having it working :/
> 
> It's enough to set the __thread flag on current_obj:
> 
> 	diff --git a/tools/lib/lockdep/common.c b/tools/lib/lockdep/common.c
> 	index eb5e481..8ef602f 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 struct task_struct current_obj;
> 	+static __thread struct task_struct current_obj;
> 	
> 	 /* lockdep wants these */
> 	 bool debug_locks = true;
> 
> Since we don't need any special initialization of the struct at any point. This
> means that the patch above is enough and we don't need to hook pthread_create.
> 

I tried googling but failed to find the TLS initialization rules. Are they
zero'd for each thread or copied about or what? And is this documented or
implementation behaviour?

If its consistently zero'd then I suppose you're right and we can get away with
just adding __thread; *phew*.

  reply	other threads:[~2013-05-08 13:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-30 18:54 [PATCH 0/9] liblockdep: userspace lockdep Sasha Levin
2013-04-30 18:54 ` [PATCH 1/9] lockdep: Be nice about building from userspace Sasha Levin
2013-04-30 18:54 ` [PATCH 2/9] liblockdep: Wrap kernel/lockdep.c to allow usage " Sasha Levin
2013-05-08 10:01   ` Peter Zijlstra
2013-05-08 13:27     ` Sasha Levin
2013-05-08 13:35       ` Peter Zijlstra [this message]
2013-05-08 13:53         ` Sasha Levin
2013-04-30 18:54 ` [PATCH 3/9] liblockdep: Add public headers for pthread_mutex_t implementation Sasha Levin
2013-04-30 18:54 ` [PATCH 4/9] liblockdep: Add pthread_mutex_t test suite Sasha Levin
2013-04-30 18:54 ` [PATCH 5/9] liblockdep: Add public headers for pthread_rwlock_t implementation Sasha Levin
2013-04-30 18:54 ` [PATCH 6/9] liblockdep: Add pthread_rwlock_t test suite Sasha Levin
2013-04-30 18:54 ` [PATCH 7/9] liblockdep: Support using LD_PRELOAD Sasha Levin
2013-05-08 10:22   ` Peter Zijlstra
2013-05-08 13:29     ` Sasha Levin
2013-04-30 18:54 ` [PATCH 8/9] liblockdep: Add the 'lockdep' user-space utility Sasha Levin
2013-04-30 18:54 ` [PATCH 9/9] liblockdep: Add a MAINTAINERS entry Sasha Levin
2013-05-07 16:15 ` [PATCH 0/9] liblockdep: userspace lockdep 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=20130508133547.GA8386@dyad.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sasha.levin@oracle.com \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox