diff mbox series

[1/1] ibmvnic: Clear failover_pending if unable to schedule

Message ID 20210203050802.680772-1-sukadev@linux.ibm.com (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [1/1] ibmvnic: Clear failover_pending if unable to schedule | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 6 maintainers not CCed: benh@kernel.crashing.org mpe@ellerman.id.au paulus@samba.org linuxppc-dev@lists.ozlabs.org davem@davemloft.net kuba@kernel.org
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 3 this patch: 3
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 24 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Sukadev Bhattiprolu Feb. 3, 2021, 5:08 a.m. UTC
Normally we clear the failover_pending flag when processing the reset.
But if we are unable to schedule a failover reset we must clear the
flag ourselves. We could fail to schedule the reset if we are in PROBING
state (eg: when booting via kexec) or because we could not allocate memory.

Thanks to Cris Forno for helping isolate the problem and for testing.

Fixes: 1d8504937478 ("powerpc/vnic: Extend "failover pending" window")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Tested-by: Cristobal Forno <cforno12@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Feb. 6, 2021, 6:36 p.m. UTC | #1
On Tue,  2 Feb 2021 21:08:02 -0800 Sukadev Bhattiprolu wrote:
> Normally we clear the failover_pending flag when processing the reset.
> But if we are unable to schedule a failover reset we must clear the
> flag ourselves. We could fail to schedule the reset if we are in PROBING
> state (eg: when booting via kexec) or because we could not allocate memory.
> 
> Thanks to Cris Forno for helping isolate the problem and for testing.
> 
> Fixes: 1d8504937478 ("powerpc/vnic: Extend "failover pending" window")
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
> Tested-by: Cristobal Forno <cforno12@linux.ibm.com>

Applied, thanks.

> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
> index df1b4884b4e8..58108e1a1d2e 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -4907,7 +4907,23 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
>  				complete(&adapter->init_done);
>  				adapter->init_done_rc = -EIO;
>  			}
> -			ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
> +			rc = ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
> +			if (rc && rc != -EBUSY) {
> +				/**

I fixed this comment up for you - /** (double star) is reserved for
kdoc comments, normal comments should start with /*. And in networking
the first line of the multi-line comment is not empty.

> +				 * We were unable to schedule the failover
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index df1b4884b4e8..58108e1a1d2e 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -4907,7 +4907,23 @@  static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
 				complete(&adapter->init_done);
 				adapter->init_done_rc = -EIO;
 			}
-			ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
+			rc = ibmvnic_reset(adapter, VNIC_RESET_FAILOVER);
+			if (rc && rc != -EBUSY) {
+				/**
+				 * We were unable to schedule the failover
+				 * reset either because the adapter was still
+				 * probing (eg: during kexec) or we could not
+				 * allocate memory. Clear the failover_pending
+				 * flag since no one else will. We ignore
+				 * EBUSY because it means either FAILOVER reset
+				 * is already scheduled or the adapter is
+				 * being removed.
+				 */
+				netdev_err(netdev,
+					   "Error %ld scheduling failover reset\n",
+					   rc);
+				adapter->failover_pending = false;
+			}
 			break;
 		case IBMVNIC_CRQ_INIT_COMPLETE:
 			dev_info(dev, "Partner initialization complete\n");