[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <201103290657.JEG17111.VOtOFJFLSQFMOH@I-love.SAKURA.ne.jp>
Date: Tue, 29 Mar 2011 06:57:41 +0900
From: Tetsuo Handa <penguin-kernel@...ove.SAKURA.ne.jp>
To: rostedt@...dmis.org
Cc: peterz@...radead.org, mingo@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [RFC] seqlock,lockdep: Add lock primitives to read_seqbegin().
Steven Rostedt wrote:
> This is where you confused me. Why would a pattern that was previously
> checked, suddenly break? If we found A->B and then come across B->A,
> lockdep should surely catch it.
I don't know. This bug can be triggered by simply running
while :; do newns /sbin/pivot_root /proc/ /proc/sys/; done
and
while :; do /bin/ls -l /proc/*/exe; done
in parallel. However, lockdep can't catch it even after applying
--- linux-2.6.38.1.orig/include/linux/seqlock.h
+++ linux-2.6.38.1/include/linux/seqlock.h
@@ -86,6 +86,11 @@ static inline int write_tryseqlock(seqlo
static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
{
unsigned ret;
+#ifdef CONFIG_PROVE_LOCKING
+ unsigned long flags;
+ spin_lock_irqsave(&((seqlock_t *) sl)->lock, flags);
+ spin_unlock_irqrestore(&((seqlock_t *) sl)->lock, flags);
+#endif
repeat:
ret = sl->sequence;
. Maybe usage of spin_lock_irqsave()/spin_unlock_irqrestore() is bad.
> Maybe I don't understand exactly whay you are trying to say.
Just apply the patch and run the 2 loops above in parallel using 2.6.38.1
will show you. Source code for newns is shown below.
---------- newns.c start ----------
#include <stdio.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sched.h>
#include <errno.h>
#include <stdlib.h>
static int child(void *arg)
{
char **argv = (char **) arg;
argv++;
execvp(argv[0], argv);
_exit(1);
}
int main(int argc, char *argv[])
{
char c = 0;
char *stack = malloc(8192);
const pid_t pid = clone(child, stack + (8192 / 2), CLONE_NEWNS,
(void *) argv);
while (waitpid(pid, NULL, __WALL) == EOF && errno == EINTR)
c++; /* Dummy. */
return 0;
}
---------- newns.c end ----------
Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists