函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\lockdep.c Create Date:2022-07-27 10:50:04
Last Modify:2020-03-17 14:16:01 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Register a lock's class in the hash-table, if the class is not present* yet. Otherwise we look it up. We cache the result in the lock object* itself, so actual lookup of the hash should be once per lock object.

函数原型:static struct lock_class *register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)

返回类型:struct lock_class

参数:

类型参数名称
struct lockdep_map *lock
unsigned intsubclass
intforce
1182  DEBUG_LOCKS_WARN_ON(!已禁止中断())
1184  class等于look_up_lock_class(lock, subclass)
1185  如果此条件成立可能性大(为编译器优化)(class)则转到:out_set_class_cache
1188  如果非key
1189  如果非Static locks do not have their class-keys yet - for them the key is* the lock object itself. If the lock is in the per cpu area, the* canonical address of the lock (per cpu offset removed) is used.则返回:NULL
1191  否则如果非Is this the address of a static object:且非Check whether a key has been registered as a dynamic key.
1192  返回:NULL
1195  key等于subkeyssubclass
1196  hash_head等于classhashentry(key)
1198  如果非graph_lock()则
1199  返回:NULL
1206  如果key恒等于key则转到:out_unlock_set
1210  Initialize the lock_classes[] array elements, the free_lock_classes list* and also the delayed_free structure.
1213  class等于list_first_entry_or_null - get the first element from a list*@ptr: the list head to take the element from.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.( & free_lock_classes, typeof( * class), lock_entry)
1215  如果非class
1217  返回:NULL
1220  print_lockdep_off("BUG: MAX_LOCKDEP_KEYS too low!")
1221  dump_stack()
1222  返回:NULL
1224  nr_lock_classes自加
1225  __set_bit - Set a bit in memory*@nr: the bit to set*@addr: the address to start counting from* Unlike set_bit(), this function is non-atomic. If it is called on the same* region of memory concurrently, the effect may be that only one operation* succeeds.
1226  debug_atomic_inc(nr_unused_locks)
1227  key等于key
1228  name等于name
1229  subclass等于subclass
1230  WARN_ON_ONCE(!链表为空)
1231  WARN_ON_ONCE(!链表为空)
1232  name_version等于To make lock name printouts unique, we calculate a unique* class->name_version generation counter. The caller must hold the graph* lock.
1237  添加哈希记录
1242  链表项移动到尾部
1244  如果verbose(class)则
1245  graph_unlock()
1247  printk("\nnew class %px: %s", key, name)
1248  如果name_version大于1则printk(Annotation for a "continued" line of log printout (only done after a* line that had no enclosing \n). Only to be used by core/arch code* during early bootup (a continued line is not SMP-safe otherwise)."#%d", name_version)
1250  printk(Annotation for a "continued" line of log printout (only done after a* line that had no enclosing \n). Only to be used by core/arch code* during early bootup (a continued line is not SMP-safe otherwise)."\n")
1251  dump_stack()
1253  如果非graph_lock()则
1254  返回:NULL
1257  out_unlock_set :
1258  graph_unlock()
1260  out_set_class_cache :
1261  如果非subclassforceclass_cache[0]等于class
1263  否则如果subclass小于NR_LOCKDEP_CACHING_CLASSESclass_cache[subclass]等于class
1270  如果DEBUG_LOCKS_WARN_ON(subclass != subclass)则返回:NULL
1273  返回:class
调用者
名称描述
lockdep_init_mapInitialize a lock instance's lock-class mapping info:
__lock_acquireThis gets called for every mutex_lock*()/spin_lock*() operation
__lock_set_class