tree:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
head:   f1b2f6eccf99fc457221cc84c7550a8e3b17d4df
commit: f1b2f6eccf99fc457221cc84c7550a8e3b17d4df [7/7] locking/lockdep, 
cpu/hotplug: Annotate AP thread
config: x86_64-randconfig-x014-201836 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        git checkout f1b2f6eccf99fc457221cc84c7550a8e3b17d4df
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/spinlock_types.h:18:0,
                    from include/linux/spinlock.h:82,
                    from include/linux/wait.h:9,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6,
                    from include/linux/proc_fs.h:9,
                    from kernel/cpu.c:6:
   kernel/cpu.c: In function 'cpuhp_thread_fun':
>> kernel/cpu.c:624:17: error: 'cpu_hotplug_lock' undeclared (first use in this 
>> function); did you mean 'cpu_hotplug_done'?
     rwsem_acquire(&cpu_hotplug_lock.rw_sem.dep_map, 0, 0, _THIS_IP_);
                    ^
   include/linux/lockdep.h:555:61: note: in definition of macro 
'lock_acquire_exclusive'
    #define lock_acquire_exclusive(l, s, t, n, i)  lock_acquire(l, s, t, 0, 1, 
n, i)
                                                                ^
>> kernel/cpu.c:624:2: note: in expansion of macro 'rwsem_acquire'
     rwsem_acquire(&cpu_hotplug_lock.rw_sem.dep_map, 0, 0, _THIS_IP_);
     ^~~~~~~~~~~~~
   kernel/cpu.c:624:17: note: each undeclared identifier is reported only once 
for each function it appears in
     rwsem_acquire(&cpu_hotplug_lock.rw_sem.dep_map, 0, 0, _THIS_IP_);
                    ^
   include/linux/lockdep.h:555:61: note: in definition of macro 
'lock_acquire_exclusive'
    #define lock_acquire_exclusive(l, s, t, n, i)  lock_acquire(l, s, t, 0, 1, 
n, i)
                                                                ^
>> kernel/cpu.c:624:2: note: in expansion of macro 'rwsem_acquire'
     rwsem_acquire(&cpu_hotplug_lock.rw_sem.dep_map, 0, 0, _THIS_IP_);
     ^~~~~~~~~~~~~

vim +624 kernel/cpu.c

   589  
   590  /*
   591   * Execute teardown/startup callbacks on the plugged cpu. Also used to 
invoke
   592   * callbacks when a state gets [un]installed at runtime.
   593   *
   594   * Each invocation of this function by the smpboot thread does a single 
AP
   595   * state callback.
   596   *
   597   * It has 3 modes of operation:
   598   *  - single: runs st->cb_state
   599   *  - up:     runs ++st->state, while st->state < st->target
   600   *  - down:   runs st->state--, while st->state > st->target
   601   *
   602   * When complete or on error, should_run is cleared and the completion 
is fired.
   603   */
   604  static void cpuhp_thread_fun(unsigned int cpu)
   605  {
   606          struct cpuhp_cpu_state *st = this_cpu_ptr(&cpuhp_state);
   607          bool bringup = st->bringup;
   608          enum cpuhp_state state;
   609  
   610          if (WARN_ON_ONCE(!st->should_run))
   611                  return;
   612  
   613          /*
   614           * ACQUIRE for the cpuhp_should_run() load of ->should_run. 
Ensures
   615           * that if we see ->should_run we also see the rest of the 
state.
   616           */
   617          smp_mb();
   618  
   619          /*
   620           * The BP holds the hotplug lock, but we're now running on the 
AP,
   621           * ensure that anybody asserting the lock is held, will 
actually find
   622           * it so.
   623           */
 > 624          rwsem_acquire(&cpu_hotplug_lock.rw_sem.dep_map, 0, 0, 
 > _THIS_IP_);
   625          cpuhp_lock_acquire(bringup);
   626  
   627          if (st->single) {
   628                  state = st->cb_state;
   629                  st->should_run = false;
   630          } else {
   631                  if (bringup) {
   632                          st->state++;
   633                          state = st->state;
   634                          st->should_run = (st->state < st->target);
   635                          WARN_ON_ONCE(st->state > st->target);
   636                  } else {
   637                          state = st->state;
   638                          st->state--;
   639                          st->should_run = (st->state > st->target);
   640                          WARN_ON_ONCE(st->state < st->target);
   641                  }
   642          }
   643  
   644          WARN_ON_ONCE(!cpuhp_is_ap_state(state));
   645  
   646          if (cpuhp_is_atomic_state(state)) {
   647                  local_irq_disable();
   648                  st->result = cpuhp_invoke_callback(cpu, state, bringup, 
st->node, &st->last);
   649                  local_irq_enable();
   650  
   651                  /*
   652                   * STARTING/DYING must not fail!
   653                   */
   654                  WARN_ON_ONCE(st->result);
   655          } else {
   656                  st->result = cpuhp_invoke_callback(cpu, state, bringup, 
st->node, &st->last);
   657          }
   658  
   659          if (st->result) {
   660                  /*
   661                   * If we fail on a rollback, we're up a creek without no
   662                   * paddle, no way forward, no way back. We loose, 
thanks for
   663                   * playing.
   664                   */
   665                  WARN_ON_ONCE(st->rollback);
   666                  st->should_run = false;
   667          }
   668  
   669          cpuhp_lock_release(bringup);
   670          rwsem_release(&cpu_hotplug_lock.rw_sem.dep_map, 1, _THIS_IP_);
   671  
   672          if (!st->should_run)
   673                  complete_ap_thread(st, bringup);
   674  }
   675  

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip

Reply via email to