From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A8FA1643B for ; Fri, 6 Mar 2026 02:46:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772765191; cv=none; b=e6U+2oNIhZ1+b+rEz1FDohM6NFB6ySnva05Z2HzljmTZxNNzXDwVb1Y4RrlsZOxcsic1V6lcBqo/LgSJAQkc0KCT9FBmsOI08v3FimOJc7GG1K56/0ljbg75hs+qW+q78TqOf+VchJfEm2k2ZgA2mfhYPQxN4UFd7Ihm8h1LWBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772765191; c=relaxed/simple; bh=Pu7+CqPrVVKYE7EAa7Dgah8ZPIFhlrVy5BN04+8vPqo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lSEJ/9oKNVLFdcRIH1UBmmhJpk9TebNj75SKVCfnBFsJLYhpKx9hmjVLbSoQU9HwE0GGbpQ/ri9FEUPlIZ5fwGTueHKZStffDCCDrXjZVJf/KgTffa+5tEp38iWDxj0EkAliLyS9oTR5swCJG7JnG6IMvTskwd5oL2MrmB3sTps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 025EC1655; Thu, 5 Mar 2026 18:46:22 -0800 (PST) Received: from [10.164.18.48] (unknown [10.164.18.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C857D3F694; Thu, 5 Mar 2026 18:46:25 -0800 (PST) Message-ID: <3e16b499-9209-4e62-99e9-791ef68d7b02@arm.com> Date: Fri, 6 Mar 2026 08:16:22 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V4 2/2] arm64/mm: Reject memory removal that splits a kernel leaf mapping To: "David Hildenbrand (Arm)" , linux-arm-kernel@lists.infradead.org Cc: Catalin Marinas , Will Deacon , Ryan Roberts , Yang Shi , Christoph Lameter , linux-kernel@vger.kernel.org References: <20260305053148.3765710-1-anshuman.khandual@arm.com> <20260305053148.3765710-3-anshuman.khandual@arm.com> <3884dd41-8ab1-45ee-8daa-198384d59c20@kernel.org> Content-Language: en-US From: Anshuman Khandual In-Reply-To: <3884dd41-8ab1-45ee-8daa-198384d59c20@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 05/03/26 6:09 PM, David Hildenbrand (Arm) wrote: > On 3/5/26 13:37, David Hildenbrand (Arm) wrote: >> On 3/5/26 06:31, Anshuman Khandual wrote: >>> Linear and vmemmap mappings that get torn down during a memory hot remove >>> operation might contain leaf level entries on any page table level. If the >>> requested memory range's linear or vmemmap mappings falls within such leaf >>> entries, new mappings need to be created for the remaining memory mapped on >>> the leaf entry earlier, following standard break before make aka BBM rules. >>> But kernel cannot tolerate BBM and hence remapping to fine grained leaves >>> would not be possible on systems without BBML2_NOABORT. >>> >>> Currently memory hot remove operation does not perform such restructuring, >>> and so removing memory ranges that could split a kernel leaf level mapping >>> need to be rejected. >>> >>> While memory_hotplug.c does appear to permit hot removing arbitrary ranges >>> of memory, the higher layers that drive memory_hotplug (e.g. ACPI, virtio, >>> ...) all appear to treat memory as fixed size devices. So it is impossible >>> to hot unplug a different amount than was previously hot plugged, and hence >>> we should never see a rejection in practice, but adding the check makes us >>> robust against a future change. >>> >>> Cc: Catalin Marinas >>> Cc: Will Deacon >>> Cc: linux-arm-kernel@lists.infradead.org >>> Cc: linux-kernel@vger.kernel.org >>> Link: https://lore.kernel.org/all/aWZYXhrT6D2M-7-N@willie-the-truck/ >>> Reviewed-by: Ryan Roberts >>> Suggested-by: Ryan Roberts >>> Signed-off-by: Anshuman Khandual >>> --- >> >> [...] >> >>> + >>> + /* >>> + * PFN range's linear map edges are leaf entry aligned >>> + */ >> >> Nit: single-line comments are usually written as >> >> /* ... */ >> >>> + 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 >>> + */ >> >> Dito. >> >> LGTM, thanks! >> >> Acked-by: David Hildenbrand (Arm) >> > > In fact, > > Reviewed-by: David Hildenbrand (Arm) > > :) > Thanks for the review. Sure, will respin with the comment fixes next week.