From b7d0481dc1219ed6c8c7a352212227f166ade8ae Mon Sep 17 00:00:00 2001 From: Rob Gardner Date: Thu, 13 Apr 2017 12:07:59 -0600 Subject: [PATCH] sparc64: DAX memory needs persistent mappings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Orabug: 25888596 Memory allocated on behalf of dax_alloc() is mapped by two distinct MMU translations, one set for userland, which is backed by regular 8k virtual pages, and another set for feeding to the hypervisor, and these are kernel virtual addresses backed by 4Mb pages. These latter translations are only used when the memory is allocated/deallocated and when a dax transaction is submitted. So the translations are unlikely to be in the TLB, and eventually may be evicted from the kernel TSB after some time. This leads to ENOMAP errors reported by the hypervisor. In order to avoid this, we "touch" such pages just before dax_submit which will fault translations into the tlb/tsb if necessary. A future performance optimization is to take advantage of the "real address has pagesize" feature which is available in very recent versions of hypervisor f/w. In this case we can convert the address in the ccb to a real address with the correct bits to specify a 4Mb pagesize, and change the address type to real. Then the memory touch would be unnecessary and the HV would not need to probe the tlb/tsb at all. Signed-off-by: Rob Gardner Reviewed-by: HÃ¥kon Bugge Reviewed-by: Jonathan Helman Signed-off-by: Allen Pais --- arch/sparc/dax/dax_mm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/sparc/dax/dax_mm.c b/arch/sparc/dax/dax_mm.c index 031767e9bda96..480c07b949cca 100644 --- a/arch/sparc/dax/dax_mm.c +++ b/arch/sparc/dax/dax_mm.c @@ -193,6 +193,9 @@ int dax_map_segment_common(unsigned long size, *ccb_addr_type = CCB_AT_VA; ccbp->dwords[addr_sel] = (unsigned long)dv->kva + (virtp - vma->vm_start); + /* touch va to fault translation into tlb/tsb */ + READ_ONCE(*(u8 *)ccbp->dwords[addr_sel]); + dax_map_dbg("changed %s to KVA 0x%llx", name, ccbp->dwords[addr_sel]); } else { -- 2.50.1