patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Hyong Youb Kim <hyonkim@cisco.com>
Cc: Dirk-Holger Lenz <dirk.lenz@ng4t.com>,
	John Daley <johndale@cisco.com>, dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/enic: fix crash in secondary process' has been queued to LTS release 18.11.6
Date: Tue,  3 Dec 2019 18:27:08 +0000	[thread overview]
Message-ID: <20191203182714.17297-59-ktraynor@redhat.com> (raw)
In-Reply-To: <20191203182714.17297-1-ktraynor@redhat.com>

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 rebasing
(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/180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324

Thanks.

Kevin.

---
From 180bbf4a7e74d5fcc53787aefa0fbee6d1ecc324 Mon Sep 17 00:00:00 2001
From: Hyong Youb Kim <hyonkim@cisco.com>
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 <dirk.lenz@ng4t.com>
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Tested-by: Dirk-Holger Lenz <dirk.lenz@ng4t.com>
Reviewed-by: John Daley <johndale@cisco.com>
---
 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 {
 	bool overlay_offload;
 	struct rte_eth_dev *rte_dev;
+	struct rte_eth_dev_data *dev_data;
 	struct enic_fdir fdir;
 	char bdf_name[ENICPMD_BDF_LENGTH];
@@ -332,5 +333,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 			uint16_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,
 	__rte_unused int wait_to_complete)
 {
-	struct enic *enic = pmd_priv(eth_dev);
-
 	ENICPMD_FUNC_TRACE();
-	return enic_link_update(enic);
+	return enic_link_update(eth_dev);
 }
 
@@ -1055,4 +1053,5 @@ static int eth_enicpmd_dev_init(struct rte_eth_dev *eth_dev)
 	enic->port_id = eth_dev->data->port_id;
 	enic->rte_dev = eth_dev;
+	enic->dev_data = eth_dev->data;
 
 	pdev = 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,
 }
 
