lkml.org 
[lkml]   [2009]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] kmemleak: Ignore the aperture memory hole on x86_64

* Catalin Marinas <catalin.marinas@arm.com> wrote:

> 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: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
> arch/x86/kernel/aperture_64.c | 6 ++++++
> arch/x86/kernel/pci-dma.c | 6 ++++++
> 2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
> index 676debf..128111d 100644
> --- a/arch/x86/kernel/aperture_64.c
> +++ b/arch/x86/kernel/aperture_64.c
> @@ -20,6 +20,7 @@
> #include <linux/bitops.h>
> #include <linux/ioport.h>
> #include <linux/suspend.h>
> +#include <linux/kmemleak.h>
> #include <asm/e820.h>
> #include <asm/io.h>
> #include <asm/iommu.h>
> @@ -94,6 +95,11 @@ static u32 __init allocate_aperture(void)
> * code for safe
> */
> 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) {
> printk(KERN_ERR
> "Cannot allocate aperture memory hole (%p,%uK)\n",

This sure does not look right for the rare but theoretically
possible !p case, does it?

> diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
> index 1a041bc..fa80f60 100644
> --- a/arch/x86/kernel/pci-dma.c
> +++ b/arch/x86/kernel/pci-dma.c
> @@ -3,6 +3,7 @@
> #include <linux/dmar.h>
> #include <linux/bootmem.h>
> #include <linux/pci.h>
> +#include <linux/kmemleak.h>
>
> #include <asm/proto.h>
> #include <asm/dma.h>
> @@ -88,6 +89,11 @@ void __init dma32_reserve_bootmem(void)
> size = roundup(dma32_bootmem_size, align);
> dma32_bootmem_ptr = __alloc_bootmem_nopanic(size, align,
> 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)
> dma32_bootmem_size = size;

Same question.

Ingo


\
 
 \ /
  Last update: 2009-08-29 15:35    [W:0.065 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site