From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f196.google.com (mail-ua0-f196.google.com [209.85.217.196]) by dpdk.org (Postfix) with ESMTP id 1AC0520F for ; Tue, 3 Jan 2017 08:10:49 +0100 (CET) Received: by mail-ua0-f196.google.com with SMTP id i68so32838162uad.1 for ; Mon, 02 Jan 2017 23:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7m4tAFCsWeiKLrQ3KWc+91SU4mqe8em5XRSHdIKBlJs=; b=L/Jiopf+3zYMa2fjUAQYawcLuE32OQJ7gJVtjEFEPU6B64fw6E30HE0kXhL23EhOXn 6mog8C/2okqMC/MBQavk7TpWhMAlBiEl47FnSEnFbNIcnq9+Yu98vH5aFiGtcWkpSHgb vQdpVh/A73SH1XHSr0YOiW6sivaCXgAuflv40N8zDa1JH3SZr1WhhAfODsT1O3SWBPal xJyL7LePA6asYqCv48Y2AX9GtJmMdpxlTlJLEUuPYQrtxkqXl/kY+/zGGMuH4tIjOc0K evOU2yujCSeSm/AAYSl0CH+m+OnBfXVn7ejEidjfIDArGDM9evC+Mzgv0pWXomATKBvc MhSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7m4tAFCsWeiKLrQ3KWc+91SU4mqe8em5XRSHdIKBlJs=; b=p6W0GFmkaWad3THGzKN5LenRu3PuIUZuUz4XJsDdy76xyWXmz2MOWi7oo3uStMjIns aILrza4yJadHQ4dk885sXzb1Crkw9MX5Yb8h/17FyixReAlaLD3z/1blvaL0Z/tiiZly 5aU/RwNKS28KY499+wDSurKuZcqsjsgWwTUMuTwpJFRO7ti6+Mx2W5YgWpTADaPfPaK9 IEF7YFR+qBgs1BnKHBBfIKmTSckNvRxOLt+pv1ohVKzlO8ywdPUx10PCDN2ZG78y/hsp 4i0E8yupJigf3T+rPJCwlFnFKZeqOiT1fVM1DUwRnJxMxE97KI8Hwq7lnT/zR5Bhm7v7 awPA== X-Gm-Message-State: AIkVDXKLc6tT9sEgby1gZuryNLyvqw6hYAphrjdcS7QvQM6ujzQDbMZm1fCAMuMVu0PmfmzrzQBxVWlXkNlDsQ== X-Received: by 10.176.67.163 with SMTP id l32mr37856429ual.89.1483427448217; Mon, 02 Jan 2017 23:10:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.70.210 with HTTP; Mon, 2 Jan 2017 23:10:47 -0800 (PST) From: =?UTF-8?B?6ZmG56eL5paH?= Date: Tue, 3 Jan 2017 15:10:47 +0800 Message-ID: To: dev@dpdk.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] Deadlock in rte_mempool using multi-process shared memory X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2017 07:10:49 -0000 Hi, I have some process running in DPDK which uses DPDK multi-process feature to communicate. Master process captures packets from NIC and put them to a ring buffer, which is shared between master and slave process. Sometimes, slave process use rte_pktmbuf_alloc() to alloc pktmbuf from the shared mempool, and send to master process by a ring buffer. However, when slave process exit by accident(recv a SIGTERM signal), the thread in slave process which using the shared mempool(such as calling rte_pktmbuf_alloc()) may cause wrong state in a few cases, and other thread use the mempool may fall into deadlock. like this: static inline int __attribute__((always_inline)) __rte_ring_mc_do_dequeue(struct rte_ring *r, void **obj_table, unsigned n, enum rte_ring_queue_behavior behavior) { ................. /* * If there are other dequeues in progress that preceded us, * we need to wait for them to complete */ while (unlikely(r->cons.tail != cons_head)) { ============ this condition cannot be satisfied forever. rte_pause(); ============ thread may spin at this line. /* Set RTE_RING_PAUSE_REP_COUNT to avoid spin too long waiting * for other thread finish. It gives pre-empted thread a chance * to proceed and finish with ring dequeue operation. */ if (RTE_RING_PAUSE_REP_COUNT && ++rep == RTE_RING_PAUSE_REP_COUNT) { rep = 0; sched_yield(); } } __RING_STAT_ADD(r, deq_success, n); r->cons.tail = cons_next; ....................... } I tried to enable RTE_RING_PAUSE_REP_COUNT, but it has no effect. What I can do? Thanks a lot! Qiuwen 2017/1/3