DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
@ 2019-05-08 12:51 wangyunjian
  2019-05-08 12:51 ` wangyunjian
  2019-05-10  3:14 ` Zhao1, Wei
  0 siblings, 2 replies; 10+ messages in thread
From: wangyunjian @ 2019-05-08 12:51 UTC (permalink / raw)
  To: dev; +Cc: i.maximets, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

The nic's interrupt source has some active handler, which maybe call
ixgbe_dev_link_update() to set link handler. We should cancel the
link handler before remove dev to prevent executing the link handler.
It triggers segfault.

Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 975fa47..2470c89 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
 	/* cancel the delay handler before remove dev */
 	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, eth_dev);
 
+	/* cancel the link handler before remove dev */
+	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, eth_dev);
+
 	/* uninitialize PF if max_vfs not zero */
 	ixgbe_pf_host_uninit(eth_dev);
 
-- 
1.8.3.1

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

* [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-08 12:51 [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed wangyunjian
@ 2019-05-08 12:51 ` wangyunjian
  2019-05-10  3:14 ` Zhao1, Wei
  1 sibling, 0 replies; 10+ messages in thread
From: wangyunjian @ 2019-05-08 12:51 UTC (permalink / raw)
  To: dev; +Cc: i.maximets, xudingke, Yunjian Wang, stable

From: Yunjian Wang <wangyunjian@huawei.com>

The nic's interrupt source has some active handler, which maybe call
ixgbe_dev_link_update() to set link handler. We should cancel the
link handler before remove dev to prevent executing the link handler.
It triggers segfault.

Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 975fa47..2470c89 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
 	/* cancel the delay handler before remove dev */
 	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, eth_dev);
 
+	/* cancel the link handler before remove dev */
+	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, eth_dev);
+
 	/* uninitialize PF if max_vfs not zero */
 	ixgbe_pf_host_uninit(eth_dev);
 
-- 
1.8.3.1



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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-08 12:51 [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed wangyunjian
  2019-05-08 12:51 ` wangyunjian
@ 2019-05-10  3:14 ` Zhao1, Wei
  2019-05-10  3:14   ` Zhao1, Wei
  2019-05-10 11:37   ` wangyunjian
  1 sibling, 2 replies; 10+ messages in thread
From: Zhao1, Wei @ 2019-05-10  3:14 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: i.maximets, xudingke, stable

Hi,  wangyunjian

 	May I ask some more info about it?
Sure, we may this handler in ixgbe_dev_link_update_share (),  but we have  "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)" 
in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this handler. If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
Maybe there is an accidental situation that some interrupt like LSC trigger ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev stop?
Then we need to cancel it in eth_ixgbe_dev_uninit().
Is you issue the same as above or other?


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> Sent: Wednesday, May 8, 2019 8:52 PM
> To: dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> <wangyunjian@huawei.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is
> being removed
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The nic's interrupt source has some active handler, which maybe call
> ixgbe_dev_link_update() to set link handler. We should cancel the link handler
> before remove dev to prevent executing the link handler.
> It triggers segfault.
> 
> Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 975fa47..2470c89 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
>  	/* cancel the delay handler before remove dev */
>  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, eth_dev);
> 
> +	/* cancel the link handler before remove dev */
> +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, eth_dev);
> +
>  	/* uninitialize PF if max_vfs not zero */
>  	ixgbe_pf_host_uninit(eth_dev);
> 
> --
> 1.8.3.1
> 

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-10  3:14 ` Zhao1, Wei
@ 2019-05-10  3:14   ` Zhao1, Wei
  2019-05-10 11:37   ` wangyunjian
  1 sibling, 0 replies; 10+ messages in thread
From: Zhao1, Wei @ 2019-05-10  3:14 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: i.maximets, xudingke, stable

Hi,  wangyunjian

 	May I ask some more info about it?
Sure, we may this handler in ixgbe_dev_link_update_share (),  but we have  "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)" 
in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this handler. If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
Maybe there is an accidental situation that some interrupt like LSC trigger ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev stop?
Then we need to cancel it in eth_ixgbe_dev_uninit().
Is you issue the same as above or other?


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> Sent: Wednesday, May 8, 2019 8:52 PM
> To: dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> <wangyunjian@huawei.com>; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is
> being removed
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> The nic's interrupt source has some active handler, which maybe call
> ixgbe_dev_link_update() to set link handler. We should cancel the link handler
> before remove dev to prevent executing the link handler.
> It triggers segfault.
> 
> Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link update")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 975fa47..2470c89 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
>  	/* cancel the delay handler before remove dev */
>  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, eth_dev);
> 
> +	/* cancel the link handler before remove dev */
> +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, eth_dev);
> +
>  	/* uninitialize PF if max_vfs not zero */
>  	ixgbe_pf_host_uninit(eth_dev);
> 
> --
> 1.8.3.1
> 


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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-10  3:14 ` Zhao1, Wei
  2019-05-10  3:14   ` Zhao1, Wei
@ 2019-05-10 11:37   ` wangyunjian
  2019-05-10 11:37     ` wangyunjian
  2019-05-13  1:56     ` Zhao1, Wei
  1 sibling, 2 replies; 10+ messages in thread
