FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 10-28-2011, 03:36 AM
Ben Hutchings
 
Default lockdep,rtmutex,bug: Show taint flags on error

Currently lock debugging is disabled when the kernel is tainted, with
a few exceptions. It is already recognised that this can be useful
for staging modules (TAINT_CRAP), but that also goes for out-of-tree
modules (TAINT_OOT_MODULE) so long as core kernel developers don't
have to spend time debugging them. Also, there are several reasons
for tainting that are unlikely to introduce false locking bug reports
(e.g. TAINT_FIRMWARE_WORKAROUND).

Instead of disabling lock debugging, show the taint flags in all
lockdep and rtmutex-debug error messages.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
kernel/lockdep.c | 23 +++++++++++++++--------
kernel/panic.c | 10 ----------
kernel/rtmutex-debug.c | 1 +
3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index e69434b..b2c4537 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -567,11 +567,12 @@ static void lockdep_print_held_locks(struct task_struct *curr)
}
}

-static void print_kernel_version(void)
+static void print_kernel_ident(void)
{
- printk("%s %.*s
", init_utsname()->release,
+ printk("%s %.*s %s
", init_utsname()->release,
(int)strcspn(init_utsname()->version, " "),
- init_utsname()->version);
+ init_utsname()->version,
+ print_tainted());
}

