[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191007113710.GH2381@dhcp22.suse.cz>
Date: Mon, 7 Oct 2019 13:37:10 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Qian Cai <cai@....pw>
Cc: akpm@...ux-foundation.org, sergey.senozhatsky.work@...il.com,
pmladek@...e.com, rostedt@...dmis.org, peterz@...radead.org,
david@...hat.com, john.ogness@...utronix.de, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm/page_isolation: fix a deadlock with printk()
On Mon 07-10-19 07:04:00, Qian Cai wrote:
>
>
> > On Oct 7, 2019, at 4:07 AM, Michal Hocko <mhocko@...nel.org> wrote:
> >
> > I do not think that removing the printk is the right long term solution.
> > While I do agree that removing the debugging printk __offline_isolated_pages
> > does make sense because it is essentially of a very limited use, this
> > doesn't really solve the underlying problem. There are likely other
> > printks from zone->lock. It would be much more saner to actually
> > disallow consoles to allocate any memory while printk is called from an
> > atomic context.
>
> No, there is only a handful of places called printk() from
> zone->lock. It is normal that the callers will quietly process
> “struct zone” modification in a short section with zone->lock
> held.
It is extremely error prone to have any zone->lock vs. printk
dependency. I do not want to play an endless whack a mole.
> No, it is not about “allocate any memory while printk is called from an
> atomic context”. It is opposite lock chain from different processors which has the same effect. For example,
>
> CPU0: CPU1: CPU2:
> console_owner
> sclp_lock
> sclp_lock zone_lock
> zone_lock
> console_owner
Why would sclp_lock ever take a zone->lock (apart from an allocation).
So really if sclp_lock is a lock that might be taken from many contexts
and generate very subtle lock dependencies then it should better be
really careful what it is calling into.
In other words you are trying to fix a wrong end of the problem. Fix the
console to not allocate or depend on MM by other means.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists