Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp1326205lqz; Mon, 1 Apr 2024 02:39:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVylswLLl8XzOKgciGM30Rcq/idIgGcZaNa02npLj2dha9Czgmr/pqr8buaG/vXpA/AZSxX/qjirkuGRKdK7F4Lb+4ZssuiCxvaXUV8+A== X-Google-Smtp-Source: AGHT+IEHP73TkCxPVGZepJhFuomIelEnTzRg0vc6TPr8lNVPEO4mhVwv5/fZWiO8TiqctsXA1x1c X-Received: by 2002:ae9:c205:0:b0:78b:c5a7:7128 with SMTP id j5-20020ae9c205000000b0078bc5a77128mr9819135qkg.0.1711964366266; Mon, 01 Apr 2024 02:39:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711964366; cv=pass; d=google.com; s=arc-20160816; b=njU7W+g2g/7zZoru4jgA4AHHH03USd1HNM9SwpTAt+wO21nM4O/5W/8T83w5z3k7d+ KihJMqv16FZy8BnJLqlhM2Vycx50ziMTrWs/s2pb9IbEHUJoKFCHTAkItkh/JdEbc/k3 yGOJTcMq2k9To6GR4tR2opHaQNer4BzhKm53JpEe1GTwqU+/QMJZ214xD9HG9k3kMhw4 RYUQCDaBlFbgVGVkix+K4aRsJJ5CLKsUuZGp43tTSVMcV8UvU3CxXX27+vUcuy18e07S oXrbv4T9ECxGAsFV/EupTxdpTmof9MKILmDH840MFm1/GLZfXcMCuxpLh99OkXIBzwh+ VGBA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=nd7G3Mtn5mwQkSP+Gro1Y1I1pMwFHMb/8zzEJQ9v4dU=; fh=WT9yPG47ctacgbmFPUNr3IxOegr11ISwf/SGgrb8uPs=; b=KvW9SDIro5og2yEaNQuslw8+URmA1PoKxREk/zuRGwRZqJF1YS7yhF1J9o3GREOaLA jD+kFZb3AQLQ27+ciRHo1ICmntqu0ObxzJEURHOkhmcCRV6Nfrldwf/TwYCXdVFLQGES t6N5cNyATMT/thjasoFJYbAwl+i4MqYxKvWXpQHsK4Xev31ibBsp2h0b4SuuSC4ECs9e saAxyWjnDbw3rryjMQAifd7fZX5G+BF9qme0QRCIAx520JnRSajFr/BMR7ubPguQVuFz 5lqDs5Q1R7Ve0snit6FixOphTUb5l+Cv238INHYBRxabstqt63Q5pUJ8jQfgLuQzsqTH ZUBg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="V/2l8Ud+"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-126560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126560-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id vu1-20020a05620a560100b0078be44a0405si1702600qkn.146.2024.04.01.02.39.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Apr 2024 02:39:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-126560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="V/2l8Ud+"; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-126560-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-126560-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 063A61C20EB7 for ; Mon, 1 Apr 2024 09:39:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8630A10965; Mon, 1 Apr 2024 09:39:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="V/2l8Ud+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 93495101CE for ; Mon, 1 Apr 2024 09:39:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711964359; cv=none; b=G2aHiiDzPYrJ8eKcmlIaqjbtmEPaSrynU0AT6cQkLr3Ye1mx2kFKV/5bO0poy0cT47AoXSephLaj8Nk2M5tm5/tWxG/GLkngPwQCDmiPzQjSOx8wHqdHS1xEVbTkIDT8uqlpJIhxM+XyHuxcp/quuh0ioKIUeyHiKEZfsYIZz1k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711964359; c=relaxed/simple; bh=e9xEhCEi0Wtt1EeHOlTmbaOt5pzWnrErrDEVF5RY/ow=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WD6qWBAEtW6qv9QOmExFUZ8IP7P3iIUJw/JJc2MRw9DXh3IByuY9DkqU5hBqLxjKS64jcihcDzTwRA2/x/Q49aL7R4Bn3XmvgreZ4x0O70XejcE6MXdMXisJlTgF+mAM7x0xodrcxb8ZN4JTM3qUBffqyLG/orLnzUMPamwdAUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=V/2l8Ud+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4950C43394; Mon, 1 Apr 2024 09:39:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1711964359; bh=e9xEhCEi0Wtt1EeHOlTmbaOt5pzWnrErrDEVF5RY/ow=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=V/2l8Ud++wgLSA7gVLLno4a7JkmzknoJCif03klo+JuKyAoOQ/4TogWoVxMOoYlvp s2OdWKOuz2ao5CPoV8Bb2jmYZpm0BcXI5Um46F4QkIRN9tf10LDqTDJCwpd8lrxthd o1srCw5Jz1sGqJhCyGnm07XikOJXmjEwlYmcXe8E= Date: Mon, 1 Apr 2024 11:39:15 +0200 From: Greg KH To: "fengchunguo@126.com" Cc: ilpo.jarvinen@linux.intel.com, andriy.shevchenko@linux.intel.com, jirislaby@kernel.org, linux-kernel@vger.kernel.org, "chunguo.feng" Subject: Re: [PATCH] tty: serial: fixed uart irq maybe cause irq storm Message-ID: <2024040147-stinging-payback-04f5@gregkh> References: <1711963801-184362-1-git-send-email-fengchunguo@126.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1711963801-184362-1-git-send-email-fengchunguo@126.com> On Mon, Apr 01, 2024 at 05:30:01PM +0800, fengchunguo@126.com wrote: > From: "chunguo.feng" Please use your name, which is not with a "." in it, right? > if not disable uart irq before disable clk, uart irq maybe triggered after > disabled clk immediately, then maybe cause irq storm. > > Reproduced the below call trace, see i2c not be connected, but irq storm > was triggered. > > i2c_designware 30b70000.i2c: controller timed out > CPU: 2 PID: 2932 Comm: gnss@1.0-servic > Tainted: G O 5.14.61-00094-geaa0149416cc-dirty #8 > Hardware name: Semidrive kunlun x9 REF Board (DT) > Call trace: > [] dump_backtrace+0x0/0x3c0 > [] show_stack+0x14/0x1c > [] dump_stack+0xc4/0xfc > [] __report_bad_irq+0x50/0xe0 > [] note_interrupt+0x248/0x28c > [] handle_irq_event+0x78/0xa4 > [] handle_fasteoi_irq+0xe4/0x1b4 > [] __handle_domain_irq+0x7c/0xbc > [] gic_handle_irq+0x4c/0xb8 > [] el1_irq+0xb0/0x124 > [] _raw_spin_unlock_irqrestore+0x10/0x44 > [] dw8250_set_termios+0x48/0xf4 > [] serial8250_set_termios+0x14/0x28 > [] uart_change_speed+0x38/0x10c > [] uart_set_termios+0xd0/0x17c > [] tty_set_termios+0x160/0x1e4 > [] set_termios+0x32c/0x3bc > [] tty_mode_ioctl+0x6f0/0x7d8 > [] n_tty_ioctl_helper+0x10c/0x1e8 > [] n_tty_ioctl+0x120/0x194 > [] tty_ioctl+0x658/0xa34 > [] do_vfs_ioctl+0x554/0x810 > [] SyS_ioctl+0x88/0x94 > Exception stack(0xffff00000ccf3ec0 to 0xffff00000ccf4000 > > Signed-off-by: chunguo.feng > --- > drivers/tty/serial/8250/8250_dw.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c > index c1d43f0..133c24e 100644 > --- a/drivers/tty/serial/8250/8250_dw.c > +++ b/drivers/tty/serial/8250/8250_dw.c > @@ -359,6 +359,12 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, > > rate = clk_round_rate(d->clk, newrate); > if (rate > 0 && p->uartclk != rate) { > + /*Need disable uart irq before disabled clk, because uart irq maybe triggered after Space needed after '*', right? > + * disabled clk immediately, then cause irq storm. > + */ > + if (p->irq) > + disabled_irq(p->irq); This feels wrong, the irq should not be turned off here, what happens if some data comes in while this function is running? Will it be lost? thanks, greg k-h