From: wangyunjian @ 2019-05-10 11:37 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: i.maximets, xudingke, stable



> -----Original Message-----
> From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> Sent: Friday, May 10, 2019 11:14 AM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port
> is being removed
> 
> Hi,  wangyunjian
> 
>  	May I ask some more info about it?
> Sure, we may this handler in ixgbe_dev_link_update_share (),  but we have
> "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)"
> in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this handler.
> If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> Maybe there is an accidental situation that some interrupt like LSC trigger
> ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev stop?
> Then we need to cancel it in eth_ixgbe_dev_uninit().
> Is you issue the same as above or other?

Yes,  it is as above. It is easy to reproduce through fault injection. As follow:

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 975fa47..a1e93c0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4055,7 +4055,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
        if (link_up == 0) {
                if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
                        intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
-                       rte_eal_alarm_set(10,
+                       rte_eal_alarm_set(500 * 1000,
                                ixgbe_dev_setup_link_alarm_handler, dev);
                }
                return rte_eth_linkstatus_set(dev, &link);

> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> > Sent: Wednesday, May 8, 2019 8:52 PM
> > To: dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> > <wangyunjian@huawei.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when
> > port is being removed
> >
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > The nic's interrupt source has some active handler, which maybe call
> > ixgbe_dev_link_update() to set link handler. We should cancel the link
> > handler before remove dev to prevent executing the link handler.
> > It triggers segfault.
> >
> > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > update")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 975fa47..2470c89 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
> >  	/* cancel the delay handler before remove dev */
> >  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler,
> eth_dev);
> >
> > +	/* cancel the link handler before remove dev */
> > +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler,
> eth_dev);
> > +
> >  	/* uninitialize PF if max_vfs not zero */
> >  	ixgbe_pf_host_uninit(eth_dev);
> >
> > --
> > 1.8.3.1
> >

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-10 11:37   ` wangyunjian
@ 2019-05-10 11:37     ` wangyunjian
  2019-05-13  1:56     ` Zhao1, Wei
  1 sibling, 0 replies; 10+ messages in thread
From: wangyunjian @ 2019-05-10 11:37 UTC (permalink / raw)
  To: Zhao1, Wei, dev; +Cc: i.maximets, xudingke, stable



> -----Original Message-----
> From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> Sent: Friday, May 10, 2019 11:14 AM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port
> is being removed
> 
> Hi,  wangyunjian
> 
>  	May I ask some more info about it?
> Sure, we may this handler in ixgbe_dev_link_update_share (),  but we have
> "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)"
> in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this handler.
> If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> Maybe there is an accidental situation that some interrupt like LSC trigger
> ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev stop?
> Then we need to cancel it in eth_ixgbe_dev_uninit().
> Is you issue the same as above or other?

Yes,  it is as above. It is easy to reproduce through fault injection. As follow:

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 975fa47..a1e93c0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4055,7 +4055,7 @@ static int ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
        if (link_up == 0) {
                if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
                        intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
-                       rte_eal_alarm_set(10,
+                       rte_eal_alarm_set(500 * 1000,
                                ixgbe_dev_setup_link_alarm_handler, dev);
                }
                return rte_eth_linkstatus_set(dev, &link);

> 
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> > Sent: Wednesday, May 8, 2019 8:52 PM
> > To: dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> > <wangyunjian@huawei.com>; stable@dpdk.org
> > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when
> > port is being removed
> >
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > The nic's interrupt source has some active handler, which maybe call
> > ixgbe_dev_link_update() to set link handler. We should cancel the link
> > handler before remove dev to prevent executing the link handler.
> > It triggers segfault.
> >
> > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > update")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 975fa47..2470c89 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
> >  	/* cancel the delay handler before remove dev */
> >  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler,
> eth_dev);
> >
> > +	/* cancel the link handler before remove dev */
> > +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler,
> eth_dev);
> > +
> >  	/* uninitialize PF if max_vfs not zero */
> >  	ixgbe_pf_host_uninit(eth_dev);
> >
> > --
> > 1.8.3.1
> >


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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-10 11:37   ` wangyunjian
  2019-05-10 11:37     ` wangyunjian
@ 2019-05-13  1:56     ` Zhao1, Wei
  2019-05-13  1:56       ` Zhao1, Wei
  2019-05-14 14:01       ` Zhang, Qi Z
  1 sibling, 2 replies; 10+ messages in thread
