Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp827400ybi; Fri, 12 Jul 2019 05:18:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpQQ3tClmFMymGTpMUtKcrM1k2zkIDAaUfEGpAcqnlwRxW7Mzr3s0Yda7FrT/Uj+1tozrx X-Received: by 2002:a63:7887:: with SMTP id t129mr10651597pgc.309.1562933919757; Fri, 12 Jul 2019 05:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562933919; cv=none; d=google.com; s=arc-20160816; b=bGbE/MN2KtTUFedbqF91KHn8qBWQE0KymZ4lDGpWyMtkzIODM/5i5FRWT9jP8tIeOF XLxaCY3TQIsoPoEl2BaCnOSAUFaVpCYD0uEwyO/hBKCnJSiSJjCcRGe/FFtb+V96shAr pOZmPFBEMl9g+UdFDEQcZPJSxO6iqYX2D4vdkPmxksEoidp+g7vIc2InGKUzq/aP8qlN It10PQz9AaY4K9Czxoi5aLM7j86KVMt+EvpDHx7/SjsrR6Xjrdi12eIKC6i2dYty0nMI OMOU4Em1NZ+giYnEFACTj2QSA0LgQUrU7031mu3FSdho38E452+y6foVhdIcKor92bRN x7Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=wFyIee871uuNUecvMDjQLm4jjgTr6/wQjnqJATlNebU=; b=UPqKBH+X3yq8KasxxFuNrHyUiYSQVOl4SDxOGB3wp5UvT5itwJmvjCPjAXiIxtnwnR e1PiNAPMbMETbGW2L/0mDZl0RoAk5FgFeHF3zp8M29r7Mn8kfkIAOmBrtkpGPoxJVj74 dFnYpdTQds9zb1dDOU0ini6G3NHRnoXIP9GE5/Q5nb6A9YapjKtuvfixIDLEWriKlRKu V+/2Cb4UrazBfSLR+KsEuRZ2x28yNOnwKQtZ2G4h4tLlWL92neG3FAWy90KbVA7rh/I2 CKvCXNPiWpNAiX5IUuh7aUFAJfQfV2ZznjaMdkQsSaZdT/0kSOU5iWfFHDczfkaCNJii UwBA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x139si3721442pgx.251.2019.07.12.05.18.22; Fri, 12 Jul 2019 05:18:39 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbfGLMSD (ORCPT + 99 others); Fri, 12 Jul 2019 08:18:03 -0400 Received: from gaia.bitwizard.nl ([149.210.166.240]:40760 "EHLO gaia.bitwizard.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726155AbfGLMSD (ORCPT ); Fri, 12 Jul 2019 08:18:03 -0400 X-Greylist: delayed 480 seconds by postgrey-1.27 at vger.kernel.org; Fri, 12 Jul 2019 08:18:01 EDT Received: from abra2.bitwizard.nl (unknown [10.8.0.6]) by gaia.bitwizard.nl (Postfix) with ESMTP id 87FAA5A0065; Fri, 12 Jul 2019 14:10:00 +0200 (CEST) Received: by abra2.bitwizard.nl (Postfix, from userid 1000) id 6CD7E13F753; Fri, 12 Jul 2019 14:10:00 +0200 (CEST) Date: Fri, 12 Jul 2019 14:10:00 +0200 From: Rogier Wolff To: Dave Martin Cc: Phil Elwell , Russell King , Greg Kroah-Hartman , Jiri Slaby , "linux-serial@vger.kernel.org" , "linux-rpi-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] tty: amba-pl011: Make TX optimisation conditional Message-ID: <20190712121000.GK11350@BitWizard.nl> References: <1562852732-123411-1-git-send-email-phil@raspberrypi.org> <20190712112105.GH2790@e103592.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712112105.GH2790@e103592.cambridge.arm.com> Organization: BitWizard B.V. User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 12, 2019 at 12:21:05PM +0100, Dave Martin wrote: > diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c > index 89ade21..1902071 100644 > --- a/drivers/tty/serial/amba-pl011.c > +++ b/drivers/tty/serial/amba-pl011.c > @@ -1307,6 +1307,13 @@ static bool pl011_tx_chars(struct uart_amba_port *uap, bool from_irq); > /* Start TX with programmed I/O only (no DMA) */ > static void pl011_start_tx_pio(struct uart_amba_port *uap) > { > + /* > + * Avoid FIFO overfills if the TX IRQ is active: > + * pl011_int() will comsume chars waiting in the xmit queue anyway. > + */ > + if (uap->im & UART011_TXIM) > + return; > + I'm no expert on PL011, have no knowledge of the current bug, but have programmed serial drivers in the past. This looks "dangerous" to me. The normal situation is that you push the first few characters into the FIFO with PIO and then the interrupt will trigger once the FIFO empties and then you can refil the FIFO until the buffer empties. The danger in THIS fix is that you might have a race that causes those first few PIO-ed characters not to be put in the hardware resulting in the interrupt never triggering.... If you can software-trigger the interrupt just before the "return" here that'd be a way to fix things. I'm ok with a reaction like "I've thought about this, it's not a problem, now shut up". Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work.