static int very_verbose(struct lock_class *class)
@@ -1148,7 +1149,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth,
printk("
");
printk("========================================== ============
");
printk("[ INFO: possible circular locking dependency detected ]
");
- print_kernel_version();
+ print_kernel_ident();
printk("-------------------------------------------------------
");
printk("%s/%d is trying to acquire lock:
",
curr->comm, task_pid_nr(curr));
@@ -1487,7 +1488,7 @@ print_bad_irq_dependency(struct task_struct *curr,
printk("========================================== ============
");
printk("[ INFO: %s-safe -> %s-unsafe lock order detected ]
",
irqclass, irqclass);
- print_kernel_version();
+ print_kernel_ident();
printk("------------------------------------------------------
");
printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:
",
curr->comm, task_pid_nr(curr),
@@ -1716,7 +1717,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
printk("
");
printk("========================================== ===
");
printk("[ INFO: possible recursive locking detected ]
");
- print_kernel_version();
+ print_kernel_ident();
printk("---------------------------------------------
");
printk("%s/%d is trying to acquire lock:
",
curr->comm, task_pid_nr(curr));
@@ -2223,7 +2224,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
printk("
");
printk("=================================
");
printk("[ INFO: inconsistent lock state ]
");
- print_kernel_version();
+ print_kernel_ident();
printk("---------------------------------
");

printk("inconsistent {%s} -> {%s} usage.
",
@@ -2288,7 +2289,7 @@ print_irq_inversion_bug(struct task_struct *curr,
printk("
");
printk("========================================== ===============
");
printk("[ INFO: possible irq lock inversion dependency detected ]
");
- print_kernel_version();
+ print_kernel_ident();
printk("---------------------------------------------------------
");
printk("%s/%d just changed the state of lock:
",
curr->comm, task_pid_nr(curr));
@@ -3169,6 +3170,7 @@ print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
printk("
");
printk("=====================================
");
printk("[ BUG: bad unlock balance detected! ]
");
+ print_kernel_ident();
printk("-------------------------------------
");
printk("%s/%d is trying to release lock (",
curr->comm, task_pid_nr(curr));
@@ -3613,6 +3615,7 @@ print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock,
printk("
");
printk("=================================
");
printk("[ BUG: bad contention detected! ]
");
+ print_kernel_ident();
printk("---------------------------------
");
printk("%s/%d is trying to contend lock (",
curr->comm, task_pid_nr(curr));
@@ -3987,6 +3990,7 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from,
printk("
");
printk("=========================
");
printk("[ BUG: held lock freed! ]
");
+ print_kernel_ident();
printk("-------------------------
");
printk("%s/%d is freeing memory %p-%p, with a lock still held there!
",
curr->comm, task_pid_nr(curr), mem_from, mem_to-1);
@@ -4044,6 +4048,7 @@ static void print_held_locks_bug(struct task_struct *curr)
printk("
");
printk("=====================================
");
printk("[ BUG: lock held at task exit time! ]
");
+ print_kernel_ident();
printk("-------------------------------------
");
printk("%s/%d is exiting with locks still held!
",
curr->comm, task_pid_nr(curr));
@@ -4141,6 +4146,7 @@ void lockdep_sys_exit(void)
printk("
");
printk("========================================== ======
");
printk("[ BUG: lock held when returning to user space! ]
");
+ print_kernel_ident();
printk("------------------------------------------------
");
printk("%s/%d is leaving the kernel with locks still held!
",
curr->comm, curr->pid);
@@ -4160,6 +4166,7 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
printk("
");
printk("===============================
");
printk("[ INFO: suspicious RCU usage. ]
");
+ print_kernel_ident();
printk("-------------------------------
");
printk("%s:%d %s!
", file, line, s);
printk("
other info that might help us debug this:

");
diff --git a/kernel/panic.c b/kernel/panic.c
index b2659360..ad03fb5 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -233,16 +233,6 @@ unsigned long get_taint(void)

void add_taint(unsigned flag)
{
- /*
- * Can't trust the integrity of the kernel anymore.
- * We don't call directly debug_locks_off() because the issue
- * is not necessarily serious enough to set oops_in_progress to 1
- * Also we want to keep up lockdep for staging development and
- * post-warning case.
- */
- if (flag != TAINT_CRAP && flag != TAINT_WARN && __debug_locks_off())
- printk(KERN_WARNING "Disabling lock debugging due to kernel taint
");
-
set_bit(flag, &tainted_mask);
}
EXPORT_SYMBOL(add_taint);
diff --git a/kernel/rtmutex-debug.c b/kernel/rtmutex-debug.c
index a2e7e72..077257f 100644
--- a/kernel/rtmutex-debug.c
+++ b/kernel/rtmutex-debug.c
@@ -101,6 +101,7 @@ void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)

printk("
============================================
");
printk( "[ BUG: circular locking deadlock detected! ]
");
+ printk("%s
", print_tainted());
printk( "--------------------------------------------
");
printk("%s/%d is deadlocking current task %s/%d

",
task->comm, task_pid_nr(task),
--
1.7.7




--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1319773015.6759.30.camel@deadeye">http://lists.debian.org/1319773015.6759.30.camel@deadeye
 
Old 10-31-2011, 12:59 AM
Rusty Russell
 
Default lockdep,rtmutex,bug: Show taint flags on error

On Fri, 28 Oct 2011 04:36:55 +0100, Ben Hutchings <ben@decadent.org.uk> wrote:
> Currently lock debugging is disabled when the kernel is tainted, with
> a few exceptions. It is already recognised that this can be useful
> for staging modules (TAINT_CRAP), but that also goes for out-of-tree
> modules (TAINT_OOT_MODULE) so long as core kernel developers don't
> have to spend time debugging them. Also, there are several reasons
> for tainting that are unlikely to introduce false locking bug reports
> (e.g. TAINT_FIRMWARE_WORKAROUND).
>
> Instead of disabling lock debugging, show the taint flags in all
> lockdep and rtmutex-debug error messages.
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Acked-by: Rusty Russell <rusty@rustcorp.com.au>


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 87lis1q5tc.fsf@rustcorp.com.au">http://lists.debian.org/87lis1q5tc.fsf@rustcorp.com.au
 
Old 11-16-2011, 08:52 PM
Ben Hutchings
 
Default lockdep,rtmutex,bug: Show taint flags on error

Please could you ack or nak this?

Ben.

On Fri, Oct 28, 2011 at 04:36:55AM +0100, Ben Hutchings wrote:
> Currently lock debugging is disabled when the kernel is tainted, with
> a few exceptions. It is already recognised that this can be useful
> for staging modules (TAINT_CRAP), but that also goes for out-of-tree
> modules (TAINT_OOT_MODULE) so long as core kernel developers don't
> have to spend time debugging them. Also, there are several reasons
> for tainting that are unlikely to introduce false locking bug reports
> (e.g. TAINT_FIRMWARE_WORKAROUND).
>
> Instead of disabling lock debugging, show the taint flags in all
> lockdep and rtmutex-debug error messages.
>
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> ---
> kernel/lockdep.c | 23 +++++++++++++++--------
> kernel/panic.c | 10 ----------
> kernel/rtmutex-debug.c | 1 +
> 3 files changed, 16 insertions(+), 18 deletions(-)
>
> diff --git a/kernel/lockdep.c b/kernel/lockdep.c
> index e69434b..b2c4537 100644
> --- a/kernel/lockdep.c
> +++ b/kernel/lockdep.c
> @@ -567,11 +567,12 @@ static void lockdep_print_held_locks(struct task_struct *curr)
> }
> }
>
> -static void print_kernel_version(void)
> +static void print_kernel_ident(void)
> {
> - printk("%s %.*s
", init_utsname()->release,
> + printk("%s %.*s %s
", init_utsname()->release,
> (int)strcspn(init_utsname()->version, " "),
> - init_utsname()->version);
> + init_utsname()->version,
> + print_tainted());
> }
>
> static int very_verbose(struct lock_class *class)
> @@ -1148,7 +1149,7 @@ print_circular_bug_header(struct lock_list *entry, unsigned int depth,
> printk("
");
> printk("========================================== ============
");
> printk("[ INFO: possible circular locking dependency detected ]
");
> - print_kernel_version();
> + print_kernel_ident();
> printk("-------------------------------------------------------
");
> printk("%s/%d is trying to acquire lock:
",
> curr->comm, task_pid_nr(curr));
> @@ -1487,7 +1488,7 @@ print_bad_irq_dependency(struct task_struct *curr,
> printk("========================================== ============
");
> printk("[ INFO: %s-safe -> %s-unsafe lock order detected ]
",
> irqclass, irqclass);
> - print_kernel_version();
> + print_kernel_ident();
> printk("------------------------------------------------------
");
> printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:
",
> curr->comm, task_pid_nr(curr),
> @@ -1716,7 +1717,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
> printk("
");
> printk("========================================== ===
");
> printk("[ INFO: possible recursive locking detected ]
");
> - print_kernel_version();
> + print_kernel_ident();
> printk("---------------------------------------------
");
> printk("%s/%d is trying to acquire lock:
",
> curr->comm, task_pid_nr(curr));
> @@ -2223,7 +2224,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
> printk("
");
> printk("=================================
");
> printk("[ INFO: inconsistent lock state ]
");
> - print_kernel_version();
> + print_kernel_ident();
> printk("---------------------------------
");
>
> printk("inconsistent {%s} -> {%s} usage.
",
> @@ -2288,7 +2289,7 @@ print_irq_inversion_bug(struct task_struct *curr,
> printk("
");
> printk("========================================== ===============
");
> printk("[ INFO: possible irq lock inversion dependency detected ]
");
> - print_kernel_version();
> + print_kernel_ident();
> printk("---------------------------------------------------------
");
> printk("%s/%d just changed the state of lock:
",
> curr->comm, task_pid_nr(curr));
> @@ -3169,6 +3170,7 @@ print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
> printk("
");
> printk("=====================================
");
> printk("[ BUG: bad unlock balance detected! ]
");
> + print_kernel_ident();
> printk("-------------------------------------
");
> printk("%s/%d is trying to release lock (",
> curr->comm, task_pid_nr(curr));
> @@ -3613,6 +3615,7 @@ print_lock_contention_bug(struct task_struct *curr, struct lockdep_map *lock,
> printk("
");
> printk("=================================
");
> printk("[ BUG: bad contention detected! ]
");
> + print_kernel_ident();
> printk("---------------------------------
");
> printk("%s/%d is trying to contend lock (",
> curr->comm, task_pid_nr(curr));
> @@ -3987,6 +3990,7 @@ print_freed_lock_bug(struct task_struct *curr, const void *mem_from,
> printk("
");
> printk("=========================
");
> printk("[ BUG: held lock freed! ]
");
> + print_kernel_ident();
> printk("-------------------------
");
> printk("%s/%d is freeing memory %p-%p, with a lock still held there!
",
> curr->comm, task_pid_nr(curr), mem_from, mem_to-1);
> @@ -4044,6 +4048,7 @@ static void print_held_locks_bug(struct task_struct *curr)
> printk("
");
> printk("=====================================
");
> printk("[ BUG: lock held at task exit time! ]
");
> + print_kernel_ident();
> printk("-------------------------------------
");
> printk("%s/%d is exiting with locks still held!
",
> curr->comm, task_pid_nr(curr));
> @@ -4141,6 +4146,7 @@ void lockdep_sys_exit(void)
> printk("
");
> printk("========================================== ======
");
> printk("[ BUG: lock held when returning to user space! ]
");
> + print_kernel_ident();
> printk("------------------------------------------------
");
> printk("%s/%d is leaving the kernel with locks still held!
",
> curr->comm, curr->pid);
> @@ -4160,6 +4166,7 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
> printk("
");
> printk("===============================
");
> printk("[ INFO: suspicious RCU usage. ]
");
> + print_kernel_ident();
> printk("-------------------------------
");
> printk("%s:%d %s!
", file, line, s);
> printk("
other info that might help us debug this:

");
> diff --git a/kernel/panic.c b/kernel/panic.c
> index b2659360..ad03fb5 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -233,16 +233,6 @@ unsigned long get_taint(void)
>
> void add_taint(unsigned flag)
> {
> - /*
> - * Can't trust the integrity of the kernel anymore.
> - * We don't call directly debug_locks_off() because the issue
> - * is not necessarily serious enough to set oops_in_progress to 1
> - * Also we want to keep up lockdep for staging development and
> - * post-warning case.
> - */
> - if (flag != TAINT_CRAP && flag != TAINT_WARN && __debug_locks_off())
> - printk(KERN_WARNING "Disabling lock debugging due to kernel taint
");
> -
> set_bit(flag, &tainted_mask);
> }
> EXPORT_SYMBOL(add_taint);
> diff --git a/kernel/rtmutex-debug.c b/kernel/rtmutex-debug.c
> index a2e7e72..077257f 100644
> --- a/kernel/rtmutex-debug.c
> +++ b/kernel/rtmutex-debug.c
> @@ -101,6 +101,7 @@ void debug_rt_mutex_print_deadlock(struct rt_mutex_waiter *waiter)
>
> printk("
============================================
");
> printk( "[ BUG: circular locking deadlock detected! ]
");
> + printk("%s
", print_tainted());
> printk( "--------------------------------------------
");
> printk("%s/%d is deadlocking current task %s/%d

",
> task->comm, task_pid_nr(task),
> --
> 1.7.7
>
>
>

--
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
- Albert Camus


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20111116215236.GD3366@decadent.org.uk">http://lists.debian.org/20111116215236.GD3366@decadent.org.uk
 
Old 11-16-2011, 09:24 PM
Dave Jones
 
Default lockdep,rtmutex,bug: Show taint flags on error

On Wed, Nov 16, 2011 at 09:52:36PM +0000, Ben Hutchings wrote:
> Please could you ack or nak this?
>
> Ben.

sorry, thought I already had.

Reviewed-by: Dave Jones <davej@redhat.com>


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 20111116222402.GB29305@redhat.com">http://lists.debian.org/20111116222402.GB29305@redhat.com
 
Old 11-17-2011, 07:48 AM
Peter Zijlstra
 
Default lockdep,rtmutex,bug: Show taint flags on error

On Wed, 2011-11-16 at 21:52 +0000, Ben Hutchings wrote:
> On Fri, Oct 28, 2011 at 04:36:55AM +0100, Ben Hutchings wrote:
> > Currently lock debugging is disabled when the kernel is tainted, with
> > a few exceptions. It is already recognised that this can be useful
> > for staging modules (TAINT_CRAP), but that also goes for out-of-tree
> > modules (TAINT_OOT_MODULE) so long as core kernel developers don't
> > have to spend time debugging them. Also, there are several reasons
> > for tainting that are unlikely to introduce false locking bug reports
> > (e.g. TAINT_FIRMWARE_WORKAROUND).



> > Instead of disabling lock debugging, show the taint flags in all
> > lockdep and rtmutex-debug error messages.


So this is two patches in one. I took the last part, the printing of the
taint flags thing, not the first part.

I did a small patch adding TAINT_FIRMWARE_WORKAROUND to the list of
TAINTS that shouldn't disable lockdep.

As for OOT_MODULE, with staging the only reason not to merge a module is
it being the wrong license and I really can't be arsed about OOT stuff
anyway, so no.


--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1321519709.27735.13.camel@twins">http://lists.debian.org/1321519709.27735.13.camel@twins
 
Old 11-17-2011, 02:18 PM
Ben Hutchings
 
Default lockdep,rtmutex,bug: Show taint flags on error

rap,On Thu, 2011-11-17 at 09:48 +0100, Peter Zijlstra wrote:
> On Wed, 2011-11-16 at 21:52 +0000, Ben Hutchings wrote:
> > On Fri, Oct 28, 2011 at 04:36:55AM +0100, Ben Hutchings wrote:
> > > Currently lock debugging is disabled when the kernel is tainted, with
> > > a few exceptions. It is already recognised that this can be useful
> > > for staging modules (TAINT_CRAP), but that also goes for out-of-tree
> > > modules (TAINT_OOT_MODULE) so long as core kernel developers don't
> > > have to spend time debugging them. Also, there are several reasons
> > > for tainting that are unlikely to introduce false locking bug reports
> > > (e.g. TAINT_FIRMWARE_WORKAROUND).
>
>
>
> > > Instead of disabling lock debugging, show the taint flags in all
> > > lockdep and rtmutex-debug error messages.
>
>
> So this is two patches in one. I took the last part, the printing of the
> taint flags thing, not the first part.
>
> I did a small patch adding TAINT_FIRMWARE_WORKAROUND to the list of
> TAINTS that shouldn't disable lockdep.
>
> As for OOT_MODULE, with staging the only reason not to merge a module is
> it being the wrong license and I really can't be arsed about OOT stuff
> anyway, so no.

That's not true. For example, VirtualBox OSE is GPL but would not be
accepted into staging. But if VirtualBox developers want to use lockdep
to fix their crap, we shouldn't stop them.

Ben.

--
Ben Hutchings
The world is coming to an end. Please log off.
 

Thread Tools




All times are GMT. The time now is 10:38 PM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org