Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1292592rdh; Mon, 25 Sep 2023 08:28:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5IskbvzD5CgXbnBt6k5xrmmP1r7Jb0jW92dySKPOPbYejgJ/Sfl27cAqBaVKBpR8rfhOA X-Received: by 2002:a17:90b:1a8e:b0:262:fc8a:ed1 with SMTP id ng14-20020a17090b1a8e00b00262fc8a0ed1mr6744158pjb.44.1695655704568; Mon, 25 Sep 2023 08:28:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695655704; cv=none; d=google.com; s=arc-20160816; b=OwlHUaPV805QxE5ygFsSSl/TfaAoKtIq7P8LnExdu8COUmr78My88huyeR13c2M4ij a3Xocrst9FzYDHoWWEAeBN9R7L+T/JQC5amL86cFBml1yeTUdVh7fx/Zo3ImgBxfJ2f5 m2NV3/er+x6VZZ7fQ6wDbs6pET3VIeFl9y8e7RTuCqFxZ3ueAUPm3cmkRBXN34DecFdT HwuR2QJALlDMrfqsTKggXjz0V90bslk2viP+2fkMaeNU1GTfhBbreXMKmvzpfVLVJ+2j 4JmqB2CBn6a81d3TRJPK6OUS77+w14/8gNY1AYD8qY+g1H+gL5ZmmltO3dg63M1mblJy EvpQ== 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=KeiJaR4eV+6b3ML+MxpCvtISIuheT6OifK4x46p6gbM=; fh=/NZX815RJy/ecOe1WbZ023sSZUJKZnpaeIZwQG5Ym7U=; b=cIEfTmP3qyww4M5ZtjfommfChLT4P4+5GXG3EJBYml21sy9hs0S39VAvfsXhCO2g11 KPEYRr/a0Ex5UU8AceeKZBffCGMy9FhLqIPpw0DgZ+pH30IWCHguszwA3WvN3TKNE+eM mV5h3QTepM85xPiuLlneL+1jX1kHWQio2Fpb+/vQwoOTdIViyv0dOWzHCs27hMeIrlL4 7HPwhokVAaa4MRPMWMU9roWpiodz5Qw2micAax3b8J/NhKCNZMzfddycnVBSMnR3Vew2 4pTneK36xHowXEV1GOvOWQyHC0R4KUoOkV20dKnUBi1ia7rvpwcfLrNYJbSmO682WvbE YYSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MOsn10GU; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 nu17-20020a17090b1b1100b0026b6a7d9e43si601575pjb.14.2023.09.25.08.28.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 08:28:24 -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=MOsn10GU; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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 D82868061353; Mon, 25 Sep 2023 02:26:12 -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 S230061AbjIYJ0H (ORCPT + 99 others); Mon, 25 Sep 2023 05:26:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233202AbjIYJ0F (ORCPT ); Mon, 25 Sep 2023 05:26:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B4A3AB for ; Mon, 25 Sep 2023 02:25:56 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1695633954; 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=KeiJaR4eV+6b3ML+MxpCvtISIuheT6OifK4x46p6gbM=; b=MOsn10GUw9NZ+HzcXU1f0XlDrg9QOwh9bxe94rYb6gn0cPFbNRwvXz8/eGhgf7B6EWlJ0d 5eVWio1dQKFzSm9Ye+yC0IlFoxZFvZMlS3LOe4QtB/5I5rTuFhuj2Cb5qZODumCmpOmFuG PL1D1aGw6IbR65EBnVXwKAGPTuCMqjZ+AqUGyKkvENQXRl9gFzCyFqAEWWj447vJKenrVd HQ96mbDtXFzb64mbi0+5nhHWjEG37Ai8xCAwNSzvNaOfwzaJAK6eNn9NGpUuNSmp/I1Bxl ppmeAGqHWW4y9bOMBzxgG14SQ+aVUjF8Y1s/j/mw9UTbs2+KeSEvNJdXclYWGA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1695633954; 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=KeiJaR4eV+6b3ML+MxpCvtISIuheT6OifK4x46p6gbM=; b=zRs/CIrwsjh8IpXgiAmEszCdlUMUM70fbi8t+COJQQs71q+QvCX+K+0l1nPRQMMhSDVBDJ qw94gzWdo9gqOiAw== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH printk v2 04/11] printk: nbcon: Provide functions to mark atomic write sections In-Reply-To: References: <20230919230856.661435-1-john.ogness@linutronix.de> <20230919230856.661435-5-john.ogness@linutronix.de> Date: Mon, 25 Sep 2023 11:31:54 +0206 Message-ID: <87il7ybo4d.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]); Mon, 25 Sep 2023 02:26:13 -0700 (PDT) On 2023-09-22, Petr Mladek wrote: >> Note that when a CPU is in a priority elevated state, flushing >> only occurs when dropping back to a lower priority. This allows >> the full set of printk records (WARN/OOPS/PANIC output) to be >> stored in the ringbuffer before beginning to flush the backlog. > > The above paragraph is a bit confusing. The code added by this patch > does not do any flushing. You are right. I should put this patch after patch 5 "printk: nbcon: Provide function for atomic flushing" to simplify the introduction. > I guess that this last paragraph is supposed to explain why the > "nesting" array is needed. No, it is explaining how this feature works in general. The term "priority elevated state" means the CPU is in an atomic write section. The "nesting" array is needed in order to support a feature that is not explained in the commit message: If nested OOPS/WARN/PANIC occur, only the outermost OOPS/WARN/PANIC will do the flushing. I will add this information to the commit message. >> +static __ref struct nbcon_cpu_state *nbcon_get_cpu_state(void) >> +{ >> + if (!printk_percpu_data_ready()) >> + return &early_nbcon_pcpu_state; > > it might worth a comment. Something like: > > /* > * The value of __printk_percpu_data_ready is modified in normal > * context. As a result it could never change inside a nbcon > * atomic context. > */ > if (!printk_percpu_data_ready()) > return &early_nbcon_pcpu_state; OK. >> +void nbcon_atomic_exit(enum nbcon_prio prio, enum nbcon_prio prev_prio) >> +{ >> + struct nbcon_cpu_state *cpu_state; >> + >> + cpu_state = nbcon_get_cpu_state(); > > I would add a consistency check: > > WARN_ON_ONCE(cpu_state->nesting[cpu_state->prio] <= 0) OK. John