Skip to contentSkip to conversation

kmsg macros and script.

RFC PATCH In review Martin Schwidefsky 5 participants 27 messages Jul 28, 2008 – Jul 30, 2008

Subsystems (6)
Documentation Kbuild Crypto API s390 +2 more subsystems
lore
Share & tools
lore
#0 lore raw

cover kmsg macros and script.

Greetings,
this is the next step of our project to document all s390 specific kernel messages. The message cleanup patches have been integrated into the upstream kernel. After we removed the meaningless messages it is now time to brush up the remaining messages.

The first patch introduces a new set of wrapper macros around printk. These macros add a prefix to each message and a message id can be specified. The second patch adds a script to help writing the kmsg comments that describe a kmsg and it can be used to write man pages for the documented messages. The remaining 13 patches convert some of the printk messages found in the s390 architecture files and some of the s390 device drivers to demonstrate how all this is supposed to work.

The code is currently only usable for s390. Should this be of interest to other architectures as well we have to think about where to put things. We'd be happy to get feedback on this.

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#1 lore raw

PATCH 1/15 kmsg: Kernel message catalog macros.

From: Michael Holzheu <[email protected]>
From: Martin Schwidefsky <[email protected]>

Introduce a new family of printk macros which prefixes each kmsg message with a component name and allows to tag the printk with a message id.

The kmsg component name is defined per source file with the KMSG_COMPONENT macro. The first argument of each kmsg printk is the message id. The message id "0" is special as it will suppress the message id prefix.

If the message id will be printed to the console / syslog at all depends on CONFIG_MSG_IDS. If it is "n" then a kmsg_xxx call is just another printk wrapper. These macros are intended to be used uniformly in the s390 architecture and the s390 device drivers.

---

 arch/s390/Kconfig       |    9 +++
 include/asm-s390/kmsg.h |  124 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+)
arch/s390/Kconfig +9 -0
Index: quilt-2.6/arch/s390/Kconfig
===================================================================
@@ -568,6 +568,15 @@ bool "s390 guest support (EXPERIMENTAL)"
 	select VIRTIO_CONSOLE
 	help
 	  Select this option if you want to run the kernel under s390 linux
+
+config KMSG_IDS
+	bool "Kernel message numbers"
+	default y
+	help
+	  Select this option if you want to include a message number to the
+	  prefix for kernel messages issued by the s390 architecture and
+	  driver code. See "Documentation/s390/kmsg.txt" for more details.
+
 endmenu
 
 source "net/Kconfig"
include/asm-s390/kmsg.h new file +124 -0

124 lines not on this page · raw message

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#2 lore raw

Re: [patch 01/15] kmsg: Kernel message catalog macros.

Quoted 2 lines · Martin Schwidefsky

The kmsg component name is defined per source file with the KMSG_COMPONENT macro.

Why not use KBUILD_MODNAME?

#3 lore raw

Re: [patch 01/15] kmsg: Kernel message catalog macros.

Quoted 5 lines · Joe Perches
Quoted 2 lines · Martin Schwidefsky

The kmsg component name is defined per source file with the KMSG_COMPONENT macro.

Why not use KBUILD_MODNAME?

Because sometimes we might want to use the same kmsg prefix for multiple modules. And the message tag is supposed to stay the same even if the code structure changes. I'd rather not use KBUILD_MODNAME.

Signature · 4 lines
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
#4 lore raw

Re: [patch 01/15] kmsg: Kernel message catalog macros.

In reply to Martin Schwidefsky
Quoted 12 lines · On Mon, 28 Jul 2008 19:53:56 +0200 Martin Schwidefsky <[email protected]>…

Introduce a new family of printk macros which prefixes each kmsg message with a component name and allows to tag the printk with a message id.

The kmsg component name is defined per source file with the KMSG_COMPONENT macro. The first argument of each kmsg printk is the message id. The message id "0" is special as it will suppress the message id prefix.

If the message id will be printed to the console / syslog at all depends on CONFIG_MSG_IDS. If it is "n" then a kmsg_xxx call is just another printk wrapper. These macros are intended to be used uniformly in the s390 architecture and the s390 device drivers.

Quoted 6 lines

---

 arch/s390/Kconfig       |    9 +++
 include/asm-s390/kmsg.h |  124 ++++++++++++++++++++++++++++++++++++++++++++++++

Numerous people want a facility like this for other-than-s390 use. Progress has been intermittent and appears to have stopped. The apparently-dead mailing list is archived here:
https://lists.linux-foundation.org/pipermail/lf_kernel_messages/.

I don't know what the future holds for that development effort, but the requirement won't go away. So one day someone is going to go and yank your implementation out of arch/s390 and into generic code.

So I'd suggest that you start out that way.

#5 lore raw

Re: [patch 01/15] kmsg: Kernel message catalog macros.

Quoted 11 lines · Andrew Morton

On Mon, 28 Jul 2008 19:53:56 +0200 Martin Schwidefsky <[email protected]> wrote:
Numerous people want a facility like this for other-than-s390 use. Progress has been intermittent and appears to have stopped. The apparently-dead mailing list is archived here:
https://lists.linux-foundation.org/pipermail/lf_kernel_messages/.

I don't know what the future holds for that development effort, but the requirement won't go away. So one day someone is going to go and yank your implementation out of arch/s390 and into generic code.

So I'd suggest that you start out that way.

Somehow I have hoped for an answer like that :-) The only thing that we'd have to do is find a proper place for the kmsg header file, include/linux/kmsg.h comes to mind. The kmsg-doc script can easily be change to check for multiple documentation directories, I was thinking about Documentation/kmsg/$ARCH for the architecture specific things and Documentation/kmsg for the generic parts.

Signature · 4 lines
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
#6 lore raw

Re: [patch 01/15] kmsg: Kernel message catalog macros.

Quoted 11 lines · On Wed, 30 Jul 2008 11:13:41 +0200 Martin Schwidefsky <[email protected]>…
Quoted 10 lines · Andrew Morton

On Mon, 28 Jul 2008 19:53:56 +0200 Martin Schwidefsky <[email protected]> wrote:
Numerous people want a facility like this for other-than-s390 use. Progress has been intermittent and appears to have stopped. The apparently-dead mailing list is archived here:
https://lists.linux-foundation.org/pipermail/lf_kernel_messages/.

I don't know what the future holds for that development effort, but the requirement won't go away. So one day someone is going to go and yank your implementation out of arch/s390 and into generic code.

Quoted 9 lines
Quoted 1 line

So I'd suggest that you start out that way.

Somehow I have hoped for an answer like that :-) The only thing that we'd have to do is find a proper place for the kmsg header file, include/linux/kmsg.h comes to mind. The kmsg-doc script can easily be change to check for multiple documentation directories, I was thinking about Documentation/kmsg/$ARCH for the architecture specific things and Documentation/kmsg for the generic parts.

No objections from me.

It would be wonderful if someone could troll those list archives and see if they can wake up the people who were involved in that effort. They probably won't help much with development but it would be useful if we could get their review/design input.

#7 lore raw

PATCH 2/15 kmsg: Kernel message catalog script.

In reply to Martin Schwidefsky

From: Michael Holzheu <[email protected]>
From: Martin Schwidefsky <[email protected]>

Add a script and the calls to the make process that allows to check the kmsg printk messages and to format man pages from the message descriptions.

The kmsg message description is a comment with the following format:

/*?
* Tag: <component>.<id>
* Text: "<kmsg message text>"
* Severity: <severity>
* Parameter:

 *   @1: <description of the first message parameter>
 *   @2: <description of the second message parameter>
 *   ...

* Description:
* <What is the kmsg message all about>
* User action:
* <What can the user do to fix the problem>
*/

The script looks for a kmsg comment for a kmsg printk at two places, the source file where the kmsg call is located and in the file Documentation/s390/kmsg/<component>.

The kmsg check is invoked with "make K=1" and reads the source files for all objects that are built by the current configuration and searches for matching kmsg descriptions for the kmsg messages in the source which have a messages id > 0. If a message description can not be found the script prints a blueprint and causes a make error.

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

---

 Makefile               |   16 ++
 scripts/Makefile.build |   15 ++
 scripts/kmsg-doc       |  358 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 389 insertions(+)
Makefile +16 -0
Index: quilt-2.6/Makefile
===================================================================
@@ -63,6 +63,20 @@ ifndef KBUILD_CHECKSRC
   KBUILD_CHECKSRC = 0
 endif
 
+# Call message checker as part of the C compilation
+#
+# Use 'make K=1' to enable checking
+# Use 'make K=2' to create the message catalog
+
+ifdef K
+  ifeq ("$(origin K)", "command line")
+    KBUILD_KMSG_CHECK = $(K)
+  endif
+endif
+ifndef KBUILD_KMSG_CHECK
+  KBUILD_KMSG_CHECK = 0
+endif
+
 # Use make M=dir to specify directory of external module to build
 # Old syntax make ... SUBDIRS=$PWD is still supported
 # Setting the environment variable KBUILD_EXTMOD take precedence
@@ -317,6 +331,7 @@ PERL		= perl
 CHECK		= sparse
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
+KMSG_CHECK	= $(srctree)/scripts/kmsg-doc
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
@@ -351,6 +366,7 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODU
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
 export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
+export KBUILD_KMSG_CHECK KMSG_CHECK
 
 # When compiling out-of-tree modules, put MODVERDIR in the module
 # tree rather than in the kernel tree. The kernel tree might
scripts/kmsg-doc new file +358 -0

358 lines not on this page · raw message

scripts/Makefile.build +15 -0
Index: quilt-2.6/scripts/Makefile.build
===================================================================
@@ -211,12 +211,14 @@ endef
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
+	$(call cmd,force_check_kmsg)
 	$(call if_changed_rule,cc_o_c)
 
 # Single-part modules are special since we need to mark them in $(MODVERDIR)
 
 $(single-used-m): $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
+	$(call cmd,force_check_kmsg)
 	$(call if_changed_rule,cc_o_c)
 	@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
 
@@ -339,6 +341,19 @@ $(multi-used-m) : %.o: $(multi-objs-m) F
 
 targets += $(multi-used-y) $(multi-used-m)
 
+# kmsg check tool
+ifneq ($(KBUILD_KMSG_CHECK),0)
+  ifeq ($(KBUILD_KMSG_CHECK),2)
+    kmsg_cmd = print
+    quiet_cmd_force_check_kmsg = KMSG_PRINT $<
+    $(shell [ -d $(objtree)/man ] || mkdir -p $(objtree)/man)
+  else
+    kmsg_cmd = check
+    quiet_cmd_force_check_kmsg = KMSG_CHECK $<
+  endif
+  cmd_force_check_kmsg = SRCTREE=$(srctree) OBJTREE=$(objtree) \
+			$(KMSG_CHECK) $(kmsg_cmd) $(CC) $(c_flags) $< ;
+endif
 
 # Descending
 # ---------------------------------------------------------------------------
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#8 lore raw

Re: [patch 02/15] kmsg: Kernel message catalog script.

Quoted 4 lines

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

Can we use M=2 instead of K=?
I have sort of reserved 'K' for Kconfig usage.

Quoted 26 lines

Index: quilt-2.6/scripts/Makefile.build
===================================================================

scripts/Makefile.build +5 -0
@@ -211,12 +211,14 @@ endef
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
+	$(call cmd,force_check_kmsg)
 	$(call if_changed_rule,cc_o_c)
 
 # Single-part modules are special since we need to mark them in $(MODVERDIR)
 
 $(single-used-m): $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
+	$(call cmd,force_check_kmsg)
 	$(call if_changed_rule,cc_o_c)
 	@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
 
@@ -339,6 +341,19 @@ $(multi-used-m) : %.o: $(multi-objs-m) F
 
 targets += $(multi-used-y) $(multi-used-m)
 
+# kmsg check tool
+ifneq ($(KBUILD_KMSG_CHECK),0)
+  ifeq ($(KBUILD_KMSG_CHECK),2)

scripts/Makefile.build $(multi-used-m) : %.o: $(multi-objs-m) F · line 356

Quoted 10 lines
scripts/Makefile.build +10 -0
+    kmsg_cmd = print
+    quiet_cmd_force_check_kmsg = KMSG_PRINT $<
+    $(shell [ -d $(objtree)/man ] || mkdir -p $(objtree)/man)
+  else
+    kmsg_cmd = check
+    quiet_cmd_force_check_kmsg = KMSG_CHECK $<
+  endif
+  cmd_force_check_kmsg = SRCTREE=$(srctree) OBJTREE=$(objtree) \
+			$(KMSG_CHECK) $(kmsg_cmd) $(CC) $(c_flags) $< ;
+endif

We are executing with $(objtree) as current directory so no need to specify $(objtree) in the above.

You can used non-recursive assignments for kmsg_cmd (use ':=').

