From: John Ogness <john.ogness@linutronix.de>
To: <zhe.he@windriver.com>
Cc: <linux-rt-users@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RT] printk: devkmsg: read: Return EPIPE when the first message user-space wants has gone
Date: Wed, 25 Sep 2019 01:49:08 +0200 [thread overview]
Message-ID: <8736gls1aj.fsf@linutronix.de> (raw)
In-Reply-To: <20190924072639.25986-1-zhe.he@windriver.com> (zhe he's message of "Tue, 24 Sep 2019 15:26:39 +0800")
On 2019-09-24, <zhe.he@windriver.com> wrote:
> From: He Zhe <zhe.he@windriver.com>
>
> When user-space wants to read the first message, that is when user->seq
> is 0, and that message has gone, it currently automatically resets
> user->seq to current first seq. This mis-aligns with mainline kernel.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/dev-kmsg#n39
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/printk/printk.c#n899
>
> We should inform user-space that what it wants has gone by returning EPIPE
> in such scenario.
>
> Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
> kernel/printk/printk.c | 12 ++++--------
> 1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index e3fa33f2e23c..58c545a528b3 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -703,14 +703,10 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
> goto out;
> }
>
> - if (user->seq == 0) {
> - user->seq = seq;
> - } else {
> - user->seq++;
> - if (user->seq < seq) {
> - ret = -EPIPE;
> - goto restore_out;
> - }
> + user->seq++;
> + if (user->seq < seq) {
> + ret = -EPIPE;
> + goto restore_out;
> }
>
> msg = (struct printk_log *)&user->msgbuf[0];
prev parent reply other threads:[~2019-09-24 23:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-24 7:26 [PATCH RT] printk: devkmsg: read: Return EPIPE when the first message user-space wants has gone zhe.he
2019-09-24 23:49 ` John Ogness [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=8736gls1aj.fsf@linutronix.de \
--to=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=zhe.he@windriver.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.