From: Petr Mladek <pmladek@suse.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Pan Xinhui <xinhui@linux.vnet.ibm.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.com>, Tejun Heo <tj@kernel.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
linux-kernel@vger.kernel.org,
Byungchul Park <byungchul.park@lge.com>
Subject: Re: [PATCH v11 3/3] printk: make printk.synchronous param rw
Date: Fri, 22 Apr 2016 10:41:06 +0200 [thread overview]
Message-ID: <20160422084106.GC2749@pathway.suse.cz> (raw)
In-Reply-To: <20160422012826.GA515@swordfish>
On Fri 2016-04-22 10:28:26, Sergey Senozhatsky wrote:
> Hello,
>
> On (04/21/16 13:07), Petr Mladek wrote:
> [..]
> > Please, what is the purpose of "printk_initcall_done" then? If I get
> > this correctly, it will always be true when printk_sync_set() is
> > called.
>
> well, this is a bit ugly, yes. kernel_param_ops defines ->set callback
> as printk_sync_set(). and this ->set callback is getting called from 2
> different paths (but it's really about underlying __init_printk_kthread()).
>
> __init_printk_kthread() can be executed from:
Ah, I see and feel shame. It is actually explained in the comment
above printk_initcall_done declaration. Well, the explanation confused
me a bit ;-) I suggest to change it sligtly:
/*
* printk_sync_set() can be called from two places:
*
* - early from start_kernel()->parse_args(). But we can't kthread_run()
* at this stage, so we just set the param value. The actual
* initalization happens later, from the late_initcall().
*
* - even later from user space via sysfs knob. We can kthread_run()
* there if needed.
*/
Or we could write this even more explicitely:
/*
* Prevent starting kthreads from start_kernel()->parse_args(). It is not
* possible at this stage. Instead do so via the inticall.
*/
static bool printk_initcall_done;
In each case, I would move the comment and the declaration right above the
printk_sync_set().
> alternatively, I had this idea to re-define ->set() callback in init_printk_kthread().
>
> IOW, by default we use param_set_bool(), so parse_args() will not cause any
> problems:
>
> static /*** can't 'const' anymore ***/ struct kernel_param_ops param_ops_printk_sync = {
> .set = param_set_bool,
> .get = param_get_bool,
> };
>
> and change it to printk_sync_set() in:
>
> static __init int init_printk_kthread(void)
> {
> param_ops_printk_sync.set = printk_sync_set;
> return __init_printk_kthread();
> }
>
> but I think that this bool flag is simpler to understand after all.
In addition, there would be problems to handle a possible change via
the sysfs knob. The bool flag looks much better to me :-)
Thanks a lot for detailed explanation.
Best Regards,
Petr
next prev parent reply other threads:[~2016-04-22 8:41 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-07 17:31 [PATCH v11 0/3] printk: Make printk() completely async Sergey Senozhatsky
2016-04-07 17:31 ` [PATCH v11 1/3] " Sergey Senozhatsky
2016-04-07 17:31 ` [PATCH v11 2/3] printk: Make wake_up_klogd_work_func() async Sergey Senozhatsky
2016-04-07 17:31 ` [PATCH v11 3/3] printk: make printk.synchronous param rw Sergey Senozhatsky
2016-04-08 4:04 ` Pan Xinhui
2016-04-08 5:29 ` Sergey Senozhatsky
2016-04-08 5:44 ` Pan Xinhui
2016-04-21 11:07 ` Petr Mladek
2016-04-22 1:28 ` Sergey Senozhatsky
2016-04-22 8:41 ` Petr Mladek [this message]
2016-04-22 13:12 ` Sergey Senozhatsky
2016-04-20 15:16 ` Jan Kara
2016-04-21 2:03 ` Sergey Senozhatsky
2016-04-16 2:55 ` [PATCH v11 0/3] printk: Make printk() completely async Sergey Senozhatsky
2016-04-16 5:44 ` Joe Perches
2016-04-21 2:14 ` Sergey Senozhatsky
2016-04-21 2:17 ` Joe Perches
2016-04-21 13:19 ` Jan Kara
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=20160422084106.GC2749@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=akpm@linux-foundation.org \
--cc=byungchul.park@lge.com \
--cc=jack@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=tj@kernel.org \
--cc=xinhui@linux.vnet.ibm.com \
/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
Powered by JetHome