Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp292930rdb; Thu, 21 Dec 2023 09:13:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8WhxyC3fqqmcUYRfi9ELJBHV7aoMk9YotfOO38JgQmxsTtyVv37FKi8uBQAsf5TAXNVHX X-Received: by 2002:a05:6870:8a23:b0:1fa:db9b:4080 with SMTP id p35-20020a0568708a2300b001fadb9b4080mr134060oaq.22.1703178836217; Thu, 21 Dec 2023 09:13:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703178836; cv=none; d=google.com; s=arc-20160816; b=MJj0DqC8FHZHr7lULmmA78GQnB1Kw9T/h/LClhqgaoYDLmwlfBquqdmSENCPgx0MWD egc9OYL9UQUO9b7ntpRMhJUwrrf451V8xAw22Q7XgqFeHf6eFp46RfdqiOfSxtR3qScJ 7uLtgQRGZZcCl7nRJj7DflWVByAfbT5pGmdbUNFn8v3knInTCiIVzBxMjA0dSE+snWev 1F/TyoWPDSGpjrJyiDFThTKWe7W818kSK+QSVnafDhkIaNOxk20ElPKo5kXaW9Jpq1Mz /bXz4fO/7fojsU5zXKQbk/3vZt7AbCHErxpbIsUPWF/g2Ujg985NecpeK/j8wD8Zbtls PQ0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :cc:to:from:date:dkim-signature; bh=248JVgGyRvCA5szqZVI4DtrGSxFHLc+06wLR7mZzUgw=; fh=wHytOafv1D3C0md+AdoEHH6pF1CtctJqp8FfIqRlXcE=; b=0E1wOjxbVN7WYQjY7Ja1OjPTzTQLgOuRMcdZBPV9FZLKdacsLnu7XVwuCXgGIJw3Gk gQuoi5At9vHTOlEywRTn57moCVpeoSVTMvzJujOLfOAToHCwv9WbnkYgcm5mvbLZVoN0 twZzPTzA/1Qw1NMEX/nMe5+AYEn2dl9rRnMDnAQjDc2kR2O/fBs+EHMuWEIUYmBL5tkO ZMDex5gVQ03DO2glRn6pa5Bh2IiBd7guqtKMqJyBShZQQWdLbU3Fisj9l4hrx0q58weo Kr3SGece0VZ4sV6Wwud4QGi9JJR19EfYRST4PGtQzP4dcG8lXimxbiZLQr5sLaBD/I8G 1Cmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=HJD9yBYP; spf=pass (google.com: domain of linux-kernel+bounces-8822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8822-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id x124-20020a1fe082000000b004b6f2421beesi509708vkg.143.2023.12.21.09.13.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 09:13:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=HJD9yBYP; spf=pass (google.com: domain of linux-kernel+bounces-8822-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8822-linux.lists.archive=gmail.com@vger.kernel.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 EC1811C25F05 for ; Thu, 21 Dec 2023 17:13:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79DD35991F; Thu, 21 Dec 2023 17:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="HJD9yBYP" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (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 F0B295822F; Thu, 21 Dec 2023 17:13:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:Mime-Version:Message-Id:Cc:To:From :Date:subject:date:message-id:reply-to; bh=248JVgGyRvCA5szqZVI4DtrGSxFHLc+06wLR7mZzUgw=; b=HJD9yBYPkAx1lcfslO8XmfanRu EUDSmzPVea8xvPCxexKhDR+0nnQWZiERB9AKjbqWVV+Wms4loMDsUORbkhbPHFR61q3UkJvKUxkru UYjBYHq1P70oHavw/ld3qm+lSF+RMyQ96wWmdZ01ZkVoZKBx42UvFCQIkuKLT+jjtuNM=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:45918 helo=pettiford) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rGMc6-0007Fu-7K; Thu, 21 Dec 2023 12:13:38 -0500 Date: Thu, 21 Dec 2023 12:13:37 -0500 From: Hugo Villeneuve To: Andy Shevchenko Cc: gregkh@linuxfoundation.org, jirislaby@kernel.org, jringle@gridpoint.com, kubakici@wp.pl, phil@raspberrypi.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Hugo Villeneuve , stable@vger.kernel.org, Yury Norov Message-Id: <20231221121337.8d56a89ece7c341f9f36bf6b@hugovil.com> In-Reply-To: References: <20231219171903.3530985-1-hugo@hugovil.com> <20231219171903.3530985-3-hugo@hugovil.com> <20231221105639.17910de5e7d7a486834bd856@hugovil.com> <20231221111337.2c1af5bbe4920268dac25e8f@hugovil.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * -0.0 T_SCC_BODY_TEXT_LINE No description available. * -3.8 NICE_REPLY_A Looks like a legit reply (A) Subject: Re: [PATCH 02/18] serial: sc16is7xx: fix invalid sc16is7xx_lines bitfield in case of probe error X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) On Thu, 21 Dec 2023 18:16:40 +0200 Andy Shevchenko wrote: > On Thu, Dec 21, 2023 at 11:13:37AM -0500, Hugo Villeneuve wrote: > > On Thu, 21 Dec 2023 10:56:39 -0500 > > Hugo Villeneuve wrote: > > > On Wed, 20 Dec 2023 17:40:42 +0200 > > > Andy Shevchenko wrote: > > ... > > > > this will indeed fix the problem described in patch 1. > > > > > > However, if I remove patch 1, and I simulate the same probe error as > > > described in patch 1, now we get stuck forever when trying to > > > remove the driver. This is something that I observed before and > > > that patch 1 also corrected. > > > > > > The problem is caused in sc16is7xx_remove() when calling this function > > > > > > kthread_flush_worker(&s->kworker); > > > > > > I am not sure how best to handle that without patch 1. > > > > Also, if we manage to get past kthread_flush_worker() and > > kthread_stop() (commented out for testing purposes), we get another bug: > > > > # rmmod sc16is7xx > > ... > > crystal-duart-24m already disabled > > WARNING: CPU: 2 PID: 340 at drivers/clk/clk.c:1090 > > clk_core_disable+0x1b0/0x1e0 > > ... > > Call trace: > > clk_core_disable+0x1b0/0x1e0 > > clk_disable+0x38/0x60 > > sc16is7xx_remove+0x1e4/0x240 [sc16is7xx] > > > > This one is caused by calling clk_disable_unprepare(). But > > clk_disable_unprepare() has already been called in probe error handling > > code. Patch 1 also fixed this... > > Word "fixed" is incorrect. "Papered over" is what it did. Hi, I just found the problem, and it was in my bug simulation, not the driver itself. When I simulated the bug, I forgot to set "ret" to an error code, and thus I returned 0 at the end of sc16is7xx_probe(). This is why sc16is7xx_remove() was called when unloading driver, but shouldn't have. If I simulate my probe error and return "-EINVAL" at the end of sc16is7xx_probe(), sc16is7xx_remove() is not called when unloading the driver. Sorry for the noise, so I will drop patch 1 and leave patch "fix invalid sc16is7xx_lines bitfield in case of probe error" as it is, and simply remove comments about Yury's patch. Hugo.