Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1204607ybt; Wed, 1 Jul 2020 22:44:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwd51iViuBkNxo+5OnQTVbvmzSmhEPxHuXcuOFZPi2RRChZejikbodFuboSgRuNt1rmVmIJ X-Received: by 2002:a05:6402:b79:: with SMTP id cb25mr13111453edb.154.1593668655683; Wed, 01 Jul 2020 22:44:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593668655; cv=none; d=google.com; s=arc-20160816; b=arkKtGekKrTYuuagKwy0LaEhw0w3q0486Qb0ZIw46Cwsfqgb2mW7evt1wXxtoKR/+4 QVk2LrnBzVHNlFupur23FjzAwxJMD28O6ST7jAxLqDnk551x/Vj4E0GRGxhqyNPH/UKD iUxxs6jmVxz0kkkCmQm8E0kaPRItleTUF9+P6n1ch9txyJA6MYiWcALzNr/2xMkdFYuZ PXNsHd7GTXYzW5yqXF0wtWtTi8CuakRWDdHETBqWKjRQiqKmZ/aIIlCp2bU32cVAJCN2 h1QhIyzL1n/nR+2vmCZJ++BPueufPVHYtOGCqrcmOyIA5MbKwkcYZAgjDqave3CN2GOg dqAg== 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:date:from :dkim-signature; bh=joxvKotI6picrAUcS02GkmtYLqsOXW4f1Zm4dCFSTkM=; b=PnSbp9NxWm4HuKCTj1OA/Q7s9iaDIpKDOSIwvnBnx2IC5M6Hi7rjk2OH9bRMHc3VPU jCoUjiTreCyQwbrzrM+ZyemR4zTJaA7hfvNUjiC5hKWWegWlyUuf7gWf4K13Pm+J8toT GGQM3XSImU9SOK2Qi9tCAJvp7zpsGVc+sg7NG4oKTVNYczinOkv7yKTwsTSIsJRYRBVy OGNgs1ON/+Z7sEccVpvPkVLk88qt3DKNDMRJggd0mxcwRyEDgZrdBshhiVW+rLfuZf03 4iN10vL532WjBf4HBTgJFMaGPkq40A7cU6DT277PP7WpXP3afxTMQwGTfEY41IVb29zn KwbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZIDObpBZ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bt2si4850813ejb.597.2020.07.01.22.43.52; Wed, 01 Jul 2020 22:44:15 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZIDObpBZ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726241AbgGBFkj (ORCPT + 99 others); Thu, 2 Jul 2020 01:40:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726015AbgGBFki (ORCPT ); Thu, 2 Jul 2020 01:40:38 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 940C0C08C5C1 for ; Wed, 1 Jul 2020 22:40:38 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id e18so12908061pgn.7 for ; Wed, 01 Jul 2020 22:40:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=joxvKotI6picrAUcS02GkmtYLqsOXW4f1Zm4dCFSTkM=; b=ZIDObpBZEn6qdf4iGXJO9sFOOMqprwvBQx/LmZm1l+NI17ooFzASttkYT4J/BmuTBl eeLcLF5Yn0zMKww/p7euG+QSNHgCbxiw2Dsvwu8sHFApxDpvxKdcuMCv6zHxHofz2KLx T5sey77dv6SmHBdwozwxPOBuPwYITzgEJy5bvBEt9cNFqkWAwapDz2ogqxfrxcOUV8kl uwDV9fWX4S2V8QMuibLNvV3OuiadaWIXo0GuAadCTg7Eqew/3dcM/NzzABgSQzzWCMST Nray+KQAF9/tPMlMeB6G1aq/0zhh708PJIQt9pr+Md0kfWU5r7XZiH0FZziB0/69ywlf quKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=joxvKotI6picrAUcS02GkmtYLqsOXW4f1Zm4dCFSTkM=; b=ESlvW/FoOSbW9wBK7bhab37pGbKbFdwdNRKJaobyUc81DbHC2Zd2xTVBswrfPGjj0o 5AnDkHVDyP2uwWxH3Dr0F8GrIetHGbtLmwxKmiNXp9ILPfSvndFPgilaG/IhHnf6JSWQ 38DfnX7H2HS4Hg7NI3szm2S4EbvPDTQlhMGpTg4qCWp+N3YEVgyxkEjlxmeVgB3mjvyR y3A7WgWHlJ4WOqNwEPlsJ2C6A47pbiosQ9HeBxvjAfLP9+PIVl9wKmcHcbxkIQJzLaWa iWiXYxRQ8qRLjv03hbTEd5rF42SMmqN6BCPUaJSn3gYNzlkSkSDJWK4y/V+dBhNkt5yE 154g== X-Gm-Message-State: AOAM530ZxEwqZMbr13sgrE8p5izL4UXd6S663c7jQQ4tCd3i9Wq7rg0r pWmilOF8+U8rI7bf1XKnBnY= X-Received: by 2002:a63:725c:: with SMTP id c28mr22457908pgn.156.1593668438031; Wed, 01 Jul 2020 22:40:38 -0700 (PDT) Received: from localhost ([2409:10:2e40:5100:6e29:95ff:fe2d:8f34]) by smtp.gmail.com with ESMTPSA id a3sm7275161pgd.73.2020.07.01.22.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 22:40:37 -0700 (PDT) From: Sergey Senozhatsky X-Google-Original-From: Sergey Senozhatsky Date: Thu, 2 Jul 2020 14:40:33 +0900 To: Tony Lindgren 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 , Sergey Senozhatsky Subject: Re: UART/TTY console deadlock Message-ID: <20200702054033.GC3450@jagdpanzerIV.localdomain> 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 On (20/07/02 14:12), Sergey Senozhatsky wrote: > Date: Thu, 2 Jul 2020 14:12:13 +0900 > From: Sergey Senozhatsky > To: Tony Lindgren > Cc: Sergey Senozhatsky , 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: <20200702051213.GB3450@jagdpanzerIV.localdomain> > > 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. Hmm, hold on. Why does it disable IRQ in the first place? IRQ handlers should grab the port->lock. So if there is already running IRQ, then serial8250_do_startup() will wait until IRQ handler unlocks the port->lock. If serial8250_do_startup() grabs the port->lock first, then IRQ will wait for serial8250_do_startup() to unlock it. serial8250_do_startup() does not release the port->unlock until its done: spin_lock_irqsave(&port->lock, flags); wait_for_xmitr(up, UART_LSR_THRE); serial_port_out_sync(port, UART_IER, UART_IER_THRI); udelay(1); /* allow THRE to set */ iir1 = serial_port_in(port, UART_IIR); serial_port_out(port, UART_IER, 0); serial_port_out_sync(port, UART_IER, UART_IER_THRI); udelay(1); /* allow a working UART time to re-assert THRE */ iir = serial_port_in(port, UART_IIR); serial_port_out(port, UART_IER, 0); spin_unlock_irqrestore(&port->lock, flags); so IRQ will not see the inconsistent device state. What exactly is the purpose of disable_irq_nosync()? Can we just remove disable_irq_nosync()/enable_irq() instead? Are there any IRQ handlers that don't acquire the port->lock? -ss