powerpc/infiniband: Use cache inhibitted and guarded mapping on powerpc
PATCH v2 1/1 powerpc/infiniband: Use cache inhibitted and guarded mapping on powerpc
The driver was requesting for a writethrough mapping. But with thoses flags we will end up with a SAO mapping because we now have memory conherence always enabled. ie, the existing mapping will end up with a WIMG value 0b1110 which is Strong Access Order.
Update this to use cache inhibitted guarded mapping
---
Changes from v1:
* resend because V1 never reached mailing list.
NOTE: This is only compile tested and I am also not sure why ppc64 needs special handling.
We need this patch because the series at http://mid.gmane.org/[email protected]
will drop _PAGE_WRITETHRU
drivers/infiniband/hw/qib/qib_file_ops.c | 5 +---- drivers/infiniband/hw/qib/qib_pcie.c | 6 ------ 2 files changed, 1 insertion(+), 10 deletions(-)
drivers/infiniband/hw/qib/qib_file_ops.c +1 -4
@@ -822,10 +822,7 @@ static int mmap_piobufs(struct vm_area_struct *vma, phys = dd->physaddr + piobufs;#if defined(__powerpc__) -/* There isn't a generic way to specify writethrough mappings */ -pgprot_val (vma->vm_page_prot) |= _PAGE_NO_CACHE; -pgprot_val (vma->vm_page_prot) |= _PAGE_WRITETHRU; -pgprot_val (vma->vm_page_prot) &= ~_PAGE_GUARDED; + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);#endif /*
drivers/infiniband/hw/qib/qib_pcie.c +0 -6
@@ -144,13 +144,7 @@ int qib_pcie_ddinit(struct qib_devdata *dd, struct pci_dev *pdev, addr =pci_resource_start (pdev,0 ); len =pci_resource_len (pdev,0 ); -#if defined(__powerpc__) -/* There isn't a generic way to specify writethrough mappings */ - dd->kregbase =__ioremap (addr, len, _PAGE_NO_CACHE | _PAGE_WRITETHRU); -#else dd->kregbase =ioremap_nocache (addr, len); -#endif -if (!dd->kregbase)return -ENOMEM ;
Signature · 6 lines
2.5.0 _______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 5 lines
From: Aneesh Kumar K.V [mailto:[email protected]]
Sent: Wednesday, April 20, 2016 3:58 AM
Subject: [PATCH V2] powerpc/infiniband: Use cache inhibitted and guarded mapping on powerpc
Doug, can you fix up the summary to git the spelling error and powerpc/infiniband: -> IB/qib:
Thanks for the patch!
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 6 lines · Aneesh Kumar K.V
The driver was requesting for a writethrough mapping. But with thoses flags we will end up with a SAO mapping because we now have memory conherence always enabled. ie, the existing mapping will end up with a WIMG value 0b1110 which is Strong Access Order.
Update this to use cache inhibitted guarded mapping
Why guarded ? If it's performance sensitive (and the driver has appropriate barriers where needed), you will get write combining without guarded, you won't with it.
Cheers,
Ben.
Quoted 58 lines
Cc Mike Marciniszyn <[email protected]>Cc Doug Ledford <[email protected]>Cc Sean Hefty <[email protected]>Cc Hal Rosenstock <[email protected]>Signed-off-by Aneesh Kumar K.V <[email protected]>---
Changes from v1:
* resend because V1 never reached mailing list.NOTE: This is only compile tested and I am also not sure why ppc64 needs special handling.
We need this patch because the series at http://mid.gmane.org/1460182
[email protected] will drop_PAGE_WRITETHRUdrivers/infiniband/hw/qib/qib_file_ops.c | 5 +---- drivers/infiniband/hw/qib/qib_pcie.c | 6 ------
2 files changed, 1 insertion(+), 10 deletions(-)drivers/infiniband/hw/qib/qib_file_ops.c +0
-0@@ -822,10 +822,7 @@ static int mmap_piobufs(struct vm_area_struct *vma, phys = dd->physaddr + piobufs;
#ifdefined(__powerpc__)drivers/infiniband/hw/qib/qib_file_ops.c +0
-1-/* There isn't a generic way to specify writethrough mappings */
drivers/infiniband/hw/qib/qib_file_ops.c +1
-3-pgprot_val (vma->vm_page_prot) |= _PAGE_NO_CACHE; -pgprot_val (vma->vm_page_prot) |= _PAGE_WRITETHRU; -pgprot_val (vma->vm_page_prot) &= ~_PAGE_GUARDED; + vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot);#endif
/*drivers/infiniband/hw/qib/qib_pcie.c +0
-0@@ -144,13 +144,7 @@ int qib_pcie_ddinit(struct qib_devdata *dd,struct pci_dev *pdev, addr = pci_resource_start(pdev, 0); len = pci_resource_len(pdev, 0);drivers/infiniband/hw/qib/qib_pcie.c +0
-2-#if defined(__powerpc__) -/* There isn't a generic way to specify writethrough mappings */
drivers/infiniband/hw/qib/qib_pcie.c +0
-1- dd->kregbase = __ioremap(addr, len, _PAGE_NO_CACHE |
_PAGE_WRITETHRU);
-#else
dd->kregbase=ioremap_nocache(addr, len);drivers/infiniband/hw/qib/qib_pcie.c +0
-2-#endif -
Quoted 3 lines
if (!dd->kregbase)
return-ENOMEM;
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 6 lines · Aneesh Kumar K.V
The driver was requesting for a writethrough mapping. But with thoses flags we will end up with a SAO mapping because we now have memory conherence always enabled. ie, the existing mapping will end up with a WIMG value 0b1110 which is Strong Access Order.
Update this to use cache inhibitted guarded mapping
Why guarded ? If it's performance sensitive (and the driver has appropriate barriers where needed), you will get write combining without guarded, you won't with it.
This driver uses uncached write combining on x86
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 13 lines · Jason Gunthorpe
Quoted 11 lines · Benjamin Herrenschmidt
Quoted 9 lines · Aneesh Kumar K.V
The driver was requesting for a writethrough mapping. But with thoses
flags we will end up with a SAO mapping because we now have memory
conherence always enabled. ie, the existing mapping will end up with
a WIMG value 0b1110 which is Strong Access Order.
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Update this to use cache inhibitted guarded mapping
Why guarded ? If it's performance sensitive (and the driver has appropriate barriers where needed), you will get write combining without guarded, you won't with it.
This driver uses uncached write combining on x86
Right so if you want something similar on power, use the _wc variant, and make sure you have the appropriate barriers when you need to break combining.
Cheers,
Ben.
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://lists.ozlabs.org/listinfo/linuxppc-dev
Quoted 18 lines · Benjamin Herrenschmidt
Quoted 17 lines · Jason Gunthorpe
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 10 lines · Aneesh Kumar K.V
The driver was requesting for a writethrough mapping. But with thoses
flags we will end up with a SAO mapping because we now have memory
conherence always enabled. ie, the existing mapping will end up with
a WIMG value 0b1110 which is Strong Access Order.Update this to use cache inhibitted guarded mapping
Why guarded ? If it's performance sensitive (and the driver has appropriate barriers where needed), you will get write combining without guarded, you won't with it.
Quoted 8 lines
Quoted 1 line
This driver uses uncached write combining on x86
Right so if you want something similar on power, use the
_wcvariant, and make sure you have the appropriate barriers when you need to break combining.Cheers,
Ben.
The code after change looks like below
#if defined(__powerpc__) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
#endif
/* * don't allow them to later change to readable with mprotect (for when * not initially mapped readable, as is normally the case) */ vma->vm_flags &= ~VM_MAYREAD; vma->vm_flags |= VM_DONTCOPY | VM_DONTEXPAND; /* We used PAT if wc_cookie == 0 */ if (!dd->wc_cookie) vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
So it uses pgprot_noncached_wc if (!dd->wc_cookie). Hence I was thinking it needs more stricter mapping otherwise.
-aneesh
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Mike
Quoted 5 lines
From: Aneesh Kumar K.V [mailto:[email protected]]
Sent: Wednesday, April 20, 2016 3:58 AM
Subject: [PATCH V2] powerpc/infiniband: Use cache inhibitted and guarded mapping on powerpcDoug, can you fix up the summary to git the spelling error and powerpc/infiniband: -> IB/qib:
We'll need to take this via the powerpc tree, we have a 68 patch series that depends on it. I'm happy to update the subject.
cheers
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html