From: Zhao1, Wei @ 2019-05-13  1:56 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: i.maximets, xudingke, stable

Thank you for your more info!

Acked-by: Wei Zhao <wei.zhao1@intel.com>



> -----Original Message-----
> From: wangyunjian [mailto:wangyunjian@huawei.com]
> Sent: Friday, May 10, 2019 7:38 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is
> being removed
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> > Sent: Friday, May 10, 2019 11:14 AM
> > To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > stable@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > when port is being removed
> >
> > Hi,  wangyunjian
> >
> >  	May I ask some more info about it?
> > Sure, we may this handler in ixgbe_dev_link_update_share (),  but we
> > have "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)"
> > in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this handler.
> > If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> > Maybe there is an accidental situation that some interrupt like LSC
> > trigger
> > ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev stop?
> > Then we need to cancel it in eth_ixgbe_dev_uninit().
> > Is you issue the same as above or other?
> 
> Yes,  it is as above. It is easy to reproduce through fault injection. As follow:
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 975fa47..a1e93c0 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -4055,7 +4055,7 @@ static int
> ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
>         if (link_up == 0) {
>                 if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
>                         intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> -                       rte_eal_alarm_set(10,
> +                       rte_eal_alarm_set(500 * 1000,
>                                 ixgbe_dev_setup_link_alarm_handler, dev);
>                 }
>                 return rte_eth_linkstatus_set(dev, &link);
> 
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> > > Sent: Wednesday, May 8, 2019 8:52 PM
> > > To: dev@dpdk.org
> > > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> > > <wangyunjian@huawei.com>; stable@dpdk.org
> > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when
> > > port is being removed
> > >
> > > From: Yunjian Wang <wangyunjian@huawei.com>
> > >
> > > The nic's interrupt source has some active handler, which maybe call
> > > ixgbe_dev_link_update() to set link handler. We should cancel the
> > > link handler before remove dev to prevent executing the link handler.
> > > It triggers segfault.
> > >
> > > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > > update")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > > ---
> > >  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > index 975fa47..2470c89 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
> > >  	/* cancel the delay handler before remove dev */
> > >  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler,
> > eth_dev);
> > >
> > > +	/* cancel the link handler before remove dev */
> > > +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler,
> > eth_dev);
> > > +
> > >  	/* uninitialize PF if max_vfs not zero */
> > >  	ixgbe_pf_host_uninit(eth_dev);
> > >
> > > --
> > > 1.8.3.1
> > >

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-13  1:56     ` Zhao1, Wei
@ 2019-05-13  1:56       ` Zhao1, Wei
  2019-05-14 14:01       ` Zhang, Qi Z
  1 sibling, 0 replies; 10+ messages in thread
From: Zhao1, Wei @ 2019-05-13  1:56 UTC (permalink / raw)
  To: wangyunjian, dev; +Cc: i.maximets, xudingke, stable

Thank you for your more info!

Acked-by: Wei Zhao <wei.zhao1@intel.com>



> -----Original Message-----
> From: wangyunjian [mailto:wangyunjian@huawei.com]
> Sent: Friday, May 10, 2019 7:38 PM
> To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is
> being removed
> 
> 
> 
> > -----Original Message-----
> > From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> > Sent: Friday, May 10, 2019 11:14 AM
> > To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > stable@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > when port is being removed
> >
> > Hi,  wangyunjian
> >
> >  	May I ask some more info about it?
> > Sure, we may this handler in ixgbe_dev_link_update_share (),  but we
> > have "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)"
> > in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this handler.
> > If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> > Maybe there is an accidental situation that some interrupt like LSC
> > trigger
> > ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev stop?
> > Then we need to cancel it in eth_ixgbe_dev_uninit().
> > Is you issue the same as above or other?
> 
> Yes,  it is as above. It is easy to reproduce through fault injection. As follow:
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 975fa47..a1e93c0 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -4055,7 +4055,7 @@ static int
> ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
>         if (link_up == 0) {
>                 if (ixgbe_get_media_type(hw) == ixgbe_media_type_fiber) {
>                         intr->flags |= IXGBE_FLAG_NEED_LINK_CONFIG;
> -                       rte_eal_alarm_set(10,
> +                       rte_eal_alarm_set(500 * 1000,
>                                 ixgbe_dev_setup_link_alarm_handler, dev);
>                 }
>                 return rte_eth_linkstatus_set(dev, &link);
> 
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> > > Sent: Wednesday, May 8, 2019 8:52 PM
> > > To: dev@dpdk.org
> > > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> > > <wangyunjian@huawei.com>; stable@dpdk.org
> > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when
> > > port is being removed
> > >
> > > From: Yunjian Wang <wangyunjian@huawei.com>
> > >
> > > The nic's interrupt source has some active handler, which maybe call
> > > ixgbe_dev_link_update() to set link handler. We should cancel the
> > > link handler before remove dev to prevent executing the link handler.
> > > It triggers segfault.
> > >
> > > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > > update")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> > > ---
> > >  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > >
> > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > index 975fa47..2470c89 100644
> > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
> > >  	/* cancel the delay handler before remove dev */
> > >  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler,
> > eth_dev);
> > >
> > > +	/* cancel the link handler before remove dev */
> > > +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler,
> > eth_dev);
> > > +
> > >  	/* uninitialize PF if max_vfs not zero */
> > >  	ixgbe_pf_host_uninit(eth_dev);
> > >
> > > --
> > > 1.8.3.1
> > >


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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-13  1:56     ` Zhao1, Wei
  2019-05-13  1:56       ` Zhao1, Wei
@ 2019-05-14 14:01       ` Zhang, Qi Z
  2019-05-14 14:01         ` Zhang, Qi Z
  1 sibling, 1 reply; 10+ messages in thread
From: Zhang, Qi Z @ 2019-05-14 14:01 UTC (permalink / raw)
  To: Zhao1, Wei, wangyunjian, dev; +Cc: i.maximets, xudingke, stable



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhao1, Wei
> Sent: Monday, May 13, 2019 9:57 AM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is
> being removed
> 
> Thank you for your more info!
> 
> Acked-by: Wei Zhao <wei.zhao1@intel.com>
> 
Applied to dpdk-next-net-intel.

Thanks
Qi

> 
> > -----Original Message-----
> > From: wangyunjian [mailto:wangyunjian@huawei.com]
> > Sent: Friday, May 10, 2019 7:38 PM
> > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > stable@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > when port is being removed
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> > > Sent: Friday, May 10, 2019 11:14 AM
> > > To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> > > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > > stable@dpdk.org
> > > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > > when port is being removed
> > >
> > > Hi,  wangyunjian
> > >
> > >  	May I ask some more info about it?
> > > Sure, we may this handler in ixgbe_dev_link_update_share (),  but we
> > > have "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)"
> > > in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this
> handler.
> > > If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> > > Maybe there is an accidental situation that some interrupt like LSC
> > > trigger
> > > ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev
> stop?
> > > Then we need to cancel it in eth_ixgbe_dev_uninit().
> > > Is you issue the same as above or other?
> >
> > Yes,  it is as above. It is easy to reproduce through fault injection. As follow:
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 975fa47..a1e93c0 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -4055,7 +4055,7 @@ static int
> > ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
> >         if (link_up == 0) {
> >                 if (ixgbe_get_media_type(hw) ==
> ixgbe_media_type_fiber) {
> >                         intr->flags |=
> IXGBE_FLAG_NEED_LINK_CONFIG;
> > -                       rte_eal_alarm_set(10,
> > +                       rte_eal_alarm_set(500 * 1000,
> >
> ixgbe_dev_setup_link_alarm_handler, dev);
> >                 }
> >                 return rte_eth_linkstatus_set(dev, &link);
> >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> > > > Sent: Wednesday, May 8, 2019 8:52 PM
> > > > To: dev@dpdk.org
> > > > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> > > > <wangyunjian@huawei.com>; stable@dpdk.org
> > > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > > > when port is being removed
> > > >
> > > > From: Yunjian Wang <wangyunjian@huawei.com>
> > > >
> > > > The nic's interrupt source has some active handler, which maybe
> > > > call
> > > > ixgbe_dev_link_update() to set link handler. We should cancel the
> > > > link handler before remove dev to prevent executing the link handler.
> > > > It triggers segfault.
> > > >
> > > > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > > > update")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

> > > > ---
> > > >  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > index 975fa47..2470c89 100644
> > > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
> > > >  	/* cancel the delay handler before remove dev */
> > > >  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler,
> > > eth_dev);
> > > >
> > > > +	/* cancel the link handler before remove dev */
> > > > +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler,
> > > eth_dev);
> > > > +
> > > >  	/* uninitialize PF if max_vfs not zero */
> > > >  	ixgbe_pf_host_uninit(eth_dev);
> > > >
> > > > --
> > > > 1.8.3.1
> > > >

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

* Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed
  2019-05-14 14:01       ` Zhang, Qi Z
