mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiang Gao <gxxa03070307@gmail.com>
To: pmladek@suse.com
Cc: rostedt@goodmis.org, john.ogness@linutronix.de,
	senozhatsky@chromium.org, linux-kernel@vger.kernel.org,
	fengqi@xiaomi.com, xiaoa <gaoxiang19870307@163.com>
Subject: [PATCH] printk: Increase PRINTK_PREFIX_MAX and the buf size in print_caller.
Date: Mon, 27 May 2024 17:19:29 +0800	[thread overview]
Message-ID: <20240527091929.316471-1-gxxa03070307@gmail.com> (raw)

From: xiaoa <gaoxiang19870307@163.com>

Sometimes we need to add our own hooks to carry more caller information
to improve debug efficiency, but currently the buf in print caller is
too small.

Signed-off-by: xiaoa <gaoxiang19870307@163.com>
---
 kernel/printk/internal.h | 2 +-
 kernel/printk/printk.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h
index 6c2afee5ef62..27a3cc11289c 100644
--- a/kernel/printk/internal.h
+++ b/kernel/printk/internal.h
@@ -23,7 +23,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
 #ifdef CONFIG_PRINTK
 
 #ifdef CONFIG_PRINTK_CALLER
-#define PRINTK_PREFIX_MAX	48
+#define PRINTK_PREFIX_MAX	64
 #else
 #define PRINTK_PREFIX_MAX	32
 #endif
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 420fd310129d..2d7f003113f7 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1331,7 +1331,7 @@ static size_t print_time(u64 ts, char *buf)
 #ifdef CONFIG_PRINTK_CALLER
 static size_t print_caller(u32 id, char *buf)
 {
-	char caller[12];
+	char caller[32];
 
 	snprintf(caller, sizeof(caller), "%c%u",
 		 id & 0x80000000 ? 'C' : 'T', id & ~0x80000000);
-- 
2.34.1


             reply	other threads:[~2024-05-27  9:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-27  9:19 Xiang Gao [this message]
2024-05-27 14:54 ` Petr Mladek
2024-05-29  6:33   ` John Ogness
     [not found]     ` <1717404421510.qmo40jy5kubcunlrdknzajsf@android.mail.163.com>
2024-06-03 12:42       ` Petr Mladek
2024-06-03 13:15         ` gxxa03070307
2024-06-03 14:59           ` Petr Mladek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240527091929.316471-1-gxxa03070307@gmail.com \
    --to=gxxa03070307@gmail.com \
    --cc=fengqi@xiaomi.com \
    --cc=gaoxiang19870307@163.com \
    --cc=john.ogness@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®