Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1322792
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code |
| Date | 2016-02-01 03:40 +0100 |
| Message-ID | <qXczf-4ds-1@gated-at.bofh.it> (permalink) |
| References | <qWgEW-33T-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On (01/29/16 21:43), Byungchul Park wrote:
[..]
> +extern int is_console_lock(raw_spinlock_t *lock);
> +
> static void __spin_lock_debug(raw_spinlock_t *lock)
> {
> u64 i;
> @@ -113,11 +115,19 @@ static void __spin_lock_debug(raw_spinlock_t *lock)
> return;
> __delay(1);
> }
> - /* lockup suspected: */
> - spin_dump(lock, "lockup suspected");
> +
> + /*
> + * If this function is called from printk(), then we should
> + * not call printk() more. Or it will cause an infinite
> + * recursive cycle!
> + */
> + if (likely(!is_console_lock(lock))) {
> + /* lockup suspected: */
> + spin_dump(lock, "lockup suspected");
> #ifdef CONFIG_SMP
> - trigger_all_cpu_backtrace();
> + trigger_all_cpu_backtrace();
> #endif
> + }
/* speaking in a context of printk locks only */
... may be for a recoverable "lockup suspected" spin_dump()
we can switch to deferred printk of the messages, which is a
bit better than nothing. but for unrecoverable "lockup suspected"
spin_dump() -- an actual bug (spin lock owner is not going to
release the lock any more) -- we need something else, I think.
the bug will neither be reported nor fixed.
-ss
> /*
> * The trylock above was causing a livelock. Give the lower level arch
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 2ce8826..568ab11 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1981,6 +1981,11 @@ asmlinkage __visible void early_printk(const char *fmt, ...)
> }
> #endif
>
> +int is_console_lock(raw_spinlock_t *lock)
> +{
> + return lock == &console_sem.lock;
> +}
> +
> static int __add_preferred_console(char *name, int idx, char *options,
> char *brl_options)
> {
> --
> 1.9.1
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Byungchul Park <byungchul.park@lge.com> - 2016-01-29 13:50 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Byungchul Park <byungchul.park@lge.com> - 2016-01-29 14:00 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-01-31 13:40 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Byungchul Park <byungchul.park@lge.com> - 2016-02-01 02:50 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-02-01 03:20 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Ingo Molnar <mingo@kernel.org> - 2016-01-30 10:30 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Byungchul Park <byungchul.park@lge.com> - 2016-02-02 03:40 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-02-01 03:40 +0100
Re: [PATCH v5] lib/spinlock_debug.c: prevent a recursive cycle in the debug code Byungchul Park <byungchul.park@lge.com> - 2016-02-01 07:30 +0100
csiph-web