Commit 868720f
iommu/vt-d: Replace spin_lock with mutex to protect domain ida
The domain ID allocator is currently protected by a spin_lock. However,
ida_alloc_range can potentially block if it needs to allocate memory to
grow its internal structures.
Replace the spin_lock with a mutex which allows sleep on block. Thus,
the memory allocation flags can be updated from GFP_ATOMIC to GFP_KERNEL
to allow blocking memory allocations if necessary.
Introduce a new mutex, did_lock, specifically for protecting the domain
ida. The existing spinlock will remain for protecting other intel_iommu
fields.
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20250430021135.2370244-3-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>1 parent f93b4ac commit 868720f
3 files changed
+7
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
| 1104 | + | |
1104 | 1105 | | |
1105 | 1106 | | |
1106 | 1107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1345 | 1345 | | |
1346 | 1346 | | |
1347 | 1347 | | |
1348 | | - | |
| 1348 | + | |
1349 | 1349 | | |
1350 | 1350 | | |
1351 | 1351 | | |
1352 | | - | |
1353 | 1352 | | |
1354 | 1353 | | |
1355 | 1354 | | |
1356 | 1355 | | |
1357 | 1356 | | |
1358 | | - | |
| 1357 | + | |
1359 | 1358 | | |
1360 | 1359 | | |
1361 | 1360 | | |
| |||
1365 | 1364 | | |
1366 | 1365 | | |
1367 | 1366 | | |
1368 | | - | |
| 1367 | + | |
1369 | 1368 | | |
1370 | 1369 | | |
1371 | 1370 | | |
1372 | 1371 | | |
1373 | 1372 | | |
1374 | | - | |
1375 | 1373 | | |
1376 | 1374 | | |
1377 | 1375 | | |
1378 | 1376 | | |
1379 | 1377 | | |
1380 | | - | |
1381 | 1378 | | |
1382 | 1379 | | |
1383 | 1380 | | |
| |||
1389 | 1386 | | |
1390 | 1387 | | |
1391 | 1388 | | |
1392 | | - | |
| 1389 | + | |
1393 | 1390 | | |
1394 | 1391 | | |
1395 | 1392 | | |
1396 | 1393 | | |
1397 | 1394 | | |
1398 | 1395 | | |
1399 | 1396 | | |
1400 | | - | |
1401 | 1397 | | |
1402 | 1398 | | |
1403 | 1399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
722 | 722 | | |
723 | 723 | | |
724 | 724 | | |
| 725 | + | |
| 726 | + | |
725 | 727 | | |
726 | 728 | | |
727 | 729 | | |
| |||
0 commit comments