-int enic_link_update(struct enic *enic)
+int enic_link_update(struct rte_eth_dev *eth_dev)
 {
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	struct enic *enic = pmd_priv(eth_dev);
 	struct rte_eth_link link;
 
@@ -439,5 +439,5 @@ enic_intr_handler(void *arg)
 	vnic_intr_return_all_credits(&enic->intr[ENICPMD_LSC_INTR_OFFSET]);
 
-	enic_link_update(enic);
+	enic_link_update(dev);
 	_rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 	enic_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)
 {
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	struct rte_eth_dev_data *data = enic->dev_data;
 	vnic_wq_enable(&enic->wq[queue_idx]);
-	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
+	data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 }
 
 int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
 {
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
+	struct rte_eth_dev_data *data = enic->dev_data;
 	int ret;
 
@@ -746,5 +746,5 @@ int enic_stop_wq(struct enic *enic, uint16_t queue_idx)
 		return ret;
 
-	eth_dev->data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	data->tx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	return 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)
 {
+	struct rte_eth_dev_data *data = enic->dev_data;
 	struct vnic_rq *rq_sop;
 	struct vnic_rq *rq_data;
 	rq_sop = &enic->rq[enic_rte_rq_idx_to_sop_idx(queue_idx)];
 	rq_data = &enic->rq[rq_sop->data_queue_idx];
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
 
 	if (rq_data->in_use) {
@@ -765,11 +765,11 @@ void enic_start_rq(struct enic *enic, uint16_t queue_idx)
 	vnic_rq_enable(rq_sop);
 	enic_initial_post_rx(enic, rq_sop);
-	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
+	data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STARTED;
 }
 
 int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
 {
+	struct rte_eth_dev_data *data = enic->dev_data;
 	int ret1 = 0, ret2 = 0;
-	struct rte_eth_dev *eth_dev = enic->rte_dev;
 	struct vnic_rq *rq_sop;
 	struct vnic_rq *rq_data;
@@ -787,5 +787,5 @@ int enic_stop_rq(struct enic *enic, uint16_t queue_idx)
 		return ret1;
 
-	eth_dev->data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
+	data->rx_queue_state[queue_idx] = RTE_ETH_QUEUE_STATE_STOPPED;
 	return 0;
 }
-- 
2.21.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2019-12-03 17:29:55.166482602 +0000
+++ 0059-net-enic-fix-crash-in-secondary-process.patch	2019-12-03 17:29:51.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_mbuf **tx_pkts,
+@@ -332,5 +333,5 @@ uint16_t enic_prep_pkts(void *tx_queue, struct rte_mbuf **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 @@
- 	/* Let rte_eth_dev_close() release the port resources */
- 	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+ 
+ 	pdev = 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)


  parent reply	other threads:[~2019-12-03 18:29 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 18:26 [dpdk-stable] patch 'ethdev: remove redundant device info cleanup before get' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/sfc: fix missing notification on link status change' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix slave request fd leak' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix link speed update in broadcast mode' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'app/testpmd: fix crash on port reset' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: forbid reallocation when running' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix vring address handling during live migration' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: protect vring access done by application' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/vhost: fix redundant queue state event' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vhost: fix vring memory partially mapped' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/virtio: fix Rx stats with vectorized functions' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/virtio: get all pending Rx packets in vectorized paths' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/mlx5: fix BlueField VF type recognition' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: add prefix to global functions' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix null access when allocating CLIP entry' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix slot allocation for IPv6 flows' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix parsing VLAN ID rewrite action' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix prefetch for non-coalesced Tx packets' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: avoid polling link status before device start' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/ixgbe: fix X553 speed capability' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/i40e: set speed to undefined for default case' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix slave id types' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bonding: fix OOB access in other aggregator modes' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/null: fix multi-process Rx and Tx' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: remove duplicate barrier' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: replace memory barrier for doorbell response' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: enforce IO barrier for doorbell command' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix flow steering' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix accessing variable before null check' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/szedata2: fix dependency " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/bnxt: fix multicast filter programming' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/qede: limit Rx ring index read for debug' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/atlantic: add FW mailbox guard mutex' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'net/cxgbe: fix races on flow API operations' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/sw: fix xstats reset value' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/dpaa2: fix default queue configuration' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'build: avoid overlinking' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'vfio: fix leak with multiprocess' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'service: use log for error messages' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'test/mbuf: fix forged mbuf in clone test' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal/ppc: fix 64-bit atomic exchange operation' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'devtools: fix cleanup of checkpatch temporary file' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'event/dpaa: fix number of supported atomic flows' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'test/lpm: fix measured cycles for delete' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal/linux: restore specific hugepage ordering for ppc' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'eal: remove dead code on NUMA node detection' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'crypto/dpaa_sec: fix auth-cipher check for AEAD' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'cryptodev: fix checks related to device id' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'doc: fix typo in l2fwd-crypto guide' " Kevin Traynor
2019-12-03 18:26 ` [dpdk-stable] patch 'crypto/qat: fix null auth when using VFIO' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'crypto/qat: fix AES CMAC mininum digest size' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'lib/distributor: fix deadlock on aarch64' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/distributor: fix spurious failure' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'bus/pci: remove useless link dependency on ethdev' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/mlx5: validate flow rule item order' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/bonding: fix LSC related cases' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'test/bonding: fix LSC timeout unit' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/enic: fix probe for secondary process' " Kevin Traynor
2019-12-03 18:27 ` Kevin Traynor [this message]
2019-12-03 18:27 ` [dpdk-stable] patch 'net/tap: fix blocked Rx packets' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: return error if setting link up fails' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: remove unnecessary variable assignment' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/qede/base: fix page index for PBL chains' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: fix dereference before null check' " Kevin Traynor
2019-12-03 18:27 ` [dpdk-stable] patch 'net/bnxt: cleanup comments' " Kevin Traynor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203182714.17297-59-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=dirk.lenz@ng4t.com \
    --cc=hyonkim@cisco.com \
    --cc=johndale@cisco.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).