Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3644743rdg; Wed, 18 Oct 2023 01:25:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFqqQQ31Rpy8iEsAt8bfjHaBuLfA/i79EErsZvQwlipL/jl0h5tXPXHbz9J70qfVtUf6xfS X-Received: by 2002:a05:6359:2f87:b0:166:a6e3:d84e with SMTP id rs7-20020a0563592f8700b00166a6e3d84emr4157084rwb.6.1697617513920; Wed, 18 Oct 2023 01:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697617513; cv=none; d=google.com; s=arc-20160816; b=AuzUNa1OOjQ21KyZZZo5BXw49ny0jOliB+7Y5XadI+2xGvsarL2Ul7xS8b93JRe7Ek dfR424l05sl1ha7M3/l4M1c+X2/34F4wThq0EErJ0MXqBwrGLSvTuKhAk829Z+n77REU TvShFKs4e0yEX1LruNQvzUzvey9OKk3TawOHNhi0q2iyQkF+4EWdQbhuJZVi4yNLdm1o N2uWAr7dgL+iESIMCZ+dl+hXHf5/A1lG12DOe8OWOUhETcUkI5Szr/pznfmydUPVl8jk aTdVdxiz+mgCVUaL0pPyfPLzKBhymc4sopgKmbEqJSNziisaWbAx8Ja/djPhutSdCOOg M/tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=x0NqHzJi+SiI0xRnDWL93ULd5WSNeqBxu/jo5Msruzc=; fh=pKnPKUsir0uEGSsor+4Zc2vgbu+g+ayvUgsdzkuXaoA=; b=qgC6aXfxysW036iO2UCWEVveEVBgGRzjbRD2dgxFDJpcD6ReTW+RsXLc/JGry5Zbu8 xkE13htK8QOk8NMpVKsuvVZC8gCyYMOF0gIMBaLB2H6/+tiOe5D1zqZblHXDSuBac62x 3mPwhCCVeAfZTbIrsbRXgTQZ+zGeKWlXvRGnZL/k0GLnQ74abgrKtXVfHDsfTeP+JtUf 4nDlUi/oLB+1c1oDJ8TcEGO8aeplI4cHiYzmLKFap9Do3Z4XRnxDg4IjC5ePikIGSNrc tEWa7mtvlw/h0GqYRo/wkvRs8zzi7H8ta3qfmhCwsdhh2HqFpN16KepA0MvldJT8CMoS FXPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iU5QYS4I; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id fa13-20020a056a002d0d00b00690bd178205si3033702pfb.215.2023.10.18.01.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 01:25:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=iU5QYS4I; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 7318180239E4; Wed, 18 Oct 2023 01:25:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235073AbjJRIZB (ORCPT + 99 others); Wed, 18 Oct 2023 04:25:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235147AbjJRIY7 (ORCPT ); Wed, 18 Oct 2023 04:24:59 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 439D8FA for ; Wed, 18 Oct 2023 01:24:58 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697617496; h=from:from:reply-to:subject:subject: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=x0NqHzJi+SiI0xRnDWL93ULd5WSNeqBxu/jo5Msruzc=; b=iU5QYS4IVeJJbzZ2OFY5EBI+0ss/BOFk6oFBVN4br+Bbwo7VEBEJWwAIpIx+ohsQ8jUkGN GTGwrpV/WAki2SUhg6ad+EgLkemBF5qxoqIrAFhzkBkhGZbSS5JnBRb98AgMDDGOvMcEcP TV6gUFn0Hq6BHiY+gO434qPeSaI7aeVex0ChrcqSRysaAQ+hM9Rw6DtmSqr0IArprjPd4d WVeK+t10CPNMG0ms42qEQ4Fh5fTxE6+oSMNjSgWiRfRgmUN8jlqsgdXLeh1B/bq/aLkVys kmwM0WsATffq0WfrtBpeLTvJcR3I8lwN5jElszmVeMnpGFG3SlVK9v32ZiCq4Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697617496; h=from:from:reply-to:subject:subject: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=x0NqHzJi+SiI0xRnDWL93ULd5WSNeqBxu/jo5Msruzc=; b=3imP60sn+X6jYtEZRmSm4S6Ve/xT3a4JDvtXvpw9JgyQ9ns2m6uVvawSkFYjqKpkwh2a+1 Dofz4feUhFTRe0BQ== To: Petr Mladek 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 In-Reply-To: <87mswh6iwq.fsf@jogness.linutronix.de> References: <20231013204340.1112036-1-john.ogness@linutronix.de> <20231013204340.1112036-4-john.ogness@linutronix.de> <87mswh6iwq.fsf@jogness.linutronix.de> Date: Wed, 18 Oct 2023 10:30:46 +0206 Message-ID: <877cnk72y9.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INVALID_DATE_TZ_ABSURD, 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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 01:25:11 -0700 (PDT) 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. 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(). John