From: Knut Omang Date: Wed, 10 Aug 2016 11:07:55 +0000 (+0200) Subject: sif: fmr: invalidate keys before TLB bulk invalidates X-Git-Tag: v4.1.12-92~87^2~7 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a27fbc4c36eec52e8af8152ce96862d8d31be71e;p=users%2Fjedix%2Flinux-maple.git sif: fmr: invalidate keys before TLB bulk invalidates This commit reorders and sequentializes the cleanup phase when bulk invalidates are used. The order was to post the TLB flushing operation to the EPSC, then invalidate keys (potentially in parallel with the ongoing flushing) before finally waiting for the TLB flushing to complete. This way is not considered safe in general, as an incoming access to a key can cause an invalidated PTE or PTW to be cached again and later cause sif to read or write to a no longer valid location. This commit makes sure that all keys are invalidated before the TLB flushing is triggered. Orabug: 24438867 Signed-off-by: Knut Omang Reviewed-by: HÃ¥kon Bugge --- diff --git a/drivers/infiniband/hw/sif/sif_fmr.c b/drivers/infiniband/hw/sif/sif_fmr.c index bb88476fa5ba..0dc18dd28ea9 100644 --- a/drivers/infiniband/hw/sif/sif_fmr.c +++ b/drivers/infiniband/hw/sif/sif_fmr.c @@ -173,7 +173,6 @@ int sif_unmap_phys_fmr_list(struct list_head *fmr_list) list_for_each_entry(ib_fmr, fmr_list, list) { cnt++; if (cnt >= sif_fmr_cache_flush_threshold) { - ret = sif_post_flush_tlb(sdev, true); flush_all = true; goto key_to_invalid; } @@ -214,6 +213,9 @@ key_to_invalid: cnt, (spqp ? " (stencil)" : "")); if (flush_all) { + ret = sif_post_flush_tlb(sdev, true); + if (ret) + goto out; ret = sif_complete_flush_tlb(sdev); if (ret) goto out;