[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87eda442cl.fsf@all.your.base.are.belong.to.us>
Date: Tue, 14 May 2024 21:31:38 +0200
From: Björn Töpel <bjorn@...nel.org>
To: Alexandre Ghiti <alexghiti@...osinc.com>
Cc: Albert Ou <aou@...s.berkeley.edu>, David Hildenbrand <david@...hat.com>,
Palmer Dabbelt <palmer@...belt.com>, Paul Walmsley
<paul.walmsley@...ive.com>, linux-riscv@...ts.infradead.org,
Björn Töpel
<bjorn@...osinc.com>, Andrew Bresticker <abrestic@...osinc.com>, Chethan
Seshadri <Chethan.Seshadri@...alinasystems.io>, Lorenzo Stoakes
<lstoakes@...il.com>, Oscar Salvador <osalvador@...e.de>, Santosh Mamila
<santosh.mamila@...alinasystems.io>, Sivakumar Munnangi
<siva.munnangi@...alinasystems.io>, Sunil V L <sunilvl@...tanamicro.com>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
virtualization@...ts.linux-foundation.org
Subject: Re: [PATCH v2 4/8] riscv: mm: Add memory hotplugging support
Alexandre Ghiti <alexghiti@...osinc.com> writes:
> On Tue, May 14, 2024 at 4:05 PM Björn Töpel <bjorn@...nel.org> wrote:
>> +int __ref arch_add_memory(int nid, u64 start, u64 size, struct mhp_params *params)
>> +{
>> + int ret;
>> +
>> + create_linear_mapping_range(start, start + size, 0, ¶ms->pgprot);
>> + flush_tlb_all();
>> + ret = __add_pages(nid, start >> PAGE_SHIFT, size >> PAGE_SHIFT, params);
>> + if (ret) {
>> + remove_linear_mapping(start, size);
>> + return ret;
>> + }
>> +
>
> You need to flush the TLB here too since __add_pages() populates the
> page table with the new vmemmap mapping (only because riscv allows to
> cache invalid entries, I'll adapt this in my next version of Svvptc
> support).
>
>> + max_pfn = PFN_UP(start + size);
>> + max_low_pfn = max_pfn;
>> + return 0;
>> +}
>> +
>> +void __ref arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
>> +{
>> + __remove_pages(start >> PAGE_SHIFT, size >> PAGE_SHIFT, altmap);
>> + remove_linear_mapping(start, size);
>
> You need to flush the TLB here too.
I'll address all of the above in the next version. Thanks for reviewing
the series!
Björn
Powered by blists - more mailing lists