lkml.org 
[lkml]   [2021]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH rdma-next 4/9] RDMA/mlx5: Cancel pkey work before destroying device resources
    Date
    From: Leon Romanovsky <leonro@nvidia.com>

    In the driver release flow, we are ensuring that notifier is disabled
    and no new works can be added to pkey_change_handler. It means that
    we can cancel that handler before destroying resources to make sure
    that our unwind routine is symmetrical to the allocation one.

    Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
    ---
    drivers/infiniband/hw/mlx5/main.c | 13 +++++++++----
    1 file changed, 9 insertions(+), 4 deletions(-)

    diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
    index 9b8dd7a604c9..75d5de14f80b 100644
    --- a/drivers/infiniband/hw/mlx5/main.c
    +++ b/drivers/infiniband/hw/mlx5/main.c
    @@ -2908,6 +2908,15 @@ static void mlx5_ib_dev_res_cleanup(struct mlx5_ib_dev *dev)
    struct mlx5_ib_resources *devr = &dev->devr;
    int port;

    + /*
    + * Make sure no change P_Key work items are still executing.
    + *
    + * At this stage, the mlx5_ib_event should be unregistered
    + * and it ensures that no new works are added.
    + */
    + for (port = 0; port < ARRAY_SIZE(devr->ports); ++port)
    + cancel_work_sync(&devr->ports[port].pkey_change_work);
    +
    mlx5_ib_destroy_srq(devr->s1, NULL);
    kfree(devr->s1);
    mlx5_ib_destroy_srq(devr->s0, NULL);
    @@ -2918,10 +2927,6 @@ static void mlx5_ib_dev_res_cleanup(struct mlx5_ib_dev *dev)
    kfree(devr->c0);
    mlx5_ib_dealloc_pd(devr->p0, NULL);
    kfree(devr->p0);
    -
    - /* Make sure no change P_Key work items are still executing */
    - for (port = 0; port < ARRAY_SIZE(devr->ports); ++port)
    - cancel_work_sync(&devr->ports[port].pkey_change_work);
    }

    static u32 get_core_cap_flags(struct ib_device *ibdev,
    --
    2.31.1
    \
     
     \ /
      Last update: 2021-07-18 14:01    [W:4.894 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site