[PATCH printk v4 5/6] printk: ringbuffer: add finalization/extension support
kernel test robot
lkp at intel.com
Wed Sep 9 02:50:38 EDT 2020
Hi John,
I love your patch! Perhaps something to improve:
[auto build test WARNING on next-20200908]
[cannot apply to linux/master linus/master pmladek/for-next v5.9-rc4 v5.9-rc3 v5.9-rc2 v5.9-rc4]
[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/John-Ogness/printk-reimplement-LOG_CONT-handling/20200909-115852
base: dff9f829e5b0181d4ed9d35aa62d695292399b54
config: mips-randconfig-r035-20200909 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 8893d0816ccdf8998d2e21b5430e9d6abe7ef465)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
All warnings (new ones prefixed by >>):
>> kernel/printk/printk_ringbuffer.c:1398:28: warning: format specifies type 'unsigned short' but the argument has type 'unsigned int' [-Wformat]
d->info.text_len, data_size);
^~~~~~~~~
include/linux/printk.h:472:42: note: expanded from macro 'pr_warn_once'
printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__)
~~~ ^~~~~~~~~~~
include/linux/printk.h:441:17: note: expanded from macro 'printk_once'
printk(fmt, ##__VA_ARGS__); \
~~~ ^~~~~~~~~~~
>> kernel/printk/printk_ringbuffer.c:1385:23: warning: variable 'data_size' is uninitialized when used here [-Wuninitialized]
d->info.text_len = data_size;
^~~~~~~~~
kernel/printk/printk_ringbuffer.c:1349:24: note: initialize the variable 'data_size' to silence this warning
unsigned int data_size;
^
= 0
2 warnings generated.
# https://github.com/0day-ci/linux/commit/4b08e95d4858fb7e2fe1732aa7f4f6f6881eac91
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review John-Ogness/printk-reimplement-LOG_CONT-handling/20200909-115852
git checkout 4b08e95d4858fb7e2fe1732aa7f4f6f6881eac91
vim +1398 kernel/printk/printk_ringbuffer.c
1299
1300 /**
1301 * prb_reserve_in_last() - Re-reserve and extend the space in the ringbuffer
1302 * used by the newest record.
1303 *
1304 * @e: The entry structure to setup.
1305 * @rb: The ringbuffer to re-reserve and extend data in.
1306 * @r: The record structure to allocate buffers for.
1307 * @caller_id: The caller ID of the caller (reserving writer).
1308 *
1309 * This is the public function available to writers to re-reserve and extend
1310 * data.
1311 *
1312 * The writer specifies the text size to extend (not the new total size) by
1313 * setting the @text_buf_size field of @r. Extending dictionaries is not
1314 * supported, so @dict_buf_size of @r should be set to 0. To ensure proper
1315 * initialization of @r, prb_rec_init_wr() should be used.
1316 *
1317 * This function will fail if @caller_id does not match the caller ID of the
1318 * newest record. In that case the caller must reserve new data using
1319 * prb_reserve().
1320 *
1321 * Context: Any context. Disables local interrupts on success.
1322 * Return: true if text data could be extended, otherwise false.
1323 *
1324 * On success:
1325 *
1326 * - @r->text_buf points to the beginning of the entire text buffer.
1327 *
1328 * - @r->text_buf_size is set to the new total size of the buffer.
1329 *
1330 * - @r->dict_buf and @r->dict_buf_size are cleared because extending
1331 * the dict buffer is not supported.
1332 *
1333 * - @r->info is not touched so that @r->info->text_len could be used
1334 * to append the text.
1335 *
1336 * - prb_record_text_space() can be used on @e to query the new
1337 * actually used space.
1338 *
1339 * Important: All @r->info fields will already be set with the current values
1340 * for the record. I.e. @r->info->text_len will be less than
1341 * @text_buf_size and @r->info->dict_len may be set, even though
1342 * @dict_buf_size is 0. Writers can use @r->info->text_len to know
1343 * where concatenation begins and writers should update
1344 * @r->info->text_len after concatenating.
1345 */
1346 bool prb_reserve_in_last(struct prb_reserved_entry *e, struct printk_ringbuffer *rb,
1347 struct printk_record *r, u32 caller_id)
1348 {
1349 unsigned int data_size;
1350 struct prb_desc *d;
1351 unsigned long id;
1352
1353 local_irq_save(e->irqflags);
1354
1355 /* Transition the newest descriptor back to the reserved state. */
1356 d = desc_reopen_last(&rb->desc_ring, caller_id, &id);
1357 if (!d) {
1358 local_irq_restore(e->irqflags);
1359 goto fail_reopen;
1360 }
1361
1362 /* Now the writer has exclusive access: LMM(prb_reserve_in_last:A) */
1363
1364 /*
1365 * Set the @e fields here so that prb_commit() can be used if
1366 * anything fails from now on.
1367 */
1368 e->rb = rb;
1369 e->id = id;
1370
1371 /*
1372 * desc_reopen_last() checked the caller_id, but there was no
1373 * exclusive access at that point. The descriptor may have
1374 * changed since then.
1375 */
1376 if (caller_id != d->info.caller_id)
1377 goto fail;
1378
1379 if (BLK_DATALESS(&d->text_blk_lpos)) {
1380 r->text_buf = data_alloc(rb, &rb->text_data_ring, r->text_buf_size,
1381 &d->text_blk_lpos, id);
1382 if (WARN_ON_ONCE(d->info.text_len != 0)) {
1383 pr_warn_once("wrong text_len value (%u, expecting 0)\n",
1384 d->info.text_len);
> 1385 d->info.text_len = data_size;
1386 }
1387 } else {
1388 if (!get_data(&rb->text_data_ring, &d->text_blk_lpos, &data_size))
1389 goto fail;
1390
1391 /*
1392 * Increase the buffer size to include the original size. If
1393 * the meta data (@text_len) is not sane, use the full data
1394 * block size.
1395 */
1396 if (WARN_ON_ONCE(d->info.text_len > data_size)) {
1397 pr_warn_once("wrong text_len value (%u, expecting <=%hu)\n",
> 1398 d->info.text_len, data_size);
1399 d->info.text_len = data_size;
1400 }
1401 r->text_buf_size += d->info.text_len;
1402
1403 if (!data_check_size(&rb->text_data_ring, r->text_buf_size))
1404 goto fail;
1405
1406 r->text_buf = data_realloc(rb, &rb->text_data_ring, r->text_buf_size,
1407 &d->text_blk_lpos, id);
1408 }
1409 if (r->text_buf_size && !r->text_buf)
1410 goto fail;
1411
1412 /* Although dictionary data may be in use, it cannot be extended. */
1413 r->dict_buf = NULL;
1414 r->dict_buf_size = 0;
1415
1416 r->info = &d->info;
1417
1418 e->text_space = space_used(&rb->text_data_ring, &d->text_blk_lpos);
1419
1420 return true;
1421 fail:
1422 prb_commit(e);
1423 /* prb_commit() re-enabled interrupts. */
1424 fail_reopen:
1425 /* Make it clear to the caller that the re-reserve failed. */
1426 memset(r, 0, sizeof(*r));
1427 return false;
1428 }
1429
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 28079 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/kexec/attachments/20200909/56cb3a50/attachment-0001.gz>
More information about the kexec
mailing list