Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1383533rwb; Fri, 28 Jul 2023 08:39:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlHLKlIBByohSFzhD5kDUP6fdBejhIRyTolJ1i2J8M62XbJ8e0lL6br7w33QPCJEn1viGCxq X-Received: by 2002:a05:6a20:187:b0:137:db14:e88b with SMTP id 7-20020a056a20018700b00137db14e88bmr1948574pzy.29.1690558757298; Fri, 28 Jul 2023 08:39:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690558757; cv=none; d=google.com; s=arc-20160816; b=NgsD6hT5io5pQHGYGWifROc6M6wyV6Uea+CUi+zAC4dqv76v0c5BEabQOTR6PywpEI WGhmXSRxSS/Mgsm25cvQLwrB6t68yzK/6a00FnqWJQzKXz5ZMfT14PUuabQKcazsxp8i QXbdmwVHKi07hEysPQ/KuAnhhAvZ9pKOwsPPdXJGaksjUD0ypFRIO+4QLYHza4/u09ii LR9GlZKoIc6pl6Yl7HVidBDOQ+x0Syw8VcY9rxc/u0m5kIVtrsnvl13aS18tnbj46cKX en/VK6ABir5txiszhKgjHuoBeU/MXgi6TX70HuvI5GmPTfT7fssfYKbkgo6eTa1SJGR9 qsgw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JYmKEmnRiA+21fjw/1miLoZlyC9GhZvBc8hEfEmyKVM=; fh=oPFVAToQkY6bsl1Vt24pO33VB3QR8tT4rK/qyEfOsuk=; b=ha/eBhUDyIqaop2ZMjBDQVQi1lPdIHTI/pwqY+ZJbrSvvMvxVgEkR6YQBym5ugUUes bRY42mUjq5I8mF2mrUgusR4TKtUjydmC7KTBVvZSxj+Ian3L4ZOlPr5Psmh/6lvtTtlm +CKmdlgrE7BhLGKHePnH+H8N/+lcf/OZ0cg1xPiYAFRs+0NWhclPFJhaFaLnZi5/VtYQ 9NeeHPAXz13LxLEzi+ePRapkO3rbc+rXmLbM9kJl9aZtY6Mclvtfqbl3DFdi7Rmuz+aI 2/5WGgL+gWAxfZXPrBk5sht7kyfzwAh2HYBCnh3s8dlqBbEcM0+MlbZwBtogos7S7y6f Pd0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=n8nkWuIb; 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 g67-20020a636b46000000b0055339507f67si3044526pgc.836.2023.07.28.08.39.04; Fri, 28 Jul 2023 08:39:17 -0700 (PDT) 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=n8nkWuIb; 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 S237335AbjG1PWz (ORCPT + 99 others); Fri, 28 Jul 2023 11:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237037AbjG1PWv (ORCPT ); Fri, 28 Jul 2023 11:22:51 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7DE63582 for ; Fri, 28 Jul 2023 08:22:48 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id B7DB31F8A3; Fri, 28 Jul 2023 15:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1690557766; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JYmKEmnRiA+21fjw/1miLoZlyC9GhZvBc8hEfEmyKVM=; b=n8nkWuIb2SEdTWheL0JxXrhzlI+rZ88BsVdsp7wa5KjMp6FnqhFfx0NgOuQQ5PP6Y2bOyv BRT6VSSkQmAhLJ6mGN5j34Zz3wDIurVsX6S6zIO+VUfkBU1CEpGIM6GtYW4mC4k36qBykg QEQhbujGwazqsrLrZiXlceRkvciR1Dg= 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 59F902C142; Fri, 28 Jul 2023 15:22:46 +0000 (UTC) Date: Fri, 28 Jul 2023 17:22:45 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v2 2/8] printk: Provide debug_store() for nbcon debugging Message-ID: References: <20230728000233.50887-1-john.ogness@linutronix.de> <20230728000233.50887-3-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230728000233.50887-3-john.ogness@linutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 2023-07-28 02:08:27, John Ogness wrote: > To debug and validate nbcon ownership transitions, provide a new > macro debug_store() (enabled with DEBUG_NBCON) to log transition > information to the ringbuffer. If enabled, this macro only logs > to the ringbuffer and does not trigger any printing. This is to > avoid triggering recursive printing in the nbcon consoles. > > --- a/kernel/printk/printk_nbcon.c > +++ b/kernel/printk/printk_nbcon.c > @@ -10,6 +10,35 @@ > * the legacy style console_lock mechanism. > */ > > +/* > + * Define DEBUG_NBCON to allow for nbcon ownership transitions to be logged > + * to the ringbuffer. The debug_store() macro only logs to the lockless > + * ringbuffer and does not trigger any printing. > + */ > +#undef DEBUG_NBCON > + > +#ifdef DEBUG_NBCON > +/* Only write to ringbuffer. */ > +int __debug_store(const char *fmt, ...) > +{ > + va_list args; > + int r; > + > + va_start(args, fmt); > + r = vprintk_store(2, 7, NULL, fmt, args); I have never used the facility number before. It seems that they are defined in /usr/include/sys/syslog.h, for example, see https://sites.uclouvain.be/SystInfo/usr/include/sys/syslog.h.html They are even somehow documented in "man 3 syslog", for example, see https://linux.die.net/man/3/syslog We should probably use one of the LOG_LOCALX numbers, e.g. #define LOG_LOCAL0 (16<<3) Also, please use LOGLEVEL_DEBUG instead of the hard coded "7". > + va_end(args); > + > + return r; > +} > +#define debug_store(cond, fmt, ...) \ > + do { \ > + if (cond) \ > + __debug_store(pr_fmt("DEBUG: " fmt), ##__VA_ARGS__) \ > + } while (0) > +#else > +#define debug_store(cond, fmt, ...) > +#endif > + > /** > * nbcon_state_set - Helper function to set the console state > * @con: Console to update Best Regards, Petr