diff mbox series

[net] i40e: fix endless loop under rtnl

Message ID 4d94f7fbd9dd6476c5adc8967f3db84bc9204f47.1630319620.git.jbenc@redhat.com
State New
Headers show
Series [net] i40e: fix endless loop under rtnl | expand

Commit Message

Jiri Benc Aug. 30, 2021, 10:34 a.m. UTC
The loop in i40e_get_capabilities can never end. The problem is that
although i40e_aq_discover_capabilities returns with an error if there's
a firmware problem, the returned error is not checked. There is a check for
pf->hw.aq.asq_last_status but that value is set to I40E_AQ_RC_OK on most
firmware problems.

When i40e_aq_discover_capabilities encounters a firmware problem, it will
enocunter the same problem on its next invocation. As the result, the loop
becomes endless. We hit this with I40E_ERR_ADMIN_QUEUE_TIMEOUT but looking
at the code, it can happen with a range of other firmware errors.

I don't know what the correct behavior should be: whether the firmware
should be retried a few times, or whether pf->hw.aq.asq_last_status should
be always set to the encountered firmware error (but then it would be
pointless and can be just replaced by the i40e_aq_discover_capabilities
return value). However, the current behavior with an endless loop under the
rtnl mutex(!) is unacceptable and Intel has not submitted a fix, although we
explained the bug to them 7 months ago.

This may not be the best possible fix but it's better than hanging the whole
system on a firmware bug.

Tested-by: Stefan Assmann <sassmann@redhat.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jesse Brandeburg Sept. 14, 2021, 11:37 p.m. UTC | #1
+intel-wired-lan list

On 8/30/2021 3:34 AM, Jiri Benc wrote:
> The loop in i40e_get_capabilities can never end. The problem is that

> although i40e_aq_discover_capabilities returns with an error if there's

> a firmware problem, the returned error is not checked. There is a check for

> pf->hw.aq.asq_last_status but that value is set to I40E_AQ_RC_OK on most

> firmware problems.

> 

> When i40e_aq_discover_capabilities encounters a firmware problem, it will

> enocunter the same problem on its next invocation. As the result, the loop

encounter

> becomes endless. We hit this with I40E_ERR_ADMIN_QUEUE_TIMEOUT but looking

> at the code, it can happen with a range of other firmware errors.

> 

> I don't know what the correct behavior should be: whether the firmware

> should be retried a few times, or whether pf->hw.aq.asq_last_status should

> be always set to the encountered firmware error (but then it would be

> pointless and can be just replaced by the i40e_aq_discover_capabilities

> return value).


If the firmware doesn't reply we have a lot of problems.

> However, the current behavior with an endless loop under the

> rtnl mutex(!) is unacceptable and Intel has not submitted a fix, although we

> explained the bug to them 7 months ago.


That's really frustrating, sorry! We are actively working to do better
by working with you more closely. This one must have slipped through the
cracks.


> This may not be the best possible fix but it's better than hanging the whole

> system on a firmware bug.

> 


The fix seems fine to me on initial review.
you can add my
Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>


but...
Missing Fixes: tag?

> Tested-by: Stefan Assmann <sassmann@redhat.com>

> Signed-off-by: Jiri Benc <jbenc@redhat.com>

> ---

>  drivers/net/ethernet/intel/i40e/i40e_main.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c

> index 1d1f52756a93..772dd05a0ae8 100644

> --- a/drivers/net/ethernet/intel/i40e/i40e_main.c

> +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c

> @@ -10110,7 +10110,7 @@ static int i40e_get_capabilities(struct i40e_pf *pf,

>  		if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) {

>  			/* retry with a larger buffer */

>  			buf_len = data_size;

> -		} else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) {

> +		} else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) {

>  			dev_info(&pf->pdev->dev,

>  				 "capability discovery failed, err %s aq_err %s\n",

>  				 i40e_stat_str(&pf->hw, err),

>
Jiri Benc Sept. 15, 2021, 6:40 a.m. UTC | #2
On Tue, 14 Sep 2021 16:37:55 -0700, Jesse Brandeburg wrote:
> The fix seems fine to me on initial review.

> you can add my

> Reviewed-by: Jesse Brandeburg <jesse.brandeburg@intel.com>


Thanks!

> but...

> Missing Fixes: tag?


I should have added that, yes. I sent a v2 yesterday with the tag
included,

https://patchwork.kernel.org/project/netdevbpf/patch/452ff4ddfef7fc8f558a8c8eb7a8050688760e11.1631609537.git.jbenc@redhat.com/

Could you reply with your Reviewed-by to that one? Alternatively, I can
send a v3.

Thanks,

 Jiri
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 1d1f52756a93..772dd05a0ae8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -10110,7 +10110,7 @@  static int i40e_get_capabilities(struct i40e_pf *pf,
 		if (pf->hw.aq.asq_last_status == I40E_AQ_RC_ENOMEM) {
 			/* retry with a larger buffer */
 			buf_len = data_size;
-		} else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK) {
+		} else if (pf->hw.aq.asq_last_status != I40E_AQ_RC_OK || err) {
 			dev_info(&pf->pdev->dev,
 				 "capability discovery failed, err %s aq_err %s\n",
 				 i40e_stat_str(&pf->hw, err),