From a27fbc4c36eec52e8af8152ce96862d8d31be71e Mon Sep 17 00:00:00 2001 From: Knut Omang Date: Wed, 10 Aug 2016 13:07:55 +0200 Subject: [PATCH] sif: fmr: invalidate keys before TLB bulk invalidates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- drivers/infiniband/hw/sif/sif_fmr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- 2.50.1