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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE82CC46CA3 for ; Sat, 9 Dec 2023 15:29:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231407AbjLIP06 (ORCPT ); Sat, 9 Dec 2023 10:26:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230443AbjLIP04 (ORCPT ); Sat, 9 Dec 2023 10:26:56 -0500 Received: from smtp.smtpout.orange.fr (smtp-14.smtpout.orange.fr [80.12.242.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8383FB for ; Sat, 9 Dec 2023 07:27:02 -0800 (PST) Received: from [192.168.1.18] ([92.140.202.140]) by smtp.orange.fr with ESMTPA id BzEFrOMQyNKQIBzEGrkMX9; Sat, 09 Dec 2023 16:27:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702135621; bh=qbef5jn99LixpSHbxUw4//EMooebEcS8svrn6x7ih6g=; h=Date:Subject:To:References:From:In-Reply-To; b=oaKQ3/SeLivCKoqOioUutWGpW+pS8fECF4Tw7o2Ziqr9bI1sLNBvB3cjy114OyfHe 2AoZ+gDNliF53OqWhSv1vv5JPGb1vcs0qDpMvOcZzRdcyOFtWLmPiKbqE5Frl9dC38 zgW2S22RNRiy03PDm0yU5msI94QlhpmNv+fiSrft5UPJeSVcA5nN37RW+HOZ6VS2x5 3QO4kmDUG5RQJujXxO6crZDAqPqV3ZTkPhxeKeteoXDAyjzzxiq2DBVGt9nByf3BOF 6/qeb8D0Bx/Xm4L8zXpi1lGUPh740CUDSaime8nr1I/PmhFIEiqWI88ROLXSzmSBuW Ky9qmPoYtCcpw== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 09 Dec 2023 16:27:01 +0100 X-ME-IP: 92.140.202.140 Message-ID: <7078bc2e-7029-4abe-b970-3a6b83e10c53@wanadoo.fr> Date: Sat, 9 Dec 2023 16:26:54 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] PM / sleep: Mechanism to find source aborting kernel suspend transition Content-Language: fr To: Vimal Kumar , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231209081056.1497-1-vimal.kumar32@gmail.com> From: Christophe JAILLET In-Reply-To: <20231209081056.1497-1-vimal.kumar32@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 09/12/2023 à 09:10, Vimal Kumar a écrit : > Sometimes kernel suspend transitions can be aborted unconditionally by > manipulating pm_abort_suspend value using "hard" wakeup triggers or > through "pm_system_wakeup()". > > There is no way to trace the source path of module or subsystem which > aborted the suspend transitions. This change will create a list of > wakeup sources aborting suspend in progress through "hard" events as > well as subsytems aborting suspend using "pm_system_wakeup()". > > Example: Existing suspend failure logs: > [ 349.708359] PM: Some devices failed to suspend, or early wake event detected > [ 350.327842] PM: suspend exit > > Suspend failure logs with this change: > [ 518.761835] PM: Some devices failed to suspend, or early wake event detected > [ 519.486939] Abort: ws or subsystem uart_suspend_port aborted suspend > [ 519.500594] PM: suspend exit > > Here we can clearly identify the module triggerring abort suspend. > > Co-developed-by: Chinmoy Ghosh > Signed-off-by: Chinmoy Ghosh > Co-developed-by: Mintu Patel > Signed-off-by: Mintu Patel > Co-developed-by: Vishal Badole > Signed-off-by: Vishal Badole > Signed-off-by: Vimal Kumar > --- ... > +void pm_add_abort_suspend_source(const char *source_name) > +{ > + struct pm_abort_suspend_source *info = NULL; No need to init. > + > + info = kmalloc(sizeof(struct pm_abort_suspend_source), GFP_KERNEL); Could be sizeof(*info). > + if (unlikely(!info)) { > + pr_err("Failed to alloc memory for pm_abort_suspend_source info\n"); No need to log a message if kmalloc() fails, a trace is already logged. > + return; > + } > + > + /* Initialize the list within the struct if it's not already initialized */ > + if (list_empty(&info->list)) > + INIT_LIST_HEAD(&info->list); > + > + info->source_triggering_abort_suspend = kstrdup(source_name, GFP_KERNEL); > + if (unlikely(!info->source_triggering_abort_suspend)) { > + pr_err("Failed to get abort_suspend source_name\n"); Same here. > + kfree(info); > + return; > + } > + > + list_add_tail(&info->list, &pm_abort_suspend_list); ... CJ