Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp106872imu; Wed, 19 Dec 2018 14:35:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/W6fnBr0QDGI588cblLKlMPP7Vinqvq7vu+mBv0/ACDm9Og66ygjeJ+CE85iw4ZZsD9qSHq X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr21347741plz.75.1545258907043; Wed, 19 Dec 2018 14:35:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545258907; cv=none; d=google.com; s=arc-20160816; b=O0Fjalab5UpFDNZCZD1r+O2hV3uV1Lw7yCTS2SCzt6VxMvRG2VospXVN72m3ZEwmsJ 1hlAxhUD7oe8x0iyU9wc8bZAjyFDXtRUhvGgzDkRNqlnTeYr8EV0wi1BDaUwEsQNg6Jf ouSBqZj9K8zm0UfrUKeCNbmwqnG7jwBYdnBqo5zOK4j9isFyaUsbcOl8ig/GG0yMd5J6 B3VScRww9uyFB0oyQ6ucY5M94AU/+gjbXrQtuAtG/GuZ0fQguJ8hQGjYaM3Tshh8OEEU 1cRq4BfPd+TZe9Td69+fVqQrc4IfBgFRjdtFuZl0ngZfPXfK+5M+fdIv6bkowk6R9bEG YMDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=m5rJxqh3NKb11NTYYJMYdcB5gjjb8mA7s1SGkQtQT9c=; b=O3Zz+FNZ39LxdM2ly/LuEbguahU2afraDqTazd5vw9DjzrZODLkHPtyM2JYxUa3VL+ RQV6HgUxvLCRPDpAg0hRNIceK93qKR+DQkY63UW2rV+PD56Knexy9hL8ttkq/VGBaOvw sz1deJ4mj3FVaPt1Vh0kXB5Jt9zx4e/gDgHjyVGUigQn3LOrFcWRIauEdrWrfTMiixp9 tRJP33/NGod/heF3zPU4Mf9B6/v0XOsBOcdP2gXzvR7PdSaIZRQfmNFlX9ZzjvD8NEB6 o8semZXYBJRXRmbMeJAIfV4HJDy6A8eE89DavPufmQSAeIveNQLP0kOz8UAUpYcP52z8 fk0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ZvHch7Rs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si16807429pld.398.2018.12.19.14.34.51; Wed, 19 Dec 2018 14:35:07 -0800 (PST) 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; dkim=pass header.i=@chromium.org header.s=google header.b=ZvHch7Rs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729794AbeLSWM7 (ORCPT + 99 others); Wed, 19 Dec 2018 17:12:59 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:37510 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727151AbeLSWM7 (ORCPT ); Wed, 19 Dec 2018 17:12:59 -0500 Received: by mail-lf1-f65.google.com with SMTP id y11so16236557lfj.4 for ; Wed, 19 Dec 2018 14:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m5rJxqh3NKb11NTYYJMYdcB5gjjb8mA7s1SGkQtQT9c=; b=ZvHch7RsvRgSvIqjgIjBKCPbkGVUn8uwKgocMIVdWiqujKR2R01J1E3vk14PhsIWit fZUQrttWets3uSKBzhczVotiUi/LH+Sdy9t7geyYOYeC1Wkl5xWpECad2FwmglZkVggq M0lh8npltzay7yWzRxYxlzPJ5c+W5m7y7MG7Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m5rJxqh3NKb11NTYYJMYdcB5gjjb8mA7s1SGkQtQT9c=; b=Bn5Mej3ifSH1lWBJuWsOk0vTgxSVkfTLR6MufxTS9kOzpG3eDJSU0GvpplDs55Nn+m FJ4CoWMoZ7hmGPhl0Dsv1UlMYPcARBH7cRIMWhrCPUCP6xRfkTFM/+Dz5PFDZq4yTLNF a4PyjCvRRhyHx/CKjii69BK75conLUAMOtaKxmqnGLl4qqln3PZbuYDa0PXldRmg+pax u0bKEfV6gHN9s9Cb6IfQ4apObWK16PBTDQp0gd3RDiwd4POvMBSkQB8r5EKvPHZUXI8y 4q2g4pV8KptSwr26QNCDrJnY4bp182Nh5YyOEJn/oNrh+d35kT9higj9dG3AOfx69/ys Ohqw== X-Gm-Message-State: AA+aEWYBKzXf6OUJt9w+cekvlX7nFkh62uPwS58WxFyGFflKW6hLvS79 jRItjqxDgM9ifinUAfpGtEFzGa/mCeM= X-Received: by 2002:a19:a84e:: with SMTP id r75mr14149665lfe.45.1545257576920; Wed, 19 Dec 2018 14:12:56 -0800 (PST) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com. [209.85.208.178]) by smtp.gmail.com with ESMTPSA id t18sm3984668lft.93.2018.12.19.14.12.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 14:12:56 -0800 (PST) Received: by mail-lj1-f178.google.com with SMTP id l15-v6so18761149lja.9 for ; Wed, 19 Dec 2018 14:12:56 -0800 (PST) X-Received: by 2002:a2e:9d17:: with SMTP id t23-v6mr13563042lji.57.1545257575738; Wed, 19 Dec 2018 14:12:55 -0800 (PST) MIME-Version: 1.0 References: <20181219203353.172335-1-ryandcase@chromium.org> In-Reply-To: <20181219203353.172335-1-ryandcase@chromium.org> From: Evan Green Date: Wed, 19 Dec 2018 14:12:19 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] tty: serial: qcom_geni_serial: Fix UART hang To: ryandcase@chromium.org Cc: gregkh@linuxfoundation.org, jslaby@suse.com, Doug Anderson , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 19, 2018 at 12:34 PM Ryan Case wrote: > > If a serial console write occured while a UART transmit command was > waiting for a done signal then no further data would be sent until > something new kicked the system into gear. If there is already data > waiting in the circular buffer we must re-enable the tx watermark so we > receive the expected interrupts. > > Signed-off-by: Ryan Case > --- > > drivers/tty/serial/qcom_geni_serial.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c > index 0c93beb69e73..a694a47747c7 100644 > --- a/drivers/tty/serial/qcom_geni_serial.c > +++ b/drivers/tty/serial/qcom_geni_serial.c > @@ -442,6 +442,7 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s, > bool locked = true; > unsigned long flags; > u32 geni_status; > + u32 irq_en; > > WARN_ON(co->index < 0 || co->index >= GENI_UART_CONS_PORTS); > > @@ -476,6 +477,13 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s, > * has been sent, in which case we need to look for done first. > */ > qcom_geni_serial_poll_tx_done(uport); > + > + if (uart_circ_chars_pending(&uport->state->xmit)) { > + irq_en = readl_relaxed(uport->membase + > + SE_GENI_M_IRQ_EN); > + writel_relaxed(irq_en | M_TX_FIFO_WATERMARK_EN, > + uport->membase + SE_GENI_M_IRQ_EN); The _relaxed part of it has always been weird to me, but I guess we fought that battle awhile ago with this driver and lost. I suppose the only real danger with relaxed would be if you could get yourself into some sort of tight loop or idle where the CPU's write queue never flushes, but you needed it to in order to proceed. This probably could never happen, especially with locks around consoles and uart ports that act as barriers. Reviewed-by: Evan Green