[dpdk-dev] [PATCH v3 2/7] net/ark: HW API part 1 of 3

Stephen Hemminger stephen at networkplumber.org
Tue Mar 21 23:15:52 CET 2017


On Tue, 21 Mar 2017 17:43:36 -0400
Ed Czeck <ed.czeck at atomicrules.com> wrote:

> +	volatile uint32_t ctrl;
> +	volatile uint32_t stats_clear;
> +	volatile uint32_t cplh_max;

You are using a lot of 'volatile' in this driver.
In general volatile should be reserved for known software shared data structures
rather than every device register and statistics. I.e volatile is an inefficient
replacement for proper use of barriers. The DPDK is not as stringent as Linux
kernel (the kernel community considers almost all use of volatile a bug).
See kernel document. process/volatile-considered-harmful.rst

Do you understand that volatile requires compiler to generate the most paranoid code possible.
Basically every reference turns into a barrier.


More information about the dev mailing list