From: Petr Mladek <pmladek@suse.com>
To: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: preffer_ofload param: was: Re: [PATCH printk v3 11/19] printk: nbcon: Rely on kthreads for normal operation
Date: Fri, 2 Aug 2024 12:19:14 +0200 [thread overview]
Message-ID: <ZqyyovKfUfI1t6Nz@pathway.suse.cz> (raw)
In-Reply-To: <87bk2b8jsi.fsf@jogness.linutronix.de>
On Fri 2024-08-02 09:35:17, John Ogness wrote:
> On 2024-08-01, Petr Mladek <pmladek@suse.com> wrote:
> > I believe that the parameter "prefer_offload" adds more harm than good
> > because:
> >
> > + It is a non-sense for nbcon consoles. They always prefer offload
> > except for emergency and panic. But emergency and panic is
> > handled transparently by nbcon_get_default_prio().
> >
> > + It is confusing even for legacy consoles after introducing the
> > kthread. There will be three types of offload:
> >
> > + do console_lock()/unlock() in IRQ work
> > + wake kthread
> > + wake kthread in IRQ work
>
> I think the confusion comes from my intention of the function. I wanted
> a caller to use it as:
>
> "Tell me how to flush."
Yes, I understand it the same way.
> This requires input from the caller to know some information about what
> the caller's intentions are.
Does it really need it?
Where?
Please, show me two examples where the function is not able to make
the right decision by global variables?
I know about __wake_up_klogd(). And it is only because
printk_deferred() requires the offload via @level parameter
instead of the per-CPU @printk_context.
Is there any other?
Let me repeat:
+ The parameter makes a difference only when it is "true".
+ The parameter affects only legacy loop.
Let me check where the parameter is true in the current code:
+ nbcon_atomic_flush_pending_con[1548]
+ No effect! The function ignores legacy consoles.
+ nbcon_device_release[1848]
+ No effect! The function ignores legacy consoles.
+ resume_console[2706]
+ Wrong! The function should flush the legacy
consoles directly by default. Otherwise, we would
change the legacy behavior.
+ console_flush_all[3102] printk_get_console_flush_type(&ft, true);
+ No effect! The function ignores legacy consoles.
+ Confusing! The function flushes legacy consoles directly!
+ console_start[3453]
+ Wrong! The function should flush the legacy
consoles directly by default. Otherwise, we would
change the legacy behavior.
+ legacy_kthread_should_wakeup[3484]
+ Not needed! The function is called only when
force_legacy_kthread() == true.
+ __wake_up_klogd[4466]
+ This is the only location where it makes a difference.
+ We could simply check both legacy_direct && legacy_offload
here.
+ Yes, it is a hack. But it is needed only because of
printk_deferred() which is already hacky by using
LOGLEVEL_SCHED.
+ console_try_replay_all[4851]
+ Wrong! It is called under console_lock() => the function will
flush legacy consoles directly anyway.
> If I change the function so that a caller uses it as:
>
> "Tell me what flush mechanisms are available to me."
No, this will make the code complicated again.
> Then the function does not need to know the caller's intentions. It only
> needs to know the caller's state, and that information is readily
> available via global/per-cpu variables.
>
> I will drop the @prefer_offload argument, simplifying the function to
> only provide a list of available flush options. The caller will then
> decide itself which option it wants to use. I believe this aligns with
> your intentions as well.
No. Please, keep the original meaning.
Best Regards,
Petr
next prev parent reply other threads:[~2024-08-02 10:19 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-22 17:19 [PATCH printk v3 00/19] add threaded printing + the rest John Ogness
2024-07-22 17:19 ` [PATCH printk v3 01/19] printk: nbcon: Clarify nbcon_get_default_prio() context John Ogness
2024-07-26 8:57 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 02/19] printk: nbcon: Consolidate alloc() and init() John Ogness
2024-07-26 11:58 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 03/19] printk: nbcon: Add function for printers to reacquire ownership John Ogness
2024-07-26 12:25 ` Petr Mladek
2024-07-29 8:36 ` John Ogness
2024-07-30 9:24 ` Petr Mladek
2024-08-27 1:32 ` John Ogness
2024-07-22 17:19 ` [PATCH printk v3 04/19] printk: nbcon: Clarify rules of the owner/waiter matching John Ogness
2024-07-26 12:55 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 05/19] printk: Fail pr_flush() if before SYSTEM_SCHEDULING John Ogness
2024-07-26 13:14 ` Petr Mladek
2024-07-26 14:45 ` John Ogness
2024-07-30 9:50 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 06/19] printk: Flush console on unregister_console() John Ogness
2024-07-26 13:23 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 07/19] printk: Add helpers for flush type logic John Ogness
2024-07-23 2:01 ` kernel test robot
2024-07-23 8:39 ` John Ogness
2024-07-23 3:29 ` kernel test robot
2024-07-26 15:51 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 08/19] printk: nbcon: Add context to usable() and emit() John Ogness
2024-07-30 12:30 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 09/19] printk: nbcon: Introduce printer kthreads John Ogness
2024-07-30 14:44 ` John Ogness
2024-07-31 9:59 ` Petr Mladek
2024-07-30 15:16 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 10/19] printk: nbcon: Use thread callback if in task context for legacy John Ogness
2024-07-30 15:35 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 11/19] printk: nbcon: Rely on kthreads for normal operation John Ogness
2024-07-23 3:18 ` kernel test robot
2024-07-23 8:51 ` John Ogness
2024-07-31 13:46 ` preffer_ofload param: was: " Petr Mladek
2024-08-01 14:22 ` John Ogness
2024-08-01 15:40 ` Petr Mladek
2024-08-02 7:29 ` John Ogness
2024-08-02 10:19 ` Petr Mladek [this message]
2024-07-31 14:06 ` Petr Mladek
2024-07-31 15:25 ` John Ogness
2024-08-01 9:36 ` Petr Mladek
2024-08-01 9:52 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 12/19] printk: Provide helper for message prepending John Ogness
2024-07-22 17:19 ` [PATCH printk v3 13/19] printk: nbcon: Show replay message on takeover John Ogness
2024-07-31 14:59 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 14/19] proc: consoles: Add notation to c_start/c_stop John Ogness
2024-07-22 17:19 ` [PATCH printk v3 15/19] proc: Add nbcon support for /proc/consoles John Ogness
2024-07-31 15:07 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 16/19] tty: sysfs: Add nbcon support for 'active' John Ogness
2024-07-31 15:09 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 17/19] printk: Implement legacy printer kthread for PREEMPT_RT John Ogness
2024-08-02 11:45 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 18/19] printk: nbcon: Assign nice -20 for printing threads John Ogness
2024-08-02 11:47 ` Petr Mladek
2024-07-22 17:19 ` [PATCH printk v3 19/19] printk: Avoid false positive lockdep report for legacy printing John Ogness
2024-08-02 12:34 ` Petr Mladek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZqyyovKfUfI1t6Nz@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®