lkml.org 
[lkml]   [2011]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] Do not round per_cpu_ptr_to_phys to page boundary
Date
The phys_addr_t per_cpu_ptr_to_phys() function ignores the offset within a 
page, whenever not using a simple translation using __pa().

Without this patch /sys/devices/system/cpu/cpu*/crash_notes shows incorrect
values, which breaks kdump. Other things may also be broken.

Signed-off-by: Petr Tesarik <ptesarik@suse.cz>

diff --git a/mm/percpu.c b/mm/percpu.c
index 3bb810a..1a1b5ac 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -998,6 +998,7 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
bool in_first_chunk = false;
unsigned long first_low, first_high;
unsigned int cpu;
+ phys_addr_t page_addr;

/*
* The following test on unit_low/high isn't strictly
@@ -1023,9 +1024,10 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
if (!is_vmalloc_addr(addr))
return __pa(addr);
else
- return page_to_phys(vmalloc_to_page(addr));
+ page_addr = page_to_phys(vmalloc_to_page(addr));
} else
- return page_to_phys(pcpu_addr_to_page(addr));
+ page_addr = page_to_phys(pcpu_addr_to_page(addr));
+ return page_addr + offset_in_page(addr);
}

/**

\
 
 \ /
  Last update: 2011-12-16 09:07    [from the cache]
©2003-2011 Jasper Spaans