Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2500552rwb; Wed, 30 Nov 2022 07:22:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf56RMurQyYDlboQqd7qwrVCJFWrCJqZqHHXD9m7jh38MV647L97+4tYj5qsYU8SZpI71lKX X-Received: by 2002:a05:6402:e04:b0:469:e6ef:9164 with SMTP id h4-20020a0564020e0400b00469e6ef9164mr7912546edh.185.1669821749152; Wed, 30 Nov 2022 07:22:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669821749; cv=none; d=google.com; s=arc-20160816; b=inH/ZdmFKeRcINwmwrKqShNcDzeW6by6Qfa212M5euBDczYktRljzrZhIg5RMet+kO vMGH3h45/rZk4qhGhD2gFQKCVYwM2+3WquhI7IUKyNWxXkRnJD8mDB6eUMUCNFHbi48k K5i4ttTXjXtnFepx3yj+jPpPpjSnydy51s1lJWfxxNSsFE0sVkEnHC8PmIGh6mpE95qq LB5Guljnty9wbM9PunGpYzlkeY/sGHcEPKlP+0mLavuzkozyUt9/SmhmLhzM8tOGaMXX 1usfHIp7K9BzPNLlh26M1GCH75ek7QMC1s3MT43Ktpb+j6gNGrMFMiB5f7T9hIBxE2z5 cmHQ== 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=rX/Pr9wWFFNUCxE3ZZA40hfNPZyjpFt1Jbcp+gMMlm8=; b=Vv7Px6h6+dl1dUQoWNWDa3AsnnLU113XvpTAPTIKYqf0Hi7bsLW4OMluJfAVX/bmAB poUZQU6medL4Hj/JqHYxx7iyFQeLrcwzWLfgzjnBVb3U4HJlGzhOHxJaHwS7UUvcue2U htoTbIkNgnIf/Suhh6JZnrWE/2a5Wc81UO4TiAccL1hR/CLt1dRi5tNZZsmTO+s2TBTx Gaidtp8qajSGFqYJ2KkVYOW6S0UqxgduE04Z9WtRXzkqCokC9AlPECrVzAFvF3MiLxP3 VKEI1UEySaKBUM2t66doMYmkLw19RGg2qKd34wT7Kbice9GN/1F7g1anFlQSeZLWLrDW 2zdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=uJRbZ6Zl; 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 gb29-20020a170907961d00b0078db5170767si1720967ejc.18.2022.11.30.07.22.07; Wed, 30 Nov 2022 07:22:29 -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=uJRbZ6Zl; 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 S229668AbiK3OvQ (ORCPT + 83 others); Wed, 30 Nov 2022 09:51:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbiK3OvO (ORCPT ); Wed, 30 Nov 2022 09:51:14 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DDC15F847; Wed, 30 Nov 2022 06:51:10 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 2A46F21AFE; Wed, 30 Nov 2022 14:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1669819869; 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=rX/Pr9wWFFNUCxE3ZZA40hfNPZyjpFt1Jbcp+gMMlm8=; b=uJRbZ6ZlLTmMdVQmyMP/qwCjhxRHygVMkVs3U6/zHA4hx11XeXPM+L5JCEnHP8hDifMV0N 4H66co2gtWBny+sC1FgFYR70zz+9g0dlMHpbWevNEd6uJ1W62uOsVwAO+4uRoH+qxOw4py +VG18LWnaJIuL4euieB/wVuMgeelLvM= 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 B1DFC2C14F; Wed, 30 Nov 2022 14:51:08 +0000 (UTC) Date: Wed, 30 Nov 2022 15:51:08 +0100 From: Petr Mladek To: Joe Perches Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , "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 2/3] checkpatch: handle new pr__cont macros Message-ID: References: <20221125190948.2062-1-linux@weissschuh.net> <20221125190948.2062-3-linux@weissschuh.net> <39f687f7c71b162eb8caefbec939fa2ad74fcdfc.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <39f687f7c71b162eb8caefbec939fa2ad74fcdfc.camel@perches.com> 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 Fri 2022-11-25 12:17:05, Joe Perches wrote: > On Fri, 2022-11-25 at 20:09 +0100, Thomas Wei?schuh wrote: > > These new macros from include/linux/printk.h replace the usage of plain > > pr_cont(). > [] > > --- a/scripts/checkpatch.pl > > +++ b/scripts/checkpatch.pl > > @@ -590,7 +590,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; > > +# check for logging continuations without explicit level > > + if ($line =~ /\bpr_cont\s*\(/) { > > + WARN("LOGGING_CONTINUATION_WITHOUT_LEVEL", > > + "Avoid logging continuation without level\n" . $herecurr); > > + } > > + > > Not so sure about this one. > > I think relatively few situations are going to require interleaving avoidance. Well, the problem is generic and any pr_cont() is affected except for NMI context on single CPU system. I though about a generic solution. We could store the last used printk log level per-process and per-CPU context. But it does not solve the situation when an unrelated printk() is printed by a nested function. It is exactly the case with try_to_freeze_tasks() in the 3rd patch. Simplified code: int freeze_processes(void) { pr_info("Freezing user space processes ... "); try_to_freeze_tasks(true); pr_info_cont("done."); } , where static int try_to_freeze_tasks(bool user_only) { [...] if (todo) { pr_err("Freezing of tasks %s after %d.%03d seconds " [...] } I would personally add this check into checkpatch.pl. It might help to make people aware about that pr_cont() is just the best effort. Best Regards, Petr