From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.171.202.116 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794994200; b=cbWoPaRVsuRJySzt5uyBxJSZvZJ7XJBlt2FCYaMbWADds9h7rR2lmWrKHr2cOZz2lpat wF289UDzY4JwLl9roncT7hFnKnqX3fZFLvz8XAFLe9hMU3iltNTbwZYQ41YJLKrkysw2f xYBt6QyV/GNluTB6dEbmrxZOCrBCdA/EP0yvOY/KPOl3QxVGeGrebKUe4Rz+gIYYSP8NN NxX8yzdUY8PoVjc0oVMpP8Jy2IMioX60WuW5nFqCHolpoNPg6yCxoCffAf8XbVoYy99gd uYOSknJra+w73cU9DAmtxBl3q7B3kR+Ik6QQo1kUZAQE/e3BIqzG4vUy9RZeRzegeNQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794994200; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:From:To:Cc: Subject:In-Reply-To:References:User-Agent:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding: X-Last-TLS-Session-Version; bh=voptK8eT+WsHOSo6pPGL3uudEvaomLPBqr7xSbzHqQQ=; b=2YFX+a7SgEoQxnV8hslesgFH+0V+AJMweq7NCRUpHgZg+su+6L++6QOgM450mgPzqxNn z9ceNkaRVj+uZWZTKFZhmAgLQfBBtJZ4A7fbotJ+r9Z14k9RZhlG8AEomfDW0ma4m3zPS h+tCKZHo6OgB8VEhCcVYqE6HOMLsLQuH5D3mT8dww/d/lEB3mzIcEjvLQZD8g0ZbQuXUG 3qL/cyHEN0f/85EuTp3B1BzReMVvFiltLRkDkhcj8I9MZu/Xij46PSSSGGYZZW1a+qaas 20pIik0oTBMyn4kwziwxzo3PC2PyQMN47V12rl3kn/sN675yU++ghQYKX3/irL6LsaQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b="K/kCWAmA"; arc=none smtp.remote-ip=185.171.202.116 Received: from smtpout-04.galae.net (smtpout-04.galae.net [185.171.202.116]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CAD0606A325 for ; Wed, 18 Nov 2026 09:29:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 9CAD0606A325 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=K/kCWAmA Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-04.galae.net (Postfix) with ESMTPS id 94A42C4CBDB; Wed, 18 Nov 2026 09:30:02 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id CCC355FE9B; Wed, 18 Nov 2026 09:29:57 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7FD9011BC0D09; Wed, 18 Nov 2026 10:29:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1794994197; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=voptK8eT+WsHOSo6pPGL3uudEvaomLPBqr7xSbzHqQQ=; b=K/kCWAmAi5/EAT9d0c7bVZS4fvoWoMIOM11w4Djgw4sCdjz90Jb4IDEf+jwv6+XU+8voc+ JcHIxWdL+RWUxSAkbmMjBNqPVZDQ/vT8fqTt8ANikMzGJIkeKiFCeK9yMZJByJgaz4dx16 g/AXBEnk849LmR/iC2LR/0tMAkX2zC7vKh94FIK1WkiRRM3fjSFgrW+s5YpcO9ZN+I/Ba5 v6CpKaKD86pBeZ8y8ThA7dqD1j4/RDEVem1dA+r4Q3DXB9tzxFUxj6Z/h950ySVy/wdC5A CQSC/v89vQb57dDi4kztGXBxA8hnmX5kIEuGSFxCM2+eMFNMB1/EM8CgqJIOyg== From: Miquel Raynal To: Yaohan Li Cc: rafael@kernel.org, daniel.lezcano@kernel.org, rui.zhang@intel.com, lukasz.luba@arm.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, edubezval@gmail.com Subject: Re: [PATCH] thermal/drivers/armada: free the overheat IRQ before the zones are gone In-Reply-To: <20261118072339.1259719-1-shunsheng1218@gmail.com> (Yaohan Li's message of "Wed, 18 Nov 2026 15:23:39 +0800") References: <20261118072339.1259719-1-shunsheng1218@gmail.com> User-Agent: mu4e 1.12.12; emacs 30.2 Date: Wed, 18 Nov 2026 10:29:54 +0100 Message-ID: <87ld6qjxm5.fsf@bootlin.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Last-TLS-Session-Version: TLSv1.3 On 18/11/2026 at 15:23:39 +08, Yaohan Li wrote: > The overheat interrupt is requested before the thermal zones are > registered, so devres releases the zones first and the interrupt > afterwards. armada_overheat_isr_thread() calls > thermal_zone_device_update() on priv->overheat_sensor, which by then has > been unregistered and freed, and thermal_zone_device_update() locks the > zone mutex unconditionally. > > The handler also polls the sensor once per second until the temperature > drops below the threshold. If that poll is still running when the > device goes away, free_irq() waits for it and the removal is blocked for > as long as the sensor stays hot. > > The same handler runs while priv->overheat_sensor is still NULL, because > the interrupt is requested before the zones exist and a spurious > interrupt in that window passes a NULL zone to > thermal_zone_device_update(). > > Move the teardown into armada_thermal_quiesce_irq(), which disables the > interrupt, frees it and tells the poll loop to give up, and call it from > ->remove(). The same helper is called from the probe rollback once the > interrupt has been requested: the driver core does not run ->remove() > for a probe that fails, while devres still frees the zones and the > private data of an interface whose handler is registered. > > Read the zone once at the top of the thread and bail out when it is not > published yet or the driver is shutting down, and reuse that pointer for > both thermal_zone_device_update() calls. > > Fixes: 879d7362d1d0 ("thermal: armada: add overheat interrupt support") > Signed-off-by: Yaohan Li Your solution is over-engineered. For a case simple like that, you would need to just move the IRQ registration (not the get_irq()) after the zones registration. Maybe you need a shutdown boolean as well, but clearly not all the extra complexity you are trying to add. Thanks, Miqu=C3=A8l