Do you really need the uppercase SRCTREE, OBJTREE? Other scripts uses the lower cases variants direct.

Sam

#9 lore raw

Re: [patch 02/15] kmsg: Kernel message catalog script.

Quoted 6 lines · Sam Ravnborg
Quoted 4 lines

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

Can we use M=2 instead of K=?
I have sort of reserved 'K' for Kconfig usage.

Ok, K= is taken but I can't use M= either because that is used for KBUILD_EXTMOD. If tested with D= for "documentation", would that be okay ?

Quoted 4 lines
Quoted 4 lines
scripts/Makefile.build +0 -0
@@ -339,6 +341,19 @@ $(multi-used-m) : %.o: $(multi-objs-m) F
 
 targets += $(multi-used-y) $(multi-used-m)
 
Quoted 15 lines

scripts/Makefile.build $(multi-used-m) : %.o: $(multi-objs-m) F · line 356

Quoted 13 lines
scripts/Makefile.build +13 -0
+# kmsg check tool
+ifneq ($(KBUILD_KMSG_CHECK),0)
+  ifeq ($(KBUILD_KMSG_CHECK),2)
+    kmsg_cmd = print
+    quiet_cmd_force_check_kmsg = KMSG_PRINT $<
+    $(shell [ -d $(objtree)/man ] || mkdir -p $(objtree)/man)
+  else
+    kmsg_cmd = check
+    quiet_cmd_force_check_kmsg = KMSG_CHECK $<
+  endif
+  cmd_force_check_kmsg = SRCTREE=$(srctree) OBJTREE=$(objtree) \
+			$(KMSG_CHECK) $(kmsg_cmd) $(CC) $(c_flags) $< ;
+endif

We are executing with $(objtree) as current directory so no need to specify $(objtree) in the above.

Ok, dropped $(objtree) from the shell command.

Quoted 1 line

You can used non-recursive assignments for kmsg_cmd (use ':=').

Will do.

Quoted 2 lines

Do you really need the uppercase SRCTREE, OBJTREE? Other scripts uses the lower cases variants direct.

Ok, I'll fix the script to use srctree and objtree directly.

Thanks Sam.

Signature · 4 lines
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
#10 lore raw

Re: [patch 02/15] kmsg: Kernel message catalog script.

Quoted 10 lines · Martin Schwidefsky
Quoted 6 lines · Sam Ravnborg
Quoted 4 lines

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

Can we use M=2 instead of K=?
I have sort of reserved 'K' for Kconfig usage.

Ok, K= is taken but I can't use M= either because that is used for KBUILD_EXTMOD. If tested with D= for "documentation", would that be okay ?

D sounds fine with me.

