Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2353851rwl; Thu, 13 Apr 2023 05:31:08 -0700 (PDT) X-Google-Smtp-Source: AKy350a/q2XSB1aVrohf+YRHHwfi6unc7kkrxYe9nZK9K+1XeWF2humqrV9rAHw8X7VaElOhu5+5 X-Received: by 2002:a17:906:4917:b0:930:e495:b1cb with SMTP id b23-20020a170906491700b00930e495b1cbmr2423225ejq.75.1681389068649; Thu, 13 Apr 2023 05:31:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681389068; cv=none; d=google.com; s=arc-20160816; b=GdiP+/72dxfewC3fDJjHG0rDz9zBi0QTohkkAtlD9NuGaDBasF01NnJvHcgGz8WSfp qsNdmv+XflTEB/ZSbmBujEecd1lPLYJ9c4Y91K6wFELlZKF9RIiQu/iR9htMlUW1JX6z dDrkQmepHOEnaA+YmDIOn8BAImyuL/ecLZVTqu6AxQGgUfZVpVIVe4kD4HEMzv0JLRTk f6DJz9+vCKs6XtgMARvrFPeSAmn3J8RI/PDndfBlPCH92EZH23+pANuvAyj4iUwDHUtp IIRckU8K2qsoANMYRtDVxFRVVexii1tDbXO7UvtpF8VfR4skU2SyfUnmCwP6oh+XPOsX plRw== 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=lqZVUfwmcACp3NfAD201FJPzDAQF/Baeqyz1OVnVtH0=; b=LvFKpjwPnV85nD1YoOjmcHi9AREFSWqf3PNbc5lZ8eTTRCuH1BAJGCHEoEBCf9KxWo BpFOxUyv37fK4dOSPlvBEwNiX4K8kVadf26rPkG6D5F1meu+/K87xFxs8596SV61apQv G3mAU6BuSz4t4ogCByeYr68Ih8aYafawviDsbwd62PbtvpkdPXbV4B+81JaVShtNBzWE P+seiZcv5+iKqjwABKI0gCG896Q+2ZpR8akMvRxQ7CRNr6NXHB2KESVUmiCTYHgZGEcs LSVa6qCDauC94Ym3nhibcGQtQytKe9CWWJLpFsse4tHl+KY+hTsYZuxjSLKDehOQdzfc P1+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=Dj71QoEU; 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 kb5-20020a1709070f8500b0094a612ce1d3si1872497ejc.701.2023.04.13.05.30.42; Thu, 13 Apr 2023 05:31:08 -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=Dj71QoEU; 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 S229920AbjDMMUx (ORCPT + 99 others); Thu, 13 Apr 2023 08:20:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjDMMUu (ORCPT ); Thu, 13 Apr 2023 08:20:50 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E821459ED for ; Thu, 13 Apr 2023 05:20:48 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id A07ED21862; Thu, 13 Apr 2023 12:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1681388447; 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=lqZVUfwmcACp3NfAD201FJPzDAQF/Baeqyz1OVnVtH0=; b=Dj71QoEUtL2c2eOlBVa3ZzJdbcN48SegwJNv7nY3KXrJ9dlJjmFJJmtRqO/EIu8c/fjHfF SEmdiFhS/Jh2WMA840KHjYnjDlRiIzd2ECPqa/Ri2HtJNEXjJwcb67hTmoIDYr1SXdNw6+ 0+WofV/Xf3m2kZIYKXiBcM7copRgKcQ= Received: from suse.cz (unknown [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 733992C143; Thu, 13 Apr 2023 12:20:47 +0000 (UTC) Date: Thu, 13 Apr 2023 14:20:47 +0200 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org Subject: Re: [PATCH printk v1 18/18] printk: Perform atomic flush in console_flush_on_panic() Message-ID: References: <20230302195618.156940-1-john.ogness@linutronix.de> <20230302195618.156940-19-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230302195618.156940-19-john.ogness@linutronix.de> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,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 Thu 2023-03-02 21:02:18, John Ogness wrote: > Typically the panic() function will take care of atomic flushing the > non-BKL consoles on panic. However, there are several users of > console_flush_on_panic() outside of panic(). > > Also perform atomic flushing in console_flush_on_panic(). A new > function cons_force_seq() is implemented to support the > mode=CONSOLE_REPLAY_ALL feature. > > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -3160,6 +3160,28 @@ void console_unblank(void) > */ > void console_flush_on_panic(enum con_flush_mode mode) > { > + struct console *c; > + short flags; > + int cookie; > + u64 seq; > + > + seq = prb_first_valid_seq(prb); > + > + /* > + * Safely flush the atomic consoles before trying to flush any > + * BKL/legacy consoles. > + */ > + if (mode == CONSOLE_REPLAY_ALL) { > + cookie = console_srcu_read_lock(); > + for_each_console_srcu(c) { > + flags = console_srcu_read_flags(c); > + if (flags & CON_NO_BKL) > + cons_force_seq(c, seq); > + } > + console_srcu_read_unlock(cookie); > + } > + cons_atomic_flush(NULL, true); > + > if (!have_bkl_console) > return; > > @@ -3174,12 +3196,6 @@ void console_flush_on_panic(enum con_flush_mode mode) > console_may_schedule = 0; > > if (mode == CONSOLE_REPLAY_ALL) { > - struct console *c; > - int cookie; > - u64 seq; > - > - seq = prb_first_valid_seq(prb); > - > cookie = console_srcu_read_lock(); > for_each_console_srcu(c) { > /* The code in this for_each_console_srcu(c) will reset r->seq for all consoles, including NO_BLK ones. It should do it only for the legacy consoles. Best Regards, Petr