Skip to contentSkip to conversation

iommu/vt-d: Use per-cpu IOVA caching, suspend-to-ram causes machine hang

PATCH Applied Adam Morrison 4 participants 4 messages Jun 5, 2016 – Jun 27, 2016 IOMMU

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines

Hi Omer the following commit introduced a regression when doing suspend-to-ram. The machine never wakes up. We have more than a few machines that hang: SNB-i7-2620m, IVB-3370, HSW-4470r, BDW-5600u, BDW-525u.

Jan Niehusmann posted a patch that fixes a similar problem:

    http://www.mail-archive.com/[email protected]/msg1158159.html

Can you please try it and see if it does the trick for you?

Thanks,
Adam

#1 lore raw

Yes, that does it. Thanks.

Quoted 5 lines · Adam Morrison
Quoted 4 lines

Hi Omer the following commit introduced a regression when doing suspend-to-ram. The machine never wakes up. We have more than a few machines that hang: SNB-i7-2620m, IVB-3370, HSW-4470r, BDW-5600u, BDW-525u.

Quoted 8 lines

Jan Niehusmann posted a patch that fixes a similar problem:

    http://www.mail-archive.com/[email protected]/msg1158159.html

Can you please try it and see if it does the trick for you?

Thanks,
Adam

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw

PATCH v2 1/1 iommu/vt-d: fix overflow of iommu->domains array

The valid range of 'did' in get_iommu_domain(*iommu, did) is 0..cap_ndoms(iommu->cap), so don't exceed that range in free_all_cpu_cached_iovas().

The user-visible impact of the out-of-bounds access is the machine hanging on suspend-to-ram. It is, in fact, a kernel panic, but due to already suspended devices, that's often not visible to the user.

Fixes 22e2f9fa63b0 ("iommu/vt-d: Use per-cpu IOVA caching")

---
Added some details and Tested-By to the commit message. Patch is unchanged.

Posted to [email protected] and [email protected] where the issue was discussed.

drivers/iommu/intel-iommu.c +1 -1
index a644d0c..82989d4 100644
@@ -4600,7 +4600,7 @@ static void free_all_cpu_cached_iovas(unsigned int cpu)
 		if (!iommu)
 			continue;
 
-		for (did = 0; did < 0xffff; did++) {
+		for (did = 0; did < cap_ndoms(iommu->cap); did++) {
 			domain = get_iommu_domain(iommu, did);
 
 			if (!domain)
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Applied
#3 lore raw

Re: [PATCH v2] iommu/vt-d: fix overflow of iommu->domains array

Quoted 11 lines · Jan Niehusmann

The valid range of 'did' in get_iommu_domain(*iommu, did) is 0..cap_ndoms(iommu->cap), so don't exceed that range in free_all_cpu_cached_iovas().

The user-visible impact of the out-of-bounds access is the machine hanging on suspend-to-ram. It is, in fact, a kernel panic, but due to already suspended devices, that's often not visible to the user.

Fixes 22e2f9fa63b0 ("iommu/vt-d: Use per-cpu IOVA caching")

Queued to iommu/fixes branch, thanks Jan.

Joerg

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx