Skip to contentSkip to conversation

sparc64: fix mmap fixed and shared on sun4u

PATCH In review Larry Bassel 2 participants 2 messages Dec 21, 2016 – Dec 26, 2016 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sparc64: fix mmap fixed and shared on sun4u

Older sparc64 must have a VAC because there is concern that mmapping fixed and shared with incorrect align would cause cache aliases. This is not an issue for sun4v.

We will enforce the rigid alignment condition only for tlb_type != hypervisor.

---
 arch/sparc/kernel/sys_sparc_64.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
arch/sparc/kernel/sys_sparc_64.c +2 -2
index fe8b8ee..43780b2 100644
@@ -95,7 +95,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
 		/* We do not accept a shared mapping if it would violate
 		 * cache aliasing constraints.
 		 */
-		if ((flags & MAP_SHARED) &&
+		if ((flags & MAP_SHARED) && (tlb_type != hypervisor) &&
 		    ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
 			return -EINVAL;
 		return addr;
@@ -159,7 +159,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
 		/* We do not accept a shared mapping if it would violate
 		 * cache aliasing constraints.
 		 */
-		if ((flags & MAP_SHARED) &&
+		if ((flags & MAP_SHARED) && (tlb_type != hypervisor) &&
 		    ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
 			return -EINVAL;
 		return addr;
Signature · 1 line
1.7.1
maintainer
#1 lore raw

From: Larry Bassel <[email protected]>
Date: Wed, 21 Dec 2016 14:25:49 -0800

Quoted 8 lines

Older sparc64 must have a VAC because there is concern that mmapping fixed and shared with incorrect align would cause cache aliases. This is not an issue for sun4v.

We will enforce the rigid alignment condition only for tlb_type != hypervisor.

This is just asking people to write programs that won't work on pre-Niagara machines.

I'm not applying this, having a SHMLBA (16K) alignment requirement for shared mmapings is quite reasonable.