Skip to contentSkip to conversation

PCI: vmd: Free up IRQs on suspend path

PATCH In review Scott Bauer 3 participants 4 messages Aug 11, 2017 – Aug 14, 2017 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: vmd: Free up IRQs on suspend path

This patch frees up the IRQs we request on the suspend path, and reallocates them on the resume path.

Fixes:

[  559.964386] CPU 111 disable failed: CPU has 9 vectors assigned and there are only 0 available.
[  559.966824] Error taking CPU111 down: -34
[  559.966825] Non-boot CPUs are not disabled
[  559.966826] Enabling non-boot CPUs ...
---
 drivers/pci/host/vmd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/host/vmd.c +15 -0
index 7e967a8784b2..4fe1756af010 100644
@@ -763,6 +763,11 @@ static void vmd_remove(struct pci_dev *dev)
 static int vmd_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < vmd->msix_count; i++)
+                devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
 
 	pci_save_state(pdev);
 	return 0;
@@ -771,6 +776,16 @@ static int vmd_suspend(struct device *dev)
 static int vmd_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int err, i;
+
+	for (i = 0; i < vmd->msix_count; i++) {
+		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
+				       vmd_irq, IRQF_NO_THREAD,
+				       "vmd", &vmd->irqs[i]);
+		if (err)
+			return err;
+	}
 
 	pci_restore_state(pdev);
 	return 0;
Signature · 1 line
2.11.0
#1 lore raw
Quoted 10 lines · Scott Bauer

This patch frees up the IRQs we request on the suspend path, and reallocates them on the resume path.

Fixes:

[  559.964386] CPU 111 disable failed: CPU has 9 vectors assigned and there are only 0 available.
[  559.966824] Error taking CPU111 down: -34
[  559.966825] Non-boot CPUs are not disabled
[  559.966826] Enabling non-boot CPUs ...

Keith acked the previous version (which contained the enable/disable), but since this is different, I'll wait for his ack again.

Quoted 40 lines
---
 drivers/pci/host/vmd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/host/vmd.c +15 -0
index 7e967a8784b2..4fe1756af010 100644
@@ -763,6 +763,11 @@ static void vmd_remove(struct pci_dev *dev)
 static int vmd_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < vmd->msix_count; i++)
+                devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
 
 	pci_save_state(pdev);
 	return 0;
@@ -771,6 +776,16 @@ static int vmd_suspend(struct device *dev)
 static int vmd_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int err, i;
+
+	for (i = 0; i < vmd->msix_count; i++) {
+		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
+				       vmd_irq, IRQF_NO_THREAD,
+				       "vmd", &vmd->irqs[i]);
+		if (err)
+			return err;
+	}
 
 	pci_restore_state(pdev);
 	return 0;
Signature · 1 line
2.11.0
Acked-by
#2 lore raw
Quoted 10 lines · Bjorn Helgaas
Quoted 9 lines · Scott Bauer

This patch frees up the IRQs we request on the suspend path, and reallocates them on the resume path.

Fixes:

[  559.964386] CPU 111 disable failed: CPU has 9 vectors assigned and there are only 0 available.
[  559.966824] Error taking CPU111 down: -34
[  559.966825] Non-boot CPUs are not disabled
[  559.966826] Enabling non-boot CPUs ...
Quoted 4 lines
Quoted 1 line

Keith acked the previous version (which contained the enable/disable), but since this is different, I'll wait for his ack again.

Thanks for checking. This is actually the patch that was intended for submission.

Quoted 40 lines
Quoted 40 lines
---
 drivers/pci/host/vmd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/host/vmd.c +15 -0
index 7e967a8784b2..4fe1756af010 100644
@@ -763,6 +763,11 @@ static void vmd_remove(struct pci_dev *dev)
 static int vmd_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < vmd->msix_count; i++)
+                devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
 
 	pci_save_state(pdev);
 	return 0;
@@ -771,6 +776,16 @@ static int vmd_suspend(struct device *dev)
 static int vmd_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int err, i;
+
+	for (i = 0; i < vmd->msix_count; i++) {
+		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
+				       vmd_irq, IRQF_NO_THREAD,
+				       "vmd", &vmd->irqs[i]);
+		if (err)
+			return err;
+	}
 
 	pci_restore_state(pdev);
 	return 0;
Signature · 1 line
2.11.0
#3 lore raw
In reply to Scott Bauer
Quoted 10 lines · Scott Bauer

This patch frees up the IRQs we request on the suspend path, and reallocates them on the resume path.

Fixes:

[  559.964386] CPU 111 disable failed: CPU has 9 vectors assigned and there are only 0 available.
[  559.966824] Error taking CPU111 down: -34
[  559.966825] Non-boot CPUs are not disabled
[  559.966826] Enabling non-boot CPUs ...

Applied with Keith's ack to pci/host-vmd for v4.14, thanks!

Quoted 40 lines
---
 drivers/pci/host/vmd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/pci/host/vmd.c +15 -0
index 7e967a8784b2..4fe1756af010 100644
@@ -763,6 +763,11 @@ static void vmd_remove(struct pci_dev *dev)
 static int vmd_suspend(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int i;
+
+	for (i = 0; i < vmd->msix_count; i++)
+                devm_free_irq(dev, pci_irq_vector(pdev, i), &vmd->irqs[i]);
 
 	pci_save_state(pdev);
 	return 0;
@@ -771,6 +776,16 @@ static int vmd_suspend(struct device *dev)
 static int vmd_resume(struct device *dev)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
+	struct vmd_dev *vmd = pci_get_drvdata(pdev);
+	int err, i;
+
+	for (i = 0; i < vmd->msix_count; i++) {
+		err = devm_request_irq(dev, pci_irq_vector(pdev, i),
+				       vmd_irq, IRQF_NO_THREAD,
+				       "vmd", &vmd->irqs[i]);
+		if (err)
+			return err;
+	}
 
 	pci_restore_state(pdev);
 	return 0;
Signature · 1 line
2.11.0