Re: [rcu:dev.2020.06.02a 85/90] kernel/smp.c:122: undefined reference to `__udivdi3'
From: Paul E. McKenney
Date: Fri Jun 05 2020 - 18:11:36 EST
On Sat, Jun 06, 2020 at 05:38:31AM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev.2020.06.02a
> head: 5216948905dd07a84cef8a7dc72c2ec076802efd
> commit: 92ebbb71443dced2019cd24b737ce60b03a29e10 [85/90] EXP kernel/smp: Provide CSD lock timeout diagnostics
> config: i386-randconfig-c001-20200605 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> All errors (new ones prefixed by >>, old ones prefixed by <<):
>
> ld: kernel/smp.o: in function `csd_lock_wait':
> >> kernel/smp.c:122: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:128: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:136: undefined reference to `__umoddi3'
> ld: kernel/smp.c:136: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:122: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:128: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:136: undefined reference to `__umoddi3'
> ld: kernel/smp.c:136: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:122: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:128: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:136: undefined reference to `__umoddi3'
> ld: kernel/smp.c:136: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:122: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:128: undefined reference to `__udivdi3'
> >> ld: kernel/smp.c:136: undefined reference to `__umoddi3'
> ld: kernel/smp.c:136: undefined reference to `__udivdi3'
Good catch, thank you, fixup patch applied.
Thanx, Paul
> vim +122 kernel/smp.c
>
> 107
> 108 /*
> 109 * csd_lock/csd_unlock used to serialize access to per-cpu csd resources
> 110 *
> 111 * For non-synchronous ipi calls the csd can still be in use by the
> 112 * previous function call. For multi-cpu calls its even more interesting
> 113 * as we'll have to ensure no other cpu is observing our csd.
> 114 */
> 115 static __always_inline void csd_lock_wait(call_single_data_t *csd)
> 116 {
> 117 int bug_id = 0;
> 118 int cpu;
> 119 call_single_data_t *cpu_cur_csd;
> 120 u64 ts0, ts1, ts2, ts_delta;
> 121
> > 122 ts1 = ts0 = sched_clock() / 1000 / 1000;
> 123 for (;;) {
> 124 unsigned long flags = READ_ONCE(csd->flags);
> 125
> 126 if (!(flags & CSD_FLAG_LOCK))
> 127 break;
> > 128 ts2 = sched_clock() / 1000 / 1000;
> 129 ts_delta = ts2 - ts1;
> 130 if (unlikely(ts_delta > CSD_LOCK_TIMEOUT)) {
> 131 bug_id = atomic_inc_return(&csd_bug_count);
> 132 cpu = csd->cpu;
> 133 smp_mb(); // No stale cur_csd values!
> 134 cpu_cur_csd = per_cpu(cur_csd, cpu);
> 135 smp_mb(); // No refetching cur_csd values!
> > 136 printk("csd: Detected non-responsive CSD lock (#%d) on CPU#%d, waiting %Ld.%03Ld secs for CPU#%02d %pf(%ps), currently %s.\n",
> 137 bug_id, raw_smp_processor_id(),
> 138 ts_delta/1000ULL, ts_delta % 1000ULL, cpu,
> 139 csd->func, csd->info,
> 140 !cpu_cur_csd ? "unresponsive"
> 141 : csd == cpu_cur_csd
> 142 ? "handling this request"
> 143 : "handling prior request");
> 144 if (!trigger_single_cpu_backtrace(cpu))
> 145 dump_cpu_task(cpu);
> 146 if (!cpu_cur_csd) {
> 147 printk("csd: Re-sending CSD lock (#%d) IPI from CPU#%02d to CPU#%02d\n", bug_id, raw_smp_processor_id(), cpu);
> 148 arch_send_call_function_single_ipi(cpu);
> 149 }
> 150 dump_stack();
> 151 ts1 = ts2;
> 152 }
> 153 cpu_relax();
> 154 }
> 155 smp_acquire__after_ctrl_dep();
> 156 if (unlikely(bug_id))
> 157 printk("csd: CSD lock (#%d) got unstuck on CPU#%02d, CPU#%02d released the lock after all. Phew!\n", bug_id, raw_smp_processor_id(), cpu);
> 158 }
> 159
>
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx