Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2056481ybp; Thu, 10 Oct 2019 01:21:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqyT5+qHC0TQDjFdAt1gElrN3IxN2v8y4bJIcN/0krxTjxymzfUaPI6r5wEavh9FpKHg+rQk X-Received: by 2002:a17:906:bcdc:: with SMTP id lw28mr6890454ejb.183.1570695710997; Thu, 10 Oct 2019 01:21:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570695710; cv=none; d=google.com; s=arc-20160816; b=mQepb+SJimKDxuATdsC7ROJw3KOHfQXxiAYgEDpmgBlognCePMWuxgzq1y7q3JRSJl dmOwiKZL4JMQSW9TClxsaKTus731dENtXu7dxMz2V+ivS8TrFgYLmNRGYqCr3TttrNLj VPGtLo8VtR5GSZNZ0pjcLYwo37pOoZRq7ek3gk3sse2Qw5KMH3w9B5ek/syO50FUTm+s paxxsmYUwpay95f3lbaYGv+CAYcd5kWg6JNG8/rAg7SFdKWjorJSdWTnB8S///bOMvls x+2RQ9eYmlL2t13fwMrnir9GezMqW8qFBXFt+hJJXFzpkhttb2Qj4yKJZR4Q6/mNWOCw iZOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=qne/w7xoFM/9SvNRiIIDRikk+6zmMVdQAHbIgpsqRnY=; b=zcptciGlzQnkM3x63HeB+YWAc6sGLxNynZ8iWOBi3Bs4FM1fuJC0nqzXumoJh8EAV9 zQlwZKccMVNXINN1o8+XqC7YeBc2jriwT9RTPjrt7ZkbMGYFzp/pABaxof6gsA7+0exa ITHRsTYwJhhUdiqJpzLsf3x7AI8bNPoBjiyRjOhCmJtoxFSCmmIsUwBsMAGVDTLFrECp 1F0YSSO6k+HkUPqxLs2mcZdo9JZQw9oZnKUn5v5JjGpMAIrfZb+kfQ3f4Y43iXlMUX53 Kgf6az7BtHCMmUdgYS4k+FLIO/ib+pZpmcni1K++TWVieCgFAGfCh0J4RhoarDNgnQ9n HxjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l18si2678677ejg.248.2019.10.10.01.21.27; Thu, 10 Oct 2019 01:21:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733127AbfJJIVN (ORCPT + 99 others); Thu, 10 Oct 2019 04:21:13 -0400 Received: from mx2.suse.de ([195.135.220.15]:53288 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732980AbfJJIVN (ORCPT ); Thu, 10 Oct 2019 04:21:13 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C8F1DAFE4; Thu, 10 Oct 2019 08:21:11 +0000 (UTC) Date: Thu, 10 Oct 2019 10:21:11 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Michal Hocko , Christian Borntraeger , Heiko Carstens , rostedt@goodmis.org, peterz@infradead.org, linux-mm@kvack.org, Qian Cai , john.ogness@linutronix.de, akpm@linux-foundation.org, Vasily Gorbik , Peter Oberparleiter , david@redhat.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/page_isolation: fix a deadlock with printk() Message-ID: <20191010082110.dreavjarni7mkvv6@pathway.suse.cz> References: <1570228005-24979-1-git-send-email-cai@lca.pw> <20191007143002.l37bt2lzqtnqjqxu@pathway.suse.cz> <20191007144937.GO2381@dhcp22.suse.cz> <20191008074357.f33f6pbs4cw5majk@pathway.suse.cz> <20191008082752.GB6681@dhcp22.suse.cz> <1570550917.5576.303.camel@lca.pw> <1157b3ae-006e-5b8e-71f0-883918992ecc@linux.ibm.com> <20191009142623.GE6681@dhcp22.suse.cz> <20191010051201.GA78180@jagdpanzerIV> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191010051201.GA78180@jagdpanzerIV> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 2019-10-10 14:12:01, Sergey Senozhatsky wrote: > On (10/09/19 16:26), Michal Hocko wrote: > > On Wed 09-10-19 15:56:32, Peter Oberparleiter wrote: > > [...] > > > A generic solution would be preferable from my point of view though, > > > because otherwise each console driver owner would need to ensure that any > > > lock taken in their console.write implementation is never held while > > > memory is allocated/released. > > > > Considering that console.write is called from essentially arbitrary code > > path IIUC then all the locks used in this path should be pretty much > > tail locks or console internal ones without external dependencies. > > That's a good expectation, but I guess it's not always the case. > > One example might be NET console - net subsystem locks, net device > drivers locks, maybe even some MM locks (skb allocations?). > > But even more "commonly used" consoles sometimes break that > expectation. E.g. 8250 > > serial8250_console_write() > serial8250_modem_status() > wake_up_interruptible() > > And so on. I think that the only maintainable solution is to call the console drivers in a well defined context (kthread). We have finally opened doors to do this change. Using printk_deferred() or removing the problematic printk() is a short term workaround. I am not going to block such patches. But the final decision will be on maintainers of the affected subsystems. Deferring console work should prevent the deadlocks. Another story is allocating memory from console->write() callback. It makes the console less reliable when there is a memory contention. Preventing this would be very valuable. Best Regards, Petr