I submit with BLK_MQ_REQ_RESERVED | BLK_MQ_REQ_NOWAIT, that never locked in my testing done on a couple of different configurations. Of course, it does not say it won't lock elsewhere ;) Unfortunately any queuing is chewing up performance, so I'm trying to find ways around. On Tue, May 22, 2018 at 10:32 AM, Jens Axboe <axboe@xxxxxxxxx> wrote: > On 5/22/18 8:29 AM, Vitaly Mayatskih wrote: >> Hi, >> >> I'm working on a new network block device and see occasional deadlocks >> when trying to submit_bio from softirq (network rcv handler). This may >> be a new use case for blk-mq, but I think context spinlock should be >> really taken with bh disabled. I *seem* can avoid the deadlock if bio >> has BIO_NOMERGE set, but I need to merge bios for better network >> utilization (no merge costs about 15% of bandwidth). Did I miss >> something, or the lock indeed needs no bh for that case (recursive >> ctx->lock in softirq)? > > You can't call submit_bio() from irq/soft irq context, it will > potentially sleep for a new request. The various locks for blk-mq > have been carefully designed _not_ to need irq/bh disabling, but > that's really orthogonal to the previous comment which is your > main issue. > > -- > Jens Axboe > -- wbr, Vitaly