Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1331323 > unrolled thread
| Started by | Petr Mladek <pmladek@suse.com> |
|---|---|
| First post | 2016-02-10 17:50 +0100 |
| Last post | 2016-02-11 09:10 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC][PATCH v3 1/4] printk: move can_use_console out of console_trylock_for_printk Petr Mladek <pmladek@suse.com> - 2016-02-10 17:50 +0100
Re: [RFC][PATCH v3 1/4] printk: move can_use_console out of console_trylock_for_printk Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-02-11 09:10 +0100
| From | Petr Mladek <pmladek@suse.com> |
|---|---|
| Date | 2016-02-10 17:50 +0100 |
| Subject | Re: [RFC][PATCH v3 1/4] printk: move can_use_console out of console_trylock_for_printk |
| Message-ID | <r0G7M-4Gb-21@gated-at.bofh.it> |
On Sat 2016-01-23 17:15:10, Sergey Senozhatsky wrote:
> This patch moves can_use_console() check out of
> console_trylock_for_printk(). Instead it calls it in
> console_unlock(), so now console_lock()/console_unlock() are
> also 'protected' by can_use_console().
>
> Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
> ---
> kernel/printk/printk.c | 86 ++++++++++++++++++++++++--------------------------
> 1 file changed, 42 insertions(+), 44 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index 7ebcfea..c39232a 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -1519,21 +1492,7 @@ static inline int can_use_console(unsigned int cpu)
> */
> static int console_trylock_for_printk(void)
> {
> - unsigned int cpu = smp_processor_id();
> -
> - if (!console_trylock())
> - return 0;
> - /*
> - * If we can't use the console, we need to release the console
> - * semaphore by hand to avoid flushing the buffer. We need to hold the
> - * console semaphore in order to do this test safely.
> - */
> - if (!can_use_console(cpu)) {
> - console_locked = 0;
> - up_console_sem();
> - return 0;
> - }
> - return 1;
> + return console_trylock();
> }
I would personally remove console_trylock_for_printk() already in this
patch. I mean to fold the 3rd patch into this one.
> int printk_delay_msec __read_mostly;
> @@ -2247,9 +2233,21 @@ void console_unlock(void)
> do_cond_resched = console_may_schedule;
> console_may_schedule = 0;
>
> +again:
> + /*
> + * We released the console_sem lock, so we need to recheck if
> + * cpu is online and (if not) is there at least one CON_ANYTIME
> + * console.
> + */
> + if (!can_use_console()) {
> + console_locked = 0;
> + up_console_sem();
> + return;
> + }
This is a bug fix and a nice clean up together.
Reviewed-by: Petr Mladek <pmladek@suse.com>
Best Regards,
Petr
[toc] | [next] | [standalone]
| From | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> |
|---|---|
| Date | 2016-02-11 09:10 +0100 |
| Message-ID | <r0Uu6-65R-5@gated-at.bofh.it> |
| In reply to | #1331323 |
Hello Petr,
On (02/10/16 17:48), Petr Mladek wrote:
[..]
> I would personally remove console_trylock_for_printk() already in this
> patch. I mean to fold the 3rd patch into this one.
will do.
> > int printk_delay_msec __read_mostly;
>
> > @@ -2247,9 +2233,21 @@ void console_unlock(void)
> > do_cond_resched = console_may_schedule;
> > console_may_schedule = 0;
> >
> > +again:
> > + /*
> > + * We released the console_sem lock, so we need to recheck if
> > + * cpu is online and (if not) is there at least one CON_ANYTIME
> > + * console.
> > + */
> > + if (!can_use_console()) {
> > + console_locked = 0;
> > + up_console_sem();
> > + return;
> > + }
>
> This is a bug fix and a nice clean up together.
>
> Reviewed-by: Petr Mladek <pmladek@suse.com>
thanks.
-ss
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web