From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Pan Xinhui <xinhui@linux.vnet.ibm.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.com>, Petr Mladek <pmladek@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>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [PATCH v11 3/3] printk: make printk.synchronous param rw
Date: Fri, 8 Apr 2016 14:29:27 +0900 [thread overview]
Message-ID: <20160408052927.GA614@swordfish> (raw)
In-Reply-To: <57072DE7.50806@linux.vnet.ibm.com>
On (04/08/16 12:04), Pan Xinhui wrote:
[..]
> > +/*
> > + * Init async printk via late_initcall, after core/arch/device/etc.
> > + * initialization.
> > + */
> > +static __init int init_printk_kthread(void)
> > +{
> > + printk_initcall_done = true;
> > + return __init_printk_kthread();
> hello,
>
> One confusion, Why not use a lock to protect __init_printk_kthread from parallel call? Otherwise I think there is a race.
> But for simplicity, maybe you could write codes as below.
>
> + int ret = __init_printk_kthread();
> + printk_initcall_done = true;
> + return ret;
>
> In my opinion, using a lock is better.
Hello,
I though about this, but isn't late_initcall() happening before kernel
starts /sbin/init? who can race with
late_initcall() -> init_printk_kthread() -> __init_printk_kthread()?
looking at
static int __ref kernel_init(void *unused)
{
int ret;
kernel_init_freeable();
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
free_initmem();
..
if (!try_to_run_init_process("/sbin/init") ||
!try_to_run_init_process("/etc/init") ||
!try_to_run_init_process("/bin/init") ||
!try_to_run_init_process("/bin/sh"))
return 0;
__init (and init_printk_kthread is __init) is finished and freed by the
time kernel try_to_run_init_process. isn't it?
sysfs knob -> __init_printk_kthread() is protected by printk_sync_lock
mutex, obviously there can be parallel calls from user space.
-ss
next prev parent reply other threads:[~2016-04-08 5:28 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 [this message]
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
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=20160408052927.GA614@swordfish \
--to=sergey.senozhatsky.work@gmail.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=pmladek@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.