On Wed, 1 Aug 2018 23:28:53 +0530 Srinath Mannam <srinath.mannam@xxxxxxxxxxxx> wrote: > Hi Alex, > > In user space UIO driver (DPDK) implementation, sysfs interface > "/sys/devices/pci/.../resource0_wc" is used to map prefetchable PCI > resources as WC. > Platforms which support write-combining maps of PCI resources have > arch_can_pci_mmap_wc() flag enabled. So that it allows to map resources as WC. > In this approach mmap calls "pci_mmap_resource_range" kernel function > with write_combine parameter set. > "drivers/pci/pci-sysfs.c" kernel file has this implementation. > > If this approach fits to vfio driver, then code change in vfio driver are > > if (arch_can_pci_mmap_wc() && > (pci_resource_flags(pdev, index) & IORESOURCE_PREFETCH)) > vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); > else > vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); > > Please provide your feedback. Let me see if I've got this straight, UIO (in reality pci-sysfs) provides a separate interface such that a driver can *choose* to get either a UC or, at their discretion, a WC mapping to a region, and you're using that as justification that vfio-pci should arbitrarily convert all existing users from UC mappings to WC mappings, without their consent, any time the architecture supports WC mappings. The fact that pci-sysfs provides separate interfaces such that drives can choose their preferred mapping attributes only reaffirms to me that this needs to be a driver decision. How would we ever validate that a change like you're proposing above would not introduce regressions for existing users? Thanks, Alex