Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3788644rdg; Wed, 18 Oct 2023 06:16:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHf96HA0gZlN5JaU83TuQyj4asyGSbAR/8tWAiYzxFQZT8JOOnNWcRwlAml12cPj2jDJHI2 X-Received: by 2002:a17:903:280c:b0:1c2:82e:32de with SMTP id kp12-20020a170903280c00b001c2082e32demr4773516plb.0.1697634987004; Wed, 18 Oct 2023 06:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697634986; cv=none; d=google.com; s=arc-20160816; b=J+BgPReJgvqsmUj7moqYXjZFkoS7iVa5Yhkvljq8vODn2s/7NmSimNAAM+k8oKWKhr RjSs9pIAhUzjA1yaI+j67SW43DmLZmES49pkPaEfDIM+OyFWvkwKBwWI8OWT7fCdBQhF Dprn4LJn1jNMZ17dmG+VfSKJNaPPDiO5PlQ2G+2qOg1v2shRTVToXkyDew00R5MIQo3U 8djobTFr3nKeYrMcCrD9eNE+WQjhaoA+hFEIGhpOoeZGCM3o9E5RHwnJP/2fcAvh8jYQ 32PCdY/0WmCwqVccZ/aNclV6iy0832oiyurRx6wS6F1I+RDiQpgKicnYH4vkJzu3N7Ky GW/Q== 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=+53DQuQx9lG2d5q872OL0l7TMGtZ7VLzqqebqsxpMec=; fh=3oUSWWYQ0rMHaNqDlm8j09K7pkfJE062n+5jIRWafQ4=; b=ViTWGVgMyflwLvj3Wy+dc4SL8i8tQORblZdmd8n7SA5zyOazfp9RglM44zmFC5C0+o ZMRUva6YNIsRlNI9/Clnu4/LPSWeihpbdKu3+xJIg6PCeOtQalOJMXZPLMSGpQa5xYaG fVkO2UEWy+cgxSqc1HlZ8E3++XNBP9VgJZl0RqooSR1XKLQlIj9xCZO4aLKtQW2huz9t B/Bv07YP+f/JxZuIFEteqv5vCmeUbKJ/Z+U8lsADyVdrlVYcmGw417WUKtLnVfl30zrk EUvz+XqJF52v3StqQSBJFTYZxyywsBW6lrbVyO9cLwMlKlRRCABOlAAO8jfKun8edE+B Sejg== 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id p3-20020a1709026b8300b001c9b3c3ce7asi3834721plk.300.2023.10.18.06.16.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 06:16:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 904EE8077572; Wed, 18 Oct 2023 06:16:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231467AbjJRNPz (ORCPT + 99 others); Wed, 18 Oct 2023 09:15:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231344AbjJRNPy (ORCPT ); Wed, 18 Oct 2023 09:15:54 -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 6813C114 for ; Wed, 18 Oct 2023 06:15:51 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D48241F37E; Wed, 18 Oct 2023 13:15:49 +0000 (UTC) Received: from suse.cz (pmladek.udp.ovpn2.prg.suse.de [10.100.201.202]) (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 7093E2C1F2; Wed, 18 Oct 2023 13:15:49 +0000 (UTC) Date: Wed, 18 Oct 2023 15:15:48 +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> <877cnk72y9.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <877cnk72y9.fsf@jogness.linutronix.de> X-Spam-Level: Authentication-Results: smtp-out2.suse.de; none X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Score: -4.00 X-Rspamd-Queue-Id: D48241F37E X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 06:16:00 -0700 (PDT) On Wed 2023-10-18 10:30:46, John Ogness wrote: > On 2023-10-17, John Ogness wrote: > >>> - if (!prb_read_valid(prb, seq, &r)) > >>> - return false; > >>> + while (!prb_read_valid(prb, seq, &r)) { > >>> + if (this_cpu_in_panic() && seq < prb_next_seq(prb)) { > >>> + /* > >>> + * The record @seq is not finalized and there may be > > I am wondering if we should put the this_cpu_in_panic() check into > _prb_read_valid() instead. This has the advantage that it could more > intelligently skip non-finalized records and not need to rely on > prb_next_seq(). Also, it would allow any other readers (kmsg_dump) to > skip non-finalized records during panic. Yeah, this look like a better solution. Anyway, we need to try reading the messages behind prb_next_seq() up to the head of the ring buffer. And @head_id is not available outside prb API. > Looking over the code, it would be easy to extend > desc_read_finalized_seq() to return a separate error code for exists but > is non-finalized. This would make it trivial for _prb_read_valid() to > skip over it when this_cpu_in_panic(). Sounds reasonable. Best Regards, Petr