Skip to contentSkip to conversation

vdpa: ifcvf: return err when fail to request config irq

PATCH Applied Jason Wang 3 participants 5 messages Jul 23, 2020 – Aug 26, 2020

Subsystems (2)
lore
Share & tools
lore

Jason Wang

author
#0 lore raw

PATCH 1/2 vdpa: ifcvf: return err when fail to request config irq

We ignore the err of requesting config interrupt, fix this.

Fixes e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
Cc Zhu Lingshan <[email protected]>
---
 drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/vdpa/ifcvf/ifcvf_main.c +4 -0
index f5a60c14b979..ae7110955a44 100644
@@ -76,6 +76,10 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
 	ret = devm_request_irq(&pdev->dev, irq,
 			       ifcvf_config_changed, 0,
 			       vf->config_msix_name, vf);
+	if (ret) {
+		IFCVF_ERR(pdev, "Failed to request config irq\n");
+		return ret;
+	}
 
 	for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
 		snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 2/2 vdpa: ifcvf: free config irq in ifcvf_free_irq()

We don't free config irq in ifcvf_free_irq() which will trigger a BUG() in pci core since we try to free the vectors that has an action. Fixing this by recording the config irq in ifcvf_hw structure and free it in ifcvf_free_irq().

Fixes e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
Cc Zhu Lingshan <[email protected]>
---
 drivers/vdpa/ifcvf/ifcvf_base.h | 2 +-
 drivers/vdpa/ifcvf/ifcvf_main.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/vdpa/ifcvf/ifcvf_base.h +1 -1
index f4554412e607..29efa75cdfce 100644
@@ -84,7 +84,7 @@ struct ifcvf_hw {
 	void __iomem * const *base;
 	char config_msix_name[256];
 	struct vdpa_callback config_cb;
-
+	unsigned int config_irq;
 };
 
 struct ifcvf_adapter {
drivers/vdpa/ifcvf/ifcvf_main.c +3 -2
index ae7110955a44..7a6d899e541d 100644
@@ -53,6 +53,7 @@ static void ifcvf_free_irq(struct ifcvf_adapter *adapter, int queues)
 	for (i = 0; i < queues; i++)
 		devm_free_irq(&pdev->dev, vf->vring[i].irq, &vf->vring[i]);
 
+	devm_free_irq(&pdev->dev, vf->config_irq, vf);
 	ifcvf_free_irq_vectors(pdev);
 }
 
@@ -72,8 +73,8 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
 	snprintf(vf->config_msix_name, 256, "ifcvf[%s]-config\n",
 		 pci_name(pdev));
 	vector = 0;
-	irq = pci_irq_vector(pdev, vector);
-	ret = devm_request_irq(&pdev->dev, irq,
+	vf->config_irq = pci_irq_vector(pdev, vector);
+	ret = devm_request_irq(&pdev->dev, vf->config_irq,
 			       ifcvf_config_changed, 0,
 			       vf->config_msix_name, vf);
 	if (ret) {
Signature · 1 line
2.20.1
author
#2 lore raw
In reply to Jason Wang
Quoted 14 lines · Jason Wang

We ignore the err of requesting config interrupt, fix this.

Fixes e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
Cc Zhu Lingshan <[email protected]>
---
  drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/vdpa/ifcvf/ifcvf_main.c +0 -0
index f5a60c14b979..ae7110955a44 100644

drivers/vdpa/ifcvf/ifcvf_main.c static int ifcvf_request_irq(struct ifcvf_adapter *adapter) · line 85

Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_main.c +4 -0
@@ -76,6 +76,10 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
  	ret = devm_request_irq(&pdev->dev, irq,
  			       ifcvf_config_changed, 0,
  			       vf->config_msix_name, vf);
+	if (ret) {
+		IFCVF_ERR(pdev, "Failed to request config irq\n");
+		return ret;
+	}
 
  	for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
  		snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",

Hi Michael:

Any comments on this series?

Thanks

maintainer Applied
#3 lore raw
Quoted 29 lines · Jason Wang
Quoted 14 lines · Jason Wang

We ignore the err of requesting config interrupt, fix this.

Fixes e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
Cc Zhu Lingshan <[email protected]>
---
  drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/vdpa/ifcvf/ifcvf_main.c +0 -0
index f5a60c14b979..ae7110955a44 100644

drivers/vdpa/ifcvf/ifcvf_main.c static int ifcvf_request_irq(struct ifcvf_adapter *adapter) · line 84

Quoted 9 lines
drivers/vdpa/ifcvf/ifcvf_main.c +4 -0
@@ -76,6 +76,10 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
  	ret = devm_request_irq(&pdev->dev, irq,
  			       ifcvf_config_changed, 0,
  			       vf->config_msix_name, vf);
+	if (ret) {
+		IFCVF_ERR(pdev, "Failed to request config irq\n");
+		return ret;
+	}
  	for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
  		snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",

Hi Michael:

Quoted 4 lines

Any comments on this series?

Thanks

Applied, thanks!

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

Tested-by on v1 1/2
#4 lore raw
In reply to Jason Wang

Hi,

Quoted 15 lines · Jason Wang

We ignore the err of requesting config interrupt, fix this.

Fixes e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
Cc Zhu Lingshan <[email protected]>
---
 drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/vdpa/ifcvf/ifcvf_main.c +0 -0
index f5a60c14b979..ae7110955a44 100644

drivers/vdpa/ifcvf/ifcvf_main.c static int ifcvf_request_irq(struct ifcvf_adapter *adapter) · line 85

Quoted 10 lines
drivers/vdpa/ifcvf/ifcvf_main.c +4 -0
@@ -76,6 +76,10 @@ static int ifcvf_request_irq(struct ifcvf_adapter *adapter)
 	ret = devm_request_irq(&pdev->dev, irq,
 			       ifcvf_config_changed, 0,
 			       vf->config_msix_name, vf);
+	if (ret) {
+		IFCVF_ERR(pdev, "Failed to request config irq\n");
+		return ret;
+	}
 
 	for (i = 0; i < IFCVF_MAX_QUEUE_PAIRS * 2; i++) {
 		snprintf(vf->vring[i].msix_name, 256, "ifcvf[%s]-%d\n",

This series fixes below Kernel BUG I faced while doing some experiments:

[ 1398.695362] kernel BUG at drivers/pci/msi.c:375!
[ 1398.700561] invalid opcode: 0000 [#1] SMP PTI
[ 1398.705423] CPU: 0 PID: 25110 Comm: dpdk-testpmd Not tainted
5.8.0-amorenoz-vdpa+ #2
[ 1398.714063] Hardware name: Dell Inc. PowerEdge R730/072T6D, BIOS
2.4.3 01/17/2017
[ 1398.722415] RIP: 0010:free_msi_irqs+0x189/0x1c0
[ 1398.727470] Code: 14 85 c0 0f 84 cc fe ff ff 31 ed eb 0f 83 c5 01 39
6b 14 0f 86 bc fe ff ff 8b 7b 10 01 ef e8 7e 94 b9 ff 48 83 78 70 00d
[ 1398.748426] RSP: 0018:ffffb48ac5dd3db8 EFLAGS: 00010286
[ 1398.754257] RAX: ffff9ab298b85400 RBX: ffff9ab285d97100 RCX:
0000000000000000
[ 1398.762219] RDX: 0000000000000000 RSI: 0000000000000073 RDI:
ffffffffac65e8a0
[ 1398.770182] RBP: 0000000000000000 R08: ffff9ab298b85400 R09:
ffff9ab74a8c3d98
[ 1398.778145] R10: ffff9ab74a8c3f58 R11: 0000000000000000 R12:
ffff9ab719fd82e0
[ 1398.786107] R13: ffff9ab719fd8000 R14: ffff9ab719fd8000 R15:
ffff9ab719fd80b0
[ 1398.794069] FS:  00007efc5dea9000(0000) GS:ffff9ab75fc00000(0000)
knlGS:0000000000000000
[ 1398.803099] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1398.809508] CR2: 000000c000079ff8 CR3: 000000038283e005 CR4:
00000000003606f0
[ 1398.817471] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[ 1398.825434] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[ 1398.833394] Call Trace:
[ 1398.836127]  pci_disable_msix+0xf7/0x120
[ 1398.840504]  pci_free_irq_vectors+0xe/0x20
[ 1398.845074]  ifcvf_vdpa_set_status+0xda/0x301
[ 1398.849938]  vhost_vdpa_unlocked_ioctl+0x61d/0x790
[ 1398.855277]  ? vhost_vdpa_process_iotlb_msg+0x2f0/0x2f0
[ 1398.861109]  ksys_ioctl+0x87/0xc0
[ 1398.864808]  __x64_sys_ioctl+0x16/0x20
[ 1398.868992]  do_syscall_64+0x52/0x90
[ 1398.872982]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[ 1398.878610] RIP: 0033:0x7efc5df9ff9b
[ 1398.882598] Code: 0f 1e fa 48 8b 05 ed ce 0c 00 64 c7 00 26 00 00 00
48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 008
[ 1398.903551] RSP: 002b:00007ffd0948e378 EFLAGS: 00000283 ORIG_RAX:
0000000000000010
[ 1398.911998] RAX: ffffffffffffffda RBX: 0000000000000000 RCX:
00007efc5df9ff9b
[ 1398.919960] RDX: 00007ffd0948e3d4 RSI: 000000004001af72 RDI:
000000000000002c
[ 1398.927921] RBP: 00007ffd0948e3c0 R08: 0000000002651bf8 R09:
0000000000000000
[ 1398.935883] R10: 00007ffd0948e417 R11: 0000000000000283 R12:
0000000000408950
[ 1398.943845] R13: 00007ffd0948e6a0 R14: 0000000000000000 R15:
0000000000000000
[ 1398.951809] Modules linked in: vxlan ip6_udp_tunnel udp_tunnel
ip_vs_sh ip_vs_wrr ip_vs_rr ip_vs xt_comment xt_mark nf_tables xt_nat vetht
[ 1398.951847]  ghash_clmulni_intel iTCO_vendor_support mlx5_core dcdbas

rapl intel_cstate intel_uncore ipmi_ssif pcspkr mxm_wmi mlxfw virtii

Thanks,
Maxime

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization