From: Guillaume Tucker <guillaume.tucker@collabora.com>
To: Mike Kravetz <mike.kravetz@oracle.com>,
"Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mips@vger.kernel.org" <linux-mips@vger.kernel.org>
Cc: Aslan Bakirov <aslan@fb.com>,
kernelci-results@groups.io, Joonsoo Kim <js1304@gmail.com>,
Rik van Riel <riel@surriel.com>, Michal Hocko <mhocko@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Will Deacon <will@kernel.org>, Roman Gushchin <guro@fb.com>,
Mike Rapoport <rppt@kernel.org>
Subject: Re: [PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS
Date: Wed, 16 Sep 2020 22:59:48 +0100 [thread overview]
Message-ID: <70ad632d-88f3-db6d-3493-b09451150298@collabora.com> (raw)
In-Reply-To: <2bf99eee-29b1-4965-da7d-d4e341803440@oracle.com>
On 16/09/2020 17:30, Mike Kravetz wrote:
> On 9/16/20 2:14 AM, Song Bao Hua (Barry Song) wrote:
>>>> -----Original Message-----
>>>> From: Mike Kravetz [mailto:mike.kravetz@oracle.com]
>>>> Sent: Wednesday, September 16, 2020 8:57 AM
>>>> To: linux-mm@kvack.org; linux-kernel@vger.kernel.org;
>>>> linux-arm-kernel@lists.infradead.org; linux-mips@vger.kernel.org
>>>> Cc: Roman Gushchin <guro@fb.com>; Song Bao Hua (Barry Song)
>>>> <song.bao.hua@hisilicon.com>; Mike Rapoport <rppt@kernel.org>; Joonsoo
>>>> Kim <js1304@gmail.com>; Rik van Riel <riel@surriel.com>; Aslan Bakirov
>>>> <aslan@fb.com>; Michal Hocko <mhocko@kernel.org>; Andrew Morton
>>>> <akpm@linux-foundation.org>; Mike Kravetz <mike.kravetz@oracle.com>
>>>> Subject: [PATCH] cma: make number of CMA areas dynamic, remove
>>>> CONFIG_CMA_AREAS
>>>>
>>>> The number of distinct CMA areas is limited by the constant
>>>> CONFIG_CMA_AREAS. In most environments, this was set to a default
>>>> value of 7. Not too long ago, support was added to allocate hugetlb
>>>> gigantic pages from CMA. More recent changes to make
>>> dma_alloc_coherent
>>>> NUMA-aware on arm64 added more potential users of CMA areas. Along
>>>> with the dma_alloc_coherent changes, the default value of CMA_AREAS
>>>> was bumped up to 19 if NUMA is enabled.
>>>>
>>>> It seems that the number of CMA users is likely to grow. Instead of
>>>> using a static array for cma areas, use a simple linked list. These
>>>> areas are used before normal memory allocators, so use the memblock
>>>> allocator.
>>>>
>>>> Acked-by: Roman Gushchin <guro@fb.com>
>>>> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
>>>> ---
>>>> rfc->v1
>>>> - Made minor changes suggested by Song Bao Hua (Barry Song)
>>>> - Removed check for late calls to cma_init_reserved_mem that was part
>>>> of RFC.
>>>> - Added ACK from Roman Gushchin
>>>> - Still in need of arm testing
>>>
>>> Unfortunately, the test result on my arm64 board is negative, Linux can't boot
>>> after applying
>>> this patch.
>>>
>>> I guess we have to hold on this patch for a while till this is fixed. BTW, Mike, do
>>> you have
>>> a qemu-based arm64 numa system to debug? It is very easy to reproduce, we
>>> don't need to
>>> use hugetlb_cma and pernuma_cma. Just the default cma will make the boot
>>> hang.
>>
>> Hi Mike,
>> I spent some time on debugging the boot issue and sent a patch here:
>> https://lore.kernel.org/linux-mm/20200916085933.25220-1-song.bao.hua@hisilicon.com/
>> All details and knic oops can be found there.
>> pls feel free to merge my patch into your v2 if you want. And we probably need ack from
>> arm maintainers.
>>
>> Also, +Will,
>>
>> Hi Will, the whole story is that Mike tried to remove the cma array with CONFIG_CMA_AREAS
>> and moved to use memblock_alloc() to allocate cma area, so that the number of cma areas
>> could be dynamic. It turns out it causes a kernel panic on arm64 during system boot as the
>> returned address from memblock_alloc is invalid before paging_init() is done on arm64.
>>
>
> Thank you!
>
> Based on your analysis, I am concerned that other architectures may also
> have issues.
>
> Andrew,
> I suggest we remove this patch from your tree. I will audit all architectures
> which enable CMA and look for similar issues there. Will then merge Barry's
> patch into a V2 with any other arch specific changes.
FYI This was also bisected on kernelci.org[1] and it landed on
this commit: c999bd436fe9 ("mm/cma: make number of CMA areas
dynamic, remove CONFIG_CMA_AREAS"). Only arm and arm64 seem to
be affected, and not with all the builds:
https://kernelci.org/test/job/next/branch/master/kernel/next-20200916/plan/baseline/
The list of failures above might help someone debug the issue
with a platform they have at hand.
Guillaume
[1] https://groups.io/g/kernelci-results-staging/message/2027
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
prev parent reply other threads:[~2020-09-16 22:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-15 20:57 [PATCH] cma: make number of CMA areas dynamic, remove CONFIG_CMA_AREAS Mike Kravetz
2020-09-16 6:21 ` Song Bao Hua (Barry Song)
2020-09-16 9:14 ` Song Bao Hua (Barry Song)
2020-09-16 16:30 ` Mike Kravetz
2020-09-16 21:59 ` Guillaume Tucker [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=70ad632d-88f3-db6d-3493-b09451150298@collabora.com \
--to=guillaume.tucker@collabora.com \
--cc=akpm@linux-foundation.org \
--cc=aslan@fb.com \
--cc=guro@fb.com \
--cc=js1304@gmail.com \
--cc=kernelci-results@groups.io \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=song.bao.hua@hisilicon.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).