From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Linus Torvalds <torvalds@linux-foundation.org>,
Guenter Roeck <linux@roeck-us.net>,
Shreyas Joshi <shreyas.joshi@biamp.com>,
shreyasjoshi15@gmail.com,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC 1/2] printk: Add kernel parameter: mute_console
Date: Fri, 23 Oct 2020 14:11:34 +0200 [thread overview]
Message-ID: <20201023121134.GF32486@alley> (raw)
In-Reply-To: <20201023003334.GA588@jagdpanzerIV.localdomain>
On Fri 2020-10-23 09:33:34, Sergey Senozhatsky wrote:
> On (20/10/22 13:42), Petr Mladek wrote:
> > +static bool mute_console;
> > +
> > +static int __init mute_console_setup(char *str)
> > +{
> > + mute_console = true;
> > + pr_info("All consoles muted.\n");
> > +
> > + return 0;
> > +}
>
> First of all, thanks a lot for picking this up and for the patch set!
>
> I've several thoughts and comments below.
>
> > static bool suppress_message_printing(int level)
> > {
> > - return (level >= console_loglevel && !ignore_loglevel);
> > + if (unlikely(mute_console))
> > + return true;
> > +
> > + if (unlikely(ignore_loglevel))
> > + return false;
> > +
> > + return (level >= console_loglevel);
> > }
>
> This is one way of doing it. Another one is to clear CON_ENABLED bit
> from all consoles (upon registration), one upside of this is that we
> will signal user-space that consoles are disabled/muted (by removing
> the E flag from /proc/consoles).
Hmm, CON_ENABLED is used by suspend/resume code unconditionaly. We
would need another flag to define the state after resume.
Well, it is true that CON_ENABLED has the same effect. Messages are
not printed to the console. So, introducing another variable is
likely overkill.
> Thinking more about it. We are still relying on the fact that there is
> anything registered as console driver, which is not necessarily the case,
> we can have NULL console drivers list. So how about having a dummy struct
> console in printk, with NOP read/write and NOP tty_driver and NOP
> tty_operations. So that when init calls filp_open("/dev/console") and
> we can't give tty anything but NULL, we'd just give tty back the dummy
> NOP device.
Yup, this seems to be the best solution.
Best Regards,
Petr
next prev parent reply other threads:[~2020-10-23 12:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-22 11:42 [RFC 0/2] printk: Official way to mute consoles Petr Mladek
2020-10-22 11:42 ` [RFC 1/2] printk: Add kernel parameter: mute_console Petr Mladek
2020-10-22 13:10 ` John Ogness
2020-10-22 14:15 ` Guenter Roeck
2020-10-22 14:53 ` John Ogness
2020-10-23 11:49 ` Petr Mladek
2020-10-23 14:52 ` Guenter Roeck
2020-10-22 13:45 ` Steven Rostedt
2020-10-22 14:22 ` Guenter Roeck
2020-10-23 9:46 ` Petr Mladek
2020-10-23 0:33 ` Sergey Senozhatsky
2020-10-23 12:11 ` Petr Mladek [this message]
2020-10-23 15:59 ` Linus Torvalds
2020-10-22 11:42 ` RFC 2/2] printk: Restore and document obsolete ways to disable console output Petr Mladek
2020-10-22 14:23 ` Guenter Roeck
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=20201023121134.GF32486@alley \
--to=pmladek@suse.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=shreyas.joshi@biamp.com \
--cc=shreyasjoshi15@gmail.com \
--cc=torvalds@linux-foundation.org \
/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®