Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp332179imu; Wed, 19 Dec 2018 19:55:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/WQT8fx6YqE5QeP9ahi0d4Is0mpL+BXrjBjnpl80ebeB2GylX/Je1cE31V3SPvJQ96dPAyC X-Received: by 2002:a63:2d46:: with SMTP id t67mr22178141pgt.140.1545278116211; Wed, 19 Dec 2018 19:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545278116; cv=none; d=google.com; s=arc-20160816; b=VRX848dBY6Eem5iMjj8Q0MXo1/6V9CDJT/HLId4QataTp9c2vIdw3rz9M7lZ+vMg47 hxOKisws+Q+TFvfD3VgcFPodwDl++a69RKSrLCSKOYwA7+XgYFpJ6mr/Oj2lupYYJU/2 q3lojabywwTNKIf2N8RetM+DsECB1KIDcytikq3rS8a4PCChloPyLgwvg9+dyB3DnJRQ MzUJGxmKd6zVHe7l94r3jq784AgMG8YsJXNGVQO6AukxXkCr7mGr6JpbkMgxNtGA8jW2 H3PPmGRXmdiATU5kB/I/Am0rPwbxUhzm/NFwqnjLdBbwQl5JkR7hdfivw1NiiVgw+zC6 FG8Q== 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=lcyvRp2CQ5DbPDRjTktuIANDFz5LiuYFyHF2SMFgEDw=; b=J/HaezdLpOIyS0REXSxj7UbEaDhaxcjujmKeTthYspCsYP6+CJpz8LyuFCv00umHyi njQDAPfNkr15+AbwId2/Vir8KBBPxFxytijxbTQZ9WGaWWe6DasJuxrAKJMVt3YWuPhQ DqlofvRFbnrNo+Oi4a+DzuqyZDNMUrHs6oIY3reDw8Yrd4MQ670IG6NZg+GuJQSbYffQ KSH7Kc0IO8T7ngT/eC/nZRPMjauFQgnY6i1e0Pe07jNDSxN5oma6dncf6LMsOKm9uF9b NcaW2AqoEo5ZAGfOMPx4JH+VCyhLRxQ1AgTTFulSEkPPzNCQ0efkYJVHPjLzLHPrKZFU eFVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=COKa9nGA; 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 c16si17022191pgn.222.2018.12.19.19.55.00; Wed, 19 Dec 2018 19:55:16 -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=COKa9nGA; 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 S1729462AbeLSXCB (ORCPT + 99 others); Wed, 19 Dec 2018 18:02:01 -0500 Received: from mail-vs1-f68.google.com ([209.85.217.68]:43533 "EHLO mail-vs1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728247AbeLSXCB (ORCPT ); Wed, 19 Dec 2018 18:02:01 -0500 Received: by mail-vs1-f68.google.com with SMTP id x1so13299544vsc.10 for ; Wed, 19 Dec 2018 15:02:00 -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=lcyvRp2CQ5DbPDRjTktuIANDFz5LiuYFyHF2SMFgEDw=; b=COKa9nGAgf4JWC5gTPJ5DNPXJc7D8ZF8FCjTQQ6+bt5Zgz9OG5Vh3Qnt7jEx/1gSTk C1fuvGVTKw/yYUXPUwTE3l4+7/H4aSV+WYZMUO2mPOtFnBjrkOt/vEsRP4zpKxcv51gS SelE4dG0avLvr4as0crBmXRkO+hqlIjjFz1T8= 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=lcyvRp2CQ5DbPDRjTktuIANDFz5LiuYFyHF2SMFgEDw=; b=EsXfpWJC/4jWpIOqqpBtaBRuJ3wj8AgHUcnzR7rySuUDoNdOcnLibJGGFV2f5/WsHJ zHSfytieOEYiD8+ITELmFwTiYvDhAcEhsm3j2taaGG1eD0awgohZv8PTWbI+PF9P5RK9 WwC9QPPh8BEc4eyp1M6oHBPr5J7NKPXVIGiKdRdzQgu4zQkBlErrMMY0G8wn4so7YbZw wivQ1k2p9vw5n555X9XSYlXaPHC0Vs+SpC3PEXuO2nwbFaMkJPz6JQTr3OaamadMhFhF /P5L1BbO2AnlrU037dWBju2nPF/CDb4ABMk3BHWUJfMUEI7sX82QOHv3fz1ReBIA1S4Y GM3A== X-Gm-Message-State: AA+aEWZmlYHHVkD151hJKkKmJu6u3kHZXJja2OSNWtVPjsSCya4HEwEk NFJEdcuik4Y3IzbhtuP8ZyUW87CT2qg= X-Received: by 2002:a67:de97:: with SMTP id r23mr10937347vsk.127.1545260519474; Wed, 19 Dec 2018 15:01:59 -0800 (PST) Received: from mail-vs1-f42.google.com (mail-vs1-f42.google.com. [209.85.217.42]) by smtp.gmail.com with ESMTPSA id j133sm7947164vkc.24.2018.12.19.15.01.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Dec 2018 15:01:58 -0800 (PST) Received: by mail-vs1-f42.google.com with SMTP id e7so13329147vsc.2 for ; Wed, 19 Dec 2018 15:01:58 -0800 (PST) X-Received: by 2002:a67:dd94:: with SMTP id i20mr4154249vsk.111.1545260518185; Wed, 19 Dec 2018 15:01:58 -0800 (PST) MIME-Version: 1.0 References: <20181219203353.172335-1-ryandcase@chromium.org> In-Reply-To: From: Doug Anderson Date: Wed, 19 Dec 2018 15:01:47 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] tty: serial: qcom_geni_serial: Fix UART hang To: Evan Green Cc: Ryan Case , Greg Kroah-Hartman , Jiri Slaby , LKML , 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 Hi, On Wed, Dec 19, 2018 at 2:12 PM Evan Green wrote: > > 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. Yeah. IMO we should go through and remove all the "_relaxed" from this driver until someone can prove that it's important for performance. ...but I think that's for a future patch to do. -Doug