The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Pierre Kuo <vichy.kuo@gmail.com>
Cc: pmladek@suse.com, sergey.senozhatsky@gmail.com,
	rostedt@goodmis.org, linux-kernel@vger.kernel.org,
	joe@perches.com
Subject: Re: [PATCH] printk: modify console_unlock with printk-safe macros
Date: Mon, 17 Jul 2017 18:28:28 +0900	[thread overview]
Message-ID: <20170717092828.GA474@jagdpanzerIV.localdomain> (raw)
In-Reply-To: <1500115014-3420-1-git-send-email-vichy.kuo@gmail.com>

On (07/15/17 18:36), Pierre Kuo wrote:
[..]
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index fc47863..21557cc 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2194,8 +2194,7 @@ void console_unlock(void)
>  		size_t ext_len = 0;
>  		size_t len;
>  
> -		printk_safe_enter_irqsave(flags);
> -		raw_spin_lock(&logbuf_lock);
> +		logbuf_lock_irqsave(flags);
>  		if (seen_seq != log_next_seq) {
>  			wake_klogd = true;
>  			seen_seq = log_next_seq;
> @@ -2267,8 +2266,7 @@ void console_unlock(void)
>  	 */
>  	raw_spin_lock(&logbuf_lock);
>  	retry = console_seq != log_next_seq;
> -	raw_spin_unlock(&logbuf_lock);
> -	printk_safe_exit_irqrestore(flags);
> +	logbuf_unlock_irqrestore(flags);
>  
>  	if (retry && console_trylock())
>  		goto again;

I did it that particular way for a reason - console_unlock() does a
bunch of tricks: unlocking logbuf in the middle of printing loop,
breaking out of loop with local IRQs disabled, re-taking the logbuf
after the loop still will local IRQs disabled, etc. etc. I didn't
want to (and still don't) mix-in logbuf macros; we do things that
macros don't cover anyway. sorry, I don't agree that the patch
improves readability.

	-ss

  parent reply	other threads:[~2017-07-17  9:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-15 10:36 [PATCH] printk: modify console_unlock with printk-safe macros Pierre Kuo
2017-07-15 12:36 ` Andy Shevchenko
2017-07-17  9:28 ` Sergey Senozhatsky [this message]
2017-07-17 11:06   ` pierre kuo

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=20170717092828.GA474@jagdpanzerIV.localdomain \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=vichy.kuo@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox