Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit acde31dc authored by Catalin Marinas's avatar Catalin Marinas
Browse files

kmemleak: Ignore the aperture memory hole on x86_64



This block is allocated with alloc_bootmem() and scanned by kmemleak but
the kernel direct mapping may no longer exist. This patch tells kmemleak
to ignore this memory hole. The dma32_bootmem_ptr in
dma32_reserve_bootmem() is also ignored.

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarIngo Molnar <mingo@elte.hu>
parent 0494e082
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/bitops.h>
#include <linux/bitops.h>
#include <linux/ioport.h>
#include <linux/ioport.h>
#include <linux/suspend.h>
#include <linux/suspend.h>
#include <linux/kmemleak.h>
#include <asm/e820.h>
#include <asm/e820.h>
#include <asm/io.h>
#include <asm/io.h>
#include <asm/iommu.h>
#include <asm/iommu.h>
@@ -94,6 +95,11 @@ static u32 __init allocate_aperture(void)
	 * code for safe
	 * code for safe
	 */
	 */
	p = __alloc_bootmem_nopanic(aper_size, aper_size, 512ULL<<20);
	p = __alloc_bootmem_nopanic(aper_size, aper_size, 512ULL<<20);
	/*
	 * Kmemleak should not scan this block as it may not be mapped via the
	 * kernel direct mapping.
	 */
	kmemleak_ignore(p);
	if (!p || __pa(p)+aper_size > 0xffffffff) {
	if (!p || __pa(p)+aper_size > 0xffffffff) {
		printk(KERN_ERR
		printk(KERN_ERR
			"Cannot allocate aperture memory hole (%p,%uK)\n",
			"Cannot allocate aperture memory hole (%p,%uK)\n",
+6 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@
#include <linux/dmar.h>
#include <linux/dmar.h>
#include <linux/bootmem.h>
#include <linux/bootmem.h>
#include <linux/pci.h>
#include <linux/pci.h>
#include <linux/kmemleak.h>


#include <asm/proto.h>
#include <asm/proto.h>
#include <asm/dma.h>
#include <asm/dma.h>
@@ -88,6 +89,11 @@ void __init dma32_reserve_bootmem(void)
	size = roundup(dma32_bootmem_size, align);
	size = roundup(dma32_bootmem_size, align);
	dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
	dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
				 512ULL<<20);
				 512ULL<<20);
	/*
	 * Kmemleak should not scan this block as it may not be mapped via the
	 * kernel direct mapping.
	 */
	kmemleak_ignore(dma32_bootmem_ptr);
	if (dma32_bootmem_ptr)
	if (dma32_bootmem_ptr)
		dma32_bootmem_size = size;
		dma32_bootmem_size = size;
	else
	else