All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Add FAT messages to printk index
@ 2022-03-18 17:23 Jonathan Lassoff
  2022-03-18 19:56 ` OGAWA Hirofumi
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jonathan Lassoff @ 2022-03-18 17:23 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: Andrew Morton, linux-kernel, Jonathan Lassoff

In order for end users to quickly react to new issues that come up in
production, it is proving useful to leverage the printk indexing system. This
printk index enables kernel developers to use calls to printk() with changable
ad-hoc format strings, while still enabling end users to detect changes and
develop a semi-stable interface for detecting and parsing these messages.

So that detailed FAT messages are captured by this printk index, this patch
wraps fat_msg with a macro.

PATCH v1 -- Fix indentation with tabs in fat_msg macro
PATCH v2 -- Define FAT_PRINTK_PREFIX

Signed-off-by: Jonathan Lassoff <jof@thejof.com>
---
 fs/fat/fat.h  | 9 ++++++++-
 fs/fat/misc.c | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 02d4d4234956..2a20a21f2fb9 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -433,8 +433,15 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
 	__fat_fs_error(sb, 1, fmt , ## args)
 #define fat_fs_error_ratelimit(sb, fmt, args...) \
 	__fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
+
+#define FAT_PRINTK_PREFIX "%sFAT-fs (%s): "
+#define fat_msg(sb, level, fmt, args...)				\
+do {									\
+	printk_index_subsys_emit(FAT_PRINTK_PREFIX, level, fmt, ##args);\
+	_fat_msg(sb, level, fmt, ##args);				\
+} while(0)
 __printf(3, 4) __cold
-void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
+void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
 #define fat_msg_ratelimit(sb, level, fmt, args...)	\
 	do {	\
 			if (__ratelimit(&MSDOS_SB(sb)->ratelimit))	\
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 91ca3c304211..a3f1e4f8bed3 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -45,7 +45,7 @@ EXPORT_SYMBOL_GPL(__fat_fs_error);
  * fat_msg() - print preformated FAT specific messages. Every thing what is
  * not fat_fs_error() should be fat_msg().
  */
-void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
+void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
 {
 	struct va_format vaf;
 	va_list args;
@@ -53,7 +53,7 @@ void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
 	va_start(args, fmt);
 	vaf.fmt = fmt;
 	vaf.va = &args;
-	printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
+	_printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf);
 	va_end(args);
 }
 
-- 
2.35.1


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

* Re: [PATCH v2] Add FAT messages to printk index
  2022-03-18 17:23 [PATCH v2] Add FAT messages to printk index Jonathan Lassoff
@ 2022-03-18 19:56 ` OGAWA Hirofumi
  2022-03-18 21:20 ` kernel test robot
  2022-03-18 22:31 ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: OGAWA Hirofumi @ 2022-03-18 19:56 UTC (permalink / raw)
  To: Jonathan Lassoff; +Cc: Andrew Morton, linux-kernel

Jonathan Lassoff <jof@thejof.com> writes:

> In order for end users to quickly react to new issues that come up in
> production, it is proving useful to leverage the printk indexing system. This
> printk index enables kernel developers to use calls to printk() with changable
> ad-hoc format strings, while still enabling end users to detect changes and
> develop a semi-stable interface for detecting and parsing these messages.
>
> So that detailed FAT messages are captured by this printk index, this patch
> wraps fat_msg with a macro.
>
> PATCH v1 -- Fix indentation with tabs in fat_msg macro
> PATCH v2 -- Define FAT_PRINTK_PREFIX
>
> Signed-off-by: Jonathan Lassoff <jof@thejof.com>

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

> ---
>  fs/fat/fat.h  | 9 ++++++++-
>  fs/fat/misc.c | 4 ++--
>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index 02d4d4234956..2a20a21f2fb9 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -433,8 +433,15 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
>  	__fat_fs_error(sb, 1, fmt , ## args)
>  #define fat_fs_error_ratelimit(sb, fmt, args...) \
>  	__fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
> +
> +#define FAT_PRINTK_PREFIX "%sFAT-fs (%s): "
> +#define fat_msg(sb, level, fmt, args...)				\
> +do {									\
> +	printk_index_subsys_emit(FAT_PRINTK_PREFIX, level, fmt, ##args);\
> +	_fat_msg(sb, level, fmt, ##args);				\
> +} while(0)
>  __printf(3, 4) __cold
> -void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
> +void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
>  #define fat_msg_ratelimit(sb, level, fmt, args...)	\
>  	do {	\
>  			if (__ratelimit(&MSDOS_SB(sb)->ratelimit))	\
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 91ca3c304211..a3f1e4f8bed3 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -45,7 +45,7 @@ EXPORT_SYMBOL_GPL(__fat_fs_error);
>   * fat_msg() - print preformated FAT specific messages. Every thing what is
>   * not fat_fs_error() should be fat_msg().
>   */
> -void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
> +void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
>  {
>  	struct va_format vaf;
>  	va_list args;
> @@ -53,7 +53,7 @@ void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
>  	va_start(args, fmt);
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
> -	printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
> +	_printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf);
>  	va_end(args);
>  }

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

* Re: [PATCH v2] Add FAT messages to printk index
  2022-03-18 17:23 [PATCH v2] Add FAT messages to printk index Jonathan Lassoff
  2022-03-18 19:56 ` OGAWA Hirofumi
