From: John Ogness <john.ogness@linutronix.de> To: Petr Mladek <pmladek@suse.com> Cc: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>, Sergey Senozhatsky <sergey.senozhatsky@gmail.com>, Steven Rostedt <rostedt@goodmis.org>, Linus Torvalds <torvalds@linux-foundation.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Thomas Gleixner <tglx@linutronix.de>, Peter Zijlstra <peterz@infradead.org>, Andrea Parri <parri.andrea@gmail.com>, Paul McKenney <paulmck@kernel.org>, kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH next v3 6/8] printk: ringbuffer: add finalization/extension support Date: Mon, 31 Aug 2020 15:00:58 +0206 [thread overview] Message-ID: <878sdvq8kd.fsf@jogness.linutronix.de> (raw) In-Reply-To: <20200831011058.6286-7-john.ogness@linutronix.de> This critical piece was missing from patch 6... From 0b745d507f0c38e6d1612ed9468aa52845ca025b Mon Sep 17 00:00:00 2001 From: John Ogness <john.ogness@linutronix.de> Date: Mon, 31 Aug 2020 14:45:40 +0206 Subject: [PATCH] printk: ringbuffer: allow reading consistent descriptors desc_read() will fail to read if a descriptor is in the desc_reserved queried state because such data would be inconsistent. However, since ("printk: ringbuffer: add finalization/extension support") the desc_reserved state can have the DESC_COMMIT_MASK flag set, in which case it _is_ consistent. And indeed, desc_reopen_last() is expecting a read in this case. Allow desc_read() to read desc_reserved descriptors if the DESC_COMMIT_MASK flag is set. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reported-by: Andy Lavr <andy.lavr@gmail.com> Fixes: ("printk: ringbuffer: add finalization/extension support") --- kernel/printk/printk_ringbuffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c index 0731d5e2dddd..6ba7d3fc96f1 100644 --- a/kernel/printk/printk_ringbuffer.c +++ b/kernel/printk/printk_ringbuffer.c @@ -446,8 +446,10 @@ static enum desc_state desc_read(struct prb_desc_ring *desc_ring, /* Check the descriptor state. */ state_val = atomic_long_read(state_var); /* LMM(desc_read:A) */ d_state = get_desc_state(id, state_val); - if (d_state != desc_committed && d_state != desc_reusable) + if (d_state == desc_miss || + (d_state == desc_reserved && !(state_val & DESC_COMMIT_MASK))) { return d_state; + } /* * Guarantee the state is loaded before copying the descriptor -- 2.20.1
WARNING: multiple messages have this Message-ID (diff)
From: John Ogness <john.ogness@linutronix.de> To: Petr Mladek <pmladek@suse.com> Cc: Andrea Parri <parri.andrea@gmail.com>, Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>, Paul McKenney <paulmck@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, Steven Rostedt <rostedt@goodmis.org>, Sergey Senozhatsky <sergey.senozhatsky@gmail.com>, Thomas Gleixner <tglx@linutronix.de>, Linus Torvalds <torvalds@linux-foundation.org> Subject: Re: [PATCH next v3 6/8] printk: ringbuffer: add finalization/extension support Date: Mon, 31 Aug 2020 15:00:58 +0206 [thread overview] Message-ID: <878sdvq8kd.fsf@jogness.linutronix.de> (raw) In-Reply-To: <20200831011058.6286-7-john.ogness@linutronix.de> This critical piece was missing from patch 6... From 0b745d507f0c38e6d1612ed9468aa52845ca025b Mon Sep 17 00:00:00 2001 From: John Ogness <john.ogness@linutronix.de> Date: Mon, 31 Aug 2020 14:45:40 +0206 Subject: [PATCH] printk: ringbuffer: allow reading consistent descriptors desc_read() will fail to read if a descriptor is in the desc_reserved queried state because such data would be inconsistent. However, since ("printk: ringbuffer: add finalization/extension support") the desc_reserved state can have the DESC_COMMIT_MASK flag set, in which case it _is_ consistent. And indeed, desc_reopen_last() is expecting a read in this case. Allow desc_read() to read desc_reserved descriptors if the DESC_COMMIT_MASK flag is set. Signed-off-by: John Ogness <john.ogness@linutronix.de> Reported-by: Andy Lavr <andy.lavr@gmail.com> Fixes: ("printk: ringbuffer: add finalization/extension support") --- kernel/printk/printk_ringbuffer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk_ringbuffer.c b/kernel/printk/printk_ringbuffer.c index 0731d5e2dddd..6ba7d3fc96f1 100644 --- a/kernel/printk/printk_ringbuffer.c +++ b/kernel/printk/printk_ringbuffer.c @@ -446,8 +446,10 @@ static enum desc_state desc_read(struct prb_desc_ring *desc_ring, /* Check the descriptor state. */ state_val = atomic_long_read(state_var); /* LMM(desc_read:A) */ d_state = get_desc_state(id, state_val); - if (d_state != desc_committed && d_state != desc_reusable) + if (d_state == desc_miss || + (d_state == desc_reserved && !(state_val & DESC_COMMIT_MASK))) { return d_state; + } /* * Guarantee the state is loaded before copying the descriptor -- 2.20.1 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec
next prev parent reply other threads:[~2020-08-31 12:55 UTC|newest] Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-31 1:10 [PATCH next v3 0/8] printk: reimplement LOG_CONT handling John Ogness 2020-08-31 1:10 ` John Ogness 2020-08-31 1:10 ` [PATCH next v3 1/8] printk: ringbuffer: rename DESC_COMMITTED_MASK flag John Ogness 2020-08-31 1:10 ` John Ogness 2020-08-31 1:10 ` [PATCH next v3 2/8] printk: ringbuffer: change representation of reusable John Ogness 2020-08-31 1:10 ` John Ogness 2020-08-31 1:10 ` [PATCH next v3 3/8] printk: ringbuffer: relocate get_data() John Ogness 2020-08-31 1:10 ` John Ogness 2020-08-31 1:10 ` [PATCH next v3 4/8] printk: ringbuffer: add BLK_DATALESS() macro John Ogness 2020-08-31 1:10 ` John Ogness 2020-08-31 1:10 ` [PATCH next v3 5/8] printk: ringbuffer: clear initial reserved fields John Ogness 2020-08-31 1:10 ` John Ogness 2020-09-01 14:33 ` Petr Mladek 2020-09-01 14:33 ` Petr Mladek 2020-08-31 1:10 ` [PATCH next v3 6/8] printk: ringbuffer: add finalization/extension support John Ogness 2020-08-31 1:10 ` John Ogness 2020-08-31 12:54 ` John Ogness [this message] 2020-08-31 12:54 ` John Ogness 2020-09-02 10:52 ` state names: vas: " Petr Mladek 2020-09-02 10:52 ` Petr Mladek 2020-09-02 11:20 ` John Ogness 2020-09-02 11:20 ` John Ogness 2020-09-02 12:39 ` Petr Mladek 2020-09-02 12:39 ` Petr Mladek 2020-09-02 10:58 ` Petr Mladek 2020-09-02 10:58 ` Petr Mladek 2020-09-02 12:21 ` misc: was: " Petr Mladek 2020-09-02 12:21 ` Petr Mladek 2020-08-31 1:10 ` [PATCH next v3 7/8] printk: reimplement log_cont using record extension John Ogness 2020-08-31 1:10 ` John Ogness 2020-09-02 13:38 ` Petr Mladek 2020-09-02 13:38 ` Petr Mladek 2020-08-31 1:10 ` [PATCH next v3 8/8] scripts/gdb: support printk finalized records John Ogness 2020-08-31 1:10 ` John Ogness
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=878sdvq8kd.fsf@jogness.linutronix.de \ --to=john.ogness@linutronix.de \ --cc=gregkh@linuxfoundation.org \ --cc=kexec@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=parri.andrea@gmail.com \ --cc=paulmck@kernel.org \ --cc=peterz@infradead.org \ --cc=pmladek@suse.com \ --cc=rostedt@goodmis.org \ --cc=sergey.senozhatsky.work@gmail.com \ --cc=sergey.senozhatsky@gmail.com \ --cc=tglx@linutronix.de \ --cc=torvalds@linux-foundation.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: linkBe 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.