[PATCH] mm: Fix up memory allocation tracing

Guenter Roeck linux at roeck-us.net
Tue May 6 09:07:01 PDT 2025


On 5/6/25 08:13, Vlastimil Babka wrote:
> On 5/6/25 16:45, Guenter Roeck wrote:
>> intcp_init_early() calls syscon_regmap_lookup_by_compatible() which in
>> turn calls of_syscon_register(). This function allocates memory.
> 
> CCing people for intcp_init_early()
> 
>> intcp_init_early() is called well before kmalloc caches are initialized.
>> As consequence, kmalloc_caches[] entries are NULL, and NULL is passed as
>> kmem_cache argument to __kmalloc_cache_noprof(). While slab_alloc_node()
>> handles this just fine, the trace code unconditionally dereferences it.
>> This results in crashes such as
> 
> OK, so we have crashes that are not deterministic. But also
> intcp_init_early() deterministically fails, right? This means it's called
> before mm_core_init(), and given the "_early" part of the name that's
> probably expected (i.e. I don't think it's due to some random initcall

Yes, it is called before mm_core_init(), from setup_arch(). And, yes,
you are correct, the call to syscon_regmap_lookup_by_compatible() from
intcp_init_early() does indeed fail with -ENOMEM. That is interesting;
I did not realize that. Thanks a lot for noticing.

Please forget this patch; I'll submit an alternative specifically th address
the integratorcp problem. Sorry for the noise.

Guenter




More information about the linux-arm-kernel mailing list