DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Fwd: Deadlock in rte_mempool using multi-process shared memory
       [not found] <CAH1gxTu=k8qXUU0AmOW6SCv3j6X4G3O+_byXVRkbnRRCerhOiw@mail.gmail.com>
@ 2017-01-03 11:20 ` 陆秋文
  0 siblings, 0 replies; only message in thread
From: 陆秋文 @ 2017-01-03 11:20 UTC (permalink / raw)
  To: users

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-01-03 11:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAH1gxTu=k8qXUU0AmOW6SCv3j6X4G3O+_byXVRkbnRRCerhOiw@mail.gmail.com>
2017-01-03 11:20 ` [dpdk-users] Fwd: Deadlock in rte_mempool using multi-process shared memory 陆秋文

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).