From: kernel test robot <lkp@intel.com>
To: 林濬哲 <m18667909625@163.com>, "Petr Mladek" <pmladek@suse.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
linux-kernel@vger.kernel.org, m18667909625@163.com
Subject: Re: [PATCH] printk: fold consecutive duplicate messages
Date: Thu, 24 Sep 2026 05:34:32 +0800 [thread overview]
Message-ID: <202609240518.RU2loaID-lkp@intel.com> (raw)
In-Reply-To: <20260921050304.73440-1-m18667909625@163.com>
Hi 林濬哲,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linus/master]
[also build test WARNING on v7.3-rc4 next-20260922]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/printk-fold-consecutive-duplicate-messages/20260921-130304
base: linus/master
patch link: https://lore.kernel.org/r/20260921050304.73440-1-m18667909625%40163.com
patch subject: [PATCH] printk: fold consecutive duplicate messages
config: hexagon-allnoconfig (https://download.01.org/0day-ci/archive/20260924/202609240518.RU2loaID-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 6e714c8d91116794cb699cdf80c26afe9cda3ef3)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260924/202609240518.RU2loaID-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609240518.RU2loaID-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> kernel/printk/printk.c:158:7: warning: variable 'n' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
158 | if (dedup_repeat >= 10 ||
| ^~~~~~~~~~~~~~~~~~~~~
159 | now - dedup_window_start > PRINTK_DEDUP_WINDOW_NS) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
kernel/printk/printk.c:187:6: note: uninitialized use occurs here
187 | if (n)
| ^
kernel/printk/printk.c:158:3: note: remove the 'if' if its condition is always true
158 | if (dedup_repeat >= 10 ||
| ^~~~~~~~~~~~~~~~~~~~~~~~~
159 | now - dedup_window_start > PRINTK_DEDUP_WINDOW_NS) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
160 | n = dedup_repeat;
161 | dedup_repeat = 0;
162 | dedup_window_start = now;
163 | drop = false;
164 | } else {
| ~~~~~~
165 | drop = true;
| ~~~~~~~~~~~~
166 | }
| ~
kernel/printk/printk.c:140:7: note: initialize the variable 'n' to silence this warning
140 | u32 n;
| ^
| = 0
1 warning generated.
vim +158 kernel/printk/printk.c
124
125 /*
126 * Detect consecutive duplicate printk messages and fold them away.
127 * Returns true if this message should be dropped.
128 *
129 * The dedup key is built from facility, level and the format string.
130 * Format parameters are intentionally not part of the key: va_list
131 * can only be consumed once, and hashing rendered text would put
132 * string comparisons on the printk fast path.
133 */
134 static bool outputs_dedupe(int facility, int level, const char *fmt)
135 {
136 unsigned long flags;
137 bool drop;
138 u64 now;
139 u32 key;
140 u32 n;
141
142 /* error and above must never be folded */
143 if (level <= LOGLEVEL_ERR || !printk_dedup)
144 return false;
145
146 key = hash_64((unsigned long)(fmt ? : ""), 32) ^
147 hash_32(facility ^ level, 32);
148 now = ktime_get_ns();
149
150 raw_spin_lock_irqsave(&dedup_lock, flags);
151
152 if (dedup_active && key == dedup_last_key) {
153 dedup_repeat++;
154 /*
155 * Force a flush when 10 repeats have accumulated or
156 * the 1s window has elapsed, so the summary shows up.
157 */
> 158 if (dedup_repeat >= 10 ||
159 now - dedup_window_start > PRINTK_DEDUP_WINDOW_NS) {
160 n = dedup_repeat;
161 dedup_repeat = 0;
162 dedup_window_start = now;
163 drop = false;
164 } else {
165 drop = true;
166 }
167 } else {
168 if (dedup_active && dedup_repeat) {
169 n = dedup_repeat;
170 drop = false;
171 } else {
172 n = 0;
173 drop = false;
174 }
175 dedup_last_key = key;
176 dedup_repeat = 0;
177 dedup_window_start = now;
178 dedup_active = true;
179 }
180
181 raw_spin_unlock_irqrestore(&dedup_lock, flags);
182
183 /*
184 * Print only after dropping the lock: pr_info() re-enters
185 * vprintk_emit() and would deadlock on dedup_lock otherwise.
186 */
187 if (n)
188 pr_info("last message repeated %u times\n", n);
189
190 return drop;
191 }
192
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
prev parent reply other threads:[~2026-09-23 21:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 5:03 林濬哲
2026-09-21 7:52 ` John Ogness
2026-09-21 10:30 ` Lin Junzhe
2026-09-21 12:13 ` John Ogness
2026-09-21 14:40 ` Lin Junzhe
2026-09-23 9:43 ` Petr Mladek
2026-09-23 20:59 ` kernel test robot
2026-09-23 21:34 ` kernel test robot [this message]
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=202609240518.RU2loaID-lkp@intel.com \
--to=lkp@intel.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=m18667909625@163.com \
--cc=oe-kbuild-all@lists.linux.dev \
--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®