From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C93449219C for ; Tue, 19 May 2026 11:03:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779188631; cv=none; b=EyllIFyuQ1tFGkU11498tfVWf86A/2YRoNS9RLiCAGlqxu1VrhHqb6+Bd53G2Q0ACcHM3sEpLFpZd9vjAPCmvN7gyQK4+9XoWTN5FwY6gB1pXiqdJMAaSnL47zj1yx7FWHSLFXUTzgjYWQ/xu2KSFIl3MryGG6DApmR8PHje0b0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779188631; c=relaxed/simple; bh=Mpcye3kRhq+WMdLbalrx78CMcPUnzAqavHvmwN1CRiE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PubV6USQiLSvkM3ZEyNPXJHpTXy3F60ABS4eI83bbSehMHT4k9i2tOvQFnVom8nbQGHuieilMWbDqgVu/eVRwSEdGALLZ4vDtBAQw7IKVl72wwIBT6jMc0OZtuquV1MuIEOx693/9Bif1mb9Qmafn40GERn+vo606XxM2NPdZJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=JYlCogF/; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JYlCogF/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779188627; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b+nv1tub1dRAw9uatvTRVsJrEgTvrLTIAT2v4860xNk=; b=JYlCogF/MVOY8g0ZRq4eCSQ27/w3oiBVY+it4cLPG0PhMlwONr6mR1ExhjAgul3gFuzdwJ mvY0G3SBkqLg1vN4/4gvQ4lk4+gKO4ezYKIe0SvpaS1IG2XigKXjGTi6Vm3I4oetlY9iCB PYKa7y01dtBKSJkVOZ8OqODM9RYGRms= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-540-2LJwBOu4MgKs3FJuIs4QDQ-1; Tue, 19 May 2026 07:03:43 -0400 X-MC-Unique: 2LJwBOu4MgKs3FJuIs4QDQ-1 X-Mimecast-MFC-AGG-ID: 2LJwBOu4MgKs3FJuIs4QDQ_1779188622 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4D720195609E; Tue, 19 May 2026 11:03:42 +0000 (UTC) Received: from [192.168.1.153] (headnet01.pony-001.prod.iad2.dc.redhat.com [10.2.32.101]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1CED530001A2; Tue, 19 May 2026 11:03:39 +0000 (UTC) From: Albert Esteve Date: Tue, 19 May 2026 13:03:13 +0200 Subject: [PATCH v4 3/4] selftests: cgroup: Add vmtest-dmem runner script Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260519-kunit_cgroups-v4-3-f6c2f498fae4@redhat.com> References: <20260519-kunit_cgroups-v4-0-f6c2f498fae4@redhat.com> In-Reply-To: <20260519-kunit_cgroups-v4-0-f6c2f498fae4@redhat.com> To: Tejun Heo , Johannes Weiner , =?utf-8?q?Michal_Koutn=C3=BD?= , Shuah Khan Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, Albert Esteve , mripard@kernel.org, echanude@redhat.com X-Developer-Signature: v=1; a=ed25519-sha256; t=1779188611; l=5973; i=aesteve@redhat.com; s=20260303; h=from:subject:message-id; bh=Mpcye3kRhq+WMdLbalrx78CMcPUnzAqavHvmwN1CRiE=; b=O+xEp6IaYYDJ9/wfyTRUh33qAvPvCjW6tVn0eFsQl4ne4wsJ170HmtHr384pfzCovV0tGLhE1 YPe9aIwLD3dCetL0PaPksTtRr8KdHeeaTc3Wo5i0A5jcRgcB8vlZZiS X-Developer-Key: i=aesteve@redhat.com; a=ed25519; pk=YSFz6sOHd2L45+Fr8DIvHTi6lSIjhLZ5T+rkxspJt1s= X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 Currently, test_dmem relies on the dmem_selftest helper module and a VM setup that may not have the helper preinstalled. This makes automated coverage of dmem charge paths harder in virtme-based runs. Add tools/testing/selftests/cgroup/vmtest-dmem.sh to provide a repeatable VM workflow for dmem tests. The script uses vng --exec to run the test directly inside a virtme-ng guest with minimal setup. The script boots a virtme-ng guest, validates dmem controller availability, ensures the dmem helper path is present, and runs tools/testing/selftests/cgroup/test_dmem. If the helper is not available as a loaded module, it attempts module build/load for the running guest kernel before executing the test binary. The runner also supports interactive shell mode (-s) and reuses the verbosity and KTAP exit-code conventions used by other vmtest scripts, so it integrates with existing kselftest workflows. Signed-off-by: Albert Esteve --- tools/testing/selftests/cgroup/Makefile | 2 +- tools/testing/selftests/cgroup/vmtest-dmem.sh | 156 ++++++++++++++++++++++++++ 2 files changed, 157 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/cgroup/Makefile b/tools/testing/selftests/cgroup/Makefile index e1a5e9316620e..2c407710c6e3b 100644 --- a/tools/testing/selftests/cgroup/Makefile +++ b/tools/testing/selftests/cgroup/Makefile @@ -3,7 +3,7 @@ CFLAGS += -Wall -pthread all: ${HELPER_PROGS} -TEST_FILES := with_stress.sh +TEST_FILES := with_stress.sh vmtest-dmem.sh TEST_PROGS := test_stress.sh test_cpuset_prs.sh test_cpuset_v1_hp.sh TEST_GEN_FILES := wait_inotify # Keep the lists lexicographically sorted diff --git a/tools/testing/selftests/cgroup/vmtest-dmem.sh b/tools/testing/selftests/cgroup/vmtest-dmem.sh new file mode 100755 index 0000000000000..b395b7153f635 --- /dev/null +++ b/tools/testing/selftests/cgroup/vmtest-dmem.sh @@ -0,0 +1,156 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0 +# +# Copyright (c) 2026 Red Hat, Inc. +# +# Run cgroup test_dmem inside a virtme-ng VM. +# Dependencies: +# * virtme-ng +# * qemu (used by virtme-ng) + +set -euo pipefail + +readonly SCRIPT_DIR="$(cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)" +readonly KERNEL_CHECKOUT="$(realpath "${SCRIPT_DIR}"/../../../../)" + +source "${SCRIPT_DIR}"/../kselftest/ktap_helpers.sh + +QEMU="qemu-system-$(uname -m)" +VERBOSE=0 +SHELL_MODE=0 +GUEST_TREE="${GUEST_TREE:-$KERNEL_CHECKOUT}" + +VM_SCRIPT="" + +function usage() { + cat </dev/null 2>&1; then + skip "dependency ${dep} not found" + fi + done +} + +# Run vng with common flags. Extra arguments are appended by the caller: +# --exec