Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3840357rdg; Wed, 18 Oct 2023 07:33:11 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYJ+atMXz9x5AB0uCZ5wD1aADH2IH9ivq7v7HO87odYy1HCmtseSgCnAXblkdmDUNMFv8M X-Received: by 2002:a05:6e02:12cf:b0:352:a1c8:6e99 with SMTP id i15-20020a056e0212cf00b00352a1c86e99mr6797768ilm.6.1697639591076; Wed, 18 Oct 2023 07:33:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697639591; cv=none; d=google.com; s=arc-20160816; b=wEYW1VyFtEPPmNwqgdgvUOyBy5dEmTzUF+cWk3x+q3azvYpT8ChVKG+cp/wt/s3BJD 80B7u0zMX+PHlI0lokju4LFkE6Gqwi9N1fuhSbhU824VkDFFByw6LQ3ZH+8ZIL6KydDp 0rf23TUAv5Yzh4rQSLYGU7kRA+ZEAom4FkxchEYBxduPfHg6SXog3dN18V2gK00+vhNY IA3+hqJ7k18iYy63rLXsAxm79qOfhcrnKXZjObZ8KcrmY7IefEtLIq0kpT1UUUkA8/jR TaOzHfw3SL8jcwu7uJ7AoVfBs226BkrVEIvxtWnjKq1Qr4asOEoGU0uaW6FB6l3orXMP bXpw== 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; bh=QHlpaPxOQINxlu9n7x1srVethBuQu0xUUrfIZsAquuI=; fh=3oUSWWYQ0rMHaNqDlm8j09K7pkfJE062n+5jIRWafQ4=; b=tiPW1FqTkgSkYuKZTNf+Vap4E8ObtErD3LMMPXGuRuel2V8gVLatOJpZhdPflH26wC pJ7TP54KYyWlUsL/aBmGyDlSQCi6L2ZCYZ+asYnQqY9HmGDjXT/Nm0Z/lbcYSc3tzspv GjA5j6A9Gp10fiOL2Q7U5U4ga0vxnkqJHsczZmZw0FQeRQR96T8Nmep2tsghXkxK8JKT M2hAe8zU5ghU8eYur210hTZaf6vR/b7Gq5FqEQ6l8HcDLi3i7rQkqhli66fRjpSpqGSP iYXGWr3Fe1gXAL0ODiQyUvE1VblzXCLSyw39C9HnHH1DHXOsaNZDEvuMfGGkhMwMpsNL 75Fw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q13-20020a056a00150d00b00690f22edc20si3211727pfu.333.2023.10.18.07.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:33:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id A3C6A806926F; Wed, 18 Oct 2023 07:33:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345739AbjJROc6 (ORCPT + 99 others); Wed, 18 Oct 2023 10:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235306AbjJROcq (ORCPT ); Wed, 18 Oct 2023 10:32:46 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBEB79ED3 for ; Wed, 18 Oct 2023 07:20:42 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 12636219FC; Wed, 18 Oct 2023 14:20:41 +0000 (UTC) Received: from suse.cz (pmladek.tcp.ovpn2.prg.suse.de [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 A6C742C21E; Wed, 18 Oct 2023 14:20:40 +0000 (UTC) Date: Wed, 18 Oct 2023 16:20:40 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v2 3/4] printk: Skip unfinalized records in panic Message-ID: References: <20231013204340.1112036-1-john.ogness@linutronix.de> <20231013204340.1112036-4-john.ogness@linutronix.de> <87mswh6iwq.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spamd-Bar: +++++++++++++++ Authentication-Results: smtp-out1.suse.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=suse.com (policy=quarantine); spf=fail (smtp-out1.suse.de: domain of pmladek@suse.com does not designate 149.44.160.134 as permitted sender) smtp.mailfrom=pmladek@suse.com X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [15.00 / 50.00]; ARC_NA(0.00)[]; R_SPF_FAIL(1.00)[-all]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RWL_MAILSPIKE_GOOD(0.00)[149.44.160.134:from]; RCPT_COUNT_FIVE(0.00)[5]; DMARC_POLICY_QUARANTINE(1.50)[suse.com : No valid SPF, No valid DKIM,quarantine]; VIOLATED_DIRECT_SPF(3.50)[]; MX_GOOD(-0.01)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.20)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; MID_RHS_NOT_FQDN(0.50)[]; BAYES_HAM(-0.00)[26.37%] X-Spam-Score: 15.00 X-Rspamd-Queue-Id: 12636219FC X-Spam: Yes X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 18 Oct 2023 07:33:07 -0700 (PDT) On Wed 2023-10-18 14:54:29, Petr Mladek wrote: > On Tue 2023-10-17 23:31:25, John Ogness wrote: > > On 2023-10-17, Petr Mladek wrote: > > > BTW: The support for data-less records were added by the commit > > > ("printk: ringbuffer: support dataless records"). It was > > > needed to handle empty lines: printk("\n"). It is strange > > > that we skip them instead of printing the empty line. > > > > We do not skip them. That was the whole point of adding support for > > data-less records. ;-) > > > > get_data() returns "" and @data_size=0 Ah, I see it now. The code really handles printk("\n") correctly. There are two types of dataless records: + #define NO_LPOS 0x3. It is used for storing zero size data. + #define FAILED_LPOS 0x1. It is used when the code failed to allocate enough space on the ring buffer or when they were overwritten. BLK_DATALESS() returns true for both of them. Sigh, we should really distinguish in the comments when functions handle the two situations different way. Especially we should not use the ambiguous "dataless record" word. I think about "empty line record" and "records with missing data". And I would rename NO_LPOS to EMPTY_LINE_LPOS to make the meaning more obvious. Also it would make sense to use 0x2 for EMPTY_LINE_LPOS and #define FAILED_LPOS 0x1 #define EMPTY_LINE_LPOS 0x2 #define DATALESS_LPOS_MASK (FAILED_LPOS | EMPTY_LINE_LPOS) #define LPOS_DATALESS(lpos) ((lpos) & DATALESS_LPOS_MASK) > > copy_data() returns true (but does not copy any data) > > > > prb_read() returns true (we are assuming it is finalized) > > > > _prb_read_valid() returns true > > This is not true if I read the code correctly. > > > prb_read_valid() return true > > > > record_print_text() creates a string with prefix and adds "\n" > > > > printk_get_next_message() returns something to print If we used the right terms in the comments then they might stay short and still be clear. Best Regards, Petr