From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1645B606A32C for ; Thu, 3 Dec 2026 15:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gjLFPTbW Received: by kanga.kvack.org (Postfix) id 1D0126B05C7; Thu, 3 Dec 2026 10:38:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A8466B05C8; Thu, 3 Dec 2026 10:38:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BDED6B05C9; Thu, 3 Dec 2026 10:38:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id D9BD26B05C7 for ; Thu, 3 Dec 2026 10:38:10 -0500 (EST) Received: from smtpin18.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6E5B616076A for ; Thu, 3 Dec 2026 15:38:10 +0000 (UTC) X-FDA: 85503077940.18.77CEED2 Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by imf20.hostedemail.com (Postfix) with ESMTP id B100D1C0004 for ; Thu, 3 Dec 2026 15:38:08 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=gjLFPTbW; spf=pass (imf20.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796312288; b=iOQVrhXScPqwtpGPftd2B0CRdavZ3FT8yeV609Vo2pzgolrthEPCxQC/qs3CS6uIvO2/Sf KBaltC7Ctjerw1bh96/ebPkcVyhTl9lWa/CBGP04fzpP1m4bC8Fa2qe3+lS5cR43acG875 NjI+IAMtvHGcPRMDQEW9hlLMDTPJh3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796312288; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IjrzOZ31X1vJt70WPkoj61/vZw84necopAVxlH+fbec=; b=nTkU6QtdCF+Rfyuwgo9gXiAvZLE/1KYdkvMMxJYo/nt79bDTy4gE71iPxHN3T3oOBLZ5og DUBDpwkPwK1ZgcvlY7/r7nTF9WQB78Co1h8SwEJfumRhnSrcdMhBfbS+xmo0M/lnsMZ6dj t0kn6IcdZJfgzhM51GoqGZB+hddatjE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20260515 header.b=gjLFPTbW; spf=pass (imf20.hostedemail.com: domain of sashiko-bot@kernel.org designates 172.234.252.31 as permitted sender) smtp.mailfrom=sashiko-bot@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 0A6AE44825; Thu, 3 Dec 2026 15:38:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D3151F00893; Thu, 3 Dec 2026 15:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796312287; bh=IjrzOZ31X1vJt70WPkoj61/vZw84necopAVxlH+fbec=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=gjLFPTbWfICWU5iz8kNU4dQzjCdOGNsoTLBPulJvuxjbkR+5AAaONobifi5nKA1Su iMzoqqmAF+Hb2MWSlx4h+HC1Pk1i9ouYAM8ka9N96dDgLGecQpnnnjJfPbumtx4VTa 3Aqlw+mpPli4nxXDeVvH8kt0msTYcVaUmy12lARh5EkKAQWaD5fFzJUn5UNZVL7IWZ r5nZDEjGrVVE32ns3J/FlMtie5FgsJds6MNHQyOgBbE2g3h/dzQBJoavb8yjVS7u6B eQb+0VKQPeFEXi2tJmYdYpM3HmaiPEuIAuntgiL5wVaJTV+/X1PwIoPx9s77Q1zk+1 mSVLVVx/34ZNQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2] selftests/mm: improve memory hotplug test reliability Reply-To: sashiko-reviews@lists.linux.dev To: "Rama Krishna Katta" , david@kernel.org, osalvador@suse.de, shuah@kernel.org Cc: linux-mm@kvack.org, linux-cxl@vger.kernel.org, "Annam Sai Manisha" In-Reply-To: <20261202204303.2777765-1-ramakrishna.katta@arm.com> References: <20261202204303.2777765-1-ramakrishna.katta@arm.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 15:38:07 +0000 X-Rspamd-Queue-Id: B100D1C0004 X-Rspamd-Server: rspam03 X-Stat-Signature: z88tguei4pznr4swpc1qb3c6zf39toty X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Rspam-User: X-HE-Tag: 1796312288-600879 X-HE-Meta: U2FsdGVkX1/5F8iWIVEQTjJlf87u6VnNjieyJd9qphfi5L7gr1Px1WmoA1TVkffKu1ok6A/jT4rMoXZrFLg8THu61AUxofdSeWFEWv8MT+kBItVjinuQCdwOAJnMD0to+Mw4scXHWYYV2cn519TIhGS9kf3urHIOwFutCHB8PKhVVJn2j9o9NCwkv1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hzjDqMdWigUivIgKH+QkM3IRvRsGJgYBMfmJK3L9EadxWJf17ujh/CSZ0aUwbSABhmGT0lZBmpwKlrqTCbbkHOQfO5s84DuRgBMCcJmLpPyjwlB2Iky6eYgFU/SRCfDxVipJN3BGLLQB1kcZUAWe0UDHndroBGWogfu/ifYRjV/rkt/e2HYSBWGbQs+/TnxCxtTnnfgEr9tPnl01gFPUSKZTmMk5E0peSvJvnjZ3DdqgCI66DtTCl9NQJm3xPx4T3jUfQIzcicf+UYqvB3ZxCx1kou/xCJ6YizUUDpfScniIcphNXV0rpu38I2WueD/sT4Enl2BoTRTrdwnBGOnIEGBz5zDybxE8c1hzdMWDcR21brdeubzNPuYZvdQ08QmWK/HyLLvf2NAY5Sz5YmNuf6RZv2zf3gmM1mo0EBI+nqdmy+YQ+lox0zMhfvwT/e1Ow7CfP5toG+wA3sS+5VMz1zo8Gt0UTY41QgFNSnq/pRwHUwmjUHjsZgNhkB+PA11C2pQHlT9XL9gJLufgVlh26vpHllgCjId5+iE4pj7a+jT4b9RopU6+0IPCZJl7quM0Tc/rrYl4i0jIgRDP0W Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] selftests/mm: DMA/DMA32 zone restoration failure in restore_memory_block() - [Medium] selftests/mm: out-of-tree run_hotplug failure in run_full_test target -- commit b63a4a9a717654c3ff50e9a2c850549c49f04eec Author: Rama Krishna Katta selftests/mm: improve memory hotplug test reliability This commit converts the memory hotplug selftest to KTAP, bounds memory block selection and offlining attempts, and adds cleanup to restore each block's initial state and zone. > diff --git a/tools/testing/selftests/memory-hotplug/Makefile b/tools/test= ing/selftests/memory-hotplug/Makefile > index e0a625e34f400..078cb59cbd07a 100644 > --- a/tools/testing/selftests/memory-hotplug/Makefile > +++ b/tools/testing/selftests/memory-hotplug/Makefile > @@ -1,11 +1,9 @@ > # SPDX-License-Identifier: GPL-2.0 > -all: > - > -include ../lib.mk > =20 > TEST_PROGS :=3D mem-on-off-test.sh > +TEST_INCLUDES :=3D ../kselftest/ktap_helpers.sh > =20 > -run_full_test: > - @/bin/bash ./mem-on-off-test.sh -r 10 && echo "memory-hotplug selftests= : [PASS]" || echo "memory-hotplug selftests: [FAIL]" > +include ../lib.mk > =20 > -clean: > +.PHONY: run_full_test > +run_full_test: run_tests [Severity: Medium] Does aliasing run_full_test to run_tests break the top-level run_hotplug target for out-of-tree builds (O=3D or KBUILD_OUTPUT=3D)? tools/testing/selftests/Makefile: hotplug: @for TARGET in $(TARGETS_HOTPLUG); do \ BUILD_TARGET=3D$$BUILD/$$TARGET; \ $(MAKE) OUTPUT=3D$$BUILD_TARGET -C $$TARGET;\ done; run_hotplug: hotplug @for TARGET in $(TARGETS_HOTPLUG); do \ BUILD_TARGET=3D$$BUILD/$$TARGET; \ $(MAKE) OUTPUT=3D$$BUILD_TARGET -C $$TARGET run_full_test;\ done; Unlike the top-level all and run_tests targets, hotplug and run_hotplug do not run mkdir -p $$BUILD_TARGET and do not pass SRC_PATH or OBJ_PATH to sub-makes. When building_out_of_srctree is set, lib.mk's run_tests fails to stage TEST_PROGS into a missing $(OUTPUT) directory and runs INSTALL_INCLUDES with SRC_PATH and OBJ_PATH empty, causing INSTALL_INCLUDES to strip only the leading slash from entry_dir, cd to $HOME, and attempt to rsync to /. > diff --git a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh b/= tools/testing/selftests/memory-hotplug/mem-on-off-test.sh > index 611be86eaf3de..654a981fa8a11 100755 > --- a/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh > +++ b/tools/testing/selftests/memory-hotplug/mem-on-off-test.sh [ ... ] > + for path in "${candidates[@]}"; do > + [ "${#test_memory[@]}" -lt "$target" ] || break > + [ "$attempts" -lt "$MAX_OFFLINE_ATTEMPTS" ] || break > + read -r state < "$path/state" || continue > + [ "$state" =3D online ] || continue > + IFS=3D read -r zone < "$path/valid_zones" || continue > + case "$zone" in > + DMA|DMA32|Normal|Movable) ;; > + *) continue ;; > + esac [ ... ] > +restore_memory_block() > +{ > + local block=3D$1 type=3Dkernel zone=3D${initial_zone[$1]} > + > + if [ "${initial_state[$block]}" =3D offline ]; then > + memory_state_is "$block" offline || > + offline_memory "$block" || return 1 > + memory_state_is "$block" offline > + return > + fi > + > + if memory_state_is "$block" online; then > + memory_zone_is "$block" "$zone" && return 0 > + offline_memory "$block" || return 1 > + fi > + memory_state_is "$block" offline || return 1 > + # online_kernel selects a kernel zone; verify the exact original zone. > + [ "$zone" !=3D Movable ] || type=3Dmovable > + online_memory "$block" "$type" || return 1 > + memory_state_is "$block" online && memory_zone_is "$block" "$zone" > +} [Severity: Medium] Can restore_memory_block() fail to restore a DMA or DMA32 block to its original zone? When find_test_memory_blocks() offlines a block at the start or end of ZONE_DMA or ZONE_DMA32 (or the last online block in that zone), offline_pages() -> remove_pfn_range_from_zone() -> shrink_zone_span() shrinks the zone span so it no longer covers that block's PFN range. When restore_memory_block() later writes online_kernel, default_kernel_zone_for_pfn() checks whether the PFN range still intersects any zone below ZONE_NORMAL: mm/memory_hotplug.c:default_kernel_zone_for_pfn() { for (zid =3D 0; zid < ZONE_NORMAL; zid++) { struct zone *zone =3D &pgdat->node_zones[zid]; if (zone_intersects(zone, start_pfn, nr_pages)) return zone; } return &pgdat->node_zones[ZONE_NORMAL]; } Because the shrunken DMA or DMA32 zone span no longer intersects the block, the kernel places the block into ZONE_NORMAL, causing the memory_zone_is check to fail and leaving the block in ZONE_NORMAL. Should find_test_memory_blocks() only select online blocks from Normal and Movable zones? --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202204303.2777= 765-1-ramakrishna.katta@arm.com?part=3D1