From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-f42.google.com (mail-pb0-f42.google.com [209.85.160.42]) by dpdk.org (Postfix) with ESMTP id D7AD2B0B5 for ; Wed, 14 May 2014 18:26:23 +0200 (CEST) Received: by mail-pb0-f42.google.com with SMTP id md12so1520855pbc.29 for ; Wed, 14 May 2014 09:26:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:user-agent:date:from:to:cc:subject :references:mime-version:content-type:content-disposition; bh=4nBZd07Do3EVhtj2HiIT2LWEeVj4uJr/h9kCZ+F2KjU=; b=JEpE7i7zJ3uqBR7S0r25ZdjX550tBigsphNBEARr0YcQYxa/u1/rE1ceUGCxo1oKEx 2imyPy611s3rQhqpu4FdZGA0OkAoulMkXaJjcg7C+ebkhTqB6hLuj6h9GuyTNQrzP6LZ HPnH6ArnSYpWaYpzJ2eMPAEpb0mfQTrPXIC95NXDYfHv1WxQjxYpHybTrCkTq6XljFOb nCuMIEnEYXa47bojUurNCNLBDQYQyCepDlOx5JmFPiuLMVO21hlMxAEvpXCin9Scwa0B GYhMSM0aWkNuY/FGEtJ5uTumOEoHy9cOQrjVY1IknMUuYE/im+8G8U9huar9UrM+wBmu O6Qg== X-Gm-Message-State: ALoCoQnMiUe8G1562zj7LgbhnzV4cUO4u3rrwBbKL+pf/VYm9+pgnBt5uTPlDzlr1g0L10M81VdY X-Received: by 10.68.136.2 with SMTP id pw2mr5531646pbb.167.1400084791317; Wed, 14 May 2014 09:26:31 -0700 (PDT) Received: from localhost (static-50-53-83-51.bvtn.or.frontiernet.net. [50.53.83.51]) by mx.google.com with ESMTPSA id ie9sm9788245pad.29.2014.05.14.09.26.30 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 May 2014 09:26:30 -0700 (PDT) Message-Id: <20140514162629.738257220@networkplumber.org> User-Agent: quilt/0.61-1 Date: Wed, 14 May 2014 09:25:27 -0700 From: Stephen Hemminger To: dev@dpdk.org References: <20140514162524.113765980@networkplumber.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=sched-unstuck-grinder.patch Cc: Stephen Hemminger Subject: [dpdk-dev] [PATCH 3/3] rte_sched: fix grinder bug 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: Wed, 14 May 2014 16:26:24 -0000 The rte_scheduler will get stuck and not deliver any more packets if there are two active subports and then one of them stops enqueing more packets. This is because of abug in how the grinder state machines are managed. If a non-zero grinder is assigned (but not yet active), then the dequeue would miss it and always return zero packets. The cure is to always do a first pass over all grinders. Signed-off-by: Stephen Hemminger --- lib/librte_sched/rte_sched.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/lib/librte_sched/rte_sched.c 2014-05-14 09:14:01.137253986 -0700 +++ b/lib/librte_sched/rte_sched.c 2014-05-14 09:14:01.137253986 -0700 @@ -2113,12 +2113,12 @@ rte_sched_port_time_resync(struct rte_sc } static inline int -rte_sched_port_exceptions(struct rte_sched_port *port) +rte_sched_port_exceptions(struct rte_sched_port *port, int second_pass) { int exceptions; /* Check if any exception flag is set */ - exceptions = (port->busy_grinders == 0) || + exceptions = (second_pass && port->busy_grinders == 0) || (port->pipe_exhaustion == 1); /* Clear exception flags */ @@ -2140,7 +2140,8 @@ rte_sched_port_dequeue(struct rte_sched_ /* Take each queue in the grinder one step further */ for (i = 0, count = 0; ; i ++) { count += grinder_handle(port, i & (RTE_SCHED_PORT_N_GRINDERS - 1)); - if ((count == n_pkts) || rte_sched_port_exceptions(port)) { + if ((count == n_pkts) || + rte_sched_port_exceptions(port, i >= RTE_SCHED_PORT_N_GRINDERS)) { break; } }