Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\locking\lockdep.c Create Date:2022-07-28 09:49:37
Last Modify:2020-03-17 14:16:01 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name: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.

Proto:static bool assign_lock_key(struct lockdep_map *lock)

Type:bool

Parameter:

TypeParameterName
struct lockdep_map *lock
855  addr = lock
865  BUILD_BUG_ON - break compile if a condition is true(sizeof(structlock_class_key) > sizeof(raw_spinlock_t))
868  If __is_kernel_percpu_address(addr, & can_addr) Then key = can_addr
870  Else if __is_module_percpu_address(addr, & can_addr) Then key = can_addr
872  Else if Is this the address of a static object: Then key = lock
874  Else
876  Generic 'turn off all lock debugging' function:
877  pr_err("INFO: trying to register non-static key.\n")
878  pr_err("the code is fine but needs lockdep annotation.\n")
879  pr_err("turning off the locking correctness validator.\n")
880  dump_stack()
881  Return false
884  Return true
Caller
NameDescribe
register_lock_classRegister 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.