Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4533041rdb; Tue, 12 Dec 2023 02:10:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IFKuE58R+yX4XnyD0+xYHZGsUMy/uqhG2klcL2pcWCm3CxP4oFuPcG85RaRAvr8LDWOUE3m X-Received: by 2002:a05:6a20:bf10:b0:18f:cfed:6cc with SMTP id gc16-20020a056a20bf1000b0018fcfed06ccmr6975487pzb.117.1702375813202; Tue, 12 Dec 2023 02:10:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702375813; cv=none; d=google.com; s=arc-20160816; b=UknYt60lEezEx57A7zn10LXmpxq7PvR1d9XfTMfiFvu76FGYBatlah+hKZgx7YPuBr hQmvz5jDP6S9Tm2SNaW9oucqKO6Tv+dXUMv2lBjf7zgf41hsBMIKEcEvjNXK0ShoRIK3 I7n1vtgMuIExkd9kivc7XlHijWy9Tnb7VEjxF8ageKIN72+TBk7uSs1q9eMwR6YXEI1C 5kMctOIzR7KYvSX9JGk53EiBxeigoSoU5QPZD9a8to+mZFPAamTXsYPJFKgozlx7uBwy xwnjwVg2K/Kq47MTqvBdryWo0/vV1S1XWy0K+ssWXGImqevAANEeKy3eucSfOpKjhRF3 J3cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3E28BIhAcMlfJBxKwzHjZKYVki+pv/1ePwSlsPJFXqA=; fh=zbu7NmvQbpp1odbIgf+5Fr/8NqaIgtuBWuL6FhGppGs=; b=rnkWit6gZyOAGgNX6IYSOGrYNvjntNHTrGEVLSoLBSmHlnWLW425FGsVQQ/do2QPP5 lTdG8+LPlz1Tg55FMf8eLtaZls7zr3Dc4+VO5L5549RG3OyW7lH0+sfsy83FCeOZCvLn V1LlM/9eLVwnhwBi10+DUQx0HTLYgMJ4Pdw8lFp0zdsneQHGTHD1kMKNsxevTFu/iVD8 C7jHqws6w+ljYn5xSM7JmRV4Ltmf92d2sl60G+bObyyKTIDLwy+m4QzQvx24mkG0Lr4M zuxk6Vs5MgZVdY75Av2CUcm2GLfRZ2WcS4kU8LGkctJ0GTW5OTu5ew72c5mRnfzcjwoa XHnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dYUjpGYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id h18-20020a63e152000000b005bdbd683601si7534047pgk.57.2023.12.12.02.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 02:10:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=dYUjpGYn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 60F8980569B6; Tue, 12 Dec 2023 02:10:10 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230509AbjLLKJm (ORCPT + 99 others); Tue, 12 Dec 2023 05:09:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjLLKJl (ORCPT ); Tue, 12 Dec 2023 05:09:41 -0500 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BBC5AC; Tue, 12 Dec 2023 02:09:45 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3BCA9MtG032172; Tue, 12 Dec 2023 04:09:22 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1702375762; bh=3E28BIhAcMlfJBxKwzHjZKYVki+pv/1ePwSlsPJFXqA=; h=Date:From:To:CC:Subject:References:In-Reply-To; b=dYUjpGYnCWMwtwO2vXRWaabk7M3/0Mx1dRZiDbmHNZyxS5c4hPIoF/O9yFc7BD6D9 6Lv6h4kO2b2z0uAudu6ulU9ASp9Rbmy+p9q9/s+uWuaqpOW2wKG5Imvjixwkp8peAt zrshnmQ1vldj1rY8zNlfmbZwFnY6c/oQQ5FBkHWg= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3BCA9MdL127284 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 12 Dec 2023 04:09:22 -0600 Received: from DFLE109.ent.ti.com (10.64.6.30) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Tue, 12 Dec 2023 04:09:22 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE109.ent.ti.com (10.64.6.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Tue, 12 Dec 2023 04:09:22 -0600 Received: from localhost (uda0497581.dhcp.ti.com [10.24.69.44]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3BCA9Lvx017052; Tue, 12 Dec 2023 04:09:22 -0600 Date: Tue, 12 Dec 2023 15:39:20 +0530 From: Manorit Chawdhry To: Vignesh Raghavendra CC: Wim Van Sebroeck , Guenter Roeck , Tero Kristo , , , , Subject: Re: [PATCH v2] watchdog: rti_wdt: Drop RPM count when unused Message-ID: <20231212100920.wq26mylvn5qsms6w@uda0497581> References: <20231122041642.2015936-1-vigneshr@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231122041642.2015936-1-vigneshr@ti.com> X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 12 Dec 2023 02:10:10 -0800 (PST) Hi Vignesh, On 09:46-20231122, Vignesh Raghavendra wrote: > Do a RPM put if watchdog is not already started during probe and re > enable it in watchdog start. > > On K3 SoCs, watchdogs and their corresponding CPUs are under same PD, so > if the reference count of unused watchdogs aren't dropped, it will lead > to CPU hotplug failures as Device Management firmware won't allow to > turn off the PD due to dangling reference count. > > Fixes: 2d63908bdbfb ("watchdog: Add K3 RTI watchdog support") > Signed-off-by: Vignesh Raghavendra > --- > > v2: > * Drop 1/2 (will be posted along with runtime_pm callbacks) > * Use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() which > takes care of err handling > > v1: lore.kernel.org/r/20231110100726.2930218-1-vigneshr@ti.com > > drivers/watchdog/rti_wdt.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c > index 8e1be7ba0103..9215793a1c81 100644 > --- a/drivers/watchdog/rti_wdt.c > +++ b/drivers/watchdog/rti_wdt.c > @@ -77,6 +77,11 @@ static int rti_wdt_start(struct watchdog_device *wdd) > { > u32 timer_margin; > struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd); > + int ret; > + > + ret = pm_runtime_resume_and_get(wdd->parent); > + if (ret) > + return ret; > > /* set timeout period */ > timer_margin = (u64)wdd->timeout * wdt->freq; > @@ -343,6 +348,9 @@ static int rti_wdt_probe(struct platform_device *pdev) > if (last_ping) > watchdog_set_last_hw_keepalive(wdd, last_ping); > > + if (!watchdog_hw_running(wdd)) > + pm_runtime_put_sync(&pdev->dev); > + > return 0; > > err_iomap: > @@ -357,7 +365,10 @@ static void rti_wdt_remove(struct platform_device *pdev) > struct rti_wdt_device *wdt = platform_get_drvdata(pdev); > > watchdog_unregister_device(&wdt->wdd); > - pm_runtime_put(&pdev->dev); > + > + if (!pm_runtime_suspended(&pdev->dev)) > + pm_runtime_put(&pdev->dev); > + > pm_runtime_disable(&pdev->dev); > } > Tested the following on j721s2 evm. https://gist.github.com/manorit2001/05a85582fea670d39cc3cfb2df1e5328 Tested-by: Manorit Chawdhry Regards, Manorit > -- > 2.42.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel