linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: John Ogness <john.ogness@linutronix.de>, Petr Mladek <pmladek@suse.com>
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrea Parri <parri.andrea@gmail.com>,
	Paul McKenney <paulmck@kernel.org>,
	kexec@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH printk v4 5/6] printk: ringbuffer: add finalization/extension support
Date: Wed, 9 Sep 2020 14:50:38 +0800	[thread overview]
Message-ID: <202009091438.IAIah06P%lkp@intel.com> (raw)
In-Reply-To: <20200908202859.2736-6-john.ogness@linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 8044 bytes --]

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@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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 28079 bytes --]

  reply	other threads:[~2020-09-09  6:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-08 20:28 [PATCH printk v4 0/6] printk: reimplement LOG_CONT handling John Ogness
2020-09-08 20:28 ` [PATCH printk v4 1/6] printk: ringbuffer: relocate get_data() John Ogness
2020-09-08 20:28 ` [PATCH printk v4 2/6] printk: ringbuffer: add BLK_DATALESS() macro John Ogness
2020-09-08 20:28 ` [PATCH printk v4 3/6] printk: ringbuffer: clear initial reserved fields John Ogness
2020-09-09  9:34   ` Petr Mladek
2020-09-08 20:28 ` [PATCH printk v4 4/6] printk: ringbuffer: change representation of states John Ogness
2020-09-09 10:01   ` Petr Mladek
2020-09-08 20:28 ` [PATCH printk v4 5/6] printk: ringbuffer: add finalization/extension support John Ogness
2020-09-09  6:50   ` kernel test robot [this message]
2020-09-09 10:40   ` Dan Carpenter
2020-09-09 15:22   ` Petr Mladek
2020-09-08 20:28 ` [PATCH printk v4 6/6] printk: reimplement log_cont using record extension John Ogness

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=202009091438.IAIah06P%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=clang-built-linux@googlegroups.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=john.ogness@linutronix.de \
    --cc=kbuild-all@lists.01.org \
    --cc=kexec@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).