Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp406957ybt; Wed, 8 Jul 2020 02:53:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXprir6DNgoeUqUTguo2exlXR9naD/iq5A1xlExE5FYrfZ/jIAgfcYBvHdtUQQEngjIPTw X-Received: by 2002:a17:906:9348:: with SMTP id p8mr28828171ejw.467.1594201996693; Wed, 08 Jul 2020 02:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594201996; cv=none; d=google.com; s=arc-20160816; b=SIOLdaLJAC4zQikTYGjPz00P47zuAf2Sm0cA5tXXuOYCvSQi7eAvXXjsqtjL4DB8jg 0p9KN1mY4cB80RJHT48HTWhq6pf+ZlW6UTWahcRdPv1SvrdKPPSPTIhPkR+GlkfkNKoI JRgW8aENCGciH54bJLtYB1RLkvzH/zfzL+d1fgqnbnEngY3NsGElC5N8tEIRs36M0GPO tE7RBXo3XsVVvqFl0hD3o1qbix1geJs9NhETvt01TqsvvnXtKxsPm/7HooVUj7BEPQn/ sVFalfsR7v/kvqD6masODq4AwW14H4CtAWef+IxZs3rKiOSdiyJz4wowikafvumpubfb qYAA== 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=T7Wvx16tYEnmfVM70Wbr4TWYnOIVRZKCNSzVK4woBHw=; b=poLePXQyi+3HelvCrsBHuOeTYGFkL2G4zdrsKdLasAPkujDSOj2jgpd7XURQthZI5B zVKMMsPTip89RAKxOt6bQdJAGq91cjLEf7BRHQYsNbA1bOD8lr2jcXhieHvyYdWqO1jQ GSjMDBiRgfIm8uviFsQEmA/kEWOpXF+6UW9hEDOFWeHi/qXypNf+fBNZxvMMYYaH2Gut 60LZ6onS7NaHFasPkk0Hm+qGWtHiUhuyTGiuTCHVeHIoRu9HzskhN/s5w0u0WqsRmpqu WFr7xJ559ivlb6SYRo/vAQPOJLvl/okBbWyMGkljn0v2NJPLqzbsDRdNow2PsYPUhtb5 HXYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ni2si9198859ejb.19.2020.07.08.02.52.53; Wed, 08 Jul 2020 02:53:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728309AbgGHJwU (ORCPT + 99 others); Wed, 8 Jul 2020 05:52:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:41084 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728188AbgGHJwS (ORCPT ); Wed, 8 Jul 2020 05:52:18 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B9AD1AED9; Wed, 8 Jul 2020 09:52:16 +0000 (UTC) Date: Wed, 8 Jul 2020 11:52:15 +0200 From: Petr Mladek To: Sergey Senozhatsky Cc: Kurt Kanzenbach , Andy Shevchenko , Tony Lindgren , Raul Rangel , Sergey Senozhatsky , linux-kernel , Greg Kroah-Hartman , Andy Shevchenko , "S, Shirish" , Peter Zijlstra , John Ogness , Steven Rostedt Subject: Re: UART/TTY console deadlock Message-ID: <20200708095215.GB4751@alley> References: <20200630130534.GB145027@jagdpanzerIV.localdomain> <20200630180255.GD37466@atomide.com> <20200702051213.GB3450@jagdpanzerIV.localdomain> <20200702160514.GK37466@atomide.com> <20200703103241.GB182102@jagdpanzerIV.localdomain> <877dvg6ft6.fsf@kurt> <20200706144314.GB1485@jagdpanzerIV.localdomain> <87o8oqa1zy.fsf@kurt> <20200708080712.GC571@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200708080712.GC571@jagdpanzerIV.localdomain> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 2020-07-08 17:07:12, Sergey Senozhatsky wrote: > On (20/07/08 09:40), Kurt Kanzenbach wrote: > > I'm not sure how this patch will help with the situation. Because at the > > point of that THRE test the irq handler isn't registered. It's > > registered a few lines below (up->ops->setup_irq()) meaning the irq line > > has to be disabled if shared. Otherwise the kernel might detect a > > spurious irq and disables it. That's at least my understanding of the > > problem (see commit message from 54e53b2e8081 ("tty: serial: 8250: pass > > IRQ shared flag to UART ports")). > > So the only remaining approach then is to move > disable_irq_nosync()/enable_irq() out of port->lock > scope. The ultimate solution is the offload of printk console handling to kthreads. I know that it takes ages to get it in. But it will also take ages to go around all the cyclic dependencies. People tend to use printk() anywhere. And any lock taken by printk() is prone to cause these problems. We have tried to go around this in the scheduler code by printk_deferred() and it was never-ending story. I believe that the port->lock related cycles are another never-ending story. And attempts to shuffle locks are always complicated and error-prone. They require deep understanding of the affected code paths. The approach with printk_deferred() has been pretty safe at least. Another approach might be to teach lockdep to remove lock chains that were taken during the system initialization and will never happen again. Or something like this. I still believe that this is a false positive. Console that is being initialized can't be used by printk() at the same moment. Locks taken only when the console is being initialized can't cause deadlocks when the fully initialized console is registered later. Best Regards, Petr