From: Michael Ellerman <hidden> Date: 2009-08-13 03:01:07
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Signed-off-by: Michael Ellerman <redacted>
---
lib/lmb.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
@@ -412,6 +415,8 @@ u64 __init __lmb_alloc_base(u64 size, u64 align, u64 max_addr)/* this area isn't reserved, take it */if(lmb_add_region(&lmb.reserved,base,size)<0)return0;++kmemleak_alloc(__va(base),size,0,0);returnbase;}res_base=lmb.reserved.region[j].base;
On Thu, 2009-08-13 at 13:01 +1000, Michael Ellerman wrote:
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Looks alright to me (though I haven't tested it). You can add a
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
--
Catalin
From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: 2009-08-14 07:57:05
On Thu, 2009-08-13 at 16:40 +0100, Catalin Marinas wrote:
On Thu, 2009-08-13 at 13:01 +1000, Michael Ellerman wrote:
quoted
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Looks alright to me (though I haven't tested it). You can add a
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Actually, Milton pointed to me that we may not want to allow all
LMB chunks to be scanned by kmemleaks, things like the DART hole
that's taken out of the linear mapping for example may need to
be avoided, though I'm not sure what would be the right way to
do it.
Cheers,
Ben.
On Fri, 2009-08-14 at 17:56 +1000, Benjamin Herrenschmidt wrote:
On Thu, 2009-08-13 at 16:40 +0100, Catalin Marinas wrote:
quoted
On Thu, 2009-08-13 at 13:01 +1000, Michael Ellerman wrote:
quoted
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Looks alright to me (though I haven't tested it). You can add a
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Actually, Milton pointed to me that we may not want to allow all
LMB chunks to be scanned by kmemleaks, things like the DART hole
that's taken out of the linear mapping for example may need to
be avoided, though I'm not sure what would be the right way to
do it.
I suspect there are more blocks to be scanned than those that shouldn't,
so maybe ignore the latter explicitly using kmemleak_ignore(). This was
raised recently on x86_64 as well which has a memory hole for some
aperture - http://lkml.org/lkml/2009/8/13/237.
--
Catalin
From: David Miller <davem@davemloft.net> Date: 2009-08-14 19:49:26
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Fri, 14 Aug 2009 17:56:40 +1000
On Thu, 2009-08-13 at 16:40 +0100, Catalin Marinas wrote:
quoted
On Thu, 2009-08-13 at 13:01 +1000, Michael Ellerman wrote:
quoted
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Looks alright to me (though I haven't tested it). You can add a
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Actually, Milton pointed to me that we may not want to allow all
LMB chunks to be scanned by kmemleaks, things like the DART hole
that's taken out of the linear mapping for example may need to
be avoided, though I'm not sure what would be the right way to
do it.
I think that annotating LMB for kmemleak may be more problems
that it's worth.
I can't think of any specific problems like the DART thing on
sparc64, but I'm sure that as soon as someone starts trying
to test this they'll run into one thing or another :-)
On Fri, 2009-08-14 at 12:49 -0700, David Miller wrote:
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Fri, 14 Aug 2009 17:56:40 +1000
quoted
On Thu, 2009-08-13 at 16:40 +0100, Catalin Marinas wrote:
quoted
On Thu, 2009-08-13 at 13:01 +1000, Michael Ellerman wrote:
quoted
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Looks alright to me (though I haven't tested it). You can add a
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Actually, Milton pointed to me that we may not want to allow all
LMB chunks to be scanned by kmemleaks, things like the DART hole
that's taken out of the linear mapping for example may need to
be avoided, though I'm not sure what would be the right way to
do it.
I think that annotating LMB for kmemleak may be more problems
that it's worth.
BTW, are there many LMB allocations used for storing pointers to other
objects? If not, it may be worth just annotating those with
kmemleak_alloc() if you get false positives.
--
Catalin
From: Michael Ellerman <hidden> Date: 2009-08-20 06:01:38
On Fri, 2009-08-14 at 22:57 +0100, Catalin Marinas wrote:
On Fri, 2009-08-14 at 12:49 -0700, David Miller wrote:
quoted
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: Fri, 14 Aug 2009 17:56:40 +1000
quoted
On Thu, 2009-08-13 at 16:40 +0100, Catalin Marinas wrote:
quoted
On Thu, 2009-08-13 at 13:01 +1000, Michael Ellerman wrote:
quoted
We don't actually want kmemleak to track the lmb allocations, so we
pass min_count as 0. However telling kmemleak about lmb allocations
allows it to scan that memory for pointers to other memory that is
tracked by kmemleak, ie. slab allocations etc.
Looks alright to me (though I haven't tested it). You can add a
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Actually, Milton pointed to me that we may not want to allow all
LMB chunks to be scanned by kmemleaks, things like the DART hole
that's taken out of the linear mapping for example may need to
be avoided, though I'm not sure what would be the right way to
do it.
I think that annotating LMB for kmemleak may be more problems
that it's worth.
BTW, are there many LMB allocations used for storing pointers to other
objects? If not, it may be worth just annotating those with
kmemleak_alloc() if you get false positives.
Yeah I think that's probably the safer approach. As Dave says even if
there's nothing obvious, lmb is used for very early allocs which are
more likely to be "special" and cause problems - and only when someone
boots with kmemleak enabled. So we're better to explicitly mark things
we want scanned.
cheers