linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/dart: Drop unnecessary call to kmemleak_no_scan()
@ 2024-04-19 11:59 Michael Ellerman
  2024-05-03 10:41 ` Michael Ellerman
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Ellerman @ 2024-04-19 11:59 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: erhard_f

Erhard reported that kmemleak was showing a warning at boot:

  kmemleak: Not scanning unknown object at 0xc00000007f000000
  CPU: 0 PID: 0 Comm: swapper Not tainted 5.19.0-rc3-PMacG5+ #2
  Call Trace:
   .dump_stack_lvl+0x7c/0xc4 (unreliable)
   .kmemleak_no_scan+0xe0/0x100
   .iommu_init_early_dart+0x2f0/0x924
   .pmac_probe+0x1b0/0x20c
   .setup_arch+0x1b8/0x674
   .start_kernel+0xdc/0xb74
   start_here_common+0x1c/0x44
  DART table allocated at: (____ptrval____)

Which he bisected to a change in kmemleak, commit
23c2d497de21 ("mm: kmemleak: take a full lowmem check in kmemleak_*_phys()").

Because pmac_probe() is called before mem_topology_setup(), the min/
max PFN variables are still zero. That causes kmemleak_alloc_phys() to
ignore the allocation, because the checks against the PFN fail. Then
kmemleak_no_scan() can't find the allocation and prints warning.

Given that kmemleak_alloc_phys() is ignoring the allocation to begin
with, there's no need to call kmemleak_no_scan() at all, which avoids
the warning.

Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://lore.kernel.org/all/bug-216156-206035@https.bugzilla.kernel.org%2F/
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/sysdev/dart_iommu.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/sysdev/dart_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 98096bbfd62e..c0d10c149661 100644
--- a/arch/powerpc/sysdev/dart_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -24,7 +24,6 @@
 #include <linux/suspend.h>
 #include <linux/memblock.h>
 #include <linux/gfp.h>
-#include <linux/kmemleak.h>
 #include <linux/of_address.h>
 #include <asm/io.h>
 #include <asm/iommu.h>
@@ -243,9 +242,6 @@ static void __init allocate_dart(void)
 	if (!dart_tablebase)
 		panic("Failed to allocate 16MB below 2GB for DART table\n");
 
-	/* There is no point scanning the DART space for leaks*/
-	kmemleak_no_scan((void *)dart_tablebase);
-
 	/* Allocate a spare page to map all invalid DART pages. We need to do
 	 * that to work around what looks like a problem with the HT bridge
 	 * prefetching into invalid pages and corrupting data
-- 
2.44.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/dart: Drop unnecessary call to kmemleak_no_scan()
  2024-04-19 11:59 [PATCH] powerpc/dart: Drop unnecessary call to kmemleak_no_scan() Michael Ellerman
@ 2024-05-03 10:41 ` Michael Ellerman
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2024-05-03 10:41 UTC (permalink / raw)
  To: linuxppc-dev, Michael Ellerman; +Cc: erhard_f

On Fri, 19 Apr 2024 21:59:13 +1000, Michael Ellerman wrote:
> Erhard reported that kmemleak was showing a warning at boot:
> 
>   kmemleak: Not scanning unknown object at 0xc00000007f000000
>   CPU: 0 PID: 0 Comm: swapper Not tainted 5.19.0-rc3-PMacG5+ #2
>   Call Trace:
>    .dump_stack_lvl+0x7c/0xc4 (unreliable)
>    .kmemleak_no_scan+0xe0/0x100
>    .iommu_init_early_dart+0x2f0/0x924
>    .pmac_probe+0x1b0/0x20c
>    .setup_arch+0x1b8/0x674
>    .start_kernel+0xdc/0xb74
>    start_here_common+0x1c/0x44
>   DART table allocated at: (____ptrval____)
> 
> [...]

Applied to powerpc/next.

[1/1] powerpc/dart: Drop unnecessary call to kmemleak_no_scan()
      https://git.kernel.org/powerpc/c/4ccae23609f589dd69a593f457f76ee8b0e2d4e0

cheers

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-05-03 10:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-19 11:59 [PATCH] powerpc/dart: Drop unnecessary call to kmemleak_no_scan() Michael Ellerman
2024-05-03 10:41 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).