Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1596735ybt; Thu, 2 Jul 2020 09:07:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwr3ydBELu1ElHTl9bRe8f7nwHYHopVzQtI5wXC21Fdj3foCg1PrNOlyGKCsxa8o8iHyzmZ X-Received: by 2002:a05:6402:b9b:: with SMTP id cf27mr33696864edb.84.1593706038336; Thu, 02 Jul 2020 09:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593706038; cv=none; d=google.com; s=arc-20160816; b=Byqdzj/HClGTnrJzZS2r8q+fLcO72jEuGVXHR4ez98gAnvj5o4uYgDIAiQ+LPlH3ga TRbfVXVC6JksBRiRG0MY45nTgT+qzdN6tzRj+qDVdfd3pf2mG5nbZ2Ql144HTy12yDcY gQGHesPGc5OOwZV65kCO2R2I+XoDNbLrk8znA+uSAGwCWVuEh/GDXAlzGxE/GJBW0dv3 /iPsVxA9oakjc52r0QrnKjkqN4Qsp/1DqKSnEnJZB5pEKwbuet+pckS2U9igSrqjDeX6 hkZzoDUMuu4nnYzMyvvHAgg1829leqsh6G68JYXH7M8qIAxsMCPCduO6h6L/HOUD5tj8 rhHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=wQ8SiYz10eOT7jcQ9lSQZD1p21Eo3G13rBogqVbD9vY=; b=KO9F9jw2lUVPuoiKrLq9rn0S5Fig70CDp0MKgzzJSFNwqpaYEx9eDf48oJpxnZR3NC oOr4LqVqOEqxKdajtfEI2xJz0yv767Uob4MPWLhDaT4xcoF0PEzfH5f3eMpWoJtYllpy msdTWNhn12s2/gxIY43/EkPbAjCI3arxg1oQqc/8Gn8myNbpZL5GbsOwS0My3KcmXNiS EU3/Zj35dPODOS8cUKhb7m1SWEcmkMYQPk8ZYI7CQ40TrEO6IRTF00h2/Ic99+H3ZiGl qK9VK1b3Y1Ajd0WXT/JEi2M3Sc7UwPIqpZ+W8ay5sn+3qHyYAdCWnyyPKof7z6MoSuZ9 PwyA== 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 w16si6230575ejq.299.2020.07.02.09.06.55; Thu, 02 Jul 2020 09:07:18 -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 S1726505AbgGBQFW (ORCPT + 99 others); Thu, 2 Jul 2020 12:05:22 -0400 Received: from muru.com ([72.249.23.125]:60366 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726084AbgGBQFT (ORCPT ); Thu, 2 Jul 2020 12:05:19 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 6FA5B8062; Thu, 2 Jul 2020 16:06:10 +0000 (UTC) Date: Thu, 2 Jul 2020 09:05:14 -0700 From: Tony Lindgren To: Sergey Senozhatsky Cc: Petr Mladek , Andy Shevchenko , Raul Rangel , Sergey Senozhatsky , linux-kernel , Greg Kroah-Hartman , Andy Shevchenko , kurt@linutronix.de, "S, Shirish" , Peter Zijlstra , John Ogness , Steven Rostedt Subject: Re: UART/TTY console deadlock Message-ID: <20200702160514.GK37466@atomide.com> References: <20200630035816.GA21591@jagdpanzerIV.localdomain> <20200630102141.GA11587@alley> <20200630105512.GA530@jagdpanzerIV.localdomain> <20200630122239.GD6173@alley> <20200630130534.GB145027@jagdpanzerIV.localdomain> <20200630180255.GD37466@atomide.com> <20200702051213.GB3450@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200702051213.GB3450@jagdpanzerIV.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Sergey Senozhatsky [200702 05:13]: > On (20/06/30 11:02), Tony Lindgren wrote: > > This conditional disable for irq_shared does not look nice to me > > from the other device point of view :) > > > > Would it be possible to just set up te dummy interrupt handler > > for the startup, then change it back afterwards? See for example > > omap8250_no_handle_irq(). > > I think we can do it. serial8250_do_startup() and irq handler take > port->lock, so they should be synchronized. > > Something like this then? Yeah thanks this should work better for shared irq. Regards, Tony > diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c > index f77bf820b7a3..61ad6f5f0f88 100644 > --- a/drivers/tty/serial/8250/8250_port.c > +++ b/drivers/tty/serial/8250/8250_port.c > @@ -2140,6 +2140,11 @@ static void serial8250_put_poll_char(struct uart_port *port, > > #endif /* CONFIG_CONSOLE_POLL */ > > +static int serial8250_dummy_handle_irq(struct uart_port *port) > +{ > + return 0; > +} > + > int serial8250_do_startup(struct uart_port *port) > { > struct uart_8250_port *up = up_to_u8250p(port); > @@ -2271,6 +2276,9 @@ int serial8250_do_startup(struct uart_port *port) > > if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { > unsigned char iir1; > + int (*handler)(struct uart_port *); > + > + handler = port->handle_irq; > /* > * Test for UARTs that do not reassert THRE when the > * transmitter is idle and the interrupt has already > @@ -2280,8 +2288,7 @@ int serial8250_do_startup(struct uart_port *port) > * allow register changes to become visible. > */ > spin_lock_irqsave(&port->lock, flags); > - if (up->port.irqflags & IRQF_SHARED) > - disable_irq_nosync(port->irq); > + port->handle_irq = serial8250_dummy_handle_irq; > > wait_for_xmitr(up, UART_LSR_THRE); > serial_port_out_sync(port, UART_IER, UART_IER_THRI); > @@ -2293,8 +2300,7 @@ int serial8250_do_startup(struct uart_port *port) > iir = serial_port_in(port, UART_IIR); > serial_port_out(port, UART_IER, 0); > > - if (port->irqflags & IRQF_SHARED) > - enable_irq(port->irq); > + port->handle_irq = handler; > spin_unlock_irqrestore(&port->lock, flags); > > /*