@ 2022-03-18 21:20 ` kernel test robot
  2022-03-18 22:31 ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-03-18 21:20 UTC (permalink / raw)
  To: Jonathan Lassoff, OGAWA Hirofumi
  Cc: kbuild-all, Andrew Morton, Linux Memory Management List,
	linux-kernel, Jonathan Lassoff

Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]
[also build test WARNING on linux/master linus/master v5.17-rc8 next-20220318]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Lassoff/Add-FAT-messages-to-printk-index/20220319-012711
base:   https://github.com/hnaz/linux-mm master
config: m68k-defconfig (https://download.01.org/0day-ci/archive/20220319/202203190531.boviZgnl-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/e3f2c52ef480a29ed0b693801bcd9497c19b89ab
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jonathan-Lassoff/Add-FAT-messages-to-printk-index/20220319-012711
        git checkout e3f2c52ef480a29ed0b693801bcd9497c19b89ab
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=m68k SHELL=/bin/bash fs/fat/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/fat/misc.c:49: warning: Function parameter or member 'sb' not described in '_fat_msg'
   fs/fat/misc.c:49: warning: Function parameter or member 'level' not described in '_fat_msg'
   fs/fat/misc.c:49: warning: Function parameter or member 'fmt' not described in '_fat_msg'
>> fs/fat/misc.c:49: warning: expecting prototype for fat_msg(). Prototype was for _fat_msg() instead


vim +49 fs/fat/misc.c

^1da177e4c3f415 Linus Torvalds   2005-04-16  43  
81ac21d34a91e85 Oleksij Rempel   2011-04-12  44  /**
81ac21d34a91e85 Oleksij Rempel   2011-04-12  45   * fat_msg() - print preformated FAT specific messages. Every thing what is
81ac21d34a91e85 Oleksij Rempel   2011-04-12  46   * not fat_fs_error() should be fat_msg().
81ac21d34a91e85 Oleksij Rempel   2011-04-12  47   */
e3f2c52ef480a29 Jonathan Lassoff 2022-03-18  48  void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
81ac21d34a91e85 Oleksij Rempel   2011-04-12 @49  {
81ac21d34a91e85 Oleksij Rempel   2011-04-12  50  	struct va_format vaf;
81ac21d34a91e85 Oleksij Rempel   2011-04-12  51  	va_list args;
81ac21d34a91e85 Oleksij Rempel   2011-04-12  52  
81ac21d34a91e85 Oleksij Rempel   2011-04-12  53  	va_start(args, fmt);
81ac21d34a91e85 Oleksij Rempel   2011-04-12  54  	vaf.fmt = fmt;
81ac21d34a91e85 Oleksij Rempel   2011-04-12  55  	vaf.va = &args;
e3f2c52ef480a29 Jonathan Lassoff 2022-03-18  56  	_printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf);
81ac21d34a91e85 Oleksij Rempel   2011-04-12  57  	va_end(args);
81ac21d34a91e85 Oleksij Rempel   2011-04-12  58  }
81ac21d34a91e85 Oleksij Rempel   2011-04-12  59  

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH v2] Add FAT messages to printk index
  2022-03-18 17:23 [PATCH v2] Add FAT messages to printk index Jonathan Lassoff
  2022-03-18 19:56 ` OGAWA Hirofumi
  2022-03-18 21:20 ` kernel test robot
@ 2022-03-18 22:31 ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2022-03-18 22:31 UTC (permalink / raw)
  To: Jonathan Lassoff, OGAWA Hirofumi
  Cc: llvm, kbuild-all, Andrew Morton, Linux Memory Management List,
	linux-kernel, Jonathan Lassoff

Hi Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on hnaz-mm/master]
[also build test WARNING on linux/master linus/master v5.17-rc8 next-20220318]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Jonathan-Lassoff/Add-FAT-messages-to-printk-index/20220319-012711
base:   https://github.com/hnaz/linux-mm master
config: x86_64-randconfig-a012 (https://download.01.org/0day-ci/archive/20220319/202203190644.dlcQDVaN-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project a6e70e4056dff962ec634c5bd4f2f4105a0bef71)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/e3f2c52ef480a29ed0b693801bcd9497c19b89ab
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Jonathan-Lassoff/Add-FAT-messages-to-printk-index/20220319-012711
        git checkout e3f2c52ef480a29ed0b693801bcd9497c19b89ab
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/fat/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   fs/fat/misc.c:49: warning: Function parameter or member 'sb' not described in '_fat_msg'
   fs/fat/misc.c:49: warning: Function parameter or member 'level' not described in '_fat_msg'
   fs/fat/misc.c:49: warning: Function parameter or member 'fmt' not described in '_fat_msg'
>> fs/fat/misc.c:49: warning: expecting prototype for fat_msg(). Prototype was for _fat_msg() instead


vim +49 fs/fat/misc.c

^1da177e4c3f41 Linus Torvalds   2005-04-16  43  
81ac21d34a91e8 Oleksij Rempel   2011-04-12  44  /**
81ac21d34a91e8 Oleksij Rempel   2011-04-12  45   * fat_msg() - print preformated FAT specific messages. Every thing what is
81ac21d34a91e8 Oleksij Rempel   2011-04-12  46   * not fat_fs_error() should be fat_msg().
81ac21d34a91e8 Oleksij Rempel   2011-04-12  47   */
e3f2c52ef480a2 Jonathan Lassoff 2022-03-18  48  void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
81ac21d34a91e8 Oleksij Rempel   2011-04-12 @49  {
81ac21d34a91e8 Oleksij Rempel   2011-04-12  50  	struct va_format vaf;
81ac21d34a91e8 Oleksij Rempel   2011-04-12  51  	va_list args;
81ac21d34a91e8 Oleksij Rempel   2011-04-12  52  
81ac21d34a91e8 Oleksij Rempel   2011-04-12  53  	va_start(args, fmt);
81ac21d34a91e8 Oleksij Rempel   2011-04-12  54  	vaf.fmt = fmt;
81ac21d34a91e8 Oleksij Rempel   2011-04-12  55  	vaf.va = &args;
e3f2c52ef480a2 Jonathan Lassoff 2022-03-18  56  	_printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf);
81ac21d34a91e8 Oleksij Rempel   2011-04-12  57  	va_end(args);
81ac21d34a91e8 Oleksij Rempel   2011-04-12  58  }
81ac21d34a91e8 Oleksij Rempel   2011-04-12  59  

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH v2] Add FAT messages to printk index
  2022-03-25 20:18 ` Andrew Morton
