Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4086482rwi; Wed, 12 Oct 2022 10:22:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7amPjHIzkQx1gPlAsB1jWzAFLgqRUpPBQorcIC0GwVIYQuKBLjWvTWwBxHzKskFNtvQvxx X-Received: by 2002:a05:6402:3887:b0:458:289e:c9cc with SMTP id fd7-20020a056402388700b00458289ec9ccmr28564041edb.101.1665595360331; Wed, 12 Oct 2022 10:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665595360; cv=none; d=google.com; s=arc-20160816; b=zShSbBCMmkgeskf3GB7g6CfXlacVqYr7/6Fem9H4dLwDxWi1XYfOCc16J5kbuPlL44 /vee5MAXPj4lQEVB59x5TNZYQ5cb0PzN0dAG3WvQnO41HhhTZP0Y19CjSve61g/s8TtC lzXc7fmZcdsJ9XyvY0NbJ+5VdgD+olJfzZ7+f/n2/Nb14b0gdkhdVFsVFsqwfsqLFLA8 YfmhjckwmRt0KybVr+AQrozDrRvUWH27AZxna3lN43y4BhSN04ZNd5d6vJPP6RwCCtl6 7hVUpnH62qAdOaCyGnWdapVDdZophuzUUn6eBmTLVjkBON7TTjIsrRH5emrh6sIIN1kw AOag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=GnjSuhCUJGpnAAztRDVl0eefb3M6/RpuSCKo0ZF+HgU=; b=ET2fngtOUfDcFqorv8m97u+BNJKmRm26KMSTRESRKs8oFZUd49RmP34TNKZwatLx1H QBa2ef2+80GiRlL7iUy9YwtTyvSQaEgJPxykB2nldtyJQqr7MBHyrCLhb23FqwwipUZk Znu8FK7g9etFiDnrgQ3tqHn1TV9lH5oDM6KbkMYSzPNBQ190OjVDI7HnsYQXtEE+XMks hBNM2rA4qUKfylpbi2stuPEEEyis58z2FOBTO4cyNaoAzd9T11k99Cw3n1YrnDTUbzjJ oBDNv4MVNq6sr1gzAtXa+77VshOK/noMZvUB7rEQGC0EWbCbqTOTs5kcaZ4AYdYQHI7v YmSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xf13-20020a17090731cd00b0073daf6b44a5si13974636ejb.775.2022.10.12.10.22.14; Wed, 12 Oct 2022 10:22:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230160AbiJLQaK (ORCPT + 99 others); Wed, 12 Oct 2022 12:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbiJLQ3o (ORCPT ); Wed, 12 Oct 2022 12:29:44 -0400 X-Greylist: delayed 2404 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 12 Oct 2022 09:29:37 PDT Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94AB3DFF; Wed, 12 Oct 2022 09:29:37 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1oidz2-000187-AD; Wed, 12 Oct 2022 17:49:24 +0200 Date: Wed, 12 Oct 2022 17:49:24 +0200 From: Martin Kaiser To: Shawn Guo Cc: Greg Kroah-Hartman , Jiri Slaby , Pengutronix Kernel Team , NXP Linux Team , linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] serial: imx: Add missing .thaw_noirq hook Message-ID: <20221012154924.x4rjav563efhsnep@viti.kaiser.cx> References: <20221012121353.2346280-1-shawn.guo@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221012121353.2346280-1-shawn.guo@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thus wrote Shawn Guo (shawn.guo@linaro.org): > The following warning is seen with non-console UART instance when > system hibernates. > [ 37.371969] ------------[ cut here ]------------ > [ 37.376599] uart3_root_clk already disabled > [ 37.380810] WARNING: CPU: 0 PID: 296 at drivers/clk/clk.c:952 clk_core_disable+0xa4/0xb0 > ... > [ 37.506986] Call trace: > [ 37.509432] clk_core_disable+0xa4/0xb0 > [ 37.513270] clk_disable+0x34/0x50 > [ 37.516672] imx_uart_thaw+0x38/0x5c > [ 37.520250] platform_pm_thaw+0x30/0x6c > [ 37.524089] dpm_run_callback.constprop.0+0x3c/0xd4 > [ 37.528972] device_resume+0x7c/0x160 > [ 37.532633] dpm_resume+0xe8/0x230 > [ 37.536036] hibernation_snapshot+0x288/0x430 > [ 37.540397] hibernate+0x10c/0x2e0 > [ 37.543798] state_store+0xc4/0xd0 > [ 37.547203] kobj_attr_store+0x1c/0x30 > [ 37.550953] sysfs_kf_write+0x48/0x60 > [ 37.554619] kernfs_fop_write_iter+0x118/0x1ac > [ 37.559063] new_sync_write+0xe8/0x184 > [ 37.562812] vfs_write+0x230/0x290 > [ 37.566214] ksys_write+0x68/0xf4 > [ 37.569529] __arm64_sys_write+0x20/0x2c > [ 37.573452] invoke_syscall.constprop.0+0x50/0xf0 > [ 37.578156] do_el0_svc+0x11c/0x150 > [ 37.581648] el0_svc+0x30/0x140 > [ 37.584792] el0t_64_sync_handler+0xe8/0xf0 > [ 37.588976] el0t_64_sync+0x1a0/0x1a4 > [ 37.592639] ---[ end trace 56e22eec54676d75 ]--- > On hibernating, pm core calls into related hooks in sequence like: > .freeze > .freeze_noirq > .thaw_noirq > .thaw > With .thaw_noirq hook being absent, the clock will be disabled in a > unbalanced call which results the warning above. > imx_uart_freeze() > clk_prepare_enable() > imx_uart_suspend_noirq() > clk_disable() > imx_uart_thaw > clk_disable_unprepare() > Adding the missing .thaw_noirq hook as imx_uart_resume_noirq() will have > the call sequence corrected as below and thus fix the warning. > imx_uart_freeze() > clk_prepare_enable() > imx_uart_suspend_noirq() > clk_disable() > imx_uart_resume_noirq() > clk_enable() > imx_uart_thaw > clk_disable_unprepare() > Signed-off-by: Shawn Guo > --- > drivers/tty/serial/imx.c | 1 + > 1 file changed, 1 insertion(+) > diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c > index 590a25369531..e5163c2c4169 100644 > --- a/drivers/tty/serial/imx.c > +++ b/drivers/tty/serial/imx.c > @@ -2603,6 +2603,7 @@ static const struct dev_pm_ops imx_uart_pm_ops = { > .suspend_noirq = imx_uart_suspend_noirq, > .resume_noirq = imx_uart_resume_noirq, > .freeze_noirq = imx_uart_suspend_noirq, > + .thaw_noirq = imx_uart_resume_noirq, > .restore_noirq = imx_uart_resume_noirq, > .suspend = imx_uart_suspend, > .resume = imx_uart_resume, > -- > 2.25.1 Reviewed-by: Martin Kaiser Thanks, Martin