virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq
@ 2020-07-23  9:12 Jason Wang
  2020-07-23  9:12 ` [PATCH 2/2] vdpa: ifcvf: free config irq in ifcvf_free_irq() Jason Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jason Wang @ 2020-07-23  9:12 UTC (permalink / raw)
  To: mst, jasowang, virtualization, linux-kernel; +Cc: Zhu Lingshan

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

Fixes: e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
Cc: Zhu Lingshan <lingshan.zhu@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index f5a60c14b979..ae7110955a44 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -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",
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] vdpa: ifcvf: free config irq in ifcvf_free_irq()
  2020-07-23  9:12 [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
@ 2020-07-23  9:12 ` Jason Wang
  2020-08-07  3:52 ` [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
  2020-08-12  7:39 ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Wang @ 2020-07-23  9:12 UTC (permalink / raw)
  To: mst, jasowang, virtualization, linux-kernel; +Cc: Zhu Lingshan

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 <lingshan.zhu@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 drivers/vdpa/ifcvf/ifcvf_base.h | 2 +-
 drivers/vdpa/ifcvf/ifcvf_main.c | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/vdpa/ifcvf/ifcvf_base.h b/drivers/vdpa/ifcvf/ifcvf_base.h
index f4554412e607..29efa75cdfce 100644
--- a/drivers/vdpa/ifcvf/ifcvf_base.h
+++ b/drivers/vdpa/ifcvf/ifcvf_base.h
@@ -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 {
diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
index ae7110955a44..7a6d899e541d 100644
--- a/drivers/vdpa/ifcvf/ifcvf_main.c
+++ b/drivers/vdpa/ifcvf/ifcvf_main.c
@@ -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) {
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq
  2020-07-23  9:12 [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
  2020-07-23  9:12 ` [PATCH 2/2] vdpa: ifcvf: free config irq in ifcvf_free_irq() Jason Wang
@ 2020-08-07  3:52 ` Jason Wang
  2020-08-26 11:12   ` Michael S. Tsirkin
  2020-08-12  7:39 ` Maxime Coquelin
  2 siblings, 1 reply; 5+ messages in thread
From: Jason Wang @ 2020-08-07  3:52 UTC (permalink / raw)
  To: mst, virtualization, linux-kernel; +Cc: Zhu Lingshan


On 2020/7/23 下午5:12, Jason Wang wrote:
> We ignore the err of requesting config interrupt, fix this.
>
> Fixes: e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
> Cc: Zhu Lingshan <lingshan.zhu@intel.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>   drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index f5a60c14b979..ae7110955a44 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -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


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq
  2020-07-23  9:12 [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
  2020-07-23  9:12 ` [PATCH 2/2] vdpa: ifcvf: free config irq in ifcvf_free_irq() Jason Wang
  2020-08-07  3:52 ` [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
@ 2020-08-12  7:39 ` Maxime Coquelin
  2 siblings, 0 replies; 5+ messages in thread
From: Maxime Coquelin @ 2020-08-12  7:39 UTC (permalink / raw)
  To: Jason Wang, mst, virtualization, linux-kernel; +Cc: Zhu Lingshan

Hi,

On 7/23/20 11:12 AM, Jason Wang wrote:
> We ignore the err of requesting config interrupt, fix this.
> 
> Fixes: e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
> Cc: Zhu Lingshan <lingshan.zhu@intel.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> index f5a60c14b979..ae7110955a44 100644
> --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> @@ -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

Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq
  2020-08-07  3:52 ` [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
@ 2020-08-26 11:12   ` Michael S. Tsirkin
  0 siblings, 0 replies; 5+ messages in thread
From: Michael S. Tsirkin @ 2020-08-26 11:12 UTC (permalink / raw)
  To: Jason Wang; +Cc: Zhu Lingshan, linux-kernel, virtualization

On Fri, Aug 07, 2020 at 11:52:09AM +0800, Jason Wang wrote:
> 
> On 2020/7/23 下午5:12, Jason Wang wrote:
> > We ignore the err of requesting config interrupt, fix this.
> > 
> > Fixes: e7991f376a4d ("ifcvf: implement config interrupt in IFCVF")
> > Cc: Zhu Lingshan <lingshan.zhu@intel.com>
> > Signed-off-by: Jason Wang <jasowang@redhat.com>
> > ---
> >   drivers/vdpa/ifcvf/ifcvf_main.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> > 
> > diff --git a/drivers/vdpa/ifcvf/ifcvf_main.c b/drivers/vdpa/ifcvf/ifcvf_main.c
> > index f5a60c14b979..ae7110955a44 100644
> > --- a/drivers/vdpa/ifcvf/ifcvf_main.c
> > +++ b/drivers/vdpa/ifcvf/ifcvf_main.c
> > @@ -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
> 

Applied, thanks!

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-08-26 11:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-23  9:12 [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
2020-07-23  9:12 ` [PATCH 2/2] vdpa: ifcvf: free config irq in ifcvf_free_irq() Jason Wang
2020-08-07  3:52 ` [PATCH 1/2] vdpa: ifcvf: return err when fail to request config irq Jason Wang
2020-08-26 11:12   ` Michael S. Tsirkin
2020-08-12  7:39 ` Maxime Coquelin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).