net/ifc: do not notify before HW ready
PATCH 1/1 net/ifc: do not notify before HW ready
--- drivers/net/ifc/ifcvf_vdpa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ifc/ifcvf_vdpa.c +4 -4
@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;
@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err;
Signature · 1 line
2.15.1
Hi, Xiao
Quoted 1 line · Xiao Wang
Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
Could you help describe what problem is without this fix in commit log?
Thanks,
Xiaolong
Quoted 42 lines
Signed-off-by Xiao Wang <[email protected]>---
drivers/net/ifc/ifcvf_vdpa.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ifc/ifcvf_vdpa.c +4
-4@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err;Signature · 1 line
2.15.1
Hi Xiaolong,
Quoted 7 lines
-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, September 13, 2018 8:55 PM
To: Wang, Xiao W <[email protected]>
Cc: Bie, Tiwei <[email protected]>; [email protected]
Subject: Re: [PATCH] net/ifc: do not notify before HW ready
Quoted 6 lines
Hi, Xiao
Quoted 1 line · Xiao Wang
Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Could you help describe what problem is without this fix in commit log?
Generally a driver should finish all the device configurations first then notify the HW for data processing.
Without this fix, the potential problems are:
1. If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the vDPA relay thread kicks it, a bad DMA request may happen.
2. The notify_addr which is used by the relay thread is set in the vdpa_ifcvf_start function. If there's really a kick relay before vdpa_ifcvf_start finishes, a null addr is accessed.
Would add the description in the commit log in v2.
Thanks for the comment,
Xiao
Quoted 45 lines
Thanks,
XiaolongQuoted 42 lines
Signed-off-by Xiao Wang <[email protected]>---
drivers/net/ifc/ifcvf_vdpa.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ifc/ifcvf_vdpa.c +4
-5@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err; --2.15.1
Quoted 12 lines · Xiao W
Hi Xiaolong,
Quoted 10 lines
-----Original Message-----
From: Ye, Xiaolong
Sent: Thursday, September 13, 2018 8:55 PM
To: Wang, Xiao W <[email protected]>
Cc: Bie, Tiwei <[email protected]>; [email protected]
Subject: Re: [PATCH] net/ifc: do not notify before HW readyHi, Xiao
On 09/10, Xiao Wang wrote:
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Could you help describe what problem is without this fix in commit log?
Generally a driver should finish all the device configurations first then notify the HW for data processing.
Without this fix, the potential problems are:
1. If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the vDPA relay thread kicks it, a bad DMA request may happen.
2. Thenotify_addrwhich is used by the relay thread is set in thevdpa_ifcvf_startfunction. If there's really a kick relay beforevdpa_ifcvf_startfinishes, a null addr is accessed.
Thanks for the explanation.
Thanks,
Xiaolong
Quoted 49 lines
Would add the description in the commit log in v2.
Thanks for the comment,
XiaoQuoted 45 lines
Thanks,
XiaolongQuoted 42 lines
Signed-off-by Xiao Wang <[email protected]>---
drivers/net/ifc/ifcvf_vdpa.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ifc/ifcvf_vdpa.c +4
-5@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err; --2.15.1
PATCH v2 1/1 net/ifc: do not notify before HW ready
In reply to Xiao WangIf the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen.
Besides, the notify_addr which is used by the relay thread is set in the vdpa_ifcvf_start function, if a kick relay happens before vdpa_ifcvf_start finishes, a null addr is accessed.
---
v2:
* Add description for the fix in the commit log.
--- drivers/net/ifc/ifcvf_vdpa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ifc/ifcvf_vdpa.c +4 -4
@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;
@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err;
Signature · 1 line
2.15.1
Looks good to me.
Thanks,
Xiaolong
Quoted 54 lines · Xiao Wang
If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen.
Besides, the
notify_addrwhich is used by the relay thread is set in thevdpa_ifcvf_startfunction, if a kick relay happens beforevdpa_ifcvf_startfinishes, a null addr is accessed.Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Signed-off-by Xiao Wang <[email protected]>---
v2:
* Add description for the fix in the commit log.
---drivers/net/ifc/ifcvf_vdpa.c| 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ifc/ifcvf_vdpa.c +4
-4@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err;Signature · 1 line
2.15.1
Zhang, Qi Z
AppliedQuoted 9 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Ye Xiaolong
Sent: Friday, September 14, 2018 4:42 PM
To: Wang, Xiao W <[email protected]>
Cc: Bie, Tiwei <[email protected]>; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/ifc: do not notify before HW ready
Quoted 19 lines
Looks good to me.
Reviewed-by Ye Xiaolong <[email protected]>Thanks,
XiaolongQuoted 11 lines · Xiao Wang
If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen.
Besides, the
notify_addrwhich is used by the relay thread is set in thevdpa_ifcvf_startfunction, if a kick relay happens beforevdpa_ifcvf_startfinishes, a null addr is accessed.Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Signed-off-by Xiao Wang <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi
Quoted 10 lines · Xiao Wang
If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen.
Besides, the
notify_addrwhich is used by the relay thread is set in thevdpa_ifcvf_startfunction, if a kick relay happens beforevdpa_ifcvf_startfinishes, a null addr is accessed.Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
Looks like this should be in stable branch too. Can you confirm?
Quoted 42 lines
Signed-off-by Xiao Wang <[email protected]>---
v2:
* Add description for the fix in the commit log.--- drivers/net/ifc/ifcvf_vdpa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)drivers/net/ifc/ifcvf_vdpa.c +4
-4@@ -503,11 +503,11 @@ update_datapath(struct ifcvf_internal *internal)if (ret) goto err; - ret =setup_notify_relay (internal); + ret =vdpa_ifcvf_start (internal);if (ret) goto err; - ret =vdpa_ifcvf_start (internal); + ret =setup_notify_relay (internal);if (ret) goto err;@@ -515,12 +515,12 @@ update_datapath(struct ifcvf_internal *internal) }else if (rte_atomic32_read (&internal->running) && (!rte_atomic32_read (&internal->started) || !rte_atomic32_read (&internal->dev_attached))) { -vdpa_ifcvf_stop (internal); - ret =unset_notify_relay (internal);if (ret) goto err; +vdpa_ifcvf_stop (internal); + ret =vdpa_disable_vfio_intr (internal);if (ret) goto err;
Hi,
Quoted 13 lines
-----Original Message-----
From: Kevin Traynor [mailto:[email protected]]
Sent: Wednesday, September 26, 2018 1:16 AM
To: Wang, Xiao W <[email protected]>
Cc: Ye, Xiaolong <[email protected]>; Bie, Tiwei <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/ifc: do not notify before HW readyQuoted 4 lines · Xiao Wang
If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen.
Quoted 8 lines
Quoted 6 lines
Besides, the
notify_addrwhich is used by the relay thread is set in thevdpa_ifcvf_startfunction, if a kick relay happens beforevdpa_ifcvf_startfinishes, a null addr is accessed.Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Looks like this should be in stable branch too. Can you confirm?
Yes, they should go also into stable branch, thanks for the notice.
BRs,
Xiao
Quoted 19 lines · Xiao W
Hi,
Quoted 17 lines
-----Original Message-----
From: Kevin Traynor [mailto:[email protected]]
Sent: Wednesday, September 26, 2018 1:16 AM
To: Wang, Xiao W <[email protected]>
Cc: Ye, Xiaolong <[email protected]>; Bie, Tiwei <[email protected]>; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/ifc: do not notify before HW readyQuoted 8 lines · Xiao Wang
If the device is not clearly reset by the previous driver and holds some invalid ring addr, and the relay thread kicks it before HW is properly re-configured, a bad DMA request may happen.
Besides, the
notify_addrwhich is used by the relay thread is set in thevdpa_ifcvf_startfunction, if a kick relay happens beforevdpa_ifcvf_startfinishes, a null addr is accessed.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")Looks like this should be in stable branch too. Can you confirm?
Yes, they should go also into stable branch, thanks for the notice.
"Cc: [email protected]" already has been added while merging next-net Commit c5ea24905585 ("net/ifc: do not notify before HW ready")
Thanks for checking.