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

Stephen Hemminger stephen at networkplumber.org
Wed Mar 22 01:30:29 CET 2017


On Tue, 21 Mar 2017 20:13:48 -0400
Ed Czeck <ed.czeck at atomicrules.com> wrote:

> Hi Stephen,
> 
> Yes I understand the paranoid issue of volatile modifier, which is the
> reason it was coded in this manner.
> 
> The struct with volatile are memory mapped IO structures.  These structure
> are not instantiated in memory and hence do not incur concurrent (host)
> software access.  The a vast majority of the fields as read-only (as viewed
> by the host.)  The concurrency model is that hardware is the producer, and
> the host the consumer.  There is no handshake other than the host must not
> expect the memory location to remain constant -- that is optimization off.
> 
> As for performance, these structures are not in any critical path, so he
> optimization path is correctness not performance.
> 
> Do you have a recommendation for changing this code without using the
> volatile modifier?  I have requirements from the hardware in the pattern of:
> write a 1 to location x
> read from location y until it become 0
> write a 0 to location x
> How can this work without a volatile modified on x and y?
> 
> Best,
> Ed.

Learn to use explicit memory barriers. DPDK has rmb()/wmb() just like kernel.

Once again good explanation of memory barriers in kernel doc.


More information about the dev mailing list