Message ID | 1384457866-16135-5-git-send-email-santosh.shilimkar@ti.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Nov 14, 2013 at 07:37:44PM +0000, Santosh Shilimkar wrote: > Slab allocator can allocate memory beyond the lowmem watermark > which can lead to false failure of virt_addr_valid(). > > So drop the check. The issue was seen with percpu_alloc() > in KVM code which was allocating memory beyond lowmem watermark. > > Am not completly sure whether this is the right fix and if it could > impact any other user of virt_addr_valid(). Without this fix as > pointed out the KVM init was failing in my testing. Do you have a problem on arm64? There is no lowmem watermark here.
On 15/11/13 13:39, Catalin Marinas wrote: > On Thu, Nov 14, 2013 at 07:37:44PM +0000, Santosh Shilimkar wrote: >> Slab allocator can allocate memory beyond the lowmem watermark >> which can lead to false failure of virt_addr_valid(). >> >> So drop the check. The issue was seen with percpu_alloc() >> in KVM code which was allocating memory beyond lowmem watermark. >> >> Am not completly sure whether this is the right fix and if it could >> impact any other user of virt_addr_valid(). Without this fix as >> pointed out the KVM init was failing in my testing. > > Do you have a problem on arm64? There is no lowmem watermark here. I don't think that change is relevant for arm64. Actually, the more I look at it, I don't think virt_addr_valid() should be touched at all. The real issue is the use of virt_to_phys()/virt_addr_valid() on a percpu pointer, which is wrong and only worked by chance so far. I'm working on a patch to solve this. M.
On Friday 15 November 2013 09:25 AM, Marc Zyngier wrote: > On 15/11/13 13:39, Catalin Marinas wrote: >> On Thu, Nov 14, 2013 at 07:37:44PM +0000, Santosh Shilimkar wrote: >>> Slab allocator can allocate memory beyond the lowmem watermark >>> which can lead to false failure of virt_addr_valid(). >>> >>> So drop the check. The issue was seen with percpu_alloc() >>> in KVM code which was allocating memory beyond lowmem watermark. >>> >>> Am not completly sure whether this is the right fix and if it could >>> impact any other user of virt_addr_valid(). Without this fix as >>> pointed out the KVM init was failing in my testing. >> >> Do you have a problem on arm64? There is no lowmem watermark here. > > I don't think that change is relevant for arm64. Actually, the more I > look at it, I don't think virt_addr_valid() should be touched at all. > > The real issue is the use of virt_to_phys()/virt_addr_valid() on a > percpu pointer, which is wrong and only worked by chance so far. > > I'm working on a patch to solve this. > Yep. I tried Marc's other approach and that does solve the issue. The $subject patch was any way more for getting attention to figure out right solution ;-) which I guess we have now. Regards, Santosh
diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h index d9341ee..d04d047 100644 --- a/arch/arm64/include/asm/memory.h +++ b/arch/arm64/include/asm/memory.h @@ -154,8 +154,7 @@ static inline void *phys_to_virt(phys_addr_t x) #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) -#define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ - ((void *)(kaddr) < (void *)high_memory)) +#define virt_addr_valid(kaddr) ((void *)(kaddr) >= (void *)PAGE_OFFSET) #endif
Slab allocator can allocate memory beyond the lowmem watermark which can lead to false failure of virt_addr_valid(). So drop the check. The issue was seen with percpu_alloc() in KVM code which was allocating memory beyond lowmem watermark. Am not completly sure whether this is the right fix and if it could impact any other user of virt_addr_valid(). Without this fix as pointed out the KVM init was failing in my testing. Cc: Christoffer Dall <christoffer.dall@linaro.org> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> --- arch/arm64/include/asm/memory.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)