From: Ben Hutchings <ben@decadent.org.uk>
To: Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>
Cc: Nick Bowler <nbowler@elliptictech.com>, Greg KH <greg@kroah.com>,
Dave Jones <davej@redhat.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Randy Dunlap <rdunlap@xenotime.net>,
LKML <linux-kernel@vger.kernel.org>,
Debian kernel maintainers <debian-kernel@lists.debian.org>
Subject: Re: [PATCH 1/2] lockdep,rtmutex,bug: Show taint flags on error
Date: Wed, 16 Nov 2011 21:52:36 +0000 [thread overview]
Message-ID: <20111116215236.GD3366@decadent.org.uk> (raw)
In-Reply-To: <1319773015.6759.30.camel@deadeye>
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\n", init_utsname()->release,
> + printk("%s %.*s %s\n", 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("\n");
> printk("======================================================\n");
> printk("[ INFO: possible circular locking dependency detected ]\n");
> - print_kernel_version();
> + print_kernel_ident();
> printk("-------------------------------------------------------\n");
> printk("%s/%d is trying to acquire lock:\n",
> curr->comm, task_pid_nr(curr));
> @@ -1487,7 +1488,7 @@ print_bad_irq_dependency(struct task_struct *curr,
> printk("======================================================\n");
> printk("[ INFO: %s-safe -> %s-unsafe lock order detected ]\n",
> irqclass, irqclass);
> - print_kernel_version();
> + print_kernel_ident();
> printk("------------------------------------------------------\n");
> printk("%s/%d [HC%u[%lu]:SC%u[%lu]:HE%u:SE%u] is trying to acquire:\n",
> curr->comm, task_pid_nr(curr),
> @@ -1716,7 +1717,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
> printk("\n");
> printk("=============================================\n");
> printk("[ INFO: possible recursive locking detected ]\n");
> - print_kernel_version();
> + print_kernel_ident();
> printk("---------------------------------------------\n");
> printk("%s/%d is trying to acquire lock:\n",
> curr->comm, task_pid_nr(curr));
> @@ -2223,7 +2224,7 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this,
> printk("\n");
> printk("=================================\n");
> printk("[ INFO: inconsistent lock state ]\n");
> - print_kernel_version();
> + print_kernel_ident();
> printk("---------------------------------\n");
>
> printk("inconsistent {%s} -> {%s} usage.\n",
> @@ -2288,7 +2289,7 @@ print_irq_inversion_bug(struct task_struct *curr,
> printk("\n");
> printk("=========================================================\n");
> printk("[ INFO: possible irq lock inversion dependency detected ]\n");
> - print_kernel_version();
> + print_kernel_ident();
> printk("---------------------------------------------------------\n");
> printk("%s/%d just changed the state of lock:\n",
> curr->comm, task_pid_nr(curr));
> @@ -3169,6 +3170,7 @@ print_unlock_inbalance_bug(struct task_struct *curr, struct lockdep_map *lock,
> printk("\n");
> printk("=====================================\n");
> printk("[ BUG: bad unlock balance detected! ]\n");
> + print_kernel_ident();
> printk("-------------------------------------\n");
> 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("\n");
> printk("=================================\n");
> printk("[ BUG: bad contention detected! ]\n");
> + print_kernel_ident();
> printk("---------------------------------\n");
> 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("\n");
> printk("=========================\n");
> printk("[ BUG: held lock freed! ]\n");
> + print_kernel_ident();
> printk("-------------------------\n");
> printk("%s/%d is freeing memory %p-%p, with a lock still held there!\n",
> 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("\n");
> printk("=====================================\n");
> printk("[ BUG: lock held at task exit time! ]\n");
> + print_kernel_ident();
> printk("-------------------------------------\n");
> printk("%s/%d is exiting with locks still held!\n",
> curr->comm, task_pid_nr(curr));
> @@ -4141,6 +4146,7 @@ void lockdep_sys_exit(void)
> printk("\n");
> printk("================================================\n");
> printk("[ BUG: lock held when returning to user space! ]\n");
> + print_kernel_ident();
> printk("------------------------------------------------\n");
> printk("%s/%d is leaving the kernel with locks still held!\n",
> curr->comm, curr->pid);
> @@ -4160,6 +4166,7 @@ void lockdep_rcu_suspicious(const char *file, const int line, const char *s)
> printk("\n");
> printk("===============================\n");
> printk("[ INFO: suspicious RCU usage. ]\n");
> + print_kernel_ident();
> printk("-------------------------------\n");
> printk("%s:%d %s!\n", file, line, s);
> printk("\nother info that might help us debug this:\n\n");
> 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\n");
> -
> 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("\n============================================\n");
> printk( "[ BUG: circular locking deadlock detected! ]\n");
> + printk("%s\n", print_tainted());
> printk( "--------------------------------------------\n");
> printk("%s/%d is deadlocking current task %s/%d\n\n",
> 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
next prev parent reply other threads:[~2011-11-16 21:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-28 3:36 Ben Hutchings
2011-10-31 1:59 ` Rusty Russell
2011-11-16 21:52 ` Ben Hutchings [this message]
2011-11-16 22:24 ` Dave Jones
2011-11-17 8:48 ` Peter Zijlstra
2011-11-17 15:18 ` Ben Hutchings
2011-12-06 9:38 ` [tip:core/locking] lockdep, rtmutex, bug: " tip-bot for Ben Hutchings
2011-12-06 15:34 ` Ben Hutchings
2011-12-06 17:48 ` Peter Zijlstra
2011-12-06 17:55 ` Alan Cox
2011-12-06 17:56 ` Peter Zijlstra
2011-12-06 17:59 ` Ingo Molnar
2011-12-06 18:17 ` Ben Hutchings
2011-12-06 18:28 ` Ingo Molnar
2011-12-06 19:14 ` Ingo Molnar
2011-12-06 21:13 ` Ben Hutchings
2011-12-07 7:49 ` Ingo Molnar
2011-12-06 18:04 ` Ingo Molnar
2011-12-06 17:54 ` Ingo Molnar
2011-12-06 18:14 ` Nick Bowler
2011-12-06 18:20 ` Ingo Molnar
2011-12-06 18:21 ` Alan Cox
2011-12-06 18:34 ` Ingo Molnar
2011-12-06 18:23 ` Ben Hutchings
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=20111116215236.GD3366@decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=davej@redhat.com \
--cc=debian-kernel@lists.debian.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=nbowler@elliptictech.com \
--cc=peterz@infradead.org \
--cc=rdunlap@xenotime.net \
--cc=rusty@rustcorp.com.au \
/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
Powered by JetHome