PCI: Add ATS-disable quirk for AMD Stoney GPUs
PATCH v2 1/1 PCI: Add ATS-disable quirk for AMD Stoney GPUs
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
drivers/pci/quirks.c +19 -0
@@ -4634,3 +4634,22 @@ static void quirk_no_aersid(struct pci_dev *pdev)DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2031 , quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2032 , quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2033 , quirk_no_aersid); + +#ifdef CONFIG_PCI_ATS +/* +* Some devices have a broken ATS implementation causing IOMMU stalls. +* Don't use ATS for those devices. +*/ +static void quirk_disable_ats (struct pci_dev *pdev) +{ +/* +* Set pdev->ats_cap = 0 to make pci_enable_ats() bail out +* early. +*/ +dev_info (&pdev->dev,"QUIRK: Disabling ATS" ); + pdev->ats_cap =0 ; +} + +/* AMD Stoney platform GPU */ +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x98e4 , quirk_disable_ats); +#endif /* CONFIG_PCI_ATS */
Signature · 1 line
1.9.1
Quoted 5 lines
-----Original Message-----
From: Joerg Roedel [mailto:[email protected]]
Sent: Friday, April 07, 2017 10:32 AM
To: Bjorn Helgaas
Cc: [email protected]; [email protected]; Daniel Drake=
;
Quoted 13 lines
Deucher, Alexander; Samuel Sieb; David Woodhouse; Joerg Roedel
Subject: [PATCH v2] PCI: Add ATS-disable quirk for AMD Stoney GPUs =20
From: Joerg Roedel <[email protected]>
=20
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
=20
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
=20
Quoted 2 lines
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>
Quoted 37 lines
--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)=20
drivers/pci/quirks.c +0
-0@@ -4634,3 +4634,22 @@ static void quirk_no_aersid(struct pci_dev *pdev)DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2031 , quirk_no_aersid); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032,
quirk_no_aersid);
DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL,0x2033,quirk_no_aersid);drivers/pci/quirks.c +18
-0+ +#ifdef CONFIG_PCI_ATS +/* +* Some devices have a broken ATS implementation causing IOMMU stalls. +* Don't use ATS for those devices. +*/ +static void quirk_disable_ats (struct pci_dev *pdev) +{ +/* +* Set pdev->ats_cap =3D 0 to make pci_enable_ats() bail out +* early. +*/ +dev_info (&pdev->dev,"QUIRK: Disabling ATS" ); + pdev->ats_cap =3D 0; +} + +/* AMD Stoney platform GPU */ +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI, 0x98e4,
quirk_disable_ats);
+#endif /*CONFIG_PCI_ATS*/
--
1.9.1
Quoted 15 lines · Alexander
Quoted 15 lines
-----Original Message-----
From: Joerg Roedel [mailto:[email protected]]
Sent: Friday, April 07, 2017 10:32 AM
To: Bjorn Helgaas
Cc: [email protected]; [email protected]; Daniel Drake; Deucher, Alexander; Samuel Sieb; David Woodhouse; Joerg Roedel
Subject: [PATCH v2] PCI: Add ATS-disable quirk for AMD Stoney GPUsFrom: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Quoted 7 lines
Quoted 6 lines
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>Acked-by Alex Deucher <[email protected]>
Alex, are you able to confirm that it is *only* the device with PCI ID 0x98e4 which has this problem, or (more likely) come up with an exhaustive list? Thanks.
We'll want the same blacklist in Xen too, won't we?
Quoted 37 lines
Quoted 37 lines
---
drivers/pci/quirks.c | 19 +++++++++++++++++++1 file changed, 19 insertions(+)drivers/pci/quirks.c +0
-0@@ -4634,3 +4634,22 @@ static void quirk_no_aersid(struct pci_dev *pdev) DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2031, quirk_no_aersid); DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2032,
quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x2033, quirk_no_aersid);drivers/pci/quirks.c +19
-1+ +#ifdef CONFIG_PCI_ATS +/* +* Some devices have a broken ATS implementation causing IOMMU stalls. +* Don't use ATS for those devices. +*/ +static void quirk_disable_ats (struct pci_dev *pdev) +{ +/* +* Set pdev->ats_cap = 0 to make pci_enable_ats() bail out +* early. +*/ +dev_info (&pdev->dev,"QUIRK: Disabling ATS" ); + pdev->ats_cap =0 ; +} + +/* AMD Stoney platform GPU */ +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x98e4 , quirk_disable_ats); +#endif /* CONFIG_PCI_ATS */ --1.9.1
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBEYXZpZCBXb29kaG91c2UgW21h aWx0bzpkd213MkBpbmZyYWRlYWQub3JnXQ0KPiBTZW50OiBUaHVyc2RheSwgTWF5IDA0LCAyMDE3 IDY6MjIgQU0NCj4gVG86IERldWNoZXIsIEFsZXhhbmRlcjsgJ0pvZXJnIFJvZWRlbCc7IEJqb3Ju IEhlbGdhYXMNCj4gQ2M6IGxpb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U9NTVUNCj4gc3RhbGxzLg0KPiA+ID4gKyAqIERv bid0IHVzZSBBVFMgZm9yIHRob3NlIGRldmljZXMuDQo+ID4gPiArICovDQo+ID4gPiArc3RhdGlj IHZvaWQgcXVpcmtfZGlzYWJsZV9hdHMoc3RydWN0IHBjaV9kZXYgKnBkZXYpDQo+ID4gPiArew0K PiA+ID4gKwkvKg0KPiA+ID4gKwnCoCogU2V0IHBkZXYtPmF0c19jYXAgPSAwIHRvIG1ha2UgcGNp X2VuYWJsZV9hdHMoKSBiYWlsIG91dA0KPiA+ID4gKwnCoCogZWFybHkuDQo+ID4gPiArCcKgKi8N Cj4gPiA+ICsJZGV2X2luZm8oJnBkZXYtPmRldiwgIlFVSVJLOiBEaXNhYmxpbmcgQVRTIik7DQo+ ID4gPiArCXBkZXYtPmF0c19jYXAgPSAwOw0KPiA+ID4gK30NCj4gPiA+ICsNCj4gPiA+ICsvKiBB TUQgU3RvbmV5IHBsYXRmb3JtIEdQVSAqLw0KPiA+ID4gK0RFQ0xBUkVfUENJX0ZJWFVQX0ZJTkFM KFBDSV9WRU5ET1JfSURfQVRJLCAweDk4ZTQsDQo+IHF1aXJrX2Rpc2FibGVfYXRzKTsNCj4gPiA+ ICsjZW5kaWYgLyogQ09ORklHX1BDSV9BVFMgKi8NCj4gPiA+IC0tDQo+ID4gPiAxLjkuMQ0K
Hi Alexander,
Quoted 5 lines · Alexander
I finally got an answer from the hw team and we validated ATS on stoney as well so in theory this patch shouldn’t actually be needed. I think we may actually be papering over some other issue. The following patch seems to also fix this issue (and other issues):
https://www.spinics.net/lists/stable/msg172631.html
Yeah, but it still looks to me like that the hardware got into some weird state with the storm of ATS invalidations sent to it.
The Completion-Wait loop timeouts seen in the original bug report indicate that the IOMMU is waiting for a response that never comes. And this is probably the ATS flush completion response from the GPU, as disabling ATS on the GPU makes the issue disappear.
Regards,
Joerg
Quoted 10 lines · Joerg Roedel
Hi Alexander,
Quoted 6 lines · Alexander
I finally got an answer from the hw team and we validated ATS on stoney as well so in theory this patch shouldn’t actually be needed. I think we may actually be papering over some other issue. The following patch seems to also fix this issue (and other issues):
https://www.spinics.net/lists/stable/msg172631.html
Quoted 7 lines
Yeah, but it still looks to me like that the hardware got into some weird state with the storm of ATS invalidations sent to it.
The Completion-Wait loop timeouts seen in the original bug report indicate that the IOMMU is waiting for a response that never comes. And this is probably the ATS flush completion response from the GPU, as disabling ATS on the GPU makes the issue disappear.
The above patch doesn't actually fix any spec violation which could the GPU an *excuse* to crash and stop responding to invalidations, does it? It just seems to reduce the invalidation load a little, and thus paper over the problem that the card tends to crash under load. Absent a more coherent explanation, it still seems like the correct answer is to blacklist these devices for ATS because they're broken.
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBKb2VyZyBSb2VkZWwgW21haWx0 bzpqcm9lZGVsQHN1c2UuZGVdDQo+IFNlbnQ6IFdlZG5lc2RheSwgTWF5IDI0LCAyMDE3IDQ6NDUg QU0NCj4gVG86IERldWNoZXIsIEFsZXhhbmRlcg0KPiBDYzogJ0RhdmlkIFdvb2Rob3VzZSc7ICdK b2VyZyBSb2VkZWwnOyBCam9ybiBIZWxnYWFzOyBsaW51eC0NCj4gcGNpQHZnZXIua2VybmVsLm9y ZzsgbGludXgta2VybmVsQHZnZXIua2VybmVsLm9yZzsgRGFuaWVsIERyYWtlOyBTYW11ZWwNCj4g U2llYg0KPiBTdWJqZWN0OiBSZTogW1BBVENIIHYyXSBQQ0k6IEFkZCBBVFMtZGlzYWJsZSBxdWly ayBmb3IgQU1EIFN0b25leSBHUFVzDQo+IA0KPiBIaSBBbGV4YW5kZXIsDQo+IA0KPiBPbiBUdWUs IE1heSAyMywgMjAxNyBhdCAwNzo1NDoxMlBNICswMDAwLCBEZXVjaGVyLCBBbGV4YW5kZXIgd3Jv dGU6DQo+ID4gSSBmaW5hbGx5IGdvdCBhbiBhbnN3ZXIgZnJvbSB0aGUgaHcgdGVhbSBhbmQgd2Ug dmFsaWRhdG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Wxl eA0KDQo=
Quoted 21 lines · Alexander
Quoted 21 lines
-----Original Message-----
From: Joerg Roedel [mailto:[email protected]]
Sent: Wednesday, May 24, 2017 4:45 AM
To: Deucher, Alexander
Cc: 'David Woodhouse'; 'Joerg Roedel'; Bjorn Helgaas; linux- [email protected]; [email protected]; Daniel Drake; Samuel Sieb
Subject: Re: [PATCH v2] PCI: Add ATS-disable quirk for AMD Stoney GPUsHi Alexander,
Quoted 5 lines · Alexander
I finally got an answer from the hw team and we validated ATS on stoney as well so in theory this patch shouldn’t actually be needed. I think we may actually be papering over some other issue. The following patch seems to also fix this issue (and other issues):
https://www.spinics.net/lists/stable/msg172631.htmlYeah, but it still looks to me like that the hardware got into some weird state with the storm of ATS invalidations sent to it.
Quoted 7 lines
Quoted 4 lines
The Completion-Wait loop timeouts seen in the original bug report indicate that the IOMMU is waiting for a response that never comes. And this is probably the ATS flush completion response from the GPU, as disabling ATS on the GPU makes the issue disappear.
Yeah, it's weird. My ack on the patch still stands. Just adding some additional data.
I just tested this patch without the previous ATS disabling patch (I verified that ATS was enabled). Doing a stress-test kernel build while running a 3D graphical application caused no disk corruption. That was running for several hours. If it's not the solution, it sure hides the problem really well.
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBKb2VyZyBSb2VkZWwgW21haWx0 bzpqcm9lZGVsQHN1c2UuZGVdDQo+IFNlbnQ6IFdlZG5lc2RheSwgTWF5IDI0LCAyMDE3IDQ6NDUg QU0NCj4gVG86IERldWNoZXIsIEFsZXhhbmRlcg0KPiBDYzogJ0RhdmlkIFdvb2Rob3VzZSc7ICdK b2VyZyBSb2VkZWwnOyBCam9ybiBIZWxnYWFzOyBsaW51eC0NCj4gcGNpQHZnZXIua2VybmVsLm9y ZzsgbGludXgta2VybmVsQHZnZXIua2VybmVsLm9yZzsgRGFuaWVsIERyYWtlOyBTYW11ZWwNCj4g U2llYg0KPiBTdWJqZWN0OiBSZTogW1BBVENIIHYyXSBQQ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hYmx5IHRoZSBBVFMgZmx1c2ggY29tcGxldGlvbiByZXNwb25z ZSBmcm9tIHRoZSBHUFUsIGFzDQo+IGRpc2FibGluZyBBVFMgb24gdGhlIEdQVSBtYWtlcyB0aGUg aXNzdWUgZGlzYXBwZWFyLg0KDQpGV0lXLCB0aGUgR1BVIGRyaXZlciBkb2VzIG5vdCBhY3R1YWxs eSB1c2UgQVRTIGF0IHRoZSBtb21lbnQgc28gSSBkb24ndCB0aGluayB3ZSBzaG91bGQgc2VlIGFu eSBBVFMgdHJhbnNhY3Rpb25zLg0KDQpBbGV4DQoNCg==
Quoted 3 lines · Alexander
FWIW, the GPU driver does not actually use ATS at the moment so I don't think we should see any ATS transactions.
That's a confusing sentence. The "GPU driver", if you mean software running in the OS, wouldn't be expected to have anything to do with ATS.
ATS is something that the CPU itself (or its DMA engine) would do. Instead of just performing a DMA transaction to a given bus address, and letting the IOMMU do the translation, the hardware might choose to first perform an IOTLB lookup, and then later do the actual DMA transaction to the pre-translated, raw physical address. Which kind of makes a mockery of any kind of protection the IOMMU is supposed to give you, but does shave a cycle or two of latency off the DMA when it finally happens, since the translation can be done in advance.
PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBEYXZpZCBXb29kaG91c2UgW21h aWx0bzpkd213MkBpbmZyYWRlYWQub3JnXQ0KPiBTZW50OiBGcmlkYXksIE1heSAyNiwgMjAxNyA4 OjU1IEFNDQo+IFRvOiBEZXVjaGVyLCBBbGV4YW5kZXI7ICdKb2VyZyBSb2VkZWwnDQo+IENjOiAn Sm9lcmcgUm9lZGVsJzsgQmpvcm4gSGVsZ2FhczsgbGludXgtcGNpQHZnZXIua2VybmVsLm9yZzsg bGludXgtDQo+IGtlcm5lbEB2Z2VyLmtlcm5lbC5vcmc7IERhbmllbCBEcmFrZTsgU2FtdWVsIFNp ZWINCj4gU3ViamVjdDogUmU6IFtQQVRDSCB2Ml0gUENJOiBBZGQgQVRTLWRpc2FibGUgcX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5IHRoZSB0cmFuc2FjdGlvbi4gIEZvciB0aGUgQVRTL1BSSSBw YXRoLCB0aGUgR1BVJ3MgTU1VIGlzIGJ5cGFzc2VkIGFuZCBQQVNJRHMgbmVlZCB0byBiZSBzZXR1 cCBvbiB0aGUgSU9NTVUgZm9yIGVhY2ggY2xpZW50LCBidXQgb25jZSBkb25lLCB0cmFuc2FjdGlv bnMgdGhhdCB1c2UgdGhhdCBpbnRlcmZhY2Ugc3VwcG9ydCByZXRyaWVzIG9uIEdQVSBwYWdlIGZh dWx0cyAoYWZ0ZXIgdGhlIE9TIGhhZCBwYWdlZCB0aGUgbWVtb3J5IGluIGFuZCB0aGUgSU9NTVUg dGFibGVzIGJlZW4gdXBkYXRlZCkgYW5kIG90aGVyIGZlYXR1cmVzLiAgSSB0aGluayBvbmx5IHRo ZSBBVFMvUFJJIGNhc2UgdXNlcyB0aGUgQVRDIG9uIHRoZSBlbmQgcG9pbnQuICBKb2huLCBTdXJh dmVlLCBjb3JyZWN0IG1lIGlmIEknbSB3cm9uZy4NCg0KQWxleA0KDQo=
Quoted 5 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
AMD Stoney Ridge is an x86 CPU + GPU combo and this quirk pertains to the GPU, right?
In that case the quirk should go to arch/x86. Paul Menzel (+cc) has just complained on linux-pci@ that final fixups are taking half a second, and I think that could be reduced if more efforts were spent to move arch-specific quirks out of the catch-all in drivers/pci/quirks.c.
Thanks,
Lukas
Quoted 41 lines
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/pci/quirks.c +19
-0@@ -4634,3 +4634,22 @@ static void quirk_no_aersid(struct pci_dev *pdev)DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2031 , quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2032 , quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2033 , quirk_no_aersid); + +#ifdef CONFIG_PCI_ATS +/* +* Some devices have a broken ATS implementation causing IOMMU stalls. +* Don't use ATS for those devices. +*/ +static void quirk_disable_ats (struct pci_dev *pdev) +{ +/* +* Set pdev->ats_cap = 0 to make pci_enable_ats() bail out +* early. +*/ +dev_info (&pdev->dev,"QUIRK: Disabling ATS" ); + pdev->ats_cap =0 ; +} + +/* AMD Stoney platform GPU */ +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x98e4 , quirk_disable_ats); +#endif /* CONFIG_PCI_ATS */ Signature · 1 line
1.9.1
Quoted 7 lines · Lukas Wunner
Quoted 5 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Quoted 8 lines
AMD Stoney Ridge is an x86 CPU + GPU combo and this quirk pertains to the GPU, right?
In that case the quirk should go to
arch/x86. Paul Menzel (+cc) has just complained on linux-pci@ that final fixups are taking half a second, and I think that could be reduced if more efforts were spent to move arch-specific quirks out of the catch-all indrivers/pci/quirks.c.
The affected hardware here might be x86-only, but ATS is not. If a broken ATS-capable plug-in card appears, we need this in generic code anyway.
Also has anyone profiled why the fixups take so long (and on what hardware)? Maybe the fixup-device matching can be improved instead of cluttering arch-code with pci-fixups.
Joerg
Quoted 17 lines · Joerg Roedel
Quoted 7 lines · Lukas Wunner
Quoted 5 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Quoted 8 lines
AMD Stoney Ridge is an x86 CPU + GPU combo and this quirk pertains to the GPU, right?
In that case the quirk should go to
arch/x86. Paul Menzel (+cc) has just complained on linux-pci@ that final fixups are taking half a second, and I think that could be reduced if more efforts were spent to move arch-specific quirks out of the catch-all indrivers/pci/quirks.c.
Quoted 3 lines
The affected hardware here might be x86-only, but ATS is not. If a broken ATS-capable plug-in card appears, we need this in generic code anyway.
It could go in either arch/x86/pci/fixup.c or drivers/pci/quirks.c.
It's not clear to me exactly what the hardware defect is or where it is. If it's in the CPU or in a GPU that can only be found on x86, I think arch/x86/pci/fixup.c is the appropriate place.
If it's in a GPU that could be found on other arches, drivers/pci/quirks.c would be the appropriate place.
I don't personally think the possibility of a plugin card with broken ATS is a real reason to put this quirk in drivers/pci/quirks.c. It's a trivial patch and easy to copy or move later if we need to.
Bjorn
Hi Bjorn,
Quoted 10 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Quoted 5 lines
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Any more objections on this patch? Please let me know if you want to have something changed.
Regards,
Joerg
Quoted 13 lines · Joerg Roedel
Hi Bjorn,
Quoted 10 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Quoted 8 lines
Quoted 5 lines
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Any more objections on this patch? Please let me know if you want to have something changed.
The other patch seems to fix this issue without disabling ATS. Isn't that better?
PiAtLS0tLU9yaWdpbmF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IGV4cGVydC4NCg0K QWxleA0KDQo=
Quoted 13 lines · Joerg Roedel
Hi Bjorn,
Quoted 10 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Quoted 8 lines
Quoted 5 lines
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Any more objections on this patch? Please let me know if you want to have something changed.
It was marked "superseded" in patchwork and thus off my radar. I don't remember if I did that or why. I changed it back to "New" so I won't forget about it.
You mention (May 24) the original bug report. Can you include the URL for that?
I admit I just don't have warm fuzzies that the problem is well understood.
Bjorn
Hi Bjorn,
Quoted 3 lines · Bjorn Helgaas
It was marked "superseded" in patchwork and thus off my radar. I don't remember if I did that or why. I changed it back to "New" so I won't forget about it.
Great!
Quoted 2 lines
You mention (May 24) the original bug report. Can you include the URL for that?
I think there were multiple reports, here is one I could still find:
https://lists.linuxfoundation.org/pipermail/iommu/2017-March/020836.html
Quoted 2 lines
I admit I just don't have warm fuzzies that the problem is well understood.
The current understanding (without my ability to debug the hardware involved) is that the GPU in the Stoney systems gets into a weird state when ATS invalidations are sent too fast and stops responding to the iommu.
The iommu then can't complete the invalidation commands and the driver throws completion-wait loop timeout messages out.
Joerg
Quoted 19 lines · Joerg Roedel
Hi Bjorn,
Quoted 3 lines · Bjorn Helgaas
It was marked "superseded" in patchwork and thus off my radar. I don't remember if I did that or why. I changed it back to "New" so I won't forget about it.
Great!
Quoted 2 lines
You mention (May 24) the original bug report. Can you include the URL for that?
I think there were multiple reports, here is one I could still find:
https://lists.linuxfoundation.org/pipermail/iommu/2017-March/020836.htmlQuoted 2 lines
I admit I just don't have warm fuzzies that the problem is well understood.
Quoted 7 lines
The current understanding (without my ability to debug the hardware involved) is that the GPU in the Stoney systems gets into a weird state when ATS invalidations are sent too fast and stops responding to the iommu.
The iommu then can't complete the invalidation commands and the driver throws completion-wait loop timeout messages out.
I'm still confused. Per Samuel
([email protected]):
Samuel> The other patch seems to fix this issue without disabling ATS. Samuel> Isn't that better?
and Alex (BN6PR12MB1652DF4130FC792B71DD9974F7C00@BN6PR12MB1652.namprd12.prod.outlook.com):
Alex> I talked to our validation team and ATS was validated on Stoney, Alex> so this patch is just working around something else. The other Alex> patch fixes it and is a valid optimization ...
I'm confused about what this "other patch" is and whether we want that one, this one, or both.
Bjorn
Hi Bjorn,
Quoted 9 lines · Bjorn Helgaas
I'm still confused. Per Samuel
([email protected]):Samuel> The other patch seems to fix this issue without disabling ATS. Samuel> Isn't that better?
and Alex (BN6PR12MB1652DF4130FC792B71DD9974F7C00@BN6PR12MB1652.namprd12.prod.outlook.com):
Quoted 6 lines
Alex> I talked to our validation team and ATS was validated on Stoney, Alex> so this patch is just working around something else. The other Alex> patch fixes it and is a valid optimization ...
I'm confused about what this "other patch" is and whether we want that one, this one, or both.
The other patches floating around lowered the ATS flush-rate from the AMD IOMMU driver, which makes the issue disappear as well. But the issue only disappeared, it is not solved and could probably still be reproduced with a GPU usage pattern that increases the ATS flush-rate.
So blacklisting the device for ATS is still the safest thing we could do here.
Regards,
Joerg
Quoted 5 lines
-----Original Message-----
From: Joerg Roedel [mailto:[email protected]]
Sent: Tuesday, July 11, 2017 7:50 AM
To: Bjorn Helgaas
Cc: Bjorn Helgaas; [email protected]; [email protected]=
g;
Quoted 9 lines
Daniel Drake; Deucher, Alexander; Samuel Sieb; David Woodhouse
Subject: Re: [PATCH v2] PCI: Add ATS-disable quirk for AMD Stoney GPUs =20
Hi Bjorn,
=20Quoted 3 lines · Bjorn Helgaas
I'm still confused. Per Samuel
([email protected]):
Quoted 14 lines
Quoted 5 lines
Samuel> The other patch seems to fix this issue without disabling ATS. Samuel> Isn't that better?
and Alex
([email protected] 2.prod.outlook.com):
Quoted 7 lines
Alex> I talked to our validation team and ATS was validated on Stoney, Alex> so this patch is just working around something else. The other Alex> patch fixes it and is a valid optimization ...
I'm confused about what this "other patch" is and whether we want that one, this one, or both.
Here's the other patch:
https://lists.freedesktop.org/archives/amd-gfx/2017-May/009421.html
Quoted 8 lines
=20
The other patches floating around lowered the ATS flush-rate from the AMD IOMMU driver, which makes the issue disappear as well. But the issue only disappeared, it is not solved and could probably still be reproduced with a GPU usage pattern that increases the ATS flush-rate. =20
So blacklisting the device for ATS is still the safest thing we could do here.
I don't have any objection per se, but I'd hate to add a quirk to disable i= t only to remove it again in the future if we needed ATS related functional= ity later. We are in the process of upstreaming KFD support for Carrizo (w= hich is a bigger version of Stoney) and that utilizes ATS related functiona= lity to provide GPU access to pageable memory. There are no immediate requ= irements for Stoney, but that may change.
Alex
Quoted 6 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Quoted 6 lines
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>
Applied with Alex's ack to pci/virtualization for v4.14, thanks!
Alex, you seemed a little ambivalent later. If you want to rescind your ack, let me know and I'll remove it.
Quoted 34 lines
--- drivers/pci/quirks.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)drivers/pci/quirks.c +19
-0@@ -4634,3 +4634,22 @@ static void quirk_no_aersid(struct pci_dev *pdev)DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2031 , quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2032 , quirk_no_aersid);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x2033 , quirk_no_aersid); + +#ifdef CONFIG_PCI_ATS +/* +* Some devices have a broken ATS implementation causing IOMMU stalls. +* Don't use ATS for those devices. +*/ +static void quirk_disable_ats (struct pci_dev *pdev) +{ +/* +* Set pdev->ats_cap = 0 to make pci_enable_ats() bail out +* early. +*/ +dev_info (&pdev->dev,"QUIRK: Disabling ATS" ); + pdev->ats_cap =0 ; +} + +/* AMD Stoney platform GPU */ +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x98e4 , quirk_disable_ats); +#endif /* CONFIG_PCI_ATS */ Signature · 1 line
1.9.1
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Quoted 8 lines
Quoted 6 lines
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>Applied with Alex's ack to pci/virtualization for v4.14, thanks!
Is there any chance of getting this into an earlier kernel? This is a pretty devastating bug for users! I'm currently providing patched kernels, but if they run upgrades and get a new kernel without noticing it, any filesystem they access will get completely mangled.
Quoted 15 lines · Samuel Sieb
Quoted 14 lines · Bjorn Helgaas
Quoted 12 lines · Joerg Roedel
From: Joerg Roedel <[email protected]>
ATS is broken on this hardware and causes IOMMU stalls and system failure. Disable ATS on these devices to make them usable again with IOMMU enabled.
Note that the commit in the Fixes-tag is not buggy, it just uncovers the problem in the hardware by increasing the ATS-flush rate.
Fixes b1516a14657a ('iommu/amd: Implement flush queue')Signed-off-by Joerg Roedel <[email protected]>
Quoted 6 lines
Quoted 1 line
Applied with Alex's ack to pci/virtualization for v4.14, thanks!
Is there any chance of getting this into an earlier kernel? This is a pretty devastating bug for users! I'm currently providing patched kernels, but if they run upgrades and get a new kernel without noticing it, any filesystem they access will get completely mangled.
I assume you're looking to get this into stable kernels or distro update kernels. I don't personally deal with either of those, but for stable kernels, see
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst
For distro update kernels, you'd have to talk to the distro folks, and I don't have contacts for those.
Bjorn
Quoted 7 lines · Samuel Sieb
Quoted 1 line · Bjorn Helgaas
Applied with Alex's ack to pci/virtualization for v4.14, thanks!
Is there any chance of getting this into an earlier kernel? This is a pretty devastating bug for users! I'm currently providing patched kernels, but if they run upgrades and get a new kernel without noticing it, any filesystem they access will get completely mangled.
The patch is queued for v4.14, so it will probably be picked up by distributions when v4.14-rc1 is released. At least this will be the case for the affected (Open)SUSE distributions.
Joerg