2022-03-19 20:39:15

by Jonathan Lassoff

[permalink] [raw]
Subject: [PATCH v2] Add FAT messages to printk index

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 <[email protected]>
---
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


2022-03-21 22:39:05

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH v2] Add FAT messages to printk index

Jonathan Lassoff <[email protected]> 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 <[email protected]>

Acked-by: OGAWA Hirofumi <[email protected]>

> ---
> 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 <[email protected]>

2022-03-21 22:48:32

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2] Add FAT messages to printk index

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/[email protected]/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 <[email protected]>

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/[email protected]

2022-03-21 23:33:00

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2] Add FAT messages to printk index

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/[email protected]/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 <[email protected]>

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/[email protected]

2022-03-24 11:59:21

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH v2] Add FAT messages to printk index

Jonathan Lassoff <[email protected]> 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 <[email protected]>

Acked-by: OGAWA Hirofumi <[email protected]>

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 <[email protected]>