From 328175547f9ac5eb13c596c2a7b56f8223235508 Mon Sep 17 00:00:00 2001 From: NAKAMURA Gou Date: Thu, 21 Apr 2016 22:55:57 +0900 Subject: [PATCH] Revert "fix REQ-37: remap_one_page: remove to check page size" This reverts commit 6790126a23197e592c4c7c19bc925c833a615359. - reverted commit should remove a 'pgsize' check in remap_one_page() instead of a 'pgsize' check in pte_make_fileoff(). - In IA-32e, PTE format varies with page size. Therefore 'pgsize' parameter of pte_make_fileoff() is preferable. --- arch/x86/kernel/include/arch-memory.h | 6 +----- kernel/process.c | 4 ++-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/include/arch-memory.h b/arch/x86/kernel/include/arch-memory.h index 055c6784..2279720e 100644 --- a/arch/x86/kernel/include/arch-memory.h +++ b/arch/x86/kernel/include/arch-memory.h @@ -242,13 +242,12 @@ static inline void pte_make_null(pte_t *ptep, size_t pgsize) } static inline void pte_make_fileoff(off_t off, - enum ihk_mc_pt_attribute ptattr, pte_t *ptep) + enum ihk_mc_pt_attribute ptattr, size_t pgsize, pte_t *ptep) { uint64_t attr; attr = ptattr & ~PAGE_MASK; -#if 0 switch (pgsize) { case PTL1_SIZE: attr |= PFL1_FILEOFF; break; case PTL2_SIZE: attr |= PFL2_FILEOFF | PFL2_SIZE; break; @@ -261,9 +260,6 @@ static inline void pte_make_fileoff(off_t off, #endif break; } -#else - attr |= PFL1_FILEOFF; -#endif *ptep = (off & PAGE_MASK) | attr; } diff --git a/kernel/process.c b/kernel/process.c index fcf0ede0..0cb19aaf 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -1266,7 +1266,7 @@ static int remap_one_page(void *arg0, page_table_t pt, pte_t *ptep, } off = args->off + ((uintptr_t)pgaddr - args->start); - pte_make_fileoff(off, 0, &apte); + pte_make_fileoff(off, 0, pgsize, &apte); pte_xchg(ptep, &apte); flush_tlb_single((uintptr_t)pgaddr); /* XXX: TLB flush */ @@ -1425,7 +1425,7 @@ static int invalidate_one_page(void *arg0, page_table_t pt, pte_t *ptep, pte_make_null(&apte, pgsize); } else { - pte_make_fileoff(page->offset, 0, &apte); + pte_make_fileoff(page->offset, 0, pgsize, &apte); } pte_xchg(ptep, &apte); flush_tlb_single((uintptr_t)pgaddr); /* XXX: TLB flush */