Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751325AbdGQLGU (ORCPT ); Mon, 17 Jul 2017 07:06:20 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:35012 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751285AbdGQLGT (ORCPT ); Mon, 17 Jul 2017 07:06:19 -0400 MIME-Version: 1.0 In-Reply-To: <20170717092828.GA474@jagdpanzerIV.localdomain> References: <1500115014-3420-1-git-send-email-vichy.kuo@gmail.com> <20170717092828.GA474@jagdpanzerIV.localdomain> From: pierre kuo Date: Mon, 17 Jul 2017 19:06:18 +0800 Message-ID: Subject: Re: [PATCH] printk: modify console_unlock with printk-safe macros To: Sergey Senozhatsky Cc: Petr Mladek , Sergey Senozhatsky , rostedt@goodmis.org, linux-kernel@vger.kernel.org, Joe Perches Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1486 Lines: 37 hi Sergey and Andy: > 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. Got ur points and appreciate for your illustration. ^^ Thanks a lot,