• Qian Cai's avatar
    powerpc/mm/book3s64/iommu: fix some RCU-list locks · b5952f81
    Qian Cai authored
    It is safe to traverse mm->context.iommu_group_mem_list with either
    mem_list_mutex or the RCU read lock held. Silence a few RCU-list false
    positive warnings and fix a few missing RCU read locks.
    
     arch/powerpc/mm/book3s64/iommu_api.c:330 RCU-list traversed in non-reader section!!
    
     other info that might help us debug this:
    
     rcu_scheduler_active = 2, debug_locks = 1
     2 locks held by qemu-kvm/4305:
      #0: c000000bc3fe4d68 (&container->lock){+.+.}-{3:3}, at: tce_iommu_ioctl.part.9+0xc7c/0x1870 [vfio_iommu_spapr_tce]
      #1: c000000001501910 (mem_list_mutex){+.+.}-{3:3}, at: mm_iommu_get+0x50/0x190
    
     ====
     arch/powerpc/mm/book3s64/iommu_api.c:132 RCU-list traversed in non-reader section!!
    
     other info that might help us debug this:
    
     rcu_scheduler_active = 2, debug_locks = 1
     2 locks held by qemu-kvm/4305:
      #0: c000000bc3fe4d68 (&container->lock){+.+.}-{3:3}, at: tce_iommu_ioctl.part.9+0xc7c/0x1870 [vfio_iommu_spapr_tce]
      #1: c000000001501910 (mem_list_mutex){+.+.}-{3:3}, at: mm_iommu_do_alloc+0x120/0x5f0
    
     ====
     arch/powerpc/mm/book3s64/iommu_api.c:292 RCU-list traversed in non-reader section!!
    
     other info that might help us debug this:
    
     rcu_scheduler_active = 2, debug_locks = 1
     2 locks held by qemu-kvm/4312:
      #0: c000000ecafe23c8 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0xdc/0x950 [kvm]
      #1: c000000045e6c468 (&kvm->srcu){....}-{0:0}, at: kvmppc_h_put_tce+0x88/0x340 [kvm]
    
     ====
     arch/powerpc/mm/book3s64/iommu_api.c:424 RCU-list traversed in non-reader section!!
    
     other info that might help us debug this:
    
     rcu_scheduler_active = 2, debug_locks = 1
     2 locks held by qemu-kvm/4312:
      #0: c000000ecafe23c8 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0xdc/0x950 [kvm]
      #1: c000000045e6c468 (&kvm->srcu){....}-{0:0}, at: kvmppc_h_put_tce+0x88/0x340 [kvm]
    Signed-off-by: default avatarQian Cai <cai@lca.pw>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200510051559.1959-1-cai@lca.pw
    b5952f81
iommu_api.c 10.6 KB