linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL
@ 2019-01-07  9:54 Sergey Senozhatsky
  2019-01-07 13:26 ` kbuild test robot
  2019-01-07 14:52 ` [PATCHv2] " Sergey Senozhatsky
  0 siblings, 2 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2019-01-07  9:54 UTC (permalink / raw)
  To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel, Sergey Senozhatsky

a) Do not pass console_loglevel to macros, use console_loglevel directly.
b) Use CONSOLE_LOGLEVEL_MOTORMOUTH instead of a naked number
c) Use bust_spinlocks() to set/clear oops_in_progress
d) Fix checkpatch error: Macros with multiple statements should be
                         enclosed in a do - while loop

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 arch/ia64/kernel/mca.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 91bd1e129379..06fb40f5c2d6 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -188,19 +188,23 @@ static unsigned int mlogbuf_finished = 0;
 static unsigned long mlogbuf_timestamp = 0;
 
 static int loglevel_save = -1;
-#define BREAK_LOGLEVEL(__console_loglevel)		\
-	oops_in_progress = 1;				\
-	if (loglevel_save < 0)				\
-		loglevel_save = __console_loglevel;	\
-	__console_loglevel = 15;
-
-#define RESTORE_LOGLEVEL(__console_loglevel)		\
-	if (loglevel_save >= 0) {			\
-		__console_loglevel = loglevel_save;	\
-		loglevel_save = -1;			\
-	}						\
-	mlogbuf_finished = 0;				\
-	oops_in_progress = 0;
+#define BREAK_LOGLEVEL()					\
+	do {							\
+		bust_spinlocks(1);				\
+		if (loglevel_save < 0)				\
+			loglevel_save = __console_loglevel;	\
+		console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;	\
+	} while (0)
+
+#define RESTORE_LOGLEVEL()					\
+	do {							\
+		if (loglevel_save >= 0) {			\
+			console_loglevel = loglevel_save;	\
+			loglevel_save = -1;			\
+		}						\
+		mlogbuf_finished = 0;				\
+		bust_spinlocks(0);				\
+	} while (0)
 
 /*
  * Push messages into buffer, print them later if not urgent.
@@ -287,7 +291,7 @@ EXPORT_SYMBOL(ia64_mlogbuf_dump);
  */
 static void ia64_mlogbuf_finish(int wait)
 {
-	BREAK_LOGLEVEL(console_loglevel);
+	BREAK_LOGLEVEL();
 
 	spin_lock_init(&mlogbuf_rlock);
 	ia64_mlogbuf_dump();
@@ -1616,7 +1620,7 @@ default_monarch_init_process(struct notifier_block *self, unsigned long val, voi
 	 * To enable show_stack from INIT, we use oops_in_progress which should
 	 * be used in real oops. This would cause something wrong after INIT.
 	 */
-	BREAK_LOGLEVEL(console_loglevel);
+	BREAK_LOGLEVEL();
 	ia64_mlogbuf_dump_from_init();
 
 	printk(KERN_ERR "Processes interrupted by INIT -");
@@ -1641,7 +1645,7 @@ default_monarch_init_process(struct notifier_block *self, unsigned long val, voi
 		read_unlock(&tasklist_lock);
 	}
 	/* FIXME: This will not restore zapped printk locks. */
-	RESTORE_LOGLEVEL(console_loglevel);
+	RESTORE_LOGLEVEL();
 	return NOTIFY_DONE;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL
  2019-01-07  9:54 [PATCH] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL Sergey Senozhatsky
@ 2019-01-07 13:26 ` kbuild test robot
  2019-01-07 14:48   ` Sergey Senozhatsky
  2019-01-07 14:52 ` [PATCHv2] " Sergey Senozhatsky
  1 sibling, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2019-01-07 13:26 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: kbuild-all, Tony Luck, Fenghua Yu, linux-ia64, linux-kernel,
	Sergey Senozhatsky

[-- Attachment #1: Type: text/plain, Size: 3101 bytes --]

Hi Sergey,

I love your patch! Yet something to improve:

[auto build test ERROR on ia64/next]
[also build test ERROR on v5.0-rc1]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Sergey-Senozhatsky/ia64-tweak-BREAK_LOGLEVEL-and-RESTORE_LOGLEVEL/20190107-191240
base:   https://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux.git next
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=8.1.0 make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   arch/ia64/kernel/mca.c: In function 'ia64_mlogbuf_finish':
>> arch/ia64/kernel/mca.c:195:20: error: '__console_loglevel' undeclared (first use in this function); did you mean 'console_loglevel'?
       loglevel_save = __console_loglevel; \
                       ^~~~~~~~~~~~~~~~~~
   arch/ia64/kernel/mca.c:294:2: note: in expansion of macro 'BREAK_LOGLEVEL'
     BREAK_LOGLEVEL();
     ^~~~~~~~~~~~~~
   arch/ia64/kernel/mca.c:195:20: note: each undeclared identifier is reported only once for each function it appears in
       loglevel_save = __console_loglevel; \
                       ^~~~~~~~~~~~~~~~~~
   arch/ia64/kernel/mca.c:294:2: note: in expansion of macro 'BREAK_LOGLEVEL'
     BREAK_LOGLEVEL();
     ^~~~~~~~~~~~~~
   arch/ia64/kernel/mca.c: In function 'default_monarch_init_process':
>> arch/ia64/kernel/mca.c:195:20: error: '__console_loglevel' undeclared (first use in this function); did you mean 'console_loglevel'?
       loglevel_save = __console_loglevel; \
                       ^~~~~~~~~~~~~~~~~~
   arch/ia64/kernel/mca.c:1623:2: note: in expansion of macro 'BREAK_LOGLEVEL'
     BREAK_LOGLEVEL();
     ^~~~~~~~~~~~~~

vim +195 arch/ia64/kernel/mca.c

43ed3baf Hidetoshi Seto     2006-09-26  189  
43ed3baf Hidetoshi Seto     2006-09-26  190  static int loglevel_save = -1;
5a53b9d7 Sergey Senozhatsky 2019-01-07  191  #define BREAK_LOGLEVEL()					\
5a53b9d7 Sergey Senozhatsky 2019-01-07  192  	do {							\
5a53b9d7 Sergey Senozhatsky 2019-01-07  193  		bust_spinlocks(1);				\
43ed3baf Hidetoshi Seto     2006-09-26  194  		if (loglevel_save < 0)				\
43ed3baf Hidetoshi Seto     2006-09-26 @195  			loglevel_save = __console_loglevel;	\
5a53b9d7 Sergey Senozhatsky 2019-01-07  196  		console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;	\
5a53b9d7 Sergey Senozhatsky 2019-01-07  197  	} while (0)
43ed3baf Hidetoshi Seto     2006-09-26  198  

:::::: The code at line 195 was first introduced by commit
:::::: 43ed3baf623410b3fa6ca14a9d3f6deca3493c56 [IA64] printing support for MCA/INIT

:::::: TO: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
:::::: CC: Tony Luck <tony.luck@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52363 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL
  2019-01-07 13:26 ` kbuild test robot
@ 2019-01-07 14:48   ` Sergey Senozhatsky
  0 siblings, 0 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2019-01-07 14:48 UTC (permalink / raw)
  To: kbuild test robot
  Cc: Sergey Senozhatsky, kbuild-all, Tony Luck, Fenghua Yu,
	linux-ia64, linux-kernel, Sergey Senozhatsky

On (01/07/19 21:26), kbuild test robot wrote:
> Hi Sergey,
> 
> I love your patch! Yet something to improve:

Well well well, guess who didn't compile test his patch; again.
Thanks for the report! I will fix it up and resend. Sorry!

	-ss

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCHv2] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL
  2019-01-07  9:54 [PATCH] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL Sergey Senozhatsky
  2019-01-07 13:26 ` kbuild test robot
@ 2019-01-07 14:52 ` Sergey Senozhatsky
  1 sibling, 0 replies; 4+ messages in thread
From: Sergey Senozhatsky @ 2019-01-07 14:52 UTC (permalink / raw)
  To: Tony Luck, Fenghua Yu
  Cc: linux-ia64, linux-kernel, Sergey Senozhatsky, Sergey Senozhatsky

From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>

a) Do not pass console_loglevel to macros, use console_loglevel directly.
b) Use CONSOLE_LOGLEVEL_MOTORMOUTH instead of a naked number
c) Use bust_spinlocks() to set/clear oops_in_progress
d) Fix checkpatch error: Macros with multiple statements should be
                         enclosed in a do - while loop

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
 arch/ia64/kernel/mca.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 91bd1e129379..940f34db97d3 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -188,19 +188,23 @@ static unsigned int mlogbuf_finished = 0;
 static unsigned long mlogbuf_timestamp = 0;
 
 static int loglevel_save = -1;
-#define BREAK_LOGLEVEL(__console_loglevel)		\
-	oops_in_progress = 1;				\
-	if (loglevel_save < 0)				\
-		loglevel_save = __console_loglevel;	\
-	__console_loglevel = 15;
-
-#define RESTORE_LOGLEVEL(__console_loglevel)		\
-	if (loglevel_save >= 0) {			\
-		__console_loglevel = loglevel_save;	\
-		loglevel_save = -1;			\
-	}						\
-	mlogbuf_finished = 0;				\
-	oops_in_progress = 0;
+#define BREAK_LOGLEVEL()					\
+	do {							\
+		bust_spinlocks(1);				\
+		if (loglevel_save < 0)				\
+			loglevel_save = console_loglevel;	\
+		console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;	\
+	} while (0)
+
+#define RESTORE_LOGLEVEL()					\
+	do {							\
+		if (loglevel_save >= 0) {			\
+			console_loglevel = loglevel_save;	\
+			loglevel_save = -1;			\
+		}						\
+		mlogbuf_finished = 0;				\
+		bust_spinlocks(0);				\
+	} while (0)
 
 /*
  * Push messages into buffer, print them later if not urgent.
@@ -287,7 +291,7 @@ EXPORT_SYMBOL(ia64_mlogbuf_dump);
  */
 static void ia64_mlogbuf_finish(int wait)
 {
-	BREAK_LOGLEVEL(console_loglevel);
+	BREAK_LOGLEVEL();
 
 	spin_lock_init(&mlogbuf_rlock);
 	ia64_mlogbuf_dump();
@@ -1616,7 +1620,7 @@ default_monarch_init_process(struct notifier_block *self, unsigned long val, voi
 	 * To enable show_stack from INIT, we use oops_in_progress which should
 	 * be used in real oops. This would cause something wrong after INIT.
 	 */
-	BREAK_LOGLEVEL(console_loglevel);
+	BREAK_LOGLEVEL();
 	ia64_mlogbuf_dump_from_init();
 
 	printk(KERN_ERR "Processes interrupted by INIT -");
@@ -1641,7 +1645,7 @@ default_monarch_init_process(struct notifier_block *self, unsigned long val, voi
 		read_unlock(&tasklist_lock);
 	}
 	/* FIXME: This will not restore zapped printk locks. */
-	RESTORE_LOGLEVEL(console_loglevel);
+	RESTORE_LOGLEVEL();
 	return NOTIFY_DONE;
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-07 14:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07  9:54 [PATCH] ia64: tweak BREAK_LOGLEVEL and RESTORE_LOGLEVEL Sergey Senozhatsky
2019-01-07 13:26 ` kbuild test robot
2019-01-07 14:48   ` Sergey Senozhatsky
2019-01-07 14:52 ` [PATCHv2] " Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).