@ 2022-03-31  0:51   ` Jonathan Lassoff
  0 siblings, 0 replies; 8+ messages in thread
From: Jonathan Lassoff @ 2022-03-31  0:51 UTC (permalink / raw)
  To: Andrew Morton; +Cc: OGAWA Hirofumi, linux-kernel, kernel test robot

On Fri, 25 Mar 2022 at 20:18, Andrew Morton <akpm@linux-foundation.org> wrote:
> It would be nice to see some before-and-after sample output to help
> reviewers understand this proposal.

By diffing the output of the debugfs interface
(/sys/kernel/debug/printk/index/vmlinux), it looks like this:

--- before
+++ after
-<-1> fs/fat/misc.c:56 fat_msg "%sFAT-fs (%s): %pV\n"
+<3> fs/fat/dir.c:1323 fat_add_entries "%sFAT-fs (%s): Corrupted
directory (i_pos %lld)"
+<4> fs/fat/dir.c:1066 fat_remove_entries "%sFAT-fs (%s): Couldn't
remove the long name slots"
+<4> fs/fat/dir.c:173 uni16_to_x8 "%sFAT-fs (%s): filename was
truncated while converting."
+<3> fs/fat/dir.c:102 fat__get_entry "%sFAT-fs (%s): Directory
bread(block %llu) failed"
+<3> fs/fat/fatent.c:110 fat_ent_bread "%sFAT-fs (%s): FAT read failed
(blocknr %llu)"
+<3> fs/fat/fatent.c:97 fat12_ent_bread "%sFAT-fs (%s): FAT read
failed (blocknr %llu)"
+<6> fs/fat/inode.c:1889 fat_fill_super "%sFAT-fs (%s): Can't find a
valid FAT filesystem"
+<4> fs/fat/inode.c:1878 fat_fill_super "%sFAT-fs (%s): mounting with
\"discard\" option, but the device does not support discard"
+<3> fs/fat/inode.c:1871 fat_fill_super "%sFAT-fs (%s): get root inode failed"
+<3> fs/fat/inode.c:1837 fat_fill_super "%sFAT-fs (%s): IO charset %s not found"
+<3> fs/fat/inode.c:1829 fat_fill_super "%sFAT-fs (%s): codepage %s not found"
+<3> fs/fat/inode.c:1794 fat_fill_super "%sFAT-fs (%s): count of
clusters too big (%u)"
+<3> fs/fat/inode.c:1766 fat_fill_super "%sFAT-fs (%s): bogus number
of directory entries (%u)"
+<4> fs/fat/inode.c:1738 fat_fill_super "%sFAT-fs (%s): Invalid FSINFO
signature: 0x%08x, 0x%08x (sector = %lu)"
+<3> fs/fat/inode.c:1731 fat_fill_super "%sFAT-fs (%s): bread failed,
FSINFO block (sector = %lu)"
+<3> fs/fat/inode.c:1688 fat_fill_super "%sFAT-fs (%s): unable to read
boot sector (logical sector size = %lu)"
+<3> fs/fat/inode.c:1680 fat_fill_super "%sFAT-fs (%s): unable to set
blocksize %u"
+<3> fs/fat/inode.c:1671 fat_fill_super "%sFAT-fs (%s): logical sector
size too small for device (logical sector size = %u)"
+<3> fs/fat/inode.c:1650 fat_fill_super "%sFAT-fs (%s): unable to read
boot sector"
+<6> fs/fat/inode.c:1580 fat_read_static_bpb "%sFAT-fs (%s): This
looks like a DOS 1.x volume; assuming default BPB values"
+<4> fs/fat/inode.c:1573 fat_read_static_bpb "%sFAT-fs (%s): This
looks like a DOS 1.x volume, but isn't a recognized floppy size (%llu
sectors)"
+<3> fs/fat/inode.c:1559 fat_read_static_bpb "%sFAT-fs (%s): %s; DOS
2.x BPB is non-zero"
+<3> fs/fat/inode.c:1548 fat_read_static_bpb "%sFAT-fs (%s): %s; no
bootstrapping code"
+<3> fs/fat/inode.c:1525 fat_read_bpb "%sFAT-fs (%s): bogus number of
FAT sectors"
+<3> fs/fat/inode.c:1511 fat_read_bpb "%sFAT-fs (%s): bogus logical
sector size %u"
+<3> fs/fat/inode.c:1502 fat_read_bpb "%sFAT-fs (%s): invalid media
value (0x%02x)"
+<3> fs/fat/inode.c:1491 fat_read_bpb "%sFAT-fs (%s): bogus number of
FAT structure"
+<3> fs/fat/inode.c:1485 fat_read_bpb "%sFAT-fs (%s): bogus number of
reserved sectors"
+<4> fs/fat/inode.c:1366 parse_options "%sFAT-fs (%s): utf8 is not a
recommended IO charset for FAT filesystems, filesystem will be case
sensitive!"
+<3> fs/fat/inode.c:1355 parse_options "%sFAT-fs (%s): Unrecognized
mount option \"%s\" or missing value"
+<6> fs/fat/inode.c:1349 parse_options "%sFAT-fs (%s): \"%s\" option
is obsolete, not supported now"
+<3> fs/fat/inode.c:869 __fat_write_inode "%sFAT-fs (%s): unable to
read inode block for updating (i_pos %lld)"
+<3> fs/fat/inode.c:690 fat_set_state "%sFAT-fs (%s): unable to read
boot sector to mark fs as dirty"
+<4> fs/fat/inode.c:682 fat_set_state "%sFAT-fs (%s): Volume was not
properly unmounted. Some data may be corrupt. Please run fsck."
+<4> fs/fat/inode.c:643 fat_free_eofblocks "%sFAT-fs (%s): Failed to
update on disk inode for unused fallocated blocks, inode could be
corrupted. Please run fsck"
+<3> fs/fat/misc.c:86 fat_clusters_flush "%sFAT-fs (%s): Invalid
FSINFO signature: 0x%08x, 0x%08x (sector = %lu)"
+<3> fs/fat/misc.c:79 fat_clusters_flush "%sFAT-fs (%s): bread failed
in fat_clusters_flush"
+<3> fs/fat/misc.c:39 __fat_fs_error "%sFAT-fs (%s): Filesystem has
been set read-only"
+<3> fs/fat/misc.c:31 __fat_fs_error "%sFAT-fs (%s): error, %pV"
+<3> fs/fat/nfs.c:225 fat_rebuild_parent "%sFAT-fs (%s): unable to
read cluster of parent directory"
+<3> fs/fat/nfs.c:73 __fat_nfs_get_inode "%sFAT-fs (%s): unable to
read block(%llu) for building NFS inode"

> > Reported-by: kernel test robot <lkp@intel.com>
>
> We'll need a Signed-off-by: for this, please.
> Documentation/process/submitting-patches.rst describes this.

*facepalm*
Sorry about that and thanks for some patience.... I'm still a total newbie.

In some of the other subsystems, I've gotten some resistance to
mentioning a "semi-stable interface" (with regard to the existing
debugfs interface, since it's not actually making any stability
guarantees), so I'd like to follow up again with a [PATCH v4] that
rewords the message and includes a Signed-off-by:

-- jof

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

* Re: [PATCH v2] Add FAT messages to printk index
  2022-03-24  2:19 Jonathan Lassoff
  2022-03-24  5:45 ` OGAWA Hirofumi
