mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Ryan Roberts <ryan.roberts@arm.com>,
	Yang Shi <yang@os.amperecomputing.com>,
	Christoph Lameter <cl@gentwo.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 2/2] arm64/mm: Reject memory removal that splits a kernel leaf mapping
Date: Wed, 4 Mar 2026 14:23:35 +0530	[thread overview]
Message-ID: <e73c1597-9a98-402c-9665-e67c1270cde7@arm.com> (raw)
In-Reply-To: <05e6034d-3493-4961-a97d-a80fff78289b@kernel.org>



On 03/03/26 2:30 PM, David Hildenbrand (Arm) wrote:
>>> I can understand the desire for this check, but I am confused about Fixes:
>>
>> Probably nothing is broken now I guess but the original memory hot remove
>> patch should have taken care of this scenario. Although don't have strong
>> opinions either way. We could drop both "Fixes" and "Closes" tags here if
>> that is preferred.
>>
> 
> We tend to only tag actual fixes. If we consider this a possible fix, we
> should ask ourselves whether this would be stable material.

Ryan had earlier asked for the Cc: stable to be dropped
as this was not an actual fix. But seems like we should
drop these Fixes/Closes tags as well.

> 
> ...
> 
>>>> +		return false;
>>>> +
>>>> +	pgdp = pgd_offset_k(addr);
>>>> +	pgd = pgdp_get(pgdp);
>>>> +	if (!pgd_present(pgd))
>>>> +		return false;
>>>
>>> How could we end up with non-present areas in a range we hotplugged earlier?
>>
>> We might not in reality but in order to be sure just an additional protection.
> 
> I'm rather wondering if this would indicate a real bug somewhere else
> that we would silently swallow.
> 
> Anyhow, no real preference from my side, just something I considered weird.
> 
> [...]
> 
>>>> +
>>>> +static bool can_unmap_without_split(unsigned long pfn, unsigned long nr_pages)
>>>> +{
>>>> +	unsigned long phys_start, phys_end, size, start, end;
>>>> +
>>>> +	phys_start = PFN_PHYS(pfn);
>>>> +	phys_end = phys_start + nr_pages * PAGE_SIZE;
>>>> +
>>>> +	/*
>>>> +	 * PFN range's linear map edges are leaf entry aligned
>>>> +	 */
>>>> +	start = __phys_to_virt(phys_start);
>>>> +	end =  __phys_to_virt(phys_end);
>>>> +	if (addr_splits_kernel_leaf(start) || addr_splits_kernel_leaf(end)) {
>>>> +		pr_warn("[%lx %lx] splits a leaf entry in linear map\n",
>>>> +			phys_start, phys_end);
>>>> +		return false;
>>>> +	}
>>>> +
>>>> +	/*
>>>> +	 * PFN range's vmemmap edges are leaf entry aligned
>>>> +	 */
>>>> +	size = nr_pages * sizeof(struct page);
>>>> +	start = (unsigned long)pfn_to_page(pfn);
>>>> +	end = start + size;
>>>
>>> As arm64 cannot be used with CONFIG_SPARSEMEM (only with
>>> CONFIG_SPARSEMEM_VMEMMAP, as it sets SPARSEMEM_VMEMMAP_ENABLE),
>>> I think you can just do
> 
> Just to clarify:
> 
> What I meant here is: with CONFIG_SPARSEMEM but without
> CONFIG_SPARSEMEM_VMEMMAP.

Alright but does the commit message or pfn_to_page() code
block here needs a comment about this ? OR it is apparent
enough ?

  reply	other threads:[~2026-03-04  8:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-24  6:24 [PATCH V3 0/2] arm64/mm: Enable batched TLB flush in unmap_hotplug_range() Anshuman Khandual
2026-02-24  6:24 ` [PATCH V3 1/2] " Anshuman Khandual
2026-03-02 15:28   ` David Hildenbrand (Arm)
2026-03-03  5:55     ` Anshuman Khandual
2026-02-24  6:24 ` [PATCH V3 2/2] arm64/mm: Reject memory removal that splits a kernel leaf mapping Anshuman Khandual
2026-03-02 15:51   ` David Hildenbrand (Arm)
2026-03-03  4:01     ` Anshuman Khandual
2026-03-03  9:00       ` David Hildenbrand (Arm)
2026-03-04  8:53         ` Anshuman Khandual [this message]
2026-03-04  8:59           ` David Hildenbrand (Arm)
2026-03-02  7:34 ` [PATCH V3 0/2] arm64/mm: Enable batched TLB flush in unmap_hotplug_range() Anshuman Khandual

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=e73c1597-9a98-402c-9665-e67c1270cde7@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=cl@gentwo.org \
    --cc=david@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ryan.roberts@arm.com \
    --cc=will@kernel.org \
    --cc=yang@os.amperecomputing.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

all inboxes | Powered by JetHome®