Fix for PAGE_SIZE / PAGE_MASK magic number.

Change-Id: Icc00594d84a33495af774096ae13f830e29be39f
Fujitsu: POSTK_DEBUG_ARCH_DEP_116
This commit is contained in:
Shiratori, Takehiro
2018-11-29 16:00:59 +09:00
committed by Dominique Martinet
parent 516ab87ab9
commit 9e5472bb94
3 changed files with 10 additions and 6 deletions

View File

@ -619,7 +619,8 @@ static void *mckernel_allocate_aligned_pages_node(int npages, int p2align,
} }
else { else {
#ifdef PROFILE_ENABLE #ifdef PROFILE_ENABLE
profile_event_add(PROFILE_mpol_alloc_missed, npages * 4096); profile_event_add(PROFILE_mpol_alloc_missed,
npages * PAGE_SIZE);
#endif #endif
dkprintf("%s: couldn't fulfill explicit NUMA request for %d pages\n", dkprintf("%s: couldn't fulfill explicit NUMA request for %d pages\n",
__FUNCTION__, npages); __FUNCTION__, npages);
@ -711,7 +712,8 @@ static void *mckernel_allocate_aligned_pages_node(int npages, int p2align,
} }
else { else {
#ifdef PROFILE_ENABLE #ifdef PROFILE_ENABLE
profile_event_add(PROFILE_mpol_alloc_missed, npages * 4096); profile_event_add(PROFILE_mpol_alloc_missed,
npages * PAGE_SIZE);
#endif #endif
dkprintf("%s: couldn't fulfill user policy for %d pages\n", dkprintf("%s: couldn't fulfill user policy for %d pages\n",
__FUNCTION__, npages); __FUNCTION__, npages);
@ -1163,7 +1165,7 @@ static void page_fault_handler(void *fault_addr, uint64_t reason, void *regs)
cpu_enable_interrupt(); cpu_enable_interrupt();
if ((uintptr_t)fault_addr < 4096) { if ((uintptr_t)fault_addr < PAGE_SIZE) {
error = -EINVAL; error = -EINVAL;
} else { } else {
error = page_fault_process_vm(thread->vm, fault_addr, reason); error = page_fault_process_vm(thread->vm, fault_addr, reason);

View File

@ -3100,7 +3100,7 @@ getcred(int *_buf)
struct syscall_request request IHK_DMA_ALIGN; struct syscall_request request IHK_DMA_ALIGN;
unsigned long phys; unsigned long phys;
if((((unsigned long)_buf) ^ ((unsigned long)(_buf + 8))) & ~4095) if ((((unsigned long)_buf) ^ ((unsigned long)(_buf + 8))) & PAGE_MASK)
buf = _buf + 8; buf = _buf + 8;
else else
buf = _buf; buf = _buf;
@ -5757,7 +5757,8 @@ long do_futex(int n, unsigned long arg0, unsigned long arg1,
request.number = n; request.number = n;
unsigned long __phys; unsigned long __phys;
if((((unsigned long)tv) ^ ((unsigned long)(tv + 1))) & ~4095) if ((((unsigned long)tv) ^
((unsigned long)(tv + 1))) & PAGE_MASK)
tv_now = tv + 1; tv_now = tv + 1;
if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->address_space->page_table, if (ihk_mc_pt_virt_to_phys(cpu_local_var(current)->vm->address_space->page_table,
(void *)tv_now, &__phys)) { (void *)tv_now, &__phys)) {

View File

@ -23,6 +23,7 @@
#include <types.h> #include <types.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <memory.h>
unsigned char _ctype[] = { unsigned char _ctype[] = {
_C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */ _C,_C,_C,_C,_C,_C,_C,_C, /* 0-7 */
@ -584,7 +585,7 @@ static char *string(char *buf, char *end, char *s, struct printf_spec spec)
{ {
int len, i; int len, i;
if ((unsigned long)s < 4096) if ((unsigned long)s < PAGE_SIZE)
s = "<NULL>"; s = "<NULL>";
len = strnlen(s, spec.precision); len = strnlen(s, spec.precision);