[dpdk-dev] [PATCH v2] rte_ethdev: safer memory access by calling Rx callback

Stephen Hemminger stephen at networkplumber.org
Wed Mar 4 18:56:38 CET 2020


On Thu,  5 Mar 2020 01:33:49 +0800
ZY Qiu <quzeyao at gmail.com> wrote:

> When compiling with -O0,
> the compiler does not optimize two memory accesses into one.
> Leads to accessing a null pointer when queue post Rx burst callback
> removal while traffic is running.
> See rte_eth_tx_burst function.
> 
> Signed-off-by: ZY Qiu <tgw_team at tencent.com>

This is a problem many places in DPDK. You said it was related to -O0
but that is just what is causing a more generic problem to be exposed.
Your solution is not sufficient.

DPDK is sloppy in several places in handling memory ordering issues     
    https://en.wikipedia.org/wiki/Memory_ordering

It should have a macro to do RTE_READ_ONCE(). Several drives have this,
the Linux kernel has it, Liburcu has it.

The macro RTE_READ_ONCE() can then be used in many places in DPDK.



More information about the dev mailing list