From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7F54C433EF for ; Thu, 21 Oct 2021 07:47:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A436A6112D for ; Thu, 21 Oct 2021 07:47:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A436A6112D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WFXu1RjK//gVpelHiPc8RvLX3UUzjUmwG2vmL9+VX90=; b=BlET4Z1SAp88fY SjNxj9+j8Vg9lzDpjF6cp9Y+hyq3Y0v56+OzhPVtrBGE5+tNdtYF2HC3JGS/XqDCeDz5L1lTlfKR9 z+Fvg0sm13K6BYrejkrS8uCNtEttrCtipLmUI6klOpaO1B48ZLLp0sVrcbZ8xMf4AlzZExkCgY8cp q4ULemENMe1Tbac5naqLKuECF5tYCGLzLS0uqq0HTq2wLAzeRZ9nSl11udw8tubDtNzd+DRikIo3l Bi2vqRuhS02xptz1T83sf3LhXFXlqKxSvUhd5GSdU+oNyhKsz0XBThnY2G2gAgZVB2YAmw1k+J6Pm Kna+2K+1QMOZ64ymkOKg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdSlQ-006jw4-MD; Thu, 21 Oct 2021 07:45:25 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdSlE-006jsc-Jg for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 07:45:14 +0000 Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdSl1-0002iG-3h; Thu, 21 Oct 2021 09:44:59 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mdSky-0000cq-M2; Thu, 21 Oct 2021 09:44:56 +0200 Date: Thu, 21 Oct 2021 09:44:56 +0200 From: Oleksij Rempel To: Daniel Lezcano Cc: Petr Benes , Michal =?utf-8?B?Vm9rw6HEjQ==?= , linux-pm@vger.kernel.org, Shawn Guo , Sascha Hauer , Amit Kucheria , linux-kernel@vger.kernel.org, Andrzej Pietrasiewicz , NXP Linux Team , Pengutronix Kernel Team , David Jander , Zhang Rui , Fabio Estevam , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2] thermal: imx: implement runtime PM support Message-ID: <20211021074456.GD2298@pengutronix.de> References: <20211019130809.21281-1-o.rempel@pengutronix.de> <20211020050459.GE16320@pengutronix.de> <20211021072000.GC2298@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 09:43:36 up 245 days, 11:07, 119 users, load average: 0.15, 0.12, 0.12 User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211021_004512_697104_48E777EB X-CRM114-Status: GOOD ( 34.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 21, 2021 at 09:41:35AM +0200, Daniel Lezcano wrote: > On 21/10/2021 09:20, Oleksij Rempel wrote: > > Hi Petr, > > > > On Wed, Oct 20, 2021 at 05:53:03PM +0200, Petr Benes wrote: > >> On Wed, 20 Oct 2021 at 07:05, Oleksij Rempel wrote: > >>> > >>> Hi Petr and Michal, > >>> > >>> I forgot to add you for v2 in CC. Please test/review this version. > >> > >> Hi Oleksij, > >> > >> It works good. with PM as well as without PM. The only minor issue I found is, > >> that the first temperature reading (when the driver probes) fails. That is > >> (val & soc_data->temp_valid_mask) == 0) holds true. How does > >> pm_runtime_resume_and_get() behave in imx_thermal_probe()? > >> Does it go through imx_thermal_runtime_resume() with usleep_range()? > > > > On the first temperature reading, the PM and part of HW is not > > initialized. Current probe sequence is racy and has at least following > > issues: > > - thermal_zone_device_register is executed before HW init was completed. > > It kind of worked before my patch, becaus part of reinit was done by > > temperature init. It worked, since the irq_enabled flag was not set, > > but potentially would run enable_irq() two times if device is > > overheated on probe. > > - the imx_thermal core is potentially disable after first race > > condition: > > CPU0 CPU1 > > thermal_zone_device_register() > > imx_get_temp() > > irq_enabled == false > > power_up > > read_temp > > power_up > > power_down > > irq_enabled = true; > > > > ... at this point imx_thermal is powered down for some amount of time, > > over temperature IRQ will not be triggered for some amount of time. > > > > - if some part after thermal_zone_device_register() would fail or > > deferred, the worker polling temperature will run in to NULL pointer. > > This issue already happened... > > > > After migrating to runtime PM, one of issues started to be visible even > > on normal conditions. > > I'll send one more patch with reworking probe sequence. > > Are you planning to send a v3 with this patch? Or a separate patch? I'm OK with both variants. What do you prefer? I'll do i on top of PM patch to reduce refactoring overhead, if you OK about it. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel