From: David Hildenbrand <david@redhat.com>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
linuxppc-dev@lists.ozlabs.org
Cc: linux-mm@kvack.org, Sourabh Jain <sourabhjain@linux.ibm.com>,
Hari Bathini <hbathini@linux.ibm.com>, Zi Yan <ziy@nvidia.com>,
"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
Mahesh J Salgaonkar <mahesh@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
Donet Tom <donettom@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
Sachin P Bappalige <sachinpb@linux.ibm.com>
Subject: Re: [RFC v2 1/4] cma: Enforce non-zero pageblock_order during cma_init_reserved_mem()
Date: Fri, 11 Oct 2024 12:12:48 +0200 [thread overview]
Message-ID: <e894f6f2-d93f-4787-af40-7f021a40b156@redhat.com> (raw)
In-Reply-To: <8579f887412720bd6f2fbce513c1c9904772ead4.1728585512.git.ritesh.list@gmail.com>
On 11.10.24 09:23, Ritesh Harjani (IBM) wrote:
> cma_init_reserved_mem() checks base and size alignment with
> CMA_MIN_ALIGNMENT_BYTES. However, some users might call this during
> early boot when pageblock_order is 0. That means if base and size does
> not have pageblock_order alignment, it can cause functional failures
> during cma activate area.
>
> So let's enforce pageblock_order to be non-zero during
> cma_init_reserved_mem().
>
> Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> ---
> mm/cma.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/cma.c b/mm/cma.c
> index 3e9724716bad..36d753e7a0bf 100644
> --- a/mm/cma.c
> +++ b/mm/cma.c
> @@ -182,6 +182,15 @@ int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
> if (!size || !memblock_is_region_reserved(base, size))
> return -EINVAL;
>
> + /*
> + * CMA uses CMA_MIN_ALIGNMENT_BYTES as alignment requirement which
> + * needs pageblock_order to be initialized. Let's enforce it.
> + */
> + if (!pageblock_order) {
> + pr_err("pageblock_order not yet initialized. Called during early boot?\n");
> + return -EINVAL;
> + }
> +
> /* ensure minimal alignment required by mm core */
> if (!IS_ALIGNED(base | size, CMA_MIN_ALIGNMENT_BYTES))
> return -EINVAL;
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-10-11 10:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 7:23 [RFC v2 0/4] cma: powerpc fadump fixes Ritesh Harjani (IBM)
2024-10-11 7:23 ` [RFC v2 1/4] cma: Enforce non-zero pageblock_order during cma_init_reserved_mem() Ritesh Harjani (IBM)
2024-10-11 10:12 ` David Hildenbrand [this message]
2024-10-11 7:23 ` [RFC v2 2/4] fadump: Refactor and prepare fadump_cma_init for late init Ritesh Harjani (IBM)
2024-10-11 7:23 ` [RFC v2 3/4] fadump: Reserve page-aligned boot_memory_size during fadump_reserve_mem Ritesh Harjani (IBM)
2024-10-11 10:51 ` Hari Bathini
2024-10-11 7:23 ` [RFC v2 4/4] fadump: Move fadump_cma_init to setup_arch() after initmem_init() Ritesh Harjani (IBM)
2024-10-11 10:17 ` [RFC v2 0/4] cma: powerpc fadump fixes Michael Ellerman
2024-10-11 10:25 ` David Hildenbrand
2024-10-11 11:00 ` Ritesh Harjani
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=e894f6f2-d93f-4787-af40-7f021a40b156@redhat.com \
--to=david@redhat.com \
--cc=aneesh.kumar@kernel.org \
--cc=donettom@linux.vnet.ibm.com \
--cc=hbathini@linux.ibm.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mahesh@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=ritesh.list@gmail.com \
--cc=sachinpb@linux.ibm.com \
--cc=sourabhjain@linux.ibm.com \
--cc=ziy@nvidia.com \
/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