DPDK patches and discussions
 help / color / mirror / Atom feed
From: P Smith <dpdk_learn-dev@yahoo.com>
To: Dev <dev@dpdk.org>
Subject: [dpdk-dev] Strange cache sync problem(?) with reading mbuf
Date: Fri, 28 Jun 2019 03:32:11 +0000 (UTC)	[thread overview]
Message-ID: <1405941610.58386.1561692731231@mail.yahoo.com> (raw)
In-Reply-To: <1405941610.58386.1561692731231.ref@mail.yahoo.com>

Hello all,                 I am aware that this is some caching/synchronization problem but for some reason despite using the barrier macros it does not seem to go away.What makes it go away though is to give a rte_delay of 100us and re-reading the value again like so:
        cons_rx_buf = &rxr->rx_buf_ring[cons];
        mbuf = cons_rx_buf->mbuf;
        rte_smp_mb();
        if (mbuf == NULL) {
                int cnt = 0;
                RTE_LOG(ERR, PMD, "mbuf = NULL cons = %d\n", cons);
                do {
                        rte_delay_us(100);
                        cons_rx_buf = &rxr->rx_buf_ring[cons];
                        mbuf = cons_rx_buf->mbuf;
                } while(mbuf == NULL && ++cnt <= 10);
                RTE_LOG(ERR, PMD, "mbuf = %p cnt = %d\n", mbuf, cnt);
        }

Invariably i see the 'mbuf = NULL' print and then post 1 iteration of the while loop the 'mbuf' is not NULL (correct value as expected) and it moves on smoothly....Clearly this seems like some cache synchronization issue and i thought the smp_wb() primitives should have solved it? 
Any other better ways to fix this other than this rte_delay_us() ?
ThanksSmith


           reply	other threads:[~2019-06-28  3:32 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1405941610.58386.1561692731231.ref@mail.yahoo.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1405941610.58386.1561692731231@mail.yahoo.com \
    --to=dpdk_learn-dev@yahoo.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).