From nobody Fri Sep 25 02:42:04 2026 Received: from mta0.migadu.com (out-117.mta0.migadu.com [91.218.175.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A05044DD3AA for ; Thu, 17 Sep 2026 11:46:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.117 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789645569; cv=none; b=fP/CrfgPy+OBxycKwPv6WToDYZu9sYF1JCHgUGK8SuNbn7pkm0nZb0sOVsdFE6T/jYI0aIPFQCn4FkBVcmM+rw+0q5B4FNmvqrOqk6uswplcw/O97vRGkiDXki4c+CmUTTuWI1fn9a7mbwSqb/1eBv8QGSth8jGFD5cldztmAwI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789645569; c=relaxed/simple; bh=/5LbqE2HaIAymwXyigxpXa2Ct6zVBx0/LuQcM40Dhxg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FJ4PLGh5x6OhUPAhead61+VG1bByQXenMfiDSCdgR7T5rS/POKJbcKfzVGn8cOKM5TF9GdAmUkCSu1YFQR7SZOOMjVP893hG0KBEOWWnqSGK81/BiXoISQCiFNIU6v6ngeCDiuL+IAdNckYLt0UILcG+uX22ZEERqcl5xVCK35M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=WHMqLI8M; arc=none smtp.client-ip=91.218.175.117 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WHMqLI8M" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=/5LbqE2HaIAymwXyigxpXa2Ct6zVBx0/LuQcM40Dhxg=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789645559; v=1; x=1790250359; b=WHMqLI8M3qe4hnAUG9ubM1OalvIA9Shcvouj895mfhex74LI7W9vTFqKIBy+zIYLcrwwnq2n NZThg4dgKkl/I9G/GTIlvjydxVeMbsoEIN4QOe3eZZGGt6yqN+YVII+CAeih/G7ybQaXh3j4Zfr uwlmQ9SeYDAl2Slct1dkHF6w= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 63a91e1a8f4e2f13; Thu, 17 Sep 2026 11:45:59 +0000 X-Mizu-Trace-ID: 63a91e1a8f4e2f13 X-Migadu-Flow: FLOW_OUT From: Zenghui Yu To: kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, "Zenghui Yu (Huawei)" Subject: [PATCH 1/3] KVM: selftests: Fix access_tracking_perf_test for larger host page size Date: Thu, 17 Sep 2026 19:45:41 +0800 Message-ID: <20260917114543.85044-2-zenghui.yu@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917114543.85044-1-zenghui.yu@linux.dev> References: <20260917114543.85044-1-zenghui.yu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Zenghui Yu (Huawei)" access_tracking_perf_test marks guest memory idle through page_idle by walking its test region one guest page at a time and checking/marking the host PFN backing each guest page. The walk assumes that every guest page maps to a distinct host page, which only holds when the guest page size is >=3D the host page size. On an arm64 host with 64K pages, the test also runs guest modes that use 4K pages, where 16 consecutive guest pages are backed by one host page. The first of them marks the shared host page idle and the other 15 then see the page as already idle and count it as "still idle", inflating still_idle to ~94% and failing the test: $ ./access_tracking_perf_test Random seed: 0x1c04f013 lru_gen: Could not open /sys/kernel/mm/lru_gen/enabled Using page_idle for aging Testing guest mode: PA-bits:48, VA-bits:48, 4K pages __vm_create: mode=3D'PA-bits:48, VA-bits:48, 4K pages' type=3D'0', page= s=3D'1696' guest physical test memory: [0xffffbfff0000, 0xffffffff0000) Populating memory : 0.299047690s Writing to populated memory : 0.008723980s Reading from populated memory : 0.010692350s =3D=3D=3D=3D Test Assertion Failure =3D=3D=3D=3D access_tracking_perf_test.c:164: idle_pages_warn_only pid=3D3503998 tid=3D3504006 errno=3D4 - Interrupted system call 1 0x000000000040308f: too_many_idle_pages at access_tracking_perf_te= st.c:164 2 (inlined by) pageidle_mark_vcpu_memory_idle at access_tracking_pe= rf_test.c:229 3 (inlined by) vcpu_thread_main at access_tracking_perf_test.c:339 4 0x000000000040a267: vcpu_thread_main at memstress.c:277 5 0x00007fff958ef09b: ?? ??:0 6 0x00007fff959548db: ?? ??:0 vCPU0: Too many pages still idle (245647 out of 262144) Idle tracking is fundamentally per host page though. Walk the region in units of the larger of the guest and host page size instead. This changes nothing when the guest page size is >=3D the host's - if the guest page is bigger, the guest only ever faults the first host page of each guest page anyway. Assisted-by: GLM-5.3 OpenCode Signed-off-by: Zenghui Yu (Huawei) --- .../selftests/kvm/access_tracking_perf_test.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tool= s/testing/selftests/kvm/access_tracking_perf_test.c index 4415c94b2866..bcdfeb9c22d8 100644 --- a/tools/testing/selftests/kvm/access_tracking_perf_test.c +++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c @@ -175,8 +175,8 @@ static void pageidle_mark_vcpu_memory_idle(struct kvm_v= m *vm, { int vcpu_idx =3D vcpu_args->vcpu_idx; gva_t base_gva =3D vcpu_args->gva; - u64 pages =3D vcpu_args->pages; - u64 page; + u64 idle_page_size; + u64 pages, page; u64 still_idle =3D 0; u64 no_pfn =3D 0; int page_idle_fd; @@ -192,8 +192,18 @@ static void pageidle_mark_vcpu_memory_idle(struct kvm_= vm *vm, pagemap_fd =3D open("/proc/self/pagemap", O_RDONLY); TEST_ASSERT(pagemap_fd > 0, "Failed to open pagemap."); =20 + /* + * Idle tracking operates on host pages, so walk the region in units of + * the larger of the guest and host page size. If the host page is the + * bigger one, several guest pages are backed by one host page and + * checking/marking the same PFN once per guest page would make the + * sanity check below count the shared page as still idle. + */ + idle_page_size =3D max_t(u64, memstress_args.guest_page_size, getpagesize= ()); + pages =3D vcpu_args->pages * memstress_args.guest_page_size / idle_page_s= ize; + for (page =3D 0; page < pages; page++) { - gva_t gva =3D base_gva + page * memstress_args.guest_page_size; + gva_t gva =3D base_gva + page * idle_page_size; u64 pfn =3D lookup_pfn(pagemap_fd, vm, gva); =20 if (!pfn) { --=20 2.53.0 From nobody Fri Sep 25 02:42:04 2026 Received: from mta0.migadu.com (out-124.mta0.migadu.com [91.218.175.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DDE64DE71D for ; Thu, 17 Sep 2026 11:46:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789645576; cv=none; b=nidhpy76ghUc9diYSygP5zodFRuLJJJlsVkxDgeCUX3HWwmCCoBdzqCxGxwRjsVMNhzkqYV6h0qKDEDwLJdn9oLef6O00fVAsbyvC0gDTAZj8SN3Hm0xKIc50vV2R73wEvB2+EVJYlpD3Q8Wl+++UmN2G73aAdh7KrmPbUHbmuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789645576; c=relaxed/simple; bh=qDI4BZ1rw9EhNWsZxeTYF88y9ggTNgPhlWojNlf71ak=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cRLbK+7V5qI8k47p8q0x9pAWLQuRtuortcTDHQvrERMBYl+W4XeZzPEAof0LQM9wB5r3C7LAYzmUdMLT/pA5vZ5ViFG3dAK+dCQPOCSNjVT5bw+u56OFgj0AjDYSJP6ypjW3Die0ncmCe4DoO1x+JmWOpeEfFMQxPQ+40+H6dsU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=CoMPZ8i3; arc=none smtp.client-ip=91.218.175.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="CoMPZ8i3" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=qDI4BZ1rw9EhNWsZxeTYF88y9ggTNgPhlWojNlf71ak=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789645566; v=1; x=1790250366; b=CoMPZ8i3K64LDNHT4dzLO6DwE5ruXzSnarwzy0cYenxMi+RmocFaWdAd5csnL3ZnjJVRDaRk GKg97chSjzIEX9K2QvAcg0dnFULuB3+m31vklo9UzqtVdFx4zk2veWll3MzvZs5ktvjwJ7mynBv hXoDHct4BTg9xpWKW1q+PHXs= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 92ac47b8f8b690fb; Thu, 17 Sep 2026 11:46:06 +0000 X-Mizu-Trace-ID: 92ac47b8f8b690fb X-Migadu-Flow: FLOW_OUT From: Zenghui Yu To: kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, "Zenghui Yu (Huawei)" Subject: [PATCH 2/3] KVM: selftests: Add missing newline to access_tracking_perf_test help Date: Thu, 17 Sep 2026 19:45:42 +0800 Message-ID: <20260917114543.85044-3-zenghui.yu@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917114543.85044-1-zenghui.yu@linux.dev> References: <20260917114543.85044-1-zenghui.yu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Zenghui Yu (Huawei)" The help text for the -h option is printed without a trailing newline, so it runs together with the first line of the guest mode help that follows it. Add the missing newline. Signed-off-by: Zenghui Yu (Huawei) --- tools/testing/selftests/kvm/access_tracking_perf_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tool= s/testing/selftests/kvm/access_tracking_perf_test.c index bcdfeb9c22d8..98ace8b8b4ac 100644 --- a/tools/testing/selftests/kvm/access_tracking_perf_test.c +++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c @@ -504,7 +504,7 @@ static void help(char *name) printf("usage: %s [-h] [-m mode] [-b vcpu_bytes] [-v vcpus] [-o] [-s mem= _type]\n", name); puts(""); - printf(" -h: Display this help message."); + printf(" -h: Display this help message.\n"); guest_modes_help(); printf(" -b: specify the size of the memory region which should be\n" " dirtied by each vCPU. e.g. 10M or 3G.\n" --=20 2.53.0 From nobody Fri Sep 25 02:42:04 2026 Received: from mta0.migadu.com (out-132.mta0.migadu.com [91.218.175.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F0DC14BD34E for ; Thu, 17 Sep 2026 11:46:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.132 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789645583; cv=none; b=au2A7VS+g1bax46PA8DrCAmiMgxs7zbYqXuprjBpLcys+vRj6tEMGDSMaZQdRdMXKnpInZES78KpEW4zf8v7PxRNrUEMd8PuGcyn2/VwqgDSAZ50H4/nwE7pW654P65o41mIQML8NnzzvFMkF6MPygYczQGB5rtf73YVk6QQYtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789645583; c=relaxed/simple; bh=I+y/yZhjqmrKJ1vXwT9TgPxkQscaL8DMJp5rQ22dsrc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=a9BZrBvrc6Fqrx5sbcknk1Envb9jIa94JbkNkuDpNuCiLk7k0aoKh/U834/jzIy+IuPTJCp4W8JC3XJPhRwWvyMT6cAzZUBCaxMDEyUUyK2NGFMFDAiRXdGX6/bkG4B8vpjZv9F+Y7ZHcHTYSjHj6LK0YxBZxyeQxh2L4Z3RZE8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=idNUoWmC; arc=none smtp.client-ip=91.218.175.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="idNUoWmC" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=I+y/yZhjqmrKJ1vXwT9TgPxkQscaL8DMJp5rQ22dsrc=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1789645573; v=1; x=1790250373; b=idNUoWmCSpPAg8zsXKrtRgklDgCHJwseeWf+tM83SaFSBsv2BejnrbtclsPcM79HRu9LHBpz msxKlIsyQCNsjhN5mesfMpIfZrunrROLrHolVWxiaBS0WErevSFh34HshSlpFtmwGgHZSPoVHCB 2MGUpHB4EvfbiImEPiVxgosY= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 9c4b709d4d1133f3; Thu, 17 Sep 2026 11:46:13 +0000 X-Mizu-Trace-ID: 9c4b709d4d1133f3 X-Migadu-Flow: FLOW_OUT From: Zenghui Yu To: kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org Cc: pbonzini@redhat.com, seanjc@google.com, "Zenghui Yu (Huawei)" Subject: [PATCH 3/3] KVM: selftests: Remove destroy_cgroup() from access_tracking_perf_test Date: Thu, 17 Sep 2026 19:45:43 +0800 Message-ID: <20260917114543.85044-4-zenghui.yu@linux.dev> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260917114543.85044-1-zenghui.yu@linux.dev> References: <20260917114543.85044-1-zenghui.yu@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: "Zenghui Yu (Huawei)" destroy_cgroup() is not called anywhere. Remove the dead helper. Signed-off-by: Zenghui Yu (Huawei) --- tools/testing/selftests/kvm/access_tracking_perf_test.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tools/testing/selftests/kvm/access_tracking_perf_test.c b/tool= s/testing/selftests/kvm/access_tracking_perf_test.c index 98ace8b8b4ac..9b83e4efcaf9 100644 --- a/tools/testing/selftests/kvm/access_tracking_perf_test.c +++ b/tools/testing/selftests/kvm/access_tracking_perf_test.c @@ -523,11 +523,6 @@ static void help(char *name) exit(0); } =20 -void destroy_cgroup(char *cg) -{ - printf("Destroying cgroup: %s\n", cg); -} - int main(int argc, char *argv[]) { struct test_params params =3D { --=20 2.53.0