From: AMEET M. PARANJAPE <aparanja@redhat.com> Date: Wed, 5 Nov 2008 22:14:57 -0500 Subject: [openib] mthca: fix dma mapping leak Message-id: 20081106031422.3297.84049.sendpatchset@squad5-lp1.lab.bos.redhat.com O-Subject: [PATCH RHEL5.3 BZ469902 3/3] mthca: fix dma mapping leak (cell platform) Bugzilla: 469902 RH-Acked-by: David Howells <dhowells@redhat.com> RH-Acked-by: Doug Ledford <dledford@redhat.com> RHBZ#: ====== https://bugzilla.redhat.com/show_bug.cgi?id=469902 Description: =========== On the cell platform, ib_umem_get_dmasync and ib_umem_release_dmasync must be used in pairs in order to make sure that all DMA mappings get freed after the user memory is released. The mlx4 device driver did this correctly, but the mthca driver did not. On all other platforms and non-powerpc architectures, there is no bug and this patch does not change anything. Because of the slightly different ABI in the mainline kernel, this change is not required there. The problem was found during IBM internal patch review. RHEL Version Found: ================ RHEL 5.3 Beta kABI Status: ============ No symbols were harmed. Brew: ===== Built on all platforms. http://brewweb.devel.redhat.com/brew/taskinfo?taskID=1560071 Upstream Status: ================ Will post as soon as it becomes available. Test Status: ============ A performance decrease is discovered on RHEL5.3 Beta expecially when executing the IMB benchmark (formerly known as Pallas) on InfiniBand connections. The performance decrease is up to 50%. After applying these patches the performance degradation is no longer present. =============================================================== Ameet Paranjape 978-392-3903 ext 23903 IBM on-site partner Proposed Patch: =============== diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index f445918..260c4b5 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c @@ -1081,7 +1081,7 @@ err_mtt: mthca_free_mtt(dev, mr->mtt); err_umem: - ib_umem_release(mr->umem); + ib_umem_release_dmasync(mr->umem); err: kfree(mr); @@ -1094,7 +1094,7 @@ static int mthca_dereg_mr(struct ib_mr *mr) mthca_free_mr(to_mdev(mr->device), mmr); if (mmr->umem) - ib_umem_release(mmr->umem); + ib_umem_release_dmasync(mmr->umem); kfree(mmr); return 0;