Re: [PATCH] swiotlb: fix the deadlock in swiotlb_do_find_slots

From: Guorui Yu
Date: Mon Feb 13 2023 - 04:37:14 EST




在 2023/2/13 17:28, kernel test robot 写道:
Hi GuoRui.Yu",

Thank you for the patch! Perhaps something to improve:

654 spin_lock_irqsave(&area->lock, flags);
655 if (unlikely(nslots > mem->area_nslabs - area->used))
656 goto not_found;
657
658 slot_base = area_index * mem->area_nslabs;
659 index = wrap = wrap_area_index(mem, ALIGN(area->index, stride));
index_nowrap should be initialized to "index" here, and I will add this in v2.

I have done some stress tests locally to check if they can avoid the deadlock but they did not reveal this problem, I will pay more attention next time.
660
661 do {

Guorui