Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2006434lqz; Tue, 2 Apr 2024 04:45:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4ZnpadzbnbLyswWJUaJnIoRMFb5g4R90QYsAux4/nt4RZ2ZwIn2yU8TBLai6q9d0HOH6UReUSHDEFB13EFK/KEZrtetirdLCBdx07hg== X-Google-Smtp-Source: AGHT+IENfd4pNzsBuI4eJxegVZ4kd0YPKeRG3MAgHma6jAFI4Ml/CLVdBn+DUi/ZM3vt6ElDeKLd X-Received: by 2002:a17:906:fe0d:b0:a4e:7f22:cfc2 with SMTP id wy13-20020a170906fe0d00b00a4e7f22cfc2mr2319057ejb.28.1712058341440; Tue, 02 Apr 2024 04:45:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712058341; cv=pass; d=google.com; s=arc-20160816; b=VcDUS+/o6zt2RUdZeJeuepL6/cGyC0Bu14iRXBJFKeXaqQLbwH8pZF+712gskEdata n4zYalcBw4T0daoU3uYxLWrsa37q97H+VQZlGKMoKqVj1NXV/ZslWoU9oSB3OJnXTwlu ckFZvC00dHzg22YIK/tfAzXx6Ejx3Non6YpMw+9SfZNpO+PRT1ZUrH91K/g1w2g8n9ew PovLhCZFiRYjvivsBHJvFBHBKeKJy3RaPAPC7qScNtr4TOmB/Qud6wTTA3ZpMGRFEz43 vsBzl6YNTQ4RZPi9YkWjqHQG4a/b0Olk038zCyq+E8qDofE8T2cTlt/AZ7YHNkXmoQin MNFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:in-reply-to:subject:cc:to:date:from :dkim-signature; bh=obi3PzD06rbbyDyYTiZUIppieZGnHosblUgvm3AXGtI=; fh=iQTqdDEMfLF/j0NOTiE1McUHT2YbIY8vL/gUvReyavE=; b=YaxOfSp/gOKc/QGns9l4+7CPqttjyku4JOKuPu2SCZZzIdJoQRyjx6nvK1SuYRVrEs n0IoYs8/IXRSK2NYLV4w6ADrOyZO0yLc0eiBmkIE+h96WQcHX2bNyBqmYEWL1e62yQIp urzqIXXKqyedgIQgJS+gTzs7UjrX4Ear1jQCGXeF1wEqJJ9iaogcUcqkFwaRGb+Mj7DO 2mP22/DdtanOrbfcr7qV9vN9csxMmtZ+VqjNjC0d78PQ64Y4aLfS38gqOn0uvpJMHyO5 xmMS2Sm6jwhojmfjZVlYxmUTvFPt40VBZtat4+6wihlci6rWKc1aYytEyS1DaZ5ufIEk 3k6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B3KDF5r+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-127881-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gt6-20020a1709072d8600b00a4e8068548fsi988430ejc.1023.2024.04.02.04.45.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 04:45:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-127881-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=B3KDF5r+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-127881-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-127881-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 27B691F24721 for ; Tue, 2 Apr 2024 11:45:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D7E069D27; Tue, 2 Apr 2024 11:45:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="B3KDF5r+" 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 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); >