• Petr Tesarik's avatar
    swiotlb: always set the number of areas before allocating the pool · aabd1260
    Petr Tesarik authored
    The number of areas defaults to the number of possible CPUs. However, the
    total number of slots may have to be increased after adjusting the number
    of areas. Consequently, the number of areas must be determined before
    allocating the memory pool. This is even explained with a comment in
    swiotlb_init_remap(), but swiotlb_init_late() adjusts the number of areas
    after slots are already allocated. The areas may end up being smaller than
    IO_TLB_SEGSIZE, which breaks per-area locking.
    
    While fixing swiotlb_init_late(), move all relevant comments before the
    definition of swiotlb_adjust_nareas() and convert them to kernel-doc.
    
    Fixes: 20347fca ("swiotlb: split up the global swiotlb lock")
    Signed-off-by: default avatarPetr Tesarik <petr.tesarik.ext@huawei.com>
    Reviewed-by: default avatarRoberto Sassu <roberto.sassu@huawei.com>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    aabd1260
swiotlb.c 29.9 KB