Dunno what drugs I was on when I suggested M :-(

Sam

#11 lore raw

Re: [patch 02/15] kmsg: Kernel message catalog script.

Quoted 9 lines · Sam Ravnborg
Quoted 8 lines · Martin Schwidefsky
Quoted 6 lines · Sam Ravnborg
Quoted 4 lines

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

Can we use M=2 instead of K=?
I have sort of reserved 'K' for Kconfig usage.

Quoted 6 lines
Quoted 2 lines

Ok, K= is taken but I can't use M= either because that is used for KBUILD_EXTMOD. If tested with D= for "documentation", would that be okay ?

D sounds fine with me.

Dunno what drugs I was on when I suggested M :-(

Or not enough drugs: It is by caffeine alone I set my mind in motion, ..

The new patch with your proposed changes below. I still do not feel too comfortable with changing the main Makefiles, the kmsg-doc script currently only works for s390 and the D= option is added for all architectures. I was thinking about replacing the hardcoded s390 with $ARCH and keep the option to add the second path Documentation/kmsg for common code kmsgs if a miracle happens and they get used by common code. If that should happen the kmsg.h header would have to be moved out of asm-s390 as well. Makes sense?

Signature · 492 lines
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.

--
Subject: [PATCH] kmsg: Kernel message catalog script.

From: Michael Holzheu <[email protected]>
From: Martin Schwidefsky <[email protected]>

Add a script and the calls to the make process that allows to check the
kmsg printk messages and to format man pages from the message descriptions.

The kmsg message description is a comment with the following format:

/*?
 * Tag: <component>.<id>
 * Text: "<kmsg message text>"
 * Severity: <severity>
 * Parameter:
 *   @1: <description of the first message parameter>
 *   @2: <description of the second message parameter>
 *   ...
 * Description:
 * <What is the kmsg message all about>
 * User action:
 * <What can the user do to fix the problem>
 */

The script looks for a kmsg comment for a kmsg printk at two places,
the source file where the kmsg call is located and in the file
Documentation/s390/kmsg/<component>.

The kmsg check is invoked with "make K=1" and reads the source files for
all objects that are built by the current configuration and searches for
matching kmsg descriptions for the kmsg messages in the source which
have a messages id > 0. If a message description can not be found the
script prints a blueprint and causes a make error.

The kmsg man page creation is invoked with "make K=2" and reads the source
files for all built objects, looks up the message description and writes
a man page to $(objtree)/man.

Signed-off-by: Michael Holzheu <[email protected]>
Signed-off-by: Martin Schwidefsky <[email protected]>
---

 Makefile               |   16 ++
 scripts/Makefile.build |   14 +
 scripts/kmsg-doc       |  358 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 388 insertions(+)

diff -urpN linux-2.6/Makefile linux-2.6-patched/Makefile
--- linux-2.6/Makefile	2008-07-29 11:32:45.000000000 +0200
+++ linux-2.6-patched/Makefile	2008-07-29 11:33:06.000000000 +0200
@@ -63,6 +63,20 @@ ifndef KBUILD_CHECKSRC
   KBUILD_CHECKSRC = 0
 endif
 
+# Call message checker as part of the C compilation
+#
+# Use 'make D=1' to enable checking
+# Use 'make D=2' to create the message catalog
+
+ifdef D
+  ifeq ("$(origin D)", "command line")
+    KBUILD_KMSG_CHECK = $(D)
+  endif
+endif
+ifndef KBUILD_KMSG_CHECK
+  KBUILD_KMSG_CHECK = 0
+endif
+
 # Use make M=dir to specify directory of external module to build
 # Old syntax make ... SUBDIRS=$PWD is still supported
 # Setting the environment variable KBUILD_EXTMOD take precedence
@@ -321,6 +335,7 @@ PERL		= perl
 CHECK		= sparse
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF)
+KMSG_CHECK	= $(srctree)/scripts/kmsg-doc
 MODFLAGS	= -DMODULE
 CFLAGS_MODULE   = $(MODFLAGS)
 AFLAGS_MODULE   = $(MODFLAGS)
@@ -355,6 +370,7 @@ export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODU
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
 export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE
+export KBUILD_KMSG_CHECK KMSG_CHECK
 
 # When compiling out-of-tree modules, put MODVERDIR in the module
 # tree rather than in the kernel tree. The kernel tree might
diff -urpN linux-2.6/scripts/kmsg-doc linux-2.6-patched/scripts/kmsg-doc
--- linux-2.6/scripts/kmsg-doc	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6-patched/scripts/kmsg-doc	2008-07-29 11:33:06.000000000 +0200
@@ -0,0 +1,358 @@
+#!/usr/bin/perl -w
+#
+# kmsg kernel messages check and print tool.
+#
+# To check the source code for missing messages the script is called
+# with check, the name compiler and the compile parameters
+#	kmsg-doc check $(CC) $(c_flags) $<
+# To create man pages for the messages the script is called with
+#	kmsg-doc print $(CC) $(c_flags) $<
+#
+# Copyright IBM Corp. 2008
+# Author(s):  Martin Schwidefsky <[email protected]>
+#	      Michael Holzheu <[email protected]>
+#
+
+use Cwd;
+
+my $errors = 0;
+my $warnings = 0;
+my $srctree = "";
+my $objtree = "";
+my $kmsg_count = 0;
+
+sub add_kmsg_desc($$$$$$)
+{
+    my ($tag, $text, $sev, $argv, $desc, $user) = @_;
+
+    if ($kmsg_desc{$tag}) {
+	warn "Duplicate message with tag $tag\n";
+	$errors++;
+	return;
+    }
+    $text =~ s/\" \"//g; # remove ...
+    $kmsg_desc{$tag}->{'TEXT'} = $text;
+    $kmsg_desc{$tag}->{'SEV'} = $sev;
+    $kmsg_desc{$tag}->{'ARGV'} = $argv;
+    $kmsg_desc{$tag}->{'DESC'} = $desc;
+    $kmsg_desc{$tag}->{'USER'} = $user;
+}
+
+sub add_kmsg_print($$$$$)
+{
+    my ($component, $id, $text, $sev, $argv) = @_;
+    my ($tag, $count, $parm);
+
+    if ($id == 0) {
+	return;
+    }
+    $text =~ s/\\n//g; # remove trailing newline character
+    $text =~ s/\" \"//g; # remove ...
+    $text =~ s/$component:\s*//g;
+    $tag = $component . "." . $id;
+    # Pretty print severity
+    $sev =~ s/EMERG/Emerg/;
+    $sev =~ s/ALERT/Alert/;
+    $sev =~ s/CRIT/Critical/;
+    $sev =~ s/ERR/Error/;
+    $sev =~ s/WARNING/Warning/;
+    $sev =~ s/NOTICE/Notice/;
+    $sev =~ s/INFO/Informational/;
+    $sev =~ s/DEBUG/Debug/;
+    $kmsg_print{$kmsg_count}->{'TAG'} = $tag;
+    $kmsg_print{$kmsg_count}->{'TEXT'} = $text;
+    $kmsg_print{$kmsg_count}->{'SEV'} = $sev;
+    $kmsg_print{$kmsg_count}->{'ARGV'} = $argv;
+    $kmsg_count += 1;
+}
+
+sub process_source_file($)
+{
+    my $file = "@_";
+    my $state;
+    my $component = "";
+    my ($tag, $text, $sev, $argv, $desc, $user);
+
+    if (!open(FD, "$file")) {
+	return "";
+    }
+
+    $state = 0;
+    while (<FD>) {
+	chomp;
+	# kmsg message component: #define KMSG_COMPONENT "<id>"
+	if (/^#define\s+KMSG_COMPONENT\s+\"(.*)\"[^\"]*$/o) {
+	    $component = $1;
+	}
+	if ($state == 0) {
+	    # kmsg message start: '/*?'
+	    if (/^\s*\/\*\?\s*$/o) {
+		$state = 1;
+		($tag, $text, $sev, $argv, $desc, $user) = ( "", "", "", "", "", "" );
+	    }
+	} elsif ($state == 1) {
+	    # kmsg message tag: ' * Tag: <tag>'
+	    if (/^\s*\*\s*Tag:\s*(\S*)\s*$/o) {
+		$tag = $1;
+	    }
+	    # kmsg message text: ' * Text: "<message>"'
+	    elsif (/^\s*\*\s*Text:\s*\"(.*)\"\s*$/o) {
+		$text = $1;
+	    }
+	    # kmsg message severity: ' * Severity: <sev>'
+	    elsif (/^\s*\*\s*Severity:\s*(\S*)\s*$/o) {
+		$sev = $1;
+	    }
+	    # kmsg message parameter: ' * Parameter: <argv>'
+	    elsif (/^\s*\*\s*Parameter:\s*(\S*)\s*$/o) {
+		if (!defined($1)) {
+		    $argv = "";
+		} else {
+		    $argv = $1;
+		}
+		$state = 2;
+	    }
+	    # kmsg message description start: ' * Description:'
+	    elsif (/^\s*\*\s*Description:\s*(\S*)\s*$/o) {
+		if (!defined($1)) {
+		    $desc = "";
+		} else {
+		    $desc = $1;
+		}
+		$state = 3;
+	    }
+	    # kmsg has unrecognizable lines
+	    else {
+		warn "Warning(${file}:$.): Cannot understand $_";
+		$warnings++;
+		$state = 0;
+	    }
+	} elsif ($state == 2) {
+	    # kmsg message end: ' */'
+	    if (/^\s*\*\//o) {
+		warn "Warning(${file}:$.): Missing description, skipping message";
+		$warnings++;
+		$state = 0;
+	    }
+	    # kmsg message description start: ' * Description:'
+	    elsif (/^\s*\*\s*Description:\s*$/o) {
+		$desc = $1;
+		$state = 3;
+	    }
+	    # kmsg message parameter line: ' * <argv>'
+	    elsif (/^\s*\*(.*)$/o) {
+		$argv .= "\n" . $1;
+	    } else {
+		warn "Warning(${file}:$.): Cannot understand $_";
+		$warnings++;
+		$state = 0;
+	    }
+	} elsif ($state == 3) {
+	    # kmsg message end: ' */'
+	    if (/^\s*\*\/\s*/o) {
+		add_kmsg_desc($tag, $text, $sev, $argv, $desc, $user);
+		$state = 0;
+	    }
+	    # kmsg message description start: ' * User action:'
+	    elsif (/^\s*\*\s*User action:\s*$/o) {
+		$user = $1;
+		$state = 4;
+	    }
+	    # kmsg message description line: ' * <text>'
+	    elsif (/^\s*\*\s*(.*)$/o) {
+		$desc .= "\n" . $1;
+	    } else {
+		warn "Warning(${file}:$.): Cannot understand $_";
+		$warnings++;
+		$state = 0;
+	    }
+	} elsif ($state == 4) {
+	    # kmsg message end: ' */'
+	    if (/^\s*\*\/\s*/o) {
+		add_kmsg_desc($tag, $text, $sev, $argv, $desc, $user);
+		$state = 0;
+	    }
+	    # kmsg message user action line: ' * <text>'
+	    elsif (/^\s*\*\s*(.*)$/o) {
+		$user .= "\n" . $1;
+	    } else {
+		warn "Warning(${file}:$.): Cannot understand $_";
+		$warnings++;
+		$state = 0;
+	    }
+	}
+    }
+    return $component;
+}
+
+sub process_cpp_file($$$$)
+{
+    my ($cc, $options, $file, $component) = @_;
+
+    open(FD, "$cc $gcc_options|") or die ("Preprocessing failed.");
+
+    while (<FD>) {
+	chomp;
+	if (/.*printk\(\s*__KMSG_CHECK\s*\(([^,]*)\,\s*(\d+)\s*\)\s*\"(.*)\"\s*,\s*(.*)\s*\)/o) {
+	    if ($component ne "") {
+		add_kmsg_print($component, $2, $3, $1, $4)
+	    } else {
+		warn "Error(${file}:$.): kmsg without component\n";
+		$errors++;
+	    }
+	} elsif (/.*printk\(\s*__KMSG_CHECK\s*\(([^,]*)\,\s*(\d+)\s*\)\s*\"(.*)\"\s*(.*)\s*\)/o) {
+	    if ($component ne "") {
+		add_kmsg_print($component, $2, $3, $1, $4)
+	    } else {
+		warn "Error(${file}:$.): kmsg without component\n";
+		$errors++;
+	    }
+	}
+    }
+}
+
+sub check_messages($)
+{
+    my $component = "@_";
+    my $failed = 0;
+
+    for ($i = 0; $i < $kmsg_count; $i++) {
+	$tag = $kmsg_print{$i}->{'TAG'};
+	if (!defined($kmsg_desc{$tag})) {
+	    add_kmsg_desc($tag,
+			  $kmsg_print{$i}->{'TEXT'},
+			  $kmsg_print{$i}->{'SEV'},
+			  $kmsg_print{$i}->{'ARGV'},
+			  "Please insert description here",
+			  "What is the user supposed to do");
+	    $kmsg_desc{$tag}->{'CHECK'} = 1;
+	    $failed = 1;
+	    warn "$component: Missing description for: $tag\n";
+	    $errors++;
+	    next;
+	}
+	if ($kmsg_print{$i}->{'TEXT'} ne $kmsg_desc{$tag}->{'TEXT'}) {
+	    warn "$component: format string mismatch for: $tag\n";
+	    warn "  --- $kmsg_print{$i}->{'TEXT'}\n";
+	    warn "  +++ $kmsg_desc{$tag}->{'TEXT'}\n";
+	    $errors++;
+	}
+    }
+    return $failed;
+}
+
+sub print_templates()
+{
+    print "Templates for missing messages:\n";
+    @tags = keys %kmsg_desc;
+    @nums = ();
+    for (@tags) {
+	push @nums, /\.(\d+)/;
+    }
+    foreach $tag (@tags[ sort { $nums[$a] <=> $nums[$b] } 0..$#tags ]) {
+	if (!defined($kmsg_desc{$tag}->{'CHECK'})) {
+	    next;
+	}
+	print "/*?\n";
+	print " * Tag: $tag\n";
+	print " * Text: \"$kmsg_desc{$tag}->{'TEXT'}\"\n";
+	print " * Severity: $kmsg_desc{$tag}->{'SEV'}\n";
+	$argv = $kmsg_desc{$tag}->{'ARGV'};
+	if ($argv ne "") {
+	    print " * Parameter:\n";
+	    @parms = split(/\s*,\s*/,$kmsg_desc{$tag}->{'ARGV'});
+	    $count = 0;
+	    foreach $parm (@parms) {
+		$count += 1;
+		if (!($parm eq "")) {
+		    print " *   \@$count: $parm\n";
+		}
+	    }
+	}
+	print " * Description:\n";
+	print " * $kmsg_desc{$tag}->{'DESC'}\n";
+	print " * User action:\n";
+	print " * $kmsg_desc{$tag}->{'USER'}\n";
+	print " */\n\n";
+    }
+}
+
+sub write_man_pages()
+{
+    my $file;
+
+    foreach $tag (keys(%kmsg_desc)) {
+	if (defined($kmsg_desc{$tag}->{'CHECK'})) {
+	    next;
+	}
+	$file = $objtree . "man/" . $tag;
+	if (!open(WR, ">$file")) {
+	    warn "Error: Cannot open file $file\n";
+	    $errors++;
+	    return;
+	}
+	print WR ".TH \"$tag\" 9 \"Linux Messages\" LINUX\n";
+	print WR ".SH Message\n";
+	print WR $tag . ": " . $kmsg_desc{$tag}->{'TEXT'} . "\n";
+	print WR ".SH Severity\n";
+	print WR "$kmsg_desc{$tag}->{'SEV'}\n";
+	$argv = $kmsg_desc{$tag}->{'ARGV'};
+	if ($argv ne "") {
+	    print WR ".SH Parameters\n";
+	    @parms = split(/,/,$kmsg_desc{$tag}->{'ARGV'});
+	    map{s/\s*//} @parms;
+	    foreach $parm (@parms) {
+		$parm =~ s/^\s+//;
+		if (!($parm eq "")) {
+		    print WR "$parm\n";
+		}
+	    }
+	}
+	print WR ".SH Description";
+	print WR "$kmsg_desc{$tag}->{'DESC'}\n";
+	$user = $kmsg_desc{$tag}->{'USER'};
+	if ($user ne "") {
+	    print WR ".SH User action";
+	    print WR "$user\n";
+	}
+    }
+}
+
+if (defined($ENV{'srctree'})) {
+    $srctree = "$ENV{'srctree'}" . "/";
+} else {
+    $srctree = getcwd;
+}
+
+if (defined($ENV{'objtree'})) {
+    $objtree = "$ENV{'objtree'}" . "/";
+} else {
+    $objtree = getcwd;
+}
+
+$option = shift;
+
+$cc = shift;
+$gcc_options = "-E -D __KMSG_CHECKER ";
+foreach $tmp (@ARGV) {
+    $tmp =~ s/\(/\\\(/;
+    $tmp =~ s/\)/\\\)/;
+    $gcc_options .= " $tmp";
+    $filename = $tmp;
+}
+
+$component = process_source_file($filename);
+if ($component ne "") {
+    process_source_file($srctree . "Documentation/s390/kmsg/" . $component);
+}
+
+if ($option eq "check") {
+    process_cpp_file($cc, $gcc_options, $filename, $component);
+    if (check_messages($component)) {
+	print_templates();
+    }
+} elsif ($option eq "print") {
+    write_man_pages();
+}
+
+exit($errors);
diff -urpN linux-2.6/scripts/Makefile.build linux-2.6-patched/scripts/Makefile.build
--- linux-2.6/scripts/Makefile.build	2008-07-13 23:51:29.000000000 +0200
+++ linux-2.6-patched/scripts/Makefile.build	2008-07-29 11:33:06.000000000 +0200
@@ -211,12 +211,14 @@ endef
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
+	$(call cmd,force_check_kmsg)
 	$(call if_changed_rule,cc_o_c)
 
 # Single-part modules are special since we need to mark them in $(MODVERDIR)
 
 $(single-used-m): $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
+	$(call cmd,force_check_kmsg)
 	$(call if_changed_rule,cc_o_c)
 	@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
 
@@ -339,6 +341,18 @@ $(multi-used-m) : %.o: $(multi-objs-m) F
 
 targets += $(multi-used-y) $(multi-used-m)
 
+# kmsg check tool
+ifneq ($(KBUILD_KMSG_CHECK),0)
+  ifeq ($(KBUILD_KMSG_CHECK),2)
+    kmsg_cmd := print
+    quiet_cmd_force_check_kmsg = KMSG_PRINT $<
+    $(shell [ -d $(objtree)/man ] || mkdir -p $(objtree)/man)
+  else
+    kmsg_cmd := check
+    quiet_cmd_force_check_kmsg = KMSG_CHECK $<
+  endif
+  cmd_force_check_kmsg = $(KMSG_CHECK) $(kmsg_cmd) $(CC) $(c_flags) $< ;
+endif
 
 # Descending
 # ---------------------------------------------------------------------------
#12 lore raw

Re: [patch 02/15] kmsg: Kernel message catalog script.

Hi Martin,

I think the changelog needs fixing, too:

2008/7/29 Martin Schwidefsky <[email protected]>:

Quoted 9 lines

The kmsg check is invoked with "make K=1" and reads the source files for all objects that are built by the current configuration and searches for matching kmsg descriptions for the kmsg messages in the source which have a messages id > 0. If a message description can not be found the script prints a blueprint and causes a make error.

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

This should be "D=1" and "D=2" now, shouldn't it?

I hope this helps,
Jochen

Signature · 1 line
http://seehuhn.de/
#13 lore raw

Re: [patch 02/15] kmsg: Kernel message catalog script.

Quoted 11 lines · Jochen Voß

Hi Martin,

I think the changelog needs fixing, too:

2008/7/29 Martin Schwidefsky <[email protected]>:

Quoted 6 lines

The kmsg check is invoked with "make K=1" and reads the source files for all objects that are built by the current configuration and searches for matching kmsg descriptions for the kmsg messages in the source which have a messages id > 0. If a message description can not be found the script prints a blueprint and causes a make error.

Quoted 4 lines
Quoted 3 lines

The kmsg man page creation is invoked with "make K=2" and reads the source files for all built objects, looks up the message description and writes a man page to $(objtree)/man.

This should be "D=1" and "D=2" now, shouldn't it?

Yes, indeed. Thanks.

Signature · 4 lines
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.
#14 lore raw

PATCH 3/15 kmsg: convert cio message to kmsg api.

In reply to Martin Schwidefsky

From: Michael Ernst <[email protected]>

---

 Documentation/s390/kmsg/cio  |   97 +++++++++++++++++++++++++++++++++++++++++++
 drivers/s390/cio/blacklist.c |   14 +++---
 drivers/s390/cio/chsc.c      |    9 ++-
 drivers/s390/cio/cio.c       |    5 +-
 drivers/s390/cio/cmf.c       |    8 ++-
 drivers/s390/cio/css.c       |    7 ++-
 6 files changed, 126 insertions(+), 14 deletions(-)
Documentation/s390/kmsg/cio new file +97 -0
Index: quilt-2.6/Documentation/s390/kmsg/cio
===================================================================
@@ -0,0 +1,97 @@
+/*?
+ * Tag: cio.1
+ * Text: "%s is not a valid device for the cio_ignore kernel parameter"
+ * Severity: Warning
+ * Parameter:
+ *   @1: device bus-ID
+ * Description:
+ * The device specification for the cio_ignore kernel parameter is
+ * syntactically incorrect or specifies an unknown device. This device is not
+ * excluded from being sensed and analyzed.
+ * User action:
+ * Correct your device specification in the kernel parameter line to have the
+ * device excluded when you next reboot Linux. You can write the correct
+ * device specification to /proc/cio_ignore to add the device to the list of
+ * devices to be excluded. This does not immediately make the device
+ * inaccessible but the device is ignored if it disappears and later reappears.
+ */
+
+/*?
+ * Tag: cio.2
+ * Text: "0.%x.%04x to 0.%x.%04x is not a valid range for cio_ignore"
+ * Severity: Warning
+ * Parameter:
+ *   @1: from subchannel set ID
+ *   @2: from device number
+ *   @3: to subchannel set ID
+ *   @4: to device number
+ * Description:
+ * The device range specified for the cio_ignore kernel parameter is
+ * syntactically incorrect. No devices specified with this range are
+ * excluded from being sensed and analyzed.
+ * User action:
+ * Correct your range specification in the kernel parameter line to have the
+ * range of devices  excluded when you next reboot Linux. You can write the
+ * correct range specification to /proc/cio_ignore to add the range of devices
+ * to the list of devices to be excluded. This does not immediately make the
+ * devices in the range inaccessible but any of these devices are ignored if
+ * they disappear and later reappear.
+ */
+
+/*?
+ * Tag: cio.3
+ * Text: "Processing %s for channel path %x.%02x"
+ * Severity: Notice
+ * Parameter:
+ *   @1: configuration change
+ *   @2: channel subsystem ID
+ *   @3: CHPID
+ * Description:
+ * A configuration change is in progress for the given channel path.
+ * User action:
+ * None.
+ */
+
+/*?
+ * Tag: cio.4
+ * Text: "No CCW console was found"
+ * Severity: Warning
+ * Description:
+ * Linux did not find the expected CCW console and tries to use an alternative
+ * console. A possible reason why the console was not found is that the console
+ * has been specified in the cio_ignore list.
+ * User action:
+ * None, if an appropriate alternative console has been found, and you want
+ * to use this alternative console. If you want to use the CCW console, ensure
+ * that is not specified in the cio_ignore list, explicitly specify the console
+ * with the 'condev=' kernel parameter, and reboot Linux.
+ */
+
+/*?
+ * Tag: cio.5
+ * Text: "Channel measurement facility initialized using format %s (mode %s)"
+ * Severity: Informational
+ * Parameter:
+ *   @1: format
+ *   @2: mode
+ * Description:
+ * The channel measurement facility has been initialized successfully. Format
+ * 'extended' should be used for z990 and later mainframe systems. Format
+ * 'basic' is intended for earlier mainframes. Mode 'autodetected' means that
+ * the format has been set automatically. Mode 'parameter' means that the
+ * format has been set according to the 'format=' kernel parameter.
+ * User action:
+ * None.
+ */
+
+/*?
+ * Tag: cio.6
+ * Text: "The CSS device driver initialization failed with errno=%d"
+ * Severity: Alert
+ * Parameter:
+ *   @1: Return code
+ * Description:
+ * The channel subsystem bus could not be established.
+ * User action:
+ * See the errno man page to find out what caused the problem.
+ */
drivers/s390/cio/blacklist.c +9 -5
Index: quilt-2.6/drivers/s390/cio/blacklist.c
===================================================================
@@ -19,12 +19,15 @@
 
 #include <asm/cio.h>
 #include <asm/uaccess.h>
+#include <asm/kmsg.h>
 
 #include "blacklist.h"
 #include "cio.h"
 #include "cio_debug.h"
 #include "css.h"
 
+#define KMSG_COMPONENT "cio"
+
 /*
  * "Blacklisting" of certain devices:
  * Device numbers given in the commandline as cio_ignore=... won't be known
@@ -49,9 +52,10 @@ static int blacklist_range(range_action 
 {
 	if ((from_ssid > to_ssid) || ((from_ssid == to_ssid) && (from > to))) {
 		if (msgtrigger)
-			printk(KERN_WARNING "cio: Invalid cio_ignore range "
-			       "0.%x.%04x-0.%x.%04x\n", from_ssid, from,
-			       to_ssid, to);
+			kmsg_warn(2, "0.%x.%04x to 0.%x.%04x is not a valid "
+				  "range for cio_ignore\n", from_ssid, from,
+				  to_ssid, to);
+
 		return 1;
 	}
 
@@ -139,8 +143,8 @@ static int parse_busid(char *str, unsign
 	rc = 0;
 out:
 	if (rc && msgtrigger)
-		printk(KERN_WARNING "cio: Invalid cio_ignore device '%s'\n",
-		       str);
+		kmsg_warn(1, "%s is not a valid device for the cio_ignore "
+			  "kernel parameter\n", str);
 
 	return rc;
 }
drivers/s390/cio/chsc.c +6 -3
Index: quilt-2.6/drivers/s390/cio/chsc.c
===================================================================
@@ -16,7 +16,7 @@
 #include <asm/cio.h>
 #include <asm/chpid.h>
 #include <asm/chsc.h>
-
+#include <asm/kmsg.h>
 #include "../s390mach.h"
 #include "css.h"
 #include "cio.h"
@@ -25,6 +25,8 @@
 #include "chp.h"
 #include "chsc.h"
 
+#define KMSG_COMPONENT "cio"
+
 static void *sei_page;
 
 /**
@@ -333,6 +335,7 @@ static void chsc_process_sei_chp_config(
 	struct chp_config_data *data;
 	struct chp_id chpid;
 	int num;
+	char *events[3] = {"configure", "deconfigure", "cancel deconfigure"};
 
 	CIO_CRW_EVENT(4, "chsc: channel-path-configuration notification\n");
 	if (sei_area->rs != 0)
@@ -343,8 +346,8 @@ static void chsc_process_sei_chp_config(
 		if (!chp_test_bit(data->map, num))
 			continue;
 		chpid.id = num;
-		printk(KERN_WARNING "cio: processing configure event %d for "
-		       "chpid %x.%02x\n", data->op, chpid.cssid, chpid.id);
+		kmsg_notice(3, "Processing %s for channel path %x.%02x\n",
+			    events[data->op], chpid.cssid, chpid.id);
 		switch (data->op) {
 		case 0:
 			chp_cfg_schedule(chpid, 1);
drivers/s390/cio/cio.c +4 -1
Index: quilt-2.6/drivers/s390/cio/cio.c
===================================================================
@@ -27,6 +27,7 @@
 #include <asm/isc.h>
 #include <asm/cpu.h>
 #include <asm/fcx.h>
+#include <asm/kmsg.h>
 #include "cio.h"
 #include "css.h"
 #include "chsc.h"
@@ -37,6 +38,8 @@
 #include "chp.h"
 #include "../s390mach.h"
 
+#define KMSG_COMPONENT "cio"
+
 debug_info_t *cio_debug_msg_id;
 debug_info_t *cio_debug_trace_id;
 debug_info_t *cio_debug_crw_id;
@@ -770,7 +773,7 @@ cio_probe_console(void)
 	sch_no = cio_get_console_sch_no();
 	if (sch_no == -1) {
 		console_subchannel_in_use = 0;
-		printk(KERN_WARNING "cio: No ccw console found!\n");
+		kmsg_warn(4, "No CCW console was found\n");
 		return ERR_PTR(-ENODEV);
 	}
 	memset(&console_subchannel, 0, sizeof(struct subchannel));
drivers/s390/cio/cmf.c +5 -3
Index: quilt-2.6/drivers/s390/cio/cmf.c
===================================================================
@@ -38,6 +38,7 @@
 #include <asm/cio.h>
 #include <asm/cmb.h>
 #include <asm/div64.h>
+#include <asm/kmsg.h>
 
 #include "cio.h"
 #include "css.h"
@@ -45,6 +46,8 @@
 #include "ioasm.h"
 #include "chsc.h"
 
+#define KMSG_COMPONENT "cio"
+
 /*
  * parameter to enable cmf during boot, possible uses are:
  *  "s390cmf" -- enable cmf and allocate 2 MB of ram so measuring can be
@@ -1359,9 +1362,8 @@ static int __init init_cmf(void)
 	default:
 		return 1;
 	}
-
-	printk(KERN_INFO "cio: Channel measurement facility using %s "
-	       "format (%s)\n", format_string, detect_string);
+	kmsg_info(5, "Channel measurement facility initialized using format "
+		  "%s (mode %s)\n", format_string, detect_string);
 	return 0;
 }
 
drivers/s390/cio/css.c +5 -2
Index: quilt-2.6/drivers/s390/cio/css.c
===================================================================
@@ -14,6 +14,7 @@
 #include <linux/list.h>
 #include <linux/reboot.h>
 #include <asm/isc.h>
+#include <asm/kmsg.h>
 
 #include "../s390mach.h"
 #include "css.h"
@@ -25,6 +26,8 @@
 #include "idset.h"
 #include "chp.h"
 
+#define KMSG_COMPONENT "cio"
+
 int css_init_done = 0;
 static int need_reprobe = 0;
 static int max_ssid = 0;
@@ -841,8 +844,8 @@ out:
 	s390_unregister_crw_handler(CRW_RSC_CSS);
 	chsc_free_sei_area();
 	kfree(slow_subchannel_set);
-	printk(KERN_WARNING"cio: failed to initialize css driver (%d)!\n",
-	       ret);
+	kmsg_alert(6, "The CSS device driver initialization failed with "
+		   "errno=%d\n", ret);
 	return ret;
 }
 
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#15 lore raw

PATCH 4/15 kmsg: convert vmcp to kmsg api.

In reply to Martin Schwidefsky

From: Christian Borntraeger <[email protected]>

---

 Documentation/s390/kmsg/vmcp |   15 +++++++++++++++
 drivers/s390/char/vmcp.c     |    6 ++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
Documentation/s390/kmsg/vmcp new file +15 -0
Index: quilt-2.6/Documentation/s390/kmsg/vmcp
===================================================================
@@ -0,0 +1,15 @@
+/*?
+ * Tag: vmcp.1
+ * Text: "The z/VM CP interface device driver cannot be loaded without z/VM"
+ * Severity: Warning
+ * Description:
+ * With the z/VM CP interface you can issue z/VM CP commands from a Linux
+ * terminal session. On Linux instances that run in environments other than
+ * the z/VM hypervisor, the z/VM CP interface does not provide any useful
+ * function and the corresponding vmcp device driver cannot be loaded.
+ * User action:
+ * Load the vmcp device driver only on Linux instances that run as guest
+ * operating systems of the z/VM hypervisor. If the device driver has been
+ * compiled into the kernel, ignore this message.
+ */
+
drivers/s390/char/vmcp.c +4 -2
Index: quilt-2.6/drivers/s390/char/vmcp.c
===================================================================
@@ -19,6 +19,7 @@
 #include <linux/smp_lock.h>
 #include <asm/cpcmd.h>
 #include <asm/debug.h>
+#include <asm/kmsg.h>
 #include <asm/uaccess.h>
 #include "vmcp.h"
 
@@ -26,7 +27,7 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Christian Borntraeger <[email protected]>");
 MODULE_DESCRIPTION("z/VM CP interface");
 
-#define PRINTK_HEADER "vmcp: "
+#define KMSG_COMPONENT "vmcp"
 
 static debug_info_t *vmcp_debug;
 
@@ -193,7 +194,8 @@ static int __init vmcp_init(void)
 	int ret;
 
 	if (!MACHINE_IS_VM) {
-		PRINT_WARN("z/VM CP interface is only available under z/VM\n");
+		kmsg_warn(1, "The z/VM CP interface device driver cannot be "
+			     "loaded without z/VM\n");
 		return -ENODEV;
 	}
 
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#16 lore raw

PATCH 5/15 kmsg: convert cpcmd to kmsg api.

In reply to Martin Schwidefsky

From: Christian Borntraeger <[email protected]>

---

 Documentation/s390/kmsg/cpcmd |   18 ++++++++++++++++++
 arch/s390/kernel/cpcmd.c      |    7 +++++--
 2 files changed, 23 insertions(+), 2 deletions(-)
arch/s390/kernel/cpcmd.c +5 -2
Index: quilt-2.6/arch/s390/kernel/cpcmd.c
===================================================================
@@ -15,9 +15,12 @@
 #include <linux/string.h>
 #include <asm/ebcdic.h>
 #include <asm/cpcmd.h>
+#include <asm/kmsg.h>
 #include <asm/system.h>
 #include <asm/io.h>
 
+#define KMSG_COMPONENT "cpcmd"
+
 static DEFINE_SPINLOCK(cpcmd_lock);
 static char cpcmd_buf[241];
 
@@ -104,8 +107,8 @@ int cpcmd(const char *cmd, char *respons
 			(((unsigned long)response + rlen) >> 31)) {
 		lowbuf = kmalloc(rlen, GFP_KERNEL | GFP_DMA);
 		if (!lowbuf) {
-			printk(KERN_WARNING
-				"cpcmd: could not allocate response buffer\n");
+			kmsg_warn(1, "The cpcmd kernel function failed to "
+				     "allocate a response buffer\n");
 			return -ENOMEM;
 		}
 		spin_lock_irqsave(&cpcmd_lock, flags);
Documentation/s390/kmsg/cpcmd new file +18 -0
Index: quilt-2.6/Documentation/s390/kmsg/cpcmd
===================================================================
@@ -0,0 +1,18 @@
+/*?
+ * Text: "The cpcmd kernel function failed to allocate a response buffer"
+ * Tag: cpcmd.1
+ * Severity: Warning
+ * Description:
+ * IPL code, console detection, and device drivers like vmcp or vmlogrdr use
+ * the cpcmd kernel function to send commands to the z/VM control program (CP).
+ * If a program that uses the cpcmd function does not allocate a contiguous
+ * response buffer below 2 GB guest real storage, cpcmd creates a bounce buffer
+ * to be used as the response buffer. Because of low memory or memory
+ * fragmentation, cpcmd could not create the bounce buffer.
+ * User action:
+ * Look for related page allocation failure messages and at the stack trace to
+ * find out which program or operation failed. Free some memory and retry the
+ * failed operation. Consider allocating more memory to your z/VM guest virtual
+ * machine.
+ */
+
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#17 lore raw

PATCH 6/15 kmsg: convert vmur to kmsg api.

In reply to Martin Schwidefsky

From: Frank Munzert <[email protected]>

---

 Documentation/s390/kmsg/vmur |   33 +++++++++++++++++++++++++++++++++
 drivers/s390/char/vmur.c     |   13 ++++++++-----
 2 files changed, 41 insertions(+), 5 deletions(-)
Documentation/s390/kmsg/vmur new file +33 -0
Index: quilt-2.6/Documentation/s390/kmsg/vmur
===================================================================
@@ -0,0 +1,33 @@
+/*?
+ * Tag: vmur.1
+ * Text: "The %s cannot be loaded without z/VM"
+ * Severity: Error
+ * Parameter:
+ *   @1: z/VM virtual unit record device driver
+ * Description:
+ * The z/VM virtual unit record device driver provides Linux with access to
+ * z/VM virtual unit record devices like punch card readers, card punches, and
+ * line printers. On Linux instances that run in environments other than the
+ * z/VM hypervisor, the device driver does not provide any useful function and
+ * the corresponding vmur module cannot be loaded.
+ * User action:
+ * Load the vmur module only on Linux instances that run as guest operating
+ * systems of the z/VM hypervisor. If the z/VM virtual unit record device
+ * has been compiled into the kernel, ignore this message.
+ */
+
+/*?
+ * Tag: vmur.2
+ * Text: "Kernel function alloc_chrdev_region failed with error code %d"
+ * Severity: Error
+ * Parameter:
+ *   @1: error code according to errno definitions
+ * Description:
+ * The z/VM virtual unit record device driver (vmur) needs to register a range
+ * of character device minor numbers from 0x0000 to 0xffff.
+ * This registration failed, probably because of memory constraints.
+ * User action:
+ * Free some memory and reload the vmur module. If the z/VM virtual unit
+ * record device driver has been compiled into the kernel reboot Linux.
+ * Consider assigning more memory to your LPAR or z/VM guest virtual machine.
+ */
drivers/s390/char/vmur.c +8 -5
Index: quilt-2.6/drivers/s390/char/vmur.c
===================================================================
@@ -16,6 +16,7 @@
 #include <asm/ccwdev.h>
 #include <asm/debug.h>
 #include <asm/diag.h>
+#include <asm/kmsg.h>
 
 #include "vmur.h"
 
@@ -40,7 +41,7 @@ MODULE_AUTHOR("IBM Corporation");
 MODULE_DESCRIPTION("s390 z/VM virtual unit record device driver");
 MODULE_LICENSE("GPL");
 
-#define PRINTK_HEADER "vmur: "
+#define KMSG_COMPONENT "vmur"
 
 static dev_t ur_first_dev_maj_min;
 static struct class *vmur_class;
@@ -988,7 +989,8 @@ static int __init ur_init(void)
 	dev_t dev;
 
 	if (!MACHINE_IS_VM) {
-		PRINT_ERR("%s is only available under z/VM.\n", ur_banner);
+		kmsg_err(1, "The %s cannot be loaded without z/VM\n",
+			 ur_banner);
 		return -ENODEV;
 	}
 
@@ -1007,7 +1009,8 @@ static int __init ur_init(void)
 
 	rc = alloc_chrdev_region(&dev, 0, NUM_MINORS, "vmur");
 	if (rc) {
-		PRINT_ERR("alloc_chrdev_region failed: err = %d\n", rc);
+		kmsg_err(2, "Kernel function alloc_chrdev_region failed with "
+			 "error code %d\n", rc);
 		goto fail_unregister_driver;
 	}
 	ur_first_dev_maj_min = MKDEV(MAJOR(dev), 0);
@@ -1017,7 +1020,7 @@ static int __init ur_init(void)
 		rc = PTR_ERR(vmur_class);
 		goto fail_unregister_region;
 	}
-	PRINT_INFO("%s loaded.\n", ur_banner);
+	kmsg_info(0, "%s loaded.\n", ur_banner);
 	return 0;
 
 fail_unregister_region:
@@ -1035,7 +1038,7 @@ static void __exit ur_exit(void)
 	unregister_chrdev_region(ur_first_dev_maj_min, NUM_MINORS);
 	ccw_driver_unregister(&ur_driver);
 	debug_unregister(vmur_dbf);
-	PRINT_INFO("%s unloaded.\n", ur_banner);
+	kmsg_info(0, "%s unloaded.\n", ur_banner);
 }
 
 module_init(ur_init);
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#18 lore raw

PATCH 7/15 kmsg: convert xpram messages to kmsg api.

In reply to Martin Schwidefsky

From: Martin Schwidefsky <[email protected]>

---

 Documentation/s390/kmsg/xpram |   54 ++++++++++++++++++++++++++++++++++++++++++
 drivers/s390/block/xpram.c    |   41 ++++++++++++++-----------------
 2 files changed, 73 insertions(+), 22 deletions(-)
Documentation/s390/kmsg/xpram new file +54 -0
Index: quilt-2.6/Documentation/s390/kmsg/xpram
===================================================================
@@ -0,0 +1,54 @@
+/*?
+ * Tag: xpram.1
+ * Text: "%d is not a valid number of XPRAM devices"
+ * Severity: Error
+ * Parameter:
+ *   @1: number of partitions
+ * Description:
+ * The number of XPRAM partitions specified for the 'devs' module parameter
+ * or with the 'xpram.parts' kernel parameter must be an integer in the
+ * range 1 to 32. The XPRAM device driver created a maximum of 32 partitions
+ * that are probably not configured as intended.
+ * User action:
+ * If the XPRAM device driver has been complied as a separate module,
+ * unload the module and load it again with a correct value for the
+ * 'devs' module parameter. If the XPRAM device driver has been compiled
+ * into the kernel, correct the 'xpram.parts' parameter in the kernel
+ * parameter line and restart Linux.
+ */
+
+/*?
+ * Tag: xpram.2
+ * Text: "Not enough expanded memory available"
+ * Severity: Error
+ * Description:
+ * The amount of expanded memory required to set up your XPRAM partitions
+ * depends on the 'sizes' parameter specified for the xpram module or on
+ * the specifications for the 'xpram.parts' parameter if the XPRAM device
+ * driver has been compiled into the kernel. Your
+ * current specification exceed the amount of available expanded memory.
+ * Your XPRAM partitions are probably not configured as intended.
+ * User action:
+ * If the XPRAM device driver has been complied as a separate module,
+ * unload the xpram module and load it again with an appropriate value
+ * for the 'sizes' module parameter. If the XPRAM device driver has been
+ * compiled into the kernel, adjust the 'xpram.parts' parameter in the
+ * kernel parameter line and restart Linux. If you need more than the
+ * available expanded memory, increase the expanded memory allocation for
+ * your virtual hardware or LPAR.
+ */
+
+/*?
+ * Tag: xpram.3
+ * Text: "No expanded memory available"
+ * Severity: Error
+ * Description:
+ * The XPRAM device driver has been loaded in a Linux instance that runs
+ * in an LPAR or virtual hardware without expanded memory.
+ * are created.
+ * User action:
+ * Allocate expanded memory for your LPAR or virtual hardware or do not
+ * load the xpram module. You can ignore this message, if you do not want
+ * to create XPRAM partitions.
+ */
+
drivers/s390/block/xpram.c +19 -22

85 lines not on this page · raw message

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#19 lore raw

PATCH 8/15 kmsg: convert cpacf printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Jan Glauber <[email protected]>

---

 Documentation/s390/kmsg/aes_s390 |   32 ++++++++++++++++++++++++++++++++
 arch/s390/crypto/aes_s390.c      |   14 +++++++++-----
 2 files changed, 41 insertions(+), 5 deletions(-)
arch/s390/crypto/aes_s390.c +9 -5
Index: quilt-2.6/arch/s390/crypto/aes_s390.c
===================================================================
@@ -22,8 +22,11 @@
 #include <linux/err.h>
 #include <linux/module.h>
 #include <linux/init.h>
+#include <asm/kmsg.h>
 #include "crypt_s390.h"
 
+#define KMSG_COMPONENT "aes_s390"
+
 #define AES_KEYLEN_128		1
 #define AES_KEYLEN_192		2
 #define AES_KEYLEN_256		4
@@ -169,7 +172,8 @@ static int fallback_init_cip(struct cryp
 			CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
 
 	if (IS_ERR(sctx->fallback.cip)) {
-		printk(KERN_ERR "Error allocating fallback algo %s\n", name);
+		kmsg_err(1, "Allocating AES fallback algorithm %s failed\n",
+			 name);
 		return PTR_ERR(sctx->fallback.blk);
 	}
 
@@ -349,7 +353,8 @@ static int fallback_init_blk(struct cryp
 			CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK);
 
 	if (IS_ERR(sctx->fallback.blk)) {
-		printk(KERN_ERR "Error allocating fallback algo %s\n", name);
+		kmsg_err(1, "Allocating AES fallback algorithm %s failed\n",
+			 name);
 		return PTR_ERR(sctx->fallback.blk);
 	}
 
@@ -515,9 +520,8 @@ static int __init aes_s390_init(void)
 
 	/* z9 109 and z9 BC/EC only support 128 bit key length */
 	if (keylen_flag == AES_KEYLEN_128)
-		printk(KERN_INFO
-		       "aes_s390: hardware acceleration only available for "
-		       "128 bit keys\n");
+		kmsg_info(2, "AES hardware acceleration is only available for"
+			  " 128-bit keys\n");
 
 	ret = crypto_register_alg(&aes_alg);
 	if (ret)
Documentation/s390/kmsg/aes_s390 new file +32 -0
Index: quilt-2.6/Documentation/s390/kmsg/aes_s390
===================================================================
@@ -0,0 +1,32 @@
+/*?
+ * Tag: aes_s390.1
+ * Text: "Allocating AES fallback algorithm %s failed"
+ * Severity: Error
+ * Parameter:
+ *   @1: algorithm name
+ * Description:
+ * The advanced encryption standard (AES) algorithm includes three modes with
+ * 128-bit, 192-bit, and 256-bit keys. Your hardware system only provides
+ * hardware acceleration for the 128-bit mode. The aes_s390 module failed to
+ * allocate a software fallback for the AES modes that are not supported by the
+ * hardware. A possible reason for this problem is that the aes_generic module
+ * that provides the fallback algorithms is not available.
+ * User action:
+ * Use the 128-bit mode only or ensure that the aes_generic module is available
+ * and loaded and reload the aes_s390 module.
+ */
+
+/*?
+ * Tag: aes_s390.2
+ * Text: "AES hardware acceleration is only available for 128-bit keys"
+ * Severity: Informational
+ * Description:
+ * The advanced encryption standard (AES) algorithm includes three modes with
+ * 128-bit, 192-bit, and 256-bit keys. Your hardware system only provides
+ * hardware acceleration for the 128-bit key mode. The aes_s390 module
+ * will use the less performant software fallback algorithm for the 192-bit
+ * and 256-bit key modes.
+ * User action:
+ * None.
+ */
+
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#20 lore raw

PATCH 9/15 kmsg: convert time printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Martin Schwidefsky <[email protected]>

---

 Documentation/s390/kmsg/time |   39 +++++++++++++++++++++++++++++++++++++++
 arch/s390/kernel/time.c      |   14 +++++++++-----
 2 files changed, 48 insertions(+), 5 deletions(-)
arch/s390/kernel/time.c +9 -5
Index: quilt-2.6/arch/s390/kernel/time.c
===================================================================
@@ -41,6 +41,9 @@
 #include <asm/timer.h>
 #include <asm/etr.h>
 #include <asm/cio.h>
+#include <asm/kmsg.h>
+
+#define KMSG_COMPONENT "time"
 
 /* change this if you have some constant time drift */
 #define USECS_PER_JIFFY     ((unsigned long) 1000000/HZ)
@@ -289,8 +292,8 @@ static unsigned long long adjust_time(un
 	}
 	jiffies_timer_cc += delta;
 	if (adjust.offset != 0) {
-		printk(KERN_NOTICE "etr: time adjusted by %li micro-seconds\n",
-		       adjust.offset);
+		kmsg_notice(1, "The ETR interface has adjusted the clock "
+			    "by %li microseconds\n", adjust.offset);
 		adjust.modes = ADJ_OFFSET_SINGLESHOT;
 		do_adjtimex(&adjust);
 	}
@@ -441,8 +444,8 @@ static void etr_reset(void)
 		etr_tolec = get_clock();
 		set_bit(CLOCK_SYNC_HAS_ETR, &clock_sync_flags);
 	} else if (etr_port0_online || etr_port1_online) {
-		printk(KERN_WARNING "Running on non ETR capable "
-		       "machine, only local mode available.\n");
+		kmsg_warn(2, "The real or virtual hardware system does "
+			  "not provide an ETR interface\n");
 		etr_port0_online = etr_port1_online = 0;
 	}
 }
@@ -1357,7 +1360,8 @@ static void stp_reset(void)
 	if (rc == 1)
 		set_bit(CLOCK_SYNC_HAS_STP, &clock_sync_flags);
 	else if (stp_online) {
-		printk(KERN_WARNING "Running on non STP capable machine.\n");
+		kmsg_warn(3, "The real or virtual hardware system does "
+			  "not provide an STP interface\n");
 		free_bootmem((unsigned long) stp_page, PAGE_SIZE);
 		stp_page = NULL;
 		stp_online = 0;
Documentation/s390/kmsg/time new file +39 -0
Index: quilt-2.6/Documentation/s390/kmsg/time
===================================================================
@@ -0,0 +1,39 @@
+/*?
+ * Tag: time.1
+ * Text: "The ETR interface has adjusted the clock by %li microseconds"
+ * Severity: Notice
+ * Parameter:
+ *   @1: number of microseconds
+ * Description:
+ * The external time reference (ETR) interface has synchronized the system
+ * clock  with the external reference and set it to a new value. The time
+ * difference between the old and new clock value has been passed to the
+ * network time protocol (NTP) as a single shot adjustment.
+ * User action:
+ * None.
+ */
+
+/*?
+ * Tag: time.2
+ * Text: "The real or virtual hardware system does not provide an ETR interface"
+ * Severity: Warning
+ * Description:
+ * The 'etr=' parameter has been passed on the kernel parameter line for
+ * a Linux instance that does not have access to the external time reference
+ * (ETR) facility.
+ * User action:
+ * To avoid this warning remove the 'etr=' kernel parameter.
+ */
+
+/*?
+ * Tag: time.3
+ * Text: "The real or virtual hardware system does not provide an STP interface"
+ * Severity: Warning
+ * Description:
+ * The 'stp=' parameter has been passed on the kernel parameter line for
+ * a Linux instance that does not have access to the server time protocol
+ * (STP) facility.
+ * User action:
+ * To avoid this warning remove the 'stp=' kernel parameter.
+ */
+
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#21 lore raw

PATCH 10/15 kmsg: convert hypfs printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Michael Holzheu <[email protected]>

---

 Documentation/s390/kmsg/hypfs |   60 ++++++++++++++++++++++++++++++++++++++++++
 arch/s390/hypfs/hypfs_diag.c  |    9 ++++--
 arch/s390/hypfs/inode.c       |   13 ++++-----
 3 files changed, 73 insertions(+), 9 deletions(-)
arch/s390/hypfs/hypfs_diag.c +6 -3
Index: quilt-2.6/arch/s390/hypfs/hypfs_diag.c
===================================================================
@@ -3,7 +3,7 @@
  *    Hypervisor filesystem for Linux on s390. Diag 204 and 224
  *    implementation.
  *
- *    Copyright (C) IBM Corp. 2006
+ *    Copyright IBM Corp. 2006, 2008
  *    Author(s): Michael Holzheu <[email protected]>
  */
 
@@ -12,8 +12,10 @@
 #include <linux/string.h>
 #include <linux/vmalloc.h>
 #include <asm/ebcdic.h>
+#include <asm/kmsg.h>
 #include "hypfs.h"
 
+#define KMSG_COMPONENT "hypfs"
 #define LPAR_NAME_LEN 8		/* lpar name len in diag 204 data */
 #define CPU_NAME_LEN 16		/* type name len of cpus in diag224 name table */
 #define TMP_SIZE 64		/* size of temporary buffers */
@@ -527,13 +529,14 @@ __init int hypfs_diag_init(void)
 	int rc;
 
 	if (diag204_probe()) {
-		printk(KERN_ERR "hypfs: diag 204 not working.");
+		kmsg_err(1, "The hardware system does not support hypfs");
 		return -ENODATA;
 	}
 	rc = diag224_get_name_table();
 	if (rc) {
 		diag204_free_buffer();
-		printk(KERN_ERR "hypfs: could not get name table.\n");
+		kmsg_err(2, "The hardware system does not provide all "
+			 "functions required by hypfs\n");
 	}
 	return rc;
 }
arch/s390/hypfs/inode.c +7 -6
Index: quilt-2.6/arch/s390/hypfs/inode.c
===================================================================
@@ -2,7 +2,7 @@
  *  arch/s390/hypfs/inode.c
  *    Hypervisor filesystem for Linux on s390.
  *
- *    Copyright (C) IBM Corp. 2006
+ *    Copyright IBM Corp. 2006, 2008
  *    Author(s): Michael Holzheu <[email protected]>
  */
 
@@ -20,8 +20,10 @@
 #include <linux/seq_file.h>
 #include <linux/mount.h>
 #include <asm/ebcdic.h>
+#include <asm/kmsg.h>
 #include "hypfs.h"
 
+#define KMSG_COMPONENT "hypfs"
 #define HYPFS_MAGIC 0x687970	/* ASCII 'hyp' */
 #define TMP_SIZE 64		/* size of temporary buffers */
 
@@ -200,7 +202,7 @@ static ssize_t hypfs_aio_write(struct ki
 	else
 		rc = hypfs_diag_create_files(sb, sb->s_root);
 	if (rc) {
-		printk(KERN_ERR "hypfs: Update failed\n");
+		kmsg_err(3, "Updating the hypfs tree failed\n");
 		hypfs_delete_tree(sb->s_root);
 		goto out;
 	}
@@ -252,8 +254,7 @@ static int hypfs_parse_options(char *opt
 			break;
 		case opt_err:
 		default:
-			printk(KERN_ERR "hypfs: Unrecognized mount option "
-			       "\"%s\" or missing value\n", str);
+			kmsg_err(4, "%s is not a valid mount option", str);
 			return -EINVAL;
 		}
 	}
@@ -317,7 +318,7 @@ static int hypfs_fill_super(struct super
 	}
 	hypfs_update_update(sb);
 	sb->s_root = root_dentry;
-	printk(KERN_INFO "hypfs: Hypervisor filesystem mounted\n");
+	kmsg_info(0, "Hypervisor filesystem mounted\n");
 	return 0;
 
 err_tree:
@@ -513,7 +514,7 @@ fail_sysfs:
 	if (!MACHINE_IS_VM)
 		hypfs_diag_exit();
 fail_diag:
-	printk(KERN_ERR "hypfs: Initialization failed with rc = %i.\n", rc);
+	kmsg_err(5, "Initialization of hypfs failed with rc=%i\n", rc);
 	return rc;
 }
 
Documentation/s390/kmsg/hypfs new file +60 -0

60 lines not on this page · raw message

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#22 lore raw

PATCH 11/15 kmsg: convert setup printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Martin Schwidefsky <[email protected]>

---

 Documentation/s390/kmsg/setup |  164 ++++++++++++++++++++++++++++++++++++++++++
 arch/s390/kernel/setup.c      |   78 ++++++++++++-------
 2 files changed, 213 insertions(+), 29 deletions(-)
arch/s390/kernel/setup.c +49 -29
Index: quilt-2.6/arch/s390/kernel/setup.c
===================================================================
@@ -55,6 +55,9 @@
 #include <asm/ebcdic.h>
 #include <asm/compat.h>
 #include <asm/kvm_virtio.h>
+#include <asm/kmsg.h>
+
+#define KMSG_COMPONENT "setup"
 
 long psw_kernel_bits	= (PSW_BASE_BITS | PSW_MASK_DAT | PSW_ASC_PRIMARY |
 			   PSW_MASK_MCHECK | PSW_DEFAULT_KEY);
@@ -291,8 +294,8 @@ unsigned int switch_amode = 0;
 #endif
 EXPORT_SYMBOL_GPL(switch_amode);
 
-static void set_amode_and_uaccess(unsigned long user_amode,
-				  unsigned long user32_amode)
+static int set_amode_and_uaccess(unsigned long user_amode,
+				 unsigned long user32_amode)
 {
 	psw_user_bits = PSW_BASE_BITS | PSW_MASK_DAT | user_amode |
 			PSW_MASK_IO | PSW_MASK_EXT | PSW_MASK_MCHECK |
@@ -309,11 +312,11 @@ static void set_amode_and_uaccess(unsign
 			  PSW_MASK_MCHECK | PSW_DEFAULT_KEY;
 
 	if (MACHINE_HAS_MVCOS) {
-		printk("mvcos available.\n");
 		memcpy(&uaccess, &uaccess_mvcos_switch, sizeof(uaccess));
+		return 1;
 	} else {
-		printk("mvcos not available.\n");
 		memcpy(&uaccess, &uaccess_pt, sizeof(uaccess));
+		return 0;
 	}
 }
 
@@ -328,9 +331,10 @@ static int __init early_parse_switch_amo
 early_param("switch_amode", early_parse_switch_amode);
 
 #else /* CONFIG_S390_SWITCH_AMODE */
-static inline void set_amode_and_uaccess(unsigned long user_amode,
-					 unsigned long user32_amode)
+static inline int set_amode_and_uaccess(unsigned long user_amode,
+					unsigned long user32_amode)
 {
+	return 0;
 }
 #endif /* CONFIG_S390_SWITCH_AMODE */
 
@@ -355,11 +359,20 @@ early_param("noexec", early_parse_noexec
 static void setup_addressing_mode(void)
 {
 	if (s390_noexec) {
-		printk("S390 execute protection active, ");
-		set_amode_and_uaccess(PSW_ASC_SECONDARY, PSW32_ASC_SECONDARY);
+		if (set_amode_and_uaccess(PSW_ASC_SECONDARY,
+					  PSW32_ASC_SECONDARY))
+			kmsg_info(1, "Execute protection active, "
+				  "mvcos available\n");
+		else
+			kmsg_info(2, "Execute protection active, "
+				  "mvcos not available\n");
 	} else if (switch_amode) {
-		printk("S390 address spaces switched, ");
-		set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY);
+		if (set_amode_and_uaccess(PSW_ASC_PRIMARY, PSW32_ASC_PRIMARY))
+			kmsg_info(3, "Address spaces switched, "
+				  "mvcos available\n");
+		else
+			kmsg_info(4, "Address spaces switched, "
+				  "mvcos not available\n");
 	}
 #ifdef CONFIG_TRACE_IRQFLAGS
 	sysc_restore_trace_psw.mask = psw_kernel_bits & ~PSW_MASK_MCHECK;
@@ -572,15 +585,15 @@ setup_memory(void)
 			start = PFN_PHYS(start_pfn) + bmap_size + PAGE_SIZE;
 
 			if (start + INITRD_SIZE > memory_end) {
-				printk("initrd extends beyond end of memory "
-				       "(0x%08lx > 0x%08lx)\n"
-				       "disabling initrd\n",
-				       start + INITRD_SIZE, memory_end);
+				kmsg_err(5, "initrd extends beyond end of "
+					 "memory (0x%08lx > 0x%08lx) "
+					 "disabling initrd\n",
+					 start + INITRD_SIZE, memory_end);
 				INITRD_START = INITRD_SIZE = 0;
 			} else {
-				printk("Moving initrd (0x%08lx -> 0x%08lx, "
-				       "size: %ld)\n",
-				       INITRD_START, start, INITRD_SIZE);
+				kmsg_info(6, "Moving initrd (0x%08lx -> "
+					  "0x%08lx, size: %ld)\n",
+					  INITRD_START, start, INITRD_SIZE);
 				memmove((void *) start, (void *) INITRD_START,
 					INITRD_SIZE);
 				INITRD_START = start;
@@ -642,9 +655,10 @@ setup_memory(void)
 			initrd_start = INITRD_START;
 			initrd_end = initrd_start + INITRD_SIZE;
 		} else {
-			printk("initrd extends beyond end of memory "
-			       "(0x%08lx > 0x%08lx)\ndisabling initrd\n",
-			       initrd_start + INITRD_SIZE, memory_end);
+			kmsg_err(5, "initrd extends beyond end of "
+				 "memory (0x%08lx > 0x%08lx)\n"
+				 "disabling initrd\n",
+				 initrd_start + INITRD_SIZE, memory_end);
 			initrd_start = initrd_end = 0;
 		}
 	}
@@ -756,21 +770,27 @@ setup_arch(char **cmdline_p)
          * print what head.S has found out about the machine
          */
 #ifndef CONFIG_64BIT
-	printk((MACHINE_IS_VM) ?
-	       "We are running under VM (31 bit mode)\n" :
-	       "We are running native (31 bit mode)\n");
-	printk((MACHINE_HAS_IEEE) ?
-	       "This machine has an IEEE fpu\n" :
-	       "This machine has no IEEE fpu\n");
+	if (MACHINE_IS_VM)
+		kmsg_info(7, "Linux is running as a z/VM "
+			  "guest operating system in 31-bit mode\n");
+	else
+		kmsg_info(8, "Linux is running natively in 31-bit mode\n");
+	if (MACHINE_HAS_IEEE)
+		kmsg_info(9, "The hardware system has IEEE compatible "
+			  "floating point units\n");
+	else
+		kmsg_info(10, "The hardware system has no IEEE compatible "
+			  "floating point units\n");
 #else /* CONFIG_64BIT */
 	if (MACHINE_IS_VM)
-		printk("We are running under VM (64 bit mode)\n");
+		kmsg_info(11, "Linux is running as a z/VM "
+			  "guest operating system in 64-bit mode\n");
 	else if (MACHINE_IS_KVM) {
-		printk("We are running under KVM (64 bit mode)\n");
+		kmsg_info(13, "Linux is running under KVM in 64-bit mode\n");
 		add_preferred_console("hvc", 0, NULL);
 		s390_virtio_console_init();
 	} else
-		printk("We are running native (64 bit mode)\n");
+		kmsg_info(12, "Linux is running natively in 64-bit mode\n");
 #endif /* CONFIG_64BIT */
 
 	/* Have one command line that is parsed and saved in /proc/cmdline */
Documentation/s390/kmsg/setup new file +164 -0

164 lines not on this page · raw message

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#23 lore raw

PATCH 12/15 kmsg: convert appldata printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Gerald Schaefer <[email protected]>

---

 Documentation/s390/kmsg/appldata   |   93 +++++++++++++++++++++++++++++++++++++
 arch/s390/appldata/appldata.h      |    4 -
 arch/s390/appldata/appldata_base.c |   11 ++--
 arch/s390/appldata/appldata_os.c   |   20 +++----
 4 files changed, 107 insertions(+), 21 deletions(-)
arch/s390/appldata/appldata_base.c +6 -5
Index: quilt-2.6/arch/s390/appldata/appldata_base.c
===================================================================
@@ -28,11 +28,12 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/smp.h>
+#include <asm/kmsg.h>
 
 #include "appldata.h"
 
 
-#define MY_PRINT_NAME	"appldata"		/* for debug messages, etc. */
+#define KMSG_COMPONENT	"appldata"
 #define APPLDATA_CPU_INTERVAL	10000		/* default (CPU) time for
 						   sampling interval in
 						   milliseconds */
@@ -390,8 +391,8 @@ appldata_generic_handler(ctl_table *ctl,
 					(unsigned long) ops->data, ops->size,
 					ops->mod_lvl);
 		if (rc != 0) {
-			P_ERROR("START DIAG 0xDC for %s failed, "
-				"return code: %d\n", ops->name, rc);
+			kmsg_err(1, "Starting the data collection for %s "
+				 "failed with rc=%d\n", ops->name, rc);
 			module_put(ops->owner);
 		} else
 			ops->active = 1;
@@ -401,8 +402,8 @@ appldata_generic_handler(ctl_table *ctl,
 				(unsigned long) ops->data, ops->size,
 				ops->mod_lvl);
 		if (rc != 0)
-			P_ERROR("STOP DIAG 0xDC for %s failed, "
-				"return code: %d\n", ops->name, rc);
+			kmsg_err(2, "Stopping the data collection for %s "
+				 "failed with rc=%d\n", ops->name, rc);
 		module_put(ops->owner);
 	}
 	spin_unlock(&appldata_ops_lock);
arch/s390/appldata/appldata.h +0 -4
Index: quilt-2.6/arch/s390/appldata/appldata.h
===================================================================
@@ -26,10 +26,6 @@
 #define CTL_APPLDATA_NET_SUM	2125
 #define CTL_APPLDATA_PROC	2126
 
-#define P_INFO(x...)	printk(KERN_INFO MY_PRINT_NAME " info: " x)
-#define P_ERROR(x...)	printk(KERN_ERR MY_PRINT_NAME " error: " x)
-#define P_WARNING(x...)	printk(KERN_WARNING MY_PRINT_NAME " status: " x)
-
 struct appldata_ops {
 	struct list_head list;
 	struct ctl_table_header *sysctl_header;
arch/s390/appldata/appldata_os.c +8 -12
Index: quilt-2.6/arch/s390/appldata/appldata_os.c
===================================================================
@@ -18,11 +18,12 @@
 #include <linux/sched.h>
 #include <asm/appldata.h>
 #include <asm/smp.h>
+#include <asm/kmsg.h>
 
 #include "appldata.h"
 
 
-#define MY_PRINT_NAME	"appldata_os"		/* for debug messages, etc. */
+#define KMSG_COMPONENT	"appldata"
 #define LOAD_INT(x) ((x) >> FSHIFT)
 #define LOAD_FRAC(x) LOAD_INT(((x) & (FIXED_1-1)) * 100)
 
@@ -143,21 +144,16 @@ static void appldata_get_os_data(void *d
 					   (unsigned long) ops.data, new_size,
 					   ops.mod_lvl);
 			if (rc != 0)
-				P_ERROR("os: START NEW DIAG 0xDC failed, "
-					"return code: %d, new size = %i\n", rc,
-					new_size);
+				kmsg_err(3, "Starting a new OS data collection "
+					 "failed with rc=%d\n", rc);
 
 			rc = appldata_diag(APPLDATA_RECORD_OS_ID,
 					   APPLDATA_STOP_REC,
 					   (unsigned long) ops.data, ops.size,
 					   ops.mod_lvl);
 			if (rc != 0)
-				P_ERROR("os: STOP OLD DIAG 0xDC failed, "
-					"return code: %d, old size = %i\n", rc,
-					ops.size);
-			else
-				P_INFO("os: old record size = %i stopped\n",
-					ops.size);
+				kmsg_err(4, "Stopping a faulty OS data "
+					 "collection failed with rc=%d\n", rc);
 		}
 		ops.size = new_size;
 	}
@@ -178,8 +174,8 @@ static int __init appldata_os_init(void)
 	max_size = sizeof(struct appldata_os_data) +
 		   (NR_CPUS * sizeof(struct appldata_os_per_cpu));
 	if (max_size > APPLDATA_MAX_REC_SIZE) {
-		P_ERROR("Max. size of OS record = %i, bigger than maximum "
-			"record size (%i)\n", max_size, APPLDATA_MAX_REC_SIZE);
+		kmsg_err(5, "Maximum OS record size %i exceeds the maximum "
+			 "record size %i\n", max_size, APPLDATA_MAX_REC_SIZE);
 		rc = -ENOMEM;
 		goto out;
 	}
Documentation/s390/kmsg/appldata new file +93 -0

93 lines not on this page · raw message

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#24 lore raw

PATCH 13/15 kmsg: convert monreader printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Gerald Schaefer <[email protected]>

---

 Documentation/s390/kmsg/monreader |  135 ++++++++++++++++++++++++++++++++++++++
 drivers/s390/char/monreader.c     |   39 ++++------
 2 files changed, 151 insertions(+), 23 deletions(-)
Documentation/s390/kmsg/monreader new file +135 -0
Index: quilt-2.6/Documentation/s390/kmsg/monreader
===================================================================
@@ -0,0 +1,135 @@
+/*?
+ * Tag: monreader.1
+ * Text: "Reading monitor data failed with rc=%i"
+ * Severity: Error
+ * Parameter:
+ *   @1: return code
+ * Description:
+ * The z/VM *MONITOR record device driver failed to read monitor data
+ * because the IUCV REPLY function failed. The read function against
+ * the monitor record device returns EIO. All monitor data that has been read
+ * since the last read with 0 size is incorrect.
+ * User action:
+ * Disregard all monitor data that has been read since the last read with
+ * 0 size. If the device driver has been compiled as a separate module, unload
+ * and reload the monreader module. If the device driver has been compiled
+ * into the kernel, reboot Linux. For more information about possible causes
+ * of the error see the IUCV section in "z/VM CP Programming Services" and
+ * the *MONITOR section in "z/VM Performance".
+ */
+
+/*?
+ * Tag: monreader.2
+ * Text: "z/VM *MONITOR system service disconnected with rc=%i"
+ * Severity: Error
+ * Parameter:
+ *   @1: IPUSER SEVER return code
+ * Description:
+ * The z/VM *MONITOR record device driver receives monitor records through
+ * an IUCV connection to the z/VM *MONITOR system service. This connection
+ * has been severed and the read function of the z/VM *MONITOR device driver
+ * returns EIO. All data received since the last read with 0 size is incorrect.
+ * User action:
+ * Disregard all monitor data read since the last read with 0 size. Close and
+ * reopen the monitor record device. For information about the IPUSER SEVER
+ * return codes see "z/VM Performance".
+ */
+
+/*?
+ * Tag: monreader.3
+ * Text: "The read queue for monitor data is full"
+ * Severity: Warning
+ * Description:
+ * The read function of the z/VM *MONITOR device driver returns EOVERFLOW
+ * because not enough monitor data has been read since the monitor device
+ * has been opened. Monitor data already read are valid and subsequent reads
+ * return valid data but some intermediate data might be missing.
+ * User action:
+ * Be aware that monitor data might be missing. Assure that you regularly
+ * read monitor data after opening the monitor record device.
+ */
+
+/*?
+ * Tag: monreader.4
+ * Text: "Connecting to the z/VM *MONITOR system service failed with rc=%i"
+ * Severity: Error
+ * Parameter:
+ *   @1: IUCV CONNECT return code
+ * Description:
+ * The z/VM *MONITOR record device driver receives monitor records through
+ * an IUCV connection to the z/VM *MONITOR system service. This connection
+ * could not be established when the monitor record device was opened. If
+ * the return code is 15, your z/VM guest virtual machine is not authorized
+ * to connect to the *MONITOR system service.
+ * User action:
+ * If the return code is 15, ensure that the IUCV *MONITOR statement is
+ * included in the z/VM directory entry for your z/VM guest virtual machine.
+ * For other IUCV CONNECT return codes see the IUCV section in "CP Programming
+ * Services" and the *MONITOR section in "z/VM  Performance".
+ */
+
+/*?
+ * Tag: monreader.5
+ * Text: "Disconnecting the z/VM *MONITOR system service failed with rc=%i"
+ * Severity: Warning
+ * Parameter:
+ *   @1: IUCV SEVER return code
+ * Description:
+ * The z/VM *MONITOR record device driver receives monitor data through an
+ * IUCV connection to the z/VM *MONITOR system service. This connection
+ * could not be closed when the monitor record device was closed. You might
+ * not be able to resume monitoring.
+ * User action:
+ * No immediate action is necessary. If you cannot open the monitor record
+ * device in the future, reboot Linux. For information about the IUCV SEVER
+ * return codes see the IUCV section in "CP Programming Services" and the
+ * *MONITOR section in "z/VM  Performance".
+ */
+
+/*?
+ * Tag: monreader.6
+ * Text: "The z/VM *MONITOR record device driver cannot be loaded without z/VM"
+ * Severity: Error
+ * Description:
+ * The z/VM *MONITOR record device driver uses z/VM system services to provide
+ * monitor data about z/VM guest operating systems to applications on Linux.
+ * On Linux instances that run in environments other than the z/VM hypervisor,
+ * the z/VM *MONITOR record device driver does not provide any useful
+ * function and the corresponding monreader module cannot be loaded.
+ * User action:
+ * Load the z/VM *MONITOR record device driver only on Linux instances that run
+ * as guest operating systems of the z/VM hypervisor. If the z/VM *MONITOR
+ * record device driver has been compiled into the kernel, ignore this message.
+ */
+
+/*?
+ * Tag: monreader.7
+ * Text: "The z/VM *MONITOR record device driver failed to register with IUCV"
+ * Severity: Error
+ * Description:
+ * The z/VM *MONITOR record device driver receives monitor data through an IUCV
+ * connection and needs to register with the IUCV device driver. This
+ * registration failed and the z/VM *MONITOR record device driver was not
+ * loaded. A possible cause of this problem is insufficient memory.
+ * User action:
+ * Free some memory and try again to load the module. If the z/VM *MONITOR
+ * record device driver has been compiled into the kernel, you might have to
+ * configure more memory and reboot Linux. If you do not want to read monitor
+ * data, ignore this message.
+ */
+
+/*?
+ * Tag: monreader.8
+ * Text: "The specified *MONITOR DCSS %s does not have the required type SC"
+ * Severity: Error
+ * Parameter:
+ *   @1: DCSS name
+ * Description:
+ * The DCSS that was specified with the monreader.mondcss kernel parameter or
+ * with the mondcss module parameter cannot be a *MONITOR DCSS because it is
+ * not of type SC.
+ * User action:
+ * Confirm that you are using the name of the DCSS that has been configured as
+ * the *MONITOR DCSS on the z/VM hypervisor. If the default name, MONDCSS, is
+ * used, omit the monreader.mondcss or mondcss parameter.
+ */
drivers/s390/char/monreader.c +16 -23
Index: quilt-2.6/drivers/s390/char/monreader.c
===================================================================
@@ -23,20 +23,10 @@
 #include <asm/uaccess.h>
 #include <asm/ebcdic.h>
 #include <asm/extmem.h>
+#include <asm/kmsg.h>
 
-//#define MON_DEBUG			/* Debug messages on/off */
 
-#define MON_NAME "monreader"
-
-#define P_INFO(x...)	printk(KERN_INFO MON_NAME " info: " x)
-#define P_ERROR(x...)	printk(KERN_ERR MON_NAME " error: " x)
-#define P_WARNING(x...)	printk(KERN_WARNING MON_NAME " warning: " x)
-
-#ifdef MON_DEBUG
-#define P_DEBUG(x...)   printk(KERN_DEBUG MON_NAME " debug: " x)
-#else
-#define P_DEBUG(x...)   do {} while (0)
-#endif
+#define KMSG_COMPONENT "monreader"
 
 #define MON_COLLECT_SAMPLE 0x80
 #define MON_COLLECT_EVENT  0x40
@@ -172,7 +162,7 @@ static int mon_send_reply(struct mon_msg
 	} else
 		monmsg->replied_msglim = 1;
 	if (rc) {
-		P_ERROR("read, IUCV reply failed with rc = %i\n\n", rc);
+		kmsg_err(1, "Reading monitor data failed with rc=%i\n", rc);
 		return -EIO;
 	}
 	return 0;
@@ -251,7 +241,8 @@ static void mon_iucv_path_severed(struct
 {
 	struct mon_private *monpriv = path->private;
 
-	P_ERROR("IUCV connection severed with rc = 0x%X\n", ipuser[0]);
+	kmsg_err(2, "z/VM *MONITOR system service disconnected with rc=%i\n",
+		 ipuser[0]);
 	iucv_path_sever(path, NULL);
 	atomic_set(&monpriv->iucv_severed, 1);
 	wake_up(&mon_conn_wait_queue);
@@ -266,8 +257,7 @@ static void mon_iucv_message_pending(str
 	memcpy(&monpriv->msg_array[monpriv->write_index]->msg,
 	       msg, sizeof(*msg));
 	if (atomic_inc_return(&monpriv->msglim_count) == MON_MSGLIM) {
-		P_WARNING("IUCV message pending, message limit (%i) reached\n",
-			  MON_MSGLIM);
+		kmsg_warn(3, "The read queue for monitor data is full\n");
 		monpriv->msg_array[monpriv->write_index]->msglim_reached = 1;
 	}
 	monpriv->write_index = (monpriv->write_index + 1) % MON_MSGLIM;
@@ -311,8 +301,8 @@ static int mon_open(struct inode *inode,
 	rc = iucv_path_connect(monpriv->path, &monreader_iucv_handler,
 			       MON_SERVICE, NULL, user_data_connect, monpriv);
 	if (rc) {
-		P_ERROR("iucv connection to *MONITOR failed with "
-			"IPUSER SEVER code = %i\n", rc);
+		kmsg_err(4, "Connecting to the z/VM *MONITOR system service "
+			    "failed with rc=%i\n", rc);
 		rc = -EIO;
 		goto out_path;
 	}
@@ -353,7 +343,8 @@ static int mon_close(struct inode *inode
 	 */
 	rc = iucv_path_sever(monpriv->path, user_data_sever);
 	if (rc)
-		P_ERROR("close, iucv_sever failed with rc = %i\n", rc);
+		kmsg_warn(5, "Disconnecting the z/VM *MONITOR system service "
+			     "failed with rc=%i\n", rc);
 
 	atomic_set(&monpriv->iucv_severed, 0);
 	atomic_set(&monpriv->iucv_connected, 0);
@@ -469,7 +460,8 @@ static int __init mon_init(void)
 	int rc;
 
 	if (!MACHINE_IS_VM) {
-		P_ERROR("not running under z/VM, driver not loaded\n");
+		kmsg_err(6, "The z/VM *MONITOR record device driver cannot be "
+			    "loaded without z/VM\n");
 		return -ENODEV;
 	}
 
@@ -478,7 +470,8 @@ static int __init mon_init(void)
 	 */
 	rc = iucv_register(&monreader_iucv_handler, 1);
 	if (rc) {
-		P_ERROR("failed to register with iucv driver\n");
+		kmsg_err(7, "The z/VM *MONITOR record device driver failed to "
+			    "register with IUCV\n");
 		return rc;
 	}
 
@@ -488,8 +481,8 @@ static int __init mon_init(void)
 		goto out_iucv;
 	}
 	if (rc != SEG_TYPE_SC) {
-		P_ERROR("segment %s has unsupported type, should be SC\n",
-			mon_dcss_name);
+		kmsg_err(8, "The specified *MONITOR DCSS %s does not have the "
+			    "required type SC\n", mon_dcss_name);
 		rc = -EINVAL;
 		goto out_iucv;
 	}
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#25 lore raw

PATCH 14/15 kmsg: convert s390 debug feature to kmsg api

In reply to Martin Schwidefsky

From: Michael Holzheu <[email protected]>

---

 Documentation/s390/kmsg/s390dbf |   84 ++++++++++++++++++++++++++++++++++++++++
 arch/s390/kernel/debug.c        |   37 +++++++++--------
 2 files changed, 103 insertions(+), 18 deletions(-)
arch/s390/kernel/debug.c +19 -18
Index: quilt-2.6/arch/s390/kernel/debug.c
===================================================================
@@ -23,6 +23,9 @@
 #include <linux/debugfs.h>
 
 #include <asm/debug.h>
+#include <asm/kmsg.h>
+
+#define KMSG_COMPONENT "s390dbf"
 
 #define DEBUG_PROLOG_ENTRY -1
 
@@ -693,8 +696,8 @@ debug_info_t *debug_register_mode(const 
 	/* Since debugfs currently does not support uid/gid other than root, */
 	/* we do not allow gid/uid != 0 until we get support for that. */
 	if ((uid != 0) || (gid != 0))
-		printk(KERN_WARNING "debug: Warning - Currently only uid/gid "
-		       "= 0 are supported. Using root as owner now!");
+		kmsg_warn(1, "Root becomes the owner of all s390dbf files "
+			  "in sysfs");
 	if (!initialized)
 		BUG();
 	mutex_lock(&debug_mutex);
@@ -709,7 +712,7 @@ debug_info_t *debug_register_mode(const 
 	debug_register_view(rc, &debug_pages_view);
 out:
         if (!rc){
-		printk(KERN_ERR "debug: debug_register failed for %s\n",name);
+		kmsg_err(2, "Registering debug feature %s failed\n", name);
         }
 	mutex_unlock(&debug_mutex);
 	return rc;
@@ -763,8 +766,8 @@ debug_set_size(debug_info_t* id, int nr_
 	if(pages_per_area > 0){
 		new_areas = debug_areas_alloc(pages_per_area, nr_areas);
 		if(!new_areas) {
-			printk(KERN_WARNING "debug: could not allocate memory "\
-					 "for pagenumber: %i\n",pages_per_area);
+			kmsg_info(6, "Allocating memory for %i pages failed",
+				  pages_per_area);
 			rc = -ENOMEM;
 			goto out;
 		}
@@ -780,8 +783,7 @@ debug_set_size(debug_info_t* id, int nr_
 	memset(id->active_entries,0,sizeof(int)*id->nr_areas);
 	memset(id->active_pages, 0, sizeof(int)*id->nr_areas);
 	spin_unlock_irqrestore(&id->lock,flags);
-	printk(KERN_INFO "debug: %s: set new size (%i pages)\n"\
-			 ,id->name, pages_per_area);
+	kmsg_info(0, "%s: set new size (%i pages)\n" ,id->name, pages_per_area);
 out:
 	return rc;
 }
@@ -800,10 +802,9 @@ debug_set_level(debug_info_t* id, int ne
 	spin_lock_irqsave(&id->lock,flags);
         if(new_level == DEBUG_OFF_LEVEL){
                 id->level = DEBUG_OFF_LEVEL;
-                printk(KERN_INFO "debug: %s: switched off\n",id->name);
+                kmsg_info(0, "%s: switched off\n",id->name);
         } else if ((new_level > DEBUG_MAX_LEVEL) || (new_level < 0)) {
-                printk(KERN_INFO
-                        "debug: %s: level %i is out of range (%i - %i)\n",
+                kmsg_info(0, "%s: level %i is out of range (%i - %i)\n",
                         id->name, new_level, 0, DEBUG_MAX_LEVEL);
         } else {
                 id->level = new_level;
@@ -1108,8 +1109,8 @@ debug_register_view(debug_info_t * id, s
 	pde = debugfs_create_file(view->name, mode, id->debugfs_root_entry,
 				id , &debug_file_ops);
 	if (!pde){
-		printk(KERN_WARNING "debug: debugfs_create_file() failed!"\
-			" Cannot register view %s/%s\n", id->name,view->name);
+		kmsg_err(0, "Registering view %s/%s failed due to out of "
+			 "memory", id->name,view->name);
 		rc = -1;
 		goto out;
 	}
@@ -1119,10 +1120,8 @@ debug_register_view(debug_info_t * id, s
 			break;
 	}
 	if (i == DEBUG_MAX_VIEWS) {
-		printk(KERN_WARNING "debug: cannot register view %s/%s\n",
-			id->name,view->name);
-		printk(KERN_WARNING 
-			"debug: maximum number of views reached (%i)!\n", i);
+		kmsg_err(3, "Registering view %s/%s would exceed the maximum "
+			 "number of views %i", id->name, view->name, i);
 		debugfs_remove(pde);
 		rc = -1;
 	} else {
@@ -1303,7 +1302,8 @@ debug_input_level_fn(debug_info_t * id, 
 		new_level = debug_get_uint(str);
 	}
 	if(new_level < 0) {
-		printk(KERN_INFO "debug: level `%s` is not valid\n", str);
+		kmsg_warn(4, "%s is not a valid level for a debug "
+			  "feature\n", str);
 		rc = -EINVAL;
 	} else {
 		debug_set_level(id, new_level);
@@ -1380,7 +1380,8 @@ debug_input_flush_fn(debug_info_t * id, 
                 goto out;
         }
 
-        printk(KERN_INFO "debug: area `%c` is not valid\n", input_buf[0]);
+        kmsg_info(5, "Flushing debug data failed because %c is not a valid "
+		  "area\n", input_buf[0]);
 
 out:
         *offset += user_len;
Documentation/s390/kmsg/s390dbf new file +84 -0

84 lines not on this page · raw message

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.
#26 lore raw

PATCH 15/15 kmsg: convert monwriter printk messages to kmsg api.

In reply to Martin Schwidefsky

From: Melissa Howland <[email protected]>

---

 Documentation/s390/kmsg/monwriter |   17 +++++++++++++++++
 drivers/s390/char/monwriter.c     |    4 +++-
 2 files changed, 20 insertions(+), 1 deletion(-)
Documentation/s390/kmsg/monwriter new file +17 -0
Index: quilt-2.6/Documentation/s390/kmsg/monwriter
===================================================================
@@ -0,0 +1,17 @@
+/*?
+ * Tag: monwriter.1
+ * Text: "Writing monitor data failed with rc=%i"
+ * Severity: Error
+ * Parameter:
+ *   @1: return code
+ * Description:
+ * The monitor stream application device driver used the z/VM diagnose call
+ * DIAG X'DC' to start writing monitor data. z/VM returned an error and the
+ * monitor data cannot be written. If the return code is 5, your z/VM guest
+ * virtual machine is not authorized to write monitor data.
+ * User action:
+ * If the return code is 5, ensure that your z/VM guest virtual machine's
+ * entry in the z/VM directory includes the OPTION APPLMON statement.
+ * For other return codes see the section about DIAGNOSE Code X'DC'
+ * in "z/VM CP Programming Services".
+ */
drivers/s390/char/monwriter.c +3 -1
Index: quilt-2.6/drivers/s390/char/monwriter.c
===================================================================
@@ -24,7 +24,9 @@
 #include <asm/io.h>
 #include <asm/appldata.h>
 #include <asm/monwriter.h>
+#include <asm/kmsg.h>
 
+#define KMSG_COMPONENT "monwriter"
 #define MONWRITE_MAX_DATALEN	4010
 
 static int mon_max_bufs = 255;
@@ -66,7 +68,7 @@ static int monwrite_diag(struct monwrite
 		return rc;
 	if (rc == 5)
 		return -EPERM;
-	printk("DIAG X'DC' error with return code: %i\n", rc);
+	kmsg_err(1,"Writing monitor data failed with rc=%i\n", rc);
 	return -EINVAL;
 }
 
Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.