Commit 8607056
iommufd/selftest: Add refcount to mock_iommu_device
For an iommu_dev that can unplug (so far only this selftest does so), the
viommu->iommu_dev pointer has no guarantee of its life cycle after it is
copied from the idev->dev->iommu->iommu_dev.
Track the user count of the iommu_dev. Postpone the exit routine using a
completion, if refcount is unbalanced. The refcount inc/dec will be added
in the following patch.
Link: https://patch.msgid.link/r/33f28d64841b497eebef11b49a571e03103c5d24.1730836219.git.nicolinc@nvidia.com
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>1 parent 18f8199 commit 8607056
1 file changed
Lines changed: 31 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
533 | 533 | | |
534 | 534 | | |
535 | 535 | | |
536 | | - | |
537 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
538 | 541 | | |
539 | 542 | | |
540 | 543 | | |
541 | 544 | | |
542 | 545 | | |
543 | | - | |
| 546 | + | |
544 | 547 | | |
545 | 548 | | |
546 | 549 | | |
| |||
1556 | 1559 | | |
1557 | 1560 | | |
1558 | 1561 | | |
1559 | | - | |
| 1562 | + | |
1560 | 1563 | | |
1561 | 1564 | | |
1562 | 1565 | | |
1563 | 1566 | | |
1564 | 1567 | | |
1565 | | - | |
| 1568 | + | |
1566 | 1569 | | |
1567 | 1570 | | |
1568 | 1571 | | |
1569 | 1572 | | |
1570 | 1573 | | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
1571 | 1577 | | |
1572 | 1578 | | |
1573 | 1579 | | |
1574 | 1580 | | |
1575 | 1581 | | |
1576 | | - | |
| 1582 | + | |
1577 | 1583 | | |
1578 | 1584 | | |
1579 | 1585 | | |
| |||
1583 | 1589 | | |
1584 | 1590 | | |
1585 | 1591 | | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
| 1595 | + | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
1586 | 1608 | | |
1587 | 1609 | | |
1588 | 1610 | | |
1589 | 1611 | | |
1590 | 1612 | | |
1591 | 1613 | | |
1592 | 1614 | | |
1593 | | - | |
1594 | | - | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
1595 | 1618 | | |
1596 | 1619 | | |
1597 | 1620 | | |
| |||
0 commit comments