@ 2022-03-25 20:18 ` Andrew Morton
  2022-03-31  0:51   ` Jonathan Lassoff
  1 sibling, 1 reply; 8+ messages in thread
From: Andrew Morton @ 2022-03-25 20:18 UTC (permalink / raw)
  To: Jonathan Lassoff; +Cc: OGAWA Hirofumi, linux-kernel, kernel test robot

On Thu, 24 Mar 2022 02:19:58 +0000 Jonathan Lassoff <jof@thejof.com> wrote:

> In order for end users to quickly react to new issues that come up in
> production, it is proving useful to leverage the printk indexing system. This
> printk index enables kernel developers to use calls to printk() with changable
> ad-hoc format strings, while still enabling end users to detect changes and
> develop a semi-stable interface for detecting and parsing these messages.
> 
> So that detailed FAT messages are captured by this printk index, this patch
> wraps fat_msg with a macro.

It would be nice to see some before-and-after sample output to help
reviewers understand this proposal.

> Reported-by: kernel test robot <lkp@intel.com>

We'll need a Signed-off-by: for this, please. 
Documentation/process/submitting-patches.rst describes this.


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

* Re: [PATCH v2] Add FAT messages to printk index
  2022-03-24  2:19 Jonathan Lassoff
@ 2022-03-24  5:45 ` OGAWA Hirofumi
  2022-03-25 20:18 ` Andrew Morton
  1 sibling, 0 replies; 8+ messages in thread
