函数逻辑报告 |
Source Code:kernel\locking\qspinlock.c |
Create Date:2022-07-27 10:51:58 |
Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:queued_spin_lock_slowpath - acquire the queued spinlock*@lock: Pointer to queued spinlock structure*@val: Current value of the queued spinlock 32-bit word* (queue tail, pending bit, lock value)* fast : slow : unlock* : :* uncontended (0,0,0) -:--> (0,0,1)
函数原型:void queued_spin_lock_slowpath(struct qspinlock *lock, unsigned int val)
返回类型:void
参数:
类型 | 参数 | 名称 |
---|---|---|
struct qspinlock * | lock | |
unsigned int | val |
320 | BUILD_BUG_ON - break compile if a condition is true(FIXME: This should be fixed in the arch's Kconfig >= (1U << _Q_TAIL_CPU_BITS)) |
322 | 如果pv_enabled()则转到:pv_queue |
325 | 如果virt_spin_lock(lock)则返回 |
334 | 如果val恒等于_Q_PENDING_VAL则 |
335 | cnt等于_Q_PENDING_LOOPS |
336 | val等于atomic_cond_read_relaxed( & val, (VAL != _Q_PENDING_VAL) || !cnt--) |
343 | 如果val按位与_Q_LOCKED_MASK的反则转到:queue |
360 | 如果此条件成立可能性小(为编译器优化)(val & ~_Q_LOCKED_MASK)则 |
363 | 如果非val按位与_Q_PENDING_MASK的值则lear_pending - clear the pending bit.*@lock: Pointer to queued spinlock structure* *,1,* -> *,0,* |
366 | 转到:queue |
380 | 如果val按位与_Q_LOCKED_MASK则atomic_cond_read_acquire( & val, !(VAL & _Q_LOCKED_MASK)) |
390 | 返回 |
396 | queue : |
398 | pv_queue : |
399 | node等于this_cpu_ptr( & mcs) |
400 | idx等于 nesting count, see qspinlock.c 自加 |
401 | tail等于We must be able to distinguish between no-tail and the tail at 0:0,* therefore increment the cpu number by one. |
412 | 如果此条件成立可能性小(为编译器优化)(idx >= MAX_NODES)则 |
414 | 当非queued_spin_trylock - try to acquire the queued spinlock*@lock : Pointer to queued spinlock structure* Return: 1 if lock acquired, 0 if failed循环 |
415 | cpu_relax() |
416 | 转到:release |
419 | node等于grab_mcs_node(node, idx) |
433 | 1 if lock acquired 等于0 |
434 | next = NULL |
435 | pv_init_node(node) |
442 | 如果queued_spin_trylock - try to acquire the queued spinlock*@lock : Pointer to queued spinlock structure* Return: 1 if lock acquired, 0 if failed则转到:release |
450 | smp_wmb() |
460 | next = NULL |
466 | 如果old按位与_Q_TAIL_MASK则 |
467 | prev等于decode_tail(old) |
470 | WRITE_ONCE(next, node) |
472 | pv_wait_node(node, prev) |
507 | 如果val等于pv_wait_head_or_lock(lock, node)则转到:locked |
510 | val等于atomic_cond_read_acquire( & val, !(VAL & _Q_LOCKED_PENDING_MASK)) |
512 | locked : |
534 | 如果val按位与_Q_TAIL_MASK的值恒等于tail则 |
535 | 如果atomic_try_cmpxchg_relaxed( & val, & val, _Q_LOCKED_VAL)则转到:release |
552 | smp_store_release() provides a memory barrier to ensure all* operations in the critical section has been completed before* unlocking.( & 1 if lock acquired ) |
553 | pv_kick_node(lock, next) |
555 | release : |
559 | __this_cpu_dec(count) |
名称 | 描述 |
---|---|
queued_spin_lock | queued_spin_lock - acquire a queued spinlock*@lock: Pointer to queued spinlock structure |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |