From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f174.google.com (mail-ua0-f174.google.com [209.85.217.174]) by dpdk.org (Postfix) with ESMTP id F0C762BB9 for ; Tue, 3 Jan 2017 12:20:48 +0100 (CET) Received: by mail-ua0-f174.google.com with SMTP id v2so144760207uac.2 for ; Tue, 03 Jan 2017 03:20:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=1FAEL1dPuH3EFCt9wlHXoWTUvasfUHGLR5dOKp8QMrQ=; b=HlPkBkyUqk+kQy0GO+qb+vY7qlyyFhHGqHku52YHJ+CsMtSLi7T/itMCLjMeLH6eav NYHl5RLOQG9BycUJaM5utlHmAjgslFhrRo9t2fmr3y/2q8wDrQU3o8rLc9cmH9cDD888 s9f6DmfcuKf0mpITwZuNumwkuso0zB4PQOGORTiti9fwlK1RM9bU6mu+AMd+rjgdSqkU kiKwIWDE76g9IuE7nTQAxzu9abEGKxBNT9ialh1qVEtCYydaAgApbfeSCE+ihTIB7Zp2 N3FV2HgjivVIHXEux0UooHCK2lpNfkvsZ7a+zqINpAuAPb6YDerCm15FuY9FUJA4qKs0 oyrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=1FAEL1dPuH3EFCt9wlHXoWTUvasfUHGLR5dOKp8QMrQ=; b=QYgLvpEbvlryNcEGf7S6m+/8JoadcadF1ZLAUKSTT54Ftf4dwRR+Cli1KRD/85Xy4N 60nzQsqqnPNDWRVeyrfGVXQXRK3rblY6ZLEwjcmOEPc/70mKfiYNPfTCwR+iNTqp2Id2 GKSCeX+nPVHvwNWXHtrIhuyF7yqrD9m81a/NTSMkrFHQmgLVxpnCjw20LMH8gnuSzfaF lqf94C66vRSZZXeG6RtqryAJIlzMHkSHIHkkpK3wnaMCVaBUwkpPkatOBugPLevAIytn BGocpTi/Ck1+YZCdoPHqq06nP4H+adL69R68ndVHql4wZnBOdk/K7n4fIFQlHtcToRdx o18g== X-Gm-Message-State: AIkVDXJjOYdKosIV9ok7kaqIMi7xhtL9SvK/KUJqG447IvIs4rjyPFi9ZYYJ7shDXTz/2dZJ9uxYdUmXknT/jg== X-Received: by 10.159.37.227 with SMTP id 90mr45542688uaf.67.1483442447710; Tue, 03 Jan 2017 03:20:47 -0800 (PST) MIME-Version: 1.0 Received: by 10.103.70.210 with HTTP; Tue, 3 Jan 2017 03:20:47 -0800 (PST) In-Reply-To: References: From: =?UTF-8?B?6ZmG56eL5paH?= Date: Tue, 3 Jan 2017 19:20:47 +0800 Message-ID: To: users@dpdk.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-users] Fwd: Deadlock in rte_mempool using multi-process shared memory X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2017 11:20: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