diff options
Diffstat (limited to 'kernel/bpf/stackmap.c')
| -rw-r--r-- | kernel/bpf/stackmap.c | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/kernel/bpf/stackmap.c b/kernel/bpf/stackmap.c index 052580c33d26..3f958b90d914 100644 --- a/kernel/bpf/stackmap.c +++ b/kernel/bpf/stackmap.c @@ -287,16 +287,17 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,  	bool irq_work_busy = false;  	struct stack_map_irq_work *work = NULL; -	if (in_nmi()) { +	if (irqs_disabled()) {  		work = this_cpu_ptr(&up_read_work); -		if (work->irq_work.flags & IRQ_WORK_BUSY) +		if (atomic_read(&work->irq_work.flags) & IRQ_WORK_BUSY)  			/* cannot queue more up_read, fallback */  			irq_work_busy = true;  	}  	/* -	 * We cannot do up_read() in nmi context. To do build_id lookup -	 * in nmi context, we need to run up_read() in irq_work. We use +	 * We cannot do up_read() when the irq is disabled, because of +	 * risk to deadlock with rq_lock. To do build_id lookup when the +	 * irqs are disabled, we need to run up_read() in irq_work. We use  	 * a percpu variable to do the irq_work. If the irq_work is  	 * already used by another lookup, we fall back to report ips.  	 * @@ -338,7 +339,7 @@ static void stack_map_get_build_id_offset(struct bpf_stack_build_id *id_offs,  		 * up_read_non_owner(). The rwsem_release() is called  		 * here to release the lock from lockdep's perspective.  		 */ -		rwsem_release(¤t->mm->mmap_sem.dep_map, 1, _RET_IP_); +		rwsem_release(¤t->mm->mmap_sem.dep_map, _RET_IP_);  	}  }  | 