@ 2019-05-14 14:01         ` Zhang, Qi Z
  0 siblings, 0 replies; 10+ messages in thread
From: Zhang, Qi Z @ 2019-05-14 14:01 UTC (permalink / raw)
  To: Zhao1, Wei, wangyunjian, dev; +Cc: i.maximets, xudingke, stable



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Zhao1, Wei
> Sent: Monday, May 13, 2019 9:57 AM
> To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> stable@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is
> being removed
> 
> Thank you for your more info!
> 
> Acked-by: Wei Zhao <wei.zhao1@intel.com>
> 
Applied to dpdk-next-net-intel.

Thanks
Qi

> 
> > -----Original Message-----
> > From: wangyunjian [mailto:wangyunjian@huawei.com]
> > Sent: Friday, May 10, 2019 7:38 PM
> > To: Zhao1, Wei <wei.zhao1@intel.com>; dev@dpdk.org
> > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > stable@dpdk.org
> > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > when port is being removed
> >
> >
> >
> > > -----Original Message-----
> > > From: Zhao1, Wei [mailto:wei.zhao1@intel.com]
> > > Sent: Friday, May 10, 2019 11:14 AM
> > > To: wangyunjian <wangyunjian@huawei.com>; dev@dpdk.org
> > > Cc: i.maximets@samsung.com; xudingke <xudingke@huawei.com>;
> > > stable@dpdk.org
> > > Subject: RE: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > > when port is being removed
> > >
> > > Hi,  wangyunjian
> > >
> > >  	May I ask some more info about it?
> > > Sure, we may this handler in ixgbe_dev_link_update_share (),  but we
> > > have "rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev)"
> > > in function ixgbe_dev_stop() and ixgbevf_dev_stop() to  cancel this
> handler.
> > > If you want to remove dev, you will call ixgbe_dev_stop() first, RIGHT?
> > > Maybe there is an accidental situation that some interrupt like LSC
> > > trigger
> > > ixgbe_dev_link_update() to set setup_link_alarm_handler just after dev
> stop?
> > > Then we need to cancel it in eth_ixgbe_dev_uninit().
> > > Is you issue the same as above or other?
> >
> > Yes,  it is as above. It is easy to reproduce through fault injection. As follow:
> >
> > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > index 975fa47..a1e93c0 100644
> > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > @@ -4055,7 +4055,7 @@ static int
> > ixgbevf_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
> >         if (link_up == 0) {
> >                 if (ixgbe_get_media_type(hw) ==
> ixgbe_media_type_fiber) {
> >                         intr->flags |=
> IXGBE_FLAG_NEED_LINK_CONFIG;
> > -                       rte_eal_alarm_set(10,
> > +                       rte_eal_alarm_set(500 * 1000,
> >
> ixgbe_dev_setup_link_alarm_handler, dev);
> >                 }
> >                 return rte_eth_linkstatus_set(dev, &link);
> >
> > >
> > >
> > > > -----Original Message-----
> > > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of wangyunjian
> > > > Sent: Wednesday, May 8, 2019 8:52 PM
> > > > To: dev@dpdk.org
> > > > Cc: i.maximets@samsung.com; xudingke@huawei.com; Yunjian Wang
> > > > <wangyunjian@huawei.com>; stable@dpdk.org
> > > > Subject: [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler
> > > > when port is being removed
> > > >
> > > > From: Yunjian Wang <wangyunjian@huawei.com>
> > > >
> > > > The nic's interrupt source has some active handler, which maybe
> > > > call
> > > > ixgbe_dev_link_update() to set link handler. We should cancel the
> > > > link handler before remove dev to prevent executing the link handler.
> > > > It triggers segfault.
> > > >
> > > > Fixes: 0408f47ba4d6 ("net/ixgbe: fix busy polling while fiber link
> > > > update")
> > > > Cc: stable@dpdk.org
> > > >
> > > > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

> > > > ---
> > > >  drivers/net/ixgbe/ixgbe_ethdev.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > >
> > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > index 975fa47..2470c89 100644
> > > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> > > > @@ -1344,6 +1344,9 @@ struct rte_ixgbe_xstats_name_off {
> > > >  	/* cancel the delay handler before remove dev */
> > > >  	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler,
> > > eth_dev);
> > > >
> > > > +	/* cancel the link handler before remove dev */
> > > > +	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler,
> > > eth_dev);
> > > > +
> > > >  	/* uninitialize PF if max_vfs not zero */
> > > >  	ixgbe_pf_host_uninit(eth_dev);
> > > >
> > > > --
> > > > 1.8.3.1
> > > >


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

end of thread, other threads:[~2019-05-14 14:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-08 12:51 [dpdk-dev] [PATCH] net/ixgbe: fix cancel link handler when port is being removed wangyunjian
2019-05-08 12:51 ` wangyunjian
2019-05-10  3:14 ` Zhao1, Wei
2019-05-10  3:14   ` Zhao1, Wei
2019-05-10 11:37   ` wangyunjian
2019-05-10 11:37     ` wangyunjian
2019-05-13  1:56     ` Zhao1, Wei
2019-05-13  1:56       ` Zhao1, Wei
2019-05-14 14:01       ` Zhang, Qi Z
2019-05-14 14:01         ` Zhang, Qi Z

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).