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 92CE8C4332F for ; Mon, 21 Mar 2022 14:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349667AbiCUOxR (ORCPT ); Mon, 21 Mar 2022 10:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349847AbiCUOxN (ORCPT ); Mon, 21 Mar 2022 10:53:13 -0400 Received: from mail-4327.protonmail.ch (mail-4327.protonmail.ch [185.70.43.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1E8753E32 for ; Mon, 21 Mar 2022 07:51:48 -0700 (PDT) Received: from mail-0301.mail-europe.com (mail-0301.mail-europe.com [188.165.51.139]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by mail-4321.protonmail.ch (Postfix) with ESMTPS id 4KMcyW00lzz4wwdN for ; Mon, 21 Mar 2022 14:51:46 +0000 (UTC) Authentication-Results: mail-4321.protonmail.ch; dkim=pass (2048-bit key) header.d=pm.me header.i=@pm.me header.b="idI/a3F/" Date: Mon, 21 Mar 2022 14:51:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail2; t=1647874301; bh=4AMGpvyEAhT/UTvfbGh3uP++8M9RSSyLpSP97ed6Q34=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=idI/a3F/4O++98+kp/E8xzgEXG4i+BYjqjnbMTphalAEKbOHbnNX8z8h8V9PG1Vmk meUSrIZkMsUyVsY0v1tD8IYorPG51vshwugLF0zscmKyq71rRgp0mKrqGcFl6CaIjf JtzqrCvmkS3dXssyURusAU6wWG9ej/ma1LcpEg9PhZyQLt2FHtA98UZ14TXSYgowWa UiYno94wBqc90ityarI+M7NpuMtEW1SNup7O3ozd8JSISFx2TXRY/mVakxa1LlHsc5 VPPI7zhu2rsJrbJXhO5H/HH6KKGc3IzTdaRYcsViKpqic6RNcxSeioJzJarjZeaEyl O95kNW8j5nd2A== To: "Rafael J. Wysocki" From: David Cohen Cc: Pavel Machek , Len Brown , Linux PM , Linux Kernel Mailing List Reply-To: David Cohen Subject: Re: [PATCH v2] PM: fix dynamic debug within pm_pr_debug() Message-ID: In-Reply-To: References: <20220312043624.40732-1-dacohen@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org On Mon, Mar 21, 2022 at 03:20:20PM +0100, Rafael J. Wysocki wrote: > On Sat, Mar 19, 2022 at 2:54 AM David Cohen wrote: > > > > On Thu, Mar 17, 2022 at 02:45:11PM +0100, Rafael J. Wysocki wrote: > > > On Sat, Mar 12, 2022 at 5:37 AM David Cohen wrote: > > > > > > > > Currently, pm_pr_debug() and pm_deferred_pr_debug() use __pm_pr_deb= ug() > > > > to filter pm debug messages based on pm_debug_messages_on flag. > > > > According to __pm_pr_debug() implementation, pm_deferred_pr_debug() > > > > indirectly calls printk_deferred() within __pm_pr_debug() which doe= sn't > > > > support dynamic debug, but pm_pr_debug() indirectly calls pr_debug(= ) > > > > > > I'm not sure what you mean by pm_pr_debug(). There's no such thing i= n > > > the kernel tree. > > > > > > Assuming that it means pm_pr_dbg(), it doesn't call pr_debug(): > > > > Yeah, I apologize for the typo. I meant pm_pr_dbg(). I can fix that if > > you're ok with the patch as per comments below. > > > > > > > > #define pm_pr_dbg(fmt, ...) __pm_pr_dbg(false, fmt, ##__VA_ARGS__) > > > > > > and > > > > > > void __pm_pr_dbg(bool defer, const char *fmt, ...) > > > { > > > ... > > > if (defer) > > > printk_deferred(KERN_DEBUG "PM: %pV", &vaf); > > > else > > > printk(KERN_DEBUG "PM: %pV", &vaf); > > > > > > And as I said printk(KERN_DEBUG ...) is not equivalent to > > > pr_debug(...), because it is not dynamic printk(). > > > > The problem is not about __pm_pr_dbg() calling printk(). The problem is > > the pm files that used to call pr_debug() were modified to call > > pm_pr_dbg() in order to be behing the pm_debug_messages_on flag, as per > > this commit: > > 8d8b2441db96 PM / sleep: Do not print debug messages by default > > So what's the problem with setting pm_debug_messages_on in addition to > enabling dynamic debug for a given file? Let me be a bit more detailed: Before "8d8b2441db96 PM / sleep: Do not print debug messages by default": - pr_debug() was used - The kernel pm files had dynamic debug support - All the instances using pr_debug() are visible on /sys/kernel/debug/dynamic_debug/control - pm_debug_messages_on flag was not supported After "8d8b2441db96 PM / sleep: Do not print debug messages by default": - pr_debug() was replaced with pm_pr_dbg() - The kernel pm files where pm_pr_dbg() replaced pr_debug() *lost* dynamic debug support and they are no longer visible on /sys/kernel/debug/dynamic_debug/control - pm_debug_messages_on flag was introduced What my patch is doing: - Reintroducing dynamic debug support to the same files who lost it after the patch mentioned above - The instances using pr_pm_dbg() (which originally came from pr_debug()) are reintroduced to /sys/kernel/debug/dynamic_debug/control - pm_debug_messages_on flag is unaltered Regards, David