Re: [PATCH v13 3/6] tracing: Add snapshot refcount

From: kernel test robot
Date: Tue Jan 30 2024 - 04:33:12 EST


Hi Vincent,

kernel test robot noticed the following build errors:

[auto build test ERROR on 29142dc92c37d3259a33aef15b03e6ee25b0d188]

url: https://github.com/intel-lab-lkp/linux/commits/Vincent-Donnefort/ring-buffer-Zero-ring-buffer-sub-buffers/20240129-223025
base: 29142dc92c37d3259a33aef15b03e6ee25b0d188
patch link: https://lore.kernel.org/r/20240129142802.2145305-4-vdonnefort%40google.com
patch subject: [PATCH v13 3/6] tracing: Add snapshot refcount
config: arc-randconfig-002-20240130 (https://download.01.org/0day-ci/archive/20240130/202401301740.qzZlpcYV-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240130/202401301740.qzZlpcYV-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401301740.qzZlpcYV-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

kernel/trace/trace.c: In function 'tracing_set_tracer':
kernel/trace/trace.c:6644:17: error: implicit declaration of function 'tracing_disarm_snapshot_locked'; did you mean 'tracing_disarm_snapshot'? [-Werror=implicit-function-declaration]
6644 | tracing_disarm_snapshot_locked(tr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| tracing_disarm_snapshot
>> kernel/trace/trace.c:6648:23: error: implicit declaration of function 'tracing_arm_snapshot_locked'; did you mean 'tracing_arm_snapshot'? [-Werror=implicit-function-declaration]
6648 | ret = tracing_arm_snapshot_locked(tr);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| tracing_arm_snapshot
cc1: some warnings being treated as errors


vim +6648 kernel/trace/trace.c

6560
6561 int tracing_set_tracer(struct trace_array *tr, const char *buf)
6562 {
6563 struct tracer *t;
6564 #ifdef CONFIG_TRACER_MAX_TRACE
6565 bool had_max_tr;
6566 #endif
6567 int ret = 0;
6568
6569 mutex_lock(&trace_types_lock);
6570
6571 if (!tr->ring_buffer_expanded) {
6572 ret = __tracing_resize_ring_buffer(tr, trace_buf_size,
6573 RING_BUFFER_ALL_CPUS);
6574 if (ret < 0)
6575 goto out;
6576 ret = 0;
6577 }
6578
6579 for (t = trace_types; t; t = t->next) {
6580 if (strcmp(t->name, buf) == 0)
6581 break;
6582 }
6583 if (!t) {
6584 ret = -EINVAL;
6585 goto out;
6586 }
6587 if (t == tr->current_trace)
6588 goto out;
6589
6590 #ifdef CONFIG_TRACER_SNAPSHOT
6591 if (t->use_max_tr) {
6592 local_irq_disable();
6593 arch_spin_lock(&tr->max_lock);
6594 if (tr->cond_snapshot)
6595 ret = -EBUSY;
6596 arch_spin_unlock(&tr->max_lock);
6597 local_irq_enable();
6598 if (ret)
6599 goto out;
6600 }
6601 #endif
6602 /* Some tracers won't work on kernel command line */
6603 if (system_state < SYSTEM_RUNNING && t->noboot) {
6604 pr_warn("Tracer '%s' is not allowed on command line, ignored\n",
6605 t->name);
6606 goto out;
6607 }
6608
6609 /* Some tracers are only allowed for the top level buffer */
6610 if (!trace_ok_for_array(t, tr)) {
6611 ret = -EINVAL;
6612 goto out;
6613 }
6614
6615 /* If trace pipe files are being read, we can't change the tracer */
6616 if (tr->trace_ref) {
6617 ret = -EBUSY;
6618 goto out;
6619 }
6620
6621 trace_branch_disable();
6622
6623 tr->current_trace->enabled--;
6624
6625 if (tr->current_trace->reset)
6626 tr->current_trace->reset(tr);
6627
6628 #ifdef CONFIG_TRACER_MAX_TRACE
6629 had_max_tr = tr->current_trace->use_max_tr;
6630
6631 /* Current trace needs to be nop_trace before synchronize_rcu */
6632 tr->current_trace = &nop_trace;
6633
6634 if (had_max_tr && !t->use_max_tr) {
6635 /*
6636 * We need to make sure that the update_max_tr sees that
6637 * current_trace changed to nop_trace to keep it from
6638 * swapping the buffers after we resize it.
6639 * The update_max_tr is called from interrupts disabled
6640 * so a synchronized_sched() is sufficient.
6641 */
6642 synchronize_rcu();
6643 free_snapshot(tr);
6644 tracing_disarm_snapshot_locked(tr);
6645 }
6646
6647 if (t->use_max_tr) {
> 6648 ret = tracing_arm_snapshot_locked(tr);
6649 if (ret)
6650 goto out;
6651 }
6652 #else
6653 tr->current_trace = &nop_trace;
6654 #endif
6655
6656 if (t->init) {
6657 ret = tracer_init(t, tr);
6658 if (ret) {
6659 #ifdef CONFIG_TRACER_MAX_TRACE
6660 if (t->use_max_tr)
6661 tracing_disarm_snapshot_locked(tr);
6662 #endif
6663 goto out;
6664 }
6665 }
6666
6667 tr->current_trace = t;
6668 tr->current_trace->enabled++;
6669 trace_branch_enable(tr);
6670 out:
6671 mutex_unlock(&trace_types_lock);
6672
6673 return ret;
6674 }
6675

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki