浏览代码

vfio/spapr: Add cond_resched() for huge updates

Clearing very big IOMMU tables can trigger soft lockups. This adds
cond_resched() to allow the scheduler to do context switching when
it decides to.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Alexey Kardashevskiy 7 年之前
父节点
当前提交
5c2fefd882
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      drivers/vfio/vfio_iommu_spapr_tce.c

+ 2 - 0
drivers/vfio/vfio_iommu_spapr_tce.c

@@ -507,6 +507,8 @@ static int tce_iommu_clear(struct tce_container *container,
 	enum dma_data_direction direction;
 	enum dma_data_direction direction;
 
 
 	for ( ; pages; --pages, ++entry) {
 	for ( ; pages; --pages, ++entry) {
+		cond_resched();
+
 		direction = DMA_NONE;
 		direction = DMA_NONE;
 		oldhpa = 0;
 		oldhpa = 0;
 		ret = iommu_tce_xchg(tbl, entry, &oldhpa, &direction);
 		ret = iommu_tce_xchg(tbl, entry, &oldhpa, &direction);