From: Thomas Monjalon <thomas.monjalon@6wind.com>
To: wenzhuo.lu@intel.com
Cc: dev@dpdk.org, Tim Shearer <tim.shearer@overturenetworks.com>
Subject: Re: [dpdk-dev] [PATCH] librte: Link status interrupt race condition, IGB E1000
Date: Sun, 25 Oct 2015 23:55:43 +0100 [thread overview]
Message-ID: <6060754.bW1Xky3pZ1@xps13> (raw)
In-Reply-To: <33526A3108217C45B7DAFFA5277E4B67485277B3@mbx024-e1-nj-2.exch024.domain.local>
Wenzhuo,
Please could you have a look?
Thanks
2015-09-24 20:44, Tim Shearer:
> I encountered an issue with DPDK 2.1.0 which occasionally causes the link status interrupt callback not to be called after the interface is started for the first time. I traced the problem back to the function eth_igb_link_update(), which is used to determine if the link has changed state since the previous time it was called. It appears that this function can be called simultaneously from two different threads:
>
> (1) From the main application/configuration thread, via rte_eth_dev_start() - pointed to by (*dev->dev_ops->link_update)
> (2) From the eal interrupt thread, via eth_igb_interrupt_action(), to check if the link state has transitioned up or down. The user callback is only executed if the link has changed state.
>
> The race condition manifests itself as follows:
> - Main thread configures the interface with link status interrupt (LSI) enabled, sets up the queues etc.
> - Main thread calls rte_eth_dev_start. The interface is started and then we call eth_igb_link_update()
> - While in this call, the link goes up. Accordingly, we detect the transition, and write the new link state (up) into the global rte_eth_dev struct
> - The interrupt fires, which also drops into the eth_igb_link_update function, finds that the global link status has already been set to up (no change)
> - Therefore, the handler thinks the interrupt was spurious, and the callback doesn't get called.
>
> I suspect that rte_eth_dev_start shouldn't be checking the link state if interrupts are enabled. Would someone mind taking a quick look at the patch below?
>
> Thanks!
> Tim
>
> --- a/lib/librte_ether/rte_ethdev.c
> +++ b/lib/librte_ether/rte_ethdev.c
> @@ -1300,7 +1300,7 @@ rte_eth_dev_start(uint8_t port_id)
>
> rte_eth_dev_config_restore(port_id);
>
> - if (dev->data->dev_conf.intr_conf.lsc != 0) {
> + if (dev->data->dev_conf.intr_conf.lsc == 0) {
> FUNC_PTR_OR_ERR_RET(*dev->dev_ops->link_update, -ENOTSUP);
> (*dev->dev_ops->link_update)(dev, 0);
> }
>
>
next prev parent reply other threads:[~2015-10-25 22:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-24 20:44 Tim Shearer
2015-10-25 22:55 ` Thomas Monjalon [this message]
2015-10-26 5:25 ` Lu, Wenzhuo
2015-10-27 17:45 ` Thomas Monjalon
2015-10-27 21:38 ` [dpdk-dev] [PATCH] lib/librte_ether: Prevent link status race condition when LSI enabled Tim Shearer
2015-11-04 22:13 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6060754.bW1Xky3pZ1@xps13 \
--to=thomas.monjalon@6wind.com \
--cc=dev@dpdk.org \
--cc=tim.shearer@overturenetworks.com \
--cc=wenzhuo.lu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).