[dpdk-dev] Strange cache sync problem(?) with reading mbuf
P Smith
dpdk_learn-dev at yahoo.com
Fri Jun 28 05:32:11 CEST 2019
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
More information about the dev
mailing list