From: OGAWA Hirofumi @ 2022-03-24  5:45 UTC (permalink / raw)
  To: Jonathan Lassoff; +Cc: Andrew Morton, linux-kernel, kernel test robot

Jonathan Lassoff <jof@thejof.com> writes:

> In order for end users to quickly react to new issues that come up in
> production, it is proving useful to leverage the printk indexing system. This
> printk index enables kernel developers to use calls to printk() with changable
> ad-hoc format strings, while still enabling end users to detect changes and
> develop a semi-stable interface for detecting and parsing these messages.
>
> So that detailed FAT messages are captured by this printk index, this patch
> wraps fat_msg with a macro.
>
> PATCH v1 -- Fix indentation with tabs in fat_msg macro
> PATCH v2 -- Define FAT_PRINTK_PREFIX
> PATCH v3 -- Fix kernel-doc comment for _fat_msg()
>
> Reported-by: kernel test robot <lkp@intel.com>

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Thanks.

> ---
>  fs/fat/fat.h  |  9 ++++++++-
>  fs/fat/misc.c | 14 ++++++++++----
>  2 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/fs/fat/fat.h b/fs/fat/fat.h
> index 02d4d4234956..2a20a21f2fb9 100644
> --- a/fs/fat/fat.h
> +++ b/fs/fat/fat.h
> @@ -433,8 +433,15 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
>  	__fat_fs_error(sb, 1, fmt , ## args)
>  #define fat_fs_error_ratelimit(sb, fmt, args...) \
>  	__fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
> +
> +#define FAT_PRINTK_PREFIX "%sFAT-fs (%s): "
> +#define fat_msg(sb, level, fmt, args...)				\
> +do {									\
> +	printk_index_subsys_emit(FAT_PRINTK_PREFIX, level, fmt, ##args);\
> +	_fat_msg(sb, level, fmt, ##args);				\
> +} while(0)
>  __printf(3, 4) __cold
> -void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
> +void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
>  #define fat_msg_ratelimit(sb, level, fmt, args...)	\
>  	do {	\
>  			if (__ratelimit(&MSDOS_SB(sb)->ratelimit))	\
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index 91ca3c304211..855477d89f41 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -42,10 +42,16 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
>  EXPORT_SYMBOL_GPL(__fat_fs_error);
>  
>  /**
> - * fat_msg() - print preformated FAT specific messages. Every thing what is
> - * not fat_fs_error() should be fat_msg().
> + * _fat_msg() - Print a preformatted FAT message based on a superblock.
> + * @sb: A pointer to a &struct super_block
> + * @level: A Kernel printk level constant
> + * @fmt: The printf-style format string to print.
> + *
> + * Everything that is not fat_fs_error() should be fat_msg().
> + *
> + * fat_msg() wraps _fat_msg() for printk indexing.
>   */
> -void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
> +void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
>  {
>  	struct va_format vaf;
>  	va_list args;
> @@ -53,7 +59,7 @@ void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
>  	va_start(args, fmt);
>  	vaf.fmt = fmt;
>  	vaf.va = &args;
> -	printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
> +	_printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf);
>  	va_end(args);
>  }

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

* [PATCH v2] Add FAT messages to printk index
@ 2022-03-24  2:19 Jonathan Lassoff
  2022-03-24  5:45 ` OGAWA Hirofumi
  2022-03-25 20:18 ` Andrew Morton
  0 siblings, 2 replies; 8+ messages in thread
From: Jonathan Lassoff @ 2022-03-24  2:19 UTC (permalink / raw)
  To: OGAWA Hirofumi
  Cc: Andrew Morton, linux-kernel, Jonathan Lassoff, kernel test robot

In order for end users to quickly react to new issues that come up in
production, it is proving useful to leverage the printk indexing system. This
printk index enables kernel developers to use calls to printk() with changable
ad-hoc format strings, while still enabling end users to detect changes and
develop a semi-stable interface for detecting and parsing these messages.

So that detailed FAT messages are captured by this printk index, this patch
wraps fat_msg with a macro.

PATCH v1 -- Fix indentation with tabs in fat_msg macro
PATCH v2 -- Define FAT_PRINTK_PREFIX
PATCH v3 -- Fix kernel-doc comment for _fat_msg()

Reported-by: kernel test robot <lkp@intel.com>
---
 fs/fat/fat.h  |  9 ++++++++-
 fs/fat/misc.c | 14 ++++++++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/fs/fat/fat.h b/fs/fat/fat.h
index 02d4d4234956..2a20a21f2fb9 100644
--- a/fs/fat/fat.h
+++ b/fs/fat/fat.h
@@ -433,8 +433,15 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...);
 	__fat_fs_error(sb, 1, fmt , ## args)
 #define fat_fs_error_ratelimit(sb, fmt, args...) \
 	__fat_fs_error(sb, __ratelimit(&MSDOS_SB(sb)->ratelimit), fmt , ## args)
+
+#define FAT_PRINTK_PREFIX "%sFAT-fs (%s): "
+#define fat_msg(sb, level, fmt, args...)				\
+do {									\
+	printk_index_subsys_emit(FAT_PRINTK_PREFIX, level, fmt, ##args);\
+	_fat_msg(sb, level, fmt, ##args);				\
+} while(0)
 __printf(3, 4) __cold
-void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
+void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...);
 #define fat_msg_ratelimit(sb, level, fmt, args...)	\
 	do {	\
 			if (__ratelimit(&MSDOS_SB(sb)->ratelimit))	\
diff --git a/fs/fat/misc.c b/fs/fat/misc.c
index 91ca3c304211..855477d89f41 100644
--- a/fs/fat/misc.c
+++ b/fs/fat/misc.c
@@ -42,10 +42,16 @@ void __fat_fs_error(struct super_block *sb, int report, const char *fmt, ...)
 EXPORT_SYMBOL_GPL(__fat_fs_error);
 
 /**
- * fat_msg() - print preformated FAT specific messages. Every thing what is
- * not fat_fs_error() should be fat_msg().
+ * _fat_msg() - Print a preformatted FAT message based on a superblock.
+ * @sb: A pointer to a &struct super_block
+ * @level: A Kernel printk level constant
+ * @fmt: The printf-style format string to print.
+ *
+ * Everything that is not fat_fs_error() should be fat_msg().
+ *
+ * fat_msg() wraps _fat_msg() for printk indexing.
  */
-void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
+void _fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
 {
 	struct va_format vaf;
 	va_list args;
@@ -53,7 +59,7 @@ void fat_msg(struct super_block *sb, const char *level, const char *fmt, ...)
 	va_start(args, fmt);
 	vaf.fmt = fmt;
 	vaf.va = &args;
-	printk("%sFAT-fs (%s): %pV\n", level, sb->s_id, &vaf);
+	_printk(FAT_PRINTK_PREFIX "%pV\n", level, sb->s_id, &vaf);
 	va_end(args);
 }
 
-- 
2.30.2


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

end of thread, other threads:[~2022-03-31  0:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-18 17:23 [PATCH v2] Add FAT messages to printk index Jonathan Lassoff
2022-03-18 19:56 ` OGAWA Hirofumi
2022-03-18 21:20 ` kernel test robot
2022-03-18 22:31 ` kernel test robot
2022-03-24  2:19 Jonathan Lassoff
2022-03-24  5:45 ` OGAWA Hirofumi
2022-03-25 20:18 ` Andrew Morton
2022-03-31  0:51   ` Jonathan Lassoff

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.