]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ibmvnic: delay complete()
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Fri, 29 Oct 2021 22:03:16 +0000 (15:03 -0700)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 7 Dec 2021 06:33:12 +0000 (07:33 +0100)
BugLink: https://bugs.launchpad.net/bugs/1951822
[ Upstream commit 6b278c0cb378079f3c0c61ae4a369c09ff1a4188 ]

If we get CRQ_INIT, we set errno to -EIO and first call complete() to
notify the waiter. Then we try to schedule a FAILOVER reset. If this
occurs while adapter is in PROBING state, ibmvnic_reset() changes the
error code to EAGAIN and returns without scheduling the FAILOVER. The
purpose of setting error code to EAGAIN is to ask the waiter to retry.

But due to the earlier complete() call, the waiter may already have seen
the -EIO response and decided not to retry. This can cause intermittent
failures when bringing up ibmvnic adapters during boot, specially in
in kexec/kdump kernels.

Defer the complete() call until after scheduling the reset.

Also streamline the error code to EAGAIN. Don't see why we need EIO
sometimes. All 3 callers of ibmvnic_reset_init() can handle EAGAIN.

Fixes: 17c8705838a5 ("ibmvnic: Return error code if init interrupted by transport event")
Reported-by: Vaishnavi Bhat <vaish123@in.ibm.com>
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Reviewed-by: Dany Madden <drt@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/net/ethernet/ibm/ibmvnic.c

index 84961a83803b70625c71b6659a8c91e94e00f04c..352ffe982d849b2bef82968d8c34fee390235274 100644 (file)
@@ -2565,7 +2565,7 @@ static int ibmvnic_reset(struct ibmvnic_adapter *adapter,
 
        if (adapter->state == VNIC_PROBING) {
                netdev_warn(netdev, "Adapter reset during probe\n");
-               adapter->init_done_rc = EAGAIN;
+               adapter->init_done_rc = -EAGAIN;
                ret = EAGAIN;
                goto err;
        }
@@ -5067,11 +5067,6 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                         */
                        adapter->login_pending = false;
 
-                       if (!completion_done(&adapter->init_done)) {
-                               complete(&adapter->init_done);
-                               adapter->init_done_rc = -EIO;
-                       }
-
                        if (adapter->state == VNIC_DOWN)
                                rc = ibmvnic_reset(adapter, VNIC_RESET_PASSIVE_INIT);
                        else
@@ -5092,6 +5087,13 @@ static void ibmvnic_handle_crq(union ibmvnic_crq *crq,
                                           rc);
                                adapter->failover_pending = false;
                        }
+
+                       if (!completion_done(&adapter->init_done)) {
+                               complete(&adapter->init_done);
+                               if (!adapter->init_done_rc)
+                                       adapter->init_done_rc = -EAGAIN;
+                       }
+
                        break;
                case IBMVNIC_CRQ_INIT_COMPLETE:
                        dev_info(dev, "Partner initialization complete\n");
@@ -5559,7 +5561,7 @@ static int ibmvnic_probe(struct vio_dev *dev, const struct vio_device_id *id)
                }
 
                rc = ibmvnic_reset_init(adapter, false);
-       } while (rc == EAGAIN);
+       } while (rc == -EAGAIN);
 
        /* We are ignoring the error from ibmvnic_reset_init() assuming that the
         * partner is not ready. CRQ is not active. When the partner becomes