lkml.org 
[lkml]   [2021]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH printk-rework 07/14] printk: use atomic64_t for devkmsg_user.seq
On Thu 2021-02-18 09:18:10, John Ogness wrote:
> @user->seq is indirectly protected by @logbuf_lock. Once @logbuf_lock
> is removed, @user->seq will be no longer safe from an atomicity point
> of view.
>
> In preparation for the removal of @logbuf_lock, change it to
> atomic64_t to provide this safety.
>
> Signed-off-by: John Ogness <john.ogness@linutronix.de>
> ---
> kernel/printk/printk.c | 24 ++++++++++++------------
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index a71e0d41ccb5..20c21a25143d 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -865,9 +865,9 @@ static __poll_t devkmsg_poll(struct file *file, poll_table *wait)
> poll_wait(file, &log_wait, wait);
>
> logbuf_lock_irq();
> - if (prb_read_valid_info(prb, user->seq, &info, NULL)) {
> + if (prb_read_valid(prb, atomic64_read(&user->seq), NULL)) {

s/prb_read_valid/prb_read_valid_info/

It is likely a mistake when rebasing on top of the commit
13791c80b0cdf54d ("printk: avoid prb_first_valid_seq() where possible").

> /* return error when data has vanished underneath us */
> - if (info.seq != user->seq)
> + if (info.seq != atomic64_read(&user->seq))
> ret = EPOLLIN|EPOLLRDNORM|EPOLLERR|EPOLLPRI;
> else
> ret = EPOLLIN|EPOLLRDNORM;

With the above fix:

Reviewed-by: Petr Mladek <pmladek@suse.com>

Best Regards,
Petr

\
 
 \ /
  Last update: 2021-02-19 14:00    [W:0.183 / U:10.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site