Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2077672rwb; Fri, 2 Dec 2022 05:18:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tjTc7jLy/q7iX0GvLODkx4fQo3/iospIQkGrsmO8GAWpvyMVnZklhfx2LsWNy3s/Z3HSl X-Received: by 2002:a05:6a00:408b:b0:56b:ca57:ba8c with SMTP id bw11-20020a056a00408b00b0056bca57ba8cmr52831751pfb.43.1669987124877; Fri, 02 Dec 2022 05:18:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669987124; cv=none; d=google.com; s=arc-20160816; b=GPPzoJbI6iqcge++1KQGExJa7Z2CbJBM1AUg1LD+Wrt5H0HJLHgNSRFGnuY/yBUmvg M3N3uHAD8QNiWN9M7cN5x4nK7T+VhH8hlqsG+LUr9IL5ddCqFbLO+K5K357V1t6wSiUk EL6ndsdpZwO+n4vAWWmi3x7Nsc4t6obSJxmmXV4DYEOr3kt871Szpg+nfdAPIiyy0bDT UhENv1O5fiBiv4Kglr+SeNPrEzPVNoahEEC/6HBbJD5wLoS8/blmo9E7FNhjuZX5Tvg1 JczKmcBOH5sGpw/pkkrYQWqqlyvz1kUOxhXLlMAtin46hofZgWdf/jIb4zKqH/Zr8Zz5 maJQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=d49Oc3S+6muyb1GOiqMcaSOmUuf1KCcSk2Xm3eq+yyg=; b=fGVE2vACoqwlbAW/S0mGDol8eJZGIURZioD3DD4yqD8lg04eXkpOcJQ0qqMTVPFSrH 4kN9Tv5NAsxRvRQxPnXZpKGSdKcE9dQXCYkwIdyIzzbo6fPxq1pyjcRTAILlzV8b+lOF 0ggLWAo0NCTUubMf8GEkMjoSFYDGAFGEh0tWZTZX5VAqG+rk17uWaD7C4wN+pe5FccNJ LQhWgfD8k9gXqBzBW/FkKWB19IuD09i7IdNY3iP6ZAPlvbRA+vRq1C38hpaBSSkzzaY6 DrkC+0St0sv3Nz6qieXqQn1AJgmnnA4VARPJnN3deJsBl1W9f7gt1Q+pAJjfNYZgF3C4 gZSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="XnuckT+/"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020a656646000000b004780ea3db18si7373717pgv.133.2022.12.02.05.18.33; Fri, 02 Dec 2022 05:18:44 -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=pass header.i=@suse.com header.s=susede1 header.b="XnuckT+/"; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233353AbiLBMVj (ORCPT + 84 others); Fri, 2 Dec 2022 07:21:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233206AbiLBMVh (ORCPT ); Fri, 2 Dec 2022 07:21:37 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3973865A5; Fri, 2 Dec 2022 04:21:36 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 86B2421C56; Fri, 2 Dec 2022 12:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1669983695; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d49Oc3S+6muyb1GOiqMcaSOmUuf1KCcSk2Xm3eq+yyg=; b=XnuckT+/lzXYI4qDySsV8Hxn7menm+zUi52vv7O/r7vdGLdiqdO47blqVwleNUjU/cEfgB Bwq3VsB7Uc7SrPfdrrEwqeA6gvttsjhdLQir6Jap3oEnhALiTLCvSr2aNGZXQHcyhCPqL8 omMnUHann3fVoS+UBEqAWLzB8gQkLvU= Received: from suse.cz (unknown [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 0CEEF2C142; Fri, 2 Dec 2022 12:21:35 +0000 (UTC) Date: Fri, 2 Dec 2022 13:21:34 +0100 From: Petr Mladek To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= 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: References: <20221125190948.2062-1-linux@weissschuh.net> <20221125190948.2062-2-linux@weissschuh.net> <1fb146231e1810b4c9923f384afa166e07e7f253.camel@perches.com> <42950773-aac6-4ec6-8cbe-543489afe316@t-8ch.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <42950773-aac6-4ec6-8cbe-543489afe316@t-8ch.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 On Wed 2022-11-30 15:50:55, Thomas Wei?schuh wrote: > 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); > } Great. It makes the index consistent. I should have checked the code ;-) I do not mind then about the ordering in the macro definitions. It really seems to be only an implementation detail. Best Regards, Petr