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 4DAB0424640 for ; Mon, 6 Jul 2026 12:09:02 +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=1783339743; cv=none; b=KagmtID2LFiDdLgj5u9Q3LhQeyBKNrrAnMvdGLDoAIjP+luK4SZx+U9QWphsIdtUSWVAXl0DZ+2vLQNsV25NLwUAi0MTOtTij7ugIGFHytUmEwMTFptk2Q8MUyPTRCcvh1w6USF8CeekzFGTBwxgmdqKGIotqtmEbmS+U2y1bX4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783339743; c=relaxed/simple; bh=VmnDr3qErC3DLN3zFRiCIeAQykb+tE5T9DfedoNui9s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=keWQwUmECF+pdE9R3as9J8SA2jBSEMy4Ek9mNCvJHmaEqRFqpWRqDj/ZyYvFNEQ7zV/Ykki+3qgW+/mbtUHZ2rQcDypvPxuv5uRSKGdp1rL6hrVCxZ8eQ/OZHXwvtmV+DgG5OYHEZ6jKdaYIwk/Z+zia75l8XldZxtSU1/X+dZc= 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=Ex7MYkkl; 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="Ex7MYkkl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783339741; 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=5W8myF8gVramz/adpN83H9hljq2x0AroHhv3246gxJs=; b=Ex7MYkklVFFLL+aFrMrT2Hdjmzq/Q8U9G7P9sZfDm0GF2NiavD1ZX+ZgrQv2pMGQYZ9Lzl X73/5j2N1fnY8aXdd6zdBgTFIaI1E1F9DeKyZlOUgitHJ/PPQnn/+g2Xs7tfU4ENx9l/zn Z9nbx3KAdCPdxHwuo0yysE7TraWy9bo= Received: from mx-prod-mc-01.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-556-QvPLHbehNHeTz52IGAMong-1; Mon, 06 Jul 2026 08:07:34 -0400 X-MC-Unique: QvPLHbehNHeTz52IGAMong-1 X-Mimecast-MFC-AGG-ID: QvPLHbehNHeTz52IGAMong_1783339653 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 8FF9F195FDE4; Mon, 6 Jul 2026 12:07:04 +0000 (UTC) Received: from [192.168.1.153] (headnet05.pony-001.prod.iad2.dc.redhat.com [10.2.32.117]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 719D81800591; Mon, 6 Jul 2026 12:07:02 +0000 (UTC) From: Albert Esteve Date: Mon, 06 Jul 2026 14:06:42 +0200 Subject: [PATCH v5 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: <20260706-kunit_cgroups-v5-3-6c42c8753468@redhat.com> References: <20260706-kunit_cgroups-v5-0-6c42c8753468@redhat.com> In-Reply-To: <20260706-kunit_cgroups-v5-0-6c42c8753468@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 X-Developer-Signature: v=1; a=ed25519-sha256; t=1783339614; l=6076; i=aesteve@redhat.com; s=20260303; h=from:subject:message-id; bh=VmnDr3qErC3DLN3zFRiCIeAQykb+tE5T9DfedoNui9s=; b=pn7EVPAy4wIbO+OgowDQcLrVcKVpjLtm2redIdNZs4eDUOs6Rri26b3dwDSc1FbRLM+LN9O9e xh69X587Pv+AxxNx7wwmhO3oEeb0tXdxoR50d806S8ZTZ/bzM+ZNSYF X-Developer-Key: i=aesteve@redhat.com; a=ed25519; pk=YSFz6sOHd2L45+Fr8DIvHTi6lSIjhLZ5T+rkxspJt1s= X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 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. vmtest-dmem.sh is placed in TEST_FILES rather than TEST_PROGS so it is installed alongside the test suite but not invoked automatically by run_kselftest.sh. It requires a VM-capable host and is intended to be run manually. Signed-off-by: Albert Esteve --- tools/testing/selftests/cgroup/Makefile | 2 +- tools/testing/selftests/cgroup/vmtest-dmem.sh | 149 ++++++++++++++++++++++++++ 2 files changed, 150 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..0bb6529112b54 --- /dev/null +++ b/tools/testing/selftests/cgroup/vmtest-dmem.sh @@ -0,0 +1,149 @@ +#!/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