[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c1504a7-3515-48f2-8ca7-15b2379dea22@arm.com>
Date: Wed, 8 Jan 2025 16:22:15 +0530
From: Anshuman Khandual <anshuman.khandual@....com>
To: Zhenhua Huang <quic_zhenhuah@...cinc.com>,
Catalin Marinas <catalin.marinas@....com>
Cc: will@...nel.org, ardb@...nel.org, ryan.roberts@....com,
mark.rutland@....com, joey.gouly@....com, dave.hansen@...ux.intel.com,
akpm@...ux-foundation.org, chenfeiyang@...ngson.cn, chenhuacai@...nel.org,
linux-mm@...ck.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, quic_tingweiz@...cinc.com,
stable@...r.kernel.org
Subject: Re: [PATCH v4] arm64: mm: Populate vmemmap/linear at the page level
for hotplugged sections
On 1/8/25 15:37, Zhenhua Huang wrote:
>
>>
>>> /*
>>> @@ -1175,9 +1178,21 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node,
>>> int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node,
>>> struct vmem_altmap *altmap)
>>> {
>>> + unsigned long start_pfn;
>>> + struct mem_section *ms;
>>> +
>>> WARN_ON((start < VMEMMAP_START) || (end > VMEMMAP_END));
>>> - if (!IS_ENABLED(CONFIG_ARM64_4K_PAGES))
>>> + start_pfn = page_to_pfn((struct page *)start);
>>> + ms = __pfn_to_section(start_pfn);
>>
>> Hmm, it would have been better if the core code provided the start pfn
>> as it does for vmemmap_populate_compound_pages() but I'm fine with
>> deducting it from 'start'.
>
> I found another bug, that even for early section, when vmemmap_populate is called, SECTION_IS_EARLY is not set. Therefore, early_section() always return false.
Hmm, well that's unexpected.
>
> Since vmemmap_populate() occurs during section initialization, it may be hard to say it is a bug..
> However, should we instead using SECTION_MARKED_PRESENT to check? I tested well in my setup.
>
> Hot plug flow:
> 1. section_activate -> vmemmap_populate
> 2. mark PRESENT
>
> In contrast, the early flow:
> 1. memblocks_present -> mark PRESENT
> 2. __populate_section_memmap -> vmemmap_populate
But from a semantics perspective, should SECTION_MARKED_PRESENT be marked on a
section before SECTION_IS_EARLY ? Is it really the expected behaviour here or
that needs to be fixed first ?
Although SYSTEM_BOOTING state check might help but section flag seems to be the
right thing to do here.
Powered by blists - more mailing lists