From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) (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 68D18664AB for ; Tue, 2 Apr 2024 11:45:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712058321; cv=none; b=tDypdVt6agNwTwkErdjcN+zho2qPEn6mqfiB/BDqU731024WIukuEgIiVpaFGKsj2jcrze4Vn9HLn/6ozokLtINT4Xj/vdpizxUQXTfG0+cW8b1hNavNvSLWSSdPug4y1xEHJd1AzaVtpiWJjDOCHVH7runpdfWXwuZ8rWiToIA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712058321; c=relaxed/simple; bh=J3vcQZxpdCuFkFzGgNmgmy5MLAq/HWsIDZHYrStWpC0=; h=From:Date:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=aFWu+71JspDr0i4kfIp6fHfPhgnw+d23wTcAWIA9IT3icKaBNWlPdJ5W7lYizR48jn10IkfW+nAGFKD0Za5JOiAID3FwhPNvxToRSPZb+Xs1E5Wsf34aNxPbK2YV7hglm6OpRtTisgqoJUlyNTW/MjJdhK5qityO7rh69YAatNk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=B3KDF5r+; arc=none smtp.client-ip=192.198.163.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="B3KDF5r+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712058320; x=1743594320; h=from:date:to:cc:subject:in-reply-to:message-id: references:mime-version; bh=J3vcQZxpdCuFkFzGgNmgmy5MLAq/HWsIDZHYrStWpC0=; b=B3KDF5r+zLP/n1LbOJwXfpshdxPgtCwPqm4OmKvgPIT7UjwTG3xQdlbX Or4I8YNtd770zI+EJglvJXUNjqp/PEyNA8pzU620sc4isema6B1jf11Hp nCpVsDuwv8tcPL29WPUUgEJ4/RmfBdUM+QbMT67dtXMn304Z5XI4yl/ln X1UtTf+jezwLdCFOCQUriX/aEJa52f9uWS559eSkXzv1+UdHETBmBvT0y YdpXYW/ho+IMH+L0EOw/x8o7EibyTgowcWjW51T6J9Q4uPDCqp8UoCU2V SjWpEgu4d8l6KkR+ORJs9PPLCbkjpuS2pNMwUBIywMf41TksMXxgGPjR8 Q==; X-CSE-ConnectionGUID: WC73gDX3QhWDQEj03bETyg== X-CSE-MsgGUID: 7GrwS8vTQcGT2blo0inCmQ== X-IronPort-AV: E=McAfee;i="6600,9927,11031"; a="10185374" X-IronPort-AV: E=Sophos;i="6.07,174,1708416000"; d="scan'208";a="10185374" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2024 04:45:19 -0700 X-CSE-ConnectionGUID: uGgf1K3ASECt5D83I2EHwA== X-CSE-MsgGUID: jstpzW8eQhe2y+qgl1SR6w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,174,1708416000"; d="scan'208";a="22737103" Received: from ijarvine-desk1.ger.corp.intel.com (HELO localhost) ([10.245.247.23]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2024 04:45:17 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Date: Tue, 2 Apr 2024 14:45:12 +0300 (EEST) To: "fengchunguo@126.com" cc: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby , LKML , Gary Feng Subject: Re: [PATCH] tty: serial: fixed uart irq maybe cause irq storm In-Reply-To: <1711966746-225228-1-git-send-email-fengchunguo@126.com> Message-ID: References: <1711966746-225228-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 On Mon, 1 Apr 2024, fengchunguo@126.com wrote: > From: "Gary Feng" > > 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. This doesn't really explain what's going on here. Why is the irq being triggered? You even seem to imply that nothing is connected so what triggers is triggering that irq? Can we selectively disable only that part, if it's e.g. empty tx condition or something? > 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 Use your real name on signed-off line too. On From line you seem to provide different name as here. -- i. > --- > 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 > + * disabled clk immediately, then cause irq storm. > + */ > + if (p->irq) > + disabled_irq(p->irq); > + > clk_disable_unprepare(d->clk); > /* > * Note that any clock-notifer worker will block in > @@ -368,6 +374,9 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, > if (!ret) > p->uartclk = rate; > clk_prepare_enable(d->clk); > + > + if (p->irq) > + enable_irq(p->irq); > } > > dw8250_do_set_termios(p, termios, old); >