From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH v2] printk: Relocate wake_klogd check close to the end of console_unlock()
Date: Mon, 26 Feb 2018 15:27:10 +0900 [thread overview]
Message-ID: <20180226062710.GB12539@jagdpanzerIV> (raw)
In-Reply-To: <20180219155817.yfo7yrnz4vyzxerx@pathway.suse.cz>
Hello,
Sorry for the delay. Could not reply sooner.
On (02/19/18 16:58), Petr Mladek wrote:
[..]
> > @@ -2417,12 +2413,17 @@ void console_unlock(void)
> > up_console_sem();
> >
> > /*
> > - * Someone could have filled up the buffer again, so re-check if there's
> > - * something to flush. In case we cannot trylock the console_sem again,
> > - * there's a new owner and the console_unlock() from them will do the
> > - * flush, no worries.
> > + * Check whether userland needs notification. Also, someone could
> > + * have filled up the buffer again, so re-check if there's
> > + * something to flush. In case we cannot trylock the console_sem
> > + * again, there's a new owner and the console_unlock() from them
> > + * will do the flush, no worries.
> > */
> > raw_spin_lock(&logbuf_lock);
> > + if (seen_seq != log_next_seq) {
> > + wake_klogd = true;
> > + seen_seq = log_next_seq;
>
> Sigh, there is actually still a race with console_trylock_spinning().
I see what you are talking about. Good catch.
> The simplest solution seems to be to do this only when !retry.
Yeah, offloading makes any "internal state" flags almost impossible to
use. We either need to upgrade those "internal state" flags to "global
state" flags, or to add more complex checks/race conditions workarounds
and so on. So I think that !retry should work. But, honestly, the whole
wakeup_klogd thing is getting too complex to like it.
-ss
prev parent reply other threads:[~2018-02-26 6:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 13:04 [PATCH v2] printk: Relocate wake_klogd check close to the end of console_unlock() Petr Mladek
2018-02-08 14:53 ` Sergey Senozhatsky
2018-02-08 16:48 ` Petr Mladek
2018-02-09 3:28 ` Sergey Senozhatsky
2018-02-09 10:39 ` Petr Mladek
2018-02-10 7:33 ` Sergey Senozhatsky
2018-02-09 10:47 ` Petr Mladek
2018-02-19 15:58 ` Petr Mladek
2018-02-19 16:01 ` [PATCH v3] " Petr Mladek
2018-02-26 6:37 ` Sergey Senozhatsky
2018-02-26 15:57 ` Petr Mladek
2018-02-26 16:01 ` Sergey Senozhatsky
2018-02-26 6:27 ` Sergey Senozhatsky [this message]
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=20180226062710.GB12539@jagdpanzerIV \
--to=sergey.senozhatsky.work@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=tj@kernel.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