From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emea01-am1-obe.outbound.protection.outlook.com (mail-am1on0061.outbound.protection.outlook.com [157.56.112.61]) by dpdk.org (Postfix) with ESMTP id 80FDEC2FA for ; Fri, 8 Jan 2016 08:49:50 +0100 (CET) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=zlu@ezchip.com; Received: from zhigangTHINK (58.135.92.20) by DB5PR02MB1143.eurprd02.prod.outlook.com (10.162.163.13) with Microsoft SMTP Server (TLS) id 15.1.361.13; Fri, 8 Jan 2016 07:49:46 +0000 From: Tony Lu To: 'Liming Sun' , References: <1450813790-11874-1-git-send-email-lsun@ezchip.com> <1450813790-11874-3-git-send-email-lsun@ezchip.com> In-Reply-To: <1450813790-11874-3-git-send-email-lsun@ezchip.com> Date: Fri, 8 Jan 2016 15:49:28 +0800 Message-ID: <004b01d149e9$27c3dc50$774b94f0$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AdE88g98kHNl3l5cTGSjAiu87zx0IQM9wARA Content-Language: zh-cn X-Originating-IP: [58.135.92.20] X-ClientProxiedBy: PS1PR06CA0001.apcprd06.prod.outlook.com (25.169.59.139) To DB5PR02MB1143.eurprd02.prod.outlook.com (25.162.163.13) X-Microsoft-Exchange-Diagnostics: 1; DB5PR02MB1143; 2:MVLON+wAs3XRLgcK8UAgK4edqn3VT5tLQLIsIbGMsNHBWKw3YiUgpf6hdJS6/VGACmnXGN5+yA1IjsU6NAZ350CWOav6zreFhUTj/6lOszAwqVj43hiVT6+lgIHy5uH3UL5WcWEF86stzSZSaaekZA==; 3:R656ZPHdsnIe+pKHGYTWvvyAnAQvujHrKfcanTu0wTqPdNZy4Va/Wa3deG3rqzprJZ/dWbdOuxhgym0ZoEU4W82rxm+H0fbKWcUi1R5ndS2ChSsLcxpIXv5MK7M6zWwr; 25:/QSD6RLm+lKtAcOFUZG0+8IRoAXDFT9VuKDNGRbfSDsyZXy0ucrgeX6UsxU2t9NID88LvfGrSYy1kJQxssl4O6gFB7lZcFp324ToUBI+ewWbjlZF+T0yU3xLRKKM40rLCYLbm3uBnR2UPhWi9rsr2Pi49LGWXc77jXy82XdznRswLbS8mha/KXkLV623K/q8lwHNIoUBhQV2OzFQXujyyx0ZUO7E0WHp7SdzyqTln0NWFRAb0KFKReIqYkFv4Wlk; 20:c6YDauUS9t+5dmQV2h9DPewkrnr7Ar0fMP3D0eLnBhDFVcY4UdsOv3hCQWy0BQan5IGGUa0+A0qMORRJvE2vjwAfMDDQiWxd437LYFrK0L4AKTJ3NXYxxv9UT8ay6c9m3NfoQ3xbNOFqBtm8hB/30x8LcNC2lRj1sz86KuqZk8w= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR02MB1143; X-MS-Office365-Filtering-Correlation-Id: e6a1a3b1-0d73-4b30-b5a6-08d318004896 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(520078)(5005006)(3002001)(10201501046); SRVR:DB5PR02MB1143; BCL:0; PCL:0; RULEID:; SRVR:DB5PR02MB1143; X-Microsoft-Exchange-Diagnostics: 1; DB5PR02MB1143; 4:JaPDWORtRTThlMJOob6ST1yWu0/vXiSvuXXhOtfakICexdfofC/LxA0yR4QKo0LktiSdBri2SFSQtVLr+yUnAa7uuirAm7vRL0K34oiYSAt4quIm9nIJnRNQ1OoOC+yfOYyzvSGaLon+z+R2LJvU/9jGJLgieR9jhR3+iKr8dj0gWvNtLXwlMHrgf6hRWGSmm7MnnD5KVil/Bn8HrlsSE2oK90EtMEu1GcLAscNLsPzGua2EMCOKCj0/bO+j/YiEOj0i5LxeafC339iEy42/ZtFNy5VO80b4eIw2BKcdRNHIvT13byS0fyUEtJBaMdmkReBWDJBcmc5kBWn9KWA/xZFNoYfdzo0x3XyMFQajO75+qbnvXYFwfsfoBJ8MAAXOteC70aTmzfro26ci3JdJkigjI82s6KEw28woFrdVXwvTJGn5/OjOJFD2gVmOnEeJ X-Forefront-PRVS: 0815F8251E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(13464003)(377454003)(199003)(189002)(47776003)(122386002)(50226001)(96836002)(84116002)(86362001)(77096005)(107886002)(106356001)(40100003)(50986999)(2906002)(59696002)(33716001)(66066001)(105586002)(14726001)(76176999)(19580405001)(586003)(5008740100001)(19580395003)(6116002)(33646002)(102836003)(61296003)(23726003)(5001960100002)(450100001)(97736004)(189998001)(50466002)(3846002)(81156007)(46406003)(2950100001)(101416001)(97756001)(5001770100001)(5004730100002)(1096002)(42186005)(230700001)(1420700001)(87976001)(92566002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR02MB1143; H:zhigangTHINK; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ezchip.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB5PR02MB1143; 23:/673ZuCxkRE9fY8JsSP5sTml973FZwibxDeeUY1Y4?= =?us-ascii?Q?u/7p6aGj+6daZfMW0FmuWicp3Fj5SAS6d38Nyr5ETdGhfnn9D7uiXR0Fm+e6?= =?us-ascii?Q?Vh3SzqVjpaAxmTXWa5qI8qRPZ04HixLGD+sEG9p4+3IjVi6O9fOvQeFItAJE?= =?us-ascii?Q?alKF/Mlhc04b0GeoXzPl2Skv/kRdnqUMOC604lQu0OeYVIz6TAtX34/QWrZz?= =?us-ascii?Q?7lXY6qB9iWlBT8+MLyktGbbvqb5wys3K1GxERyuyd5nhcyUEihlvA+HuWbs+?= =?us-ascii?Q?yBzJq+TAg2fapRuXIHMoUrC9UwcNIb1GlMmWg2f+6KqhAyfzRVaAc0NppJ1w?= =?us-ascii?Q?OyHo+GzE2vM2aNbuKeALiYAmsMhbWVUOav1MsVvG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R14DBFXFvh/3xDffnP4sBmQdqPDqvZWOD4nEhPtv8YmwgsibHn8?= =?us-ascii?Q?BVCmj7OZbrBSQnT1l41HKo=3D?= X-Microsoft-Exchange-Diagnostics: 1; DB5PR02MB1143; 5:duM98N2cnHE4OOMSsFTC0VQPpPUIJxIduz44j2XuHA+0yQKLYB76OMcxQeSNrQdItzfZnLFF3ZMF9BQA5jpbEkoNUx0JOZQlJ35+vvz7wGgn6ExF5Ir/TZkUk1xVCtapZ7UYgSbePUyIm2zLMKbQmg==; 24:reDG5Jhr8yRP1dbV+LZhVniedRLNIj5WSEbBKn8s+ePm5FhzgdeDruvd97SzuPUeB3Qn/ZME8/y+dm9jBeEjxuqDRAHjKstzGmKMawNeBT8= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2016 07:49:46.8930 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR02MB1143 Subject: Re: [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when testpmd quits X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2016 07:49:50 -0000 >-----Original Message----- >From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liming Sun >Sent: Wednesday, December 23, 2015 3:50 AM >To: dev@dpdk.org >Subject: [dpdk-dev] [PATCH 2/2] driver/net/mpipe: fix the crash/hung issue when >testpmd quits > >1. Fixed the compiling issue of the ethtool example on tilegx > platform. >2. Fixed the hung/crash issue when quitting testpmd under high > traffic rate. The buffer error bit needs to be checked before > processing the idesc and releasing the buffer. Code logic is > also simplified. > >Signed-off-by: Liming Sun >--- > drivers/net/mpipe/mpipe_tilegx.c | 46 >+++++++------------- > .../common/include/arch/tile/rte_rwlock.h | 1 + > 2 files changed, 17 insertions(+), 30 deletions(-) > >diff --git a/drivers/net/mpipe/mpipe_tilegx.c >b/drivers/net/mpipe/mpipe_tilegx.c >index 8d006fa..4cb54c3 100644 >--- a/drivers/net/mpipe/mpipe_tilegx.c >+++ b/drivers/net/mpipe/mpipe_tilegx.c >@@ -134,7 +134,6 @@ struct mpipe_dev_priv { > struct rte_mempool *rx_mpool; /* mpool used by the rx queues. */ > unsigned rx_offset; /* Receive head room. */ > unsigned rx_size_code; /* mPIPE rx buffer size code. */ >- unsigned rx_buffers; /* receive buffers on stack. */ > int is_xaui:1, /* Is this an xgbe or gbe? */ > initialized:1, /* Initialized port? */ > running:1; /* Running port? */ >@@ -529,7 +528,6 @@ mpipe_recv_fill_stack(struct mpipe_dev_priv *priv, int >count) > mpipe_recv_push(priv, mbuf); > } > >- priv->rx_buffers += count; > PMD_DEBUG_RX("%s: Filled %d/%d buffers\n", mpipe_name(priv), i, >count); } > >@@ -539,10 +537,9 @@ mpipe_recv_flush_stack(struct mpipe_dev_priv *priv) > const int offset = priv->rx_offset & ~RTE_MEMPOOL_ALIGN_MASK; > uint8_t in_port = priv->port_id; > struct rte_mbuf *mbuf; >- unsigned count; > void *va; > >- for (count = 0; count < priv->rx_buffers; count++) { >+ while (1) { > va = gxio_mpipe_pop_buffer(priv->context, priv->stack); > if (!va) > break; >@@ -561,10 +558,6 @@ mpipe_recv_flush_stack(struct mpipe_dev_priv *priv) > > __rte_mbuf_raw_free(mbuf); > } >- >- PMD_DEBUG_RX("%s: Returned %d/%d buffers\n", >- mpipe_name(priv), count, priv->rx_buffers); >- priv->rx_buffers -= count; > } > > static void >@@ -1246,31 +1239,23 @@ mpipe_recv_flush(struct mpipe_dev_priv *priv) > gxio_mpipe_iqueue_t *iqueue; > gxio_mpipe_idesc_t idesc; > struct rte_mbuf *mbuf; >- int retries = 0; > unsigned queue; > >- do { >- mpipe_recv_flush_stack(priv); >- >- /* Flush packets sitting in recv queues. */ >- for (queue = 0; queue < priv->nb_rx_queues; queue++) { >- rx_queue = mpipe_rx_queue(priv, queue); >- iqueue = &rx_queue->iqueue; >- while (gxio_mpipe_iqueue_try_get(iqueue, &idesc) >= 0) { >- mbuf = mpipe_recv_mbuf(priv, &idesc, in_port); >- rte_pktmbuf_free(mbuf); >- priv->rx_buffers--; >- } >- rte_free(rx_queue->rx_ring_mem); >- } >- } while (retries++ < 10 && priv->rx_buffers); >+ /* Release packets on the buffer stack. */ >+ mpipe_recv_flush_stack(priv); > >- if (priv->rx_buffers) { >- RTE_LOG(ERR, PMD, "%s: Leaked %d receive buffers.\n", >- mpipe_name(priv), priv->rx_buffers); >- } else { >- PMD_DEBUG_RX("%s: Returned all receive buffers.\n", >- mpipe_name(priv)); >+ /* Flush packets sitting in recv queues. */ >+ for (queue = 0; queue < priv->nb_rx_queues; queue++) { >+ rx_queue = mpipe_rx_queue(priv, queue); >+ iqueue = &rx_queue->iqueue; >+ while (gxio_mpipe_iqueue_try_get(iqueue, &idesc) >= 0) { >+ /* Skip idesc with the 'buffer error' bit set. */ >+ if (idesc.be) >+ continue; >+ mbuf = mpipe_recv_mbuf(priv, &idesc, in_port); >+ rte_pktmbuf_free(mbuf); >+ } >+ rte_free(rx_queue->rx_ring_mem); > } > } > >@@ -1339,6 +1324,7 @@ mpipe_do_xmit(struct mpipe_tx_queue *tx_queue, >struct rte_mbuf **tx_pkts, > .xfer_size = rte_pktmbuf_data_len(mbuf), > .bound = next ? 0 : 1, > .stack_idx = mpipe_mbuf_stack_index(priv, mbuf), >+ .size = priv->rx_size_code, > } }; > if (mpipe_local.mbuf_push_debt[port_id] > 0) { > mpipe_local.mbuf_push_debt[port_id]--; >diff --git a/lib/librte_eal/common/include/arch/tile/rte_rwlock.h >b/lib/librte_eal/common/include/arch/tile/rte_rwlock.h >index 8f67a19..6d609e8 100644 >--- a/lib/librte_eal/common/include/arch/tile/rte_rwlock.h >+++ b/lib/librte_eal/common/include/arch/tile/rte_rwlock.h >@@ -38,6 +38,7 @@ extern "C" { > #endif > > #include "generic/rte_rwlock.h" >+#include > > static inline void > rte_rwlock_read_lock_tm(rte_rwlock_t *rwl) >-- >1.7.1 Acked-by: Zhigang Lu