[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3c886941-bf9d-f040-b568-ee7a8eba9a04@free.fr>
Date: Tue, 22 Jan 2019 15:12:54 +0100
From: Marc Gonzalez <marc.w.gonzalez@...e.fr>
To: Mike Rapoport <rppt@...ux.ibm.com>,
Rob Herring <robh+dt@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Prateek Patel <prpatel@...dia.com>,
Sachin Nikam <snikam@...dia.com>,
John Hubbard <jhubbard@...dia.com>,
Ralph Campbell <rcampbell@...dia.com>
Cc: Robin Murphy <robin.murphy@....com>,
Frank Rowand <frowand.list@...il.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Mark Rutland <mark.rutland@....com>,
Arnd Bergmann <arnd@...db.de>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Oscar Salvador <osalvador@...e.de>,
Wei Yang <richard.weiyang@...il.com>,
Michal Hocko <mhocko@...e.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Qian Cai <cai@....pw>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: kmemleak panic
On 22/01/2019 15:02, Marc Gonzalez wrote:
> On 21/01/2019 18:42, Mike Rapoport wrote:
>
>> If I understood correctly, the trouble comes from no-map range allocated in
>> early_init_dt_alloc_reserved_memory_arch().
>>
>> There's indeed imbalance, because memblock_alloc() does kmemleak_alloc(), but
>> memblock_remove() does not do kmemleak_free().
>>
>> I think the best way is to replace __memblock_alloc_base() with
>> memblock_find_in_range(), e.g something like:
>>
>>
>> diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
>> index 1977ee0adcb1..6807a1cffe55 100644
>> --- a/drivers/of/of_reserved_mem.c
>> +++ b/drivers/of/of_reserved_mem.c
>> @@ -37,21 +37,16 @@ int __init __weak early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
>> */
>> end = !end ? MEMBLOCK_ALLOC_ANYWHERE : end;
>> align = !align ? SMP_CACHE_BYTES : align;
>> - base = __memblock_alloc_base(size, align, end);
>> + base = memblock_find_in_range(size, align, start, end);
>> if (!base)
>> return -ENOMEM;
>>
>> - /*
>> - * Check if the allocated region fits in to start..end window
>> - */
>> - if (base < start) {
>> - memblock_free(base, size);
>> - return -ENOMEM;
>> - }
>> -
>> *res_base = base;
>> if (nomap)
>> return memblock_remove(base, size);
>> + else
>> + return memblock_reserve(base, size);
>> +
>> return 0;
>> }
>>
>
> Your patch solves the issue. \o/
[ Add nvidia devs, but drop schowdary@...dia.com ]
Powered by blists - more mailing lists