Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3108062rwb; Wed, 30 Nov 2022 15:40:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf62ErbEv1uPtKNMdXmm0bYsyrMJ5riXjiNAeJjSo0TJdP5KAFxBICOFJDCXKgNxEp8DJJUA X-Received: by 2002:a17:90b:1942:b0:219:42d8:bd3a with SMTP id nk2-20020a17090b194200b0021942d8bd3amr14642264pjb.177.1669851611787; Wed, 30 Nov 2022 15:40:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669851611; cv=none; d=google.com; s=arc-20160816; b=u7M7R42Gd6+ZU9B0VrVOQKs6ZNs8dZWfyvOMkvTYRSe9PekN4aNsoB/POXfX0gk+Ti xjXeTSCh0UhAQ5KdmzE21CWK24oWvz4ERc7XhbiAQCnSpMCjH49vxjfznhqdiiu4S2vF Bei2Mn4TGnLB7nS5Q2W1gC7BigHvjAX6z8Bsa+FO8XfiJEHar7jAQFJ+fO76QwDJNVXo Uv1k/NndWKeDKg/03wBrsVuluSTYY3Q0ghwtTPk5Pepo+Op9NRVrkMZJPV7bpdkXz6eU 85mE2nMAyfKVl2uiVn7EGCUykSJG/CJpEpaapIlQ7UMm+PtEl+Kb+22a8JcjO13SEZAb ACHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:jabber-id:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=qycipsv+7BrU2f5/gAAFxfFvwk72gmjmiTqixIvbLRA=; b=B00zjd3QptjTBu8+ztwST5Tk2G19mI43SfAj1ixv111+8mTT/7e6XzzPEkmVesiaST ORgU2po2vBwn9CeJ8SwCGPRtf5TJqG3Dv4/Pq0T7ovbU+rH7yIEs2jwi9b1V/nAr7vHO sGWAKBWtbgwEwnwg/GpznefIkLN7SZhbRkFTiHVhXzqIebY1Iq2UmHts/Njd2oB9eAgv fRaid6bdgdyuo6bBwgqRPWwHrRCO7yCt8ovVJ0yUNJlmFap1oQTZLjO1uvDurEcL1K5b vav7r8hFzU3HjuVbUHmIjV/fI16CWvfIOzGeIRqSVft3FM/cBj/1bhL7tsocjIxayJAx xELQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=YZ7g80E1; 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 b23-20020a170902d89700b00176c9015627si2498730plz.94.2022.11.30.15.40.01; Wed, 30 Nov 2022 15:40:11 -0800 (PST) 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; dkim=fail header.i=@weissschuh.net header.s=mail header.b=YZ7g80E1; 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 S230092AbiK3XaK (ORCPT + 84 others); Wed, 30 Nov 2022 18:30:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbiK3X3m (ORCPT ); Wed, 30 Nov 2022 18:29:42 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6C82BD5; Wed, 30 Nov 2022 15:20:05 -0800 (PST) Date: Wed, 30 Nov 2022 15:50:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1669850360; bh=AOooFKU7NIxLs7yLATARLHPgA86wAoxNAcbcgPZM9II=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YZ7g80E1uS2FjZUXZepWD0GWT2LswMhWGPDrY6iItcUht2OhtmIjdSMLA3N8pxqVI Jp2ozhHPa4vOeklRuAX4zU13ndJldrhTeeCQg0vls8qIhNC4W5X8/y94LXJNZcBS/U vnO0viZBlBj8/Td4MeF4UtHKFBIWWcIWK6Zik19g= From: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= To: Petr Mladek Cc: Joe Perches , "Rafael J. Wysocki" , Pavel Machek , Len Brown , linux-pm@vger.kernel.org, Sergey Senozhatsky , Andy Whitcroft , linux-kernel@vger.kernel.org, Steven Rostedt , Dwaipayan Ray , Lukas Bulwahn Subject: Re: [PATCH v2 1/3] printk: introduce new macros pr__cont() Message-ID: <42950773-aac6-4ec6-8cbe-543489afe316@t-8ch.de> References: <20221125190948.2062-1-linux@weissschuh.net> <20221125190948.2062-2-linux@weissschuh.net> <1fb146231e1810b4c9923f384afa166e07e7f253.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Jabber-ID: thomas@t-8ch.de X-Accept: text/plain, text/html;q=0.2, text/*;q=0.1 X-Accept-Language: en-us, en;q=0.8, de-de;q=0.7, de;q=0.6 X-Spam-Status: No, score=-0.6 required=5.0 tests=BAYES_00,DATE_IN_PAST_06_12, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=no 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 On 2022-11-30 14:59+0100, Petr Mladek wrote: > On Fri 2022-11-25 21:33:40, Thomas Weißschuh wrote: >> On 2022-11-25 12:18-0800, Joe Perches wrote: >>> On Fri, 2022-11-25 at 20:09 +0100, Thomas Weißschuh wrote: >>>> These macros emit continuation messages with explicit levels. >>>> In case the continuation is logged separately from the original message >>>> it will retain its level instead of falling back to KERN_DEFAULT. >>>> >>>> This remedies the issue that logs filtered by level contain stray >>>> continuation messages without context. >>>> >>>> --- a/include/linux/printk.h >>>> +++ b/include/linux/printk.h >>>> @@ -701,6 +703,27 @@ do { \ >>>> no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) >>>> #endif >>>> >>>> +/* >>>> + * Print a continuation message with level. In case the continuation is split >>>> + * from the main message it preserves the level. >>>> + */ >>>> + >>>> +#define pr_emerg_cont(fmt, ...) \ >>>> + printk(KERN_EMERG KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) >>> >>> Aren't this rather backwards? >>> KERN_CONT KERN_ seems to make more sense to me. >> >> If nobody else disagrees I'll do this for v3. > > I slightly prefer the way how it is now. IMHO, it makes it easier > to check the related levels in /sys/kernel/debug/printk/index/vmlinux [*]: > > <6> kernel/power/process.c:227 thaw_kernel_threads "Restarting kernel threads ... " > <6,c> kernel/power/process.c:218 thaw_processes "done.\n" > <6> kernel/power/process.c:197 thaw_processes "Restarting tasks ... " > <6,c> kernel/power/process.c:176 freeze_kernel_threads "\n" > <6,c> kernel/power/process.c:174 freeze_kernel_threads "done." > <6> kernel/power/process.c:169 freeze_kernel_threads "Freezing remaining freezable tasks ... " > <6,c> kernel/power/process.c:140 freeze_processes "\n" > <6,c> kernel/power/process.c:138 freeze_processes "done." > <6> kernel/power/process.c:133 freeze_processes "Freezing user space processes ... " > <6,c> kernel/power/process.c:105 try_to_freeze_tasks "(elapsed %d.%03d seconds) " I did not test it (will do so later) but it seems to me that the code in kernel/printk/index.c should do this correctly in either case. At least it tries to: if (flags & LOG_CONT) { /* * LOGLEVEL_DEFAULT here means "use the same level as the * message we're continuing from", not the default message * loglevel, so don't display it as such. */ if (level == LOGLEVEL_DEFAULT) seq_puts(s, ""); else seq_printf(s, "<%d,c>", level); } else seq_printf(s, "<%d>", level); } } I'll try to validate it. If it doesn't work it may make more sense to fix the index file generation. What do you think > That said, I do not want to fight over it. It is hidden behind the > API. The only really visible place is the printk index. > > [*] The index is available only when CONFIG_PRINTK_INDEX is enabled. > > Best Regards, > Petr Thomas