From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.41 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794582352; b=QlJqN2ozkNEQgMP+d6ynkYwrUuJiYYL3X8hiufFcBIZE4FH267W3mAe/9SWc6XQqocxw jmyjrShpka0a1e2sQIJQDDqeBStegMw8UXAhF7ddhPXiVCKFGG4+UdI2mwi2dbIjqMnWN Bh4F6ZLxy4vUpca/4Y2bwFr1fnm/2VZVslS5IwaatMcBjlMn3VAN0s+sFtpXxwIm/dny3 lDpgkpDMO99T7mrC8O2B+0CjFIHvdTwMbfaJK9opdMqa6lgMcKCP1iPa398BBYgwTjUkb KIOtatYZ2TLAL14j+rUHMDivFg+IYpJPNtEw/t7Y7xNQBofyePllDG9UkowQYCep5BQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794582352; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=x+Xd1db6zPqMxOaxpQfVku2qqOYSO4cm/68ivCtsVLQ=; b=TfTgfKMGyeSfpMe7pmPvWdSyREMMwUowNjdBqUQs1SSKnxrI5nzZuhbEhHS1IYMu5Y8o gHqIMZYMUyI0zqlStIzldlSM7A0bv7Wu9FFgtXMmZNLCcSo3qhB/Y9jc9Gg5qx/t9mOpD skhFp9/GmaaH6iYBdou85v+7ZZK5cbvxolc4NR/6He4KWsckLq/+VOuHwo/+nqcU+CQzY PCexg97iVQ215z2v6mT7kCx9tacmkOFk90VOBDJGR2Chh/YIdY+Yz1Fq63dE80hiwQI/H 4dCbDdpta9bNQIesR0UAU0jRivxLs7nwUpkAC9eAX2AdjxqycAV6c7H2V1NuqeLFrHQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=gBj1J2bn; arc=none smtp.remote-ip=209.85.128.41 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 39763606A323 for ; Fri, 13 Nov 2026 15:05:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 39763606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.a=rsa-sha256 header.s=google header.b=gBj1J2bn Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4a210470b49so8886455e9.2 for ; Fri, 13 Nov 2026 07:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1794582349; x=1795187149; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=x+Xd1db6zPqMxOaxpQfVku2qqOYSO4cm/68ivCtsVLQ=; b=gBj1J2bn0z9VTnTLTBdspNJvCaOXOTdxEjmggLUvm2x930Uau0W2VFzWZPJv3gzmcX 4kOgyyenoKfuv+g+ra7q2nJLCdgshWiFfaXHJjL7NYk35ofR033uhc5K4gdY0oULhH2i bDST57DdjHnZZ4CkrcFGUxc5I2phkZgwmH1ZKZYke3VxITNG6IbC+lgFxtNSnYA2dBMN kxTnX9uO7xzQFDFHVgG5YtF6ps3NG6AerEMFoWu09BHQXx0bEKj4bwltZohWtEYGX/v4 hnnoUFrrdnBaGp0L2qHrElbJM/bJxxpERIQouOrQcgAWz+Q8+jDICxLTXiW/lin+/uuv Bdhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1794582349; x=1795187149; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=x+Xd1db6zPqMxOaxpQfVku2qqOYSO4cm/68ivCtsVLQ=; b=qHmmrPpQSJ2XhuUN6pxp+sDtz5VNpAeAZcR2GZaLAlnKuc5N2nvtmz6R80udo5Ddou 83ibdHJsTWERAfuy0/AQ7edsvLSrEaor8hEvz5Zk+EHAuXJc95seHQvkWa5IzRTapdEG fDs3tIGKMdULq3+GMsyx+UPGDeok3FBf51UmIQVpkJU244GaeWQZoqBo9VrNGq10H5Ay yvUEK0e+C/UpvV+Z1FzW1ogZ3pr8QqxMXheWKoz/PgcQ/HuhZAwq3sacJ/0+qet+RZra SKSYF9jzFxsKeyq9MRKg32TBSJitXIsCBGNSgIqNhua4tfGpq+ESEfeCb8Wd0G7px637 qkLQ== X-Forwarded-Encrypted: i=1; AL+hErFf8I6djBnOrWqUAFdd0vc4XnRrdqzeXztk3YTrKf4XaAqppKgKBF03Kx9bpeRjcjA1kDeAyGdGajDdaj8=@vger.kernel.org X-Gm-Message-State: APuU4Z/wpqFo+wPHJzfG1IGFzThyCl1ZICNQz9Jmz/QeuhFE7nwCn4Um pUFq5kR9ej7Fs43lDgoy1QxJTbFrc0Gawb2+b/Gx8vVFyFuLhwIaexlQeqPA0xLaaYw= X-Gm-Gg: AYBFou3Vo9QtvYDMhj/Wv84OTsqiWIwcK4qXKcb18z6hY/bPnUmdg8SaEndgTKe5u67 xzkSr3RQpMXdLPZXx2EVO28JkXj7nLX94ALeRwhOe9f8+BkoRWtziz3BGT5Rijl+3CR3DGCxN2c Wd9ADiYA5xwoWCoZclXcUYs82lWLAXeFPzdTH44ZlzG6ul2P3GE08r5whfdBonE31XXKaUn4IQd 2o5j15/7eLlhSQkv6Aj1D12kFV0ehI9jmCteC6Vdpmor8R210vFaruIeLjSWmCDDbxytViUzXAO GNV8tT9kukVt8OCwlrHPJ5wRn2n+63/fV4hB5TQ0+liNIIEO/GVq9Xh+Gm71iRMlVFC3cij1S2W BkK2CrjKrDvRaougtC1zwge4JDG/eHMyl9NmhlrYumFyX+ZsPdH1BCPYte8LcFlLtuZq9RMcisY lCU7KX25FIMZTFUohx7ZkYG7ZUgBwkxBIVfRMjJ3mri8lGPkcDBvFbFvKCTflWrTltT46qW4TyL IEFW4Yego8eWDjgfjhfs8dJ10MS4W7S6m7W5wfs0ccM/UTNd03Ux6wYQqcpxIhV81XrL+/6YwF7 FkBDBFklIltxTDe0PqRtOlmPQDqZ/Do= X-Received: by 2002:a05:600c:46d5:b0:4a5:87b3:ddc1 with SMTP id 5b1f17b1804b1-4bb55a8329amr58179765e9.13.1794582349341; Fri, 13 Nov 2026 07:05:49 -0800 (PST) Received: from pathway.suse.cz ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb4e2538b9sm270777285e9.1.2026.11.13.07.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Nov 2026 07:05:48 -0800 (PST) Date: Fri, 13 Nov 2026 16:05:46 +0100 From: Petr Mladek To: John Ogness Cc: Sergey Senozhatsky , Steven Rostedt , Ryan Roberts , Breno Leitao , printk@lists.linux.dev, linux-kernel@vger.kernel.org, Huacai Chen , WANG Xuerui , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , "Ritesh Harjani (IBM)" , Shrikanth Hegde , Greg Kroah-Hartman , Jason Wessel , Daniel Thompson , Douglas Anderson , Andrew Morton , Mukesh Kumar Chaurasiya , Feng Tang , Rio , Bradley Morgan , Pnina Feder , Gal Pressman , Petr Pavlu , Pavel Tikhomirov , Oleg Nesterov , "Cen Zhang (Microsoft)" , loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, kgdb-bugreport@lists.sourceforge.net Subject: Re: [PATCH printk v2 1/6] printk: Introduce and specify flush reasons Message-ID: References: <20261111181942.593695-1-john.ogness@linutronix.de> <20261111181942.593695-2-john.ogness@linutronix.de> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261111181942.593695-2-john.ogness@linutronix.de> On Wed 2026-11-11 19:25:17, John Ogness wrote: > Prepare for per-console atomic flushing policies by introducing > enum pr_flush_reason to classify various reasons for performing a > printk backlog flush. The reasons are specified for > printk_trigger_flush() and console_flush_on_panic(). > > For atomic printing from printk_trigger_flush(), propagate the > reason down to __nbcon_atomic_flush_pending_con(), where the actual > atomic flushing is executed. > > For legacy printing, use a new global variable @legacy_flush_reason > to track the reason in case nbcon consoles are using legacy > printing. > > Update all printk_trigger_flush() and console_flush_on_panic() > call sites as well as any explicit lower-level atomic flush calls > to specify the reason. > > Note that PR_FLUSH_RUNTIME is used for cases where the reason for > the flush is not clearly defined. > --- a/include/linux/printk.h > +++ b/include/linux/printk.h > @@ -145,6 +145,24 @@ void early_printk(const char *s, ...) { } > > struct dev_printk_info; > > +/** > + * enum pr_flush_reason - Reason for a flush > + * @PR_FLUSH_RUNTIME: A flush while the kernel is running > + * @PR_FLUSH_RESTART: The kernel is ending, but another instance should > + * follow (reboot, kexec) > + * @PR_FLUSH_HANG: The kernel is ending and will enter an infinite loop > + * @PR_FLUSH_KDB: Printing while KDB is active > + * > + * Flush reasons are used to determine if unsafe atomic flushing should be > + * performed, based on individual console policies. > + */ > +enum pr_flush_reason { > + PR_FLUSH_RUNTIME = 0, > + PR_FLUSH_RESTART, > + PR_FLUSH_HANG, > + PR_FLUSH_KDB, > +}; This entire patchset adds a lot of complexity just to enable all 4 new policy flags for netconsole in the last patch. There already have few dimensions which affect console flushing: + console_loglevel + nbcon_prio This patchset adds 8 new terms in pr_flush_reason and nbcon_unsafe_flush_flags just to explicitly set all flush_flags in netconsole. Let's start with pr_flush_reason. I am not sure if it is worth it: + PR_FLUSH_RUNTIME is the default + PR_FLUSH_RESTART can be detected by system_state > SYSTEM_RUNNING + PR_FLUSH_HANG has only one caller currently distinguished by the global panic_nbcon_allow_unsafe_takeover + PR_FLUSH_KDB can be detected by kdb_trap_printk and kdb_printf_cpu, see vprintk() implementation. IMHO, it makes things worse because nbcon_atomic_flush_pending() has to use PR_FLUSH_RUNTIME in vprintk_emit(). But I think that we would like to flush it the same way as an explicit flush called in the given context. Best Regards, Petr