On Thu, Feb 01, 2018 at 09:18:22AM +0800, Changpeng Liu wrote: > For PCI prefetchable resources, Linux will create a > write combined file as well, the library will try > to map resourceX_wc file first, if the file does > not exist, then it will map resourceX as usual. > > Signed-off-by: Changpeng Liu <changpeng....@intel.com> > --- > drivers/bus/pci/linux/pci_uio.c | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) >
Hi, Given the lack of ordering guarantees with write-combined memory, I would have thought that this is very risky to do without a complete set of changes inside the PMDs to add in the necessary memory barriers to ensure ordering of operations to the BARs. Therefore, instead of mapping one file or another, I think the change should be made to map *both* in DPDK if available. Then each driver can chose whether to write a given device register using uncacheable memory type or write-combining memory type + any appropriate barriers. For example, with many NICs the initialization of the device involves many register writes in a pretty defined order, so wc operations are probably to suitable as performance is not a concern. However, for data path operations, a driver may chose to use wc memory for the occasional device writes there, for performance reasons. Regards, /Bruce