From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2CC52A051C for ; Tue, 11 Feb 2020 12:42:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 22E2C1C05C; Tue, 11 Feb 2020 12:42:19 +0100 (CET) Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) by dpdk.org (Postfix) with ESMTP id 8A23A1C05C for ; Tue, 11 Feb 2020 12:42:17 +0100 (CET) Received: by mail-wr1-f45.google.com with SMTP id w15so11968074wru.4 for ; Tue, 11 Feb 2020 03:42:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VQAXMXVzaL4/VvDBJbBCB2iOBJAsIul8HkLMHGslnPM=; b=cgkuJooRmmFIfrWkaNLYmsmFswceCLAL9ZutNb5EtiBkzlBEPSnRU2MAGb5aejRoU+ mHaH+vl9tPAf7OnLgcjbr/3nJgm0jF86f1bFb3gg/EePYpPnikNAbrfTZHnaK+iaZPfa rX6jo97jceHYt3FWje1kmMH9jVNTaHTnp0SaJ+K2SnfoZhuGbVfmXuN64MtM9aJqUzIU y9FhYGuemH91Akn4o0KXwOqA1sNH/xZBwAyZSd7alSmrGsA3Wl84foBzjq5J7W33iq0A cWnrM+VLUbuxf6o/UTVC39pjvOQBaS7shN2YkSMAocj3Q8zfCEIIgorBoNkivkIXCzyw Ix9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VQAXMXVzaL4/VvDBJbBCB2iOBJAsIul8HkLMHGslnPM=; b=LAVlqaZ/+323sKElEcQ0f84zED/idMvsQGw1ZPh2onynCoZnSRcBxR9xRJBqKAb6YV xJ1c43ncFLng9Jd+jS3WOVxK7tY1GGYrHTCGV6L80FTR0dY0FxZIdtaMQAxCAp2L0olt LZhcNA0+7zu0PQ1zpAF3gUijmMJ2GsddjrIrNuPDTpqEUxLShWAIuyfhy+6w47y+maUk SDaQoTXyvpt5faVml7/YpUayLAP9fDW3Q65ZUmtNlf8hlMpfVpCcKvrIYn0oHcgwiM0V ZCA0aJRs1kSHh6frhrbezp7hDrNheYE2DYE300EnWyntw9FK0xAyeO+xMPpPE3DJOoaC 67mw== X-Gm-Message-State: APjAAAW63RkyTyB0isI3+xMf/gupMeHX7Vq9oOOKZzU0D9Yaknuje2lC VRmVi2NJETl+Q4JDuzj+urg= X-Google-Smtp-Source: APXvYqybWZQscRyBEYdf+JxQimuZSg4Fla5v1ll9eqXK9wUs2Cgcea0U7tLcmkcuNBDjlsUZ2iVVrQ== X-Received: by 2002:a5d:6b03:: with SMTP id v3mr7758190wrw.289.1581421337227; Tue, 11 Feb 2020 03:42:17 -0800 (PST) Received: from localhost ([88.98.246.218]) by smtp.gmail.com with ESMTPSA id y139sm3585018wmd.24.2020.02.11.03.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Feb 2020 03:42:16 -0800 (PST) From: luca.boccassi@gmail.com To: Michael Baum Cc: Viacheslav Ovsiienko , Matan Azrad , dpdk stable Date: Tue, 11 Feb 2020 11:21:59 +0000 Message-Id: <20200211112216.3929-173-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200211112216.3929-1-luca.boccassi@gmail.com> References: <20200211112216.3929-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/mlx5: fix memory regions release deadlock' has been queued to stable release 19.11.1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/13/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Thanks. Luca Boccassi --- >From f6f7ba7a7c7567211b779e7ff2bb816b10c3554b Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Tue, 4 Feb 2020 15:36:09 +0200 Subject: [PATCH] net/mlx5: fix memory regions release deadlock [ upstream commit 4f8e6befe7c6045b082dc5b95afd5a1c00e30bf0 ] The mpx5 PMD maintains the list of devices for those the memory operation callback routines must be invoked to keep the device MRs (MR is the entity backing the hardware DMA transactions) consistent with the mapped memory. Each device context in the list is protected with dedicated lock on per device basis, which might be taken inside the callback routine. When device is closing the PMD frees all MRs by calling mlx5_mr_release(), that might call rte_free() under the taken device lock. If this rte_free call triggers the entire memory segment freeing it, in its turn, invokes the callback routine and attempt to take the lock inside this one causes the deadlock. The patch proposes the remove the device from the callback list first and then call mlx5_mr_release() and free the remaining device MRs explicitly. Fixes: 0e3d0525b2f2 ("net/mlx5: fix memory event callback list") Signed-off-by: Michael Baum Acked-by: Viacheslav Ovsiienko Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c index 50960c91ce..646d50285b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c @@ -673,12 +673,12 @@ mlx5_free_shared_ibctx(struct mlx5_ibv_shared *sh) assert(rte_eal_process_type() == RTE_PROC_PRIMARY); if (--sh->refcnt) goto exit; - /* Release created Memory Regions. */ - mlx5_mr_release(sh); /* Remove from memory callback device list. */ rte_rwlock_write_lock(&mlx5_shared_data->mem_event_rwlock); LIST_REMOVE(sh, mem_event_cb); rte_rwlock_write_unlock(&mlx5_shared_data->mem_event_rwlock); + /* Release created Memory Regions. */ + mlx5_mr_release(sh); /* Remove context from the global device list. */ LIST_REMOVE(sh, next); /* -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-02-11 11:17:44.595538811 +0000 +++ 0173-net-mlx5-fix-memory-regions-release-deadlock.patch 2020-02-11 11:17:38.812009050 +0000 @@ -1,8 +1,10 @@ -From 4f8e6befe7c6045b082dc5b95afd5a1c00e30bf0 Mon Sep 17 00:00:00 2001 +From f6f7ba7a7c7567211b779e7ff2bb816b10c3554b Mon Sep 17 00:00:00 2001 From: Michael Baum Date: Tue, 4 Feb 2020 15:36:09 +0200 Subject: [PATCH] net/mlx5: fix memory regions release deadlock +[ upstream commit 4f8e6befe7c6045b082dc5b95afd5a1c00e30bf0 ] + The mpx5 PMD maintains the list of devices for those the memory operation callback routines must be invoked to keep the device MRs (MR is the entity backing the hardware DMA transactions) consistent with the @@ -21,7 +23,6 @@ explicitly. Fixes: 0e3d0525b2f2 ("net/mlx5: fix memory event callback list") -Cc: stable@dpdk.org Signed-off-by: Michael Baum Acked-by: Viacheslav Ovsiienko @@ -31,11 +32,11 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c -index 7a79722fb7..b4ec6cba1a 100644 +index 50960c91ce..646d50285b 100644 --- a/drivers/net/mlx5/mlx5.c +++ b/drivers/net/mlx5/mlx5.c -@@ -679,12 +679,12 @@ mlx5_free_shared_ibctx(struct mlx5_ibv_shared *sh) - MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY); +@@ -673,12 +673,12 @@ mlx5_free_shared_ibctx(struct mlx5_ibv_shared *sh) + assert(rte_eal_process_type() == RTE_PROC_PRIMARY); if (--sh->refcnt) goto exit; - /* Release created Memory Regions. */