kernel-hacking-2024-linux-s.../drivers/iommu
Robin Murphy 85c7a0f1ef iommu/io-pgtable-arm: Fix race handling in split_blk_unmap()
In removing the pagetable-wide lock, we gained the possibility of the
vanishingly unlikely case where we have a race between two concurrent
unmappers splitting the same block entry. The logic to handle this is
fairly straightforward - whoever loses the race frees their partial
next-level table and instead dereferences the winner's newly-installed
entry in order to fall back to a regular unmap, which intentionally
echoes the pre-existing case of recursively splitting a 1GB block down
to 4KB pages by installing a full table of 2MB blocks first.

Unfortunately, the chump who implemented that logic failed to update the
condition check for that fallback, meaning that if said race occurs at
the last level (where the loser's unmap_idx is valid) then the unmap
won't actually happen. Fix that to properly account for both the race
and recursive cases.

Fixes: 2c3d273eab ("iommu/io-pgtable-arm: Support lockless operation")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
[will: re-jig control flow to avoid duplicate cmpxchg test]
Signed-off-by: Will Deacon <will.deacon@arm.com>
2018-10-01 13:01:29 +01:00
..
amd_iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
amd_iommu_debugfs.c iommu/amd: Add basic debugfs infrastructure for AMD IOMMU 2018-07-06 14:06:30 +02:00
amd_iommu_init.c Merge branches 'arm/shmobile', 'arm/renesas', 'arm/msm', 'arm/smmu', 'arm/omap', 'x86/amd', 'x86/vt-d' and 'core' into next 2018-08-08 12:02:27 +02:00
amd_iommu_proto.h iommu/amd: Add basic debugfs infrastructure for AMD IOMMU 2018-07-06 14:06:30 +02:00
amd_iommu_types.h Merge branches 'arm/shmobile', 'arm/renesas', 'arm/msm', 'arm/smmu', 'arm/omap', 'x86/amd', 'x86/vt-d' and 'core' into next 2018-08-08 12:02:27 +02:00
amd_iommu_v2.c mm: convert return type of handle_mm_fault() caller to vm_fault_t 2018-08-17 16:20:28 -07:00
arm-smmu-regs.h
arm-smmu-v3.c iommu/arm-smmu-v3: Fix a couple of minor comment typos 2018-10-01 13:01:29 +01:00
arm-smmu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
dma-iommu.c iommu/dma: Respect bus DMA limit for IOVAs 2018-07-27 19:01:06 +02:00
dmar.c iommu/vt-d: Fix dev iotlb pfsid use 2018-07-06 13:26:10 +02:00
exynos-iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
fsl_pamu.c
fsl_pamu.h
fsl_pamu_domain.c
fsl_pamu_domain.h
intel-iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
intel-pasid.c iommu/vt-d: Per PCI device pasid table interfaces 2018-07-20 14:44:24 +02:00
intel-pasid.h iommu/vt-d: Per PCI device pasid table interfaces 2018-07-20 14:44:24 +02:00
intel-svm.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
intel_irq_remapping.c irq_remapping: Use apic_ack_irq() 2018-06-06 15:18:20 +02:00
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Abort allocation when table address overflows the PTE 2018-07-26 11:34:58 +01:00
io-pgtable-arm.c iommu/io-pgtable-arm: Fix race handling in split_blk_unmap() 2018-10-01 13:01:29 +01:00
io-pgtable.c
io-pgtable.h iommu/io-pgtable: Use size_t return type for all foo_unmap 2018-02-13 19:31:32 +01:00
iommu-debugfs.c iommu: Enable debugfs exposure of IOMMU driver internals 2018-07-06 14:06:30 +02:00
iommu-sysfs.c
iommu-traces.c
iommu.c iommu: Remove the ->map_sg indirection 2018-08-08 11:06:20 +02:00
iova.c
ipmmu-vmsa.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
irq_remapping.c irq_remapping: Use apic_ack_irq() 2018-06-06 15:18:20 +02:00
irq_remapping.h irq_remapping: Use apic_ack_irq() 2018-06-06 15:18:20 +02:00
Kconfig Merge branches 'arm/shmobile', 'arm/renesas', 'arm/msm', 'arm/smmu', 'arm/omap', 'x86/amd', 'x86/vt-d' and 'core' into next 2018-08-08 12:02:27 +02:00
Makefile Merge branches 'arm/shmobile', 'arm/renesas', 'arm/msm', 'arm/smmu', 'arm/omap', 'x86/amd', 'x86/vt-d' and 'core' into next 2018-08-08 12:02:27 +02:00
msm_iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
msm_iommu.h
msm_iommu_hw-8xxx.h
mtk_iommu.c iommu: Remove the ->map_sg indirection 2018-08-08 11:06:20 +02:00
mtk_iommu.h iommu/mediatek: Fix protect memory setting 2018-03-21 06:13:57 -05:00
mtk_iommu_v1.c iommu: Remove the ->map_sg indirection 2018-08-08 11:06:20 +02:00
of_iommu.c iommu: Remove IOMMU_OF_DECLARE 2018-07-10 17:22:35 +02:00
omap-iommu-debug.c
omap-iommu.c Merge branches 'arm/shmobile', 'arm/renesas', 'arm/msm', 'arm/smmu', 'arm/omap', 'x86/amd', 'x86/vt-d' and 'core' into next 2018-08-08 12:02:27 +02:00
omap-iommu.h
omap-iopgtable.h
qcom_iommu.c IOMMU Update for Linux v4.19 2018-08-24 13:10:38 -07:00
rockchip-iommu.c ARM: SoC: late updates 2018-08-25 14:12:36 -07:00
s390-iommu.c
tegra-gart.c iommu: Remove the ->map_sg indirection 2018-08-08 11:06:20 +02:00
tegra-smmu.c iommu: Remove the ->map_sg indirection 2018-08-08 11:06:20 +02:00