[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181123114826.h27t7qiwfp7grrqx@pathway.suse.cz>
Date: Fri, 23 Nov 2018 12:48:26 +0100
From: Petr Mladek <pmladek@...e.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Waiman Long <longman@...hat.com>,
Ingo Molnar <mingo@...hat.com>,
Will Deacon <will.deacon@....com>,
Thomas Gleixner <tglx@...utronix.de>,
linux-kernel@...r.kernel.org, kasan-dev@...glegroups.com,
linux-mm@...ck.org, iommu@...ts.linux-foundation.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Tejun Heo <tj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH v2 07/17] debugobjects: Move printk out of db lock
critical sections
On Fri 2018-11-23 11:40:48, Sergey Senozhatsky wrote:
> On (11/22/18 11:16), Peter Zijlstra wrote:
> > > So maybe we need to switch debug objects print-outs to _always_
> > > printk_deferred(). Debug objects can be used in code which cannot
> > > do direct printk() - timekeeping is just one example.
> >
> > No, printk_deferred() is a disease, it needs to be eradicated, not
> > spread around.
>
> deadlock-free printk() is deferred, but OK.
The best solution would be lockless console drivers. Sigh.
> Another idea then:
>
> ---
>
> diff --git a/lib/debugobjects.c b/lib/debugobjects.c
> index 70935ed91125..3928c2b2f77c 100644
> --- a/lib/debugobjects.c
> +++ b/lib/debugobjects.c
> @@ -323,10 +323,13 @@ static void debug_print_object(struct debug_obj *obj, char *msg)
> void *hint = descr->debug_hint ?
> descr->debug_hint(obj->object) : NULL;
> limit++;
> +
> + bust_spinlocks(1);
> WARN(1, KERN_ERR "ODEBUG: %s %s (active state %u) "
> "object type: %s hint: %pS\n",
> msg, obj_states[obj->state], obj->astate,
> descr->name, hint);
> + bust_spinlocks(0);
> }
> debug_objects_warnings++;
> }
>
> ---
>
> This should make serial consoles re-entrant.
> So printk->console_driver_write() hopefully will not deadlock.
Is the re-entrance safe? Some risk might be acceptable in Oops/panic
situations. It is much less acceptable for random warnings.
Best Regards,
Petr
Powered by blists - more mailing lists