函数源码

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source File:kernel\locking\lockdep.c Create Date:2022-07-27 10:50:29
首页 Copyright©Brick

4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
/*
 * Check whether we follow the irq-flags state precisely:
 */
static void check_flags(unsigned long flags)
{
#if defined(CONFIG_PROVE_LOCKING) && defined(CONFIG_DEBUG_LOCKDEP)
    if (!debug_locks)
        return;
 
    if (irqs_disabled_flags(flags)) {
        if (DEBUG_LOCKS_WARN_ON(current->hardirqs_enabled)) {
            printk("possible reason: unannotated irqs-off.\n");
        }
    } else {
        if (DEBUG_LOCKS_WARN_ON(!current->hardirqs_enabled)) {
            printk("possible reason: unannotated irqs-on.\n");
        }
    }
 
    /*
     * We dont accurately track softirq state in e.g.
     * hardirq contexts (such as on 4KSTACKS), so only
     * check if not in hardirq contexts:
     */
    if (!hardirq_count()) {
        if (softirq_count()) {
            /* like the above, but with softirqs */
            DEBUG_LOCKS_WARN_ON(current->softirqs_enabled);
        } else {
            /* lick the above, does it taste good? */
            DEBUG_LOCKS_WARN_ON(!current->softirqs_enabled);
        }
    }
 
    if (!debug_locks)
        print_irqtrace_events(current);
#endif
}