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 9DB97A04B5 for ; Tue, 3 Dec 2019 19:29:18 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9085037AF; Tue, 3 Dec 2019 19:29:18 +0100 (CET) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id D59B11BFC8 for ; Tue, 3 Dec 2019 19:29:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575397756; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C+EEy5uPEIKzFcIUtyG1PPVxUNbnVbFSITwwRtSpJLs=; b=IyVto9oOThGEhhxBQan/EGzD00qSOzxsbAxBaM3yYqD288ZhdLK63360qav091zBiJ9ZGu MrsxkqUxzfEdLVbCaPvw2j4BcbeE0e6Dr0+zCFIgDR5yGxo5IB9HSRJqhNfBDqTXt7nlS+ neURUSP/GctGlbkb2MbK+RPLN0Wi+JE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-54-dLvOfsRxPwmsMbz-6-RnzA-1; Tue, 03 Dec 2019 13:29:15 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23ADC107ACC5; Tue, 3 Dec 2019 18:29:14 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-10.ams2.redhat.com [10.36.117.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id F1BBB5C3FA; Tue, 3 Dec 2019 18:29:12 +0000 (UTC) From: Kevin Traynor To: Hyong Youb Kim Cc: Dirk-Holger Lenz , John Daley , dpdk stable Date: Tue, 3 Dec 2019 18:27:08 +0000 Message-Id: <20191203182714.17297-59-ktraynor@redhat.com> In-Reply-To: <20191203182714.17297-1-ktraynor@redhat.com> References: <20191203182714.17297-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-MC-Unique: dLvOfsRxPwmsMbz-6-RnzA-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-stable] patch 'net/enic: fix crash in secondary process' has been queued to LTS release 18.11.6 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 LTS release 18.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 12/10/19. 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 rebasi= ng (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/180bbf4a7e74d5fcc5= 3787aefa0fbee6d1ecc324 Thanks. Kevin. --- >From 180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324 Mon Sep 17 00:00:00 2001 From: Hyong Youb Kim Date: Thu, 5 Sep 2019 23:50:20 -0700 Subject: [PATCH] net/enic: fix crash in secondary process [ upstream commit c655c547f92d1cf4bfd525a690660f5b399bdceb ] Both primary and secondary processes may call the queue start/stop, link update handlers. These functions use the rte_eth_dev pointer cached in the adapter private data (struct enic). But, this pointer is valid only in the primary process, as rte_eth_dev addresses may differ in different processes. Using that cached pointer in secondary processes leads to a crash. For the link update handler (enic_link_update), use the rte_eth_dev pointer passed down from the rte layer as it is valid in the current process. For the queue start/stop handlers (enic_start_wq and friends), cache the rte_eth_dev_data pointer in the adapter private data, and use that. rte_eth_dev_data is in shared memory and its address is same across processes. Fixes: 837e68ae94a2 ("net/enic: fix queue stop and start") Fixes: cf8d9826b7be ("net/enic: extract code for checking link status") Reported-by: Dirk-Holger Lenz Signed-off-by: Hyong Youb Kim Tested-by: Dirk-Holger Lenz Reviewed-by: John Daley --- drivers/net/enic/enic.h | 3 ++- drivers/net/enic/enic_ethdev.c | 5 ++--- drivers/net/enic/enic_main.c | 22 +++++++++++----------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/net/enic/enic.h b/drivers/net/enic/enic.h index 00a208728..fc34d1012 100644 --- a/drivers/net/enic/enic.h +++ b/drivers/net/enic/enic.h @@ -113,4 +113,5 @@ struct enic { =09bool overlay_offload; =09struct rte_eth_dev *rte_dev; +=09struct rte_eth_dev_data *dev_data; =09struct enic_fdir fdir; =09char bdf_name[ENICPMD_BDF_LENGTH]; @@ -332,5 +333,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf= **tx_pkts, =09=09=09uint16_t nb_pkts); int enic_set_mtu(struct enic *enic, uint16_t new_mtu); -int enic_link_update(struct enic *enic); +int enic_link_update(struct rte_eth_dev *eth_dev); bool enic_use_vector_rx_handler(struct rte_eth_dev *eth_dev); void enic_pick_rx_handler(struct rte_eth_dev *eth_dev); diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.= c index 67a96a483..ed6dd70c8 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -433,8 +433,6 @@ static int enicpmd_dev_link_update(struct rte_eth_dev *= eth_dev, =09__rte_unused int wait_to_complete) { -=09struct enic *enic =3D pmd_priv(eth_dev); - =09ENICPMD_FUNC_TRACE(); -=09return enic_link_update(enic); +=09return enic_link_update(eth_dev); } =20 @@ -1055,4 +1053,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *e= th_dev) =09enic->port_id =3D eth_dev->data->port_id; =09enic->rte_dev =3D eth_dev; +=09enic->dev_data =3D eth_dev->data; =20 =09pdev =3D RTE_ETH_DEV_TO_PCI(eth_dev); diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index a6c838bc2..c3dc3dee1 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -418,7 +418,7 @@ enic_free_consistent(void *priv, } =20 -int enic_link_update(struct enic *enic) +int enic_link_update(struct rte_eth_dev *eth_dev) { -=09struct rte_eth_dev *eth_dev =3D enic->rte_dev; +=09struct enic *enic =3D pmd_priv(eth_dev); =09struct rte_eth_link link; =20 @@ -439,5 +439,5 @@ enic_intr_handler(void *arg) =09vnic_intr_return_all_credits(&enic->intr[ENICPMD_LSC_INTR_OFFSET]); =20 -=09enic_link_update(enic); +=09enic_link_update(dev); =09_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); =09enic_log_q_error(enic); @@ -732,12 +732,12 @@ void enic_free_rq(void *rxq) void enic_start_wq(struct enic *enic, uint16_t queue_idx) { -=09struct rte_eth_dev *eth_dev =3D enic->rte_dev; +=09struct rte_eth_dev_data *data =3D enic->dev_data; =09vnic_wq_enable(&enic->wq[queue_idx]); -=09eth_dev->data->tx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STARTE= D; +=09data->tx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STARTED; } =20 int enic_stop_wq(struct enic *enic, uint16_t queue_idx) { -=09struct rte_eth_dev *eth_dev =3D enic->rte_dev; +=09struct rte_eth_dev_data *data =3D enic->dev_data; =09int ret; =20 @@ -746,5 +746,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx) =09=09return ret; =20 -=09eth_dev->data->tx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STOPPE= D; +=09data->tx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STOPPED; =09return 0; } @@ -752,9 +752,9 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx) void enic_start_rq(struct enic *enic, uint16_t queue_idx) { +=09struct rte_eth_dev_data *data =3D enic->dev_data; =09struct vnic_rq *rq_sop; =09struct vnic_rq *rq_data; =09rq_sop =3D &enic->rq[enic_rte_rq_idx_to_sop_idx(queue_idx)]; =09rq_data =3D &enic->rq[rq_sop->data_queue_idx]; -=09struct rte_eth_dev *eth_dev =3D enic->rte_dev; =20 =09if (rq_data->in_use) { @@ -765,11 +765,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue_= idx) =09vnic_rq_enable(rq_sop); =09enic_initial_post_rx(enic, rq_sop); -=09eth_dev->data->rx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STARTE= D; +=09data->rx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STARTED; } =20 int enic_stop_rq(struct enic *enic, uint16_t queue_idx) { +=09struct rte_eth_dev_data *data =3D enic->dev_data; =09int ret1 =3D 0, ret2 =3D 0; -=09struct rte_eth_dev *eth_dev =3D enic->rte_dev; =09struct vnic_rq *rq_sop; =09struct vnic_rq *rq_data; @@ -787,5 +787,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx) =09=09return ret1; =20 -=09eth_dev->data->rx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STOPPE= D; +=09data->rx_queue_state[queue_idx] =3D RTE_ETH_QUEUE_STATE_STOPPED; =09return 0; } --=20 2.21.0 --- Diff of the applied patch vs upstream commit (please double-check if non-= empty: --- --- -=092019-12-03 17:29:55.166482602 +0000 +++ 0059-net-enic-fix-crash-in-secondary-process.patch=092019-12-03 17:29:5= 1.791749099 +0000 @@ -1 +1 @@ -From c655c547f92d1cf4bfd525a690660f5b399bdceb Mon Sep 17 00:00:00 2001 +From 180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit c655c547f92d1cf4bfd525a690660f5b399bdceb ] + @@ -22 +23,0 @@ -Cc: stable@dpdk.org @@ -35 +36 @@ -index 681109ba9..fac8d57fa 100644 +index 00a208728..fc34d1012 100644 @@ -44 +45 @@ -@@ -336,5 +337,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbu= f **tx_pkts, +@@ -332,5 +333,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbu= f **tx_pkts, @@ -52 +53 @@ -index fe18cf3a9..562401ae7 100644 +index 67a96a483..ed6dd70c8 100644 @@ -55 +56 @@ -@@ -461,8 +461,6 @@ static int enicpmd_dev_link_update(struct rte_eth_dev = *eth_dev, +@@ -433,8 +433,6 @@ static int enicpmd_dev_link_update(struct rte_eth_dev = *eth_dev, @@ -65 +66 @@ -@@ -1240,4 +1238,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *= eth_dev) +@@ -1055,4 +1053,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *= eth_dev) @@ -69,2 +70,2 @@ - =09/* Let rte_eth_dev_close() release the port resources */ - =09eth_dev->data->dev_flags |=3D RTE_ETH_DEV_CLOSE_REMOVE; +=20 + =09pdev =3D RTE_ETH_DEV_TO_PCI(eth_dev); @@ -72 +73 @@ -index 30c7b1c86..ce89b8154 100644 +index a6c838bc2..c3dc3dee1 100644 @@ -75 +76 @@ -@@ -425,7 +425,7 @@ enic_free_consistent(void *priv, +@@ -418,7 +418,7 @@ enic_free_consistent(void *priv, @@ -85 +86 @@ -@@ -446,5 +446,5 @@ enic_intr_handler(void *arg) +@@ -439,5 +439,5 @@ enic_intr_handler(void *arg) @@ -92 +93 @@ -@@ -739,12 +739,12 @@ void enic_free_rq(void *rxq) +@@ -732,12 +732,12 @@ void enic_free_rq(void *rxq) @@ -108 +109 @@ -@@ -753,5 +753,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx= ) +@@ -746,5 +746,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx= ) @@ -115 +116 @@ -@@ -759,9 +759,9 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx= ) +@@ -752,9 +752,9 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx= ) @@ -126 +127 @@ -@@ -772,11 +772,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue= _idx) +@@ -765,11 +765,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue= _idx) @@ -140 +141 @@ -@@ -794,5 +794,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx= ) +@@ -787,5 +787,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx= )